epic-modals 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/utils.d.ts +7 -0
- package/dist/core.js +1 -0
- package/dist/index.js +1 -1
- package/dist/react/Dock.d.ts +2 -5
- package/dist/react/Modal.d.ts +2 -4
- package/dist/react.d.ts +2 -3
- package/dist/react.js +1 -1
- package/dist/runtime.js +1 -0
- package/dist/styles/modal.css +1 -1
- package/dist/styles/themes/light.css +1 -1
- package/dist/styles/variables.css +1 -1
- package/dist/svelte/Backdrop.svelte.d.ts +1 -0
- package/dist/svelte/Dock.svelte.d.ts +1 -0
- package/dist/svelte/Modal.svelte.d.ts +1 -0
- package/dist/svelte/ModalHeader.svelte.d.ts +1 -0
- package/dist/svelte/ModalInner.svelte.d.ts +1 -0
- package/dist/svelte/ModalProvider.svelte.d.ts +1 -0
- package/dist/svelte/Portal.svelte.d.ts +1 -0
- package/dist/svelte/ResizeHandles.svelte.d.ts +1 -0
- package/dist/svelte/actions/appendElement.d.ts +9 -0
- package/dist/svelte/hooks/useModal.svelte.d.ts +1 -1
- package/dist/svelte/hooks/useModalZIndex.svelte.d.ts +1 -1
- package/dist/svelte.d.ts +0 -1
- package/dist/svelte.js +1 -1
- package/dist/ui.js +1 -0
- package/dist/vanilla.js +1 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A stunning modal library with macOS-style animations, drag, resize, and dock. Supports Svelte 5, React, and vanilla JavaScript.
|
|
4
4
|
|
|
5
|
-
**[Live Demo](https://epicmodals.eu)**
|
|
5
|
+
**[Live Demo](https://epicmodals.eu)** · **[NPM](https://www.npmjs.com/package/epic-modals)**
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
package/dist/core/index.d.ts
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ModalId } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Convert a modal ID (string or Symbol) to a string suitable for DOM attributes
|
|
4
|
+
* Symbols are converted using their description property
|
|
5
|
+
*/
|
|
6
|
+
export declare function toDataId(id: ModalId): string;
|
|
7
|
+
//# sourceMappingURL=utils.d.ts.map
|
package/dist/core.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from"svelte/internal/client";const e={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};let n=t.state(t.proxy(e.MODAL));function i(){t.set(n,oe().zIndex.base,!0)}function s(){const e=t.get(n);return t.set(n,t.get(n)+2),e}function o(t){const n=oe();return"MODAL"===t?n.zIndex.base:"DOCK"===t?n.zIndex.dock:"TOAST"===t?n.zIndex.toast:e[t]}function a(){t.set(n,oe().zIndex.base,!0)}const r=8;function d(t,e,n,i,s={}){const{margin:o=r,allowPartialVisibility:a=!1}=s,d="undefined"!=typeof window?window.innerWidth:1920,c="undefined"!=typeof window?window.innerHeight:1080;let u,l,f,g;return a&&n>d-2*o?(u=40-n,l=d-40):(u=o,l=Math.max(o,d-n-o)),a&&i>c-2*o?(f=40-i,g=c-40):(f=o,g=Math.max(o,c-i-o)),{x:Math.max(u,Math.min(l,t)),y:Math.max(f,Math.min(g,e))}}function c(t,e,n,i,s={}){const{margin:o=r}=s,a=("undefined"!=typeof window?window.innerWidth:1920)-2*o,c=("undefined"!=typeof window?window.innerHeight:1080)-2*o,u=Math.min(n,a),l=Math.min(i,c),f=d(t,e,u,l,s);return{x:f.x,y:f.y,width:u,height:l}}function u(t,e){return Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x))*Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y))}function l(t,e,n,i,s,o){const a={x:t-o,y:e-o,width:n+2*o,height:i+2*o};let r=0;for(const t of s)r+=u(a,t);return r}function f(t){if("undefined"==typeof document)return[];const e=[];for(const n of t)try{const t=document.querySelectorAll(n);for(const n of t){const t=n.getBoundingClientRect();t.width>0&&t.height>0&&e.push({x:t.left,y:t.top,width:t.width,height:t.height})}}catch{}return e}function g(t,e,n,i,s,o,a){const r=(s-n)/2,d=(o-i)/2,c=r-a,u=d-a,l=Math.abs(t-r)/(c||1),f=Math.abs(e-d)/(u||1),g=Math.sqrt(l*l+f*f)/Math.SQRT2,h=50,p=t-a,m=s-n-a-t,x=e-a,I=o-i-a-e;let y=0;return p<h&&(y+=.3*(1-p/h)),m<h&&(y+=.3*(1-m/h)),x<h&&(y+=.2*(1-x/h)),I<h&&(y+=.2*(1-I/h)),Math.min(1,g+y)}function h(t,e,n,i={}){const{modalGap:s=16,gridResolution:o=10,avoidBounds:a=[],avoidMargin:r=16}=i,d=i.margin??s,c="undefined"!=typeof window?window.innerWidth:1920,u="undefined"!=typeof window?window.innerHeight:1080,f=a.map(t=>({x:t.x-r,y:t.y-r,width:t.width+2*r,height:t.height+2*r})),h={x:(c-t)/2,y:(u-e)/2};if(0===n.length&&0===f.length)return h;const p=d,m=Math.max(d,c-t-d),x=d,I=Math.max(d,u-e-d);if(m<=p||I<=x)return h;const y=l(h.x,h.y,t,e,n,s),w=l(h.x,h.y,t,e,f,0);if(0===y&&0===w)return h;const z=[],M=(m-p)/o,v=(I-x)/o;for(let i=0;i<=o;i++)for(let a=0;a<=o;a++){const o=p+i*M,r=x+a*v,h=l(o,r,t,e,n,s),m=l(o,r,t,e,f,0),I=g(o,r,t,e,c,u,d);z.push({pos:{x:o,y:r},modalOverlap:h,avoidOverlap:m,centerDist:I})}const O=z.filter(t=>0===t.avoidOverlap),P=O.length>0?O:z,C=t*e,D=Math.min(...P.map(t=>t.modalOverlap))/C;return P.sort((t,e)=>{if(0===O.length&&t.avoidOverlap!==e.avoidOverlap)return t.avoidOverlap-e.avoidOverlap;const n=t.modalOverlap/C,i=e.modalOverlap/C;if(D<.3){const s=.3,o=n<=s,a=i<=s;if(o&&a)return t.centerDist+.3*n-(e.centerDist+.3*i);if(o)return-1;if(a)return 1}return.6*n+.4*t.centerDist-(.6*i+.4*e.centerDist)}),P[0].pos}function p(t,e,n,i={}){const{modalGap:s=16}=i,o=i.margin??s,a="undefined"!=typeof window?window.innerWidth:1920,r="undefined"!=typeof window?window.innerHeight:1080,d=n.reduce((t,e)=>t+e.width,0)+t,c=n.length*s,u=a-2*o;if(d+c>u)return null;const l=u-d-c;n.length;const f=l/2,g=a/2,h=[...n.map(t=>({id:t.id,width:t.width,height:t.height,currentX:t.x+t.width/2,currentY:t.y,isNew:!1})),{id:"__new__",width:t,height:e,currentX:g,currentY:(r-e)/2,isNew:!0}];h.sort((t,e)=>t.currentX-e.currentX);let p=o+f;const m=new Map;let x=null;for(const t of h){const e=p;if(t.isNew)x={x:Math.round(e),y:Math.round(t.currentY)};else{const i=n.find(e=>e.id===t.id);Math.abs(e-i.x)>5&&m.set(t.id,{x:Math.round(e),y:Math.round(i.y)})}p+=t.width+s}return x?{newModalPosition:x,existingModalMoves:m}:null}function m(t){return"symbol"==typeof t?t.description??"symbol":t}let x=t.proxy(new Map),I=t.state(0);const y=new Set;function w(){t.update(I),queueMicrotask(()=>{y.forEach(t=>t())})}function z(t){return y.add(t),()=>y.delete(t)}let M=t.state(t.proxy([])),v=t.state(t.proxy([])),O=t.state(t.proxy([])),P=t.state(t.proxy([])),C=t.state(t.proxy([])),D=t.state(t.proxy([])),k=t.state(t.proxy([])),b=t.state(t.proxy([])),A=t.state(null),T=t.proxy(new Map),F=t.state(null),W=t.proxy(new Map),H=t.proxy(new Set),B=t.proxy(new Set),R=t.state(t.proxy([])),S=null,X=null;function E(e){const n=x.get(e.id),i=(null==n?void 0:n.zIndex)??s();n?x.set(e.id,{...n,title:e.title,icon:e.icon,glow:e.glow,zIndex:i}):x.set(e.id,{...e,zIndex:i,isAnimating:!1}),w(),e.isMinimized&&!t.get(R).includes(e.id)&&t.get(R).push(e.id)}function q(e){const n=x.get(e);if(n){if(t.set(R,t.get(R).filter(t=>t!==e),!0),n.childId){const t=x.get(n.childId);t&&x.set(n.childId,{...t,parentId:void 0})}if(n.parentId){const t=x.get(n.parentId);t&&x.set(n.parentId,{...t,childId:void 0,lastChildId:n.id})}x.delete(e),w(),B.delete(e),H.delete(e)}}function Y(e){const n=x.get(e);if(!n||n.isMinimized)return;if(jt(e),n.parentId){const t=x.get(n.parentId);if(t&&!t.isMinimized)return void Y(n.parentId)}if(t.set(M,[...t.get(M),e],!0),n.position&&n.size&&X){const i=X(),s=t.get(R).indexOf(e),o=i.x+s*(i.height+8),a=i.y;t.set(A,{x:o,y:a,originX:n.position.x+n.size.width/2,originY:n.position.y+n.size.height/2},!0)}const i=n.childId;x.set(e,{...n,isMinimized:!0,lastChildId:i}),w(),t.get(R).includes(e)||t.get(R).push(e),n.childId&&ot(e)}function L(e){const n=x.get(e);if(!n||!n.isMinimized)return;x.set(e,{...n,isMinimized:!1,isOpen:!0}),w(),t.set(C,[...t.get(C),e],!0),V(e);const i=n.lastChildId||n.childId;i&&_(i)}function N(){Array.from(x.values()).filter(t=>t.isMinimized).map(t=>t.id).forEach(e=>{const n=x.get(e);if(n){x.set(e,{...n,isMinimized:!1,isOpen:!0}),t.set(C,[...t.get(C),e],!0),V(e);const i=n.lastChildId||n.childId;i&&_(i)}}),t.set(R,[],!0),w()}function _(e){const n=x.get(e);n&&n.isHiddenWithParent&&(x.set(e,{...n,isHiddenWithParent:!1}),w(),t.set(D,[...t.get(D),e],!0))}function G(t,e,n){const i=x.get(t);if(!i)return;let s=e;if((null==n?void 0:n.constrain)&&i.size&&(s=d(e.x,e.y,i.size.width,i.size.height)),x.set(t,{...i,position:s,size:(null==n?void 0:n.size)??i.size,hasBeenDragged:i.hasBeenDragged||(null==n?void 0:n.drag)||!1}),i.childId){let e=t,n=s;for(;;){const t=x.get(e);if(!(null==t?void 0:t.childId))break;const i=x.get(t.childId);if(!(null==i?void 0:i.offsetFromParent))break;const s={x:n.x+i.offsetFromParent.x,y:n.y+i.offsetFromParent.y};x.set(t.childId,{...i,position:s,hasBeenDragged:!0}),e=t.childId,n=s}}if(i.parentId&&i.offsetFromParent){const e=oe();let n=t,o=i;for(;o.parentId&&o.offsetFromParent;){const i=x.get(o.parentId);if(!i)break;const a=n===t?s:x.get(n).position,r={x:a.x-o.offsetFromParent.x,y:a.y-o.offsetFromParent.y};"animated"===e.parentChild.movementMode?W.set(o.parentId,r):x.set(o.parentId,{...i,position:r,hasBeenDragged:!0}),n=o.parentId,o=i}}w()}function K(t,e){const n=x.get(t);n&&(x.set(t,{...n,size:e}),w())}function j(t,e){const n=x.get(t);n&&(x.set(t,{...n,...e}),w())}function V(t){var e;const n=x.get(t);if(!n)return;const i=Math.max(...Array.from(x.values()).map(t=>t.zIndex),0);if(n.parentId){const s=x.get(n.parentId);s&&s.zIndex<i&&x.set(n.parentId,{...s,zIndex:i+2});const o=(null==(e=x.get(n.parentId))?void 0:e.zIndex)??i+2;return n.zIndex<=o&&x.set(t,{...n,zIndex:o+2}),void w()}if(n.zIndex<i&&(x.set(t,{...n,zIndex:i+2}),w()),n.childId){const e=x.get(n.childId),i=x.get(t);e&&i&&e.zIndex<=i.zIndex&&(x.set(n.childId,{...e,zIndex:i.zIndex+2}),w())}}function $(t){const e=x.get(t);if(!e)return!1;const n=Math.max(...Array.from(x.values()).map(t=>t.zIndex),0);return e.zIndex===n&&!e.isMinimized&&!e.isHiddenWithParent}function Q(e){t.set(R,e,!0)}function J(e,n,i){const s=n.getBoundingClientRect();T.set(e,{x:s.left+s.width/2,y:s.top+s.height/2});const o=oe();(null==i?void 0:i.parentId)&&o.features.parentChild&&t.set(F,{parentId:i.parentId,childId:e},!0),t.get(v).includes(e)||t.set(v,[...t.get(v),e],!0),w();const a=x.get(e);if(a){if(a.isOpen&&!a.isMinimized&&!a.isHiddenWithParent)return t.set(v,t.get(v).filter(t=>t!==e),!0),bt(e),void V(e);if(a.isMinimized)return t.set(v,t.get(v).filter(t=>t!==e),!0),void L(e);x.set(e,{...a,isOpen:!0}),V(e),null==S||S.push(e)}}function U(e){E(e);const n=x.get(e.id);n&&(x.set(e.id,{...n,isOpen:!0}),w()),t.set(v,[...t.get(v),e.id],!0),w(),V(e.id),null==S||S.push(e.id)}function Z(e,n=!1){const i=x.get(e);i&&(jt(e),n?t.set(P,[...t.get(P),e],!0):t.set(O,[...t.get(O),e],!0),w(),i.childId&&Z(i.childId,n),null==S||S.pop())}function tt(){Array.from(x.keys()).forEach(t=>Z(t,!0))}function et(t){const e=x.get(t);if(e){if(e.parentId){const n=x.get(e.parentId);n&&n.childId===t&&x.set(e.parentId,{...n,childId:void 0,lastChildId:t})}x.set(t,{...e,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),w()}}function nt(t){const e=x.get(t);if(!e)return[t];const n=[t];return e.childId&&n.push(...nt(e.childId)),n}function it(e,n,i){const s=oe();if(i&&!T.has(e.id)){const t=i.getBoundingClientRect();T.set(e.id,{x:t.left+t.width/2,y:t.top+t.height/2})}const o={id:e.id,title:e.title??"",icon:e.icon??"",isOpen:!0,isMinimized:!1,isHiddenWithParent:!1,isTransparent:e.isTransparent??!1,isRejected:!1,position:e.position??null,size:e.size??null,hasBeenDragged:e.hasBeenDragged??!1,dockPosition:e.dockPosition??-1,glow:e.glow??null};if(!s.features.parentChild){E(o);const n=x.get(e.id);return n&&x.set(e.id,{...n,isOpen:!0}),t.set(v,[...t.get(v),e.id],!0),w(),void V(e.id)}const a=x.get(n);if(!a)return;a.childId&&Z(a.childId,!0),E({...o,parentId:n});const r=x.get(e.id);r&&x.set(e.id,{...r,isOpen:!0,parentId:n}),t.set(v,[...t.get(v),e.id],!0),w(),V(e.id),t.set(F,{parentId:n,childId:e.id},!0)}function st(t,e){if(!oe().features.parentChild)return;const n=x.get(t),i=x.get(e);if(!n||!i)return;let s={x:40,y:40};n.position&&i.position&&(s={x:i.position.x-n.position.x,y:i.position.y-n.position.y});const o=Math.max(i.zIndex,n.zIndex+1);x.set(t,{...n,childId:e,lastChildId:e}),x.set(e,{...i,parentId:t,offsetFromParent:s,zIndex:o}),w()}function ot(t){const e=x.get(t);if(!(null==e?void 0:e.childId))return;const n=x.get(e.childId);n&&(x.set(e.childId,{...n,isHiddenWithParent:!0}),w())}function at(t,e){const n=x.get(t);if(!(null==n?void 0:n.childId))return;const i=x.get(n.childId);if(!i||!i.offsetFromParent)return;const s={x:e.x+i.offsetFromParent.x,y:e.y+i.offsetFromParent.y};x.set(n.childId,{...i,position:s}),w()}function rt(t,e){const n=x.get(t),i=x.get(e);if(!(null==n?void 0:n.position)||!(null==i?void 0:i.position))return;const s={x:n.position.x-i.position.x,y:n.position.y-i.position.y};x.set(t,{...n,offsetFromParent:s}),w()}function dt(e){return t.get(M).includes(e)}function ct(e){return!!t.get(M).includes(e)&&(t.set(M,t.get(M).filter(t=>t!==e),!0),!0)}function ut(){return t.get(M).length>0}function lt(){return Array.from(x.keys())}function ft(t){return x.get(t)}function gt(t){const e=[];for(const[n,i]of x.entries())if(n!==t&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent&&!i.parentId)if(i.position&&i.size)e.push({id:m(n),x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const t=document.querySelector(`[data-modal-id="${m(n)}"]`);if(t){const i=t.getBoundingClientRect();e.push({id:m(n),x:i.left,y:i.top,width:i.width,height:i.height})}}return e}function ht(t){const e=[];for(const[n,i]of x.entries())if(n!==t&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent)if(i.position&&i.size)e.push({x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const t=document.querySelector(`[data-modal-id="${m(n)}"]`);if(t){const n=t.getBoundingClientRect();e.push({x:n.left,y:n.top,width:n.width,height:n.height})}}return e}function pt(){return t.get(I)}function mt(){const e=t.get(A);return t.set(A,null),e}function xt(e){return t.get(v).includes(e)}function It(e){return!!t.get(v).includes(e)&&(t.set(v,t.get(v).filter(t=>t!==e),!0),!0)}function yt(e){return t.get(O).includes(e)}function wt(e){return!!t.get(O).includes(e)&&(t.set(O,t.get(O).filter(t=>t!==e),!0),!0)}function zt(e){return t.get(P).includes(e)}function Mt(e){return!!t.get(P).includes(e)&&(t.set(P,t.get(P).filter(t=>t!==e),!0),!0)}function vt(e){return t.get(C).includes(e)}function Ot(e){return!!t.get(C).includes(e)&&(t.set(C,t.get(C).filter(t=>t!==e),!0),!0)}function Pt(e){return t.get(D).includes(e)}function Ct(e){return!!t.get(D).includes(e)&&(t.set(D,t.get(D).filter(t=>t!==e),!0),!0)}function Dt(e){return t.get(k).includes(e)}function kt(e){return!!t.get(k).includes(e)&&(t.set(k,t.get(k).filter(t=>t!==e),!0),!0)}function bt(e){x.get(e)&&(t.get(k).includes(e)||t.get(b).includes(e)||(t.set(k,[...t.get(k),e],!0),w()))}function At(e){t.get(b).includes(e)||t.set(b,[...t.get(b),e],!0)}function Tt(e){t.set(b,t.get(b).filter(t=>t!==e),!0)}function Ft(){return t.get(F)}function Wt(e){if(!t.get(F)||t.get(F).childId!==e)return null;const n=t.get(F);return t.set(F,null),n}function Ht(t,e){T.set(t,e)}function Bt(t){const e=T.get(t);return e&&T.delete(t),e??null}function Rt(t,e){e?H.add(t):H.delete(t)}function St(t){return H.has(t)}function Xt(t){const e=x.get(t);return void 0!==e&&e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent}function Et(t){return x.has(t)}function qt(){return{get modals(){return x},get pendingMinimize(){return t.get(M)},get pendingOpen(){return t.get(v)},get pendingClose(){return t.get(O)},get pendingRestore(){return t.get(C)},get dockOrder(){return t.get(R)}}}function Yt(t){B.has(t)?B.delete(t):B.add(t);const e=x.get(t);e&&(x.set(t,{...e,isTransparent:B.has(t)}),w())}function Lt(t){B.delete(t);const e=x.get(t);e&&(x.set(t,{...e,isTransparent:!1}),w())}function Nt(t){t.animate([{transform:"translateX(0)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(0)"}],{duration:300,easing:"ease-in-out"})}function _t(t){const e=W.get(t);if(!e)return;const n=x.get(t);n&&(x.set(t,{...n,isAnimatingPosition:!0,position:e}),W.delete(t),w())}function Gt(t){const e=x.get(t);e&&(x.set(t,{...e,isAnimatingPosition:!1}),w())}function Kt(t){return W.has(t)}function jt(t){W.delete(t)}function Vt(t){const e=oe().parentChild.animationDuration;for(const[e,n]of t){const t=x.get(e);t&&x.set(e,{...t,position:n,isAnimatingPosition:!0,hasBeenDragged:!0})}w(),setTimeout(()=>{for(const e of t.keys()){const t=x.get(e);t&&x.set(e,{...t,isAnimatingPosition:!1})}w()},e)}function $t(t){const e=oe();if("animated"!==e.parentChild.movementMode)return;const n=e.parentChild.animationDuration,i=[];let s=t;for(;;){const t=x.get(s);if(!(null==t?void 0:t.parentId))break;i.push({parentId:t.parentId,childId:s}),s=t.parentId}i.forEach(({parentId:t,childId:e},i)=>{setTimeout(()=>{const i=x.get(e),s=x.get(t);if(!(null==i?void 0:i.position)||!i.offsetFromParent||!s)return;const o={x:i.position.x-i.offsetFromParent.x,y:i.position.y-i.offsetFromParent.y};W.set(t,o),_t(t),setTimeout(()=>Gt(t),n)},i*n)})}function Qt(t){}function Jt(t){S=t}function Ut(t){X=t}function Zt(){return{modals:x,pendingMinimize:t.get(M),pendingOpen:t.get(v),pendingClose:t.get(O),pendingRestore:t.get(C),dockOrder:t.get(R),animatingModals:H,transparentModals:B}}function te(){x.clear(),t.get(M).length=0,t.get(v).length=0,t.get(O).length=0,t.get(P).length=0,t.get(C).length=0,t.get(D).length=0,t.set(A,null),T.clear(),t.set(F,null),W.clear(),H.clear(),B.clear(),t.get(R).length=0,S=null,X=null}const ee={features:{dock:!0,minimize:!0,transparency:!0,resize:!0,drag:!0,focusTrap:!0,animations:!0,backdrop:!0,parentChild:!0},dock:{position:"bottom",labelMode:"beside",enableReorder:!0,enableFreeDrag:!0},animations:{open:400,close:250,minimize:500,restore:400},appearance:{headerLayout:"macos",defaultWidth:"480px",defaultHeight:"auto",minWidth:280,minHeight:200},zIndex:{base:400,dock:8e3,toast:9e3},parentChild:{movementMode:"animated",animationDuration:300},positioning:{strategy:"smart",modalGap:16,avoidElements:[]},portalTarget:"#modal-portal"};let ne={...ee},ie=t.state(0);function se(){return t.get(ie)}function oe(){return ne}function ae(e){const n=ne;ne=de(ee,e),t.update(ie),n.features.dock&&!ne.features.dock&&N()}function re(){ne={...ee},t.update(ie)}function de(t,e){return{features:{...t.features,...e.features},dock:{...t.dock,...e.dock},animations:{...t.animations,...e.animations},appearance:{...t.appearance,...e.appearance},zIndex:{...t.zIndex,...e.zIndex},parentChild:{...t.parentChild,...e.parentChild},positioning:{...t.positioning,...e.positioning},portalTarget:e.portalTarget??t.portalTarget}}function ce(t){return ne.features[t]}export{st as $,Mt as A,mt as B,j as C,ct as D,Ot as E,Ct as F,wt as G,et as H,xt as I,It as J,Bt as K,Dt as L,kt as M,At as N,Tt as O,Wt as P,Ft as Q,ht as R,f as S,h as T,l as U,gt as V,p as W,Vt as X,E as Y,$ as Z,Yt as _,Xt as a,o as a0,qt as a1,St as a2,Nt as a3,ae as a4,i as a5,re as a6,a as a7,ee as a8,de as a9,g as aA,z as aa,N as ab,_ as ac,K as ad,Q as ae,U as af,tt as ag,nt as ah,ot as ai,at as aj,rt as ak,ut as al,lt as am,Ht as an,Rt as ao,_t as ap,Gt as aq,Kt as ar,jt as as,Qt as at,Jt as au,Ut as av,Zt as aw,te as ax,s as ay,u as az,J as b,Z as c,V as d,d as e,c as f,oe as g,m as h,Et as i,ft as j,se as k,pt as l,Y as m,yt as n,it as o,dt as p,Pt as q,L as r,vt as s,bt as t,Lt as u,q as v,ce as w,G as x,$t as y,zt as z};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"svelte/internal/client";const e={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};let n=t.state(t.proxy(e.MODAL));function i(){t.set(n,oe().zIndex.base,!0)}function o(){const e=t.get(n);return t.set(n,t.get(n)+2),e}function r(t){const n=oe();return"MODAL"===t?n.zIndex.base:"DOCK"===t?n.zIndex.dock:"TOAST"===t?n.zIndex.toast:e[t]}function s(){t.set(n,oe().zIndex.base,!0)}const d=8;function a(t,e,n,i,o={}){const{margin:r=d,allowPartialVisibility:s=!1}=o,a="undefined"!=typeof window?window.innerWidth:1920,c="undefined"!=typeof window?window.innerHeight:1080;let u,l,f,g;return s&&n>a-2*r?(u=40-n,l=a-40):(u=r,l=Math.max(r,a-n-r)),s&&i>c-2*r?(f=40-i,g=c-40):(f=r,g=Math.max(r,c-i-r)),{x:Math.max(u,Math.min(l,t)),y:Math.max(f,Math.min(g,e))}}function c(t,e,n,i,o={}){const{margin:r=d}=o,s=("undefined"!=typeof window?window.innerWidth:1920)-2*r,c=("undefined"!=typeof window?window.innerHeight:1080)-2*r,u=Math.min(n,s),l=Math.min(i,c),f=a(t,e,u,l,o);return{x:f.x,y:f.y,width:u,height:l}}function u(t,e){return Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x))*Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y))}function l(t,e,n,i,o,r){const s={x:t-r,y:e-r,width:n+2*r,height:i+2*r};let d=0;for(const t of o)d+=u(s,t);return d}function f(t){if("undefined"==typeof document)return[];const e=[];for(const n of t)try{const t=document.querySelectorAll(n);for(const n of t){const t=n.getBoundingClientRect();t.width>0&&t.height>0&&e.push({x:t.left,y:t.top,width:t.width,height:t.height})}}catch{}return e}function g(t,e,n,i,o,r,s){const d=(o-n)/2,a=(r-i)/2,c=d-s,u=a-s,l=Math.abs(t-d)/(c||1),f=Math.abs(e-a)/(u||1),g=Math.sqrt(l*l+f*f)/Math.SQRT2,h=50,p=t-s,m=o-n-s-t,x=e-s,I=r-i-s-e;let y=0;return p<h&&(y+=.3*(1-p/h)),m<h&&(y+=.3*(1-m/h)),x<h&&(y+=.2*(1-x/h)),I<h&&(y+=.2*(1-I/h)),Math.min(1,g+y)}function h(t,e,n,i={}){const{modalGap:o=16,gridResolution:r=10,avoidBounds:s=[],avoidMargin:d=16}=i,a=i.margin??o,c="undefined"!=typeof window?window.innerWidth:1920,u="undefined"!=typeof window?window.innerHeight:1080,f=s.map(t=>({x:t.x-d,y:t.y-d,width:t.width+2*d,height:t.height+2*d})),h={x:(c-t)/2,y:(u-e)/2};if(0===n.length&&0===f.length)return h;const p=a,m=Math.max(a,c-t-a),x=a,I=Math.max(a,u-e-a);if(m<=p||I<=x)return h;const y=l(h.x,h.y,t,e,n,o),w=l(h.x,h.y,t,e,f,0);if(0===y&&0===w)return h;const z=[],M=(m-p)/r,v=(I-x)/r;for(let i=0;i<=r;i++)for(let s=0;s<=r;s++){const r=p+i*M,d=x+s*v,h=l(r,d,t,e,n,o),m=l(r,d,t,e,f,0),I=g(r,d,t,e,c,u,a);z.push({pos:{x:r,y:d},modalOverlap:h,avoidOverlap:m,centerDist:I})}const O=z.filter(t=>0===t.avoidOverlap),P=O.length>0?O:z,C=t*e,D=Math.min(...P.map(t=>t.modalOverlap))/C;return P.sort((t,e)=>{if(0===O.length&&t.avoidOverlap!==e.avoidOverlap)return t.avoidOverlap-e.avoidOverlap;const n=t.modalOverlap/C,i=e.modalOverlap/C;if(D<.3){const o=.3,r=n<=o,s=i<=o;if(r&&s)return t.centerDist+.3*n-(e.centerDist+.3*i);if(r)return-1;if(s)return 1}return.6*n+.4*t.centerDist-(.6*i+.4*e.centerDist)}),P[0].pos}function p(t,e,n,i={}){const{modalGap:o=16}=i,r=i.margin??o,s="undefined"!=typeof window?window.innerWidth:1920,d="undefined"!=typeof window?window.innerHeight:1080,a=n.reduce((t,e)=>t+e.width,0)+t,c=n.length*o,u=s-2*r;if(a+c>u)return null;const l=u-a-c;n.length;const f=l/2,g=s/2,h=[...n.map(t=>({id:t.id,width:t.width,height:t.height,currentX:t.x+t.width/2,currentY:t.y,isNew:!1})),{id:"__new__",width:t,height:e,currentX:g,currentY:(d-e)/2,isNew:!0}];h.sort((t,e)=>t.currentX-e.currentX);let p=r+f;const m=new Map;let x=null;for(const t of h){const e=p;if(t.isNew)x={x:Math.round(e),y:Math.round(t.currentY)};else{const i=n.find(e=>e.id===t.id);Math.abs(e-i.x)>5&&m.set(t.id,{x:Math.round(e),y:Math.round(i.y)})}p+=t.width+o}return x?{newModalPosition:x,existingModalMoves:m}:null}let m=t.proxy(new Map),x=t.state(0);const I=new Set;function y(){t.update(x),queueMicrotask(()=>{I.forEach(t=>t())})}function w(t){return I.add(t),()=>I.delete(t)}let z=t.state(t.proxy([])),M=t.state(t.proxy([])),v=t.state(t.proxy([])),O=t.state(t.proxy([])),P=t.state(t.proxy([])),C=t.state(t.proxy([])),D=t.state(t.proxy([])),k=t.state(t.proxy([])),T=t.state(null),b=t.proxy(new Map),A=t.state(null),F=t.proxy(new Map),W=t.proxy(new Set),H=t.proxy(new Set),B=t.state(t.proxy([])),S=null,R=null;function X(e){const n=m.get(e.id),i=(null==n?void 0:n.zIndex)??o();n?m.set(e.id,{...n,title:e.title,icon:e.icon,glow:e.glow,zIndex:i}):m.set(e.id,{...e,zIndex:i,isAnimating:!1}),y(),e.isMinimized&&!t.get(B).includes(e.id)&&t.get(B).push(e.id)}function E(e){const n=m.get(e);if(n){if(t.set(B,t.get(B).filter(t=>t!==e),!0),n.childId){const t=m.get(n.childId);t&&m.set(n.childId,{...t,parentId:void 0})}if(n.parentId){const t=m.get(n.parentId);t&&m.set(n.parentId,{...t,childId:void 0,lastChildId:n.id})}m.delete(e),y(),H.delete(e),W.delete(e)}}function Y(e){const n=m.get(e);if(!n||n.isMinimized)return;if(Kt(e),n.parentId){const t=m.get(n.parentId);if(t&&!t.isMinimized)return void Y(n.parentId)}if(t.set(z,[...t.get(z),e],!0),n.position&&n.size&&R){const i=R(),o=t.get(B).indexOf(e),r=i.x+o*(i.height+8),s=i.y;t.set(T,{x:r,y:s,originX:n.position.x+n.size.width/2,originY:n.position.y+n.size.height/2},!0)}const i=n.childId;m.set(e,{...n,isMinimized:!0,lastChildId:i}),y(),t.get(B).includes(e)||t.get(B).push(e),n.childId&&ot(e)}function q(e){const n=m.get(e);if(!n||!n.isMinimized)return;m.set(e,{...n,isMinimized:!1,isOpen:!0}),y(),t.set(P,[...t.get(P),e],!0),V(e);const i=n.lastChildId||n.childId;i&&N(i)}function L(){Array.from(m.values()).filter(t=>t.isMinimized).map(t=>t.id).forEach(e=>{const n=m.get(e);if(n){m.set(e,{...n,isMinimized:!1,isOpen:!0}),t.set(P,[...t.get(P),e],!0),V(e);const i=n.lastChildId||n.childId;i&&N(i)}}),t.set(B,[],!0),y()}function N(e){const n=m.get(e);n&&n.isHiddenWithParent&&(m.set(e,{...n,isHiddenWithParent:!1}),y(),t.set(C,[...t.get(C),e],!0))}function _(t,e,n){const i=m.get(t);if(!i)return;let o=e;if((null==n?void 0:n.constrain)&&i.size&&(o=a(e.x,e.y,i.size.width,i.size.height)),m.set(t,{...i,position:o,size:(null==n?void 0:n.size)??i.size,hasBeenDragged:i.hasBeenDragged||(null==n?void 0:n.drag)||!1}),i.childId){let e=t,n=o;for(;;){const t=m.get(e);if(!(null==t?void 0:t.childId))break;const i=m.get(t.childId);if(!(null==i?void 0:i.offsetFromParent))break;const o={x:n.x+i.offsetFromParent.x,y:n.y+i.offsetFromParent.y};m.set(t.childId,{...i,position:o,hasBeenDragged:!0}),e=t.childId,n=o}}if(i.parentId&&i.offsetFromParent){const e=oe();let n=t,r=i;for(;r.parentId&&r.offsetFromParent;){const i=m.get(r.parentId);if(!i)break;const s=n===t?o:m.get(n).position,d={x:s.x-r.offsetFromParent.x,y:s.y-r.offsetFromParent.y};"animated"===e.parentChild.movementMode?F.set(r.parentId,d):m.set(r.parentId,{...i,position:d,hasBeenDragged:!0}),n=r.parentId,r=i}}y()}function G(t,e){const n=m.get(t);n&&(m.set(t,{...n,size:e}),y())}function K(t,e){const n=m.get(t);n&&(m.set(t,{...n,...e}),y())}function V(t){var e;const n=m.get(t);if(!n)return;const i=Math.max(...Array.from(m.values()).map(t=>t.zIndex),0);if(n.parentId){const o=m.get(n.parentId);o&&o.zIndex<i&&m.set(n.parentId,{...o,zIndex:i+2});const r=(null==(e=m.get(n.parentId))?void 0:e.zIndex)??i+2;return n.zIndex<=r&&m.set(t,{...n,zIndex:r+2}),void y()}if(n.zIndex<i&&(m.set(t,{...n,zIndex:i+2}),y()),n.childId){const e=m.get(n.childId),i=m.get(t);e&&i&&e.zIndex<=i.zIndex&&(m.set(n.childId,{...e,zIndex:i.zIndex+2}),y())}}function $(t){const e=m.get(t);if(!e)return!1;const n=Math.max(...Array.from(m.values()).map(t=>t.zIndex),0);return e.zIndex===n&&!e.isMinimized&&!e.isHiddenWithParent}function j(e){t.set(B,e,!0)}function Q(e,n,i){const o=n.getBoundingClientRect();b.set(e,{x:o.left+o.width/2,y:o.top+o.height/2});const r=oe();(null==i?void 0:i.parentId)&&r.features.parentChild&&t.set(A,{parentId:i.parentId,childId:e},!0),t.get(M).includes(e)||t.set(M,[...t.get(M),e],!0),y();const s=m.get(e);if(s){if(s.isOpen&&!s.isMinimized&&!s.isHiddenWithParent)return t.set(M,t.get(M).filter(t=>t!==e),!0),kt(e),void V(e);if(s.isMinimized)return t.set(M,t.get(M).filter(t=>t!==e),!0),void q(e);m.set(e,{...s,isOpen:!0}),V(e),null==S||S.push(e)}}function J(e){X(e);const n=m.get(e.id);n&&(m.set(e.id,{...n,isOpen:!0}),y()),t.set(M,[...t.get(M),e.id],!0),y(),V(e.id),null==S||S.push(e.id)}function U(e,n=!1){const i=m.get(e);i&&(Kt(e),n?t.set(O,[...t.get(O),e],!0):t.set(v,[...t.get(v),e],!0),y(),i.childId&&U(i.childId,n),null==S||S.pop())}function Z(){Array.from(m.keys()).forEach(t=>U(t,!0))}function tt(t){const e=m.get(t);if(e){if(e.parentId){const n=m.get(e.parentId);n&&n.childId===t&&m.set(e.parentId,{...n,childId:void 0,lastChildId:t})}m.set(t,{...e,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),y()}}function et(t){const e=m.get(t);if(!e)return[t];const n=[t];return e.childId&&n.push(...et(e.childId)),n}function nt(e,n,i){const o=oe();if(i&&!b.has(e.id)){const t=i.getBoundingClientRect();b.set(e.id,{x:t.left+t.width/2,y:t.top+t.height/2})}const r={id:e.id,title:e.title??"",icon:e.icon??"",isOpen:!0,isMinimized:!1,isHiddenWithParent:!1,isTransparent:e.isTransparent??!1,isRejected:!1,position:e.position??null,size:e.size??null,hasBeenDragged:e.hasBeenDragged??!1,dockPosition:e.dockPosition??-1,glow:e.glow??null};if(!o.features.parentChild){X(r);const n=m.get(e.id);return n&&m.set(e.id,{...n,isOpen:!0}),t.set(M,[...t.get(M),e.id],!0),y(),void V(e.id)}const s=m.get(n);if(!s)return;s.childId&&U(s.childId,!0),X({...r,parentId:n});const d=m.get(e.id);d&&m.set(e.id,{...d,isOpen:!0,parentId:n}),t.set(M,[...t.get(M),e.id],!0),y(),V(e.id),t.set(A,{parentId:n,childId:e.id},!0)}function it(t,e){if(!oe().features.parentChild)return;const n=m.get(t),i=m.get(e);if(!n||!i)return;let o={x:40,y:40};n.position&&i.position&&(o={x:i.position.x-n.position.x,y:i.position.y-n.position.y});const r=Math.max(i.zIndex,n.zIndex+1);m.set(t,{...n,childId:e,lastChildId:e}),m.set(e,{...i,parentId:t,offsetFromParent:o,zIndex:r}),y()}function ot(t){const e=m.get(t);if(!(null==e?void 0:e.childId))return;const n=m.get(e.childId);n&&(m.set(e.childId,{...n,isHiddenWithParent:!0}),y())}function rt(t,e){const n=m.get(t);if(!(null==n?void 0:n.childId))return;const i=m.get(n.childId);if(!i||!i.offsetFromParent)return;const o={x:e.x+i.offsetFromParent.x,y:e.y+i.offsetFromParent.y};m.set(n.childId,{...i,position:o}),y()}function st(t,e){const n=m.get(t),i=m.get(e);if(!(null==n?void 0:n.position)||!(null==i?void 0:i.position))return;const o={x:n.position.x-i.position.x,y:n.position.y-i.position.y};m.set(t,{...n,offsetFromParent:o}),y()}function dt(e){return t.get(z).includes(e)}function at(e){return!!t.get(z).includes(e)&&(t.set(z,t.get(z).filter(t=>t!==e),!0),!0)}function ct(){return t.get(z).length>0}function ut(){return Array.from(m.keys())}function lt(t){return m.get(t)}function ft(t){const e=[];for(const[n,i]of m.entries())if(n!==t&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent&&!i.parentId)if(i.position&&i.size)e.push({id:String(n),x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const t=document.querySelector(`[data-modal-id="${String(n)}"]`);if(t){const i=t.getBoundingClientRect();e.push({id:String(n),x:i.left,y:i.top,width:i.width,height:i.height})}}return e}function gt(t){const e=[];for(const[n,i]of m.entries())if(n!==t&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent)if(i.position&&i.size)e.push({x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const t=document.querySelector(`[data-modal-id="${String(n)}"]`);if(t){const n=t.getBoundingClientRect();e.push({x:n.left,y:n.top,width:n.width,height:n.height})}}return e}function ht(){return t.get(x)}function pt(){const e=t.get(T);return t.set(T,null),e}function mt(e){return t.get(M).includes(e)}function xt(e){return!!t.get(M).includes(e)&&(t.set(M,t.get(M).filter(t=>t!==e),!0),!0)}function It(e){return t.get(v).includes(e)}function yt(e){return!!t.get(v).includes(e)&&(t.set(v,t.get(v).filter(t=>t!==e),!0),!0)}function wt(e){return t.get(O).includes(e)}function zt(e){return!!t.get(O).includes(e)&&(t.set(O,t.get(O).filter(t=>t!==e),!0),!0)}function Mt(e){return t.get(P).includes(e)}function vt(e){return!!t.get(P).includes(e)&&(t.set(P,t.get(P).filter(t=>t!==e),!0),!0)}function Ot(e){return t.get(C).includes(e)}function Pt(e){return!!t.get(C).includes(e)&&(t.set(C,t.get(C).filter(t=>t!==e),!0),!0)}function Ct(e){return t.get(D).includes(e)}function Dt(e){return!!t.get(D).includes(e)&&(t.set(D,t.get(D).filter(t=>t!==e),!0),!0)}function kt(e){m.get(e)&&(t.get(D).includes(e)||t.get(k).includes(e)||(t.set(D,[...t.get(D),e],!0),y()))}function Tt(e){t.get(k).includes(e)||t.set(k,[...t.get(k),e],!0)}function bt(e){t.set(k,t.get(k).filter(t=>t!==e),!0)}function At(){return t.get(A)}function Ft(e){if(!t.get(A)||t.get(A).childId!==e)return null;const n=t.get(A);return t.set(A,null),n}function Wt(t,e){b.set(t,e)}function Ht(t){const e=b.get(t);return e&&b.delete(t),e??null}function Bt(t,e){e?W.add(t):W.delete(t)}function St(t){return W.has(t)}function Rt(t){const e=m.get(t);return void 0!==e&&e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent}function Xt(t){return m.has(t)}function Et(){return{get modals(){return m},get pendingMinimize(){return t.get(z)},get pendingOpen(){return t.get(M)},get pendingClose(){return t.get(v)},get pendingRestore(){return t.get(P)},get dockOrder(){return t.get(B)}}}function Yt(t){H.has(t)?H.delete(t):H.add(t);const e=m.get(t);e&&(m.set(t,{...e,isTransparent:H.has(t)}),y())}function qt(t){H.delete(t);const e=m.get(t);e&&(m.set(t,{...e,isTransparent:!1}),y())}function Lt(t){t.animate([{transform:"translateX(0)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(0)"}],{duration:300,easing:"ease-in-out"})}function Nt(t){const e=F.get(t);if(!e)return;const n=m.get(t);n&&(m.set(t,{...n,isAnimatingPosition:!0,position:e}),F.delete(t),y())}function _t(t){const e=m.get(t);e&&(m.set(t,{...e,isAnimatingPosition:!1}),y())}function Gt(t){return F.has(t)}function Kt(t){F.delete(t)}function Vt(t){const e=oe().parentChild.animationDuration;for(const[e,n]of t){const t=m.get(e);t&&m.set(e,{...t,position:n,isAnimatingPosition:!0,hasBeenDragged:!0})}y(),setTimeout(()=>{for(const e of t.keys()){const t=m.get(e);t&&m.set(e,{...t,isAnimatingPosition:!1})}y()},e)}function $t(t){const e=oe();if("animated"!==e.parentChild.movementMode)return;const n=e.parentChild.animationDuration,i=[];let o=t;for(;;){const t=m.get(o);if(!(null==t?void 0:t.parentId))break;i.push({parentId:t.parentId,childId:o}),o=t.parentId}i.forEach(({parentId:t,childId:e},i)=>{setTimeout(()=>{const i=m.get(e),o=m.get(t);if(!(null==i?void 0:i.position)||!i.offsetFromParent||!o)return;const r={x:i.position.x-i.offsetFromParent.x,y:i.position.y-i.offsetFromParent.y};F.set(t,r),Nt(t),setTimeout(()=>_t(t),n)},i*n)})}function jt(t){}function Qt(t){S=t}function Jt(t){R=t}function Ut(){return{modals:m,pendingMinimize:t.get(z),pendingOpen:t.get(M),pendingClose:t.get(v),pendingRestore:t.get(P),dockOrder:t.get(B),animatingModals:W,transparentModals:H}}function Zt(){m.clear(),t.get(z).length=0,t.get(M).length=0,t.get(v).length=0,t.get(O).length=0,t.get(P).length=0,t.get(C).length=0,t.set(T,null),b.clear(),t.set(A,null),F.clear(),W.clear(),H.clear(),t.get(B).length=0,S=null,R=null}const te={features:{dock:!0,minimize:!0,transparency:!0,resize:!0,drag:!0,focusTrap:!0,animations:!0,backdrop:!0,parentChild:!0},dock:{position:"bottom",labelMode:"beside",enableReorder:!0,enableFreeDrag:!0},animations:{open:400,close:250,minimize:500,restore:400},appearance:{headerLayout:"macos",defaultWidth:"480px",defaultHeight:"auto",minWidth:280,minHeight:200},zIndex:{base:400,dock:8e3,toast:9e3},parentChild:{movementMode:"animated",animationDuration:300},positioning:{strategy:"smart",modalGap:16,avoidElements:[]},portalTarget:"#modal-portal"};let ee={...te},ne=t.state(0);function ie(){return t.get(ne)}function oe(){return ee}function re(e){const n=ee;ee=de(te,e),t.update(ne),n.features.dock&&!ee.features.dock&&L()}function se(){ee={...te},t.update(ne)}function de(t,e){return{features:{...t.features,...e.features},dock:{...t.dock,...e.dock},animations:{...t.animations,...e.animations},appearance:{...t.appearance,...e.appearance},zIndex:{...t.zIndex,...e.zIndex},parentChild:{...t.parentChild,...e.parentChild},positioning:{...t.positioning,...e.positioning},portalTarget:e.portalTarget??t.portalTarget}}function ae(t){return ee.features[t]}export{Ut as _getInternalState,Zt as _resetInternalState,o as acquireModalZIndex,Vt as animateModalsToPositions,Nt as animateParentToPosition,V as bringToFront,u as calculateOverlap,g as calculatePositionScore,p as calculateRearrangement,l as calculateTotalOverlap,_t as clearParentAnimationFlag,Kt as clearPendingParentAnimation,Z as closeAllModals,U as closeModal,c as constrainSizeToViewport,a as constrainToViewport,Ht as consumeOpenSourcePosition,Dt as consumePendingAttention,Pt as consumePendingChildRestore,yt as consumePendingClose,zt as consumePendingForceClose,at as consumePendingMinimize,pt as consumePendingMinimizeTarget,xt as consumePendingOpen,Ft as consumePendingParentLink,vt as consumePendingRestore,J as createModal,te as defaultConfig,bt as endAttentionAnimation,tt as finalizeModalClose,h as findSmartPosition,oe as getConfig,ie as getConfigVersion,f as getElementBounds,r as getLayerZIndex,lt as getModalState,Et as getModalsStore,et as getModalsToClose,gt as getOpenModalBounds,ft as getOpenModalBoundsWithIds,At as getPendingParentLink,ut as getRegisteredModalIds,ht as getStateVersion,ct as hasAnyPendingMinimize,Ct as hasPendingAttention,Ot as hasPendingChildRestore,It as hasPendingClose,wt as hasPendingForceClose,dt as hasPendingMinimize,mt as hasPendingOpen,Gt as hasPendingParentAnimation,Mt as hasPendingRestore,ot as hideChildWithParent,i as initializeStacking,ae as isFeatureEnabled,St as isModalAnimating,Rt as isModalOpen,Xt as isModalRegistered,$ as isTopModal,it as linkModals,de as mergeConfig,Y as minimizeModal,nt as openChildModal,Q as openModal,X as registerModal,j as reorderDock,se as resetConfig,qt as resetModalTransparency,s as resetStacking,L as restoreAllMinimizedModals,N as restoreChildModal,q as restoreModal,st as setChildOffsetFromParent,re as setConfig,Jt as setDockPositionGetter,Bt as setModalAnimating,jt as setRegistryFunctions,Qt as setURLStateCallbacks,Lt as shakeElement,Tt as startAttentionAnimation,Wt as storeOpenSourcePosition,w as subscribe,Yt as toggleModalTransparency,kt as triggerAttention,$t as triggerCascadingParentAnimations,E as unregisterModal,rt as updateChildPosition,K as updateModal,_ as updateModalPosition,G as updateModalSize};
|
|
1
|
+
import{aw as a,ax as e,ay as s,X as n,ap as i,d as t,az as o,aA as d,W as r,U as l,aq as g,as as c,ag as P,c as m,f as M,e as u,K as p,M as C,F as h,G as A,A as S,D as f,B as T,J as z,P as O,E as k,af as R,a8 as F,O as I,H as b,T as y,g as L,k as V,S as x,a0 as B,j as D,a1 as E,ah as j,R as v,V as w,Q as W,am as Z,l as _,al as q,L as G,q as U,n as H,z as J,p as K,I as N,ar as Q,s as X,ai as Y,a5 as $,w as aa,a2 as ea,a as sa,i as na,Z as ia,$ as ta,a9 as oa,m as da,o as ra,b as la,Y as ga,ae as ca,a6 as Pa,u as ma,a7 as Ma,ab as ua,ac as pa,r as Ca,ak as ha,a4 as Aa,av as Sa,ao as fa,at as Ta,au as za,a3 as Oa,N as ka,an as Ra,aa as Fa,h as Ia,_ as ba,t as ya,y as La,v as Va,aj as xa,C as Ba,x as Da,ad as Ea}from"./core.js";import"./ui.js";export{a as _getInternalState,e as _resetInternalState,s as acquireModalZIndex,n as animateModalsToPositions,i as animateParentToPosition,t as bringToFront,o as calculateOverlap,d as calculatePositionScore,r as calculateRearrangement,l as calculateTotalOverlap,g as clearParentAnimationFlag,c as clearPendingParentAnimation,P as closeAllModals,m as closeModal,M as constrainSizeToViewport,u as constrainToViewport,p as consumeOpenSourcePosition,C as consumePendingAttention,h as consumePendingChildRestore,A as consumePendingClose,S as consumePendingForceClose,f as consumePendingMinimize,T as consumePendingMinimizeTarget,z as consumePendingOpen,O as consumePendingParentLink,k as consumePendingRestore,R as createModal,F as defaultConfig,I as endAttentionAnimation,b as finalizeModalClose,y as findSmartPosition,L as getConfig,V as getConfigVersion,x as getElementBounds,B as getLayerZIndex,D as getModalState,E as getModalsStore,j as getModalsToClose,v as getOpenModalBounds,w as getOpenModalBoundsWithIds,W as getPendingParentLink,Z as getRegisteredModalIds,_ as getStateVersion,q as hasAnyPendingMinimize,G as hasPendingAttention,U as hasPendingChildRestore,H as hasPendingClose,J as hasPendingForceClose,K as hasPendingMinimize,N as hasPendingOpen,Q as hasPendingParentAnimation,X as hasPendingRestore,Y as hideChildWithParent,$ as initializeStacking,aa as isFeatureEnabled,ea as isModalAnimating,sa as isModalOpen,na as isModalRegistered,ia as isTopModal,ta as linkModals,oa as mergeConfig,da as minimizeModal,ra as openChildModal,la as openModal,ga as registerModal,ca as reorderDock,Pa as resetConfig,ma as resetModalTransparency,Ma as resetStacking,ua as restoreAllMinimizedModals,pa as restoreChildModal,Ca as restoreModal,ha as setChildOffsetFromParent,Aa as setConfig,Sa as setDockPositionGetter,fa as setModalAnimating,Ta as setRegistryFunctions,za as setURLStateCallbacks,Oa as shakeElement,ka as startAttentionAnimation,Ra as storeOpenSourcePosition,Fa as subscribe,Ia as toDataId,ba as toggleModalTransparency,ya as triggerAttention,La as triggerCascadingParentAnimations,Va as unregisterModal,xa as updateChildPosition,Ba as updateModal,Da as updateModalPosition,Ea as updateModalSize};
|
package/dist/react/Dock.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
export interface DockProps {
|
|
3
3
|
/** Custom icon renderer - receives icon name, returns React element */
|
|
4
4
|
renderIcon?: (props: {
|
|
5
5
|
icon: string;
|
|
6
6
|
}) => ReactNode;
|
|
7
7
|
}
|
|
8
|
-
export declare function Dock({ renderIcon }: DockProps):
|
|
9
|
-
ref: React.RefObject<HTMLDivElement | null>;
|
|
10
|
-
'data-dock-bridge': boolean;
|
|
11
|
-
}, string | React.JSXElementConstructor<any>>;
|
|
8
|
+
export declare function Dock({ renderIcon }: DockProps): import("react/jsx-runtime").JSX.Element;
|
|
12
9
|
export default Dock;
|
|
13
10
|
//# sourceMappingURL=Dock.d.ts.map
|
package/dist/react/Modal.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { BaseModalProps } from '../core/types';
|
|
3
3
|
export interface ModalProps extends BaseModalProps {
|
|
4
4
|
children?: ReactNode;
|
|
5
5
|
footer?: ReactNode;
|
|
6
|
-
/** Custom icon as React element (overrides icon string if provided) */
|
|
7
|
-
customIcon?: ReactNode;
|
|
8
6
|
}
|
|
9
|
-
export declare function Modal({ id, title, icon,
|
|
7
|
+
export declare function Modal({ id, title, icon, maxWidth, preferredHeight, autoOpen, glow, config, closeOnEscape, onClose, children, footer, }: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
10
8
|
export default Modal;
|
|
11
9
|
//# sourceMappingURL=Modal.d.ts.map
|
package/dist/react.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { openModal, closeModal, closeAllModals, minimizeModal, restoreModal, openChildModal, bringToFront, isModalOpen, isModalRegistered, toggleModalTransparency, } from './core/state.svelte';
|
|
2
|
+
export { getConfig, setConfig } from './core/config.svelte';
|
|
1
3
|
export { Modal } from './react/Modal';
|
|
2
4
|
export type { ModalProps } from './react/Modal';
|
|
3
5
|
export { ModalProvider } from './react/ModalProvider';
|
|
@@ -5,7 +7,4 @@ export type { ModalProviderProps } from './react/ModalProvider';
|
|
|
5
7
|
export { Dock } from './react/Dock';
|
|
6
8
|
export type { DockProps } from './react/Dock';
|
|
7
9
|
export { useModal, useModals } from './react/useModal';
|
|
8
|
-
export { openModal, closeModal, minimizeModal, restoreModal, bringToFront, isModalOpen, isModalRegistered, openChildModal, closeAllModals, isTopModal, reorderDock, toggleModalTransparency, } from './core/state.svelte';
|
|
9
|
-
export { getConfig, setConfig } from './core/config.svelte';
|
|
10
|
-
export type { ModalState, Position, Dimensions, } from './core/types';
|
|
11
10
|
//# sourceMappingURL=react.d.ts.map
|
package/dist/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{createContext as t,useRef as i,useEffect as n,useCallback as o,useSyncExternalStore as r}from"react";import{onMount as d,getContext as s,setContext as a,tick as l,onDestroy as c,mount as g,unmount as u}from"svelte";import"svelte/internal/disclose-version";import*as h from"svelte/internal/client";import{scale as p,fly as f}from"svelte/transition";import{cubicOut as m,backOut as v}from"svelte/easing";const w={features:{dock:!0,minimize:!0,transparency:!0,resize:!0,drag:!0,focusTrap:!0,animations:!0,backdrop:!0,parentChild:!0},dock:{position:"bottom",labelMode:"beside",enableReorder:!0,enableFreeDrag:!0},animations:{open:400,close:250,minimize:500,restore:400},appearance:{headerLayout:"macos",defaultWidth:"480px",defaultHeight:"auto",minWidth:280,minHeight:200},zIndex:{base:400,dock:8e3,toast:9e3},parentChild:{movementMode:"animated",animationDuration:300},positioning:{strategy:"smart",modalGap:16,avoidElements:[]},portalTarget:"#modal-portal"};let y={...w},x=h.state(0);function z(){return h.get(x)}function I(){return y}function b(e){const t=y;var i,n;y={features:{...(i=w).features,...(n=e).features},dock:{...i.dock,...n.dock},animations:{...i.animations,...n.animations},appearance:{...i.appearance,...n.appearance},zIndex:{...i.zIndex,...n.zIndex},parentChild:{...i.parentChild,...n.parentChild},positioning:{...i.positioning,...n.positioning},portalTarget:n.portalTarget??i.portalTarget},h.update(x),t.features.dock&&!y.features.dock&&(Array.from(E.values()).filter(e=>e.isMinimized).map(e=>e.id).forEach(e=>{const t=E.get(e);if(t){E.set(e,{...t,isMinimized:!1,isOpen:!0}),h.set(L,[...h.get(L),e],!0),oe(e);const i=t.lastChildId||t.childId;i&&te(i)}}),h.set(K,[],!0),T())}let M=h.state(h.proxy(400));const _=8;function k(e,t,i,n,o={}){const{margin:r=_,allowPartialVisibility:d=!1}=o,s="undefined"!=typeof window?window.innerWidth:1920,a="undefined"!=typeof window?window.innerHeight:1080;let l,c,g,u;return d&&i>s-2*r?(l=40-i,c=s-40):(l=r,c=Math.max(r,s-i-r)),d&&n>a-2*r?(g=40-n,u=a-40):(g=r,u=Math.max(r,a-n-r)),{x:Math.max(l,Math.min(c,e)),y:Math.max(g,Math.min(u,t))}}function C(e,t,i,n,o={}){const{margin:r=_}=o,d=("undefined"!=typeof window?window.innerWidth:1920)-2*r,s=("undefined"!=typeof window?window.innerHeight:1080)-2*r,a=Math.min(i,d),l=Math.min(n,s),c=k(e,t,a,l,o);return{x:c.x,y:c.y,width:a,height:l}}function P(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function D(e,t,i,n,o,r){const d={x:e-r,y:t-r,width:i+2*r,height:n+2*r};let s=0;for(const e of o)s+=P(d,e);return s}function B(e,t,i,n,o,r,d){const s=(o-i)/2,a=(r-n)/2,l=s-d,c=a-d,g=Math.abs(e-s)/(l||1),u=Math.abs(t-a)/(c||1),h=Math.sqrt(g*g+u*u)/Math.SQRT2,p=50,f=e-d,m=o-i-d-e,v=t-d,w=r-n-d-t;let y=0;return f<p&&(y+=.3*(1-f/p)),m<p&&(y+=.3*(1-m/p)),v<p&&(y+=.2*(1-v/p)),w<p&&(y+=.2*(1-w/p)),Math.min(1,h+y)}let E=h.proxy(new Map),R=h.state(0);const O=new Set;function T(){h.update(R),queueMicrotask(()=>{O.forEach(e=>e())})}function H(e){return O.add(e),()=>O.delete(e)}let S=h.state(h.proxy([])),W=h.state(h.proxy([])),F=h.state(h.proxy([])),$=h.state(h.proxy([])),L=h.state(h.proxy([])),X=h.state(h.proxy([])),A=h.state(h.proxy([])),Y=h.state(h.proxy([])),q=h.state(null),j=h.proxy(new Map),N=h.state(null),G=h.proxy(new Map),U=h.proxy(new Set),V=h.proxy(new Set),K=h.state(h.proxy([]));function Q(e){const t=E.get(e.id),i=(null==t?void 0:t.zIndex)??function(){const e=h.get(M);return h.set(M,h.get(M)+2),e}();t?E.set(e.id,{...t,title:e.title,icon:e.icon,glow:e.glow,zIndex:i}):E.set(e.id,{...e,zIndex:i,isAnimating:!1}),T(),e.isMinimized&&!h.get(K).includes(e.id)&&h.get(K).push(e.id)}function J(e){const t=E.get(e);if(t){if(h.set(K,h.get(K).filter(t=>t!==e),!0),t.childId){const e=E.get(t.childId);e&&E.set(t.childId,{...e,parentId:void 0})}if(t.parentId){const e=E.get(t.parentId);e&&E.set(t.parentId,{...e,childId:void 0,lastChildId:t.id})}E.delete(e),T(),V.delete(e),U.delete(e)}}function Z(e){const t=E.get(e);if(!t||t.isMinimized)return;if(ke(e),t.parentId){const e=E.get(t.parentId);if(e&&!e.isMinimized)return void Z(t.parentId)}h.set(S,[...h.get(S),e],!0),t.position&&t.size;const i=t.childId;E.set(e,{...t,isMinimized:!0,lastChildId:i}),T(),h.get(K).includes(e)||h.get(K).push(e),t.childId&&function(e){const t=E.get(e);if(!(null==t?void 0:t.childId))return;const i=E.get(t.childId);i&&(E.set(t.childId,{...i,isHiddenWithParent:!0}),T())}(e)}function ee(e){const t=E.get(e);if(!t||!t.isMinimized)return;E.set(e,{...t,isMinimized:!1,isOpen:!0}),T(),h.set(L,[...h.get(L),e],!0),oe(e);const i=t.lastChildId||t.childId;i&&te(i)}function te(e){const t=E.get(e);t&&t.isHiddenWithParent&&(E.set(e,{...t,isHiddenWithParent:!1}),T(),h.set(X,[...h.get(X),e],!0))}function ie(e,t,i){const n=E.get(e);if(!n)return;let o=t;if((null==i?void 0:i.constrain)&&n.size&&(o=k(t.x,t.y,n.size.width,n.size.height)),E.set(e,{...n,position:o,size:(null==i?void 0:i.size)??n.size,hasBeenDragged:n.hasBeenDragged||(null==i?void 0:i.drag)||!1}),n.childId){let t=e,i=o;for(;;){const e=E.get(t);if(!(null==e?void 0:e.childId))break;const n=E.get(e.childId);if(!(null==n?void 0:n.offsetFromParent))break;const o={x:i.x+n.offsetFromParent.x,y:i.y+n.offsetFromParent.y};E.set(e.childId,{...n,position:o,hasBeenDragged:!0}),t=e.childId,i=o}}if(n.parentId&&n.offsetFromParent){const t=I();let i=e,r=n;for(;r.parentId&&r.offsetFromParent;){const n=E.get(r.parentId);if(!n)break;const d=i===e?o:E.get(i).position,s={x:d.x-r.offsetFromParent.x,y:d.y-r.offsetFromParent.y};"animated"===t.parentChild.movementMode?G.set(r.parentId,s):E.set(r.parentId,{...n,position:s,hasBeenDragged:!0}),i=r.parentId,r=n}}T()}function ne(e,t){const i=E.get(e);i&&(E.set(e,{...i,...t}),T())}function oe(e){var t;const i=E.get(e);if(!i)return;const n=Math.max(...Array.from(E.values()).map(e=>e.zIndex),0);if(i.parentId){const o=E.get(i.parentId);o&&o.zIndex<n&&E.set(i.parentId,{...o,zIndex:n+2});const r=(null==(t=E.get(i.parentId))?void 0:t.zIndex)??n+2;return i.zIndex<=r&&E.set(e,{...i,zIndex:r+2}),void T()}if(i.zIndex<n&&(E.set(e,{...i,zIndex:n+2}),T()),i.childId){const t=E.get(i.childId),n=E.get(e);t&&n&&t.zIndex<=n.zIndex&&(E.set(i.childId,{...t,zIndex:n.zIndex+2}),T())}}function re(e){const t=E.get(e);if(!t)return!1;const i=Math.max(...Array.from(E.values()).map(e=>e.zIndex),0);return t.zIndex===i&&!t.isMinimized&&!t.isHiddenWithParent}function de(e){h.set(K,e,!0)}function se(e,t,i){const n=t.getBoundingClientRect();j.set(e,{x:n.left+n.width/2,y:n.top+n.height/2});const o=I();(null==i?void 0:i.parentId)&&o.features.parentChild&&h.set(N,{parentId:i.parentId,childId:e},!0),h.get(W).includes(e)||h.set(W,[...h.get(W),e],!0),T();const r=E.get(e);if(r){if(r.isOpen&&!r.isMinimized&&!r.isHiddenWithParent)return h.set(W,h.get(W).filter(t=>t!==e),!0),xe(e),void oe(e);if(r.isMinimized)return h.set(W,h.get(W).filter(t=>t!==e),!0),void ee(e);E.set(e,{...r,isOpen:!0}),oe(e)}}function ae(e,t=!1){const i=E.get(e);i&&(ke(e),t?h.set($,[...h.get($),e],!0):h.set(F,[...h.get(F),e],!0),T(),i.childId&&ae(i.childId,t))}function le(){Array.from(E.keys()).forEach(e=>ae(e,!0))}function ce(e,t,i){const n=I();if(i&&!j.has(e.id)){const t=i.getBoundingClientRect();j.set(e.id,{x:t.left+t.width/2,y:t.top+t.height/2})}const o={id:e.id,title:e.title??"",icon:e.icon??"",isOpen:!0,isMinimized:!1,isHiddenWithParent:!1,isTransparent:e.isTransparent??!1,isRejected:!1,position:e.position??null,size:e.size??null,hasBeenDragged:e.hasBeenDragged??!1,dockPosition:e.dockPosition??-1,glow:e.glow??null};if(!n.features.parentChild){Q(o);const t=E.get(e.id);return t&&E.set(e.id,{...t,isOpen:!0}),h.set(W,[...h.get(W),e.id],!0),T(),void oe(e.id)}const r=E.get(t);if(!r)return;r.childId&&ae(r.childId,!0),Q({...o,parentId:t});const d=E.get(e.id);d&&E.set(e.id,{...d,isOpen:!0,parentId:t}),h.set(W,[...h.get(W),e.id],!0),T(),oe(e.id),h.set(N,{parentId:t,childId:e.id},!0)}function ge(e){return h.get(S).includes(e)}function ue(e){return E.get(e)}function he(){return h.get(R)}function pe(e){return h.get(W).includes(e)}function fe(e){return h.get(F).includes(e)}function me(e){return h.get($).includes(e)}function ve(e){return!!h.get($).includes(e)&&(h.set($,h.get($).filter(t=>t!==e),!0),!0)}function we(e){return h.get(L).includes(e)}function ye(e){return h.get(X).includes(e)}function xe(e){E.get(e)&&(h.get(A).includes(e)||h.get(Y).includes(e)||(h.set(A,[...h.get(A),e],!0),T()))}function ze(e){const t=E.get(e);return void 0!==t&&t.isOpen&&!t.isMinimized&&!t.isHiddenWithParent}function Ie(e){return E.has(e)}function be(){return{get modals(){return E},get pendingMinimize(){return h.get(S)},get pendingOpen(){return h.get(W)},get pendingClose(){return h.get(F)},get pendingRestore(){return h.get(L)},get dockOrder(){return h.get(K)}}}function Me(e){V.has(e)?V.delete(e):V.add(e);const t=E.get(e);t&&(E.set(e,{...t,isTransparent:V.has(e)}),T())}function _e(e){V.delete(e);const t=E.get(e);t&&(E.set(e,{...t,isTransparent:!1}),T())}function ke(e){G.delete(e)}const Ce=Symbol("modal-render-icon"),Pe=Symbol("modal-id");function De(){return I().features.animations}const Be=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Ee(e){return Array.from(e.querySelectorAll(Be)).filter(e=>null!==e.offsetParent||"A"===e.tagName)}function Re(e,t){if("Tab"!==e.key)return;const i=Ee(t);if(0===i.length)return void e.preventDefault();const n=i[0],o=i[i.length-1],r=document.activeElement;e.shiftKey?r===n&&(o.focus(),e.preventDefault()):r===o&&(n.focus(),e.preventDefault())}function Oe(e){const t=Ee(e);return t.length>0&&(t[0].focus(),!0)}const Te="modal-portal";var He=h.from_html('<div style="display: contents;"><!></div>');function Se(e,t){h.push(t,!0);let i=h.prop(t,"target",3,"body"),n=null,o=null;const{mount:r}={mount:function(e,t=null){const i=function(e){if("undefined"==typeof window)return null;if(e instanceof HTMLElement)return e;if("string"==typeof e){const t=document.querySelector(e);if(t)return t;if(e.startsWith("#")){const t=e.slice(1),i=document.createElement("div");return i.id=t,document.body.appendChild(i),i}}let t=document.getElementById(Te);return t||(t=document.createElement("div"),t.id=Te,document.body.appendChild(t)),t}(t);return i?(i.appendChild(e),()=>{e.parentNode===i&&i.removeChild(e),i.id!==Te&&0===i.children.length&&i.parentNode&&i.parentNode.removeChild(i)}):()=>{}}};d(()=>(n&&(o=r(n,i())),()=>{null==o||o()}));var s=He(),a=h.child(s);h.snippet(a,()=>t.children),h.reset(s),h.bind_this(s,e=>n=e,()=>n),h.append(e,s),h.pop()}var We=h.from_html('<button type="button" aria-label="Minimize"></button>'),Fe=h.from_html('<button type="button" class="modal-header-light modal-header-light-style" aria-label="Toggle style"></button>'),$e=h.from_html('<div class="modal-header-icon"><!></div>'),Le=h.from_html('<div class="modal-header-icon"><!></div>'),Xe=h.from_html('<h2 class="modal-header-title"> </h2>'),Ae=h.from_html('<h2 class="modal-header-title"> </h2>'),Ye=h.from_html('<div class="modal-header-traffic-lights"><button type="button" class="modal-header-light modal-header-light-close" aria-label="Close"></button> <!> <!></div> <div class="modal-header-mac-center"><!> <div class="modal-header-title-group"><!></div></div> <div class="modal-header-mac-spacer"></div>',1),qe=h.from_html('<div class="modal-header-icon"><!></div>'),je=h.from_html('<div class="modal-header-icon"><!></div>'),Ne=h.from_html('<h2 class="modal-header-title"> </h2>'),Ge=h.from_html('<h2 class="modal-header-title"> </h2>'),Ue=h.from_html('<button type="button" class="modal-header-btn-windows modal-header-btn-windows-style" aria-label="Toggle style">◇</button>'),Ve=h.from_html('<button type="button" aria-label="Minimize">–</button>'),Ke=h.from_html('<div class="modal-header-title-group"><!> <!></div> <div class="modal-header-actions"><!> <!> <button type="button" class="modal-header-btn-windows modal-header-btn-windows-close" aria-label="Close">×</button></div>',1),Qe=h.from_html("<header><!></header>");h.delegate(["pointerdown","click"]);var Je=h.from_html("<div></div>"),Ze=h.from_html('<div class="modal-resize-handles"></div>');h.delegate(["pointerdown"]);var et=h.from_html('<div class="modal-footer"><!></div>'),tt=h.from_html("<div></div>"),it=h.from_html('<div role="dialog" aria-modal="true" tabindex="-1"><!> <div class="modal-body"><!></div> <!> <!> <!></div>');function nt(e,t){h.push(t,!0);let i=h.prop(t,"maxWidth",3,"600px"),n=h.prop(t,"autoOpen",3,!1),o=h.prop(t,"closeOnEscape",3,!0),r=h.state(!1);d(()=>{Q({id:t.id,title:t.title,icon:t.icon??"",isOpen:n(),isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:t.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),h.set(r,!0)}),c(()=>{J(t.id)});const g=h.derived(()=>{if(!h.get(r))return!1;he();const e=ue(t.id);return!!e&&(e.isOpen||e.isMinimized||pe(t.id)||fe(t.id)||ge(t.id))});var u=h.comment(),p=h.first_child(u),f=e=>{!function(e,t){h.push(t,!0);let i=h.prop(t,"maxWidth",3,"600px"),n=h.prop(t,"autoOpen",3,!1),o=h.prop(t,"closeOnEscape",3,!0),r=h.prop(t,"skipRegistration",3,!1);a(Pe,t.id);const g=I().portalTarget;function u(e){var i,n;return(null==(n=null==(i=t.config)?void 0:i.features)?void 0:n[e])??function(e){return y.features[e]}(e)}const p=h.derived(()=>(z(),u("drag"))),f=h.derived(()=>(z(),u("minimize"))),m=h.derived(()=>(z(),!u("dock"))),v=h.derived(()=>(z(),u("transparency"))),w=h.derived(()=>(z(),u("resize"))),x=h.derived(()=>{var e,i;return z(),(null==(i=null==(e=t.config)?void 0:e.appearance)?void 0:i.headerLayout)??I().appearance.headerLayout});let b=h.state(null),M=h.state(!1),_=h.state(!1),P=h.state(!1),R=h.state(!1),O=h.state(!1);const H=h.derived(()=>(he(),ue(t.id))),$=h.derived(()=>h.get(H)&&(h.get(H).isOpen||fe(t.id))&&(!h.get(H).isMinimized||ge(t.id))&&!h.get(H).isHiddenWithParent),U=h.derived(()=>{var e;return!!(null==(e=h.get(H))?void 0:e.childId)}),V=h.derived(()=>{var e;return!!(null==(e=h.get(H))?void 0:e.parentId)}),K=h.derived(()=>h.get(U)||h.get(_)),ee=h.derived(()=>!!t.glow),te=h.derived(()=>`modal-title-${t.id}`),de=h.derived(()=>{var e;return(null==(e=h.get(H))?void 0:e.zIndex)??1e3}),se=function(e={x:0,y:0}){const t=h.proxy({...e}),i=h.proxy({isDragging:!1,startX:0,startY:0,initialX:0,initialY:0,hasBeenDragged:!1});return{get position(){return t},get hasBeenDragged(){return i.hasBeenDragged},get isDragging(){return i.isDragging},onPointerDown:function(e,n){if(0===e.button){if(!i.hasBeenDragged){const e=n.getBoundingClientRect();t.x=e.left,t.y=e.top}i.isDragging=!0,i.startX=e.clientX,i.startY=e.clientY,i.initialX=t.x,i.initialY=t.y,n.setPointerCapture(e.pointerId)}},onPointerMove:function(e,n,o){if(!i.isDragging)return;const r=e.clientX-i.startX,d=e.clientY-i.startY,s=k(i.initialX+r,i.initialY+d,o.width,o.height);t.x=s.x,t.y=s.y,i.hasBeenDragged=!0},onPointerUp:function(e,t){i.isDragging&&(i.isDragging=!1,t.releasePointerCapture(e.pointerId))},setPosition:function(e){t.x=e.x,t.y=e.y},setHasBeenDragged:function(e){i.hasBeenDragged=e},reset:function(){t.x=e.x,t.y=e.y,i.hasBeenDragged=!1}}}({x:0,y:0});let le=h.state(!1);const ce=function(e,i,n){let o=h.state(!1),r=h.state(""),d=h.state(h.proxy({width:0,height:0})),s=h.state(!1),a=h.state(!1),l={x:0,y:0,width:0,height:0,posX:0,posY:0},c=null;function g(t,a){t.preventDefault(),t.stopPropagation();const g=e();if(!g)return;const f=g.getBoundingClientRect();se.hasBeenDragged||(n({x:f.left,y:f.top}),se.setHasBeenDragged(!0)),h.get(s)||(h.set(d,{width:f.width,height:f.height},!0),h.set(s,!0));const m=i();h.set(o,!0),h.set(r,a,!0),c=t.pointerId,l={x:t.clientX,y:t.clientY,width:h.get(d).width,height:h.get(d).height,posX:m.x,posY:m.y,centerX:m.x+h.get(d).width/2,centerY:m.y+h.get(d).height/2},window.addEventListener("pointermove",u),window.addEventListener("pointerup",p),window.addEventListener("pointercancel",p)}function u(e){if(e.pointerId!==c)return;const t=e.clientX-l.x,i=e.clientY-l.y,o=window.innerWidth,s=window.innerHeight;let a=l.width,g=l.height,u=l.posX,p=l.posY;if(h.get(r).includes("e")){const e=o-u;a=Math.max(280,Math.min(l.width+t,e))}if(h.get(r).includes("w")){const e=l.width-280,i=Math.min(t,e);a=l.width-i,u=l.posX+i}if(h.get(r).includes("s")){const e=s-p;g=Math.max(200,Math.min(l.height+i,e))}if(h.get(r).includes("n")){const e=l.height-200,t=Math.min(i,e);g=l.height-t,p=l.posY+t}const f=C(u,p,a,g);h.set(d,{width:f.width,height:f.height},!0),n({x:f.x,y:f.y})}function p(e){e.pointerId===c&&(h.set(o,!1),c=null,window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),h.set(a,!0),((e,i)=>{const n=ue(t.id);if(null==n?void 0:n.parentId){const e=ue(n.parentId),o=document.querySelector(`[data-modal-id="${n.parentId}"]`);if(e&&o){const n=e.position??{x:o.getBoundingClientRect().left,y:o.getBoundingClientRect().top},r=e.size??{width:o.offsetWidth,height:o.offsetHeight},d={x:n.x+(r.width-i.width)/2,y:n.y+(r.height-i.height)/2};h.set(le,!0),se.setPosition(d);const s={x:d.x-n.x,y:d.y-n.y};return ne(t.id,{position:d,size:i,hasBeenDragged:!0,offsetFromParent:s}),void setTimeout(()=>{h.set(le,!1)},200)}}ne(t.id,{position:e,size:i,hasBeenDragged:!0})})(i(),h.get(d)),setTimeout(()=>{h.set(a,!1)},0))}const f={startResize:g};return{get isResizing(){return h.get(o)},get resizeDirection(){return h.get(r)},get size(){return h.get(d)},get hasBeenResized(){return h.get(s)},get isActive(){return h.get(o)},get justFinishedResizing(){return h.get(a)},start:g,setHasBeenResized:()=>{},setSize:function(e){h.set(d,e,!0),h.set(s,!0)},reset:function(){h.set(s,!1),h.set(d,{width:0,height:0},!0)},constrainToViewport:function(){const t=i(),o=e();if(!o)return;const r=C(t.x,t.y,h.get(d).width||o.offsetWidth,h.get(d).height||o.offsetHeight);h.set(d,{width:r.width,height:r.height},!0),n({x:r.x,y:r.y})},handlers:f}}(()=>h.get(b),()=>se.position,e=>se.setPosition(e)),xe=function(e,i,n,o,r,d,s,a,l){let c=h.state(!1),g=h.state(!1),u=h.state(!1),p=h.state(!1),f=h.state(null),m=h.state(null),v=null,w=null;function y(){w&&(clearTimeout(w),w=null)}function x(){const e=t.id,i=document.querySelector(`.modal-dock-item[data-modal-id="${e}"]`),n=document.querySelector('[data-dock-container="true"]'),o=i||n;if(o){const e=o.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top+e.height/2}}return{x:window.innerWidth/2,y:window.innerHeight-40}}return h.user_effect(()=>()=>{y(),h.set(c,!1),h.set(g,!1),h.set(u,!1),h.set(p,!1),h.set(f,null),h.set(m,null),v=null}),{get isMinimizing(){return h.get(c)},get isRestoring(){return h.get(g)},get isOpening(){return h.get(u)},get isClosing(){return h.get(p)},get animationTransform(){return h.get(f)},get pendingOpenSource(){return h.get(m)},startMinimize:function(e,t){const p=i();if(h.get(c)||!p)return;if(h.set(g,!1),h.set(u,!1),y(),!De()){const e=p.getBoundingClientRect();let i=r()?n():{x:e.left,y:e.top},c=s()?a():{width:e.width,height:e.height};return r()||(o(i),d(!0)),void(t?t():l(i,!0,c))}const m=p.getBoundingClientRect(),v=m.left+m.width/2,z=m.top+m.height/2;let I=r()?n():{x:m.left,y:m.top},b=s()?a():{width:m.width,height:m.height};r()||(o(I),d(!0));const M=e??x(),_=M.x-m.left,k=M.y-m.top,C={x:M.x-v,y:M.y-z,originX:_,originY:k};h.set(f,C,!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{h.set(c,!0)})}),w=setTimeout(()=>{t?t():l(I,!0,b)},500)},startRestore:function(e,t){if(!De()){const t=e||{x:window.innerWidth/2,y:window.innerHeight/2};return o(t),void d(!0)}const i=x(),n=e||{x:window.innerWidth/2,y:window.innerHeight/2},r=t||{width:480,height:400};o(n),d(!0);const s=n.x+r.width/2,a=n.y+r.height/2,l=i.x-n.x,c=i.y-n.y;h.set(f,{x:i.x-s,y:i.y-a,originX:l,originY:c},!0),h.set(g,!0),setTimeout(()=>{h.set(g,!1),h.set(f,null)},400)},startClose:function(e){h.get(p)||h.get(c)||(De()?(v=e,h.set(p,!0),setTimeout(()=>{h.set(p,!1),v&&(v(),v=null)},250)):e())},setPendingOpenSource:function(e){h.set(m,e,!0)},tryStartOpenAnimation:function(){const e=i();if(!h.get(m)||!e||h.get(u))return!1;if(!De())return h.set(m,null),!1;const t=h.get(m);h.set(m,null);const s=e.getBoundingClientRect(),a=r()?n():{x:s.left,y:s.top},l=s.width,c=s.height,g=a.x+l/2,p=a.y+c/2;r()||(o(a),d(!0));const v=t.x-a.x,w=t.y-a.y;return h.set(f,{x:t.x-g,y:t.y-p,originX:v,originY:w},!0),h.set(u,!0),setTimeout(()=>{h.set(u,!1),h.set(f,null)},400),!0},forceClearMinimize:function(){y(),h.set(c,!1),h.set(f,null)}}}(0,()=>h.get(b),()=>se.position,e=>se.setPosition(e),()=>se.hasBeenDragged,e=>se.setHasBeenDragged(e),()=>ce.hasBeenResized,()=>ce.size,(e,i,n)=>{ne(t.id,{position:e,size:n,hasBeenDragged:i}),Z(t.id)}),{trapFocus:ze,focusFirstElement:Ie}={trapFocus:Re,focusFirstElement:Oe},be=h.derived(()=>xe.isMinimizing||xe.isRestoring||xe.isOpening||xe.isClosing),ke=h.derived(()=>(ye(t.id)||we(t.id))&&!xe.isRestoring);let Be=h.state(!1);const Ee=h.derived(()=>xe.isRestoring||xe.isOpening||h.get(Be)),Te=h.derived(()=>h.get($)&&!se.hasBeenDragged&&!h.get(be)&&!xe.pendingOpenSource&&!h.get(ke)),He=h.derived(()=>{const e=[];return e.push(`z-index: ${h.get(de)};`),xe.animationTransform?(e.push(`left: ${se.position.x}px; top: ${se.position.y}px;`),e.push(`--genie-origin-x: ${xe.animationTransform.originX}px;`),e.push(`--genie-origin-y: ${xe.animationTransform.originY}px;`),e.push(`--genie-translate-x: ${xe.animationTransform.x}px;`),e.push(`--genie-translate-y: ${xe.animationTransform.y}px;`)):se.hasBeenDragged&&e.push(`left: ${se.position.x}px; top: ${se.position.y}px; transform: none;`),ce.hasBeenResized?e.push(`width: ${ce.size.width}px; height: ${ce.size.height}px; max-width: none; max-height: none;`):(t.preferredHeight&&e.push(`min-height: ${t.preferredHeight};`),i()&&e.push(`max-width: ${i()};`)),h.get(ee)&&t.glow&&(e.push(`--modal-glow-color: ${t.glow.color};`),e.push(`--modal-glow-intensity: ${t.glow.intensity};`)),e.join(" ")});function nt(){h.get(f)&&Z(t.id)}function ot(){var e;me(t.id)&&ve(t.id),ae(t.id),null==(e=t.onClose)||e.call(t)}function rt(){Me(t.id)}function dt(e){h.get(p)&&h.get(b)&&se.onPointerDown(e,h.get(b))}function st(e){o()&&"Escape"===e.key&&re(t.id)&&(e.stopPropagation(),ot())}function at(e){if(!h.get(b))return;const i=se.isDragging,n=ce.hasBeenResized?ce.size:{width:h.get(b).offsetWidth,height:h.get(b).offsetHeight};se.onPointerMove(e,h.get(b),n),se.isDragging&&i&&ie(t.id,se.position,{drag:!0})}function lt(e){if(!h.get(b))return;const i=se.isDragging;se.onPointerUp(e,h.get(b)),i&&!ce.justFinishedResizing&&(ie(t.id,se.position,{drag:!0}),function(e){const t=I();if("animated"!==t.parentChild.movementMode)return;const i=t.parentChild.animationDuration,n=[];let o=e;for(;;){const e=E.get(o);if(!(null==e?void 0:e.parentId))break;n.push({parentId:e.parentId,childId:o}),o=e.parentId}n.forEach(({parentId:e,childId:t},n)=>{setTimeout(()=>{const n=E.get(t),o=E.get(e);if(!(null==n?void 0:n.position)||!n.offsetFromParent||!o)return;const r={x:n.position.x-n.offsetFromParent.x,y:n.position.y-n.offsetFromParent.y};G.set(e,r),function(e){const t=G.get(e);if(!t)return;const i=E.get(e);i&&(E.set(e,{...i,isAnimatingPosition:!0,position:t}),G.delete(e),T())}(e),setTimeout(()=>function(e){const t=E.get(e);t&&(E.set(e,{...t,isAnimatingPosition:!1}),T())}(e),i)},n*i)})}(t.id))}function ct(){var e;const i=I();if("smart"!==(null==(e=i.positioning)?void 0:e.strategy))return!1;const n=ue(t.id);if(null==n?void 0:n.parentId)return!1;if((null==n?void 0:n.hasBeenDragged)||(null==n?void 0:n.position))return!1;const o=h.get(b)||document.querySelector(`[data-modal-id="${t.id}"]`);if(!o)return!1;const r=o.offsetWidth,d=o.offsetHeight;if(r<=0||d<=0)return!1;const s=i.positioning.modalGap??16,a=function(e){const t=[];for(const[i,n]of E.entries())if(i!==e&&n.isOpen&&!n.isMinimized&&!n.isHiddenWithParent)if(n.position&&n.size)t.push({x:n.position.x,y:n.position.y,width:n.size.width,height:n.size.height});else{const e=document.querySelector(`[data-modal-id="${String(i)}"]`);if(e){const i=e.getBoundingClientRect();t.push({x:i.left,y:i.top,width:i.width,height:i.height})}}return t}(t.id),l=function(e){if("undefined"==typeof document)return[];const t=[];for(const i of e)try{const e=document.querySelectorAll(i);for(const i of e){const e=i.getBoundingClientRect();e.width>0&&e.height>0&&t.push({x:e.left,y:e.top,width:e.width,height:e.height})}}catch{}return t}(i.positioning.avoidElements??[]),c=function(e,t,i,n={}){const{modalGap:o=16,gridResolution:r=10,avoidBounds:d=[],avoidMargin:s=16}=n,a=n.margin??o,l="undefined"!=typeof window?window.innerWidth:1920,c="undefined"!=typeof window?window.innerHeight:1080,g=d.map(e=>({x:e.x-s,y:e.y-s,width:e.width+2*s,height:e.height+2*s})),u={x:(l-e)/2,y:(c-t)/2};if(0===i.length&&0===g.length)return u;const h=a,p=Math.max(a,l-e-a),f=a,m=Math.max(a,c-t-a);if(p<=h||m<=f)return u;const v=D(u.x,u.y,e,t,i,o),w=D(u.x,u.y,e,t,g,0);if(0===v&&0===w)return u;const y=[],x=(p-h)/r,z=(m-f)/r;for(let n=0;n<=r;n++)for(let d=0;d<=r;d++){const r=h+n*x,s=f+d*z,u=D(r,s,e,t,i,o),p=D(r,s,e,t,g,0),m=B(r,s,e,t,l,c,a);y.push({pos:{x:r,y:s},modalOverlap:u,avoidOverlap:p,centerDist:m})}const I=y.filter(e=>0===e.avoidOverlap),b=I.length>0?I:y,M=e*t,_=Math.min(...b.map(e=>e.modalOverlap))/M;return b.sort((e,t)=>{if(0===I.length&&e.avoidOverlap!==t.avoidOverlap)return e.avoidOverlap-t.avoidOverlap;const i=e.modalOverlap/M,n=t.modalOverlap/M;if(_<.3){const o=.3,r=i<=o,d=n<=o;if(r&&d)return e.centerDist+.3*i-(t.centerDist+.3*n);if(r)return-1;if(d)return 1}return.6*i+.4*e.centerDist-(.6*n+.4*t.centerDist)}),b[0].pos}(r,d,a,{modalGap:s,avoidBounds:l});if(D(c.x,c.y,r,d,a,s)/(r*d)>.1&&a.length>0){const e=function(e){const t=[];for(const[i,n]of E.entries())if(i!==e&&n.isOpen&&!n.isMinimized&&!n.isHiddenWithParent&&!n.parentId)if(n.position&&n.size)t.push({id:String(i),x:n.position.x,y:n.position.y,width:n.size.width,height:n.size.height});else{const e=document.querySelector(`[data-modal-id="${String(i)}"]`);if(e){const n=e.getBoundingClientRect();t.push({id:String(i),x:n.left,y:n.top,width:n.width,height:n.height})}}return t}(t.id),i=function(e,t,i,n={}){const{modalGap:o=16}=n,r=n.margin??o,d="undefined"!=typeof window?window.innerWidth:1920,s="undefined"!=typeof window?window.innerHeight:1080,a=i.reduce((e,t)=>e+t.width,0)+e,l=i.length*o,c=d-2*r;if(a+l>c)return null;const g=c-a-l;i.length;const u=g/2,h=d/2,p=[...i.map(e=>({id:e.id,width:e.width,height:e.height,currentX:e.x+e.width/2,currentY:e.y,isNew:!1})),{id:"__new__",width:e,height:t,currentX:h,currentY:(s-t)/2,isNew:!0}];p.sort((e,t)=>e.currentX-t.currentX);let f=r+u;const m=new Map;let v=null;for(const e of p){const t=f;if(e.isNew)v={x:Math.round(t),y:Math.round(e.currentY)};else{const n=i.find(t=>t.id===e.id);Math.abs(t-n.x)>5&&m.set(e.id,{x:Math.round(t),y:Math.round(n.y)})}f+=e.width+o}return v?{newModalPosition:v,existingModalMoves:m}:null}(r,d,e,{modalGap:s});if(i&&i.existingModalMoves.size>0)return function(e){const t=I().parentChild.animationDuration;for(const[t,i]of e){const e=E.get(t);e&&E.set(t,{...e,position:i,isAnimatingPosition:!0,hasBeenDragged:!0})}T(),setTimeout(()=>{for(const t of e.keys()){const e=E.get(t);e&&E.set(t,{...e,isAnimatingPosition:!1})}T()},t)}(i.existingModalMoves),se.setPosition(i.newModalPosition),se.setHasBeenDragged(!0),ie(t.id,i.newModalPosition,{size:{width:r,height:d}}),!0}return se.setPosition(c),se.setHasBeenDragged(!0),ie(t.id,c,{size:{width:r,height:d}}),!0}function gt(){l().then(()=>l()).then(()=>{let e=0;const t=()=>{e+=1,ct()||e>5||requestAnimationFrame(t)};h.get(b)?t():requestAnimationFrame(t)})}d(()=>{var e;function i(){const e=ue(t.id);if(!(null==e?void 0:e.position)||!h.get(b))return;if(e.parentId)return;const i=ce.hasBeenResized?ce.size.width:h.get(b).offsetWidth,n=ce.hasBeenResized?ce.size.height:h.get(b).offsetHeight;if(i<=0||n<=0)return;const o=k(e.position.x,e.position.y,i,n);(Math.abs(o.x-e.position.x)>1||Math.abs(o.y-e.position.y)>1)&&(se.setPosition(o),ie(t.id,o))}return r()||(e=n(),Q({id:t.id,title:t.title,icon:t.icon??"",isOpen:e,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:t.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),e&&oe(t.id)),n()&&(l().then(()=>{h.get(b)&&Ie(h.get(b))}),gt()),window.addEventListener("pointermove",at),window.addEventListener("pointerup",lt),window.addEventListener("resize",i),()=>{window.removeEventListener("pointermove",at),window.removeEventListener("pointerup",lt),window.removeEventListener("resize",i)}}),c(()=>{_e(t.id),r()||J(t.id)}),h.user_effect(()=>{he();const e=ue(t.id);if(e){if(h.set(M,e.isTransparent,!0),!se.isDragging&&!ce.isResizing&&e.position){const t=se.position,i=e.position;(Math.abs(t.x-i.x)>.5||Math.abs(t.y-i.y)>.5)&&(se.setPosition(i),e.hasBeenDragged&&se.setHasBeenDragged(!0))}l().then(()=>function(){var e,i;if(!ue(t.id))return;if(me(t.id))return ve(t.id),void(null==(e=t.onClose)||e.call(t));if(ge(t.id)&&!h.get(R)){if(h.set(R,!0),h.get(q),h.set(q,null),h.get(b)){const e=h.get(b).getBoundingClientRect(),i=se.hasBeenDragged?se.position:{x:e.left,y:e.top},n=ce.hasBeenResized?ce.size:{width:e.width,height:e.height};ne(t.id,{position:i,size:n,hasBeenDragged:!0})}xe.startMinimize(void 0,()=>{var e;e=t.id,h.get(S).includes(e)&&h.set(S,h.get(S).filter(t=>t!==e),!0),h.set(R,!1)})}if(we(t.id)){i=t.id,h.get(L).includes(i)&&h.set(L,h.get(L).filter(e=>e!==i),!0);const e=ue(t.id);xe.startRestore((null==e?void 0:e.position)??void 0,(null==e?void 0:e.size)??void 0),l().then(()=>{h.get(b)&&Ie(h.get(b))})}if(ye(t.id)){!function(e){h.get(X).includes(e)&&h.set(X,h.get(X).filter(t=>t!==e),!0)}(t.id);const e=ue(t.id);xe.startRestore((null==e?void 0:e.position)??void 0,(null==e?void 0:e.size)??void 0)}if(fe(t.id)&&(function(e){h.get(F).includes(e)&&h.set(F,h.get(F).filter(t=>t!==e),!0)}(t.id),xe.startClose(()=>{var e;_e(t.id),function(e){const t=E.get(e);if(t){if(t.parentId){const i=E.get(t.parentId);i&&i.childId===e&&E.set(t.parentId,{...i,childId:void 0,lastChildId:e})}E.set(e,{...t,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),T()}}(t.id),null==(e=t.onClose)||e.call(t)})),pe(t.id)){!function(e){h.get(W).includes(e)&&h.set(W,h.get(W).filter(t=>t!==e),!0)}(t.id);const e=function(e){const t=j.get(e);return t&&j.delete(e),t??null}(t.id)||t.openSourcePosition||null;e?(xe.setPendingOpenSource(e),l().then(()=>l()).then(()=>{ct(),xe.tryStartOpenAnimation()})):gt(),l().then(()=>{h.get(b)&&Ie(h.get(b))})}(function(e){return h.get(A).includes(e)})(t.id)&&(function(e){h.get(A).includes(e)&&h.set(A,h.get(A).filter(t=>t!==e),!0)}(t.id),function(e){h.get(Y).includes(e)||h.set(Y,[...h.get(Y),e],!0)}(t.id),h.set(O,!0),setTimeout(()=>{h.set(O,!1),function(e){h.set(Y,h.get(Y).filter(t=>t!==e),!0)}(t.id)},600));const n=function(e){if(!h.get(N)||h.get(N).childId!==e)return null;const t=h.get(N);return h.set(N,null),t}(t.id);var o;n&&h.get(b)&&(o=n.parentId,l().then(()=>l()).then(()=>{let e=0;const i=()=>{e+=1;const n=function(e){var i,n;const o=ue(e);if(!o)return!1;const r=h.get(b)||document.querySelector(`[data-modal-id="${t.id}"]`),d=document.querySelector(`[data-modal-id="${e}"]`),s=null==d?void 0:d.getBoundingClientRect(),a=o.position??(s?{x:s.left,y:s.top}:null);if(!a||!r)return!1;const l=(null==(i=o.size)?void 0:i.width)??(null==d?void 0:d.offsetWidth)??(null==s?void 0:s.width)??480,c=(null==(n=o.size)?void 0:n.height)??(null==d?void 0:d.offsetHeight)??(null==s?void 0:s.height)??400,g=r.offsetWidth,u=r.offsetHeight;if(l<=0||c<=0||g<=0||u<=0)return!1;const p={x:a.x+(l-g)/2,y:a.y+(c-u)/2};return se.setPosition(p),se.setHasBeenDragged(!0),ie(t.id,p,{size:{width:g,height:u}}),o.position&&o.size||!s||ie(e,{x:s.left,y:s.top},{size:{width:l,height:c}}),function(e,t){if(!I().features.parentChild)return;const i=E.get(e),n=E.get(t);if(!i||!n)return;let o={x:40,y:40};i.position&&n.position&&(o={x:n.position.x-i.position.x,y:n.position.y-i.position.y});const r=Math.max(n.zIndex,i.zIndex+1);E.set(e,{...i,childId:t,lastChildId:t}),E.set(t,{...n,parentId:e,offsetFromParent:o,zIndex:r}),T()}(e,t.id),!0}(o);n||e>5||requestAnimationFrame(i)};h.get(b)?i():requestAnimationFrame(i)}))}())}}),h.user_effect(()=>{const e=ue(t.id);e&&e.isTransparent!==h.get(M)&&h.set(M,e.isTransparent,!0)}),h.user_effect(()=>{if(h.get($)&&h.get(b)){const e=e=>function(e){h.get(b)&&ze(e,h.get(b))}(e);return h.get(b).addEventListener("keydown",e),()=>{var t;return null==(t=h.get(b))?void 0:t.removeEventListener("keydown",e)}}}),h.user_effect(()=>{!h.get($)&&xe.isMinimizing&&xe.forceClearMinimize()}),h.user_effect(()=>{xe.isRestoring||xe.isOpening?h.set(Be,!0):h.get(Be)&&requestAnimationFrame(()=>{h.set(Be,!1)})}),h.user_effect(()=>{h.get(P)&&!h.get(U)&&(h.set(_,!0),setTimeout(()=>{h.set(_,!1)},200)),h.set(P,h.get(U),!0)});var ut=h.comment(),ht=h.first_child(ut),pt=e=>{Se(e,{get target(){return g},children:(e,i)=>{var n=it();let o;n.__keydown=st;var r=h.child(n);{let e=h.derived(()=>h.get(p)?dt:void 0);!function(e,t){h.push(t,!0);let i=h.prop(t,"isTransparent",3,!1),n=h.prop(t,"headerLayout",3,"macos"),o=h.prop(t,"minimizable",3,!0),r=h.prop(t,"minimizeDisabled",3,!1),d=h.prop(t,"transparencyEnabled",3,!0);const a=s(Ce),l=h.derived(()=>null==a?void 0:a()),c=h.derived(()=>"macos"===n());var g=Qe();let u;g.__pointerdown=function(e){var i;e.target.closest("button")||null==(i=t.onStartDrag)||i.call(t,e)};var p=h.child(g),f=e=>{var i=Ye(),n=h.first_child(i),s=h.child(n);s.__click=function(...e){var i;null==(i=t.onClose)||i.apply(this,e)};var a=h.sibling(s,2),c=e=>{var i=We();let n;i.__click=function(...e){var i;null==(i=r()?void 0:t.onMinimize)||i.apply(this,e)},h.template_effect(()=>{n=h.set_class(i,1,"modal-header-light modal-header-light-minimize",null,n,{"modal-header-light-disabled":r()}),i.disabled=r(),h.set_attribute(i,"title",r()?"Enable dock to minimize":void 0)}),h.append(e,i)};h.if(a,e=>{o()&&e(c)});var g=h.sibling(a,2),u=e=>{var i=Fe();i.__click=function(...e){var i;null==(i=t.onToggleStyle)||i.apply(this,e)},h.append(e,i)};h.if(g,e=>{d()&&e(u)}),h.reset(n);var p=h.sibling(n,2),f=h.child(p),m=e=>{var i=$e(),n=h.child(i);h.snippet(n,()=>t.customIcon),h.reset(i),h.append(e,i)},v=e=>{var i=h.comment(),n=h.first_child(i),o=e=>{var i=Le(),n=h.child(i);h.snippet(n,()=>h.get(l),()=>t.icon),h.reset(i),h.append(e,i)};h.if(n,e=>{t.icon&&h.get(l)&&e(o)},!0),h.append(e,i)};h.if(f,e=>{t.customIcon?e(m):e(v,!1)});var w=h.sibling(f,2),y=h.child(w),x=e=>{var i=Xe(),n=h.child(i,!0);h.reset(i),h.template_effect(()=>{h.set_attribute(i,"id",t.titleId),h.set_text(n,t.title)}),h.append(e,i)},z=e=>{var i=Ae(),n=h.child(i,!0);h.reset(i),h.template_effect(()=>h.set_text(n,t.title)),h.append(e,i)};h.if(y,e=>{t.titleId?e(x):e(z,!1)}),h.reset(w),h.reset(p),h.next(2),h.append(e,i)},m=e=>{var i=Ke(),n=h.first_child(i),s=h.child(n),a=e=>{var i=qe(),n=h.child(i);h.snippet(n,()=>t.customIcon),h.reset(i),h.append(e,i)},c=e=>{var i=h.comment(),n=h.first_child(i),o=e=>{var i=je(),n=h.child(i);h.snippet(n,()=>h.get(l),()=>t.icon),h.reset(i),h.append(e,i)};h.if(n,e=>{t.icon&&h.get(l)&&e(o)},!0),h.append(e,i)};h.if(s,e=>{t.customIcon?e(a):e(c,!1)});var g=h.sibling(s,2),u=e=>{var i=Ne(),n=h.child(i,!0);h.reset(i),h.template_effect(()=>{h.set_attribute(i,"id",t.titleId),h.set_text(n,t.title)}),h.append(e,i)},p=e=>{var i=Ge(),n=h.child(i,!0);h.reset(i),h.template_effect(()=>h.set_text(n,t.title)),h.append(e,i)};h.if(g,e=>{t.titleId?e(u):e(p,!1)}),h.reset(n);var f=h.sibling(n,2),m=h.child(f),v=e=>{var i=Ue();i.__click=function(...e){var i;null==(i=t.onToggleStyle)||i.apply(this,e)},h.append(e,i)};h.if(m,e=>{d()&&e(v)});var w=h.sibling(m,2),y=e=>{var i=Ve();let n;i.__click=function(...e){var i;null==(i=r()?void 0:t.onMinimize)||i.apply(this,e)},h.template_effect(()=>{n=h.set_class(i,1,"modal-header-btn-windows",null,n,{"modal-header-btn-windows-disabled":r()}),i.disabled=r(),h.set_attribute(i,"title",r()?"Enable dock to minimize":void 0)}),h.append(e,i)};h.if(w,e=>{o()&&e(y)}),h.sibling(w,2).__click=function(...e){var i;null==(i=t.onClose)||i.apply(this,e)},h.reset(f),h.append(e,i)};h.if(p,e=>{h.get(c)?e(f):e(m,!1)}),h.reset(g),h.template_effect(()=>u=h.set_class(g,1,"modal-header",null,u,{"modal-header-draggable":!!t.onStartDrag,transparent:i()})),h.append(e,g),h.pop()}(r,{get title(){return t.title},get customIcon(){return t.customIcon},get icon(){return t.icon},get isTransparent(){return h.get(M)},get titleId(){return h.get(te)},get headerLayout(){return h.get(x)},get onStartDrag(){return h.get(e)},onToggleStyle:rt,onMinimize:nt,onClose:ot,get minimizable(){return h.get(f)},get minimizeDisabled(){return h.get(m)},get transparencyEnabled(){return h.get(v)}})}var d=h.sibling(r,2),a=h.child(d);h.snippet(a,()=>t.children??h.noop),h.reset(d);var l=h.sibling(d,2),c=e=>{var i=et(),n=h.child(i);h.snippet(n,()=>t.footer),h.reset(i),h.append(e,i)};h.if(l,e=>{t.footer&&e(c)});var g=h.sibling(l,2);{let e=h.derived(()=>h.get(w)&&!h.get(U)?ce.handlers.startResize:void 0);!function(e,t){h.push(t,!0);const i=["n","s","e","w","ne","nw","se","sw"];var n=h.comment(),o=h.first_child(n),r=e=>{var n=Ze();h.each(n,21,()=>i,h.index,(e,i)=>{var n=Je();n.__pointerdown=e=>function(e,i){var n;null==(n=t.onStartResize)||n.call(t,e,i)}(e,h.get(i)),h.template_effect(()=>h.set_class(n,1,`modal-resize-handle modal-resize-${h.get(i)??""}`)),h.append(e,n)}),h.reset(n),h.append(e,n)};h.if(o,e=>{t.onStartResize&&e(r)}),h.append(e,n),h.pop()}(g,{get onStartResize(){return h.get(e)}})}var u=h.sibling(g,2),y=e=>{var t=tt();let i;h.template_effect(()=>i=h.set_class(t,1,"modal-child-overlay",null,i,{"modal-overlay-closing":h.get(_)})),h.append(e,t)};h.if(u,e=>{h.get(K)&&e(y)}),h.reset(n),h.bind_this(n,e=>h.set(b,e),()=>h.get(b)),h.template_effect(()=>{var e;o=h.set_class(n,1,"modal-dialog",null,o,{"modal-dragging":se.isDragging,"modal-resizing":ce.isResizing,"modal-positioned":se.hasBeenDragged,"modal-minimizing":xe.isMinimizing,"modal-restoring":xe.isRestoring,"modal-opening":xe.isOpening,"modal-closing":xe.isClosing,"modal-centered":h.get(Te),"modal-solid":!h.get(M),"modal-transparent":h.get(M),"modal-glow":h.get(ee),"modal-has-child":h.get(U),"modal-is-child":h.get(V),"modal-visible-by-animation":h.get(Ee),"modal-animating-to-center":h.get(le),"modal-animating-position":null==(e=h.get(H))?void 0:e.isAnimatingPosition,"modal-attention":h.get(O)}),h.set_attribute(n,"data-modal-id",t.id),h.set_style(n,h.get(He)),h.set_attribute(n,"aria-labelledby",h.get(te))}),h.event("pointerdown",n,()=>oe(t.id),!0),h.append(e,n)},$$slots:{default:!0}})};h.if(ht,e=>{h.get($)&&e(pt)}),h.append(e,ut),h.pop()}(e,{get id(){return t.id},get title(){return t.title},get icon(){return t.icon},get customIcon(){return t.customIcon},get maxWidth(){return i()},get preferredHeight(){return t.preferredHeight},get autoOpen(){return n()},get openSourcePosition(){return t.openSourcePosition},get glow(){return t.glow},get config(){return t.config},get closeOnEscape(){return o()},get onClose(){return t.onClose},get children(){return t.children},get footer(){return t.footer},skipRegistration:!0})};h.if(p,e=>{h.get(g)&&e(f)}),h.append(e,u),h.pop()}h.delegate(["keydown"]);const ot=t(null);function rt({id:t,title:o,icon:r,customIcon:d,maxWidth:s,preferredHeight:a,autoOpen:l=!1,openSourcePosition:c,glow:h,config:p,closeOnEscape:f=!0,onClose:m,children:v,footer:w}){const y=i(null),x=i(null),z=i(null),I=i(null),b=i(null);n(()=>{if(!y.current)return;const e=v?()=>z.current:void 0,i=w?()=>I.current:void 0,n=d?()=>b.current:void 0;return x.current=g(nt,{target:y.current,props:{id:t,title:o,icon:r,customIcon:n,maxWidth:s,preferredHeight:a,autoOpen:l,openSourcePosition:c,glow:h,config:p,closeOnEscape:f,onClose:m,children:e,footer:i}}),()=>{x.current&&(u(x.current),x.current=null)}},[t]),n(()=>{x.current&&Object.assign(x.current,{title:o,maxWidth:s,preferredHeight:a,glow:h,config:p,closeOnEscape:f,onClose:m})},[o,s,a,h,p,f,m]);const M="symbol"==typeof t?t.description??"symbol":t;return e.createElement(ot.Provider,{value:t},e.createElement("div",{ref:y,"data-modal-bridge":M}),e.createElement("div",{style:{display:"none"}},v&&e.createElement("div",{ref:z},v),w&&e.createElement("div",{ref:I},w),d&&e.createElement("div",{ref:b},d)))}function dt({config:t,children:i}){return n(()=>{t&&b(t),h.set(M,I().zIndex.base,!0);const e=I().portalTarget;let i=null;return"string"==typeof e&&"undefined"!=typeof document&&(document.querySelector(e)||(i=document.createElement("div"),i.id=e.replace("#",""),document.body.appendChild(i))),()=>{y={...w},h.update(x),h.set(M,I().zIndex.base,!0),i&&i.remove()}},[t]),e.createElement(e.Fragment,null,i)}var st=h.from_html('<button type="button" aria-label="Drag dock"></button>'),at=h.from_html('<span class="modal-dock-item-icon-placeholder"> </span>'),lt=h.from_html('<span class="modal-dock-item-label"> </span>'),ct=h.from_html("<span>+</span>"),gt=h.from_html('<span class="modal-dock-child-indicator"><!></span>'),ut=h.from_html('<button><span class="modal-dock-item-icon"><!></span> <!> <span class="modal-dock-item-glow"></span> <!></button>'),ht=h.from_html('<div data-dock-container="true"><div><!> <!></div></div>');function pt(e,t){h.push(t,!0);const i=s(Ce),n=h.derived(()=>t.renderIcon??(null==i?void 0:i())),o=be(),r=h.derived(()=>(z(),I())),d=h.derived(()=>I().zIndex.dock),a=h.derived(()=>h.get(r).dock.position),l=h.derived(()=>h.get(r).dock.labelMode);let c=h.state("horizontal"),g=h.state(h.proxy({x:100,y:100})),u=h.state(null),w=h.state(!1),y={x:0,y:0},x=null;const b=h.derived(()=>(he(),Array.from(o.modals.values()).filter(e=>e.isMinimized).sort((e,t)=>e.dockPosition-t.dockPosition))),M=h.derived(()=>{switch(h.get(a)){case"left":return{x:-20,duration:250,easing:m};case"right":return{x:20,duration:250,easing:m};default:return{y:20,duration:250,easing:m}}});function _(e){var t;"free"===h.get(a)&&(h.set(w,!0),x=e.pointerId,y={x:e.clientX-h.get(g).x,y:e.clientY-h.get(g).y},null==(t=e.currentTarget)||t.setPointerCapture(e.pointerId),window.addEventListener("pointermove",C),window.addEventListener("pointerup",P),window.addEventListener("pointercancel",P))}function C(e){if(e.pointerId!==x||!h.get(u))return;const t=h.get(u).getBoundingClientRect(),i=window.innerWidth-t.width-8,n=window.innerHeight-t.height-8,o=Math.min(Math.max(e.clientX-y.x,8),Math.max(8,i)),r=Math.min(Math.max(e.clientY-y.y,8),Math.max(8,n));h.set(g,{x:Math.round(o),y:Math.round(r)},!0)}function P(e){e.pointerId===x&&(h.set(w,!1),x=null,window.removeEventListener("pointermove",C),window.removeEventListener("pointerup",P),window.removeEventListener("pointercancel",P))}const{addListener:D}=function(){function e(e,t,i){return"undefined"==typeof window?()=>{}:(window.addEventListener(e,t,i),()=>{window.removeEventListener(e,t,i)})}return{addListener:e,addListenerEffect:function(t,i,n){h.user_effect(()=>{if("undefined"!=typeof window)return e(t,i,n)})}}}();function B(){if("free"!==h.get(a)||!h.get(u))return;const e=h.get(u).getBoundingClientRect(),t=k(h.get(g).x,h.get(g).y,e.width,e.height);t.x===h.get(g).x&&t.y===h.get(g).y||h.set(g,{x:Math.round(t.x),y:Math.round(t.y)},!0)}h.user_effect(()=>{"undefined"!=typeof window&&D("resize",B)});var E={setDockOrientation:function(e){h.set(c,e,!0)},setDockFreePosition:function(e){h.set(g,e,!0)},getDockState:function(){return{dockPosition:h.get(a),dockOrientation:h.get(c),dockFreePosition:h.get(g),dockLabelMode:h.get(l)}}};return Se(e,{get target(){return h.get(r).portalTarget},children:(e,t)=>{var i=ht();let r,s;var m=h.child(i);let y;var x=h.child(m),z=e=>{var t=st();let i;t.__pointerdown=_,h.template_effect(()=>i=h.set_class(t,1,"modal-dock-handle",null,i,{"modal-dock-handle-dragging":h.get(w)})),h.append(e,t)};h.if(x,e=>{"free"===h.get(a)&&e(z)});var I=h.sibling(x,2);h.each(I,19,()=>h.get(b),e=>e.id,(e,t,i)=>{const r=h.derived(()=>h.get(t).lastChildId?o.modals.get(h.get(t).lastChildId):null);var d=ut();let s;d.__click=e=>{var i;i=h.get(t).id,U.has(i)?e.currentTarget.animate([{transform:"translateX(0)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(0)"}],{duration:300,easing:"ease-in-out"}):ee(h.get(t).id)};var a=h.child(d),c=h.child(a),g=e=>{var i=h.comment(),o=h.first_child(i);h.snippet(o,()=>h.get(n),()=>h.get(t).icon),h.append(e,i)},u=e=>{var i=at(),n=h.child(i,!0);h.reset(i),h.template_effect(e=>h.set_text(n,e),[()=>h.get(t).title.charAt(0)]),h.append(e,i)};h.if(c,e=>{h.get(t).icon&&h.get(n)?e(g):e(u,!1)}),h.reset(a);var f=h.sibling(a,2),m=e=>{var i=lt(),n=h.child(i,!0);h.reset(i),h.template_effect(()=>h.set_text(n,h.get(t).title)),h.append(e,i)};h.if(f,e=>{"hidden"!==h.get(l)&&e(m)});var w=h.sibling(f,4),y=e=>{var t=gt(),i=h.child(t),o=e=>{var t=h.comment(),i=h.first_child(t);h.snippet(i,()=>h.get(n),()=>h.get(r).icon),h.append(e,t)},d=e=>{var t=ct();h.append(e,t)};h.if(i,e=>{h.get(r).icon&&h.get(n)?e(o):e(d,!1)}),h.reset(t),h.append(e,t)};h.if(w,e=>{h.get(t).lastChildId&&h.get(r)&&e(y)}),h.reset(d),h.template_effect(()=>{s=h.set_class(d,1,"modal-dock-item",null,s,{"modal-dock-item-has-glow":!!h.get(t).glow,"modal-dock-item-has-child":!!h.get(t).lastChildId,"modal-dock-item-label-beside":"beside"===h.get(l),"modal-dock-item-label-below":"below"===h.get(l)}),h.set_attribute(d,"data-modal-id",h.get(t).id),h.set_style(d,h.get(t).glow?`--modal-dock-glow-color: ${h.get(t).glow.color};`:"")}),h.transition(3,d,()=>p,()=>({duration:300,delay:50*h.get(i),easing:v,start:.5})),h.append(e,d)}),h.reset(m),h.reset(i),h.bind_this(i,e=>h.set(u,e),()=>h.get(u)),h.template_effect(()=>{r=h.set_class(i,1,"modal-dock-container",null,r,{"modal-dock-left":"left"===h.get(a),"modal-dock-right":"right"===h.get(a),"modal-dock-bottom":"bottom"===h.get(a),"modal-dock-free":"free"===h.get(a),"modal-dock-empty":0===h.get(b).length}),s=h.set_style(i,"free"===h.get(a)?`left: ${h.get(g).x}px; top: ${h.get(g).y}px;`:"",s,{"z-index":h.get(d)}),y=h.set_class(m,1,"modal-dock",null,y,{"modal-dock-free-horizontal":"free"===h.get(a)&&"horizontal"===h.get(c),"modal-dock-free-vertical":"free"===h.get(a)&&"vertical"===h.get(c)})}),h.transition(3,i,()=>f,()=>h.get(b).length>0?h.get(M):{duration:0}),h.append(e,i)},$$slots:{default:!0}}),h.pop(E)}function ft({renderIcon:t}){const o=i(null),r=i(null);return n(()=>{if(o.current)return r.current=g(pt,{target:o.current,props:{}}),()=>{r.current&&(u(r.current),r.current=null)}},[]),e.createElement("div",{ref:o,"data-dock-bridge":!0})}function mt(e,t){if(!Ie(e))throw new Error(`Cannot call ${t}() on unregistered modal "${String(e)}". Ensure the Modal component is rendered.`)}h.delegate(["pointerdown","click"]);const vt=new Map;function wt(e){const t=o(()=>function(e){const t=be().modals.get(e),i=void 0!==t&&!t.isMinimized,n=(null==t?void 0:t.isMinimized)??!1,o=void 0!==t,r=vt.get(e);if(r&&r.isOpen===i&&r.isMinimized===n&&r.isRegistered===o)return r;const d={isOpen:i,isMinimized:n,isRegistered:o};return vt.set(e,d),d}(e),[e]);return{...r(H,t,t),open:o(t=>{mt(e,"open"),se(e,t)},[e]),close:o(()=>{mt(e,"close"),ae(e)},[e]),minimize:o(()=>{mt(e,"minimize"),Z(e)},[e]),restore:o(()=>{mt(e,"restore"),ee(e)},[e]),openChild:o((t,i)=>{mt(e,"openChild"),ce({id:t},e,i)},[e]),shake:o(()=>{mt(e,"shake"),xe(e)},[e]),bringToFront:o(()=>{mt(e,"bringToFront"),oe(e)},[e])}}let yt=null;function xt(){const e=be(),t=Array.from(e.modals.values()),i=t.filter(e=>e.isMinimized).length,n=t.filter(e=>!e.isMinimized).length;return yt&&yt.modals===e.modals&&yt.minimizedCount===i&&yt.openCount===n||(yt={modals:e.modals,minimizedCount:i,openCount:n}),yt}function zt(){return r(H,xt,xt)}export{ft as Dock,rt as Modal,dt as ModalProvider,oe as bringToFront,le as closeAllModals,ae as closeModal,I as getConfig,ze as isModalOpen,Ie as isModalRegistered,re as isTopModal,Z as minimizeModal,ce as openChildModal,se as openModal,de as reorderDock,ee as restoreModal,b as setConfig,Me as toggleModalTransparency,wt as useModal,zt as useModals};
|
|
1
|
+
import{r as e,u as n,m as t,M as r,a as o,t as i,s as l,i as s,g as c,b as u,c as a,D as d,d as m,o as p,e as f,f as g,h,j as y,k as M,l as z,n as v,p as C}from"./runtime.js";import{q as E,v as b,w as O}from"./runtime.js";import{jsxs as j,Fragment as k,jsx as w}from"react/jsx-runtime";import x,{useRef as T,useState as F,useEffect as H,useCallback as R,useSyncExternalStore as W}from"react";import{createPortal as A}from"react-dom";function D({id:l,title:s,icon:c,maxWidth:u="600px",preferredHeight:a,autoOpen:d=!1,glow:m,config:p,closeOnEscape:f=!0,onClose:g,children:h,footer:y}){const M=T(null),z=T(null),v=T(null),C=T(null),[E,b]=F(!1),[O,x]=F(!1);H(()=>(e({id:l,title:s,icon:c??"",isOpen:d,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:m??null}),b(!0),()=>{n(l)}),[l]),H(()=>{if(!E||!M.current)return;const e=h?(v.current||"undefined"==typeof document||(v.current=document.createElement("div"),v.current.className="react-modal-body-content"),v.current):null,n=y?(C.current||"undefined"==typeof document||(C.current=document.createElement("div"),C.current.className="react-modal-footer-content"),C.current):null;return z.current=t(r,{target:M.current,props:{id:l,title:s,icon:c??"",maxWidth:u,preferredHeight:a,closeOnEscape:f,onClose:g,bodyElement:e,footerElement:n}}),x(!0),()=>{z.current&&(o(z.current),z.current=null,x(!1)),v.current=null,C.current=null}},[E,l]);const R=i(l),W=O?v.current:null,D=O?C.current:null;return j(k,{children:[w("div",{ref:M,"data-modal-bridge":R,style:{display:"contents"}}),W&&h&&A(h,W),D&&y&&A(y,D)]})}function N({config:e,children:n}){return H(()=>{e&&l(e),s();const n=c().portalTarget;let t=null;return"string"==typeof n&&"undefined"!=typeof document&&(document.querySelector(n)||(t=document.createElement("div"),t.id=n.replace("#",""),document.body.appendChild(t))),()=>{u(),a(),t&&t.remove()}},[e]),x.createElement(x.Fragment,null,n)}function P({renderIcon:e}){const n=T(null),r=T(null);return H(()=>{if(n.current)return r.current=t(d,{target:n.current,props:{}}),()=>{r.current&&(o(r.current),r.current=null)}},[]),w("div",{ref:n,"data-dock-bridge":"true",style:{display:"contents"}})}function S(e,n){if(!C(e))throw new Error(`Cannot call ${n}() on unregistered modal "${String(e)}". Ensure the Modal component is rendered.`)}const $=new Map;function q(e){const n=R(()=>function(e){const n=v().modals.get(e),t=void 0!==n&&!n.isMinimized,r=(null==n?void 0:n.isMinimized)??!1,o=void 0!==n,i=$.get(e);if(i&&i.isOpen===t&&i.isMinimized===r&&i.isRegistered===o)return i;const l={isOpen:t,isMinimized:r,isRegistered:o};return $.set(e,l),l}(e),[e]);return{...W(m,n,n),open:R(n=>{S(e,"open"),p(e,n)},[e]),close:R(()=>{S(e,"close"),f(e)},[e]),minimize:R(()=>{S(e,"minimize"),g(e)},[e]),restore:R(()=>{S(e,"restore"),h(e)},[e]),openChild:R((n,t)=>{S(e,"openChild"),y({id:n},e,t)},[e]),shake:R(()=>{S(e,"shake"),M(e)},[e]),bringToFront:R(()=>{S(e,"bringToFront"),z(e)},[e])}}let B=null;function I(){const e=v(),n=Array.from(e.modals.values()),t=n.filter(e=>e.isMinimized).length,r=n.filter(e=>!e.isMinimized).length;return B&&B.modals===e.modals&&B.minimizedCount===t&&B.openCount===r||(B={modals:e.modals,minimizedCount:t,openCount:r}),B}function G(){return W(m,I,I)}export{P as Dock,D as Modal,N as ModalProvider,z as bringToFront,E as closeAllModals,f as closeModal,c as getConfig,b as isModalOpen,C as isModalRegistered,g as minimizeModal,y as openChildModal,p as openModal,h as restoreModal,l as setConfig,O as toggleModalTransparency,q as useModal,G as useModals};
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t,e,n,i,r,o,s,a,l,d,u,c,f,h,p,v,g,m,w,y,x,b,M,z,k,I,_,P,D,C,S,O,E,W,T,B,R,A,L,H,$,F,q=Object.defineProperty,j=t=>{throw TypeError(t)},X=(t,e,n)=>((t,e,n)=>e in t?q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n),Y=(t,e,n)=>e.has(t)||j("Cannot "+n),N=(t,e,n)=>(Y(t,e,"read from private field"),n?n.call(t):e.get(t)),K=(t,e,n)=>e.has(t)?j("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),G=(t,e,n,i)=>(Y(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),V=(t,e,n)=>(Y(t,e,"access private method"),n);const U=Symbol();var Q=Array.isArray,J=Array.prototype.indexOf,Z=Array.from,tt=Object.defineProperty,et=Object.getOwnPropertyDescriptor,nt=Object.getOwnPropertyDescriptors,it=Object.prototype,rt=Array.prototype,ot=Object.getPrototypeOf,st=Object.isExtensible;const at=()=>{};function lt(){var t,e;return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}}const dt=16,ut=512,ct=1024,ft=2048,ht=4096,pt=8192,vt=16384,gt=32768,mt=65536,wt=1<<18,yt=1<<19,xt=1<<25,bt=32768,Mt=1<<21,zt=1<<23,kt=Symbol("$state"),It=Symbol(""),_t=new class extends Error{constructor(){super(...arguments),X(this,"name","StaleReactionError"),X(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function Pt(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Dt(t){return t===this.v}function Ct(t,e){return t!=t?e==e:t!==e||null!==t&&"object"==typeof t||"function"==typeof t}function St(t){return!Ct(t,this.v)}let Ot=null;function Et(t){Ot=t}function Wt(t){return Rt().get(t)}function Tt(t,e=!1,n){Ot={p:Ot,i:!1,c:null,e:null,s:t,x:null,l:null}}function Bt(t){var e=Ot,n=e.e;if(null!==n)for(var i of(e.e=null,n))$e(i);return void 0!==t&&(e.x=t),e.i=!0,Ot=e.p,t??{}}function Rt(t){return null===Ot&&Pt(),Ot.c??(Ot.c=new Map(function(){let t=Ot.p;for(;null!==t;){const e=t.c;if(null!==e)return e;t=t.p}return null}()||void 0))}let At=[];function Lt(){var t=At;At=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function Ht(t){if(0===At.length&&!Vt){var e=At;queueMicrotask(()=>{e===At&&Lt()})}At.push(t)}function $t(){for(;At.length>0;)Lt()}function Ft(t){var e=dn;if(null===e)return sn.f|=zt,t;if(0===(e.f>)){if(!(128&e.f))throw t;e.b.error(t)}else qt(t,e)}function qt(t,e){for(;null!==e;){if(128&e.f)try{return void e.b.error(t)}catch(e){t=e}e=e.parent}throw t}const jt=new Set;let Xt=null,Yt=null,Nt=[],Kt=null,Gt=!1,Vt=!1;t=new WeakMap,e=new WeakMap,n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,a=new WeakSet,l=function(t,e){var n;t.f^=ct;for(var i=t.first;null!==i;){var r=i.f,s=!!(96&r),l=s&&0!==(r&ct)||0!==(r&pt)||this.skipped_effects.has(i);if(!!(128&i.f)&&(null==(n=i.b)?void 0:n.is_pending())&&(e={parent:e,effect:i,effects:[],render_effects:[]}),!l&&null!==i.fn){s?i.f^=ct:4&r?e.effects.push(i):bn(i)&&(0!==(i.f&dt)&&N(this,o).add(i),_n(i));var u=i.first;if(null!==u){i=u;continue}}var c=i.parent;for(i=i.next;null===i&&null!==c;)c===e.effect&&(V(this,a,d).call(this,e.effects),V(this,a,d).call(this,e.render_effects),e=e.parent),i=c.next,c=c.parent}},d=function(t){for(const e of t)0!==(e.f&ft)?N(this,o).add(e):0!==(e.f&ht)&&N(this,s).add(e),V(this,a,u).call(this,e.deps),Wn(e,ct)},u=function(t){if(null!==t)for(const e of t)2&e.f&&0!==(e.f&bt)&&(e.f^=bt,V(this,a,u).call(this,e.deps))},c=function(){if(0===N(this,i)){for(const e of N(this,t))e();N(this,t).clear()}0===N(this,n)&&V(this,a,f).call(this)},f=function(){var t;if(jt.size>1){this.previous.clear();var e=Yt,n=!0,i={parent:null,effect:null,effects:[],render_effects:[]};for(const e of jt){if(e===this){n=!1;continue}const o=[];for(const[t,i]of this.current){if(e.current.has(t)){if(!n||i===e.current.get(t))continue;e.current.set(t,i)}o.push(t)}if(0===o.length)continue;const s=[...e.current.keys()].filter(t=>!this.current.has(t));if(s.length>0){var r=Nt;Nt=[];const n=new Set,d=new Map;for(const t of o)ee(t,s,n,d);if(Nt.length>0){Xt=e,e.apply();for(const n of Nt)V(t=e,a,l).call(t,n,i);e.deactivate()}Nt=r}}Xt=null,Yt=e}this.committed=!0,jt.delete(this)};let Ut=class u{constructor(){K(this,a),X(this,"committed",!1),X(this,"current",new Map),X(this,"previous",new Map),K(this,t,new Set),K(this,e,new Set),K(this,n,0),K(this,i,0),K(this,r,null),K(this,o,new Set),K(this,s,new Set),X(this,"skipped_effects",new Set),X(this,"is_fork",!1)}is_deferred(){return this.is_fork||N(this,i)>0}process(t){var e;Nt=[],this.apply();var n={parent:null,effect:null,effects:[],render_effects:[]};for(const e of t)V(this,a,l).call(this,e,n);this.is_fork||V(this,a,c).call(this),this.is_deferred()?(V(this,a,d).call(this,n.effects),V(this,a,d).call(this,n.render_effects)):(Xt=null,te(n.render_effects),te(n.effects),null==(e=N(this,r))||e.resolve()),Yt=null}capture(t,e){this.previous.has(t)||this.previous.set(t,e),0===(t.f&zt)&&(this.current.set(t,t.v),null==Yt||Yt.set(t,t.v))}activate(){Xt=this,this.apply()}deactivate(){Xt===this&&(Xt=null,Yt=null)}flush(){if(this.activate(),Nt.length>0){if(Qt(),null!==Xt&&Xt!==this)return}else 0===N(this,n)&&this.process([]);this.deactivate()}discard(){for(const t of N(this,e))t(this);N(this,e).clear()}increment(t){G(this,n,N(this,n)+1),t&&G(this,i,N(this,i)+1)}decrement(t){G(this,n,N(this,n)-1),t&&G(this,i,N(this,i)-1),this.revive()}revive(){for(const t of N(this,o))N(this,s).delete(t),Wn(t,ft),ie(t);for(const t of N(this,s))Wn(t,ht),ie(t);this.flush()}oncommit(e){N(this,t).add(e)}ondiscard(t){N(this,e).add(t)}settled(){return(N(this,r)??G(this,r,lt())).promise}static ensure(){if(null===Xt){const t=Xt=new u;jt.add(Xt),Vt||u.enqueue(()=>{Xt===t&&t.flush()})}return Xt}static enqueue(t){Ht(t)}apply(){}};function Qt(){var t=en;Gt=!0;try{var e=0;for(nn(!0);Nt.length>0;){var n=Ut.ensure();e++>1e3&&Jt(),n.process(Nt),pe.clear()}}finally{Gt=!1,nn(t),Kt=null}}function Jt(){try{!function(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(t){qt(t,Kt)}}let Zt=null;function te(t){var e=t.length;if(0!==e){for(var n=0;n<e;){var i=t[n++];if(!(24576&i.f)&&bn(i)&&(Zt=new Set,_n(i),null===i.deps&&null===i.first&&null===i.nodes&&(null===i.teardown&&null===i.ac?Ve(i):i.fn=null),(null==Zt?void 0:Zt.size)>0)){pe.clear();for(const t of Zt){if(24576&t.f)continue;const e=[t];let n=t.parent;for(;null!==n;)Zt.has(n)&&(Zt.delete(n),e.push(n)),n=n.parent;for(let t=e.length-1;t>=0;t--){const n=e[t];24576&n.f||_n(n)}}Zt.clear()}}Zt=null}}function ee(t,e,n,i){if(!n.has(t)&&(n.add(t),null!==t.reactions))for(const r of t.reactions){const t=r.f;2&t?ee(r,e,n,i):4194320&t&&0===(t&ft)&&ne(r,e,i)&&(Wn(r,ft),ie(r))}}function ne(t,e,n){const i=n.get(t);if(void 0!==i)return i;if(null!==t.deps)for(const i of t.deps){if(e.includes(i))return!0;if(2&i.f&&ne(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function ie(t){for(var e=Kt=t;null!==e.parent;){var n=(e=e.parent).f;if(Gt&&e===dn&&0!==(n&dt)&&0===(n&wt))return;if(96&n){if(0===(n&ct))return;e.f^=ct}}Nt.push(e)}class re{constructor(t,e,n){K(this,C),X(this,"parent"),K(this,h,!1),K(this,p),K(this,v,null),K(this,g),K(this,m),K(this,w),K(this,y,null),K(this,x,null),K(this,b,null),K(this,M,null),K(this,z,null),K(this,k,0),K(this,I,0),K(this,_,!1),K(this,P,null),K(this,D,function(t){let e,n=0,i=ge(0);return()=>{Ae()&&(Dn(i),qe(()=>(0===n&&(e=On(()=>t())),n+=1,()=>{Ht(()=>{n-=1,0===n&&(null==e||e(),e=void 0,Me(i))})})))}}(()=>(G(this,P,ge(N(this,k))),()=>{G(this,P,null)}))),G(this,p,t),G(this,g,e),G(this,m,n),this.parent=dn.b,G(this,h,!!N(this,g).pending),G(this,w,Xe(()=>{dn.b=this;var t=V(this,C,S).call(this);try{G(this,y,Ye(()=>n(t)))}catch(t){this.error(t)}return N(this,I)>0?V(this,C,E).call(this):G(this,h,!1),()=>{var t;null==(t=N(this,z))||t.remove()}},589952))}is_pending(){return N(this,h)||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!N(this,g).pending}update_pending_count(t){V(this,C,W).call(this,t),G(this,k,N(this,k)+t),N(this,P)&&xe(N(this,P),N(this,k))}get_effect_pending(){return N(this,D).call(this),Dn(N(this,P))}error(t){var e=N(this,g).onerror;let n=N(this,g).failed;if(N(this,_)||!e&&!n)throw t;N(this,y)&&(Ge(N(this,y)),G(this,y,null)),N(this,x)&&(Ge(N(this,x)),G(this,x,null)),N(this,b)&&(Ge(N(this,b)),G(this,b,null));var i=!1,r=!1;const o=()=>{i||(i=!0,r&&function(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}(),Ut.ensure(),G(this,k,0),null!==N(this,b)&&Ue(N(this,b),()=>{G(this,b,null)}),G(this,h,this.has_pending_snippet()),G(this,y,V(this,C,O).call(this,()=>(G(this,_,!1),Ye(()=>N(this,m).call(this,N(this,p)))))),N(this,I)>0?V(this,C,E).call(this):G(this,h,!1))};var s=sn;try{ln(null),r=!0,null==e||e(t,o),r=!1}catch(t){qt(t,N(this,w)&&N(this,w).parent)}finally{ln(s)}n&&Ht(()=>{G(this,b,V(this,C,O).call(this,()=>{Ut.ensure(),G(this,_,!0);try{return Ye(()=>{n(N(this,p),()=>t,()=>o)})}catch(t){return qt(t,N(this,w).parent),null}finally{G(this,_,!1)}}))})}}function oe(){un(null),ln(null),Et(null)}function se(t){var e=null!==sn&&2&sn.f?sn:null;return null!==dn&&(dn.f|=yt),{ctx:Ot,deps:null,effects:null,equals:Dt,f:2050,fn:t,reactions:null,rv:0,v:U,wv:0,parent:e??dn,ac:null}}function ae(t,e){let n=dn;null===n&&function(){throw new Error("https://svelte.dev/e/async_derived_orphan")}();var i=n.b,r=void 0,o=ge(U),s=!sn,a=new Map;return function(t){Re(4718592,t,!0)}(()=>{var e,n=lt();r=n.promise;try{Promise.resolve(t()).then(n.resolve,n.reject).then(()=>{l===Xt&&l.committed&&l.deactivate(),oe()})}catch(t){n.reject(t),oe()}var l=Xt;if(s){var d=!i.is_pending();i.update_pending_count(1),l.increment(d),null==(e=a.get(l))||e.reject(_t),a.delete(l),a.set(l,n)}const u=(t,e=void 0)=>{if(l.activate(),e)e!==_t&&(o.f|=zt,xe(o,e));else{0!==(o.f&zt)&&(o.f^=zt),xe(o,t);for(const[t,e]of a){if(a.delete(t),t===l)break;e.reject(_t)}}s&&(i.update_pending_count(-1),l.decrement(d))};n.promise.then(u,t=>u(null,t||"unknown"))}),Le(()=>{for(const t of a.values())t.reject(_t)}),new Promise(t=>{!function e(n){function i(){n===r?t(o):e(r)}n.then(i,i)}(r)})}function le(t){const e=se(t);return fn(e),e}function de(t){const e=se(t);return e.equals=St,e}function ue(t){var e=t.effects;if(null!==e){t.effects=null;for(var n=0;n<e.length;n+=1)Ge(e[n])}}function ce(t){var e,n=dn;un(function(t){for(var e=t.parent;null!==e;){if(!(2&e.f))return 0===(e.f&vt)?e:null;e=e.parent}return null}(t));try{t.f&=-32769,ue(t),e=zn(t)}finally{un(n)}return e}function fe(t){var e=ce(t);t.equals(e)||((null==Xt?void 0:Xt.is_fork)||(t.v=e),t.wv=xn()),rn||(null!==Yt?(Ae()||(null==Xt?void 0:Xt.is_fork))&&Yt.set(t,e):Wn(t,0===(t.f&ut)?ht:ct))}h=new WeakMap,p=new WeakMap,v=new WeakMap,g=new WeakMap,m=new WeakMap,w=new WeakMap,y=new WeakMap,x=new WeakMap,b=new WeakMap,M=new WeakMap,z=new WeakMap,k=new WeakMap,I=new WeakMap,_=new WeakMap,P=new WeakMap,D=new WeakMap,C=new WeakSet,S=function(){var t=N(this,p);return N(this,h)&&(G(this,z,Ce()),N(this,p).before(N(this,z)),t=N(this,z)),t},O=function(t){var e=dn,n=sn,i=Ot;un(N(this,w)),ln(N(this,w)),Et(N(this,w).ctx);try{return t()}catch(t){return Ft(t),null}finally{un(e),ln(n),Et(i)}},E=function(){const t=N(this,g).pending;null!==N(this,y)&&(G(this,M,document.createDocumentFragment()),N(this,M).append(N(this,z)),tn(N(this,y),N(this,M))),null===N(this,x)&&G(this,x,Ye(()=>t(N(this,p))))},W=function(t){var e;this.has_pending_snippet()?(G(this,I,N(this,I)+t),0===N(this,I)&&(G(this,h,!1),N(this,x)&&Ue(N(this,x),()=>{G(this,x,null)}),N(this,M)&&(N(this,p).before(N(this,M)),G(this,M,null)))):this.parent&&V(e=this.parent,C,W).call(e,t)};let he=new Set;const pe=new Map;let ve=!1;function ge(t,e){return{f:0,v:t,reactions:null,equals:Dt,rv:0,wv:0}}function me(t,e){const n=ge(t);return fn(n),n}function we(t,e=!1,n=!0){const i=ge(t);return e||(i.equals=St),i}function ye(t,e,n=!1){return null===sn||an&&!(131072&sn.f)||!(4325394&sn.f)||(null==cn?void 0:cn.includes(t))||function(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}(),xe(t,n?ke(e):e)}function xe(t,e){if(!t.equals(e)){var n=t.v;rn?pe.set(t,e):pe.set(t,n),t.v=e;var i=Ut.ensure();i.capture(t,n),2&t.f&&(0!==(t.f&ft)&&ce(t),Wn(t,0!==(t.f&ut)?ct:ht)),t.wv=xn(),ze(t,ft),null===dn||0===(dn.f&ct)||96&dn.f||(null===vn?function(t){vn=t}([t]):vn.push(t)),!i.is_fork&&he.size>0&&!ve&&function(){ve=!1;var t=en;nn(!0);const e=Array.from(he);try{for(const t of e)0!==(t.f&ct)&&Wn(t,ht),bn(t)&&_n(t)}finally{nn(t)}he.clear()}()}return e}function be(t,e=1){var n=Dn(t),i=1===e?n++:n--;return ye(t,n),i}function Me(t){ye(t,t.v+1)}function ze(t,e){var n=t.reactions;if(null!==n)for(var i=n.length,r=0;r<i;r++){var o=n[r],s=o.f,a=0===(s&ft);if(a&&Wn(o,e),2&s){var l=o;null==Yt||Yt.delete(l),0===(s&bt)&&(s&ut&&(o.f|=bt),ze(l,ht))}else a&&(0!==(s&dt)&&null!==Zt&&Zt.add(o),ie(o))}}function ke(t){if("object"!=typeof t||null===t||kt in t)return t;const e=ot(t);if(e!==it&&e!==rt)return t;var n=new Map,i=Q(t),r=me(0),o=wn,s=t=>{if(wn===o)return t();var e=sn,n=wn;ln(null),yn(o);var i=t();return ln(e),yn(n),i};return i&&n.set("length",me(t.length)),new Proxy(t,{defineProperty(t,e,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}();var r=n.get(e);return void 0===r?r=s(()=>{var t=me(i.value);return n.set(e,t),t}):ye(r,i.value,!0),!0},deleteProperty(t,e){var i=n.get(e);if(void 0===i){if(e in t){const t=s(()=>me(U));n.set(e,t),Me(r)}}else ye(i,U),Me(r);return!0},get(e,i,r){var o;if(i===kt)return t;var a=n.get(i),l=i in e;if(void 0!==a||l&&!(null==(o=et(e,i))?void 0:o.writable)||(a=s(()=>me(ke(l?e[i]:U))),n.set(i,a)),void 0!==a){var d=Dn(a);return d===U?void 0:d}return Reflect.get(e,i,r)},getOwnPropertyDescriptor(t,e){var i=Reflect.getOwnPropertyDescriptor(t,e);if(i&&"value"in i){var r=n.get(e);r&&(i.value=Dn(r))}else if(void 0===i){var o=n.get(e),s=null==o?void 0:o.v;if(void 0!==o&&s!==U)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(t,e){var i;if(e===kt)return!0;var r=n.get(e),o=void 0!==r&&r.v!==U||Reflect.has(t,e);return!((void 0!==r||null!==dn&&(!o||(null==(i=et(t,e))?void 0:i.writable)))&&(void 0===r&&(r=s(()=>me(o?ke(t[e]):U)),n.set(e,r)),Dn(r)===U))&&o},set(t,e,o,a){var l,d=n.get(e),u=e in t;if(i&&"length"===e)for(var c=o;c<d.v;c+=1){var f=n.get(c+"");void 0!==f?ye(f,U):c in t&&(f=s(()=>me(U)),n.set(c+"",f))}void 0===d?u&&!(null==(l=et(t,e))?void 0:l.writable)||(ye(d=s(()=>me(void 0)),ke(o)),n.set(e,d)):(u=d.v!==U,ye(d,s(()=>ke(o))));var h=Reflect.getOwnPropertyDescriptor(t,e);if((null==h?void 0:h.set)&&h.set.call(a,o),!u){if(i&&"string"==typeof e){var p=n.get("length"),v=Number(e);Number.isInteger(v)&&v>=p.v&&ye(p,v+1)}Me(r)}return!0},ownKeys(t){Dn(r);var e=Reflect.ownKeys(t).filter(t=>{var e=n.get(t);return void 0===e||e.v!==U});for(var[i,o]of n)o.v===U||i in t||e.push(i);return e},setPrototypeOf(){!function(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}var Ie,_e,Pe,De;function Ce(t=""){return document.createTextNode(t)}function Se(t){return Pe.call(t)}function Oe(t){return De.call(t)}function Ee(t,e){return Se(t)}function We(t,e=!1){var n=Se(t);return n instanceof Comment&&""===n.data?Oe(n):n}function Te(t,e=1,n=!1){let i=t;for(;e--;)i=Oe(i);return i}function Be(t){var e=sn,n=dn;ln(null),un(null);try{return t()}finally{ln(e),un(n)}}function Re(t,e,n){var i=dn;null!==i&&0!==(i.f&pt)&&(t|=pt);var r={ctx:Ot,deps:null,nodes:null,f:t|ft|ut,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(n)try{_n(r),r.f|=gt}catch(t){throw Ge(r),t}else null!==e&&ie(r);var o=r;if(n&&null===o.deps&&null===o.teardown&&null===o.nodes&&o.first===o.last&&0===(o.f&yt)&&(o=o.first,0!==(t&dt)&&0!==(t&mt)&&null!==o&&(o.f|=mt)),null!==o&&(o.parent=i,null!==i&&function(t,e){var n=e.last;null===n?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}(o,i),null!==sn&&2&sn.f&&!(64&t))){var s=sn;(s.effects??(s.effects=[])).push(o)}return r}function Ae(){return null!==sn&&!an}function Le(t){const e=Re(8,null,!1);return Wn(e,ct),e.teardown=t,e}function He(t){null===dn&&(null===sn&&function(){throw new Error("https://svelte.dev/e/effect_orphan")}(),function(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}()),rn&&function(){throw new Error("https://svelte.dev/e/effect_in_teardown")}();var e=dn.f;if(sn||!(32&e)||0!==(e>))return $e(t);var n=Ot;(n.e??(n.e=[])).push(t)}function $e(t){return Re(1048580,t,!1)}function Fe(t){return Re(4,t,!1)}function qe(t,e=0){return Re(8|e,t,!0)}function je(t,e=[],n=[],i=[]){!function(t,e,n,i){const r=se;if(0!==n.length||0!==t.length){var o,s,a,l,d=Xt,u=dn,c=(o=dn,s=sn,a=Ot,l=Xt,function(t=!0){un(o),ln(s),Et(a),t&&(null==l||l.activate())});t.length>0?Promise.all(t).then(()=>{c();try{return f()}finally{null==d||d.deactivate(),oe()}}):f()}else i(e.map(r));function f(){Promise.all(n.map(t=>ae(t))).then(t=>{c();try{i([...e.map(r),...t])}catch(t){0===(u.f&vt)&&qt(t,u)}null==d||d.deactivate(),oe()}).catch(t=>{qt(t,u)})}}(i,e,n,e=>{Re(8,()=>t(...e.map(Dn)),!0)})}function Xe(t,e=0){return Re(dt|e,t,!0)}function Ye(t){return Re(524320,t,!0)}function Ne(t){var e=t.teardown;if(null!==e){const t=rn,n=sn;on(!0),ln(null);try{e.call(null)}finally{on(t),ln(n)}}}function Ke(t,e=!1){var n=t.first;for(t.first=t.last=null;null!==n;){const t=n.ac;null!==t&&Be(()=>{t.abort(_t)});var i=n.next;64&n.f?n.parent=null:Ge(n,e),n=i}}function Ge(t,e=!0){var n=!1;!e&&0===(t.f&wt)||null===t.nodes||null===t.nodes.end||(function(t,e){for(;null!==t;){var n=t===e?null:Oe(t);t.remove(),t=n}}(t.nodes.start,t.nodes.end),n=!0),Ke(t,e&&!n),In(t,0),Wn(t,vt);var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)t.stop();Ne(t);var r=t.parent;null!==r&&null!==r.first&&Ve(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function Ve(t){var e=t.parent,n=t.prev,i=t.next;null!==n&&(n.next=i),null!==i&&(i.prev=n),null!==e&&(e.first===t&&(e.first=i),e.last===t&&(e.last=n))}function Ue(t,e,n=!0){var i=[];Qe(t,i,!0);var r=()=>{n&&Ge(t),e&&e()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function Qe(t,e,n){if(0===(t.f&pt)){t.f^=pt;var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)(t.is_global||n)&&e.push(t);for(var r=t.first;null!==r;){var o=r.next;Qe(r,e,!!(0!==(r.f&mt)||32&r.f&&0!==(t.f&dt))&&n),r=o}}}function Je(t){Ze(t,!0)}function Ze(t,e){if(0!==(t.f&pt)){t.f^=pt,0===(t.f&ct)&&(Wn(t,ft),ie(t));for(var n=t.first;null!==n;){var i=n.next;Ze(n,!!(0!==(n.f&mt)||32&n.f)&&e),n=i}var r=t.nodes&&t.nodes.t;if(null!==r)for(const t of r)(t.is_global||e)&&t.in()}}function tn(t,e){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end;null!==n;){var r=n===i?null:Oe(n);e.append(n),n=r}}let en=!1;function nn(t){en=t}let rn=!1;function on(t){rn=t}let sn=null,an=!1;function ln(t){sn=t}let dn=null;function un(t){dn=t}let cn=null;function fn(t){null!==sn&&(null===cn?cn=[t]:cn.push(t))}let hn=null,pn=0,vn=null,gn=1,mn=0,wn=mn;function yn(t){wn=t}function xn(){return++gn}function bn(t){var e=t.f;if(0!==(e&ft))return!0;if(2&e&&(t.f&=-32769),0!==(e&ht)){var n=t.deps;if(null!==n)for(var i=n.length,r=0;r<i;r++){var o=n[r];if(bn(o)&&fe(o),o.wv>t.wv)return!0}0!==(e&ut)&&null===Yt&&Wn(t,ct)}return!1}function Mn(t,e,n=!0){var i=t.reactions;if(null!==i&&!(null==cn?void 0:cn.includes(t)))for(var r=0;r<i.length;r++){var o=i[r];2&o.f?Mn(o,e,!1):e===o&&(n?Wn(o,ft):0!==(o.f&ct)&&Wn(o,ht),ie(o))}}function zn(t){var e,n=hn,i=pn,r=vn,o=sn,s=cn,a=Ot,l=an,d=wn,u=t.f;hn=null,pn=0,vn=null,sn=96&u?null:t,cn=null,Et(t.ctx),an=!1,wn=++mn,null!==t.ac&&(Be(()=>{t.ac.abort(_t)}),t.ac=null);try{t.f|=Mt;var c=(0,t.fn)(),f=t.deps;if(null!==hn){var h;if(In(t,pn),null!==f&&pn>0)for(f.length=pn+hn.length,h=0;h<hn.length;h++)f[pn+h]=hn[h];else t.deps=f=hn;if(Ae()&&0!==(t.f&ut))for(h=pn;h<f.length;h++)((e=f[h]).reactions??(e.reactions=[])).push(t)}else null!==f&&pn<f.length&&(In(t,pn),f.length=pn);if(!(null===vn||an||null===f||6146&t.f))for(h=0;h<vn.length;h++)Mn(vn[h],t);return null!==o&&o!==t&&(mn++,null!==vn&&(null===r?r=vn:r.push(...vn))),0!==(t.f&zt)&&(t.f^=zt),c}catch(t){return Ft(t)}finally{t.f^=Mt,hn=n,pn=i,vn=r,sn=o,cn=s,Et(a),an=l,wn=d}}function kn(t,e){let n=e.reactions;if(null!==n){var i=J.call(n,t);if(-1!==i){var r=n.length-1;0===r?n=e.reactions=null:(n[i]=n[r],n.pop())}}null===n&&2&e.f&&(null===hn||!hn.includes(e))&&(Wn(e,ht),0!==(e.f&ut)&&(e.f^=ut,e.f&=-32769),ue(e),In(e,0))}function In(t,e){var n=t.deps;if(null!==n)for(var i=e;i<n.length;i++)kn(t,n[i])}function _n(t){var e=t.f;if(0===(e&vt)){Wn(t,ct);var n=dn,i=en;dn=t,en=!0;try{16777232&e?function(t){for(var e=t.first;null!==e;){var n=e.next;!(32&e.f)&&Ge(e),e=n}}(t):Ke(t),Ne(t);var r=zn(t);t.teardown="function"==typeof r?r:null,t.wv=gn}finally{en=i,dn=n}}}async function Pn(){await Promise.resolve(),function(){var t=Vt;Vt=!0;try{for(;;){if($t(),0===Nt.length&&(null==Xt||Xt.flush(),0===Nt.length))return void(Kt=null);Qt()}}finally{Vt=t}}()}function Dn(t){var e=!!(2&t.f);if(!(null===sn||an||null!==dn&&0!==(dn.f&vt)||(null==cn?void 0:cn.includes(t)))){var n=sn.deps;if(0!==(sn.f&Mt))t.rv<mn&&(t.rv=mn,null===hn&&null!==n&&n[pn]===t?pn++:null===hn?hn=[t]:hn.includes(t)||hn.push(t));else{(sn.deps??(sn.deps=[])).push(t);var i=t.reactions;null===i?t.reactions=[sn]:i.includes(sn)||i.push(sn)}}if(rn){if(pe.has(t))return pe.get(t);if(e){var r=t,o=r.v;return(0===(r.f&ct)&&null!==r.reactions||Sn(r))&&(o=ce(r)),pe.set(r,o),o}}else e&&(!(null==Yt?void 0:Yt.has(t))||(null==Xt?void 0:Xt.is_fork)&&!Ae())&&(bn(r=t)&&fe(r),en&&Ae()&&0===(r.f&ut)&&Cn(r));if(null==Yt?void 0:Yt.has(t))return Yt.get(t);if(0!==(t.f&zt))throw t.v;return t.v}function Cn(t){if(null!==t.deps){t.f^=ut;for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),2&e.f&&0===(e.f&ut)&&Cn(e)}}function Sn(t){if(t.v===U)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(pe.has(e))return!0;if(2&e.f&&Sn(e))return!0}return!1}function On(t){var e=an;try{return an=!0,t()}finally{an=e}}const En=-7169;function Wn(t,e){t.f=t.f&En|e}function Tn(t,e=new Set){if(!("object"!=typeof t||null===t||t instanceof EventTarget||e.has(t))){e.add(t),t instanceof Date&&t.getTime();for(let n in t)try{Tn(t[n],e)}catch(t){}const n=ot(t);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const e=nt(n);for(let n in e){const i=e[n].get;if(i)try{i.call(t)}catch(t){}}}}}const Bn=new Set,Rn=new Set;function An(t){for(var e=0;e<t.length;e++)Bn.add(t[e]);for(var n of Rn)n(t)}let Ln=null;function Hn(t){var e,n=this,i=n.ownerDocument,r=t.type,o=(null==(e=t.composedPath)?void 0:e.call(t))||[],s=o[0]||t.target;Ln=t;var a=0,l=Ln===t&&t.__root;if(l){var d=o.indexOf(l);if(-1!==d&&(n===document||n===window))return void(t.__root=n);var u=o.indexOf(n);if(-1===u)return;d<=u&&(a=d)}if((s=o[a]||t.target)!==n){tt(t,"currentTarget",{configurable:!0,get:()=>s||i});var c=sn,f=dn;ln(null),un(null);try{for(var h,p=[];null!==s;){var v=s.assignedSlot||s.parentNode||s.host||null;try{var g=s["__"+r];null==g||s.disabled&&t.target!==s||g.call(s,t)}catch(t){h?p.push(t):h=t}if(t.cancelBubble||v===n||null===v)break;s=v}if(h){for(let t of p)queueMicrotask(()=>{throw t});throw h}}finally{t.__root=n,delete t.currentTarget,ln(c),un(f)}}}function $n(t,e){var n=dn;null===n.nodes&&(n.nodes={start:t,end:e,a:null,t:null})}function Fn(t,e){var n,i=!!(1&e),r=!!(2&e),o=!t.startsWith("<!>");return()=>{var e,s;void 0===n&&(e=o?t:"<!>"+t,(s=document.createElement("template")).innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=Se(n)));var a=r||_e?document.importNode(n,!0):n.cloneNode(!0);return i?$n(Se(a),a.lastChild):$n(a,a),a}}function qn(){var t=document.createDocumentFragment(),e=document.createComment(""),n=Ce();return t.append(e,n),$n(e,n),t}function jn(t,e){null!==t&&t.before(e)}const Xn=["touchstart","touchmove"];function Yn(t){return Xn.includes(t)}let Nn=!0;function Kn(t,e){var n=null==e?"":"object"==typeof e?e+"":e;n!==(t.__t??(t.__t=t.nodeValue))&&(t.__t=n,t.nodeValue=n+"")}function Gn(t,e){return function(t,{target:e,anchor:n,props:i={},events:r,context:o,intro:s=!0}){!function(){if(void 0===Ie){Ie=window,_e=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;Pe=et(e,"firstChild").get,De=et(e,"nextSibling").get,st(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),st(n)&&(n.__t=void 0)}}();var a=new Set,l=t=>{for(var n=0;n<t.length;n++){var i=t[n];if(!a.has(i)){a.add(i);var r=Yn(i);e.addEventListener(i,Hn,{passive:r});var o=Vn.get(i);void 0===o?(document.addEventListener(i,Hn,{passive:r}),Vn.set(i,1)):Vn.set(i,o+1)}}};l(Z(Bn)),Rn.add(l);var d=void 0,u=function(){Ut.ensure();const u=Re(524352,()=>{var u=n??e.appendChild(Ce());return new re(u,{pending:()=>{}},e=>{o&&(Tt({}),Ot.c=o),r&&(i.$$events=r),Nn=s,d=t(e,i)||{},Nn=!0,o&&Bt()}),()=>{var t;for(var i of a){e.removeEventListener(i,Hn);var r=Vn.get(i);0===--r?(document.removeEventListener(i,Hn),Vn.delete(i)):Vn.set(i,r)}Rn.delete(l),u!==n&&(null==(t=u.parentNode)||t.removeChild(u))}},!0);return(t={})=>new Promise(e=>{t.outro?Ue(u,()=>{Ge(u),e(void 0)}):(Ge(u),e(void 0))})}();return Un.set(d,u),d}(t,e)}const Vn=new Map;let Un=new WeakMap;function Qn(t,e){const n=Un.get(t);return n?(Un.delete(t),n(e)):Promise.resolve()}class Jn{constructor(t,e=!0){X(this,"anchor"),K(this,T,new Map),K(this,B,new Map),K(this,R,new Map),K(this,A,new Set),K(this,L,!0),K(this,H,()=>{var t=Xt;if(N(this,T).has(t)){var e=N(this,T).get(t),n=N(this,B).get(e);if(n)Je(n),N(this,A).delete(e);else{var i=N(this,R).get(e);i&&(N(this,B).set(e,i.effect),N(this,R).delete(e),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[e,n]of N(this,T)){if(N(this,T).delete(e),e===t)break;const i=N(this,R).get(n);i&&(Ge(i.effect),N(this,R).delete(n))}for(const[t,i]of N(this,B)){if(t===e||N(this,A).has(t))continue;const r=()=>{if(Array.from(N(this,T).values()).includes(t)){var e=document.createDocumentFragment();tn(i,e),e.append(Ce()),N(this,R).set(t,{effect:i,fragment:e})}else Ge(i);N(this,A).delete(t),N(this,B).delete(t)};N(this,L)||!n?(N(this,A).add(t),Ue(i,r,!1)):r()}}}),K(this,$,t=>{N(this,T).delete(t);const e=Array.from(N(this,T).values());for(const[t,n]of N(this,R))e.includes(t)||(Ge(n.effect),N(this,R).delete(t))}),this.anchor=t,G(this,L,e)}ensure(t,e){var n=Xt;!e||N(this,B).has(t)||N(this,R).has(t)||N(this,B).set(t,Ye(()=>e(this.anchor))),N(this,T).set(n,t),N(this,H).call(this)}}function Zn(t,e,...n){var i=new Jn(t);Xe(()=>{const t=e()??null;i.ensure(t,t&&(e=>t(e,...n)))},mt)}function ti(t){null===Ot&&Pt(),He(()=>{const e=On(t);if("function"==typeof e)return e})}function ei(t){null===Ot&&Pt(),ti(()=>()=>On(t))}function ni(t,e,n=!1){var i=new Jn(t);function r(t,e){i.ensure(t,e)}Xe(()=>{var t=!1;e((e,n=!0)=>{t=!0,r(n,e)}),t||r(!1,null)},n?mt:0)}function ii(t,e){return e}function ri(t,e=!0){for(var n=0;n<t.length;n++)Ge(t[n],e)}var oi;function si(t,e,n,i,r,o=null){var s=t,a=new Map;!(4&e)||(s=t.appendChild(Ce()));var l,d=null,u=de(()=>{var t=n();return Q(t)?t:null==t?[]:Z(t)}),c=!0,f={effect:Xe(()=>{for(var t=(l=Dn(u)).length,h=new Set,p=0;p<t;p+=1){var v=l[p],g=i(v,p),m=c?null:a.get(g);m?(m.v&&xe(m.v,v),m.i&&xe(m.i,p)):(m=ai(a,c?s:oi??(oi=Ce()),v,g,p,r,e,n),c||(m.e.f|=xt),a.set(g,m)),h.add(g)}0===t&&o&&!d&&(c?d=Ye(()=>o(s)):(d=Ye(()=>o(oi??(oi=Ce())))).f|=xt),c||(f.fallback=d,function(t,e,n,i,r){var o,s,a,l,d,u,c,f,h,p,v,g,m,w,y=!!(8&i),x=e.length,b=t.items,M=t.effect.first,z=null,k=[],I=[];if(y)for(w=0;w<x;w+=1)g=r(e[w],w),0===((m=b.get(g).e).f&xt)&&(null==(s=null==(o=m.nodes)?void 0:o.a)||s.measure(),(v??(v=new Set)).add(m));for(w=0;w<x;w+=1){if(g=r(e[w],w),m=b.get(g).e,null!==t.outrogroups)for(const e of t.outrogroups)e.pending.delete(m),e.done.delete(m);if(0!==(m.f&xt)){if(m.f^=xt,m!==M){var _=z?z.next:M;m===t.effect.last&&(t.effect.last=m.prev),m.prev&&(m.prev.next=m.next),m.next&&(m.next.prev=m.prev),di(t,z,m),di(t,m,_),li(m,_,n),k=[],I=[],M=(z=m).next;continue}li(m,null,n)}if(0!==(m.f&pt)&&(Je(m),y&&(null==(l=null==(a=m.nodes)?void 0:a.a)||l.unfix(),(v??(v=new Set)).delete(m))),m!==M){if(void 0!==p&&p.has(m)){if(k.length<I.length){var P,D=I[0];z=D.prev;var C=k[0],S=k[k.length-1];for(P=0;P<k.length;P+=1)li(k[P],D,n);for(P=0;P<I.length;P+=1)p.delete(I[P]);di(t,C.prev,S.next),di(t,z,C),di(t,S,D),M=D,z=S,w-=1,k=[],I=[]}else p.delete(m),li(m,M,n),di(t,m.prev,m.next),di(t,m,null===z?t.effect.first:z.next),di(t,z,m),z=m;continue}for(k=[],I=[];null!==M&&M!==m;)(p??(p=new Set)).add(M),I.push(M),M=M.next;if(null===M)continue}0===(m.f&xt)&&k.push(m),z=m,M=m.next}if(null!==t.outrogroups){for(const e of t.outrogroups)0===e.pending.size&&(ri(Z(e.done)),null==(d=t.outrogroups)||d.delete(e));0===t.outrogroups.size&&(t.outrogroups=null)}if(null!==M||void 0!==p){var O=[];if(void 0!==p)for(m of p)0===(m.f&pt)&&O.push(m);for(;null!==M;)0===(M.f&pt)&&M!==t.fallback&&O.push(M),M=M.next;var E=O.length;if(E>0){var W=4&i&&0===x?n:null;if(y){for(w=0;w<E;w+=1)null==(c=null==(u=O[w].nodes)?void 0:u.a)||c.measure();for(w=0;w<E;w+=1)null==(h=null==(f=O[w].nodes)?void 0:f.a)||h.fix()}!function(t,e,n){for(var i,r=e.length,o=e.length,s=0;s<r;s++){let n=e[s];Ue(n,()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var e=t.outrogroups;ri(Z(i.done)),e.delete(i),0===e.size&&(t.outrogroups=null)}}else o-=1},!1)}if(0===o){var a=null!==n;if(a){var l=n,d=l.parentNode;d.textContent="",d.append(l),t.items.clear()}ri(e,!a)}else i={pending:new Set(e),done:new Set},(t.outrogroups??(t.outrogroups=new Set)).add(i)}(t,O,W)}}y&&Ht(()=>{var t,e;if(void 0!==v)for(m of v)null==(e=null==(t=m.nodes)?void 0:t.a)||e.apply()})}(f,l,s,e,i),null!==d&&(0===l.length?0===(d.f&xt)?Je(d):(d.f^=xt,li(d,null,s)):Ue(d,()=>{d=null}))),Dn(u)}),items:a,outrogroups:null,fallback:d};c=!1}function ai(t,e,n,i,r,o,s,a){var l=1&s?16&s?ge(n):we(n,!1,!1):null,d=2&s?ge(r):null;return{v:l,i:d,e:Ye(()=>(o(e,l??n,d??r,a),()=>{t.delete(i)}))}}function li(t,e,n){if(t.nodes)for(var i=t.nodes.start,r=t.nodes.end,o=e&&0===(e.f&xt)?e.nodes.start:n;null!==i;){var s=Oe(i);if(o.before(i),i===r)return;i=s}}function di(t,e,n){null===e?t.effect.first=n:e.next=n,null===n?t.effect.last=e:n.prev=e}T=new WeakMap,B=new WeakMap,R=new WeakMap,A=new WeakMap,L=new WeakMap,H=new WeakMap,$=new WeakMap;const ui={tick:t=>requestAnimationFrame(t),now:()=>performance.now(),tasks:new Set};function ci(){const t=ui.now();ui.tasks.forEach(e=>{e.c(t)||(ui.tasks.delete(e),e.f())}),0!==ui.tasks.size&&ui.tick(ci)}function fi(t,e){Be(()=>{t.dispatchEvent(new CustomEvent(e))})}function hi(t){if("float"===t)return"cssFloat";if("offset"===t)return"cssOffset";if(t.startsWith("--"))return t;const e=t.split("-");return 1===e.length?e[0]:e[0]+e.slice(1).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function pi(t){const e={},n=t.split(";");for(const t of n){const[n,i]=t.split(":");if(!n||void 0===i)break;e[hi(n.trim())]=i.trim()}return e}const vi=t=>t;function gi(t,e,n,i){var r,o,s,a,l=!!(4&t),d=e.inert,u=e.style.overflow;function c(){return Be(()=>o??(o=n()(e,(null==i?void 0:i())??{},{direction:"both"})))}var f={is_global:l,in(){e.inert=d,fi(e,"introstart"),s=mi(e,c(),a,1,()=>{fi(e,"introend"),null==s||s.abort(),s=o=void 0,e.style.overflow=u})},out(t){e.inert=!0,fi(e,"outrostart"),a=mi(e,c(),s,0,()=>{fi(e,"outroend"),null==t||t()})},stop:()=>{null==s||s.abort(),null==a||a.abort()}},h=dn;if(((r=h.nodes).t??(r.t=[])).push(f),Nn){var p=l;if(!p){for(var v=h.parent;v&&0!==(v.f&mt);)for(;(v=v.parent)&&0===(v.f&dt););p=!v||0!==(v.f>)}p&&Fe(()=>{On(()=>f.in())})}}function mi(t,e,n,i,r){var o=1===i;if("function"==typeof e){var s,a=!1;return Ht(()=>{if(!a){var l=e({direction:o?"in":"out"});s=mi(t,l,n,i,r)}}),{abort:()=>{a=!0,null==s||s.abort()},deactivate:()=>s.deactivate(),reset:()=>s.reset(),t:()=>s.t()}}if(null==n||n.deactivate(),!(null==e?void 0:e.duration))return r(),{abort:at,deactivate:at,reset:at,t:()=>i};const{delay:l=0,css:d,tick:u,easing:c=vi}=e;var f=[];if(o&&void 0===n&&(u&&u(0,1),d)){var h=pi(d(0,1));f.push(h,h)}var p=()=>1-i,v=t.animate(f,{duration:l,fill:"forwards"});return v.onfinish=()=>{v.cancel();var o=(null==n?void 0:n.t())??1-i;null==n||n.abort();var s=i-o,a=e.duration*Math.abs(s),l=[];if(a>0){var f=!1;if(d)for(var h=Math.ceil(a/(1e3/60)),g=0;g<=h;g+=1){var m=o+s*c(g/h),w=pi(d(m,1-m));l.push(w),f||(f="hidden"===w.overflow)}f&&(t.style.overflow="hidden"),p=()=>{var t=v.currentTime;return o+s*c(t/a)},u&&function(t){let e;0===ui.tasks.size&&ui.tick(ci),new Promise(n=>{ui.tasks.add(e={c:t,f:n})})}(()=>{if("running"!==v.playState)return!1;var t=p();return u(t,1-t),!0})}(v=t.animate(l,{duration:a,fill:"forwards"})).onfinish=()=>{p=()=>i,null==u||u(i,1-i),r()}},{abort:()=>{v&&(v.cancel(),v.effect=null,v.onfinish=at)},deactivate:()=>{r=at},reset:()=>{0===i&&(null==u||u(1,0))},t:()=>p()}}function wi(t,e,n){Fe(()=>{var i=On(()=>e(t,null==n?void 0:n())||{});if(n&&(null==i?void 0:i.update)){var r=!1,o={};qe(()=>{var t=n();!function(t){if("object"==typeof t&&t&&!(t instanceof EventTarget))if(kt in t)Tn(t);else if(!Array.isArray(t))for(let e in t){const n=t[e];"object"==typeof n&&n&&kt in n&&Tn(n)}}(t),r&&Ct(o,t)&&(o=t,i.update(t))}),r=!0}if(null==i?void 0:i.destroy)return()=>i.destroy()})}const yi=[..." \t\n\r\f \v\ufeff"];function xi(t,e=!1){var n=e?" !important;":";",i="";for(var r in t){var o=t[r];null!=o&&""!==o&&(i+=" "+r+": "+o+n)}return i}function bi(t){return"-"!==t[0]||"-"!==t[1]?t.toLowerCase():t}function Mi(t,e,n,i,r,o){var s=t.__className;if(s!==n||void 0===s){var a=function(t,e,n){var i=null==t?"":""+t;if(e&&(i=i?i+" "+e:e),n)for(var r in n)if(n[r])i=i?i+" "+r:r;else if(i.length)for(var o=r.length,s=0;(s=i.indexOf(r,s))>=0;){var a=s+o;0!==s&&!yi.includes(i[s-1])||a!==i.length&&!yi.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);null==a?t.removeAttribute("class"):t.className=a,t.__className=n}else if(o&&r!==o)for(var l in o){var d=!!o[l];null!=r&&d===!!r[l]||t.classList.toggle(l,d)}return o}function zi(t,e={},n,i){for(var r in n){var o=n[r];e[r]!==o&&(null==n[r]?t.style.removeProperty(r):t.style.setProperty(r,o,i))}}function ki(t,e,n,i){if(t.__style!==e){var r=function(t,e){if(e){var n,i,r="";if(Array.isArray(e)?(n=e[0],i=e[1]):n=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,s=0,a=!1,l=[];n&&l.push(...Object.keys(n).map(bi)),i&&l.push(...Object.keys(i).map(bi));var d=0,u=-1;const e=t.length;for(var c=0;c<e;c++){var f=t[c];if(a?"/"===f&&"*"===t[c-1]&&(a=!1):o?o===f&&(o=!1):"/"===f&&"*"===t[c+1]?a=!0:'"'===f||"'"===f?o=f:"("===f?s++:")"===f&&s--,!a&&!1===o&&0===s)if(":"===f&&-1===u)u=c;else if(";"===f||c===e-1){if(-1!==u){var h=bi(t.substring(d,u).trim());l.includes(h)||(";"!==f&&c++,r+=" "+t.substring(d,c).trim()+";")}d=c+1,u=-1}}}return n&&(r+=xi(n)),i&&(r+=xi(i,!0)),""===(r=r.trim())?null:r}return null==t?null:String(t)}(e,i);null==r?t.removeAttribute("style"):t.style.cssText=r,t.__style=e}else i&&(Array.isArray(i)?(zi(t,null==n?void 0:n[0],i[0]),zi(t,null==n?void 0:n[1],i[1],"important")):zi(t,n,i));return i}const Ii=Symbol("is custom element"),_i=Symbol("is html");function Pi(t,e,n,i){var r=function(t){return t.__attributes??(t.__attributes={[Ii]:t.nodeName.includes("-"),[_i]:"http://www.w3.org/1999/xhtml"===t.namespaceURI})}(t);r[e]!==(r[e]=n)&&("loading"===e&&(t[It]=n),null==n?t.removeAttribute(e):"string"!=typeof n&&function(t){var e,n=t.getAttribute("is")||t.nodeName,i=Di.get(n);if(i)return i;Di.set(n,i=[]);for(var r=t,o=Element.prototype;o!==r;){for(var s in e=nt(r))e[s].set&&i.push(s);r=ot(r)}return i}(t).includes(e)?t[e]=n:t.setAttribute(e,n))}var Di=new Map;function Ci(t,e){return t===e||(null==t?void 0:t[kt])===e}function Si(t={},e,n,i){return Fe(()=>{var i,r;return qe(()=>{i=r,r=[],On(()=>{t!==n(...r)&&(e(t,...r),i&&Ci(n(...i),t)&&e(null,...i))})}),()=>{Ht(()=>{r&&Ci(n(...r),t)&&e(null,...r)})}}),t}function Oi(t,e,n,i){var r=i,o=!0,s=()=>(o&&(o=!1,r=i),r);return void 0===t[e]&&void 0!==i&&s(),()=>{var n=t[e];return void 0===n?s():(o=!0,n)}}const Ei={features:{dock:!0,minimize:!0,transparency:!0,resize:!0,drag:!0,focusTrap:!0,animations:!0,backdrop:!0,parentChild:!0},dock:{position:"bottom",labelMode:"beside",enableReorder:!0,enableFreeDrag:!0},animations:{open:400,close:250,minimize:500,restore:400},appearance:{headerLayout:"macos",defaultWidth:"480px",defaultHeight:"auto",minWidth:280,minHeight:200},zIndex:{base:400,dock:8e3,toast:9e3},parentChild:{movementMode:"animated",animationDuration:300},positioning:{strategy:"smart",modalGap:16,avoidElements:[]},portalTarget:"#modal-portal"};let Wi={...Ei},Ti=me(0);function Bi(){return Dn(Ti)}function Ri(){return Wi}function Ai(t){const e=Wi;var n,i;Wi={features:{...(n=Ei).features,...(i=t).features},dock:{...n.dock,...i.dock},animations:{...n.animations,...i.animations},appearance:{...n.appearance,...i.appearance},zIndex:{...n.zIndex,...i.zIndex},parentChild:{...n.parentChild,...i.parentChild},positioning:{...n.positioning,...i.positioning},portalTarget:i.portalTarget??n.portalTarget},be(Ti),e.features.dock&&!Wi.features.dock&&(Array.from(Qi.values()).filter(t=>t.isMinimized).map(t=>t.id).forEach(t=>{const e=Qi.get(t);if(e){Qi.set(t,{...e,isMinimized:!1,isOpen:!0}),ye(sr,[...Dn(sr),t],!0),kr(t);const n=e.lastChildId||e.childId;n&&br(n)}}),ye(gr,[],!0),tr())}function Li(){Wi={...Ei},be(Ti)}const Hi={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};let $i=me(ke(Hi.MODAL));function Fi(){ye($i,Ri().zIndex.base,!0)}function qi(t){const e=Ri();return"MODAL"===t?e.zIndex.base:"DOCK"===t?e.zIndex.dock:"TOAST"===t?e.zIndex.toast:Hi[t]}function ji(){ye($i,Ri().zIndex.base,!0)}const Xi=8;function Yi(t,e,n,i,r={}){const{margin:o=Xi,allowPartialVisibility:s=!1}=r,a="undefined"!=typeof window?window.innerWidth:1920,l="undefined"!=typeof window?window.innerHeight:1080;let d,u,c,f;return s&&n>a-2*o?(d=40-n,u=a-40):(d=o,u=Math.max(o,a-n-o)),s&&i>l-2*o?(c=40-i,f=l-40):(c=o,f=Math.max(o,l-i-o)),{x:Math.max(d,Math.min(u,t)),y:Math.max(c,Math.min(f,e))}}function Ni(t,e,n,i,r={}){const{margin:o=Xi}=r,s=("undefined"!=typeof window?window.innerWidth:1920)-2*o,a=("undefined"!=typeof window?window.innerHeight:1080)-2*o,l=Math.min(n,s),d=Math.min(i,a),u=Yi(t,e,l,d,r);return{x:u.x,y:u.y,width:l,height:d}}function Ki(t,e){return Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x))*Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y))}function Gi(t,e,n,i,r,o){const s={x:t-o,y:e-o,width:n+2*o,height:i+2*o};let a=0;for(const t of r)a+=Ki(s,t);return a}function Vi(t,e,n,i,r,o,s){const a=(r-n)/2,l=(o-i)/2,d=a-s,u=l-s,c=Math.abs(t-a)/(d||1),f=Math.abs(e-l)/(u||1),h=Math.sqrt(c*c+f*f)/Math.SQRT2,p=50,v=t-s,g=r-n-s-t,m=e-s,w=o-i-s-e;let y=0;return v<p&&(y+=.3*(1-v/p)),g<p&&(y+=.3*(1-g/p)),m<p&&(y+=.2*(1-m/p)),w<p&&(y+=.2*(1-w/p)),Math.min(1,h+y)}function Ui(t){return"symbol"==typeof t?t.description??"symbol":t}let Qi=ke(new Map),Ji=me(0);const Zi=new Set;function tr(){be(Ji),queueMicrotask(()=>{Zi.forEach(t=>t())})}function er(t){return Zi.add(t),()=>Zi.delete(t)}let nr=me(ke([])),ir=me(ke([])),rr=me(ke([])),or=me(ke([])),sr=me(ke([])),ar=me(ke([])),lr=me(ke([])),dr=me(ke([])),ur=me(null),cr=ke(new Map),fr=me(null),hr=ke(new Map),pr=ke(new Set),vr=ke(new Set),gr=me(ke([]));function mr(t){const e=Qi.get(t.id),n=(null==e?void 0:e.zIndex)??function(){const t=Dn($i);return ye($i,Dn($i)+2),t}();e?Qi.set(t.id,{...e,title:t.title,icon:t.icon,glow:t.glow,zIndex:n}):Qi.set(t.id,{...t,zIndex:n,isAnimating:!1}),tr(),t.isMinimized&&!Dn(gr).includes(t.id)&&Dn(gr).push(t.id)}function wr(t){const e=Qi.get(t);if(e){if(ye(gr,Dn(gr).filter(e=>e!==t),!0),e.childId){const t=Qi.get(e.childId);t&&Qi.set(e.childId,{...t,parentId:void 0})}if(e.parentId){const t=Qi.get(e.parentId);t&&Qi.set(e.parentId,{...t,childId:void 0,lastChildId:e.id})}Qi.delete(t),tr(),vr.delete(t),pr.delete(t)}}function yr(t){const e=Qi.get(t);if(!e||e.isMinimized)return;if(Xr(t),e.parentId){const t=Qi.get(e.parentId);if(t&&!t.isMinimized)return void yr(e.parentId)}ye(nr,[...Dn(nr),t],!0),e.position&&e.size;const n=e.childId;Qi.set(t,{...e,isMinimized:!0,lastChildId:n}),tr(),Dn(gr).includes(t)||Dn(gr).push(t),e.childId&&function(t){const e=Qi.get(t);if(!(null==e?void 0:e.childId))return;const n=Qi.get(e.childId);n&&(Qi.set(e.childId,{...n,isHiddenWithParent:!0}),tr())}(t)}function xr(t){const e=Qi.get(t);if(!e||!e.isMinimized)return;Qi.set(t,{...e,isMinimized:!1,isOpen:!0}),tr(),ye(sr,[...Dn(sr),t],!0),kr(t);const n=e.lastChildId||e.childId;n&&br(n)}function br(t){const e=Qi.get(t);e&&e.isHiddenWithParent&&(Qi.set(t,{...e,isHiddenWithParent:!1}),tr(),ye(ar,[...Dn(ar),t],!0))}function Mr(t,e,n){const i=Qi.get(t);if(!i)return;let r=e;if((null==n?void 0:n.constrain)&&i.size&&(r=Yi(e.x,e.y,i.size.width,i.size.height)),Qi.set(t,{...i,position:r,size:(null==n?void 0:n.size)??i.size,hasBeenDragged:i.hasBeenDragged||(null==n?void 0:n.drag)||!1}),i.childId){let e=t,n=r;for(;;){const t=Qi.get(e);if(!(null==t?void 0:t.childId))break;const i=Qi.get(t.childId);if(!(null==i?void 0:i.offsetFromParent))break;const r={x:n.x+i.offsetFromParent.x,y:n.y+i.offsetFromParent.y};Qi.set(t.childId,{...i,position:r,hasBeenDragged:!0}),e=t.childId,n=r}}if(i.parentId&&i.offsetFromParent){const e=Ri();let n=t,o=i;for(;o.parentId&&o.offsetFromParent;){const i=Qi.get(o.parentId);if(!i)break;const s=n===t?r:Qi.get(n).position,a={x:s.x-o.offsetFromParent.x,y:s.y-o.offsetFromParent.y};"animated"===e.parentChild.movementMode?hr.set(o.parentId,a):Qi.set(o.parentId,{...i,position:a,hasBeenDragged:!0}),n=o.parentId,o=i}}tr()}function zr(t,e){const n=Qi.get(t);n&&(Qi.set(t,{...n,...e}),tr())}function kr(t){var e;const n=Qi.get(t);if(!n)return;const i=Math.max(...Array.from(Qi.values()).map(t=>t.zIndex),0);if(n.parentId){const r=Qi.get(n.parentId);r&&r.zIndex<i&&Qi.set(n.parentId,{...r,zIndex:i+2});const o=(null==(e=Qi.get(n.parentId))?void 0:e.zIndex)??i+2;return n.zIndex<=o&&Qi.set(t,{...n,zIndex:o+2}),void tr()}if(n.zIndex<i&&(Qi.set(t,{...n,zIndex:i+2}),tr()),n.childId){const e=Qi.get(n.childId),i=Qi.get(t);e&&i&&e.zIndex<=i.zIndex&&(Qi.set(n.childId,{...e,zIndex:i.zIndex+2}),tr())}}function Ir(t,e,n){const i=e.getBoundingClientRect();cr.set(t,{x:i.left+i.width/2,y:i.top+i.height/2});const r=Ri();(null==n?void 0:n.parentId)&&r.features.parentChild&&ye(fr,{parentId:n.parentId,childId:t},!0),Dn(ir).includes(t)||ye(ir,[...Dn(ir),t],!0),tr();const o=Qi.get(t);if(o){if(o.isOpen&&!o.isMinimized&&!o.isHiddenWithParent)return ye(ir,Dn(ir).filter(e=>e!==t),!0),Lr(t),void kr(t);if(o.isMinimized)return ye(ir,Dn(ir).filter(e=>e!==t),!0),void xr(t);Qi.set(t,{...o,isOpen:!0}),kr(t)}}function _r(t,e=!1){const n=Qi.get(t);n&&(Xr(t),e?ye(or,[...Dn(or),t],!0):ye(rr,[...Dn(rr),t],!0),tr(),n.childId&&_r(n.childId,e))}function Pr(){Array.from(Qi.keys()).forEach(t=>_r(t,!0))}function Dr(t,e,n){const i=Ri();if(n&&!cr.has(t.id)){const e=n.getBoundingClientRect();cr.set(t.id,{x:e.left+e.width/2,y:e.top+e.height/2})}const r={id:t.id,title:t.title??"",icon:t.icon??"",isOpen:!0,isMinimized:!1,isHiddenWithParent:!1,isTransparent:t.isTransparent??!1,isRejected:!1,position:t.position??null,size:t.size??null,hasBeenDragged:t.hasBeenDragged??!1,dockPosition:t.dockPosition??-1,glow:t.glow??null};if(!i.features.parentChild){mr(r);const e=Qi.get(t.id);return e&&Qi.set(t.id,{...e,isOpen:!0}),ye(ir,[...Dn(ir),t.id],!0),tr(),void kr(t.id)}const o=Qi.get(e);if(!o)return;o.childId&&_r(o.childId,!0),mr({...r,parentId:e});const s=Qi.get(t.id);s&&Qi.set(t.id,{...s,isOpen:!0,parentId:e}),ye(ir,[...Dn(ir),t.id],!0),tr(),kr(t.id),ye(fr,{parentId:e,childId:t.id},!0)}function Cr(t){return Dn(nr).includes(t)}function Sr(t){return Qi.get(t)}function Or(){return Dn(Ji)}function Er(t){return Dn(ir).includes(t)}function Wr(t){return Dn(rr).includes(t)}function Tr(t){return Dn(or).includes(t)}function Br(t){return!!Dn(or).includes(t)&&(ye(or,Dn(or).filter(e=>e!==t),!0),!0)}function Rr(t){return Dn(sr).includes(t)}function Ar(t){return Dn(ar).includes(t)}function Lr(t){Qi.get(t)&&(Dn(lr).includes(t)||Dn(dr).includes(t)||(ye(lr,[...Dn(lr),t],!0),tr()))}function Hr(t){const e=Qi.get(t);return void 0!==e&&e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent}function $r(t){return Qi.has(t)}function Fr(){return{get modals(){return Qi},get pendingMinimize(){return Dn(nr)},get pendingOpen(){return Dn(ir)},get pendingClose(){return Dn(rr)},get pendingRestore(){return Dn(sr)},get dockOrder(){return Dn(gr)}}}function qr(t){vr.has(t)?vr.delete(t):vr.add(t);const e=Qi.get(t);e&&(Qi.set(t,{...e,isTransparent:vr.has(t)}),tr())}function jr(t){vr.delete(t);const e=Qi.get(t);e&&(Qi.set(t,{...e,isTransparent:!1}),tr())}function Xr(t){hr.delete(t)}"undefined"!=typeof window&&((F=window.__svelte??(window.__svelte={})).v??(F.v=new Set)).add("5");const Yr=Symbol("modal-render-icon"),Nr=Symbol("modal-id");function Kr(){return Ri().features.animations}const Gr=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Vr(t){return Array.from(t.querySelectorAll(Gr)).filter(t=>null!==t.offsetParent||"A"===t.tagName)}function Ur(t,e){if("Tab"!==t.key)return;const n=Vr(e);if(0===n.length)return void t.preventDefault();const i=n[0],r=n[n.length-1],o=document.activeElement;t.shiftKey?o===i&&(r.focus(),t.preventDefault()):o===r&&(i.focus(),t.preventDefault())}function Qr(t){const e=Vr(t);return e.length>0&&(e[0].focus(),!0)}const Jr="modal-portal";var Zr=Fn('<div style="display: contents;"><!></div>');function to(t,e){Tt(e,!0);let n=Oi(e,"target",0,"body"),i=null,r=null;const{mount:o}={mount:function(t,e=null){const n=function(t){if("undefined"==typeof window)return null;if(t instanceof HTMLElement)return t;if("string"==typeof t){const e=document.querySelector(t);if(e)return e;if(t.startsWith("#")){const e=t.slice(1),n=document.createElement("div");return n.id=e,document.body.appendChild(n),n}}let e=document.getElementById(Jr);return e||(e=document.createElement("div"),e.id=Jr,document.body.appendChild(e)),e}(e);return n?(n.appendChild(t),()=>{t.parentNode===n&&n.removeChild(t),n.id!==Jr&&0===n.children.length&&n.parentNode&&n.parentNode.removeChild(n)}):()=>{}}};ti(()=>(i&&(r=o(i,n())),()=>{null==r||r()}));var s=Zr();Zn(Ee(s),()=>e.children),Si(s,t=>i=t,()=>i),jn(t,s),Bt()}var eo=Fn('<button type="button" aria-label="Minimize"></button>'),no=Fn('<button type="button" class="modal-header-light modal-header-light-style" aria-label="Toggle style"></button>'),io=Fn('<div class="modal-header-icon"><!></div>'),ro=Fn('<div class="modal-header-icon"><!></div>'),oo=Fn('<h2 class="modal-header-title"> </h2>'),so=Fn('<h2 class="modal-header-title"> </h2>'),ao=Fn('<div class="modal-header-traffic-lights"><button type="button" class="modal-header-light modal-header-light-close" aria-label="Close"></button> <!> <!></div> <div class="modal-header-mac-center"><!> <div class="modal-header-title-group"><!></div></div> <div class="modal-header-mac-spacer"></div>',1),lo=Fn('<div class="modal-header-icon"><!></div>'),uo=Fn('<div class="modal-header-icon"><!></div>'),co=Fn('<h2 class="modal-header-title"> </h2>'),fo=Fn('<h2 class="modal-header-title"> </h2>'),ho=Fn('<button type="button" class="modal-header-btn-windows modal-header-btn-windows-style" aria-label="Toggle style">◇</button>'),po=Fn('<button type="button" aria-label="Minimize">–</button>'),vo=Fn('<div class="modal-header-title-group"><!> <!></div> <div class="modal-header-actions"><!> <!> <button type="button" class="modal-header-btn-windows modal-header-btn-windows-close" aria-label="Close">×</button></div>',1),go=Fn("<header><!></header>");An(["pointerdown","click"]);var mo=Fn("<div></div>"),wo=Fn('<div class="modal-resize-handles"></div>');function yo(t,e){return e&&t.appendChild(e),{update(e){t.innerHTML="",e&&t.appendChild(e)},destroy(){t.innerHTML=""}}}An(["pointerdown"]);var xo=Fn('<div class="modal-footer"><!></div>'),bo=Fn("<div></div>"),Mo=Fn('<div role="dialog" aria-modal="true" tabindex="-1"><!> <div class="modal-body"><!></div> <!> <!> <!></div>');function zo(t,e){Tt(e,!0);let n=Oi(e,"maxWidth",0,"600px"),i=Oi(e,"autoOpen",0,!1),r=Oi(e,"closeOnEscape",0,!0),o=Oi(e,"skipRegistration",0,!1);var s,a;s=Nr,a=()=>e.id,Rt().set(s,a);const l=Ri().portalTarget,d=le(()=>Ui(e.id));function u(t){var n,i;return(null==(i=null==(n=e.config)?void 0:n.features)?void 0:i[t])??function(t){return Wi.features[t]}(t)}const c=le(()=>(Bi(),u("drag"))),f=le(()=>(Bi(),u("minimize"))),h=le(()=>(Bi(),!u("dock"))),p=le(()=>(Bi(),u("transparency"))),v=le(()=>(Bi(),u("resize"))),g=le(()=>{var t,n;return Bi(),(null==(n=null==(t=e.config)?void 0:t.appearance)?void 0:n.headerLayout)??Ri().appearance.headerLayout});let m=me(null),w=me(!1),y=me(!1),x=me(!1),b=me(!1),M=me(!1);const z=le(()=>(Or(),Sr(e.id))),k=le(()=>Dn(z)&&(Dn(z).isOpen||Wr(e.id))&&(!Dn(z).isMinimized||Cr(e.id))&&!Dn(z).isHiddenWithParent),I=le(()=>{var t;return!!(null==(t=Dn(z))?void 0:t.childId)}),_=le(()=>{var t;return!!(null==(t=Dn(z))?void 0:t.parentId)}),P=le(()=>Dn(I)||Dn(y)),D=le(()=>!!e.glow),C=le(()=>`modal-title-${Dn(d)}`),S=le(()=>{var t;return(null==(t=Dn(z))?void 0:t.zIndex)??1e3}),O=function(t={x:0,y:0}){const e=ke({...t}),n=ke({isDragging:!1,startX:0,startY:0,initialX:0,initialY:0,hasBeenDragged:!1});return{get position(){return e},get hasBeenDragged(){return n.hasBeenDragged},get isDragging(){return n.isDragging},onPointerDown:function(t,i){if(0===t.button){if(!n.hasBeenDragged){const t=i.getBoundingClientRect();e.x=t.left,e.y=t.top}n.isDragging=!0,n.startX=t.clientX,n.startY=t.clientY,n.initialX=e.x,n.initialY=e.y,i.setPointerCapture(t.pointerId)}},onPointerMove:function(t,i,r){if(!n.isDragging)return;const o=t.clientX-n.startX,s=t.clientY-n.startY,a=Yi(n.initialX+o,n.initialY+s,r.width,r.height);e.x=a.x,e.y=a.y,n.hasBeenDragged=!0},onPointerUp:function(t,e){n.isDragging&&(n.isDragging=!1,e.releasePointerCapture(t.pointerId))},setPosition:function(t){e.x=t.x,e.y=t.y},setHasBeenDragged:function(t){n.hasBeenDragged=t},reset:function(){e.x=t.x,e.y=t.y,n.hasBeenDragged=!1}}}({x:0,y:0});let E=me(!1);const W=function(t,n,i){let r=me(!1),o=me(""),s=me(ke({width:0,height:0})),a=me(!1),l=me(!1),d={x:0,y:0,width:0,height:0,posX:0,posY:0},u=null;function c(e,l){e.preventDefault(),e.stopPropagation();const c=t();if(!c)return;const p=c.getBoundingClientRect();O.hasBeenDragged||(i({x:p.left,y:p.top}),O.setHasBeenDragged(!0)),Dn(a)||(ye(s,{width:p.width,height:p.height},!0),ye(a,!0));const v=n();ye(r,!0),ye(o,l,!0),u=e.pointerId,d={x:e.clientX,y:e.clientY,width:Dn(s).width,height:Dn(s).height,posX:v.x,posY:v.y,centerX:v.x+Dn(s).width/2,centerY:v.y+Dn(s).height/2},window.addEventListener("pointermove",f),window.addEventListener("pointerup",h),window.addEventListener("pointercancel",h)}function f(t){if(t.pointerId!==u)return;const e=t.clientX-d.x,n=t.clientY-d.y,r=window.innerWidth,a=window.innerHeight;let l=d.width,c=d.height,f=d.posX,h=d.posY;if(Dn(o).includes("e")){const t=r-f;l=Math.max(280,Math.min(d.width+e,t))}if(Dn(o).includes("w")){const t=d.width-280,n=Math.min(e,t);l=d.width-n,f=d.posX+n}if(Dn(o).includes("s")){const t=a-h;c=Math.max(200,Math.min(d.height+n,t))}if(Dn(o).includes("n")){const t=d.height-200,e=Math.min(n,t);c=d.height-e,h=d.posY+e}const p=Ni(f,h,l,c);ye(s,{width:p.width,height:p.height},!0),i({x:p.x,y:p.y})}function h(t){t.pointerId===u&&(ye(r,!1),u=null,window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),ye(l,!0),((t,n)=>{const i=Sr(e.id);if(null==i?void 0:i.parentId){const t=Sr(i.parentId),r=document.querySelector(`[data-modal-id="${Ui(i.parentId)}"]`);if(t&&r){const i=t.position??{x:r.getBoundingClientRect().left,y:r.getBoundingClientRect().top},o=t.size??{width:r.offsetWidth,height:r.offsetHeight},s={x:i.x+(o.width-n.width)/2,y:i.y+(o.height-n.height)/2};ye(E,!0),O.setPosition(s);const a={x:s.x-i.x,y:s.y-i.y};return zr(e.id,{position:s,size:n,hasBeenDragged:!0,offsetFromParent:a}),void setTimeout(()=>{ye(E,!1)},200)}}zr(e.id,{position:t,size:n,hasBeenDragged:!0})})(n(),Dn(s)),setTimeout(()=>{ye(l,!1)},0))}const p={startResize:c};return{get isResizing(){return Dn(r)},get resizeDirection(){return Dn(o)},get size(){return Dn(s)},get hasBeenResized(){return Dn(a)},get isActive(){return Dn(r)},get justFinishedResizing(){return Dn(l)},start:c,setHasBeenResized:()=>{},setSize:function(t){ye(s,t,!0),ye(a,!0)},reset:function(){ye(a,!1),ye(s,{width:0,height:0},!0)},constrainToViewport:function(){const e=n(),r=t();if(!r)return;const o=Ni(e.x,e.y,Dn(s).width||r.offsetWidth,Dn(s).height||r.offsetHeight);ye(s,{width:o.width,height:o.height},!0),i({x:o.x,y:o.y})},handlers:p}}(()=>Dn(m),()=>O.position,t=>O.setPosition(t)),T=function(t,n,i,r,o,s,a,l,d){let u=me(!1),c=me(!1),f=me(!1),h=me(!1),p=me(null),v=me(null),g=null,m=null;function w(){m&&(clearTimeout(m),m=null)}function y(){const t=e.id,n=document.querySelector(`.modal-dock-item[data-modal-id="${Ui(t)}"]`),i=document.querySelector('[data-dock-container="true"]'),r=n||i;if(r){const t=r.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}return{x:window.innerWidth/2,y:window.innerHeight-40}}return He(()=>()=>{w(),ye(u,!1),ye(c,!1),ye(f,!1),ye(h,!1),ye(p,null),ye(v,null),g=null}),{get isMinimizing(){return Dn(u)},get isRestoring(){return Dn(c)},get isOpening(){return Dn(f)},get isClosing(){return Dn(h)},get animationTransform(){return Dn(p)},get pendingOpenSource(){return Dn(v)},startMinimize:function(t,e){const h=n();if(Dn(u)||!h)return;if(ye(c,!1),ye(f,!1),w(),!Kr()){const t=h.getBoundingClientRect();let n=o()?i():{x:t.left,y:t.top},u=a()?l():{width:t.width,height:t.height};return o()||(r(n),s(!0)),void(e?e():d(n,!0,u))}const v=h.getBoundingClientRect(),g=v.left+v.width/2,x=v.top+v.height/2;let b=o()?i():{x:v.left,y:v.top},M=a()?l():{width:v.width,height:v.height};o()||(r(b),s(!0));const z=t??y(),k=z.x-v.left,I=z.y-v.top,_={x:z.x-g,y:z.y-x,originX:k,originY:I};ye(p,_,!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ye(u,!0)})}),m=setTimeout(()=>{e?e():d(b,!0,M)},500)},startRestore:function(t,e){if(!Kr()){const e=t||{x:window.innerWidth/2,y:window.innerHeight/2};return r(e),void s(!0)}const n=y(),i=t||{x:window.innerWidth/2,y:window.innerHeight/2},o=e||{width:480,height:400};r(i),s(!0);const a=i.x+o.width/2,l=i.y+o.height/2,d=n.x-i.x,u=n.y-i.y;ye(p,{x:n.x-a,y:n.y-l,originX:d,originY:u},!0),ye(c,!0),setTimeout(()=>{ye(c,!1),ye(p,null)},400)},startClose:function(t){Dn(h)||Dn(u)||(Kr()?(g=t,ye(h,!0),setTimeout(()=>{ye(h,!1),g&&(g(),g=null)},250)):t())},setPendingOpenSource:function(t){ye(v,t,!0)},tryStartOpenAnimation:function(){const t=n();if(!Dn(v)||!t||Dn(f))return!1;if(!Kr())return ye(v,null),!1;const e=Dn(v);ye(v,null);const a=t.getBoundingClientRect(),l=o()?i():{x:a.left,y:a.top},d=a.width,u=a.height,c=l.x+d/2,h=l.y+u/2;o()||(r(l),s(!0));const g=e.x-l.x,m=e.y-l.y;return ye(p,{x:e.x-c,y:e.y-h,originX:g,originY:m},!0),ye(f,!0),setTimeout(()=>{ye(f,!1),ye(p,null)},400),!0},forceClearMinimize:function(){w(),ye(u,!1),ye(p,null)}}}(0,()=>Dn(m),()=>O.position,t=>O.setPosition(t),()=>O.hasBeenDragged,t=>O.setHasBeenDragged(t),()=>W.hasBeenResized,()=>W.size,(t,n,i)=>{zr(e.id,{position:t,size:i,hasBeenDragged:n}),yr(e.id)}),{trapFocus:B,focusFirstElement:R}={trapFocus:Ur,focusFirstElement:Qr},A=le(()=>T.isMinimizing||T.isRestoring||T.isOpening||T.isClosing),L=le(()=>(Ar(e.id)||Rr(e.id))&&!T.isRestoring);let H=me(!1);const $=le(()=>T.isRestoring||T.isOpening||Dn(H)),F=le(()=>Dn(k)&&!O.hasBeenDragged&&!Dn(A)&&!T.pendingOpenSource&&!Dn(L)),q=le(()=>{const t=[];return t.push(`z-index: ${Dn(S)};`),T.animationTransform?(t.push(`left: ${O.position.x}px; top: ${O.position.y}px;`),t.push(`--genie-origin-x: ${T.animationTransform.originX}px;`),t.push(`--genie-origin-y: ${T.animationTransform.originY}px;`),t.push(`--genie-translate-x: ${T.animationTransform.x}px;`),t.push(`--genie-translate-y: ${T.animationTransform.y}px;`)):O.hasBeenDragged&&t.push(`left: ${O.position.x}px; top: ${O.position.y}px; transform: none;`),W.hasBeenResized?t.push(`width: ${W.size.width}px; height: ${W.size.height}px; max-width: none; max-height: none;`):(e.preferredHeight&&t.push(`min-height: ${e.preferredHeight};`),n()&&t.push(`max-width: ${n()};`)),Dn(D)&&e.glow&&(t.push(`--modal-glow-color: ${e.glow.color};`),t.push(`--modal-glow-intensity: ${e.glow.intensity};`)),t.join(" ")});function j(){Dn(f)&&yr(e.id)}function X(){var t;Tr(e.id)&&Br(e.id),_r(e.id),null==(t=e.onClose)||t.call(e)}function Y(){qr(e.id)}function N(t){Dn(c)&&Dn(m)&&O.onPointerDown(t,Dn(m))}function K(t){r()&&"Escape"===t.key&&function(t){const e=Qi.get(t);if(!e)return!1;const n=Math.max(...Array.from(Qi.values()).map(t=>t.zIndex),0);return e.zIndex===n&&!e.isMinimized&&!e.isHiddenWithParent}(e.id)&&(t.stopPropagation(),X())}function G(t){if(!Dn(m))return;const n=O.isDragging,i=W.hasBeenResized?W.size:{width:Dn(m).offsetWidth,height:Dn(m).offsetHeight};O.onPointerMove(t,Dn(m),i),O.isDragging&&n&&Mr(e.id,O.position,{drag:!0})}function V(t){if(!Dn(m))return;const n=O.isDragging;O.onPointerUp(t,Dn(m)),n&&!W.justFinishedResizing&&(Mr(e.id,O.position,{drag:!0}),function(t){const e=Ri();if("animated"!==e.parentChild.movementMode)return;const n=e.parentChild.animationDuration,i=[];let r=t;for(;;){const t=Qi.get(r);if(!(null==t?void 0:t.parentId))break;i.push({parentId:t.parentId,childId:r}),r=t.parentId}i.forEach(({parentId:t,childId:e},i)=>{setTimeout(()=>{const i=Qi.get(e),r=Qi.get(t);if(!(null==i?void 0:i.position)||!i.offsetFromParent||!r)return;const o={x:i.position.x-i.offsetFromParent.x,y:i.position.y-i.offsetFromParent.y};hr.set(t,o),function(t){const e=hr.get(t);if(!e)return;const n=Qi.get(t);n&&(Qi.set(t,{...n,isAnimatingPosition:!0,position:e}),hr.delete(t),tr())}(t),setTimeout(()=>function(t){const e=Qi.get(t);e&&(Qi.set(t,{...e,isAnimatingPosition:!1}),tr())}(t),n)},i*n)})}(e.id))}function U(){var t;const n=Ri();if("smart"!==(null==(t=n.positioning)?void 0:t.strategy))return!1;const i=Sr(e.id),r=Dn(fr);if((null==i?void 0:i.parentId)||r&&r.childId===e.id)return!1;if((null==i?void 0:i.hasBeenDragged)||(null==i?void 0:i.position))return!1;const o=Dn(m)||document.querySelector(`[data-modal-id="${Dn(d)}"]`);if(!o)return!1;const s=o.offsetWidth,a=o.offsetHeight;if(s<=0||a<=0)return!1;const l=n.positioning.modalGap??16,u=function(t){const e=[];for(const[n,i]of Qi.entries())if(n!==t&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent)if(i.position&&i.size)e.push({x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const t=document.querySelector(`[data-modal-id="${Ui(n)}"]`);if(t){const n=t.getBoundingClientRect();e.push({x:n.left,y:n.top,width:n.width,height:n.height})}}return e}(e.id),c=function(t){if("undefined"==typeof document)return[];const e=[];for(const n of t)try{const t=document.querySelectorAll(n);for(const n of t){const t=n.getBoundingClientRect();t.width>0&&t.height>0&&e.push({x:t.left,y:t.top,width:t.width,height:t.height})}}catch{}return e}(n.positioning.avoidElements??[]),f=function(t,e,n,i={}){const{modalGap:r=16,gridResolution:o=10,avoidBounds:s=[],avoidMargin:a=16}=i,l=i.margin??r,d="undefined"!=typeof window?window.innerWidth:1920,u="undefined"!=typeof window?window.innerHeight:1080,c=s.map(t=>({x:t.x-a,y:t.y-a,width:t.width+2*a,height:t.height+2*a})),f={x:(d-t)/2,y:(u-e)/2};if(0===n.length&&0===c.length)return f;const h=l,p=Math.max(l,d-t-l),v=l,g=Math.max(l,u-e-l);if(p<=h||g<=v)return f;const m=Gi(f.x,f.y,t,e,n,r),w=Gi(f.x,f.y,t,e,c,0);if(0===m&&0===w)return f;const y=[],x=(p-h)/o,b=(g-v)/o;for(let i=0;i<=o;i++)for(let s=0;s<=o;s++){const o=h+i*x,a=v+s*b,f=Gi(o,a,t,e,n,r),p=Gi(o,a,t,e,c,0),g=Vi(o,a,t,e,d,u,l);y.push({pos:{x:o,y:a},modalOverlap:f,avoidOverlap:p,centerDist:g})}const M=y.filter(t=>0===t.avoidOverlap),z=M.length>0?M:y,k=t*e,I=Math.min(...z.map(t=>t.modalOverlap))/k;return z.sort((t,e)=>{if(0===M.length&&t.avoidOverlap!==e.avoidOverlap)return t.avoidOverlap-e.avoidOverlap;const n=t.modalOverlap/k,i=e.modalOverlap/k;if(I<.3){const r=.3,o=n<=r,s=i<=r;if(o&&s)return t.centerDist+.3*n-(e.centerDist+.3*i);if(o)return-1;if(s)return 1}return.6*n+.4*t.centerDist-(.6*i+.4*e.centerDist)}),z[0].pos}(s,a,u,{modalGap:l,avoidBounds:c});if(Gi(f.x,f.y,s,a,u,l)/(s*a)>.1&&u.length>0){const t=function(t){const e=[];for(const[n,i]of Qi.entries())if(n!==t&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent&&!i.parentId)if(i.position&&i.size)e.push({id:Ui(n),x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const t=document.querySelector(`[data-modal-id="${Ui(n)}"]`);if(t){const i=t.getBoundingClientRect();e.push({id:Ui(n),x:i.left,y:i.top,width:i.width,height:i.height})}}return e}(e.id),n=function(t,e,n,i={}){const{modalGap:r=16}=i,o=i.margin??r,s="undefined"!=typeof window?window.innerWidth:1920,a="undefined"!=typeof window?window.innerHeight:1080,l=n.reduce((t,e)=>t+e.width,0)+t,d=n.length*r,u=s-2*o;if(l+d>u)return null;const c=u-l-d;n.length;const f=c/2,h=s/2,p=[...n.map(t=>({id:t.id,width:t.width,height:t.height,currentX:t.x+t.width/2,currentY:t.y,isNew:!1})),{id:"__new__",width:t,height:e,currentX:h,currentY:(a-e)/2,isNew:!0}];p.sort((t,e)=>t.currentX-e.currentX);let v=o+f;const g=new Map;let m=null;for(const t of p){const e=v;if(t.isNew)m={x:Math.round(e),y:Math.round(t.currentY)};else{const i=n.find(e=>e.id===t.id);Math.abs(e-i.x)>5&&g.set(t.id,{x:Math.round(e),y:Math.round(i.y)})}v+=t.width+r}return m?{newModalPosition:m,existingModalMoves:g}:null}(s,a,t,{modalGap:l});if(n&&n.existingModalMoves.size>0)return function(t){const e=Ri().parentChild.animationDuration;for(const[e,n]of t){const t=Qi.get(e);t&&Qi.set(e,{...t,position:n,isAnimatingPosition:!0,hasBeenDragged:!0})}tr(),setTimeout(()=>{for(const e of t.keys()){const t=Qi.get(e);t&&Qi.set(e,{...t,isAnimatingPosition:!1})}tr()},e)}(n.existingModalMoves),O.setPosition(n.newModalPosition),O.setHasBeenDragged(!0),Mr(e.id,n.newModalPosition,{size:{width:s,height:a}}),!0}return O.setPosition(f),O.setHasBeenDragged(!0),Mr(e.id,f,{size:{width:s,height:a}}),!0}function Q(){Pn().then(()=>Pn()).then(()=>{let t=0;const e=()=>{t+=1,U()||t>5||requestAnimationFrame(e)};Dn(m)?e():requestAnimationFrame(e)})}ti(()=>{var t;function n(){const t=Sr(e.id);if(!(null==t?void 0:t.position)||!Dn(m))return;if(t.parentId)return;const n=W.hasBeenResized?W.size.width:Dn(m).offsetWidth,i=W.hasBeenResized?W.size.height:Dn(m).offsetHeight;if(n<=0||i<=0)return;const r=Yi(t.position.x,t.position.y,n,i);(Math.abs(r.x-t.position.x)>1||Math.abs(r.y-t.position.y)>1)&&(O.setPosition(r),Mr(e.id,r))}return o()||(t=i(),mr({id:e.id,title:e.title,icon:e.icon??"",isOpen:t,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:e.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),t&&kr(e.id)),i()&&(Pn().then(()=>{Dn(m)&&R(Dn(m))}),Q()),window.addEventListener("pointermove",G),window.addEventListener("pointerup",V),window.addEventListener("resize",n),()=>{window.removeEventListener("pointermove",G),window.removeEventListener("pointerup",V),window.removeEventListener("resize",n)}}),ei(()=>{jr(e.id),o()||wr(e.id)}),He(()=>{Or();const t=Sr(e.id);if(t){if(ye(w,t.isTransparent,!0),!O.isDragging&&!W.isResizing&&t.position){const e=O.position,n=t.position;(Math.abs(e.x-n.x)>.5||Math.abs(e.y-n.y)>.5)&&(O.setPosition(n),t.hasBeenDragged&&O.setHasBeenDragged(!0))}Pn().then(()=>function(){var t,n;if(!Sr(e.id))return;if(Tr(e.id))return Br(e.id),void(null==(t=e.onClose)||t.call(e));if(Cr(e.id)&&!Dn(b)){if(ye(b,!0),Dn(ur),ye(ur,null),Dn(m)){const t=Dn(m).getBoundingClientRect(),n=O.hasBeenDragged?O.position:{x:t.left,y:t.top},i=W.hasBeenResized?W.size:{width:t.width,height:t.height};zr(e.id,{position:n,size:i,hasBeenDragged:!0})}T.startMinimize(void 0,()=>{var t;t=e.id,Dn(nr).includes(t)&&ye(nr,Dn(nr).filter(e=>e!==t),!0),ye(b,!1)})}if(Rr(e.id)){n=e.id,Dn(sr).includes(n)&&ye(sr,Dn(sr).filter(t=>t!==n),!0);const t=Sr(e.id);T.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0),Pn().then(()=>{Dn(m)&&R(Dn(m))})}if(Ar(e.id)){!function(t){Dn(ar).includes(t)&&ye(ar,Dn(ar).filter(e=>e!==t),!0)}(e.id);const t=Sr(e.id);T.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0)}if(Wr(e.id)&&(function(t){Dn(rr).includes(t)&&ye(rr,Dn(rr).filter(e=>e!==t),!0)}(e.id),T.startClose(()=>{var t;jr(e.id),function(t){const e=Qi.get(t);if(e){if(e.parentId){const n=Qi.get(e.parentId);n&&n.childId===t&&Qi.set(e.parentId,{...n,childId:void 0,lastChildId:t})}Qi.set(t,{...e,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),tr()}}(e.id),null==(t=e.onClose)||t.call(e)})),Er(e.id)){!function(t){Dn(ir).includes(t)&&ye(ir,Dn(ir).filter(e=>e!==t),!0)}(e.id);const t=function(t){const e=cr.get(t);return e&&cr.delete(t),e??null}(e.id)||e.openSourcePosition||null;t?(T.setPendingOpenSource(t),Pn().then(()=>Pn()).then(()=>{U(),T.tryStartOpenAnimation()})):Q(),Pn().then(()=>{Dn(m)&&R(Dn(m))})}(function(t){return Dn(lr).includes(t)})(e.id)&&(function(t){Dn(lr).includes(t)&&ye(lr,Dn(lr).filter(e=>e!==t),!0)}(e.id),function(t){Dn(dr).includes(t)||ye(dr,[...Dn(dr),t],!0)}(e.id),ye(M,!0),setTimeout(()=>{ye(M,!1),function(t){ye(dr,Dn(dr).filter(e=>e!==t),!0)}(e.id)},600));const i=function(t){if(!Dn(fr)||Dn(fr).childId!==t)return null;const e=Dn(fr);return ye(fr,null),e}(e.id);var r;i&&Dn(m)&&(r=i.parentId,Pn().then(()=>Pn()).then(()=>{let t=0;const n=()=>{t+=1;const i=function(t){var n,i;const r=Sr(t);if(!r)return!1;const o=Dn(m)||document.querySelector(`[data-modal-id="${Dn(d)}"]`),s=document.querySelector(`[data-modal-id="${Ui(t)}"]`),a=null==s?void 0:s.getBoundingClientRect(),l=r.position??(a?{x:a.left,y:a.top}:null);if(!l||!o)return!1;const u=(null==(n=r.size)?void 0:n.width)??(null==s?void 0:s.offsetWidth)??(null==a?void 0:a.width)??480,c=(null==(i=r.size)?void 0:i.height)??(null==s?void 0:s.offsetHeight)??(null==a?void 0:a.height)??400,f=o.offsetWidth,h=o.offsetHeight;if(u<=0||c<=0||f<=0||h<=0)return!1;const p={x:l.x+(u-f)/2,y:l.y+(c-h)/2};return O.setPosition(p),O.setHasBeenDragged(!0),Mr(e.id,p,{size:{width:f,height:h}}),r.position&&r.size||!a||Mr(t,{x:a.left,y:a.top},{size:{width:u,height:c}}),function(t,e){if(!Ri().features.parentChild)return;const n=Qi.get(t),i=Qi.get(e);if(!n||!i)return;let r={x:40,y:40};n.position&&i.position&&(r={x:i.position.x-n.position.x,y:i.position.y-n.position.y});const o=Math.max(i.zIndex,n.zIndex+1);Qi.set(t,{...n,childId:e,lastChildId:e}),Qi.set(e,{...i,parentId:t,offsetFromParent:r,zIndex:o}),tr()}(t,e.id),!0}(r);i||t>5||requestAnimationFrame(n)};Dn(m)?n():requestAnimationFrame(n)}))}())}}),He(()=>{const t=Sr(e.id);t&&t.isTransparent!==Dn(w)&&ye(w,t.isTransparent,!0)}),He(()=>{if(Dn(k)&&Dn(m)){const t=t=>function(t){Dn(m)&&B(t,Dn(m))}(t);return Dn(m).addEventListener("keydown",t),()=>{var e;return null==(e=Dn(m))?void 0:e.removeEventListener("keydown",t)}}}),He(()=>{!Dn(k)&&T.isMinimizing&&T.forceClearMinimize()}),He(()=>{T.isRestoring||T.isOpening?ye(H,!0):Dn(H)&&requestAnimationFrame(()=>{ye(H,!1)})}),He(()=>{Dn(x)&&!Dn(I)&&(ye(y,!0),setTimeout(()=>{ye(y,!1)},200)),ye(x,Dn(I),!0)});var J=qn(),Z=We(J),tt=t=>{to(t,{get target(){return l},children:(t,n)=>{var i=Mo();let r;i.__keydown=K;var o=Ee(i);{let t=le(()=>Dn(c)?N:void 0);!function(t,e){Tt(e,!0);let n=Oi(e,"isTransparent",0,!1),i=Oi(e,"headerLayout",0,"macos"),r=Oi(e,"minimizable",0,!0),o=Oi(e,"minimizeDisabled",0,!1),s=Oi(e,"transparencyEnabled",0,!0);const a=Wt(Yr),l=le(()=>null==a?void 0:a()),d=le(()=>"macos"===i());var u=go();let c;u.__pointerdown=function(t){var n;t.target.closest("button")||null==(n=e.onStartDrag)||n.call(e,t)};var f=Ee(u),h=t=>{var n=ao(),i=We(n),a=Ee(i);a.__click=function(...t){var n;null==(n=e.onClose)||n.apply(this,t)};var d=Te(a,2),u=t=>{var n=eo();let i;n.__click=function(...t){var n;null==(n=o()?void 0:e.onMinimize)||n.apply(this,t)},je(()=>{i=Mi(n,0,"modal-header-light modal-header-light-minimize",null,i,{"modal-header-light-disabled":o()}),n.disabled=o(),Pi(n,"title",o()?"Enable dock to minimize":void 0)}),jn(t,n)};ni(d,t=>{r()&&t(u)});var c=Te(d,2),f=t=>{var n=no();n.__click=function(...t){var n;null==(n=e.onToggleStyle)||n.apply(this,t)},jn(t,n)};ni(c,t=>{s()&&t(f)});var h=Ee(Te(i,2)),p=t=>{var n=io();Zn(Ee(n),()=>e.customIcon),jn(t,n)},v=t=>{var n=qn(),i=We(n),r=t=>{var n=ro();Zn(Ee(n),()=>Dn(l),()=>e.icon),jn(t,n)};ni(i,t=>{e.icon&&Dn(l)&&t(r)},!0),jn(t,n)};ni(h,t=>{e.customIcon?t(p):t(v,!1)});var g=Ee(Te(h,2)),m=t=>{var n=oo(),i=Ee(n);je(()=>{Pi(n,"id",e.titleId),Kn(i,e.title)}),jn(t,n)},w=t=>{var n=so(),i=Ee(n);je(()=>Kn(i,e.title)),jn(t,n)};ni(g,t=>{e.titleId?t(m):t(w,!1)}),jn(t,n)},p=t=>{var n=vo(),i=We(n),a=Ee(i),d=t=>{var n=lo();Zn(Ee(n),()=>e.customIcon),jn(t,n)},u=t=>{var n=qn(),i=We(n),r=t=>{var n=uo();Zn(Ee(n),()=>Dn(l),()=>e.icon),jn(t,n)};ni(i,t=>{e.icon&&Dn(l)&&t(r)},!0),jn(t,n)};ni(a,t=>{e.customIcon?t(d):t(u,!1)});var c=Te(a,2),f=t=>{var n=co(),i=Ee(n);je(()=>{Pi(n,"id",e.titleId),Kn(i,e.title)}),jn(t,n)},h=t=>{var n=fo(),i=Ee(n);je(()=>Kn(i,e.title)),jn(t,n)};ni(c,t=>{e.titleId?t(f):t(h,!1)});var p=Ee(Te(i,2)),v=t=>{var n=ho();n.__click=function(...t){var n;null==(n=e.onToggleStyle)||n.apply(this,t)},jn(t,n)};ni(p,t=>{s()&&t(v)});var g=Te(p,2),m=t=>{var n=po();let i;n.__click=function(...t){var n;null==(n=o()?void 0:e.onMinimize)||n.apply(this,t)},je(()=>{i=Mi(n,0,"modal-header-btn-windows",null,i,{"modal-header-btn-windows-disabled":o()}),n.disabled=o(),Pi(n,"title",o()?"Enable dock to minimize":void 0)}),jn(t,n)};ni(g,t=>{r()&&t(m)}),Te(g,2).__click=function(...t){var n;null==(n=e.onClose)||n.apply(this,t)},jn(t,n)};ni(f,t=>{Dn(d)?t(h):t(p,!1)}),je(()=>c=Mi(u,0,"modal-header",null,c,{"modal-header-draggable":!!e.onStartDrag,transparent:n()})),jn(t,u),Bt()}(o,{get title(){return e.title},get customIcon(){return e.customIcon},get icon(){return e.icon},get isTransparent(){return Dn(w)},get titleId(){return Dn(C)},get headerLayout(){return Dn(g)},get onStartDrag(){return Dn(t)},onToggleStyle:Y,onMinimize:j,onClose:X,get minimizable(){return Dn(f)},get minimizeDisabled(){return Dn(h)},get transparencyEnabled(){return Dn(p)}})}var s=Te(o,2);Zn(Ee(s),()=>e.children??at),wi(s,(t,e)=>null==yo?void 0:yo(t,e),()=>e.bodyElement);var a=Te(s,2),l=t=>{var n=xo(),i=Ee(n),r=t=>{var n=qn();Zn(We(n),()=>e.footer),jn(t,n)};ni(i,t=>{e.footer&&t(r)}),wi(n,(t,e)=>null==yo?void 0:yo(t,e),()=>e.footerElement),jn(t,n)};ni(a,t=>{(e.footer||e.footerElement)&&t(l)});var u=Te(a,2);{let t=le(()=>Dn(v)&&!Dn(I)?W.handlers.startResize:void 0);!function(t,e){Tt(e,!0);const n=["n","s","e","w","ne","nw","se","sw"];var i=qn(),r=We(i),o=t=>{var i=wo();si(i,21,()=>n,ii,(t,n)=>{var i=mo();i.__pointerdown=t=>function(t,n){var i;null==(i=e.onStartResize)||i.call(e,t,n)}(t,Dn(n)),je(()=>Mi(i,0,`modal-resize-handle modal-resize-${Dn(n)??""}`)),jn(t,i)}),jn(t,i)};ni(r,t=>{e.onStartResize&&t(o)}),jn(t,i),Bt()}(u,{get onStartResize(){return Dn(t)}})}var x,b,k,S=Te(u,2),B=t=>{var e=bo();let n;je(()=>n=Mi(e,0,"modal-child-overlay",null,n,{"modal-overlay-closing":Dn(y)})),jn(t,e)};ni(S,t=>{Dn(P)&&t(B)}),Si(i,t=>ye(m,t),()=>Dn(m)),je(()=>{var t;r=Mi(i,0,"modal-dialog",null,r,{"modal-dragging":O.isDragging,"modal-resizing":W.isResizing,"modal-positioned":O.hasBeenDragged,"modal-minimizing":T.isMinimizing,"modal-restoring":T.isRestoring,"modal-opening":T.isOpening,"modal-closing":T.isClosing,"modal-centered":Dn(F),"modal-solid":!Dn(w),"modal-transparent":Dn(w),"modal-glow":Dn(D),"modal-has-child":Dn(I),"modal-is-child":Dn(_),"modal-visible-by-animation":Dn($),"modal-animating-to-center":Dn(E),"modal-animating-position":null==(t=Dn(z))?void 0:t.isAnimatingPosition,"modal-attention":Dn(M)}),Pi(i,"data-modal-id",Dn(d)),ki(i,Dn(q)),Pi(i,"aria-labelledby",Dn(C))}),k=function(t,e,n,i={}){function r(t){if(i.capture||Hn.call(e,t),!t.cancelBubble)return Be(()=>null==n?void 0:n.call(this,t))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?Ht(()=>{e.addEventListener(t,r,i)}):e.addEventListener(t,r,i),r}("pointerdown",x=i,()=>kr(e.id),b={capture:!0,passive:void 0}),(x===document.body||x===window||x===document||x instanceof HTMLMediaElement)&&Le(()=>{x.removeEventListener("pointerdown",k,b)}),jn(t,i)},$$slots:{default:!0}})};ni(Z,t=>{Dn(k)&&t(tt)}),jn(t,J),Bt()}An(["keydown"]);const ko=t=>t;function Io(t){const e=t-1;return e*e*e+1}function _o(t){const e="string"==typeof t&&t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[t,"px"]}function Po(t,{delay:e=0,duration:n=400,easing:i=ko}={}){const r=+getComputedStyle(t).opacity;return{delay:e,duration:n,easing:i,css:t=>"opacity: "+t*r}}function Do(t,{delay:e=0,duration:n=400,easing:i=Io,x:r=0,y:o=0,opacity:s=0}={}){const a=getComputedStyle(t),l=+a.opacity,d="none"===a.transform?"":a.transform,u=l*(1-s),[c,f]=_o(r),[h,p]=_o(o);return{delay:e,duration:n,easing:i,css:(t,e)=>`\n\t\t\ttransform: ${d} translate(${(1-t)*c}${f}, ${(1-t)*h}${p});\n\t\t\topacity: ${l-u*e}`}}function Co(t,{delay:e=0,duration:n=400,easing:i=Io,start:r=0,opacity:o=0}={}){const s=getComputedStyle(t),a=+s.opacity,l="none"===s.transform?"":s.transform,d=1-r,u=a*(1-o);return{delay:e,duration:n,easing:i,css:(t,e)=>`\n\t\t\ttransform: ${l} scale(${1-d*e});\n\t\t\topacity: ${a-u*e}\n\t\t`}}function So(t){const e=1.70158;return--t*t*((e+1)*t+e)+1}function Oo(t){const e=t-1;return e*e*e+1}var Eo=Fn('<button type="button" aria-label="Drag dock"></button>'),Wo=Fn('<span class="modal-dock-item-icon-placeholder"> </span>'),To=Fn('<span class="modal-dock-item-label"> </span>'),Bo=Fn("<span>+</span>"),Ro=Fn('<span class="modal-dock-child-indicator"><!></span>'),Ao=Fn('<button><span class="modal-dock-item-icon"><!></span> <!> <span class="modal-dock-item-glow"></span> <!></button>'),Lo=Fn('<div data-dock-container="true"><div><!> <!></div></div>');function Ho(t,e){Tt(e,!0);const n=Wt(Yr),i=le(()=>e.renderIcon??(null==n?void 0:n())),r=Fr(),o=le(()=>(Bi(),Ri())),s=le(()=>qi("DOCK")),a=le(()=>Dn(o).dock.position),l=le(()=>Dn(o).dock.labelMode);let d=me("horizontal"),u=me(ke({x:100,y:100})),c=me(null),f=me(!1),h={x:0,y:0},p=null;const v=le(()=>(Or(),Array.from(r.modals.values()).filter(t=>t.isMinimized).sort((t,e)=>t.dockPosition-e.dockPosition))),g=le(()=>{switch(Dn(a)){case"left":return{x:-20,duration:250,easing:Oo};case"right":return{x:20,duration:250,easing:Oo};default:return{y:20,duration:250,easing:Oo}}});function m(t){var e;"free"===Dn(a)&&(ye(f,!0),p=t.pointerId,h={x:t.clientX-Dn(u).x,y:t.clientY-Dn(u).y},null==(e=t.currentTarget)||e.setPointerCapture(t.pointerId),window.addEventListener("pointermove",w),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y))}function w(t){if(t.pointerId!==p||!Dn(c))return;const e=Dn(c).getBoundingClientRect(),n=window.innerWidth-e.width-8,i=window.innerHeight-e.height-8,r=Math.min(Math.max(t.clientX-h.x,8),Math.max(8,n)),o=Math.min(Math.max(t.clientY-h.y,8),Math.max(8,i));ye(u,{x:Math.round(r),y:Math.round(o)},!0)}function y(t){t.pointerId===p&&(ye(f,!1),p=null,window.removeEventListener("pointermove",w),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y))}const{addListener:x}=function(){function t(t,e,n){return"undefined"==typeof window?()=>{}:(window.addEventListener(t,e,n),()=>{window.removeEventListener(t,e,n)})}return{addListener:t,addListenerEffect:function(e,n,i){He(()=>{if("undefined"!=typeof window)return t(e,n,i)})}}}();function b(){if("free"!==Dn(a)||!Dn(c))return;const t=Dn(c).getBoundingClientRect(),e=Yi(Dn(u).x,Dn(u).y,t.width,t.height);e.x===Dn(u).x&&e.y===Dn(u).y||ye(u,{x:Math.round(e.x),y:Math.round(e.y)},!0)}He(()=>{"undefined"!=typeof window&&x("resize",b)});var M={setDockOrientation:function(t){ye(d,t,!0)},setDockFreePosition:function(t){ye(u,t,!0)},getDockState:function(){return{dockPosition:Dn(a),dockOrientation:Dn(d),dockFreePosition:Dn(u),dockLabelMode:Dn(l)}}};return to(t,{get target(){return Dn(o).portalTarget},children:(t,e)=>{var n=Lo();let o,h;var p=Ee(n);let w;var y=Ee(p),x=t=>{var e=Eo();let n;e.__pointerdown=m,je(()=>n=Mi(e,0,"modal-dock-handle",null,n,{"modal-dock-handle-dragging":Dn(f)})),jn(t,e)};ni(y,t=>{"free"===Dn(a)&&t(x)}),si(Te(y,2),19,()=>Dn(v),t=>t.id,(t,e,n)=>{const o=le(()=>Dn(e).lastChildId?r.modals.get(Dn(e).lastChildId):null);var s=Ao();let a;s.__click=t=>{var n;n=Dn(e).id,pr.has(n)?t.currentTarget.animate([{transform:"translateX(0)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(0)"}],{duration:300,easing:"ease-in-out"}):xr(Dn(e).id)};var d=Ee(s),u=Ee(d),c=t=>{var n=qn();Zn(We(n),()=>Dn(i),()=>Dn(e).icon),jn(t,n)},f=t=>{var n=Wo(),i=Ee(n);je(t=>Kn(i,t),[()=>Dn(e).title.charAt(0)]),jn(t,n)};ni(u,t=>{Dn(e).icon&&Dn(i)?t(c):t(f,!1)});var h=Te(d,2),p=t=>{var n=To(),i=Ee(n);je(()=>Kn(i,Dn(e).title)),jn(t,n)};ni(h,t=>{"hidden"!==Dn(l)&&t(p)});var v=Te(h,4),g=t=>{var e=Ro(),n=Ee(e),r=t=>{var e=qn();Zn(We(e),()=>Dn(i),()=>Dn(o).icon),jn(t,e)},s=t=>{jn(t,Bo())};ni(n,t=>{Dn(o).icon&&Dn(i)?t(r):t(s,!1)}),jn(t,e)};ni(v,t=>{Dn(e).lastChildId&&Dn(o)&&t(g)}),je(t=>{a=Mi(s,0,"modal-dock-item",null,a,{"modal-dock-item-has-glow":!!Dn(e).glow,"modal-dock-item-has-child":!!Dn(e).lastChildId,"modal-dock-item-label-beside":"beside"===Dn(l),"modal-dock-item-label-below":"below"===Dn(l)}),Pi(s,"data-modal-id",t),ki(s,Dn(e).glow?`--modal-dock-glow-color: ${Dn(e).glow.color};`:"")},[()=>Ui(Dn(e).id)]),gi(3,s,()=>Co,()=>({duration:300,delay:50*Dn(n),easing:So,start:.5})),jn(t,s)}),Si(n,t=>ye(c,t),()=>Dn(c)),je(()=>{o=Mi(n,0,"modal-dock-container",null,o,{"modal-dock-left":"left"===Dn(a),"modal-dock-right":"right"===Dn(a),"modal-dock-bottom":"bottom"===Dn(a),"modal-dock-free":"free"===Dn(a),"modal-dock-empty":0===Dn(v).length}),h=ki(n,"free"===Dn(a)?`left: ${Dn(u).x}px; top: ${Dn(u).y}px;`:"",h,{"z-index":Dn(s)}),w=Mi(p,0,"modal-dock",null,w,{"modal-dock-free-horizontal":"free"===Dn(a)&&"horizontal"===Dn(d),"modal-dock-free-vertical":"free"===Dn(a)&&"vertical"===Dn(d)})}),gi(3,n,()=>Do,()=>Dn(v).length>0?Dn(g):{duration:0}),jn(t,n)},$$slots:{default:!0}}),Bt(M)}function $o(t,e){Tt(e,!0);let n=Oi(e,"maxWidth",0,"600px"),i=Oi(e,"autoOpen",0,!1),r=Oi(e,"closeOnEscape",0,!0),o=me(!1);ti(()=>{mr({id:e.id,title:e.title,icon:e.icon??"",isOpen:i(),isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:e.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),ye(o,!0)}),ei(()=>{wr(e.id)});const s=le(()=>{if(!Dn(o))return!1;Or();const t=Sr(e.id);return!!t&&(t.isOpen||t.isMinimized||Er(e.id)||Wr(e.id)||Cr(e.id))});var a=qn(),l=We(a),d=t=>{zo(t,{get id(){return e.id},get title(){return e.title},get icon(){return e.icon},get customIcon(){return e.customIcon},get maxWidth(){return n()},get preferredHeight(){return e.preferredHeight},get autoOpen(){return i()},get openSourcePosition(){return e.openSourcePosition},get glow(){return e.glow},get config(){return e.config},get closeOnEscape(){return r()},get onClose(){return e.onClose},get children(){return e.children},get footer(){return e.footer},skipRegistration:!0})};ni(l,t=>{Dn(s)&&t(d)}),jn(t,a),Bt()}An(["pointerdown","click"]);var Fo=Fn('<div class="modal-backdrop svelte-1d3nq4t" aria-hidden="true"></div>');function qo(t,e){Tt(e,!0);const n=Fr(),i=le(()=>(Bi(),Ri())),r=le(()=>Dn(i).features.backdrop),o=le(()=>(Or(),Array.from(n.modals.values()).some(t=>t.isOpen&&!t.isMinimized&&!t.isHiddenWithParent))),s=le(()=>Dn(r)&&Dn(o)),a=le(()=>qi("MODAL")-1);to(t,{get target(){return Dn(i).portalTarget},children:(t,e)=>{var n=qn(),i=We(n),r=t=>{var e=Fo();let n;je(()=>n=ki(e,"",n,{"z-index":Dn(a)})),gi(3,e,()=>Po,()=>({duration:200})),jn(t,e)};ni(i,t=>{Dn(s)&&t(r)}),jn(t,n)},$$slots:{default:!0}}),Bt()}export{qo as B,Ho as D,zo as M,Qn as a,Li as b,ji as c,er as d,_r as e,yr as f,Ri as g,xr as h,Fi as i,Dr as j,Lr as k,kr as l,Gn as m,Fr as n,Ir as o,$r as p,Pr as q,mr as r,Ai as s,Ui as t,wr as u,Hr as v,qr as w,$o as x};
|
package/dist/styles/modal.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.modal-dialog{background:var(--modal-bg);border:1px solid var(--modal-border);border-radius:var(--modal-border-radius);width:calc(100% - 2rem);max-width:480px;max-height:80vh;box-shadow:var(--modal-shadow-lg);opacity:0;outline:none;flex-direction:column;transition:height .15s ease-out,background-color .2s,border-color .2s;display:flex;position:fixed;top:50%;left:50%;overflow:visible;transform:translate(-50%,-50%)}.modal-dialog.modal-positioned{opacity:1;transform:none}.modal-dialog.modal-centered{opacity:1}.modal-dialog.modal-awaiting-restore{pointer-events:none;opacity:0!important}.modal-dialog.modal-dragging{opacity:.9;user-select:none;transition:none}.modal-dialog.modal-resizing{user-select:none;transition:none}.modal-dialog.modal-animating-to-center{transition:left .2s ease-out,top .2s ease-out}.modal-dialog.modal-animating-position{transition:left var(--modal-parent-animation-duration)ease-out,top var(--modal-parent-animation-duration)ease-out}.modal-dialog.modal-solid{background:var(--modal-bg)}.modal-dialog.modal-transparent{background:var(--modal-bg-transparent);opacity:.4}.modal-dialog.modal-minimizing{pointer-events:none;animation:modal-genie-minimize var(--modal-animation-duration-minimize)ease-in forwards;transform-origin:var(--genie-origin-x,50%)var(--genie-origin-y,100%);will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-restoring{pointer-events:none;animation:modal-genie-restore var(--modal-animation-duration-restore)ease-out forwards;transform-origin:var(--genie-origin-x,50%)var(--genie-origin-y,100%);will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-opening{pointer-events:none;animation:modal-genie-restore var(--modal-animation-duration-open)ease-out forwards;transform-origin:var(--genie-origin-x,50%)var(--genie-origin-y,50%);will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-closing{pointer-events:none;animation:modal-close var(--modal-animation-duration-close)ease-in forwards;will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-closing:not(.modal-positioned){animation-name:modal-close-centered}.modal-dialog.modal-positioned.modal-minimizing,.modal-dialog.modal-positioned.modal-closing{transform:unset;opacity:unset}.modal-dialog.modal-positioned.modal-opening,.modal-dialog.modal-positioned.modal-restoring{transform:unset;opacity:1}.modal-dialog.modal-visible-by-animation{opacity:1}.modal-dialog.modal-attention{animation:.5s cubic-bezier(.36,.07,.19,.97) both modal-shake-positioned,.6s ease-out both modal-attention-glow}.modal-dialog.modal-attention:not(.modal-positioned){animation:.5s cubic-bezier(.36,.07,.19,.97) both modal-shake-centered,.6s ease-out both modal-attention-glow}.modal-dialog.modal-attention.modal-glow{--modal-attention-color:var(--modal-glow-color)}.modal-dialog.modal-glow{border-color:rgb(var(--modal-glow-color));animation:2s ease-in-out infinite modal-glow-medium}.modal-dialog.modal-glow.modal-glow-low{animation-name:modal-glow-low}.modal-dialog.modal-glow.modal-glow-high{animation-name:modal-glow-high}.modal-dialog.modal-glow.modal-minimizing{animation:modal-genie-minimize var(--modal-animation-duration-minimize)ease-in forwards}.modal-dialog.modal-glow.modal-restoring{animation:modal-genie-restore var(--modal-animation-duration-restore)ease-out forwards}.modal-dialog.modal-glow.modal-opening{animation:modal-genie-restore var(--modal-animation-duration-open)ease-out forwards}.modal-dialog.modal-glow.modal-closing{animation:modal-close var(--modal-animation-duration-close)ease-in forwards}.modal-header{padding:var(--modal-header-padding);border-bottom:1px solid var(--modal-header-border);z-index:101;outline:none;flex-shrink:0;align-items:center;gap:.75rem;display:flex;position:relative;overflow:visible}.modal-header.modal-header-draggable{cursor:grab;user-select:none;touch-action:none}.modal-header.modal-header-draggable:active{cursor:grabbing}.modal-header-traffic-lights{gap:var(--modal-btn-gap);z-index:100;flex-shrink:0;display:flex;position:relative}.modal-header-traffic-lights .modal-header-light{width:var(--modal-btn-size);height:var(--modal-btn-size);cursor:pointer;border:none;border-radius:50%;outline:none;flex-shrink:0;padding:0;transition:filter .15s,transform .1s;position:relative}.modal-header-traffic-lights .modal-header-light:before{content:"";opacity:0;justify-content:center;align-items:center;transition:opacity .15s;display:flex;position:absolute;inset:0}.modal-header-traffic-lights .modal-header-light:hover{transform:scale(1.1)}.modal-header-traffic-lights .modal-header-light:hover:before{opacity:1}.modal-header-traffic-lights .modal-header-light:focus-visible{box-shadow:0 0 0 2px #ffffff80,0 0 0 4px #0003}.modal-header-light-close{background:var(--modal-btn-close);box-shadow:inset 0 0 0 .5px #0000001f}.modal-header-light-close:hover{filter:brightness(.92)}.modal-header-traffic-lights .modal-header-light.modal-header-light-close:before{content:"×";color:#4a0002cc;font-size:11px;font-weight:600;line-height:13px}.modal-header-light-minimize{background:var(--modal-btn-minimize);box-shadow:inset 0 0 0 .5px #0000001f}.modal-header-light-minimize:hover{filter:brightness(.92)}.modal-header-traffic-lights .modal-header-light.modal-header-light-minimize:before{content:"−";color:#995700cc;font-size:13px;font-weight:600;line-height:12px}.modal-header-light-style{background:var(--modal-btn-style);box-shadow:inset 0 0 0 .5px #0000001f}.modal-header-light-style:hover{filter:brightness(.92)}.modal-header-traffic-lights .modal-header-light.modal-header-light-style:before{content:"◇";color:#006500cc;font-size:7px;line-height:13px}.modal-header-light.modal-header-light-disabled{opacity:.5;cursor:not-allowed;background:#ccc}.modal-header-light.modal-header-light-disabled:hover{filter:none}.modal-header-traffic-lights .modal-header-light.modal-header-light-disabled:before{opacity:.4}.modal-header-mac-center{pointer-events:none;justify-content:center;align-items:center;gap:.5rem;display:flex;position:absolute;left:0;right:0}.modal-header-mac-center .modal-header-title-group{flex:unset;pointer-events:auto}.modal-header-mac-center .modal-header-icon{pointer-events:auto}.modal-header-mac-spacer{display:none}.modal-header-title-group{flex:1;align-items:center;gap:.5rem;min-width:0;display:flex}.modal-header-title{font-size:var(--modal-title-size);color:var(--modal-title-color);white-space:nowrap;text-overflow:ellipsis;min-width:0;margin:0;overflow:hidden}.modal-header-icon{font-size:var(--modal-icon-size);width:var(--modal-icon-size);height:var(--modal-icon-size);flex-shrink:0;justify-content:center;align-items:center;display:inline-flex;position:relative}.modal-header-icon-badge{font-size:var(--modal-icon-badge-size);background:var(--modal-bg);border-radius:50%;padding:2px;line-height:1;position:absolute;bottom:-6px;right:-8px;box-shadow:0 1px 3px #0003}.modal-header-btn-windows{color:var(--modal-btn-windows-color);cursor:pointer;background:0 0;border:none;border-radius:4px;padding:.25rem;font-size:1.25rem;line-height:1;transition:background-color .15s,color .15s}.modal-header-btn-windows:hover{color:var(--modal-btn-windows-hover-color);background:var(--modal-btn-windows-hover-bg)}.modal-header-btn-windows-style{font-size:.9rem}.modal-header-btn-windows-close{padding:0;font-size:1.5rem}.modal-header-btn-windows.modal-header-btn-windows-disabled{opacity:.35;cursor:not-allowed}.modal-header-btn-windows.modal-header-btn-windows-disabled:hover{color:var(--modal-btn-windows-color);background:0 0}.modal-body{min-height:0;padding:var(--modal-content-padding);flex-direction:column;flex:auto;display:flex;position:relative;overflow-y:auto}.modal-body::-webkit-scrollbar{width:6px}.modal-body::-webkit-scrollbar-track{background:#0000000d}.modal-body::-webkit-scrollbar-thumb{background:#0003;border-radius:3px}.modal-footer{padding:var(--modal-footer-padding);border-top:1px solid var(--modal-footer-border);flex-shrink:0}.modal-resize-handle{z-index:10;touch-action:none;position:absolute}.modal-resize-n,.modal-resize-s{height:var(--modal-resize-handle-size);cursor:ns-resize;left:8px;right:8px}.modal-resize-n{top:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-s{bottom:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-e,.modal-resize-w{width:var(--modal-resize-handle-size);cursor:ew-resize;top:8px;bottom:8px}.modal-resize-e{right:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-w{left:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-ne,.modal-resize-nw,.modal-resize-se,.modal-resize-sw{width:var(--modal-resize-corner-size);height:var(--modal-resize-corner-size)}.modal-resize-ne{top:calc(var(--modal-resize-handle-size)/-2);right:calc(var(--modal-resize-handle-size)/-2);cursor:nesw-resize}.modal-resize-nw{top:calc(var(--modal-resize-handle-size)/-2);left:calc(var(--modal-resize-handle-size)/-2);cursor:nwse-resize}.modal-resize-se{bottom:calc(var(--modal-resize-handle-size)/-2);right:calc(var(--modal-resize-handle-size)/-2);cursor:nwse-resize}.modal-resize-sw{bottom:calc(var(--modal-resize-handle-size)/-2);left:calc(var(--modal-resize-handle-size)/-2);cursor:nesw-resize}.modal-child-overlay{background:var(--modal-child-overlay-bg);backdrop-filter:blur(var(--modal-child-overlay-blur));border-radius:inherit;z-index:100;cursor:not-allowed;pointer-events:all;animation:.2s ease-out forwards modal-overlay-fade-in;position:absolute;inset:0}.modal-child-overlay.modal-overlay-closing{pointer-events:none;animation:.2s ease-in forwards modal-overlay-fade-out}.modal-dialog.modal-has-child .modal-header-actions{pointer-events:none;opacity:.5}.modal-dialog.modal-has-child .modal-header-draggable{cursor:not-allowed}.modal-dialog.modal-is-child.modal-positioned:not(.modal-closing):not(.modal-minimizing):not(.modal-restoring){animation:.25s ease-out forwards modal-child-appear}.modal-dialog.modal-is-child.modal-closing{animation:.2s ease-in forwards modal-child-disappear}
|
|
1
|
+
.modal-dialog{background:var(--modal-bg);border:1px solid var(--modal-border);border-radius:var(--modal-border-radius);width:calc(100% - 2rem);max-width:480px;max-height:80vh;box-shadow:var(--modal-shadow-lg);opacity:0;outline:none;flex-direction:column;transition:height .15s ease-out,background-color .2s,border-color .2s;display:flex;position:fixed;top:50%;left:50%;overflow:visible;transform:translate(-50%,-50%)}.modal-dialog.modal-positioned{opacity:1;transform:none}.modal-dialog.modal-centered{opacity:1}.modal-dialog.modal-awaiting-restore{pointer-events:none;opacity:0!important}.modal-dialog.modal-dragging{opacity:.9;user-select:none;transition:none}.modal-dialog.modal-resizing{user-select:none;transition:none}.modal-dialog.modal-animating-to-center{transition:left .2s ease-out,top .2s ease-out}.modal-dialog.modal-animating-position{transition:left var(--modal-parent-animation-duration)ease-out,top var(--modal-parent-animation-duration)ease-out}.modal-dialog.modal-solid{background:var(--modal-bg)}.modal-dialog.modal-transparent{background:var(--modal-bg-transparent);opacity:.4}.modal-dialog.modal-minimizing{pointer-events:none;animation:modal-genie-minimize var(--modal-animation-duration-minimize)ease-in forwards;transform-origin:var(--genie-origin-x,50%)var(--genie-origin-y,100%);will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-restoring{pointer-events:none;animation:modal-genie-restore var(--modal-animation-duration-restore)ease-out forwards;transform-origin:var(--genie-origin-x,50%)var(--genie-origin-y,100%);will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-opening{pointer-events:none;animation:modal-genie-restore var(--modal-animation-duration-open)ease-out forwards;transform-origin:var(--genie-origin-x,50%)var(--genie-origin-y,50%);will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-closing{pointer-events:none;animation:modal-close var(--modal-animation-duration-close)ease-in forwards;will-change:transform,opacity;backface-visibility:hidden}.modal-dialog.modal-closing:not(.modal-positioned){animation-name:modal-close-centered}.modal-dialog.modal-positioned.modal-minimizing,.modal-dialog.modal-positioned.modal-closing{transform:unset;opacity:unset}.modal-dialog.modal-positioned.modal-opening,.modal-dialog.modal-positioned.modal-restoring{transform:unset;opacity:1}.modal-dialog.modal-visible-by-animation{opacity:1}.modal-dialog.modal-attention{animation:.5s cubic-bezier(.36,.07,.19,.97) both modal-shake-positioned,.6s ease-out both modal-attention-glow}.modal-dialog.modal-attention:not(.modal-positioned){animation:.5s cubic-bezier(.36,.07,.19,.97) both modal-shake-centered,.6s ease-out both modal-attention-glow}.modal-dialog.modal-attention.modal-glow{--modal-attention-color:var(--modal-glow-color)}.modal-dialog.modal-glow{border-color:rgb(var(--modal-glow-color));animation:2s ease-in-out infinite modal-glow-medium}.modal-dialog.modal-glow.modal-glow-low{animation-name:modal-glow-low}.modal-dialog.modal-glow.modal-glow-high{animation-name:modal-glow-high}.modal-dialog.modal-glow.modal-minimizing{animation:modal-genie-minimize var(--modal-animation-duration-minimize)ease-in forwards}.modal-dialog.modal-glow.modal-restoring{animation:modal-genie-restore var(--modal-animation-duration-restore)ease-out forwards}.modal-dialog.modal-glow.modal-opening{animation:modal-genie-restore var(--modal-animation-duration-open)ease-out forwards}.modal-dialog.modal-glow.modal-closing{animation:modal-close var(--modal-animation-duration-close)ease-in forwards}.modal-header{padding:var(--modal-header-padding);border-bottom:1px solid var(--modal-header-border);outline:none;flex-shrink:0;align-items:center;gap:.75rem;display:flex;position:relative;overflow:visible}.modal-header.modal-header-draggable{cursor:grab;user-select:none;touch-action:none}.modal-header.modal-header-draggable:active{cursor:grabbing}.modal-header-traffic-lights{gap:var(--modal-btn-gap);z-index:100;flex-shrink:0;display:flex;position:relative}.modal-header-traffic-lights .modal-header-light{width:var(--modal-btn-size);height:var(--modal-btn-size);cursor:pointer;border:none;border-radius:50%;outline:none;flex-shrink:0;padding:0;transition:filter .15s,transform .1s;position:relative}.modal-header-traffic-lights .modal-header-light:before{content:"";opacity:0;justify-content:center;align-items:center;transition:opacity .15s;display:flex;position:absolute;inset:0}.modal-header-traffic-lights .modal-header-light:hover{transform:scale(1.1)}.modal-header-traffic-lights .modal-header-light:hover:before{opacity:1}.modal-header-traffic-lights .modal-header-light:focus-visible{box-shadow:0 0 0 2px #ffffff80,0 0 0 4px #0003}.modal-header-light-close{background:var(--modal-btn-close);box-shadow:inset 0 0 0 .5px #0000001f}.modal-header-light-close:hover{filter:brightness(.92)}.modal-header-traffic-lights .modal-header-light.modal-header-light-close:before{content:"×";color:#4a0002cc;font-size:11px;font-weight:600;line-height:13px}.modal-header-light-minimize{background:var(--modal-btn-minimize);box-shadow:inset 0 0 0 .5px #0000001f}.modal-header-light-minimize:hover{filter:brightness(.92)}.modal-header-traffic-lights .modal-header-light.modal-header-light-minimize:before{content:"−";color:#995700cc;font-size:13px;font-weight:600;line-height:12px}.modal-header-light-style{background:var(--modal-btn-style);box-shadow:inset 0 0 0 .5px #0000001f}.modal-header-light-style:hover{filter:brightness(.92)}.modal-header-traffic-lights .modal-header-light.modal-header-light-style:before{content:"◇";color:#006500cc;font-size:7px;line-height:13px}.modal-header-light.modal-header-light-disabled{opacity:.5;cursor:not-allowed;background:#ccc}.modal-header-light.modal-header-light-disabled:hover{filter:none}.modal-header-traffic-lights .modal-header-light.modal-header-light-disabled:before{opacity:.4}.modal-header-mac-center{pointer-events:none;justify-content:center;align-items:center;gap:.5rem;display:flex;position:absolute;left:0;right:0}.modal-header-mac-center .modal-header-title-group{flex:unset;pointer-events:auto}.modal-header-mac-center .modal-header-icon{pointer-events:auto}.modal-header-mac-spacer{display:none}.modal-header-title-group{flex:1;align-items:center;gap:.5rem;min-width:0;display:flex}.modal-header-title{font-size:var(--modal-title-size);color:var(--modal-title-color);white-space:nowrap;text-overflow:ellipsis;min-width:0;margin:0;overflow:hidden}.modal-header-icon{font-size:var(--modal-icon-size);width:var(--modal-icon-size);height:var(--modal-icon-size);flex-shrink:0;justify-content:center;align-items:center;display:inline-flex;position:relative}.modal-header-icon-badge{font-size:var(--modal-icon-badge-size);background:var(--modal-bg);border-radius:50%;padding:2px;line-height:1;position:absolute;bottom:-6px;right:-8px;box-shadow:0 1px 3px #0003}.modal-header-btn-windows{color:var(--modal-btn-windows-color);cursor:pointer;background:0 0;border:none;border-radius:4px;padding:.25rem;font-size:1.25rem;line-height:1;transition:background-color .15s,color .15s}.modal-header-btn-windows:hover{color:var(--modal-btn-windows-hover-color);background:var(--modal-btn-windows-hover-bg)}.modal-header-btn-windows-style{font-size:.9rem}.modal-header-btn-windows-close{padding:0;font-size:1.5rem}.modal-header-btn-windows.modal-header-btn-windows-disabled{opacity:.35;cursor:not-allowed}.modal-header-btn-windows.modal-header-btn-windows-disabled:hover{color:var(--modal-btn-windows-color);background:0 0}.modal-body{min-height:0;padding:var(--modal-content-padding);color:var(--modal-content-color);flex-direction:column;flex:auto;display:flex;position:relative;overflow-y:auto}.modal-body::-webkit-scrollbar{width:6px}.modal-body::-webkit-scrollbar-track{background:#0000000d}.modal-body::-webkit-scrollbar-thumb{background:#0003;border-radius:3px}.modal-footer{padding:var(--modal-footer-padding);border-top:1px solid var(--modal-footer-border);flex-shrink:0}.modal-footer-empty:empty{display:none}.modal-resize-handle{z-index:10;touch-action:none;position:absolute}.modal-resize-n,.modal-resize-s{height:var(--modal-resize-handle-size);cursor:ns-resize;left:8px;right:8px}.modal-resize-n{top:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-s{bottom:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-e,.modal-resize-w{width:var(--modal-resize-handle-size);cursor:ew-resize;top:8px;bottom:8px}.modal-resize-e{right:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-w{left:calc(var(--modal-resize-handle-size)/-2)}.modal-resize-ne,.modal-resize-nw,.modal-resize-se,.modal-resize-sw{width:var(--modal-resize-corner-size);height:var(--modal-resize-corner-size)}.modal-resize-ne{top:calc(var(--modal-resize-handle-size)/-2);right:calc(var(--modal-resize-handle-size)/-2);cursor:nesw-resize}.modal-resize-nw{top:calc(var(--modal-resize-handle-size)/-2);left:calc(var(--modal-resize-handle-size)/-2);cursor:nwse-resize}.modal-resize-se{bottom:calc(var(--modal-resize-handle-size)/-2);right:calc(var(--modal-resize-handle-size)/-2);cursor:nwse-resize}.modal-resize-sw{bottom:calc(var(--modal-resize-handle-size)/-2);left:calc(var(--modal-resize-handle-size)/-2);cursor:nesw-resize}.modal-child-overlay{background:var(--modal-child-overlay-bg);backdrop-filter:blur(var(--modal-child-overlay-blur));border-radius:inherit;z-index:100;cursor:not-allowed;pointer-events:all;animation:.2s ease-out forwards modal-overlay-fade-in;position:absolute;inset:0}.modal-child-overlay.modal-overlay-closing{pointer-events:none;animation:.2s ease-in forwards modal-overlay-fade-out}.modal-dialog.modal-has-child .modal-header-actions{pointer-events:none;opacity:.5}.modal-dialog.modal-has-child .modal-header-draggable{cursor:not-allowed}.modal-dialog.modal-is-child.modal-positioned:not(.modal-closing):not(.modal-minimizing):not(.modal-restoring){animation:.25s ease-out forwards modal-child-appear}.modal-dialog.modal-is-child.modal-closing{animation:.2s ease-in forwards modal-child-disappear}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--modal-bg
|
|
1
|
+
:root{--modal-bg:linear-gradient(165deg,#fff 0%,#fafbfc 50%,#f5f7f9 100%);--modal-bg-transparent:#ffffffeb;--modal-border:#0000001f;--modal-title-color:#0f172a;--modal-content-color:#334155;--modal-header-border:#0000000f;--modal-footer-border:#0000000f;--modal-shadow:0 0 0 1px #0000000a,0 4px 6px -1px #00000014,0 10px 20px -5px #0000001a,0 25px 50px -12px #00000026;--modal-shadow-lg:0 0 0 1px #00000008,0 8px 16px -4px #0000001a,0 20px 40px -8px #0000001f,0 40px 80px -16px #00000014;--modal-dock-bg:linear-gradient(180deg,#fffffff2 0%,#f8fafceb 100%);--modal-dock-border:#00000014;--modal-dock-shadow:0 -1px 0 0 #fffc,0 4px 12px -2px #0000001f,0 8px 24px -4px #00000014;--modal-dock-label-color:#475569;--modal-dock-item-bg:linear-gradient(145deg,#fffc,#f1f5f999);--modal-dock-item-border:#0000000f;--modal-dock-item-shadow:0 1px 3px #0000000f,inset 0 1px 0 #fffc;--modal-dock-item-hover-bg:linear-gradient(145deg,#fff,#f1f5f9);--modal-dock-item-hover-border:#0000001f;--modal-dock-item-hover-shadow:0 4px 12px #0000001a,0 2px 4px #0000000f,inset 0 1px 0 #fff;--modal-dock-handle-bg:linear-gradient(145deg,#fff9,#f1f5f966);--modal-dock-handle-border:#0000000f;--modal-dock-handle-dots:#00000040;--modal-btn-windows-color:#64748b;--modal-btn-windows-hover-bg:#0000000f;--modal-btn-windows-hover-color:#0f172a;--modal-attention-color:251,146,60;--modal-backdrop-bg:#0f172a33;--modal-backdrop-blur:4px;--modal-child-overlay-bg:#fff9;--modal-child-overlay-blur:2px}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--modal-bg
|
|
1
|
+
:root{--modal-bg:linear-gradient(165deg,#fff 0%,#fafbfc 50%,#f5f7f9 100%);--modal-bg-transparent:#ffffffeb;--modal-border:#0000001f;--modal-border-radius:12px;--modal-shadow:0 0 0 1px #0000000a,0 4px 6px -1px #00000014,0 10px 20px -5px #0000001a,0 25px 50px -12px #00000026;--modal-shadow-lg:0 0 0 1px #00000008,0 8px 16px -4px #0000001a,0 20px 40px -8px #0000001f,0 40px 80px -16px #00000014;--modal-header-bg:transparent;--modal-header-border:#00000014;--modal-header-height:48px;--modal-header-padding:.875rem 1.25rem;--modal-title-color:#0f172a;--modal-title-size:1rem;--modal-btn-close:#ff5f57;--modal-btn-minimize:#febc2e;--modal-btn-style:#28c840;--modal-btn-size:13px;--modal-btn-gap:7px;--modal-btn-windows-color:#666;--modal-btn-windows-hover-bg:#0000000d;--modal-btn-windows-hover-color:#1a1a1a;--modal-content-padding:0;--modal-content-color:#334155;--modal-footer-bg:transparent;--modal-footer-border:#00000014;--modal-footer-padding:1rem 1.25rem;--modal-backdrop-bg:#0000004d;--modal-backdrop-blur:2px;--modal-dock-bg:linear-gradient(180deg,#fffffff2 0%,#f8fafceb 100%);--modal-dock-border:#00000014;--modal-dock-shadow:0 -1px 0 0 #fffc,0 4px 12px -2px #0000001f,0 8px 24px -4px #00000014;--modal-dock-padding:.5rem .625rem;--modal-dock-gap:.5rem;--modal-dock-border-radius:14px;--modal-dock-item-size:44px;--modal-dock-item-bg:linear-gradient(145deg,#fffc,#f1f5f999);--modal-dock-item-border:#0000000f;--modal-dock-item-shadow:0 1px 3px #0000000f,inset 0 1px 0 #fffc;--modal-dock-item-hover-bg:linear-gradient(145deg,#fff,#f1f5f9);--modal-dock-item-hover-border:#0000001f;--modal-dock-item-hover-shadow:0 4px 12px #0000001a,0 2px 4px #0000000f,inset 0 1px 0 #fff;--modal-dock-item-border-radius:10px;--modal-dock-label-color:#475569;--modal-dock-label-size:.65rem;--modal-dock-handle-bg:linear-gradient(145deg,#fff9,#f1f5f966);--modal-dock-handle-border:#0000000f;--modal-dock-handle-dots:#00000040;--modal-animation-duration-open:.4s;--modal-animation-duration-close:.25s;--modal-animation-duration-minimize:.5s;--modal-animation-duration-restore:.4s;--modal-animation-easing:cubic-bezier(.4,0,.2,1);--modal-parent-animation-duration:.3s;--modal-resize-handle-size:12px;--modal-resize-corner-size:20px;--modal-glow-color:126,200,191;--modal-attention-color:255,180,100;--modal-attention-duration:.6s;--modal-child-overlay-bg:#00000040;--modal-child-overlay-blur:1px;--modal-icon-size:1.5rem;--modal-icon-badge-size:.85rem}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte action to append an external DOM element
|
|
3
|
+
* Used by React bridge to inject React-rendered content
|
|
4
|
+
*/
|
|
5
|
+
export declare function appendElement(node: HTMLElement, element: HTMLElement | null | undefined): {
|
|
6
|
+
update(newElement: HTMLElement | null | undefined): void;
|
|
7
|
+
destroy(): void;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=appendElement.d.ts.map
|
|
@@ -13,7 +13,7 @@ export interface UseModalZIndexReturn {
|
|
|
13
13
|
* @example
|
|
14
14
|
* ```svelte
|
|
15
15
|
* <script lang="ts">
|
|
16
|
-
* import { useModalZIndex, Portal } from '
|
|
16
|
+
* import { useModalZIndex, Portal } from 'epic-modals/svelte';
|
|
17
17
|
*
|
|
18
18
|
* // Automatically uses parent modal's ID from context
|
|
19
19
|
* const { zIndex, portalTarget } = useModalZIndex();
|
package/dist/svelte.d.ts
CHANGED
package/dist/svelte.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"svelte/internal/client";import"svelte/internal/disclose-version";import{getContext as t,onMount as n,setContext as i,tick as o,onDestroy as r,untrack as s}from"svelte";import{scale as d,fly as a,fade as l}from"svelte/transition";import{cubicOut as c,backOut as g}from"svelte/easing";const u={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};let h=e.state(e.proxy(u.MODAL));function p(){e.set(h,ft().zIndex.base,!0)}function f(){const t=e.get(h);return e.set(h,e.get(h)+2),t}function m(e){const t=ft();return"MODAL"===e?t.zIndex.base:"DOCK"===e?t.zIndex.dock:"TOAST"===e?t.zIndex.toast:u[e]}function v(){e.set(h,ft().zIndex.base,!0)}const w=8;function y(e,t,n,i,o={}){const{margin:r=w,allowPartialVisibility:s=!1}=o,d="undefined"!=typeof window?window.innerWidth:1920,a="undefined"!=typeof window?window.innerHeight:1080;let l,c,g,u;return s&&n>d-2*r?(l=40-n,c=d-40):(l=r,c=Math.max(r,d-n-r)),s&&i>a-2*r?(g=40-i,u=a-40):(g=r,u=Math.max(r,a-i-r)),{x:Math.max(l,Math.min(c,e)),y:Math.max(g,Math.min(u,t))}}function x(e,t,n,i,o={}){const{margin:r=w}=o,s=("undefined"!=typeof window?window.innerWidth:1920)-2*r,d=("undefined"!=typeof window?window.innerHeight:1080)-2*r,a=Math.min(n,s),l=Math.min(i,d),c=y(e,t,a,l,o);return{x:c.x,y:c.y,width:a,height:l}}function z(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function I(e,t,n,i,o,r){const s={x:e-r,y:t-r,width:n+2*r,height:i+2*r};let d=0;for(const e of o)d+=z(s,e);return d}function b(e){if("undefined"==typeof document)return[];const t=[];for(const n of e)try{const e=document.querySelectorAll(n);for(const n of e){const e=n.getBoundingClientRect();e.width>0&&e.height>0&&t.push({x:e.left,y:e.top,width:e.width,height:e.height})}}catch{}return t}function _(e,t,n,i,o,r,s){const d=(o-n)/2,a=(r-i)/2,l=d-s,c=a-s,g=Math.abs(e-d)/(l||1),u=Math.abs(t-a)/(c||1),h=Math.sqrt(g*g+u*u)/Math.SQRT2,p=50,f=e-s,m=o-n-s-e,v=t-s,w=r-i-s-t;let y=0;return f<p&&(y+=.3*(1-f/p)),m<p&&(y+=.3*(1-m/p)),v<p&&(y+=.2*(1-v/p)),w<p&&(y+=.2*(1-w/p)),Math.min(1,h+y)}function M(e,t,n,i={}){const{modalGap:o=16,gridResolution:r=10,avoidBounds:s=[],avoidMargin:d=16}=i,a=i.margin??o,l="undefined"!=typeof window?window.innerWidth:1920,c="undefined"!=typeof window?window.innerHeight:1080,g=s.map(e=>({x:e.x-d,y:e.y-d,width:e.width+2*d,height:e.height+2*d})),u={x:(l-e)/2,y:(c-t)/2};if(0===n.length&&0===g.length)return u;const h=a,p=Math.max(a,l-e-a),f=a,m=Math.max(a,c-t-a);if(p<=h||m<=f)return u;const v=I(u.x,u.y,e,t,n,o),w=I(u.x,u.y,e,t,g,0);if(0===v&&0===w)return u;const y=[],x=(p-h)/r,z=(m-f)/r;for(let i=0;i<=r;i++)for(let s=0;s<=r;s++){const r=h+i*x,d=f+s*z,u=I(r,d,e,t,n,o),p=I(r,d,e,t,g,0),m=_(r,d,e,t,l,c,a);y.push({pos:{x:r,y:d},modalOverlap:u,avoidOverlap:p,centerDist:m})}const b=y.filter(e=>0===e.avoidOverlap),M=b.length>0?b:y,k=e*t,D=Math.min(...M.map(e=>e.modalOverlap))/k;return M.sort((e,t)=>{if(0===b.length&&e.avoidOverlap!==t.avoidOverlap)return e.avoidOverlap-t.avoidOverlap;const n=e.modalOverlap/k,i=t.modalOverlap/k;if(D<.3){const o=.3,r=n<=o,s=i<=o;if(r&&s)return e.centerDist+.3*n-(t.centerDist+.3*i);if(r)return-1;if(s)return 1}return.6*n+.4*e.centerDist-(.6*i+.4*t.centerDist)}),M[0].pos}function k(e,t,n,i={}){const{modalGap:o=16}=i,r=i.margin??o,s="undefined"!=typeof window?window.innerWidth:1920,d="undefined"!=typeof window?window.innerHeight:1080,a=n.reduce((e,t)=>e+t.width,0)+e,l=n.length*o,c=s-2*r;if(a+l>c)return null;const g=c-a-l;n.length;const u=g/2,h=s/2,p=[...n.map(e=>({id:e.id,width:e.width,height:e.height,currentX:e.x+e.width/2,currentY:e.y,isNew:!1})),{id:"__new__",width:e,height:t,currentX:h,currentY:(d-t)/2,isNew:!0}];p.sort((e,t)=>e.currentX-t.currentX);let f=r+u;const m=new Map;let v=null;for(const e of p){const t=f;if(e.isNew)v={x:Math.round(t),y:Math.round(e.currentY)};else{const i=n.find(t=>t.id===e.id);Math.abs(t-i.x)>5&&m.set(e.id,{x:Math.round(t),y:Math.round(i.y)})}f+=e.width+o}return v?{newModalPosition:v,existingModalMoves:m}:null}let D=e.proxy(new Map),P=e.state(0);const C=new Set;function B(){e.update(P),queueMicrotask(()=>{C.forEach(e=>e())})}function O(e){return C.add(e),()=>C.delete(e)}let T=e.state(e.proxy([])),R=e.state(e.proxy([])),E=e.state(e.proxy([])),S=e.state(e.proxy([])),H=e.state(e.proxy([])),F=e.state(e.proxy([])),L=e.state(e.proxy([])),W=e.state(e.proxy([])),A=e.state(null),$=e.proxy(new Map),X=e.state(null),Y=e.proxy(new Map),q=e.proxy(new Set),N=e.proxy(new Set),j=e.state(e.proxy([])),G=null,K=null;function V(t){const n=D.get(t.id),i=(null==n?void 0:n.zIndex)??f();n?D.set(t.id,{...n,title:t.title,icon:t.icon,glow:t.glow,zIndex:i}):D.set(t.id,{...t,zIndex:i,isAnimating:!1}),B(),t.isMinimized&&!e.get(j).includes(t.id)&&e.get(j).push(t.id)}function U(t){const n=D.get(t);if(n){if(e.set(j,e.get(j).filter(e=>e!==t),!0),n.childId){const e=D.get(n.childId);e&&D.set(n.childId,{...e,parentId:void 0})}if(n.parentId){const e=D.get(n.parentId);e&&D.set(n.parentId,{...e,childId:void 0,lastChildId:n.id})}D.delete(t),B(),N.delete(t),q.delete(t)}}function Q(t){const n=D.get(t);if(!n||n.isMinimized)return;if(it(t),n.parentId){const e=D.get(n.parentId);if(e&&!e.isMinimized)return void Q(n.parentId)}if(e.set(T,[...e.get(T),t],!0),n.position&&n.size&&K){const i=K(),o=e.get(j).indexOf(t),r=i.x+o*(i.height+8),s=i.y;e.set(A,{x:r,y:s,originX:n.position.x+n.size.width/2,originY:n.position.y+n.size.height/2},!0)}const i=n.childId;D.set(t,{...n,isMinimized:!0,lastChildId:i}),B(),e.get(j).includes(t)||e.get(j).push(t),n.childId&&fe(t)}function Z(t){const n=D.get(t);if(!n||!n.isMinimized)return;D.set(t,{...n,isMinimized:!1,isOpen:!0}),B(),e.set(H,[...e.get(H),t],!0),oe(t);const i=n.lastChildId||n.childId;i&&ee(i)}function J(){Array.from(D.values()).filter(e=>e.isMinimized).map(e=>e.id).forEach(t=>{const n=D.get(t);if(n){D.set(t,{...n,isMinimized:!1,isOpen:!0}),e.set(H,[...e.get(H),t],!0),oe(t);const i=n.lastChildId||n.childId;i&&ee(i)}}),e.set(j,[],!0),B()}function ee(t){const n=D.get(t);n&&n.isHiddenWithParent&&(D.set(t,{...n,isHiddenWithParent:!1}),B(),e.set(F,[...e.get(F),t],!0))}function te(e,t,n){const i=D.get(e);if(!i)return;let o=t;if((null==n?void 0:n.constrain)&&i.size&&(o=y(t.x,t.y,i.size.width,i.size.height)),D.set(e,{...i,position:o,size:(null==n?void 0:n.size)??i.size,hasBeenDragged:i.hasBeenDragged||(null==n?void 0:n.drag)||!1}),i.childId){let t=e,n=o;for(;;){const e=D.get(t);if(!(null==e?void 0:e.childId))break;const i=D.get(e.childId);if(!(null==i?void 0:i.offsetFromParent))break;const o={x:n.x+i.offsetFromParent.x,y:n.y+i.offsetFromParent.y};D.set(e.childId,{...i,position:o,hasBeenDragged:!0}),t=e.childId,n=o}}if(i.parentId&&i.offsetFromParent){const t=ft();let n=e,r=i;for(;r.parentId&&r.offsetFromParent;){const i=D.get(r.parentId);if(!i)break;const s=n===e?o:D.get(n).position,d={x:s.x-r.offsetFromParent.x,y:s.y-r.offsetFromParent.y};"animated"===t.parentChild.movementMode?Y.set(r.parentId,d):D.set(r.parentId,{...i,position:d,hasBeenDragged:!0}),n=r.parentId,r=i}}B()}function ne(e,t){const n=D.get(e);n&&(D.set(e,{...n,size:t}),B())}function ie(e,t){const n=D.get(e);n&&(D.set(e,{...n,...t}),B())}function oe(e){var t;const n=D.get(e);if(!n)return;const i=Math.max(...Array.from(D.values()).map(e=>e.zIndex),0);if(n.parentId){const o=D.get(n.parentId);o&&o.zIndex<i&&D.set(n.parentId,{...o,zIndex:i+2});const r=(null==(t=D.get(n.parentId))?void 0:t.zIndex)??i+2;return n.zIndex<=r&&D.set(e,{...n,zIndex:r+2}),void B()}if(n.zIndex<i&&(D.set(e,{...n,zIndex:i+2}),B()),n.childId){const t=D.get(n.childId),i=D.get(e);t&&i&&t.zIndex<=i.zIndex&&(D.set(n.childId,{...t,zIndex:i.zIndex+2}),B())}}function re(e){const t=D.get(e);if(!t)return!1;const n=Math.max(...Array.from(D.values()).map(e=>e.zIndex),0);return t.zIndex===n&&!t.isMinimized&&!t.isHiddenWithParent}function se(t){e.set(j,t,!0)}function de(t,n,i){const o=n.getBoundingClientRect();$.set(t,{x:o.left+o.width/2,y:o.top+o.height/2});const r=ft();(null==i?void 0:i.parentId)&&r.features.parentChild&&e.set(X,{parentId:i.parentId,childId:t},!0),e.get(R).includes(t)||e.set(R,[...e.get(R),t],!0),B();const s=D.get(t);if(s){if(s.isOpen&&!s.isMinimized&&!s.isHiddenWithParent)return e.set(R,e.get(R).filter(e=>e!==t),!0),We(t),void oe(t);if(s.isMinimized)return e.set(R,e.get(R).filter(e=>e!==t),!0),void Z(t);D.set(t,{...s,isOpen:!0}),oe(t),null==G||G.push(t)}}function ae(t){V(t);const n=D.get(t.id);n&&(D.set(t.id,{...n,isOpen:!0}),B()),e.set(R,[...e.get(R),t.id],!0),B(),oe(t.id),null==G||G.push(t.id)}function le(t,n=!1){const i=D.get(t);i&&(it(t),n?e.set(S,[...e.get(S),t],!0):e.set(E,[...e.get(E),t],!0),B(),i.childId&&le(i.childId,n),null==G||G.pop())}function ce(){Array.from(D.keys()).forEach(e=>le(e,!0))}function ge(e){const t=D.get(e);if(t){if(t.parentId){const n=D.get(t.parentId);n&&n.childId===e&&D.set(t.parentId,{...n,childId:void 0,lastChildId:e})}D.set(e,{...t,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),B()}}function ue(e){const t=D.get(e);if(!t)return[e];const n=[e];return t.childId&&n.push(...ue(t.childId)),n}function he(t,n,i){const o=ft();if(i&&!$.has(t.id)){const e=i.getBoundingClientRect();$.set(t.id,{x:e.left+e.width/2,y:e.top+e.height/2})}const r={id:t.id,title:t.title??"",icon:t.icon??"",isOpen:!0,isMinimized:!1,isHiddenWithParent:!1,isTransparent:t.isTransparent??!1,isRejected:!1,position:t.position??null,size:t.size??null,hasBeenDragged:t.hasBeenDragged??!1,dockPosition:t.dockPosition??-1,glow:t.glow??null};if(!o.features.parentChild){V(r);const n=D.get(t.id);return n&&D.set(t.id,{...n,isOpen:!0}),e.set(R,[...e.get(R),t.id],!0),B(),void oe(t.id)}const s=D.get(n);if(!s)return;s.childId&&le(s.childId,!0),V({...r,parentId:n});const d=D.get(t.id);d&&D.set(t.id,{...d,isOpen:!0,parentId:n}),e.set(R,[...e.get(R),t.id],!0),B(),oe(t.id),e.set(X,{parentId:n,childId:t.id},!0)}function pe(e,t){if(!ft().features.parentChild)return;const n=D.get(e),i=D.get(t);if(!n||!i)return;let o={x:40,y:40};n.position&&i.position&&(o={x:i.position.x-n.position.x,y:i.position.y-n.position.y});const r=Math.max(i.zIndex,n.zIndex+1);D.set(e,{...n,childId:t,lastChildId:t}),D.set(t,{...i,parentId:e,offsetFromParent:o,zIndex:r}),B()}function fe(e){const t=D.get(e);if(!(null==t?void 0:t.childId))return;const n=D.get(t.childId);n&&(D.set(t.childId,{...n,isHiddenWithParent:!0}),B())}function me(e,t){const n=D.get(e);if(!(null==n?void 0:n.childId))return;const i=D.get(n.childId);if(!i||!i.offsetFromParent)return;const o={x:t.x+i.offsetFromParent.x,y:t.y+i.offsetFromParent.y};D.set(n.childId,{...i,position:o}),B()}function ve(e,t){const n=D.get(e),i=D.get(t);if(!(null==n?void 0:n.position)||!(null==i?void 0:i.position))return;const o={x:n.position.x-i.position.x,y:n.position.y-i.position.y};D.set(e,{...n,offsetFromParent:o}),B()}function we(t){return e.get(T).includes(t)}function ye(t){return!!e.get(T).includes(t)&&(e.set(T,e.get(T).filter(e=>e!==t),!0),!0)}function xe(){return e.get(T).length>0}function ze(){return Array.from(D.keys())}function Ie(e){return D.get(e)}function be(e){const t=[];for(const[n,i]of D.entries())if(n!==e&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent&&!i.parentId)if(i.position&&i.size)t.push({id:String(n),x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const e=document.querySelector(`[data-modal-id="${String(n)}"]`);if(e){const i=e.getBoundingClientRect();t.push({id:String(n),x:i.left,y:i.top,width:i.width,height:i.height})}}return t}function _e(e){const t=[];for(const[n,i]of D.entries())if(n!==e&&i.isOpen&&!i.isMinimized&&!i.isHiddenWithParent)if(i.position&&i.size)t.push({x:i.position.x,y:i.position.y,width:i.size.width,height:i.size.height});else{const e=document.querySelector(`[data-modal-id="${String(n)}"]`);if(e){const n=e.getBoundingClientRect();t.push({x:n.left,y:n.top,width:n.width,height:n.height})}}return t}function Me(){return e.get(P)}function ke(){const t=e.get(A);return e.set(A,null),t}function De(t){return e.get(R).includes(t)}function Pe(t){return!!e.get(R).includes(t)&&(e.set(R,e.get(R).filter(e=>e!==t),!0),!0)}function Ce(t){return e.get(E).includes(t)}function Be(t){return!!e.get(E).includes(t)&&(e.set(E,e.get(E).filter(e=>e!==t),!0),!0)}function Oe(t){return e.get(S).includes(t)}function Te(t){return!!e.get(S).includes(t)&&(e.set(S,e.get(S).filter(e=>e!==t),!0),!0)}function Re(t){return e.get(H).includes(t)}function Ee(t){return!!e.get(H).includes(t)&&(e.set(H,e.get(H).filter(e=>e!==t),!0),!0)}function Se(t){return e.get(F).includes(t)}function He(t){return!!e.get(F).includes(t)&&(e.set(F,e.get(F).filter(e=>e!==t),!0),!0)}function Fe(t){return e.get(L).includes(t)}function Le(t){return!!e.get(L).includes(t)&&(e.set(L,e.get(L).filter(e=>e!==t),!0),!0)}function We(t){D.get(t)&&(e.get(L).includes(t)||e.get(W).includes(t)||(e.set(L,[...e.get(L),t],!0),B()))}function Ae(t){e.get(W).includes(t)||e.set(W,[...e.get(W),t],!0)}function $e(t){e.set(W,e.get(W).filter(e=>e!==t),!0)}function Xe(){return e.get(X)}function Ye(t){if(!e.get(X)||e.get(X).childId!==t)return null;const n=e.get(X);return e.set(X,null),n}function qe(e,t){$.set(e,t)}function Ne(e){const t=$.get(e);return t&&$.delete(e),t??null}function je(e,t){t?q.add(e):q.delete(e)}function Ge(e){return q.has(e)}function Ke(e){const t=D.get(e);return void 0!==t&&t.isOpen&&!t.isMinimized&&!t.isHiddenWithParent}function Ve(e){return D.has(e)}function Ue(){return{get modals(){return D},get pendingMinimize(){return e.get(T)},get pendingOpen(){return e.get(R)},get pendingClose(){return e.get(E)},get pendingRestore(){return e.get(H)},get dockOrder(){return e.get(j)}}}function Qe(e){N.has(e)?N.delete(e):N.add(e);const t=D.get(e);t&&(D.set(e,{...t,isTransparent:N.has(e)}),B())}function Ze(e){N.delete(e);const t=D.get(e);t&&(D.set(e,{...t,isTransparent:!1}),B())}function Je(e){e.animate([{transform:"translateX(0)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(0)"}],{duration:300,easing:"ease-in-out"})}function et(e){const t=Y.get(e);if(!t)return;const n=D.get(e);n&&(D.set(e,{...n,isAnimatingPosition:!0,position:t}),Y.delete(e),B())}function tt(e){const t=D.get(e);t&&(D.set(e,{...t,isAnimatingPosition:!1}),B())}function nt(e){return Y.has(e)}function it(e){Y.delete(e)}function ot(e){const t=ft().parentChild.animationDuration;for(const[t,n]of e){const e=D.get(t);e&&D.set(t,{...e,position:n,isAnimatingPosition:!0,hasBeenDragged:!0})}B(),setTimeout(()=>{for(const t of e.keys()){const e=D.get(t);e&&D.set(t,{...e,isAnimatingPosition:!1})}B()},t)}function rt(e){const t=ft();if("animated"!==t.parentChild.movementMode)return;const n=t.parentChild.animationDuration,i=[];let o=e;for(;;){const e=D.get(o);if(!(null==e?void 0:e.parentId))break;i.push({parentId:e.parentId,childId:o}),o=e.parentId}i.forEach(({parentId:e,childId:t},i)=>{setTimeout(()=>{const i=D.get(t),o=D.get(e);if(!(null==i?void 0:i.position)||!i.offsetFromParent||!o)return;const r={x:i.position.x-i.offsetFromParent.x,y:i.position.y-i.offsetFromParent.y};Y.set(e,r),et(e),setTimeout(()=>tt(e),n)},i*n)})}function st(e){}function dt(e){G=e}function at(e){K=e}function lt(){return{modals:D,pendingMinimize:e.get(T),pendingOpen:e.get(R),pendingClose:e.get(E),pendingRestore:e.get(H),dockOrder:e.get(j),animatingModals:q,transparentModals:N}}function ct(){D.clear(),e.get(T).length=0,e.get(R).length=0,e.get(E).length=0,e.get(S).length=0,e.get(H).length=0,e.get(F).length=0,e.set(A,null),$.clear(),e.set(X,null),Y.clear(),q.clear(),N.clear(),e.get(j).length=0,G=null,K=null}const gt={features:{dock:!0,minimize:!0,transparency:!0,resize:!0,drag:!0,focusTrap:!0,animations:!0,backdrop:!0,parentChild:!0},dock:{position:"bottom",labelMode:"beside",enableReorder:!0,enableFreeDrag:!0},animations:{open:400,close:250,minimize:500,restore:400},appearance:{headerLayout:"macos",defaultWidth:"480px",defaultHeight:"auto",minWidth:280,minHeight:200},zIndex:{base:400,dock:8e3,toast:9e3},parentChild:{movementMode:"animated",animationDuration:300},positioning:{strategy:"smart",modalGap:16,avoidElements:[]},portalTarget:"#modal-portal"};let ut={...gt},ht=e.state(0);function pt(){return e.get(ht)}function ft(){return ut}function mt(t){const n=ut;ut=wt(gt,t),e.update(ht),n.features.dock&&!ut.features.dock&&J()}function vt(){ut={...gt},e.update(ht)}function wt(e,t){return{features:{...e.features,...t.features},dock:{...e.dock,...t.dock},animations:{...e.animations,...t.animations},appearance:{...e.appearance,...t.appearance},zIndex:{...e.zIndex,...t.zIndex},parentChild:{...e.parentChild,...t.parentChild},positioning:{...e.positioning,...t.positioning},portalTarget:t.portalTarget??e.portalTarget}}function yt(e){return ut.features[e]}const xt=Symbol("modal-render-icon"),zt=Symbol("modal-id");function It(e,t){if(!Ve(e))throw new Error(`Cannot call ${t}() on unregistered modal "${String(e)}". Ensure the Modal component is rendered.`)}function bt(e){return{shake:()=>{It(e,"shake"),We(e)},bringToFront:()=>{It(e,"bringToFront"),oe(e)},isOpen:()=>Ke(e),isRegistered:()=>Ve(e),open:t=>{It(e,"open"),de(e,t)},close:()=>{It(e,"close"),le(e)},minimize:()=>{It(e,"minimize"),Q(e)},restore:()=>{It(e,"restore"),Z(e)},openChild:(t,n)=>{It(e,"openChild"),he({id:t},e,n)}}}function _t(t={x:0,y:0}){const n=e.proxy({...t}),i=e.proxy({isDragging:!1,startX:0,startY:0,initialX:0,initialY:0,hasBeenDragged:!1});return{get position(){return n},get hasBeenDragged(){return i.hasBeenDragged},get isDragging(){return i.isDragging},onPointerDown:function(e,t){if(0===e.button){if(!i.hasBeenDragged){const e=t.getBoundingClientRect();n.x=e.left,n.y=e.top}i.isDragging=!0,i.startX=e.clientX,i.startY=e.clientY,i.initialX=n.x,i.initialY=n.y,t.setPointerCapture(e.pointerId)}},onPointerMove:function(e,t,o){if(!i.isDragging)return;const r=e.clientX-i.startX,s=e.clientY-i.startY,d=y(i.initialX+r,i.initialY+s,o.width,o.height);n.x=d.x,n.y=d.y,i.hasBeenDragged=!0},onPointerUp:function(e,t){i.isDragging&&(i.isDragging=!1,t.releasePointerCapture(e.pointerId))},setPosition:function(e){n.x=e.x,n.y=e.y},setHasBeenDragged:function(e){i.hasBeenDragged=e},reset:function(){n.x=t.x,n.y=t.y,i.hasBeenDragged=!1}}}function Mt(t,n,i,o,r,s,d){let a=e.state(!1),l=e.state(""),c=e.state(e.proxy({width:0,height:0})),g=e.state(!1),u=e.state(!1),h={x:0,y:0,width:0,height:0,posX:0,posY:0,centerX:0,centerY:0},p=null;function f(s,d){s.preventDefault(),s.stopPropagation();const u=t();if(!u)return;const f=u.getBoundingClientRect();o()||(i({x:f.left,y:f.top}),r(!0)),e.get(g)||(e.set(c,{width:f.width,height:f.height},!0),e.set(g,!0));const w=n();e.set(a,!0),e.set(l,d,!0),p=s.pointerId,h={x:s.clientX,y:s.clientY,width:e.get(c).width,height:e.get(c).height,posX:w.x,posY:w.y,centerX:w.x+e.get(c).width/2,centerY:w.y+e.get(c).height/2},window.addEventListener("pointermove",m),window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v)}function m(t){if(t.pointerId!==p)return;const n=t.clientX-h.x,o=t.clientY-h.y,r=window.innerWidth,s=window.innerHeight,a=(null==d?void 0:d())??!1;let g=h.width,u=h.height,f=h.posX,m=h.posY;if(a){if(e.get(l).includes("e")||e.get(l).includes("w")){const t=e.get(l).includes("e")?n:-n;g=Math.max(280,h.width+2*t),f=h.centerX-g/2}if(e.get(l).includes("s")||e.get(l).includes("n")){const t=e.get(l).includes("s")?o:-o;u=Math.max(200,h.height+2*t),m=h.centerY-u/2}}else{if(e.get(l).includes("e")){const e=r-f;g=Math.max(280,Math.min(h.width+n,e))}if(e.get(l).includes("w")){const e=h.width-280,t=Math.min(n,e);g=h.width-t,f=h.posX+t}if(e.get(l).includes("s")){const e=s-m;u=Math.max(200,Math.min(h.height+o,e))}if(e.get(l).includes("n")){const e=h.height-200,t=Math.min(o,e);u=h.height-t,m=h.posY+t}}const v=x(f,m,g,u);e.set(c,{width:v.width,height:v.height},!0),i({x:v.x,y:v.y})}function v(t){t.pointerId===p&&(e.set(a,!1),p=null,window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v),e.set(u,!0),s(n(),e.get(c)),setTimeout(()=>{e.set(u,!1)},0))}const w={startResize:f};return{get isResizing(){return e.get(a)},get resizeDirection(){return e.get(l)},get size(){return e.get(c)},get hasBeenResized(){return e.get(g)},get isActive(){return e.get(a)},get justFinishedResizing(){return e.get(u)},start:f,setHasBeenResized:()=>{},setSize:function(t){e.set(c,t,!0),e.set(g,!0)},reset:function(){e.set(g,!1),e.set(c,{width:0,height:0},!0)},constrainToViewport:function(){const o=n(),r=t();if(!r)return;const s=x(o.x,o.y,e.get(c).width||r.offsetWidth,e.get(c).height||r.offsetHeight);e.set(c,{width:s.width,height:s.height},!0),i({x:s.x,y:s.y})},handlers:w}}function kt(){return ft().features.animations}function Dt(t,n,i,o,r,s,d,a,l){let c=e.state(!1),g=e.state(!1),u=e.state(!1),h=e.state(!1),p=e.state(null),f=e.state(null),m=null,v=null;function w(){v&&(clearTimeout(v),v=null)}function y(){const e=t(),n=document.querySelector(`.modal-dock-item[data-modal-id="${e}"]`),i=document.querySelector('[data-dock-container="true"]'),o=n||i;if(o){const e=o.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top+e.height/2}}return{x:window.innerWidth/2,y:window.innerHeight-40}}return e.user_effect(()=>()=>{w(),e.set(c,!1),e.set(g,!1),e.set(u,!1),e.set(h,!1),e.set(p,null),e.set(f,null),m=null}),{get isMinimizing(){return e.get(c)},get isRestoring(){return e.get(g)},get isOpening(){return e.get(u)},get isClosing(){return e.get(h)},get animationTransform(){return e.get(p)},get pendingOpenSource(){return e.get(f)},startMinimize:function(t,h){const f=n();if(e.get(c)||!f)return;if(e.set(g,!1),e.set(u,!1),w(),!kt()){const e=f.getBoundingClientRect();let t=r()?i():{x:e.left,y:e.top},n=d()?a():{width:e.width,height:e.height};return r()||(o(t),s(!0)),void(h?h():l(t,!0,n))}const m=f.getBoundingClientRect(),x=m.left+m.width/2,z=m.top+m.height/2;let I=r()?i():{x:m.left,y:m.top},b=d()?a():{width:m.width,height:m.height};r()||(o(I),s(!0));const _=t??y(),M=_.x-m.left,k=_.y-m.top,D={x:_.x-x,y:_.y-z,originX:M,originY:k};e.set(p,D,!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.set(c,!0)})}),v=setTimeout(()=>{h?h():l(I,!0,b)},500)},startRestore:function(t,n){if(!kt()){const e=t||{x:window.innerWidth/2,y:window.innerHeight/2};return o(e),void s(!0)}const i=y(),r=t||{x:window.innerWidth/2,y:window.innerHeight/2},d=n||{width:480,height:400};o(r),s(!0);const a=r.x+d.width/2,l=r.y+d.height/2,c=i.x-r.x,u=i.y-r.y;e.set(p,{x:i.x-a,y:i.y-l,originX:c,originY:u},!0),e.set(g,!0),setTimeout(()=>{e.set(g,!1),e.set(p,null)},400)},startClose:function(t){e.get(h)||e.get(c)||(kt()?(m=t,e.set(h,!0),setTimeout(()=>{e.set(h,!1),m&&(m(),m=null)},250)):t())},setPendingOpenSource:function(t){e.set(f,t,!0)},tryStartOpenAnimation:function(){const t=n();if(!e.get(f)||!t||e.get(u))return!1;if(!kt())return e.set(f,null),!1;const d=e.get(f);e.set(f,null);const a=t.getBoundingClientRect(),l=r()?i():{x:a.left,y:a.top},c=a.width,g=a.height,h=l.x+c/2,m=l.y+g/2;r()||(o(l),s(!0));const v=d.x-l.x,w=d.y-l.y;return e.set(p,{x:d.x-h,y:d.y-m,originX:v,originY:w},!0),e.set(u,!0),setTimeout(()=>{e.set(u,!1),e.set(p,null)},400),!0},forceClearMinimize:function(){w(),e.set(c,!1),e.set(p,null)}}}const Pt=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Ct(e){return Array.from(e.querySelectorAll(Pt)).filter(e=>null!==e.offsetParent||"A"===e.tagName)}function Bt(e,t){if("Tab"!==e.key)return;const n=Ct(t);if(0===n.length)return void e.preventDefault();const i=n[0],o=n[n.length-1],r=document.activeElement;e.shiftKey?r===i&&(o.focus(),e.preventDefault()):r===o&&(i.focus(),e.preventDefault())}function Ot(e){const t=Ct(e);return t.length>0&&(t[0].focus(),!0)}function Tt(){return{trapFocus:Bt,focusFirstElement:Ot}}const Rt="modal-portal";function Et(){return{mount:function(e,t=null){const n=function(e){if("undefined"==typeof window)return null;if(e instanceof HTMLElement)return e;if("string"==typeof e){const t=document.querySelector(e);if(t)return t;if(e.startsWith("#")){const t=e.slice(1),n=document.createElement("div");return n.id=t,document.body.appendChild(n),n}}let t=document.getElementById(Rt);return t||(t=document.createElement("div"),t.id=Rt,document.body.appendChild(t)),t}(t);return n?(n.appendChild(e),()=>{e.parentNode===n&&n.removeChild(e),n.id!==Rt&&0===n.children.length&&n.parentNode&&n.parentNode.removeChild(n)}):()=>{}}}}function St(e){const n=t(zt),i=e??n;if(!i)throw new Error("useModalZIndex: No modal ID provided and no modal context found. Either pass a modal ID or use this hook inside a Modal component.");return{get zIndex(){const e=Ie(i);return((null==e?void 0:e.zIndex)??ft().zIndex.base)+1},get portalTarget(){return ft().portalTarget}}}function Ht(){function t(e,t,n){return"undefined"==typeof window?()=>{}:(window.addEventListener(e,t,n),()=>{window.removeEventListener(e,t,n)})}return{addListener:t,addListenerEffect:function(n,i,o){e.user_effect(()=>{if("undefined"!=typeof window)return t(n,i,o)})}}}var Ft=e.from_html('<div style="display: contents;"><!></div>');function Lt(t,i){e.push(i,!0);let o=e.prop(i,"target",3,"body"),r=null,s=null;const{mount:d}=Et();n(()=>(r&&(s=d(r,o())),()=>{null==s||s()}));var a=Ft(),l=e.child(a);e.snippet(l,()=>i.children),e.reset(a),e.bind_this(a,e=>r=e,()=>r),e.append(t,a),e.pop()}var Wt=e.from_html('<button type="button" aria-label="Minimize"></button>'),At=e.from_html('<button type="button" class="modal-header-light modal-header-light-style" aria-label="Toggle style"></button>'),$t=e.from_html('<div class="modal-header-icon"><!></div>'),Xt=e.from_html('<div class="modal-header-icon"><!></div>'),Yt=e.from_html('<h2 class="modal-header-title"> </h2>'),qt=e.from_html('<h2 class="modal-header-title"> </h2>'),Nt=e.from_html('<div class="modal-header-traffic-lights"><button type="button" class="modal-header-light modal-header-light-close" aria-label="Close"></button> <!> <!></div> <div class="modal-header-mac-center"><!> <div class="modal-header-title-group"><!></div></div> <div class="modal-header-mac-spacer"></div>',1),jt=e.from_html('<div class="modal-header-icon"><!></div>'),Gt=e.from_html('<div class="modal-header-icon"><!></div>'),Kt=e.from_html('<h2 class="modal-header-title"> </h2>'),Vt=e.from_html('<h2 class="modal-header-title"> </h2>'),Ut=e.from_html('<button type="button" class="modal-header-btn-windows modal-header-btn-windows-style" aria-label="Toggle style">◇</button>'),Qt=e.from_html('<button type="button" aria-label="Minimize">–</button>'),Zt=e.from_html('<div class="modal-header-title-group"><!> <!></div> <div class="modal-header-actions"><!> <!> <button type="button" class="modal-header-btn-windows modal-header-btn-windows-close" aria-label="Close">×</button></div>',1),Jt=e.from_html("<header><!></header>");function en(n,i){e.push(i,!0);let o=e.prop(i,"isTransparent",3,!1),r=e.prop(i,"headerLayout",3,"macos"),s=e.prop(i,"minimizable",3,!0),d=e.prop(i,"minimizeDisabled",3,!1),a=e.prop(i,"transparencyEnabled",3,!0);const l=t(xt),c=e.derived(()=>null==l?void 0:l()),g=e.derived(()=>"macos"===r());var u=Jt();let h;u.__pointerdown=function(e){var t;e.target.closest("button")||null==(t=i.onStartDrag)||t.call(i,e)};var p=e.child(u),f=t=>{var n=Nt(),o=e.first_child(n),r=e.child(o);r.__click=function(...e){var t;null==(t=i.onClose)||t.apply(this,e)};var l=e.sibling(r,2),g=t=>{var n=Wt();let o;n.__click=function(...e){var t;null==(t=d()?void 0:i.onMinimize)||t.apply(this,e)},e.template_effect(()=>{o=e.set_class(n,1,"modal-header-light modal-header-light-minimize",null,o,{"modal-header-light-disabled":d()}),n.disabled=d(),e.set_attribute(n,"title",d()?"Enable dock to minimize":void 0)}),e.append(t,n)};e.if(l,e=>{s()&&e(g)});var u=e.sibling(l,2),h=t=>{var n=At();n.__click=function(...e){var t;null==(t=i.onToggleStyle)||t.apply(this,e)},e.append(t,n)};e.if(u,e=>{a()&&e(h)}),e.reset(o);var p=e.sibling(o,2),f=e.child(p),m=t=>{var n=$t(),o=e.child(n);e.snippet(o,()=>i.customIcon),e.reset(n),e.append(t,n)},v=t=>{var n=e.comment(),o=e.first_child(n),r=t=>{var n=Xt(),o=e.child(n);e.snippet(o,()=>e.get(c),()=>i.icon),e.reset(n),e.append(t,n)};e.if(o,t=>{i.icon&&e.get(c)&&t(r)},!0),e.append(t,n)};e.if(f,e=>{i.customIcon?e(m):e(v,!1)});var w=e.sibling(f,2),y=e.child(w),x=t=>{var n=Yt(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>{e.set_attribute(n,"id",i.titleId),e.set_text(o,i.title)}),e.append(t,n)},z=t=>{var n=qt(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>e.set_text(o,i.title)),e.append(t,n)};e.if(y,e=>{i.titleId?e(x):e(z,!1)}),e.reset(w),e.reset(p),e.next(2),e.append(t,n)},m=t=>{var n=Zt(),o=e.first_child(n),r=e.child(o),l=t=>{var n=jt(),o=e.child(n);e.snippet(o,()=>i.customIcon),e.reset(n),e.append(t,n)},g=t=>{var n=e.comment(),o=e.first_child(n),r=t=>{var n=Gt(),o=e.child(n);e.snippet(o,()=>e.get(c),()=>i.icon),e.reset(n),e.append(t,n)};e.if(o,t=>{i.icon&&e.get(c)&&t(r)},!0),e.append(t,n)};e.if(r,e=>{i.customIcon?e(l):e(g,!1)});var u=e.sibling(r,2),h=t=>{var n=Kt(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>{e.set_attribute(n,"id",i.titleId),e.set_text(o,i.title)}),e.append(t,n)},p=t=>{var n=Vt(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>e.set_text(o,i.title)),e.append(t,n)};e.if(u,e=>{i.titleId?e(h):e(p,!1)}),e.reset(o);var f=e.sibling(o,2),m=e.child(f),v=t=>{var n=Ut();n.__click=function(...e){var t;null==(t=i.onToggleStyle)||t.apply(this,e)},e.append(t,n)};e.if(m,e=>{a()&&e(v)});var w=e.sibling(m,2),y=t=>{var n=Qt();let o;n.__click=function(...e){var t;null==(t=d()?void 0:i.onMinimize)||t.apply(this,e)},e.template_effect(()=>{o=e.set_class(n,1,"modal-header-btn-windows",null,o,{"modal-header-btn-windows-disabled":d()}),n.disabled=d(),e.set_attribute(n,"title",d()?"Enable dock to minimize":void 0)}),e.append(t,n)};e.if(w,e=>{s()&&e(y)}),e.sibling(w,2).__click=function(...e){var t;null==(t=i.onClose)||t.apply(this,e)},e.reset(f),e.append(t,n)};e.if(p,t=>{e.get(g)?t(f):t(m,!1)}),e.reset(u),e.template_effect(()=>h=e.set_class(u,1,"modal-header",null,h,{"modal-header-draggable":!!i.onStartDrag,transparent:o()})),e.append(n,u),e.pop()}e.delegate(["pointerdown","click"]);var tn=e.from_html("<div></div>"),nn=e.from_html('<div class="modal-resize-handles"></div>');function on(t,n){e.push(n,!0);const i=["n","s","e","w","ne","nw","se","sw"];var o=e.comment(),r=e.first_child(o),s=t=>{var o=nn();e.each(o,21,()=>i,e.index,(t,i)=>{var o=tn();o.__pointerdown=t=>function(e,t){var i;null==(i=n.onStartResize)||i.call(n,e,t)}(t,e.get(i)),e.template_effect(()=>e.set_class(o,1,`modal-resize-handle modal-resize-${e.get(i)??""}`)),e.append(t,o)}),e.reset(o),e.append(t,o)};e.if(r,e=>{n.onStartResize&&e(s)}),e.append(t,o),e.pop()}e.delegate(["pointerdown"]);var rn=e.from_html('<div class="modal-footer"><!></div>'),sn=e.from_html("<div></div>"),dn=e.from_html('<div role="dialog" aria-modal="true" tabindex="-1"><!> <div class="modal-body"><!></div> <!> <!> <!></div>');function an(t,s){e.push(s,!0);let d=e.prop(s,"maxWidth",3,"600px"),a=e.prop(s,"autoOpen",3,!1),l=e.prop(s,"closeOnEscape",3,!0),c=e.state(!1);n(()=>{V({id:s.id,title:s.title,icon:s.icon??"",isOpen:a(),isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:s.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),e.set(c,!0)}),r(()=>{U(s.id)});const g=e.derived(()=>{if(!e.get(c))return!1;Me();const t=Ie(s.id);return!!t&&(t.isOpen||t.isMinimized||De(s.id)||Ce(s.id)||we(s.id))});var u=e.comment(),h=e.first_child(u),p=t=>{!function(t,s){e.push(s,!0);let d=e.prop(s,"maxWidth",3,"600px"),a=e.prop(s,"autoOpen",3,!1),l=e.prop(s,"closeOnEscape",3,!0),c=e.prop(s,"skipRegistration",3,!1);i(zt,s.id);const g=ft().portalTarget;function u(e){var t,n;return(null==(n=null==(t=s.config)?void 0:t.features)?void 0:n[e])??yt(e)}const h=e.derived(()=>(pt(),u("drag"))),p=e.derived(()=>(pt(),u("minimize"))),f=e.derived(()=>(pt(),!u("dock"))),m=e.derived(()=>(pt(),u("transparency"))),v=e.derived(()=>(pt(),u("resize"))),w=e.derived(()=>{var e,t;return pt(),(null==(t=null==(e=s.config)?void 0:e.appearance)?void 0:t.headerLayout)??ft().appearance.headerLayout});let x=e.state(null),z=e.state(!1),_=e.state(!1),D=e.state(!1),P=e.state(!1),C=e.state(!1);const B=e.derived(()=>(Me(),Ie(s.id))),O=e.derived(()=>e.get(B)&&(e.get(B).isOpen||Ce(s.id))&&(!e.get(B).isMinimized||we(s.id))&&!e.get(B).isHiddenWithParent),T=e.derived(()=>{var t;return!!(null==(t=e.get(B))?void 0:t.childId)}),R=e.derived(()=>{var t;return!!(null==(t=e.get(B))?void 0:t.parentId)}),E=e.derived(()=>e.get(T)||e.get(_)),S=e.derived(()=>!!s.glow),H=e.derived(()=>`modal-title-${s.id}`),F=e.derived(()=>{var t;return(null==(t=e.get(B))?void 0:t.zIndex)??1e3}),L=_t({x:0,y:0});let W=e.state(!1);const A=Mt(()=>e.get(x),()=>L.position,e=>L.setPosition(e),()=>L.hasBeenDragged,e=>L.setHasBeenDragged(e),(t,n)=>{const i=Ie(s.id);if(null==i?void 0:i.parentId){const t=Ie(i.parentId),o=document.querySelector(`[data-modal-id="${i.parentId}"]`);if(t&&o){const i=t.position??{x:o.getBoundingClientRect().left,y:o.getBoundingClientRect().top},r=t.size??{width:o.offsetWidth,height:o.offsetHeight},d={x:i.x+(r.width-n.width)/2,y:i.y+(r.height-n.height)/2};e.set(W,!0),L.setPosition(d);const a={x:d.x-i.x,y:d.y-i.y};return ie(s.id,{position:d,size:n,hasBeenDragged:!0,offsetFromParent:a}),void setTimeout(()=>{e.set(W,!1)},200)}}ie(s.id,{position:t,size:n,hasBeenDragged:!0})}),$=Dt(()=>s.id,()=>e.get(x),()=>L.position,e=>L.setPosition(e),()=>L.hasBeenDragged,e=>L.setHasBeenDragged(e),()=>A.hasBeenResized,()=>A.size,(e,t,n)=>{ie(s.id,{position:e,size:n,hasBeenDragged:t}),Q(s.id)}),{trapFocus:X,focusFirstElement:Y}=Tt(),q=e.derived(()=>$.isMinimizing||$.isRestoring||$.isOpening||$.isClosing),N=e.derived(()=>(Se(s.id)||Re(s.id))&&!$.isRestoring);let j=e.state(!1);const G=e.derived(()=>$.isRestoring||$.isOpening||e.get(j)),K=e.derived(()=>e.get(O)&&!L.hasBeenDragged&&!e.get(q)&&!$.pendingOpenSource&&!e.get(N)),Z=e.derived(()=>{const t=[];return t.push(`z-index: ${e.get(F)};`),$.animationTransform?(t.push(`left: ${L.position.x}px; top: ${L.position.y}px;`),t.push(`--genie-origin-x: ${$.animationTransform.originX}px;`),t.push(`--genie-origin-y: ${$.animationTransform.originY}px;`),t.push(`--genie-translate-x: ${$.animationTransform.x}px;`),t.push(`--genie-translate-y: ${$.animationTransform.y}px;`)):L.hasBeenDragged&&t.push(`left: ${L.position.x}px; top: ${L.position.y}px; transform: none;`),A.hasBeenResized?t.push(`width: ${A.size.width}px; height: ${A.size.height}px; max-width: none; max-height: none;`):(s.preferredHeight&&t.push(`min-height: ${s.preferredHeight};`),d()&&t.push(`max-width: ${d()};`)),e.get(S)&&s.glow&&(t.push(`--modal-glow-color: ${s.glow.color};`),t.push(`--modal-glow-intensity: ${s.glow.intensity};`)),t.join(" ")});function J(){e.get(p)&&Q(s.id)}function ee(){var e;Oe(s.id)&&Te(s.id),le(s.id),null==(e=s.onClose)||e.call(s)}function ne(){Qe(s.id)}function se(t){e.get(h)&&e.get(x)&&L.onPointerDown(t,e.get(x))}function de(e){l()&&"Escape"===e.key&&re(s.id)&&(e.stopPropagation(),ee())}function ae(t){if(!e.get(x))return;const n=L.isDragging,i=A.hasBeenResized?A.size:{width:e.get(x).offsetWidth,height:e.get(x).offsetHeight};L.onPointerMove(t,e.get(x),i),L.isDragging&&n&&te(s.id,L.position,{drag:!0})}function ce(t){if(!e.get(x))return;const n=L.isDragging;L.onPointerUp(t,e.get(x)),n&&!A.justFinishedResizing&&(te(s.id,L.position,{drag:!0}),rt(s.id))}function ue(){var t;const n=ft();if("smart"!==(null==(t=n.positioning)?void 0:t.strategy))return!1;const i=Ie(s.id);if(null==i?void 0:i.parentId)return!1;if((null==i?void 0:i.hasBeenDragged)||(null==i?void 0:i.position))return!1;const o=e.get(x)||document.querySelector(`[data-modal-id="${s.id}"]`);if(!o)return!1;const r=o.offsetWidth,d=o.offsetHeight;if(r<=0||d<=0)return!1;const a=n.positioning.modalGap??16,l=_e(s.id),c=M(r,d,l,{modalGap:a,avoidBounds:b(n.positioning.avoidElements??[])});if(I(c.x,c.y,r,d,l,a)/(r*d)>.1&&l.length>0){const e=k(r,d,be(s.id),{modalGap:a});if(e&&e.existingModalMoves.size>0)return ot(e.existingModalMoves),L.setPosition(e.newModalPosition),L.setHasBeenDragged(!0),te(s.id,e.newModalPosition,{size:{width:r,height:d}}),!0}return L.setPosition(c),L.setHasBeenDragged(!0),te(s.id,c,{size:{width:r,height:d}}),!0}function he(){o().then(()=>o()).then(()=>{let t=0;const n=()=>{t+=1,ue()||t>5||requestAnimationFrame(n)};e.get(x)?n():requestAnimationFrame(n)})}n(()=>{var t;function n(){const t=Ie(s.id);if(!(null==t?void 0:t.position)||!e.get(x))return;if(t.parentId)return;const n=A.hasBeenResized?A.size.width:e.get(x).offsetWidth,i=A.hasBeenResized?A.size.height:e.get(x).offsetHeight;if(n<=0||i<=0)return;const o=y(t.position.x,t.position.y,n,i);(Math.abs(o.x-t.position.x)>1||Math.abs(o.y-t.position.y)>1)&&(L.setPosition(o),te(s.id,o))}return c()||(t=a(),V({id:s.id,title:s.title,icon:s.icon??"",isOpen:t,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:s.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),t&&oe(s.id)),a()&&(o().then(()=>{e.get(x)&&Y(e.get(x))}),he()),window.addEventListener("pointermove",ae),window.addEventListener("pointerup",ce),window.addEventListener("resize",n),()=>{window.removeEventListener("pointermove",ae),window.removeEventListener("pointerup",ce),window.removeEventListener("resize",n)}}),r(()=>{Ze(s.id),c()||U(s.id)}),e.user_effect(()=>{Me();const t=Ie(s.id);if(t){if(e.set(z,t.isTransparent,!0),!L.isDragging&&!A.isResizing&&t.position){const e=L.position,n=t.position;(Math.abs(e.x-n.x)>.5||Math.abs(e.y-n.y)>.5)&&(L.setPosition(n),t.hasBeenDragged&&L.setHasBeenDragged(!0))}o().then(()=>function(){var t;if(!Ie(s.id))return;if(Oe(s.id))return Te(s.id),void(null==(t=s.onClose)||t.call(s));if(we(s.id)&&!e.get(P)){if(e.set(P,!0),ke(),e.get(x)){const t=e.get(x).getBoundingClientRect(),n=L.hasBeenDragged?L.position:{x:t.left,y:t.top},i=A.hasBeenResized?A.size:{width:t.width,height:t.height};ie(s.id,{position:n,size:i,hasBeenDragged:!0})}$.startMinimize(void 0,()=>{ye(s.id),e.set(P,!1)})}if(Re(s.id)){Ee(s.id);const t=Ie(s.id);$.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0),o().then(()=>{e.get(x)&&Y(e.get(x))})}if(Se(s.id)){He(s.id);const e=Ie(s.id);$.startRestore((null==e?void 0:e.position)??void 0,(null==e?void 0:e.size)??void 0)}if(Ce(s.id)&&(Be(s.id),$.startClose(()=>{var e;Ze(s.id),ge(s.id),null==(e=s.onClose)||e.call(s)})),De(s.id)){Pe(s.id);const t=Ne(s.id)||s.openSourcePosition||null;t?($.setPendingOpenSource(t),o().then(()=>o()).then(()=>{ue(),$.tryStartOpenAnimation()})):he(),o().then(()=>{e.get(x)&&Y(e.get(x))})}Fe(s.id)&&(Le(s.id),Ae(s.id),e.set(C,!0),setTimeout(()=>{e.set(C,!1),$e(s.id)},600));const n=Ye(s.id);var i;n&&e.get(x)&&(i=n.parentId,o().then(()=>o()).then(()=>{let t=0;const n=()=>{t+=1;const o=function(t){var n,i;const o=Ie(t);if(!o)return!1;const r=e.get(x)||document.querySelector(`[data-modal-id="${s.id}"]`),d=document.querySelector(`[data-modal-id="${t}"]`),a=null==d?void 0:d.getBoundingClientRect(),l=o.position??(a?{x:a.left,y:a.top}:null);if(!l||!r)return!1;const c=(null==(n=o.size)?void 0:n.width)??(null==d?void 0:d.offsetWidth)??(null==a?void 0:a.width)??480,g=(null==(i=o.size)?void 0:i.height)??(null==d?void 0:d.offsetHeight)??(null==a?void 0:a.height)??400,u=r.offsetWidth,h=r.offsetHeight;if(c<=0||g<=0||u<=0||h<=0)return!1;const p={x:l.x+(c-u)/2,y:l.y+(g-h)/2};return L.setPosition(p),L.setHasBeenDragged(!0),te(s.id,p,{size:{width:u,height:h}}),o.position&&o.size||!a||te(t,{x:a.left,y:a.top},{size:{width:c,height:g}}),pe(t,s.id),!0}(i);o||t>5||requestAnimationFrame(n)};e.get(x)?n():requestAnimationFrame(n)}))}())}}),e.user_effect(()=>{const t=Ie(s.id);t&&t.isTransparent!==e.get(z)&&e.set(z,t.isTransparent,!0)}),e.user_effect(()=>{if(e.get(O)&&e.get(x)){const t=t=>function(t){e.get(x)&&X(t,e.get(x))}(t);return e.get(x).addEventListener("keydown",t),()=>{var n;return null==(n=e.get(x))?void 0:n.removeEventListener("keydown",t)}}}),e.user_effect(()=>{!e.get(O)&&$.isMinimizing&&$.forceClearMinimize()}),e.user_effect(()=>{$.isRestoring||$.isOpening?e.set(j,!0):e.get(j)&&requestAnimationFrame(()=>{e.set(j,!1)})}),e.user_effect(()=>{e.get(D)&&!e.get(T)&&(e.set(_,!0),setTimeout(()=>{e.set(_,!1)},200)),e.set(D,e.get(T),!0)});var fe=e.comment(),me=e.first_child(fe),ve=t=>{Lt(t,{get target(){return g},children:(t,n)=>{var i=dn();let o;i.__keydown=de;var r=e.child(i);{let t=e.derived(()=>e.get(h)?se:void 0);en(r,{get title(){return s.title},get customIcon(){return s.customIcon},get icon(){return s.icon},get isTransparent(){return e.get(z)},get titleId(){return e.get(H)},get headerLayout(){return e.get(w)},get onStartDrag(){return e.get(t)},onToggleStyle:ne,onMinimize:J,onClose:ee,get minimizable(){return e.get(p)},get minimizeDisabled(){return e.get(f)},get transparencyEnabled(){return e.get(m)}})}var d=e.sibling(r,2),a=e.child(d);e.snippet(a,()=>s.children??e.noop),e.reset(d);var l=e.sibling(d,2),c=t=>{var n=rn(),i=e.child(n);e.snippet(i,()=>s.footer),e.reset(n),e.append(t,n)};e.if(l,e=>{s.footer&&e(c)});var g=e.sibling(l,2);{let t=e.derived(()=>e.get(v)&&!e.get(T)?A.handlers.startResize:void 0);on(g,{get onStartResize(){return e.get(t)}})}var u=e.sibling(g,2),y=t=>{var n=sn();let i;e.template_effect(()=>i=e.set_class(n,1,"modal-child-overlay",null,i,{"modal-overlay-closing":e.get(_)})),e.append(t,n)};e.if(u,t=>{e.get(E)&&t(y)}),e.reset(i),e.bind_this(i,t=>e.set(x,t),()=>e.get(x)),e.template_effect(()=>{var t;o=e.set_class(i,1,"modal-dialog",null,o,{"modal-dragging":L.isDragging,"modal-resizing":A.isResizing,"modal-positioned":L.hasBeenDragged,"modal-minimizing":$.isMinimizing,"modal-restoring":$.isRestoring,"modal-opening":$.isOpening,"modal-closing":$.isClosing,"modal-centered":e.get(K),"modal-solid":!e.get(z),"modal-transparent":e.get(z),"modal-glow":e.get(S),"modal-has-child":e.get(T),"modal-is-child":e.get(R),"modal-visible-by-animation":e.get(G),"modal-animating-to-center":e.get(W),"modal-animating-position":null==(t=e.get(B))?void 0:t.isAnimatingPosition,"modal-attention":e.get(C)}),e.set_attribute(i,"data-modal-id",s.id),e.set_style(i,e.get(Z)),e.set_attribute(i,"aria-labelledby",e.get(H))}),e.event("pointerdown",i,()=>oe(s.id),!0),e.append(t,i)},$$slots:{default:!0}})};e.if(me,t=>{e.get(O)&&t(ve)}),e.append(t,fe),e.pop()}(t,{get id(){return s.id},get title(){return s.title},get icon(){return s.icon},get customIcon(){return s.customIcon},get maxWidth(){return d()},get preferredHeight(){return s.preferredHeight},get autoOpen(){return a()},get openSourcePosition(){return s.openSourcePosition},get glow(){return s.glow},get config(){return s.config},get closeOnEscape(){return l()},get onClose(){return s.onClose},get children(){return s.children},get footer(){return s.footer},skipRegistration:!0})};e.if(h,t=>{e.get(g)&&t(p)}),e.append(t,u),e.pop()}e.delegate(["keydown"]);var ln=e.from_html('<button type="button" aria-label="Drag dock"></button>'),cn=e.from_html('<span class="modal-dock-item-icon-placeholder"> </span>'),gn=e.from_html('<span class="modal-dock-item-label"> </span>'),un=e.from_html("<span>+</span>"),hn=e.from_html('<span class="modal-dock-child-indicator"><!></span>'),pn=e.from_html('<button><span class="modal-dock-item-icon"><!></span> <!> <span class="modal-dock-item-glow"></span> <!></button>'),fn=e.from_html('<div data-dock-container="true"><div><!> <!></div></div>');function mn(n,i){e.push(i,!0);const o=t(xt),r=e.derived(()=>i.renderIcon??(null==o?void 0:o())),s=Ue(),l=e.derived(()=>(pt(),ft())),u=e.derived(()=>m("DOCK")),h=e.derived(()=>e.get(l).dock.position),p=e.derived(()=>e.get(l).dock.labelMode);let f=e.state("horizontal"),v=e.state(e.proxy({x:100,y:100})),w=e.state(null),x=e.state(!1),z={x:0,y:0},I=null;const b=e.derived(()=>(Me(),Array.from(s.modals.values()).filter(e=>e.isMinimized).sort((e,t)=>e.dockPosition-t.dockPosition))),_=e.derived(()=>{switch(e.get(h)){case"left":return{x:-20,duration:250,easing:c};case"right":return{x:20,duration:250,easing:c};default:return{y:20,duration:250,easing:c}}});function M(t){var n;"free"===e.get(h)&&(e.set(x,!0),I=t.pointerId,z={x:t.clientX-e.get(v).x,y:t.clientY-e.get(v).y},null==(n=t.currentTarget)||n.setPointerCapture(t.pointerId),window.addEventListener("pointermove",k),window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D))}function k(t){if(t.pointerId!==I||!e.get(w))return;const n=e.get(w).getBoundingClientRect(),i=window.innerWidth-n.width-8,o=window.innerHeight-n.height-8,r=Math.min(Math.max(t.clientX-z.x,8),Math.max(8,i)),s=Math.min(Math.max(t.clientY-z.y,8),Math.max(8,o));e.set(v,{x:Math.round(r),y:Math.round(s)},!0)}function D(t){t.pointerId===I&&(e.set(x,!1),I=null,window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D))}const{addListener:P}=Ht();function C(){if("free"!==e.get(h)||!e.get(w))return;const t=e.get(w).getBoundingClientRect(),n=y(e.get(v).x,e.get(v).y,t.width,t.height);n.x===e.get(v).x&&n.y===e.get(v).y||e.set(v,{x:Math.round(n.x),y:Math.round(n.y)},!0)}e.user_effect(()=>{"undefined"!=typeof window&&P("resize",C)});var B={setDockOrientation:function(t){e.set(f,t,!0)},setDockFreePosition:function(t){e.set(v,t,!0)},getDockState:function(){return{dockPosition:e.get(h),dockOrientation:e.get(f),dockFreePosition:e.get(v),dockLabelMode:e.get(p)}}};return Lt(n,{get target(){return e.get(l).portalTarget},children:(t,n)=>{var i=fn();let o,l;var c=e.child(i);let m;var y=e.child(c),z=t=>{var n=ln();let i;n.__pointerdown=M,e.template_effect(()=>i=e.set_class(n,1,"modal-dock-handle",null,i,{"modal-dock-handle-dragging":e.get(x)})),e.append(t,n)};e.if(y,t=>{"free"===e.get(h)&&t(z)});var I=e.sibling(y,2);e.each(I,19,()=>e.get(b),e=>e.id,(t,n,i)=>{const o=e.derived(()=>e.get(n).lastChildId?s.modals.get(e.get(n).lastChildId):null);var a=pn();let l;a.__click=t=>{Ge(e.get(n).id)?Je(t.currentTarget):Z(e.get(n).id)};var c=e.child(a),u=e.child(c),h=t=>{var i=e.comment(),o=e.first_child(i);e.snippet(o,()=>e.get(r),()=>e.get(n).icon),e.append(t,i)},f=t=>{var i=cn(),o=e.child(i,!0);e.reset(i),e.template_effect(t=>e.set_text(o,t),[()=>e.get(n).title.charAt(0)]),e.append(t,i)};e.if(u,t=>{e.get(n).icon&&e.get(r)?t(h):t(f,!1)}),e.reset(c);var m=e.sibling(c,2),v=t=>{var i=gn(),o=e.child(i,!0);e.reset(i),e.template_effect(()=>e.set_text(o,e.get(n).title)),e.append(t,i)};e.if(m,t=>{"hidden"!==e.get(p)&&t(v)});var w=e.sibling(m,4),y=t=>{var n=hn(),i=e.child(n),s=t=>{var n=e.comment(),i=e.first_child(n);e.snippet(i,()=>e.get(r),()=>e.get(o).icon),e.append(t,n)},d=t=>{var n=un();e.append(t,n)};e.if(i,t=>{e.get(o).icon&&e.get(r)?t(s):t(d,!1)}),e.reset(n),e.append(t,n)};e.if(w,t=>{e.get(n).lastChildId&&e.get(o)&&t(y)}),e.reset(a),e.template_effect(()=>{l=e.set_class(a,1,"modal-dock-item",null,l,{"modal-dock-item-has-glow":!!e.get(n).glow,"modal-dock-item-has-child":!!e.get(n).lastChildId,"modal-dock-item-label-beside":"beside"===e.get(p),"modal-dock-item-label-below":"below"===e.get(p)}),e.set_attribute(a,"data-modal-id",e.get(n).id),e.set_style(a,e.get(n).glow?`--modal-dock-glow-color: ${e.get(n).glow.color};`:"")}),e.transition(3,a,()=>d,()=>({duration:300,delay:50*e.get(i),easing:g,start:.5})),e.append(t,a)}),e.reset(c),e.reset(i),e.bind_this(i,t=>e.set(w,t),()=>e.get(w)),e.template_effect(()=>{o=e.set_class(i,1,"modal-dock-container",null,o,{"modal-dock-left":"left"===e.get(h),"modal-dock-right":"right"===e.get(h),"modal-dock-bottom":"bottom"===e.get(h),"modal-dock-free":"free"===e.get(h),"modal-dock-empty":0===e.get(b).length}),l=e.set_style(i,"free"===e.get(h)?`left: ${e.get(v).x}px; top: ${e.get(v).y}px;`:"",l,{"z-index":e.get(u)}),m=e.set_class(c,1,"modal-dock",null,m,{"modal-dock-free-horizontal":"free"===e.get(h)&&"horizontal"===e.get(f),"modal-dock-free-vertical":"free"===e.get(h)&&"vertical"===e.get(f)})}),e.transition(3,i,()=>a,()=>e.get(b).length>0?e.get(_):{duration:0}),e.append(t,i)},$$slots:{default:!0}}),e.pop(B)}e.delegate(["pointerdown","click"]);var vn=e.from_html('<div class="modal-backdrop svelte-1d3nq4t" aria-hidden="true"></div>');function wn(t,n){e.push(n,!0);const i=Ue(),o=e.derived(()=>(pt(),ft())),r=e.derived(()=>e.get(o).features.backdrop),s=e.derived(()=>(Me(),Array.from(i.modals.values()).some(e=>e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent))),d=e.derived(()=>e.get(r)&&e.get(s)),a=e.derived(()=>m("MODAL")-1);Lt(t,{get target(){return e.get(o).portalTarget},children:(t,n)=>{var i=e.comment(),o=e.first_child(i),r=t=>{var n=vn();let i;e.template_effect(()=>i=e.set_style(n,"",i,{"z-index":e.get(a)})),e.transition(3,n,()=>l,()=>({duration:200})),e.append(t,n)};e.if(o,t=>{e.get(d)&&t(r)}),e.append(t,i)},$$slots:{default:!0}}),e.pop()}var yn=e.from_html("<!> <!>",1);function xn(t,n){e.push(n,!0),i(xt,()=>n.renderIcon),e.user_effect(()=>(s(()=>{n.config&&mt(n.config),p()}),()=>{vt(),v()})),e.user_effect(()=>{if("undefined"==typeof document)return;const e=s(()=>ft().portalTarget);if("string"==typeof e&&!document.querySelector(e)){const t=document.createElement("div");return t.id=e.replace("#",""),document.body.appendChild(t),()=>{t.remove()}}});var o=yn(),r=e.first_child(o);wn(r,{});var d=e.sibling(r,2);e.snippet(d,()=>n.children??e.noop),e.append(t,o),e.pop()}export{wn as Backdrop,mn as Dock,an as Modal,en as ModalHeader,xn as ModalProvider,Lt as Portal,on as ResizeHandles,lt as _getInternalState,ct as _resetInternalState,f as acquireModalZIndex,ot as animateModalsToPositions,et as animateParentToPosition,oe as bringToFront,z as calculateOverlap,_ as calculatePositionScore,k as calculateRearrangement,I as calculateTotalOverlap,tt as clearParentAnimationFlag,it as clearPendingParentAnimation,ce as closeAllModals,le as closeModal,x as constrainSizeToViewport,y as constrainToViewport,Ne as consumeOpenSourcePosition,Le as consumePendingAttention,He as consumePendingChildRestore,Be as consumePendingClose,Te as consumePendingForceClose,ye as consumePendingMinimize,ke as consumePendingMinimizeTarget,Pe as consumePendingOpen,Ye as consumePendingParentLink,Ee as consumePendingRestore,ae as createModal,gt as defaultConfig,$e as endAttentionAnimation,ge as finalizeModalClose,M as findSmartPosition,Ot as focusFirstElement,ft as getConfig,pt as getConfigVersion,b as getElementBounds,m as getLayerZIndex,Ie as getModalState,Ue as getModalsStore,ue as getModalsToClose,_e as getOpenModalBounds,be as getOpenModalBoundsWithIds,Xe as getPendingParentLink,ze as getRegisteredModalIds,Me as getStateVersion,xe as hasAnyPendingMinimize,Fe as hasPendingAttention,Se as hasPendingChildRestore,Ce as hasPendingClose,Oe as hasPendingForceClose,we as hasPendingMinimize,De as hasPendingOpen,nt as hasPendingParentAnimation,Re as hasPendingRestore,fe as hideChildWithParent,p as initializeStacking,yt as isFeatureEnabled,Ge as isModalAnimating,Ke as isModalOpen,Ve as isModalRegistered,re as isTopModal,pe as linkModals,wt as mergeConfig,Q as minimizeModal,he as openChildModal,de as openModal,V as registerModal,se as reorderDock,vt as resetConfig,Ze as resetModalTransparency,v as resetStacking,J as restoreAllMinimizedModals,ee as restoreChildModal,Z as restoreModal,ve as setChildOffsetFromParent,mt as setConfig,at as setDockPositionGetter,je as setModalAnimating,st as setRegistryFunctions,dt as setURLStateCallbacks,Je as shakeElement,Ae as startAttentionAnimation,qe as storeOpenSourcePosition,O as subscribe,Qe as toggleModalTransparency,Bt as trapFocus,We as triggerAttention,rt as triggerCascadingParentAnimations,U as unregisterModal,me as updateChildPosition,ie as updateModal,te as updateModalPosition,ne as updateModalSize,Tt as useFocusTrap,bt as useModal,Dt as useModalAnimation,_t as useModalDrag,Mt as useModalResize,St as useModalZIndex,Et as usePortal,Ht as useWindowEvent};
|
|
1
|
+
import{B as a,D as s,M as e,b as o,a as d,P as r,R as l,f as u,t as i,g as t,u as M,e as n,c,d as p,i as m,h as F,j as P}from"./ui.js";export{a as Backdrop,s as Dock,e as Modal,o as ModalHeader,d as ModalProvider,r as Portal,l as ResizeHandles,u as focusFirstElement,i as trapFocus,t as useFocusTrap,M as useModal,n as useModalAnimation,c as useModalDrag,p as useModalResize,m as useModalZIndex,F as usePortal,P as useWindowEvent};
|
package/dist/ui.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"svelte/internal/client";import{i as t,a as i,o as n,r as o,m as r,c as s,b as a,d,t as l,e as g,f as c,g as u,h as p,j as h,k as m,l as f,n as v,p as w,q as y,s as x,u as _,v as b,w as z,x as k,y as D,z as M,A as B,B as I,C,D as E,E as R,F as P,G as T,H as L,I as $,J as S,K as H,L as O,M as X,N as Y,O as F,P as W,Q as A,R as q,S as j,T as N,U as G,V as K,W as U,X as V,Y as Z,Z as J,_ as Q,$ as ee,a0 as te,a1 as ie,a2 as ne,a3 as oe,a4 as re,a5 as se,a6 as ae,a7 as de}from"./core.js";import{getContext as le,onMount as ge,setContext as ce,tick as ue,onDestroy as pe,untrack as he}from"svelte";import"svelte/internal/disclose-version";import{scale as me,fly as fe,fade as ve}from"svelte/transition";import{cubicOut as we,backOut as ye}from"svelte/easing";const xe=Symbol("modal-render-icon"),_e=Symbol("modal-id");function be(e,i){if(!t(e))throw new Error(`Cannot call ${i}() on unregistered modal "${String(e)}". Ensure the Modal component is rendered.`)}function ze(e){return{shake:()=>{be(e,"shake"),l(e)},bringToFront:()=>{be(e,"bringToFront"),d(e)},isOpen:()=>i(e),isRegistered:()=>t(e),open:t=>{be(e,"open"),a(e,t)},close:()=>{be(e,"close"),s(e)},minimize:()=>{be(e,"minimize"),r(e)},restore:()=>{be(e,"restore"),o(e)},openChild:(t,i)=>{be(e,"openChild"),n({id:t},e,i)}}}function ke(t={x:0,y:0}){const i=e.proxy({...t}),n=e.proxy({isDragging:!1,startX:0,startY:0,initialX:0,initialY:0,hasBeenDragged:!1});return{get position(){return i},get hasBeenDragged(){return n.hasBeenDragged},get isDragging(){return n.isDragging},onPointerDown:function(e,t){if(0===e.button){if(!n.hasBeenDragged){const e=t.getBoundingClientRect();i.x=e.left,i.y=e.top}n.isDragging=!0,n.startX=e.clientX,n.startY=e.clientY,n.initialX=i.x,n.initialY=i.y,t.setPointerCapture(e.pointerId)}},onPointerMove:function(e,t,o){if(!n.isDragging)return;const r=e.clientX-n.startX,s=e.clientY-n.startY,a=n.initialX+r,d=n.initialY+s,l=g(a,d,o.width,o.height);i.x=l.x,i.y=l.y,n.hasBeenDragged=!0},onPointerUp:function(e,t){n.isDragging&&(n.isDragging=!1,t.releasePointerCapture(e.pointerId))},setPosition:function(e){i.x=e.x,i.y=e.y},setHasBeenDragged:function(e){n.hasBeenDragged=e},reset:function(){i.x=t.x,i.y=t.y,n.hasBeenDragged=!1}}}function De(t,i,n,o,r,s,a){let d=e.state(!1),l=e.state(""),g=e.state(e.proxy({width:0,height:0})),u=e.state(!1),p=e.state(!1),h={x:0,y:0,width:0,height:0,posX:0,posY:0,centerX:0,centerY:0},m=null;function f(s,a){s.preventDefault(),s.stopPropagation();const c=t();if(!c)return;const p=c.getBoundingClientRect();o()||(n({x:p.left,y:p.top}),r(!0)),e.get(u)||(e.set(g,{width:p.width,height:p.height},!0),e.set(u,!0));const f=i();e.set(d,!0),e.set(l,a,!0),m=s.pointerId,h={x:s.clientX,y:s.clientY,width:e.get(g).width,height:e.get(g).height,posX:f.x,posY:f.y,centerX:f.x+e.get(g).width/2,centerY:f.y+e.get(g).height/2},window.addEventListener("pointermove",v),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w)}function v(t){if(t.pointerId!==m)return;const i=t.clientX-h.x,o=t.clientY-h.y,r=window.innerWidth,s=window.innerHeight,d=(null==a?void 0:a())??!1;let u=h.width,p=h.height,f=h.posX,v=h.posY;if(d){if(e.get(l).includes("e")||e.get(l).includes("w")){const t=e.get(l).includes("e")?i:-i;u=Math.max(280,h.width+2*t),f=h.centerX-u/2}if(e.get(l).includes("s")||e.get(l).includes("n")){const t=e.get(l).includes("s")?o:-o;p=Math.max(200,h.height+2*t),v=h.centerY-p/2}}else{if(e.get(l).includes("e")){const e=r-f;u=Math.max(280,Math.min(h.width+i,e))}if(e.get(l).includes("w")){const e=h.width-280,t=Math.min(i,e);u=h.width-t,f=h.posX+t}if(e.get(l).includes("s")){const e=s-v;p=Math.max(200,Math.min(h.height+o,e))}if(e.get(l).includes("n")){const e=h.height-200,t=Math.min(o,e);p=h.height-t,v=h.posY+t}}const w=c(f,v,u,p);e.set(g,{width:w.width,height:w.height},!0),n({x:w.x,y:w.y})}function w(t){t.pointerId===m&&(e.set(d,!1),m=null,window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w),e.set(p,!0),s(i(),e.get(g)),setTimeout(()=>{e.set(p,!1)},0))}const y={startResize:f};return{get isResizing(){return e.get(d)},get resizeDirection(){return e.get(l)},get size(){return e.get(g)},get hasBeenResized(){return e.get(u)},get isActive(){return e.get(d)},get justFinishedResizing(){return e.get(p)},start:f,setHasBeenResized:()=>{},setSize:function(t){e.set(g,t,!0),e.set(u,!0)},reset:function(){e.set(u,!1),e.set(g,{width:0,height:0},!0)},constrainToViewport:function(){const o=i(),r=t();if(!r)return;const s=c(o.x,o.y,e.get(g).width||r.offsetWidth,e.get(g).height||r.offsetHeight);e.set(g,{width:s.width,height:s.height},!0),n({x:s.x,y:s.y})},handlers:y}}function Me(){return u().features.animations}function Be(t,i,n,o,r,s,a,d,l){let g=e.state(!1),c=e.state(!1),u=e.state(!1),h=e.state(!1),m=e.state(null),f=e.state(null),v=null,w=null;function y(){w&&(clearTimeout(w),w=null)}function x(){const e=t(),i=document.querySelector(`.modal-dock-item[data-modal-id="${p(e)}"]`),n=document.querySelector('[data-dock-container="true"]'),o=i||n;if(o){const e=o.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top+e.height/2}}return{x:window.innerWidth/2,y:window.innerHeight-40}}return e.user_effect(()=>()=>{y(),e.set(g,!1),e.set(c,!1),e.set(u,!1),e.set(h,!1),e.set(m,null),e.set(f,null),v=null}),{get isMinimizing(){return e.get(g)},get isRestoring(){return e.get(c)},get isOpening(){return e.get(u)},get isClosing(){return e.get(h)},get animationTransform(){return e.get(m)},get pendingOpenSource(){return e.get(f)},startMinimize:function(t,p){const h=i();if(e.get(g)||!h)return;if(e.set(c,!1),e.set(u,!1),y(),!Me()){const e=h.getBoundingClientRect();let t=r()?n():{x:e.left,y:e.top},i=a()?d():{width:e.width,height:e.height};return r()||(o(t),s(!0)),void(p?p():l(t,!0,i))}const f=h.getBoundingClientRect(),v=f.left+f.width/2,_=f.top+f.height/2;let b=r()?n():{x:f.left,y:f.top},z=a()?d():{width:f.width,height:f.height};r()||(o(b),s(!0));const k=t??x(),D=k.x-f.left,M=k.y-f.top,B={x:k.x-v,y:k.y-_,originX:D,originY:M};e.set(m,B,!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.set(g,!0)})}),w=setTimeout(()=>{p?p():l(b,!0,z)},500)},startRestore:function(t,i){if(!Me()){const e=t||{x:window.innerWidth/2,y:window.innerHeight/2};return o(e),void s(!0)}const n=x(),r=t||{x:window.innerWidth/2,y:window.innerHeight/2},a=i||{width:480,height:400};o(r),s(!0);const d=r.x+a.width/2,l=r.y+a.height/2,g=n.x-r.x,u=n.y-r.y;e.set(m,{x:n.x-d,y:n.y-l,originX:g,originY:u},!0),e.set(c,!0),setTimeout(()=>{e.set(c,!1),e.set(m,null)},400)},startClose:function(t){e.get(h)||e.get(g)||(Me()?(v=t,e.set(h,!0),setTimeout(()=>{e.set(h,!1),v&&(v(),v=null)},250)):t())},setPendingOpenSource:function(t){e.set(f,t,!0)},tryStartOpenAnimation:function(){const t=i();if(!e.get(f)||!t||e.get(u))return!1;if(!Me())return e.set(f,null),!1;const a=e.get(f);e.set(f,null);const d=t.getBoundingClientRect(),l=r()?n():{x:d.left,y:d.top},g=d.width,c=d.height,p=l.x+g/2,h=l.y+c/2;r()||(o(l),s(!0));const v=a.x-l.x,w=a.y-l.y;return e.set(m,{x:a.x-p,y:a.y-h,originX:v,originY:w},!0),e.set(u,!0),setTimeout(()=>{e.set(u,!1),e.set(m,null)},400),!0},forceClearMinimize:function(){y(),e.set(g,!1),e.set(m,null)}}}const Ie=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Ce(e){return Array.from(e.querySelectorAll(Ie)).filter(e=>null!==e.offsetParent||"A"===e.tagName)}function Ee(e,t){if("Tab"!==e.key)return;const i=Ce(t);if(0===i.length)return void e.preventDefault();const n=i[0],o=i[i.length-1],r=document.activeElement;e.shiftKey?r===n&&(o.focus(),e.preventDefault()):r===o&&(n.focus(),e.preventDefault())}function Re(e){const t=Ce(e);return t.length>0&&(t[0].focus(),!0)}function Pe(){return{trapFocus:Ee,focusFirstElement:Re}}const Te="modal-portal";function Le(){return{mount:function(e,t=null){const i=function(e){if("undefined"==typeof window)return null;if(e instanceof HTMLElement)return e;if("string"==typeof e){const t=document.querySelector(e);if(t)return t;if(e.startsWith("#")){const t=e.slice(1),i=document.createElement("div");return i.id=t,document.body.appendChild(i),i}}let t=document.getElementById(Te);return t||(t=document.createElement("div"),t.id=Te,document.body.appendChild(t)),t}(t);return i?(i.appendChild(e),()=>{e.parentNode===i&&i.removeChild(e),i.id!==Te&&0===i.children.length&&i.parentNode&&i.parentNode.removeChild(i)}):()=>{}}}}function $e(e){const t=le(_e),i=e??t;if(!i)throw new Error("useModalZIndex: No modal ID provided and no modal context found. Either pass a modal ID or use this hook inside a Modal component.");return{get zIndex(){const e=h(i);return((null==e?void 0:e.zIndex)??u().zIndex.base)+1},get portalTarget(){return u().portalTarget}}}function Se(){function t(e,t,i){return"undefined"==typeof window?()=>{}:(window.addEventListener(e,t,i),()=>{window.removeEventListener(e,t,i)})}return{addListener:t,addListenerEffect:function(i,n,o){e.user_effect(()=>{if("undefined"!=typeof window)return t(i,n,o)})}}}var He=e.from_html('<div style="display: contents;"><!></div>');function Oe(t,i){e.push(i,!0);let n=e.prop(i,"target",3,"body"),o=null,r=null;const{mount:s}=Le();ge(()=>(o&&(r=s(o,n())),()=>{null==r||r()}));var a=He(),d=e.child(a);e.snippet(d,()=>i.children),e.reset(a),e.bind_this(a,e=>o=e,()=>o),e.append(t,a),e.pop()}var Xe=e.from_html('<button type="button" aria-label="Minimize"></button>'),Ye=e.from_html('<button type="button" class="modal-header-light modal-header-light-style" aria-label="Toggle style"></button>'),Fe=e.from_html('<div class="modal-header-icon"><!></div>'),We=e.from_html('<div class="modal-header-icon"><!></div>'),Ae=e.from_html('<h2 class="modal-header-title"> </h2>'),qe=e.from_html('<h2 class="modal-header-title"> </h2>'),je=e.from_html('<div class="modal-header-traffic-lights"><button type="button" class="modal-header-light modal-header-light-close" aria-label="Close"></button> <!> <!></div> <div class="modal-header-mac-center"><!> <div class="modal-header-title-group"><!></div></div> <div class="modal-header-mac-spacer"></div>',1),Ne=e.from_html('<div class="modal-header-icon"><!></div>'),Ge=e.from_html('<div class="modal-header-icon"><!></div>'),Ke=e.from_html('<h2 class="modal-header-title"> </h2>'),Ue=e.from_html('<h2 class="modal-header-title"> </h2>'),Ve=e.from_html('<button type="button" class="modal-header-btn-windows modal-header-btn-windows-style" aria-label="Toggle style">◇</button>'),Ze=e.from_html('<button type="button" aria-label="Minimize">–</button>'),Je=e.from_html('<div class="modal-header-title-group"><!> <!></div> <div class="modal-header-actions"><!> <!> <button type="button" class="modal-header-btn-windows modal-header-btn-windows-close" aria-label="Close">×</button></div>',1),Qe=e.from_html("<header><!></header>");function et(t,i){e.push(i,!0);let n=e.prop(i,"isTransparent",3,!1),o=e.prop(i,"headerLayout",3,"macos"),r=e.prop(i,"minimizable",3,!0),s=e.prop(i,"minimizeDisabled",3,!1),a=e.prop(i,"transparencyEnabled",3,!0);const d=le(xe),l=e.derived(()=>null==d?void 0:d()),g=e.derived(()=>"macos"===o());var c=Qe();let u;c.__pointerdown=function(e){var t;e.target.closest("button")||null==(t=i.onStartDrag)||t.call(i,e)};var p=e.child(c),h=t=>{var n=je(),o=e.first_child(n),d=e.child(o);d.__click=function(...e){var t;null==(t=i.onClose)||t.apply(this,e)};var g=e.sibling(d,2),c=t=>{var n=Xe();let o;n.__click=function(...e){var t;null==(t=s()?void 0:i.onMinimize)||t.apply(this,e)},e.template_effect(()=>{o=e.set_class(n,1,"modal-header-light modal-header-light-minimize",null,o,{"modal-header-light-disabled":s()}),n.disabled=s(),e.set_attribute(n,"title",s()?"Enable dock to minimize":void 0)}),e.append(t,n)};e.if(g,e=>{r()&&e(c)});var u=e.sibling(g,2),p=t=>{var n=Ye();n.__click=function(...e){var t;null==(t=i.onToggleStyle)||t.apply(this,e)},e.append(t,n)};e.if(u,e=>{a()&&e(p)}),e.reset(o);var h=e.sibling(o,2),m=e.child(h),f=t=>{var n=Fe(),o=e.child(n);e.snippet(o,()=>i.customIcon),e.reset(n),e.append(t,n)},v=t=>{var n=e.comment(),o=e.first_child(n),r=t=>{var n=We(),o=e.child(n);e.snippet(o,()=>e.get(l),()=>i.icon),e.reset(n),e.append(t,n)};e.if(o,t=>{i.icon&&e.get(l)&&t(r)},!0),e.append(t,n)};e.if(m,e=>{i.customIcon?e(f):e(v,!1)});var w=e.sibling(m,2),y=e.child(w),x=t=>{var n=Ae(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>{e.set_attribute(n,"id",i.titleId),e.set_text(o,i.title)}),e.append(t,n)},_=t=>{var n=qe(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>e.set_text(o,i.title)),e.append(t,n)};e.if(y,e=>{i.titleId?e(x):e(_,!1)}),e.reset(w),e.reset(h),e.next(2),e.append(t,n)},m=t=>{var n=Je(),o=e.first_child(n),d=e.child(o),g=t=>{var n=Ne(),o=e.child(n);e.snippet(o,()=>i.customIcon),e.reset(n),e.append(t,n)},c=t=>{var n=e.comment(),o=e.first_child(n),r=t=>{var n=Ge(),o=e.child(n);e.snippet(o,()=>e.get(l),()=>i.icon),e.reset(n),e.append(t,n)};e.if(o,t=>{i.icon&&e.get(l)&&t(r)},!0),e.append(t,n)};e.if(d,e=>{i.customIcon?e(g):e(c,!1)});var u=e.sibling(d,2),p=t=>{var n=Ke(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>{e.set_attribute(n,"id",i.titleId),e.set_text(o,i.title)}),e.append(t,n)},h=t=>{var n=Ue(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>e.set_text(o,i.title)),e.append(t,n)};e.if(u,e=>{i.titleId?e(p):e(h,!1)}),e.reset(o);var m=e.sibling(o,2),f=e.child(m),v=t=>{var n=Ve();n.__click=function(...e){var t;null==(t=i.onToggleStyle)||t.apply(this,e)},e.append(t,n)};e.if(f,e=>{a()&&e(v)});var w=e.sibling(f,2),y=t=>{var n=Ze();let o;n.__click=function(...e){var t;null==(t=s()?void 0:i.onMinimize)||t.apply(this,e)},e.template_effect(()=>{o=e.set_class(n,1,"modal-header-btn-windows",null,o,{"modal-header-btn-windows-disabled":s()}),n.disabled=s(),e.set_attribute(n,"title",s()?"Enable dock to minimize":void 0)}),e.append(t,n)};e.if(w,e=>{r()&&e(y)}),e.sibling(w,2).__click=function(...e){var t;null==(t=i.onClose)||t.apply(this,e)},e.reset(m),e.append(t,n)};e.if(p,t=>{e.get(g)?t(h):t(m,!1)}),e.reset(c),e.template_effect(()=>u=e.set_class(c,1,"modal-header",null,u,{"modal-header-draggable":!!i.onStartDrag,transparent:n()})),e.append(t,c),e.pop()}e.delegate(["pointerdown","click"]);var tt=e.from_html("<div></div>"),it=e.from_html('<div class="modal-resize-handles"></div>');function nt(t,i){e.push(i,!0);const n=["n","s","e","w","ne","nw","se","sw"];var o=e.comment(),r=e.first_child(o),s=t=>{var o=it();e.each(o,21,()=>n,e.index,(t,n)=>{var o=tt();o.__pointerdown=t=>function(e,t){var n;null==(n=i.onStartResize)||n.call(i,e,t)}(t,e.get(n)),e.template_effect(()=>e.set_class(o,1,`modal-resize-handle modal-resize-${e.get(n)??""}`)),e.append(t,o)}),e.reset(o),e.append(t,o)};e.if(r,e=>{i.onStartResize&&e(s)}),e.append(t,o),e.pop()}function ot(e,t){return t&&e.appendChild(t),{update(t){e.innerHTML="",t&&e.appendChild(t)},destroy(){e.innerHTML=""}}}e.delegate(["pointerdown"]);var rt=e.from_html('<div class="modal-footer"><!></div>'),st=e.from_html("<div></div>"),at=e.from_html('<div role="dialog" aria-modal="true" tabindex="-1"><!> <div class="modal-body"><!></div> <!> <!> <!></div>');function dt(t,i){e.push(i,!0);let n=e.prop(i,"maxWidth",3,"600px"),o=e.prop(i,"autoOpen",3,!1),a=e.prop(i,"closeOnEscape",3,!0),l=e.state(!1);ge(()=>{Z({id:i.id,title:i.title,icon:i.icon??"",isOpen:o(),isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:i.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),e.set(l,!0)}),pe(()=>{b(i.id)});const c=e.derived(()=>{if(!e.get(l))return!1;f();const t=h(i.id);return!!t&&(t.isOpen||t.isMinimized||$(i.id)||v(i.id)||w(i.id))});var te=e.comment(),ie=e.first_child(te),ne=t=>{!function(t,i){e.push(i,!0);let n=e.prop(i,"maxWidth",3,"600px"),o=e.prop(i,"autoOpen",3,!1),a=e.prop(i,"closeOnEscape",3,!0),l=e.prop(i,"skipRegistration",3,!1);ce(_e,()=>i.id);const c=u().portalTarget,te=e.derived(()=>p(i.id));function ie(e){var t,n;return(null==(n=null==(t=i.config)?void 0:t.features)?void 0:n[e])??z(e)}const ne=e.derived(()=>(m(),ie("drag"))),oe=e.derived(()=>(m(),ie("minimize"))),re=e.derived(()=>(m(),!ie("dock"))),se=e.derived(()=>(m(),ie("transparency"))),ae=e.derived(()=>(m(),ie("resize"))),de=e.derived(()=>{var e,t;return m(),(null==(t=null==(e=i.config)?void 0:e.appearance)?void 0:t.headerLayout)??u().appearance.headerLayout});let le=e.state(null),he=e.state(!1),me=e.state(!1),fe=e.state(!1),ve=e.state(!1),we=e.state(!1);const ye=e.derived(()=>(f(),h(i.id))),xe=e.derived(()=>e.get(ye)&&(e.get(ye).isOpen||v(i.id))&&(!e.get(ye).isMinimized||w(i.id))&&!e.get(ye).isHiddenWithParent),be=e.derived(()=>{var t;return!!(null==(t=e.get(ye))?void 0:t.childId)}),ze=e.derived(()=>{var t;return!!(null==(t=e.get(ye))?void 0:t.parentId)}),Me=e.derived(()=>e.get(be)||e.get(me)),Ie=e.derived(()=>!!i.glow),Ce=e.derived(()=>`modal-title-${e.get(te)}`),Ee=e.derived(()=>{var t;return(null==(t=e.get(ye))?void 0:t.zIndex)??1e3}),Re=ke({x:0,y:0});let Te=e.state(!1);const Le=De(()=>e.get(le),()=>Re.position,e=>Re.setPosition(e),()=>Re.hasBeenDragged,e=>Re.setHasBeenDragged(e),(t,n)=>{const o=h(i.id);if(null==o?void 0:o.parentId){const t=h(o.parentId),r=document.querySelector(`[data-modal-id="${p(o.parentId)}"]`);if(t&&r){const o=t.position??{x:r.getBoundingClientRect().left,y:r.getBoundingClientRect().top},s=t.size??{width:r.offsetWidth,height:r.offsetHeight},a={x:o.x+(s.width-n.width)/2,y:o.y+(s.height-n.height)/2};e.set(Te,!0),Re.setPosition(a);const d={x:a.x-o.x,y:a.y-o.y};return C(i.id,{position:a,size:n,hasBeenDragged:!0,offsetFromParent:d}),void setTimeout(()=>{e.set(Te,!1)},200)}}C(i.id,{position:t,size:n,hasBeenDragged:!0})}),$e=Be(()=>i.id,()=>e.get(le),()=>Re.position,e=>Re.setPosition(e),()=>Re.hasBeenDragged,e=>Re.setHasBeenDragged(e),()=>Le.hasBeenResized,()=>Le.size,(e,t,n)=>{C(i.id,{position:e,size:n,hasBeenDragged:t}),r(i.id)}),{trapFocus:Se,focusFirstElement:He}=Pe(),Xe=e.derived(()=>$e.isMinimizing||$e.isRestoring||$e.isOpening||$e.isClosing),Ye=e.derived(()=>(y(i.id)||x(i.id))&&!$e.isRestoring);let Fe=e.state(!1);const We=e.derived(()=>$e.isRestoring||$e.isOpening||e.get(Fe)),Ae=e.derived(()=>e.get(xe)&&!Re.hasBeenDragged&&!e.get(Xe)&&!$e.pendingOpenSource&&!e.get(Ye)),qe=e.derived(()=>{const t=[];return t.push(`z-index: ${e.get(Ee)};`),$e.animationTransform?(t.push(`left: ${Re.position.x}px; top: ${Re.position.y}px;`),t.push(`--genie-origin-x: ${$e.animationTransform.originX}px;`),t.push(`--genie-origin-y: ${$e.animationTransform.originY}px;`),t.push(`--genie-translate-x: ${$e.animationTransform.x}px;`),t.push(`--genie-translate-y: ${$e.animationTransform.y}px;`)):Re.hasBeenDragged&&t.push(`left: ${Re.position.x}px; top: ${Re.position.y}px; transform: none;`),Le.hasBeenResized?t.push(`width: ${Le.size.width}px; height: ${Le.size.height}px; max-width: none; max-height: none;`):(i.preferredHeight&&t.push(`min-height: ${i.preferredHeight};`),n()&&t.push(`max-width: ${n()};`)),e.get(Ie)&&i.glow&&(t.push(`--modal-glow-color: ${i.glow.color};`),t.push(`--modal-glow-intensity: ${i.glow.intensity};`)),t.join(" ")});function je(){e.get(oe)&&r(i.id)}function Ne(){var e;M(i.id)&&B(i.id),s(i.id),null==(e=i.onClose)||e.call(i)}function Ge(){Q(i.id)}function Ke(t){e.get(ne)&&e.get(le)&&Re.onPointerDown(t,e.get(le))}function Ue(e){a()&&"Escape"===e.key&&J(i.id)&&(e.stopPropagation(),Ne())}function Ve(t){if(!e.get(le))return;const n=Re.isDragging,o=Le.hasBeenResized?Le.size:{width:e.get(le).offsetWidth,height:e.get(le).offsetHeight};Re.onPointerMove(t,e.get(le),o),Re.isDragging&&n&&k(i.id,Re.position,{drag:!0})}function Ze(t){if(!e.get(le))return;const n=Re.isDragging;Re.onPointerUp(t,e.get(le)),n&&!Le.justFinishedResizing&&(k(i.id,Re.position,{drag:!0}),D(i.id))}function Je(){var t;const n=u();if("smart"!==(null==(t=n.positioning)?void 0:t.strategy))return!1;const o=h(i.id),r=A();if((null==o?void 0:o.parentId)||r&&r.childId===i.id)return!1;if((null==o?void 0:o.hasBeenDragged)||(null==o?void 0:o.position))return!1;const s=e.get(le)||document.querySelector(`[data-modal-id="${e.get(te)}"]`);if(!s)return!1;const a=s.offsetWidth,d=s.offsetHeight;if(a<=0||d<=0)return!1;const l=n.positioning.modalGap??16,g=q(i.id),c=j(n.positioning.avoidElements??[]),p=N(a,d,g,{modalGap:l,avoidBounds:c});if(G(p.x,p.y,a,d,g,l)/(a*d)>.1&&g.length>0){const e=K(i.id),t=U(a,d,e,{modalGap:l});if(t&&t.existingModalMoves.size>0)return V(t.existingModalMoves),Re.setPosition(t.newModalPosition),Re.setHasBeenDragged(!0),k(i.id,t.newModalPosition,{size:{width:a,height:d}}),!0}return Re.setPosition(p),Re.setHasBeenDragged(!0),k(i.id,p,{size:{width:a,height:d}}),!0}function Qe(){ue().then(()=>ue()).then(()=>{let t=0;const i=()=>{t+=1,Je()||t>5||requestAnimationFrame(i)};e.get(le)?i():requestAnimationFrame(i)})}ge(()=>{var t;function n(){const t=h(i.id);if(!(null==t?void 0:t.position)||!e.get(le))return;if(t.parentId)return;const n=Le.hasBeenResized?Le.size.width:e.get(le).offsetWidth,o=Le.hasBeenResized?Le.size.height:e.get(le).offsetHeight;if(n<=0||o<=0)return;const r=g(t.position.x,t.position.y,n,o);(Math.abs(r.x-t.position.x)>1||Math.abs(r.y-t.position.y)>1)&&(Re.setPosition(r),k(i.id,r))}return l()||(t=o(),Z({id:i.id,title:i.title,icon:i.icon??"",isOpen:t,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:i.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),t&&d(i.id)),o()&&(ue().then(()=>{e.get(le)&&He(e.get(le))}),Qe()),window.addEventListener("pointermove",Ve),window.addEventListener("pointerup",Ze),window.addEventListener("resize",n),()=>{window.removeEventListener("pointermove",Ve),window.removeEventListener("pointerup",Ze),window.removeEventListener("resize",n)}}),pe(()=>{_(i.id),l()||b(i.id)}),e.user_effect(()=>{f();const t=h(i.id);if(t){if(e.set(he,t.isTransparent,!0),!Re.isDragging&&!Le.isResizing&&t.position){const e=Re.position,i=t.position;(Math.abs(e.x-i.x)>.5||Math.abs(e.y-i.y)>.5)&&(Re.setPosition(i),t.hasBeenDragged&&Re.setHasBeenDragged(!0))}ue().then(()=>function(){var t;if(!h(i.id))return;if(M(i.id))return B(i.id),void(null==(t=i.onClose)||t.call(i));if(w(i.id)&&!e.get(ve)){if(e.set(ve,!0),I(),e.get(le)){const t=e.get(le).getBoundingClientRect(),n=Re.hasBeenDragged?Re.position:{x:t.left,y:t.top},o=Le.hasBeenResized?Le.size:{width:t.width,height:t.height};C(i.id,{position:n,size:o,hasBeenDragged:!0})}$e.startMinimize(void 0,()=>{E(i.id),e.set(ve,!1)})}if(x(i.id)){R(i.id);const t=h(i.id);$e.startRestore((null==t?void 0:t.position)??void 0,(null==t?void 0:t.size)??void 0),ue().then(()=>{e.get(le)&&He(e.get(le))})}if(y(i.id)){P(i.id);const e=h(i.id);$e.startRestore((null==e?void 0:e.position)??void 0,(null==e?void 0:e.size)??void 0)}if(v(i.id)&&(T(i.id),$e.startClose(()=>{var e;_(i.id),L(i.id),null==(e=i.onClose)||e.call(i)})),$(i.id)){S(i.id);const t=H(i.id)||i.openSourcePosition||null;t?($e.setPendingOpenSource(t),ue().then(()=>ue()).then(()=>{Je(),$e.tryStartOpenAnimation()})):Qe(),ue().then(()=>{e.get(le)&&He(e.get(le))})}O(i.id)&&(X(i.id),Y(i.id),e.set(we,!0),setTimeout(()=>{e.set(we,!1),F(i.id)},600));const n=W(i.id);var o;n&&e.get(le)&&(o=n.parentId,ue().then(()=>ue()).then(()=>{let t=0;const n=()=>{t+=1;const r=function(t){var n,o;const r=h(t);if(!r)return!1;const s=e.get(le)||document.querySelector(`[data-modal-id="${e.get(te)}"]`),a=document.querySelector(`[data-modal-id="${p(t)}"]`),d=null==a?void 0:a.getBoundingClientRect(),l=r.position??(d?{x:d.left,y:d.top}:null);if(!l||!s)return!1;const g=(null==(n=r.size)?void 0:n.width)??(null==a?void 0:a.offsetWidth)??(null==d?void 0:d.width)??480,c=(null==(o=r.size)?void 0:o.height)??(null==a?void 0:a.offsetHeight)??(null==d?void 0:d.height)??400,u=s.offsetWidth,m=s.offsetHeight;if(g<=0||c<=0||u<=0||m<=0)return!1;const f={x:l.x+(g-u)/2,y:l.y+(c-m)/2};return Re.setPosition(f),Re.setHasBeenDragged(!0),k(i.id,f,{size:{width:u,height:m}}),r.position&&r.size||!d||k(t,{x:d.left,y:d.top},{size:{width:g,height:c}}),ee(t,i.id),!0}(o);r||t>5||requestAnimationFrame(n)};e.get(le)?n():requestAnimationFrame(n)}))}())}}),e.user_effect(()=>{const t=h(i.id);t&&t.isTransparent!==e.get(he)&&e.set(he,t.isTransparent,!0)}),e.user_effect(()=>{if(e.get(xe)&&e.get(le)){const t=t=>function(t){e.get(le)&&Se(t,e.get(le))}(t);return e.get(le).addEventListener("keydown",t),()=>{var i;return null==(i=e.get(le))?void 0:i.removeEventListener("keydown",t)}}}),e.user_effect(()=>{!e.get(xe)&&$e.isMinimizing&&$e.forceClearMinimize()}),e.user_effect(()=>{$e.isRestoring||$e.isOpening?e.set(Fe,!0):e.get(Fe)&&requestAnimationFrame(()=>{e.set(Fe,!1)})}),e.user_effect(()=>{e.get(fe)&&!e.get(be)&&(e.set(me,!0),setTimeout(()=>{e.set(me,!1)},200)),e.set(fe,e.get(be),!0)});var tt=e.comment(),it=e.first_child(tt),dt=t=>{Oe(t,{get target(){return c},children:(t,n)=>{var o=at();let r;o.__keydown=Ue;var s=e.child(o);{let t=e.derived(()=>e.get(ne)?Ke:void 0);et(s,{get title(){return i.title},get customIcon(){return i.customIcon},get icon(){return i.icon},get isTransparent(){return e.get(he)},get titleId(){return e.get(Ce)},get headerLayout(){return e.get(de)},get onStartDrag(){return e.get(t)},onToggleStyle:Ge,onMinimize:je,onClose:Ne,get minimizable(){return e.get(oe)},get minimizeDisabled(){return e.get(re)},get transparencyEnabled(){return e.get(se)}})}var a=e.sibling(s,2),l=e.child(a);e.snippet(l,()=>i.children??e.noop),e.reset(a),e.action(a,(e,t)=>null==ot?void 0:ot(e,t),()=>i.bodyElement);var g=e.sibling(a,2),c=t=>{var n=rt(),o=e.child(n),r=t=>{var n=e.comment(),o=e.first_child(n);e.snippet(o,()=>i.footer),e.append(t,n)};e.if(o,e=>{i.footer&&e(r)}),e.reset(n),e.action(n,(e,t)=>null==ot?void 0:ot(e,t),()=>i.footerElement),e.append(t,n)};e.if(g,e=>{(i.footer||i.footerElement)&&e(c)});var u=e.sibling(g,2);{let t=e.derived(()=>e.get(ae)&&!e.get(be)?Le.handlers.startResize:void 0);nt(u,{get onStartResize(){return e.get(t)}})}var p=e.sibling(u,2),h=t=>{var i=st();let n;e.template_effect(()=>n=e.set_class(i,1,"modal-child-overlay",null,n,{"modal-overlay-closing":e.get(me)})),e.append(t,i)};e.if(p,t=>{e.get(Me)&&t(h)}),e.reset(o),e.bind_this(o,t=>e.set(le,t),()=>e.get(le)),e.template_effect(()=>{var t;r=e.set_class(o,1,"modal-dialog",null,r,{"modal-dragging":Re.isDragging,"modal-resizing":Le.isResizing,"modal-positioned":Re.hasBeenDragged,"modal-minimizing":$e.isMinimizing,"modal-restoring":$e.isRestoring,"modal-opening":$e.isOpening,"modal-closing":$e.isClosing,"modal-centered":e.get(Ae),"modal-solid":!e.get(he),"modal-transparent":e.get(he),"modal-glow":e.get(Ie),"modal-has-child":e.get(be),"modal-is-child":e.get(ze),"modal-visible-by-animation":e.get(We),"modal-animating-to-center":e.get(Te),"modal-animating-position":null==(t=e.get(ye))?void 0:t.isAnimatingPosition,"modal-attention":e.get(we)}),e.set_attribute(o,"data-modal-id",e.get(te)),e.set_style(o,e.get(qe)),e.set_attribute(o,"aria-labelledby",e.get(Ce))}),e.event("pointerdown",o,()=>d(i.id),!0),e.append(t,o)},$$slots:{default:!0}})};e.if(it,t=>{e.get(xe)&&t(dt)}),e.append(t,tt),e.pop()}(t,{get id(){return i.id},get title(){return i.title},get icon(){return i.icon},get customIcon(){return i.customIcon},get maxWidth(){return n()},get preferredHeight(){return i.preferredHeight},get autoOpen(){return o()},get openSourcePosition(){return i.openSourcePosition},get glow(){return i.glow},get config(){return i.config},get closeOnEscape(){return a()},get onClose(){return i.onClose},get children(){return i.children},get footer(){return i.footer},skipRegistration:!0})};e.if(ie,t=>{e.get(c)&&t(ne)}),e.append(t,te),e.pop()}e.delegate(["keydown"]);var lt=e.from_html('<button type="button" aria-label="Drag dock"></button>'),gt=e.from_html('<span class="modal-dock-item-icon-placeholder"> </span>'),ct=e.from_html('<span class="modal-dock-item-label"> </span>'),ut=e.from_html("<span>+</span>"),pt=e.from_html('<span class="modal-dock-child-indicator"><!></span>'),ht=e.from_html('<button><span class="modal-dock-item-icon"><!></span> <!> <span class="modal-dock-item-glow"></span> <!></button>'),mt=e.from_html('<div data-dock-container="true"><div><!> <!></div></div>');function ft(t,i){e.push(i,!0);const n=le(xe),r=e.derived(()=>i.renderIcon??(null==n?void 0:n())),s=ie(),a=e.derived(()=>(m(),u())),d=e.derived(()=>te("DOCK")),l=e.derived(()=>e.get(a).dock.position),c=e.derived(()=>e.get(a).dock.labelMode);let h=e.state("horizontal"),v=e.state(e.proxy({x:100,y:100})),w=e.state(null),y=e.state(!1),x={x:0,y:0},_=null;const b=e.derived(()=>(f(),Array.from(s.modals.values()).filter(e=>e.isMinimized).sort((e,t)=>e.dockPosition-t.dockPosition))),z=e.derived(()=>{switch(e.get(l)){case"left":return{x:-20,duration:250,easing:we};case"right":return{x:20,duration:250,easing:we};default:return{y:20,duration:250,easing:we}}});function k(t){var i;"free"===e.get(l)&&(e.set(y,!0),_=t.pointerId,x={x:t.clientX-e.get(v).x,y:t.clientY-e.get(v).y},null==(i=t.currentTarget)||i.setPointerCapture(t.pointerId),window.addEventListener("pointermove",D),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M))}function D(t){if(t.pointerId!==_||!e.get(w))return;const i=e.get(w).getBoundingClientRect(),n=window.innerWidth-i.width-8,o=window.innerHeight-i.height-8,r=Math.min(Math.max(t.clientX-x.x,8),Math.max(8,n)),s=Math.min(Math.max(t.clientY-x.y,8),Math.max(8,o));e.set(v,{x:Math.round(r),y:Math.round(s)},!0)}function M(t){t.pointerId===_&&(e.set(y,!1),_=null,window.removeEventListener("pointermove",D),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M))}const{addListener:B}=Se();function I(){if("free"!==e.get(l)||!e.get(w))return;const t=e.get(w).getBoundingClientRect(),i=g(e.get(v).x,e.get(v).y,t.width,t.height);i.x===e.get(v).x&&i.y===e.get(v).y||e.set(v,{x:Math.round(i.x),y:Math.round(i.y)},!0)}e.user_effect(()=>{"undefined"!=typeof window&&B("resize",I)});var C={setDockOrientation:function(t){e.set(h,t,!0)},setDockFreePosition:function(t){e.set(v,t,!0)},getDockState:function(){return{dockPosition:e.get(l),dockOrientation:e.get(h),dockFreePosition:e.get(v),dockLabelMode:e.get(c)}}};return Oe(t,{get target(){return e.get(a).portalTarget},children:(t,i)=>{var n=mt();let a,g;var u=e.child(n);let m;var f=e.child(u),x=t=>{var i=lt();let n;i.__pointerdown=k,e.template_effect(()=>n=e.set_class(i,1,"modal-dock-handle",null,n,{"modal-dock-handle-dragging":e.get(y)})),e.append(t,i)};e.if(f,t=>{"free"===e.get(l)&&t(x)});var _=e.sibling(f,2);e.each(_,19,()=>e.get(b),e=>e.id,(t,i,n)=>{const a=e.derived(()=>e.get(i).lastChildId?s.modals.get(e.get(i).lastChildId):null);var d=ht();let l;d.__click=t=>{ne(e.get(i).id)?oe(t.currentTarget):o(e.get(i).id)};var g=e.child(d),u=e.child(g),h=t=>{var n=e.comment(),o=e.first_child(n);e.snippet(o,()=>e.get(r),()=>e.get(i).icon),e.append(t,n)},m=t=>{var n=gt(),o=e.child(n,!0);e.reset(n),e.template_effect(t=>e.set_text(o,t),[()=>e.get(i).title.charAt(0)]),e.append(t,n)};e.if(u,t=>{e.get(i).icon&&e.get(r)?t(h):t(m,!1)}),e.reset(g);var f=e.sibling(g,2),v=t=>{var n=ct(),o=e.child(n,!0);e.reset(n),e.template_effect(()=>e.set_text(o,e.get(i).title)),e.append(t,n)};e.if(f,t=>{"hidden"!==e.get(c)&&t(v)});var w=e.sibling(f,4),y=t=>{var i=pt(),n=e.child(i),o=t=>{var i=e.comment(),n=e.first_child(i);e.snippet(n,()=>e.get(r),()=>e.get(a).icon),e.append(t,i)},s=t=>{var i=ut();e.append(t,i)};e.if(n,t=>{e.get(a).icon&&e.get(r)?t(o):t(s,!1)}),e.reset(i),e.append(t,i)};e.if(w,t=>{e.get(i).lastChildId&&e.get(a)&&t(y)}),e.reset(d),e.template_effect(t=>{l=e.set_class(d,1,"modal-dock-item",null,l,{"modal-dock-item-has-glow":!!e.get(i).glow,"modal-dock-item-has-child":!!e.get(i).lastChildId,"modal-dock-item-label-beside":"beside"===e.get(c),"modal-dock-item-label-below":"below"===e.get(c)}),e.set_attribute(d,"data-modal-id",t),e.set_style(d,e.get(i).glow?`--modal-dock-glow-color: ${e.get(i).glow.color};`:"")},[()=>p(e.get(i).id)]),e.transition(3,d,()=>me,()=>({duration:300,delay:50*e.get(n),easing:ye,start:.5})),e.append(t,d)}),e.reset(u),e.reset(n),e.bind_this(n,t=>e.set(w,t),()=>e.get(w)),e.template_effect(()=>{a=e.set_class(n,1,"modal-dock-container",null,a,{"modal-dock-left":"left"===e.get(l),"modal-dock-right":"right"===e.get(l),"modal-dock-bottom":"bottom"===e.get(l),"modal-dock-free":"free"===e.get(l),"modal-dock-empty":0===e.get(b).length}),g=e.set_style(n,"free"===e.get(l)?`left: ${e.get(v).x}px; top: ${e.get(v).y}px;`:"",g,{"z-index":e.get(d)}),m=e.set_class(u,1,"modal-dock",null,m,{"modal-dock-free-horizontal":"free"===e.get(l)&&"horizontal"===e.get(h),"modal-dock-free-vertical":"free"===e.get(l)&&"vertical"===e.get(h)})}),e.transition(3,n,()=>fe,()=>e.get(b).length>0?e.get(z):{duration:0}),e.append(t,n)},$$slots:{default:!0}}),e.pop(C)}e.delegate(["pointerdown","click"]);var vt=e.from_html('<div class="modal-backdrop svelte-1d3nq4t" aria-hidden="true"></div>');function wt(t,i){e.push(i,!0);const n=ie(),o=e.derived(()=>(m(),u())),r=e.derived(()=>e.get(o).features.backdrop),s=e.derived(()=>(f(),Array.from(n.modals.values()).some(e=>e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent))),a=e.derived(()=>e.get(r)&&e.get(s)),d=e.derived(()=>te("MODAL")-1);Oe(t,{get target(){return e.get(o).portalTarget},children:(t,i)=>{var n=e.comment(),o=e.first_child(n),r=t=>{var i=vt();let n;e.template_effect(()=>n=e.set_style(i,"",n,{"z-index":e.get(d)})),e.transition(3,i,()=>ve,()=>({duration:200})),e.append(t,i)};e.if(o,t=>{e.get(a)&&t(r)}),e.append(t,n)},$$slots:{default:!0}}),e.pop()}var yt=e.from_html("<!> <!>",1);function xt(t,i){e.push(i,!0),ce(xe,()=>i.renderIcon),e.user_effect(()=>(he(()=>{i.config&&re(i.config),se()}),()=>{ae(),de()})),e.user_effect(()=>{if("undefined"==typeof document)return;const e=he(()=>u().portalTarget);if("string"==typeof e&&!document.querySelector(e)){const t=document.createElement("div");return t.id=e.replace("#",""),document.body.appendChild(t),()=>{t.remove()}}});var n=yt(),o=e.first_child(n);wt(o,{});var r=e.sibling(o,2);e.snippet(r,()=>i.children??e.noop),e.append(t,n),e.pop()}export{wt as B,ft as D,dt as M,Oe as P,nt as R,xt as a,et as b,ke as c,De as d,Be as e,Re as f,Pe as g,Le as h,$e as i,Se as j,Ee as t,ze as u};
|
package/dist/vanilla.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{onMount as e,getContext as t,setContext as i,tick as n,onDestroy as o,mount as r,unmount as d}from"svelte";import"svelte/internal/disclose-version";import*as s from"svelte/internal/client";import{scale as a,fly as l,fade as c}from"svelte/transition";import{cubicOut as g,backOut as u}from"svelte/easing";const h={features:{dock:!0,minimize:!0,transparency:!0,resize:!0,drag:!0,focusTrap:!0,animations:!0,backdrop:!0,parentChild:!0},dock:{position:"bottom",labelMode:"beside",enableReorder:!0,enableFreeDrag:!0},animations:{open:400,close:250,minimize:500,restore:400},appearance:{headerLayout:"macos",defaultWidth:"480px",defaultHeight:"auto",minWidth:280,minHeight:200},zIndex:{base:400,dock:8e3,toast:9e3},parentChild:{movementMode:"animated",animationDuration:300},positioning:{strategy:"smart",modalGap:16,avoidElements:[]},portalTarget:"#modal-portal"};let p={...h},f=s.state(0);function m(){return s.get(f)}function v(){return p}function w(e){const t=p;var i,n;p={features:{...(i=h).features,...(n=e).features},dock:{...i.dock,...n.dock},animations:{...i.animations,...n.animations},appearance:{...i.appearance,...n.appearance},zIndex:{...i.zIndex,...n.zIndex},parentChild:{...i.parentChild,...n.parentChild},positioning:{...i.positioning,...n.positioning},portalTarget:n.portalTarget??i.portalTarget},s.update(f),t.features.dock&&!p.features.dock&&(Array.from(P.values()).filter(e=>e.isMinimized).map(e=>e.id).forEach(e=>{const t=P.get(e);if(t){P.set(e,{...t,isMinimized:!1,isOpen:!0}),s.set(S,[...s.get(S),e],!0),ee(e);const i=t.lastChildId||t.childId;i&&Q(i)}}),s.set(j,[],!0),O())}const y={BASE:0,DROPDOWN:100,STICKY:200,OVERLAY:300,MODAL:400,DOCK:8e3,TOAST:9e3};let x=s.state(s.proxy(y.MODAL));function z(e){const t=v();return"MODAL"===e?t.zIndex.base:"DOCK"===e?t.zIndex.dock:"TOAST"===e?t.zIndex.toast:y[e]}const I=8;function b(e,t,i,n,o={}){const{margin:r=I,allowPartialVisibility:d=!1}=o,s="undefined"!=typeof window?window.innerWidth:1920,a="undefined"!=typeof window?window.innerHeight:1080;let l,c,g,u;return d&&i>s-2*r?(l=40-i,c=s-40):(l=r,c=Math.max(r,s-i-r)),d&&n>a-2*r?(g=40-n,u=a-40):(g=r,u=Math.max(r,a-n-r)),{x:Math.max(l,Math.min(c,e)),y:Math.max(g,Math.min(u,t))}}function _(e,t,i,n,o={}){const{margin:r=I}=o,d=("undefined"!=typeof window?window.innerWidth:1920)-2*r,s=("undefined"!=typeof window?window.innerHeight:1080)-2*r,a=Math.min(i,d),l=Math.min(n,s),c=b(e,t,a,l,o);return{x:c.x,y:c.y,width:a,height:l}}function M(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function k(e,t,i,n,o,r){const d={x:e-r,y:t-r,width:i+2*r,height:n+2*r};let s=0;for(const e of o)s+=M(d,e);return s}function D(e,t,i,n,o,r,d){const s=(o-i)/2,a=(r-n)/2,l=s-d,c=a-d,g=Math.abs(e-s)/(l||1),u=Math.abs(t-a)/(c||1),h=Math.sqrt(g*g+u*u)/Math.SQRT2,p=50,f=e-d,m=o-i-d-e,v=t-d,w=r-n-d-t;let y=0;return f<p&&(y+=.3*(1-f/p)),m<p&&(y+=.3*(1-m/p)),v<p&&(y+=.2*(1-v/p)),w<p&&(y+=.2*(1-w/p)),Math.min(1,h+y)}let P=s.proxy(new Map),C=s.state(0);const B=new Set;function O(){s.update(C),queueMicrotask(()=>{B.forEach(e=>e())})}let R=s.state(s.proxy([])),T=s.state(s.proxy([])),E=s.state(s.proxy([])),H=s.state(s.proxy([])),S=s.state(s.proxy([])),L=s.state(s.proxy([])),W=s.state(s.proxy([])),A=s.state(s.proxy([])),$=s.state(null),F=s.proxy(new Map),X=s.state(null),Y=s.proxy(new Map),q=s.proxy(new Set),N=s.proxy(new Set),j=s.state(s.proxy([]));function G(e){const t=P.get(e.id),i=(null==t?void 0:t.zIndex)??function(){const e=s.get(x);return s.set(x,s.get(x)+2),e}();t?P.set(e.id,{...t,title:e.title,icon:e.icon,glow:e.glow,zIndex:i}):P.set(e.id,{...e,zIndex:i,isAnimating:!1}),O(),e.isMinimized&&!s.get(j).includes(e.id)&&s.get(j).push(e.id)}function K(e){const t=P.get(e);if(t){if(s.set(j,s.get(j).filter(t=>t!==e),!0),t.childId){const e=P.get(t.childId);e&&P.set(t.childId,{...e,parentId:void 0})}if(t.parentId){const e=P.get(t.parentId);e&&P.set(t.parentId,{...e,childId:void 0,lastChildId:t.id})}P.delete(e),O(),N.delete(e),q.delete(e)}}function V(e){const t=P.get(e);if(!t||t.isMinimized)return;if(ye(e),t.parentId){const e=P.get(t.parentId);if(e&&!e.isMinimized)return void V(t.parentId)}s.set(R,[...s.get(R),e],!0),t.position&&t.size;const i=t.childId;P.set(e,{...t,isMinimized:!0,lastChildId:i}),O(),s.get(j).includes(e)||s.get(j).push(e),t.childId&&function(e){const t=P.get(e);if(!(null==t?void 0:t.childId))return;const i=P.get(t.childId);i&&(P.set(t.childId,{...i,isHiddenWithParent:!0}),O())}(e)}function U(e){const t=P.get(e);if(!t||!t.isMinimized)return;P.set(e,{...t,isMinimized:!1,isOpen:!0}),O(),s.set(S,[...s.get(S),e],!0),ee(e);const i=t.lastChildId||t.childId;i&&Q(i)}function Q(e){const t=P.get(e);t&&t.isHiddenWithParent&&(P.set(e,{...t,isHiddenWithParent:!1}),O(),s.set(L,[...s.get(L),e],!0))}function J(e,t,i){const n=P.get(e);if(!n)return;let o=t;if((null==i?void 0:i.constrain)&&n.size&&(o=b(t.x,t.y,n.size.width,n.size.height)),P.set(e,{...n,position:o,size:(null==i?void 0:i.size)??n.size,hasBeenDragged:n.hasBeenDragged||(null==i?void 0:i.drag)||!1}),n.childId){let t=e,i=o;for(;;){const e=P.get(t);if(!(null==e?void 0:e.childId))break;const n=P.get(e.childId);if(!(null==n?void 0:n.offsetFromParent))break;const o={x:i.x+n.offsetFromParent.x,y:i.y+n.offsetFromParent.y};P.set(e.childId,{...n,position:o,hasBeenDragged:!0}),t=e.childId,i=o}}if(n.parentId&&n.offsetFromParent){const t=v();let i=e,r=n;for(;r.parentId&&r.offsetFromParent;){const n=P.get(r.parentId);if(!n)break;const d=i===e?o:P.get(i).position,s={x:d.x-r.offsetFromParent.x,y:d.y-r.offsetFromParent.y};"animated"===t.parentChild.movementMode?Y.set(r.parentId,s):P.set(r.parentId,{...n,position:s,hasBeenDragged:!0}),i=r.parentId,r=n}}O()}function Z(e,t){const i=P.get(e);i&&(P.set(e,{...i,...t}),O())}function ee(e){var t;const i=P.get(e);if(!i)return;const n=Math.max(...Array.from(P.values()).map(e=>e.zIndex),0);if(i.parentId){const o=P.get(i.parentId);o&&o.zIndex<n&&P.set(i.parentId,{...o,zIndex:n+2});const r=(null==(t=P.get(i.parentId))?void 0:t.zIndex)??n+2;return i.zIndex<=r&&P.set(e,{...i,zIndex:r+2}),void O()}if(i.zIndex<n&&(P.set(e,{...i,zIndex:n+2}),O()),i.childId){const t=P.get(i.childId),n=P.get(e);t&&n&&t.zIndex<=n.zIndex&&(P.set(i.childId,{...t,zIndex:n.zIndex+2}),O())}}function te(e,t,i){const n=t.getBoundingClientRect();F.set(e,{x:n.left+n.width/2,y:n.top+n.height/2});const o=v();(null==i?void 0:i.parentId)&&o.features.parentChild&&s.set(X,{parentId:i.parentId,childId:e},!0),s.get(T).includes(e)||s.set(T,[...s.get(T),e],!0),O();const r=P.get(e);if(r){if(r.isOpen&&!r.isMinimized&&!r.isHiddenWithParent)return s.set(T,s.get(T).filter(t=>t!==e),!0),function(e){P.get(e)&&(s.get(W).includes(e)||s.get(A).includes(e)||(s.set(W,[...s.get(W),e],!0),O()))}(e),void ee(e);if(r.isMinimized)return s.set(T,s.get(T).filter(t=>t!==e),!0),void U(e);P.set(e,{...r,isOpen:!0}),ee(e)}}function ie(e,t=!1){const i=P.get(e);i&&(ye(e),t?s.set(H,[...s.get(H),e],!0):s.set(E,[...s.get(E),e],!0),O(),i.childId&&ie(i.childId,t))}function ne(){Array.from(P.keys()).forEach(e=>ie(e,!0))}function oe(e,t,i){const n=v();if(i&&!F.has(e.id)){const t=i.getBoundingClientRect();F.set(e.id,{x:t.left+t.width/2,y:t.top+t.height/2})}const o={id:e.id,title:e.title??"",icon:e.icon??"",isOpen:!0,isMinimized:!1,isHiddenWithParent:!1,isTransparent:e.isTransparent??!1,isRejected:!1,position:e.position??null,size:e.size??null,hasBeenDragged:e.hasBeenDragged??!1,dockPosition:e.dockPosition??-1,glow:e.glow??null};if(!n.features.parentChild){G(o);const t=P.get(e.id);return t&&P.set(e.id,{...t,isOpen:!0}),s.set(T,[...s.get(T),e.id],!0),O(),void ee(e.id)}const r=P.get(t);if(!r)return;r.childId&&ie(r.childId,!0),G({...o,parentId:t});const d=P.get(e.id);d&&P.set(e.id,{...d,isOpen:!0,parentId:t}),s.set(T,[...s.get(T),e.id],!0),O(),ee(e.id),s.set(X,{parentId:t,childId:e.id},!0)}function re(e){return s.get(R).includes(e)}function de(e){return P.get(e)}function se(){return s.get(C)}function ae(e){return s.get(T).includes(e)}function le(e){return s.get(E).includes(e)}function ce(e){return s.get(H).includes(e)}function ge(e){return!!s.get(H).includes(e)&&(s.set(H,s.get(H).filter(t=>t!==e),!0),!0)}function ue(e){return s.get(S).includes(e)}function he(e){return s.get(L).includes(e)}function pe(e){const t=P.get(e);return void 0!==t&&t.isOpen&&!t.isMinimized&&!t.isHiddenWithParent}function fe(e){return P.has(e)}function me(){return{get modals(){return P},get pendingMinimize(){return s.get(R)},get pendingOpen(){return s.get(T)},get pendingClose(){return s.get(E)},get pendingRestore(){return s.get(S)},get dockOrder(){return s.get(j)}}}function ve(e){N.has(e)?N.delete(e):N.add(e);const t=P.get(e);t&&(P.set(e,{...t,isTransparent:N.has(e)}),O())}function we(e){N.delete(e);const t=P.get(e);t&&(P.set(e,{...t,isTransparent:!1}),O())}function ye(e){Y.delete(e)}const xe=Symbol("modal-render-icon"),ze=Symbol("modal-id");function Ie(){return v().features.animations}const be=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function _e(e){return Array.from(e.querySelectorAll(be)).filter(e=>null!==e.offsetParent||"A"===e.tagName)}function Me(e,t){if("Tab"!==e.key)return;const i=_e(t);if(0===i.length)return void e.preventDefault();const n=i[0],o=i[i.length-1],r=document.activeElement;e.shiftKey?r===n&&(o.focus(),e.preventDefault()):r===o&&(n.focus(),e.preventDefault())}function ke(e){const t=_e(e);return t.length>0&&(t[0].focus(),!0)}const De="modal-portal";var Pe=s.from_html('<div style="display: contents;"><!></div>');function Ce(t,i){s.push(i,!0);let n=s.prop(i,"target",3,"body"),o=null,r=null;const{mount:d}={mount:function(e,t=null){const i=function(e){if("undefined"==typeof window)return null;if(e instanceof HTMLElement)return e;if("string"==typeof e){const t=document.querySelector(e);if(t)return t;if(e.startsWith("#")){const t=e.slice(1),i=document.createElement("div");return i.id=t,document.body.appendChild(i),i}}let t=document.getElementById(De);return t||(t=document.createElement("div"),t.id=De,document.body.appendChild(t)),t}(t);return i?(i.appendChild(e),()=>{e.parentNode===i&&i.removeChild(e),i.id!==De&&0===i.children.length&&i.parentNode&&i.parentNode.removeChild(i)}):()=>{}}};e(()=>(o&&(r=d(o,n())),()=>{null==r||r()}));var a=Pe(),l=s.child(a);s.snippet(l,()=>i.children),s.reset(a),s.bind_this(a,e=>o=e,()=>o),s.append(t,a),s.pop()}var Be=s.from_html('<button type="button" aria-label="Minimize"></button>'),Oe=s.from_html('<button type="button" class="modal-header-light modal-header-light-style" aria-label="Toggle style"></button>'),Re=s.from_html('<div class="modal-header-icon"><!></div>'),Te=s.from_html('<div class="modal-header-icon"><!></div>'),Ee=s.from_html('<h2 class="modal-header-title"> </h2>'),He=s.from_html('<h2 class="modal-header-title"> </h2>'),Se=s.from_html('<div class="modal-header-traffic-lights"><button type="button" class="modal-header-light modal-header-light-close" aria-label="Close"></button> <!> <!></div> <div class="modal-header-mac-center"><!> <div class="modal-header-title-group"><!></div></div> <div class="modal-header-mac-spacer"></div>',1),Le=s.from_html('<div class="modal-header-icon"><!></div>'),We=s.from_html('<div class="modal-header-icon"><!></div>'),Ae=s.from_html('<h2 class="modal-header-title"> </h2>'),$e=s.from_html('<h2 class="modal-header-title"> </h2>'),Fe=s.from_html('<button type="button" class="modal-header-btn-windows modal-header-btn-windows-style" aria-label="Toggle style">◇</button>'),Xe=s.from_html('<button type="button" aria-label="Minimize">–</button>'),Ye=s.from_html('<div class="modal-header-title-group"><!> <!></div> <div class="modal-header-actions"><!> <!> <button type="button" class="modal-header-btn-windows modal-header-btn-windows-close" aria-label="Close">×</button></div>',1),qe=s.from_html("<header><!></header>");s.delegate(["pointerdown","click"]);var Ne=s.from_html("<div></div>"),je=s.from_html('<div class="modal-resize-handles"></div>');s.delegate(["pointerdown"]);var Ge=s.from_html('<div class="modal-footer"><!></div>'),Ke=s.from_html("<div></div>"),Ve=s.from_html('<div role="dialog" aria-modal="true" tabindex="-1"><!> <div class="modal-body"><!></div> <!> <!> <!></div>');function Ue(r,d){s.push(d,!0);let a=s.prop(d,"maxWidth",3,"600px"),l=s.prop(d,"autoOpen",3,!1),c=s.prop(d,"closeOnEscape",3,!0),g=s.state(!1);e(()=>{G({id:d.id,title:d.title,icon:d.icon??"",isOpen:l(),isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:d.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),s.set(g,!0)}),o(()=>{K(d.id)});const u=s.derived(()=>{if(!s.get(g))return!1;se();const e=de(d.id);return!!e&&(e.isOpen||e.isMinimized||ae(d.id)||le(d.id)||re(d.id))});var h=s.comment(),f=s.first_child(h),w=r=>{!function(r,d){s.push(d,!0);let a=s.prop(d,"maxWidth",3,"600px"),l=s.prop(d,"autoOpen",3,!1),c=s.prop(d,"closeOnEscape",3,!0),g=s.prop(d,"skipRegistration",3,!1);i(ze,d.id);const u=v().portalTarget;function h(e){var t,i;return(null==(i=null==(t=d.config)?void 0:t.features)?void 0:i[e])??function(e){return p.features[e]}(e)}const f=s.derived(()=>(m(),h("drag"))),w=s.derived(()=>(m(),h("minimize"))),y=s.derived(()=>(m(),!h("dock"))),x=s.derived(()=>(m(),h("transparency"))),z=s.derived(()=>(m(),h("resize"))),I=s.derived(()=>{var e,t;return m(),(null==(t=null==(e=d.config)?void 0:e.appearance)?void 0:t.headerLayout)??v().appearance.headerLayout});let M=s.state(null),C=s.state(!1),B=s.state(!1),H=s.state(!1),q=s.state(!1),N=s.state(!1);const j=s.derived(()=>(se(),de(d.id))),U=s.derived(()=>s.get(j)&&(s.get(j).isOpen||le(d.id))&&(!s.get(j).isMinimized||re(d.id))&&!s.get(j).isHiddenWithParent),Q=s.derived(()=>{var e;return!!(null==(e=s.get(j))?void 0:e.childId)}),te=s.derived(()=>{var e;return!!(null==(e=s.get(j))?void 0:e.parentId)}),ne=s.derived(()=>s.get(Q)||s.get(B)),oe=s.derived(()=>!!d.glow),pe=s.derived(()=>`modal-title-${d.id}`),fe=s.derived(()=>{var e;return(null==(e=s.get(j))?void 0:e.zIndex)??1e3}),me=function(e={x:0,y:0}){const t=s.proxy({...e}),i=s.proxy({isDragging:!1,startX:0,startY:0,initialX:0,initialY:0,hasBeenDragged:!1});return{get position(){return t},get hasBeenDragged(){return i.hasBeenDragged},get isDragging(){return i.isDragging},onPointerDown:function(e,n){if(0===e.button){if(!i.hasBeenDragged){const e=n.getBoundingClientRect();t.x=e.left,t.y=e.top}i.isDragging=!0,i.startX=e.clientX,i.startY=e.clientY,i.initialX=t.x,i.initialY=t.y,n.setPointerCapture(e.pointerId)}},onPointerMove:function(e,n,o){if(!i.isDragging)return;const r=e.clientX-i.startX,d=e.clientY-i.startY,s=b(i.initialX+r,i.initialY+d,o.width,o.height);t.x=s.x,t.y=s.y,i.hasBeenDragged=!0},onPointerUp:function(e,t){i.isDragging&&(i.isDragging=!1,t.releasePointerCapture(e.pointerId))},setPosition:function(e){t.x=e.x,t.y=e.y},setHasBeenDragged:function(e){i.hasBeenDragged=e},reset:function(){t.x=e.x,t.y=e.y,i.hasBeenDragged=!1}}}({x:0,y:0});let ye=s.state(!1);const be=function(e,t,i){let n=s.state(!1),o=s.state(""),r=s.state(s.proxy({width:0,height:0})),a=s.state(!1),l=s.state(!1),c={x:0,y:0,width:0,height:0,posX:0,posY:0},g=null;function u(d,l){d.preventDefault(),d.stopPropagation();const u=e();if(!u)return;const f=u.getBoundingClientRect();me.hasBeenDragged||(i({x:f.left,y:f.top}),me.setHasBeenDragged(!0)),s.get(a)||(s.set(r,{width:f.width,height:f.height},!0),s.set(a,!0));const m=t();s.set(n,!0),s.set(o,l,!0),g=d.pointerId,c={x:d.clientX,y:d.clientY,width:s.get(r).width,height:s.get(r).height,posX:m.x,posY:m.y,centerX:m.x+s.get(r).width/2,centerY:m.y+s.get(r).height/2},window.addEventListener("pointermove",h),window.addEventListener("pointerup",p),window.addEventListener("pointercancel",p)}function h(e){if(e.pointerId!==g)return;const t=e.clientX-c.x,n=e.clientY-c.y,d=window.innerWidth,a=window.innerHeight;let l=c.width,u=c.height,h=c.posX,p=c.posY;if(s.get(o).includes("e")){const e=d-h;l=Math.max(280,Math.min(c.width+t,e))}if(s.get(o).includes("w")){const e=c.width-280,i=Math.min(t,e);l=c.width-i,h=c.posX+i}if(s.get(o).includes("s")){const e=a-p;u=Math.max(200,Math.min(c.height+n,e))}if(s.get(o).includes("n")){const e=c.height-200,t=Math.min(n,e);u=c.height-t,p=c.posY+t}const f=_(h,p,l,u);s.set(r,{width:f.width,height:f.height},!0),i({x:f.x,y:f.y})}function p(e){e.pointerId===g&&(s.set(n,!1),g=null,window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),s.set(l,!0),((e,t)=>{const i=de(d.id);if(null==i?void 0:i.parentId){const e=de(i.parentId),n=document.querySelector(`[data-modal-id="${i.parentId}"]`);if(e&&n){const i=e.position??{x:n.getBoundingClientRect().left,y:n.getBoundingClientRect().top},o=e.size??{width:n.offsetWidth,height:n.offsetHeight},r={x:i.x+(o.width-t.width)/2,y:i.y+(o.height-t.height)/2};s.set(ye,!0),me.setPosition(r);const a={x:r.x-i.x,y:r.y-i.y};return Z(d.id,{position:r,size:t,hasBeenDragged:!0,offsetFromParent:a}),void setTimeout(()=>{s.set(ye,!1)},200)}}Z(d.id,{position:e,size:t,hasBeenDragged:!0})})(t(),s.get(r)),setTimeout(()=>{s.set(l,!1)},0))}const f={startResize:u};return{get isResizing(){return s.get(n)},get resizeDirection(){return s.get(o)},get size(){return s.get(r)},get hasBeenResized(){return s.get(a)},get isActive(){return s.get(n)},get justFinishedResizing(){return s.get(l)},start:u,setHasBeenResized:()=>{},setSize:function(e){s.set(r,e,!0),s.set(a,!0)},reset:function(){s.set(a,!1),s.set(r,{width:0,height:0},!0)},constrainToViewport:function(){const n=t(),o=e();if(!o)return;const d=_(n.x,n.y,s.get(r).width||o.offsetWidth,s.get(r).height||o.offsetHeight);s.set(r,{width:d.width,height:d.height},!0),i({x:d.x,y:d.y})},handlers:f}}(()=>s.get(M),()=>me.position,e=>me.setPosition(e)),_e=function(e,t,i,n,o,r,a,l,c){let g=s.state(!1),u=s.state(!1),h=s.state(!1),p=s.state(!1),f=s.state(null),m=s.state(null),v=null,w=null;function y(){w&&(clearTimeout(w),w=null)}function x(){const e=d.id,t=document.querySelector(`.modal-dock-item[data-modal-id="${e}"]`),i=document.querySelector('[data-dock-container="true"]'),n=t||i;if(n){const e=n.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top+e.height/2}}return{x:window.innerWidth/2,y:window.innerHeight-40}}return s.user_effect(()=>()=>{y(),s.set(g,!1),s.set(u,!1),s.set(h,!1),s.set(p,!1),s.set(f,null),s.set(m,null),v=null}),{get isMinimizing(){return s.get(g)},get isRestoring(){return s.get(u)},get isOpening(){return s.get(h)},get isClosing(){return s.get(p)},get animationTransform(){return s.get(f)},get pendingOpenSource(){return s.get(m)},startMinimize:function(e,d){const p=t();if(s.get(g)||!p)return;if(s.set(u,!1),s.set(h,!1),y(),!Ie()){const e=p.getBoundingClientRect();let t=o()?i():{x:e.left,y:e.top},s=a()?l():{width:e.width,height:e.height};return o()||(n(t),r(!0)),void(d?d():c(t,!0,s))}const m=p.getBoundingClientRect(),v=m.left+m.width/2,z=m.top+m.height/2;let I=o()?i():{x:m.left,y:m.top},b=a()?l():{width:m.width,height:m.height};o()||(n(I),r(!0));const _=e??x(),M=_.x-m.left,k=_.y-m.top,D={x:_.x-v,y:_.y-z,originX:M,originY:k};s.set(f,D,!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{s.set(g,!0)})}),w=setTimeout(()=>{d?d():c(I,!0,b)},500)},startRestore:function(e,t){if(!Ie()){const t=e||{x:window.innerWidth/2,y:window.innerHeight/2};return n(t),void r(!0)}const i=x(),o=e||{x:window.innerWidth/2,y:window.innerHeight/2},d=t||{width:480,height:400};n(o),r(!0);const a=o.x+d.width/2,l=o.y+d.height/2,c=i.x-o.x,g=i.y-o.y;s.set(f,{x:i.x-a,y:i.y-l,originX:c,originY:g},!0),s.set(u,!0),setTimeout(()=>{s.set(u,!1),s.set(f,null)},400)},startClose:function(e){s.get(p)||s.get(g)||(Ie()?(v=e,s.set(p,!0),setTimeout(()=>{s.set(p,!1),v&&(v(),v=null)},250)):e())},setPendingOpenSource:function(e){s.set(m,e,!0)},tryStartOpenAnimation:function(){const e=t();if(!s.get(m)||!e||s.get(h))return!1;if(!Ie())return s.set(m,null),!1;const d=s.get(m);s.set(m,null);const a=e.getBoundingClientRect(),l=o()?i():{x:a.left,y:a.top},c=a.width,g=a.height,u=l.x+c/2,p=l.y+g/2;o()||(n(l),r(!0));const v=d.x-l.x,w=d.y-l.y;return s.set(f,{x:d.x-u,y:d.y-p,originX:v,originY:w},!0),s.set(h,!0),setTimeout(()=>{s.set(h,!1),s.set(f,null)},400),!0},forceClearMinimize:function(){y(),s.set(g,!1),s.set(f,null)}}}(0,()=>s.get(M),()=>me.position,e=>me.setPosition(e),()=>me.hasBeenDragged,e=>me.setHasBeenDragged(e),()=>be.hasBeenResized,()=>be.size,(e,t,i)=>{Z(d.id,{position:e,size:i,hasBeenDragged:t}),V(d.id)}),{trapFocus:De,focusFirstElement:Pe}={trapFocus:Me,focusFirstElement:ke},Ue=s.derived(()=>_e.isMinimizing||_e.isRestoring||_e.isOpening||_e.isClosing),Qe=s.derived(()=>(he(d.id)||ue(d.id))&&!_e.isRestoring);let Je=s.state(!1);const Ze=s.derived(()=>_e.isRestoring||_e.isOpening||s.get(Je)),et=s.derived(()=>s.get(U)&&!me.hasBeenDragged&&!s.get(Ue)&&!_e.pendingOpenSource&&!s.get(Qe)),tt=s.derived(()=>{const e=[];return e.push(`z-index: ${s.get(fe)};`),_e.animationTransform?(e.push(`left: ${me.position.x}px; top: ${me.position.y}px;`),e.push(`--genie-origin-x: ${_e.animationTransform.originX}px;`),e.push(`--genie-origin-y: ${_e.animationTransform.originY}px;`),e.push(`--genie-translate-x: ${_e.animationTransform.x}px;`),e.push(`--genie-translate-y: ${_e.animationTransform.y}px;`)):me.hasBeenDragged&&e.push(`left: ${me.position.x}px; top: ${me.position.y}px; transform: none;`),be.hasBeenResized?e.push(`width: ${be.size.width}px; height: ${be.size.height}px; max-width: none; max-height: none;`):(d.preferredHeight&&e.push(`min-height: ${d.preferredHeight};`),a()&&e.push(`max-width: ${a()};`)),s.get(oe)&&d.glow&&(e.push(`--modal-glow-color: ${d.glow.color};`),e.push(`--modal-glow-intensity: ${d.glow.intensity};`)),e.join(" ")});function it(){s.get(w)&&V(d.id)}function nt(){var e;ce(d.id)&&ge(d.id),ie(d.id),null==(e=d.onClose)||e.call(d)}function ot(){ve(d.id)}function rt(e){s.get(f)&&s.get(M)&&me.onPointerDown(e,s.get(M))}function dt(e){c()&&"Escape"===e.key&&function(e){const t=P.get(e);if(!t)return!1;const i=Math.max(...Array.from(P.values()).map(e=>e.zIndex),0);return t.zIndex===i&&!t.isMinimized&&!t.isHiddenWithParent}(d.id)&&(e.stopPropagation(),nt())}function st(e){if(!s.get(M))return;const t=me.isDragging,i=be.hasBeenResized?be.size:{width:s.get(M).offsetWidth,height:s.get(M).offsetHeight};me.onPointerMove(e,s.get(M),i),me.isDragging&&t&&J(d.id,me.position,{drag:!0})}function at(e){if(!s.get(M))return;const t=me.isDragging;me.onPointerUp(e,s.get(M)),t&&!be.justFinishedResizing&&(J(d.id,me.position,{drag:!0}),function(e){const t=v();if("animated"!==t.parentChild.movementMode)return;const i=t.parentChild.animationDuration,n=[];let o=e;for(;;){const e=P.get(o);if(!(null==e?void 0:e.parentId))break;n.push({parentId:e.parentId,childId:o}),o=e.parentId}n.forEach(({parentId:e,childId:t},n)=>{setTimeout(()=>{const n=P.get(t),o=P.get(e);if(!(null==n?void 0:n.position)||!n.offsetFromParent||!o)return;const r={x:n.position.x-n.offsetFromParent.x,y:n.position.y-n.offsetFromParent.y};Y.set(e,r),function(e){const t=Y.get(e);if(!t)return;const i=P.get(e);i&&(P.set(e,{...i,isAnimatingPosition:!0,position:t}),Y.delete(e),O())}(e),setTimeout(()=>function(e){const t=P.get(e);t&&(P.set(e,{...t,isAnimatingPosition:!1}),O())}(e),i)},n*i)})}(d.id))}function lt(){var e;const t=v();if("smart"!==(null==(e=t.positioning)?void 0:e.strategy))return!1;const i=de(d.id);if(null==i?void 0:i.parentId)return!1;if((null==i?void 0:i.hasBeenDragged)||(null==i?void 0:i.position))return!1;const n=s.get(M)||document.querySelector(`[data-modal-id="${d.id}"]`);if(!n)return!1;const o=n.offsetWidth,r=n.offsetHeight;if(o<=0||r<=0)return!1;const a=t.positioning.modalGap??16,l=function(e){const t=[];for(const[i,n]of P.entries())if(i!==e&&n.isOpen&&!n.isMinimized&&!n.isHiddenWithParent)if(n.position&&n.size)t.push({x:n.position.x,y:n.position.y,width:n.size.width,height:n.size.height});else{const e=document.querySelector(`[data-modal-id="${String(i)}"]`);if(e){const i=e.getBoundingClientRect();t.push({x:i.left,y:i.top,width:i.width,height:i.height})}}return t}(d.id),c=function(e){if("undefined"==typeof document)return[];const t=[];for(const i of e)try{const e=document.querySelectorAll(i);for(const i of e){const e=i.getBoundingClientRect();e.width>0&&e.height>0&&t.push({x:e.left,y:e.top,width:e.width,height:e.height})}}catch{}return t}(t.positioning.avoidElements??[]),g=function(e,t,i,n={}){const{modalGap:o=16,gridResolution:r=10,avoidBounds:d=[],avoidMargin:s=16}=n,a=n.margin??o,l="undefined"!=typeof window?window.innerWidth:1920,c="undefined"!=typeof window?window.innerHeight:1080,g=d.map(e=>({x:e.x-s,y:e.y-s,width:e.width+2*s,height:e.height+2*s})),u={x:(l-e)/2,y:(c-t)/2};if(0===i.length&&0===g.length)return u;const h=a,p=Math.max(a,l-e-a),f=a,m=Math.max(a,c-t-a);if(p<=h||m<=f)return u;const v=k(u.x,u.y,e,t,i,o),w=k(u.x,u.y,e,t,g,0);if(0===v&&0===w)return u;const y=[],x=(p-h)/r,z=(m-f)/r;for(let n=0;n<=r;n++)for(let d=0;d<=r;d++){const r=h+n*x,s=f+d*z,u=k(r,s,e,t,i,o),p=k(r,s,e,t,g,0),m=D(r,s,e,t,l,c,a);y.push({pos:{x:r,y:s},modalOverlap:u,avoidOverlap:p,centerDist:m})}const I=y.filter(e=>0===e.avoidOverlap),b=I.length>0?I:y,_=e*t,M=Math.min(...b.map(e=>e.modalOverlap))/_;return b.sort((e,t)=>{if(0===I.length&&e.avoidOverlap!==t.avoidOverlap)return e.avoidOverlap-t.avoidOverlap;const i=e.modalOverlap/_,n=t.modalOverlap/_;if(M<.3){const o=.3,r=i<=o,d=n<=o;if(r&&d)return e.centerDist+.3*i-(t.centerDist+.3*n);if(r)return-1;if(d)return 1}return.6*i+.4*e.centerDist-(.6*n+.4*t.centerDist)}),b[0].pos}(o,r,l,{modalGap:a,avoidBounds:c});if(k(g.x,g.y,o,r,l,a)/(o*r)>.1&&l.length>0){const e=function(e){const t=[];for(const[i,n]of P.entries())if(i!==e&&n.isOpen&&!n.isMinimized&&!n.isHiddenWithParent&&!n.parentId)if(n.position&&n.size)t.push({id:String(i),x:n.position.x,y:n.position.y,width:n.size.width,height:n.size.height});else{const e=document.querySelector(`[data-modal-id="${String(i)}"]`);if(e){const n=e.getBoundingClientRect();t.push({id:String(i),x:n.left,y:n.top,width:n.width,height:n.height})}}return t}(d.id),t=function(e,t,i,n={}){const{modalGap:o=16}=n,r=n.margin??o,d="undefined"!=typeof window?window.innerWidth:1920,s="undefined"!=typeof window?window.innerHeight:1080,a=i.reduce((e,t)=>e+t.width,0)+e,l=i.length*o,c=d-2*r;if(a+l>c)return null;const g=c-a-l;i.length;const u=g/2,h=d/2,p=[...i.map(e=>({id:e.id,width:e.width,height:e.height,currentX:e.x+e.width/2,currentY:e.y,isNew:!1})),{id:"__new__",width:e,height:t,currentX:h,currentY:(s-t)/2,isNew:!0}];p.sort((e,t)=>e.currentX-t.currentX);let f=r+u;const m=new Map;let v=null;for(const e of p){const t=f;if(e.isNew)v={x:Math.round(t),y:Math.round(e.currentY)};else{const n=i.find(t=>t.id===e.id);Math.abs(t-n.x)>5&&m.set(e.id,{x:Math.round(t),y:Math.round(n.y)})}f+=e.width+o}return v?{newModalPosition:v,existingModalMoves:m}:null}(o,r,e,{modalGap:a});if(t&&t.existingModalMoves.size>0)return function(e){const t=v().parentChild.animationDuration;for(const[t,i]of e){const e=P.get(t);e&&P.set(t,{...e,position:i,isAnimatingPosition:!0,hasBeenDragged:!0})}O(),setTimeout(()=>{for(const t of e.keys()){const e=P.get(t);e&&P.set(t,{...e,isAnimatingPosition:!1})}O()},t)}(t.existingModalMoves),me.setPosition(t.newModalPosition),me.setHasBeenDragged(!0),J(d.id,t.newModalPosition,{size:{width:o,height:r}}),!0}return me.setPosition(g),me.setHasBeenDragged(!0),J(d.id,g,{size:{width:o,height:r}}),!0}function ct(){n().then(()=>n()).then(()=>{let e=0;const t=()=>{e+=1,lt()||e>5||requestAnimationFrame(t)};s.get(M)?t():requestAnimationFrame(t)})}e(()=>{var e;function t(){const e=de(d.id);if(!(null==e?void 0:e.position)||!s.get(M))return;if(e.parentId)return;const t=be.hasBeenResized?be.size.width:s.get(M).offsetWidth,i=be.hasBeenResized?be.size.height:s.get(M).offsetHeight;if(t<=0||i<=0)return;const n=b(e.position.x,e.position.y,t,i);(Math.abs(n.x-e.position.x)>1||Math.abs(n.y-e.position.y)>1)&&(me.setPosition(n),J(d.id,n))}return g()||(e=l(),G({id:d.id,title:d.title,icon:d.icon??"",isOpen:e,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:d.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),e&&ee(d.id)),l()&&(n().then(()=>{s.get(M)&&Pe(s.get(M))}),ct()),window.addEventListener("pointermove",st),window.addEventListener("pointerup",at),window.addEventListener("resize",t),()=>{window.removeEventListener("pointermove",st),window.removeEventListener("pointerup",at),window.removeEventListener("resize",t)}}),o(()=>{we(d.id),g()||K(d.id)}),s.user_effect(()=>{se();const e=de(d.id);if(e){if(s.set(C,e.isTransparent,!0),!me.isDragging&&!be.isResizing&&e.position){const t=me.position,i=e.position;(Math.abs(t.x-i.x)>.5||Math.abs(t.y-i.y)>.5)&&(me.setPosition(i),e.hasBeenDragged&&me.setHasBeenDragged(!0))}n().then(()=>function(){var e,t;if(!de(d.id))return;if(ce(d.id))return ge(d.id),void(null==(e=d.onClose)||e.call(d));if(re(d.id)&&!s.get(q)){if(s.set(q,!0),s.get($),s.set($,null),s.get(M)){const e=s.get(M).getBoundingClientRect(),t=me.hasBeenDragged?me.position:{x:e.left,y:e.top},i=be.hasBeenResized?be.size:{width:e.width,height:e.height};Z(d.id,{position:t,size:i,hasBeenDragged:!0})}_e.startMinimize(void 0,()=>{var e;e=d.id,s.get(R).includes(e)&&s.set(R,s.get(R).filter(t=>t!==e),!0),s.set(q,!1)})}if(ue(d.id)){t=d.id,s.get(S).includes(t)&&s.set(S,s.get(S).filter(e=>e!==t),!0);const e=de(d.id);_e.startRestore((null==e?void 0:e.position)??void 0,(null==e?void 0:e.size)??void 0),n().then(()=>{s.get(M)&&Pe(s.get(M))})}if(he(d.id)){!function(e){s.get(L).includes(e)&&s.set(L,s.get(L).filter(t=>t!==e),!0)}(d.id);const e=de(d.id);_e.startRestore((null==e?void 0:e.position)??void 0,(null==e?void 0:e.size)??void 0)}if(le(d.id)&&(function(e){s.get(E).includes(e)&&s.set(E,s.get(E).filter(t=>t!==e),!0)}(d.id),_e.startClose(()=>{var e;we(d.id),function(e){const t=P.get(e);if(t){if(t.parentId){const i=P.get(t.parentId);i&&i.childId===e&&P.set(t.parentId,{...i,childId:void 0,lastChildId:e})}P.set(e,{...t,isOpen:!1,isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,position:null,size:null,hasBeenDragged:!1,parentId:void 0,childId:void 0,offsetFromParent:void 0}),O()}}(d.id),null==(e=d.onClose)||e.call(d)})),ae(d.id)){!function(e){s.get(T).includes(e)&&s.set(T,s.get(T).filter(t=>t!==e),!0)}(d.id);const e=function(e){const t=F.get(e);return t&&F.delete(e),t??null}(d.id)||d.openSourcePosition||null;e?(_e.setPendingOpenSource(e),n().then(()=>n()).then(()=>{lt(),_e.tryStartOpenAnimation()})):ct(),n().then(()=>{s.get(M)&&Pe(s.get(M))})}(function(e){return s.get(W).includes(e)})(d.id)&&(function(e){s.get(W).includes(e)&&s.set(W,s.get(W).filter(t=>t!==e),!0)}(d.id),function(e){s.get(A).includes(e)||s.set(A,[...s.get(A),e],!0)}(d.id),s.set(N,!0),setTimeout(()=>{s.set(N,!1),function(e){s.set(A,s.get(A).filter(t=>t!==e),!0)}(d.id)},600));const i=function(e){if(!s.get(X)||s.get(X).childId!==e)return null;const t=s.get(X);return s.set(X,null),t}(d.id);var o;i&&s.get(M)&&(o=i.parentId,n().then(()=>n()).then(()=>{let e=0;const t=()=>{e+=1;const i=function(e){var t,i;const n=de(e);if(!n)return!1;const o=s.get(M)||document.querySelector(`[data-modal-id="${d.id}"]`),r=document.querySelector(`[data-modal-id="${e}"]`),a=null==r?void 0:r.getBoundingClientRect(),l=n.position??(a?{x:a.left,y:a.top}:null);if(!l||!o)return!1;const c=(null==(t=n.size)?void 0:t.width)??(null==r?void 0:r.offsetWidth)??(null==a?void 0:a.width)??480,g=(null==(i=n.size)?void 0:i.height)??(null==r?void 0:r.offsetHeight)??(null==a?void 0:a.height)??400,u=o.offsetWidth,h=o.offsetHeight;if(c<=0||g<=0||u<=0||h<=0)return!1;const p={x:l.x+(c-u)/2,y:l.y+(g-h)/2};return me.setPosition(p),me.setHasBeenDragged(!0),J(d.id,p,{size:{width:u,height:h}}),n.position&&n.size||!a||J(e,{x:a.left,y:a.top},{size:{width:c,height:g}}),function(e,t){if(!v().features.parentChild)return;const i=P.get(e),n=P.get(t);if(!i||!n)return;let o={x:40,y:40};i.position&&n.position&&(o={x:n.position.x-i.position.x,y:n.position.y-i.position.y});const r=Math.max(n.zIndex,i.zIndex+1);P.set(e,{...i,childId:t,lastChildId:t}),P.set(t,{...n,parentId:e,offsetFromParent:o,zIndex:r}),O()}(e,d.id),!0}(o);i||e>5||requestAnimationFrame(t)};s.get(M)?t():requestAnimationFrame(t)}))}())}}),s.user_effect(()=>{const e=de(d.id);e&&e.isTransparent!==s.get(C)&&s.set(C,e.isTransparent,!0)}),s.user_effect(()=>{if(s.get(U)&&s.get(M)){const e=e=>function(e){s.get(M)&&De(e,s.get(M))}(e);return s.get(M).addEventListener("keydown",e),()=>{var t;return null==(t=s.get(M))?void 0:t.removeEventListener("keydown",e)}}}),s.user_effect(()=>{!s.get(U)&&_e.isMinimizing&&_e.forceClearMinimize()}),s.user_effect(()=>{_e.isRestoring||_e.isOpening?s.set(Je,!0):s.get(Je)&&requestAnimationFrame(()=>{s.set(Je,!1)})}),s.user_effect(()=>{s.get(H)&&!s.get(Q)&&(s.set(B,!0),setTimeout(()=>{s.set(B,!1)},200)),s.set(H,s.get(Q),!0)});var gt=s.comment(),ut=s.first_child(gt),ht=e=>{Ce(e,{get target(){return u},children:(e,i)=>{var n=Ve();let o;n.__keydown=dt;var r=s.child(n);{let e=s.derived(()=>s.get(f)?rt:void 0);!function(e,i){s.push(i,!0);let n=s.prop(i,"isTransparent",3,!1),o=s.prop(i,"headerLayout",3,"macos"),r=s.prop(i,"minimizable",3,!0),d=s.prop(i,"minimizeDisabled",3,!1),a=s.prop(i,"transparencyEnabled",3,!0);const l=t(xe),c=s.derived(()=>null==l?void 0:l()),g=s.derived(()=>"macos"===o());var u=qe();let h;u.__pointerdown=function(e){var t;e.target.closest("button")||null==(t=i.onStartDrag)||t.call(i,e)};var p=s.child(u),f=e=>{var t=Se(),n=s.first_child(t),o=s.child(n);o.__click=function(...e){var t;null==(t=i.onClose)||t.apply(this,e)};var l=s.sibling(o,2),g=e=>{var t=Be();let n;t.__click=function(...e){var t;null==(t=d()?void 0:i.onMinimize)||t.apply(this,e)},s.template_effect(()=>{n=s.set_class(t,1,"modal-header-light modal-header-light-minimize",null,n,{"modal-header-light-disabled":d()}),t.disabled=d(),s.set_attribute(t,"title",d()?"Enable dock to minimize":void 0)}),s.append(e,t)};s.if(l,e=>{r()&&e(g)});var u=s.sibling(l,2),h=e=>{var t=Oe();t.__click=function(...e){var t;null==(t=i.onToggleStyle)||t.apply(this,e)},s.append(e,t)};s.if(u,e=>{a()&&e(h)}),s.reset(n);var p=s.sibling(n,2),f=s.child(p),m=e=>{var t=Re(),n=s.child(t);s.snippet(n,()=>i.customIcon),s.reset(t),s.append(e,t)},v=e=>{var t=s.comment(),n=s.first_child(t),o=e=>{var t=Te(),n=s.child(t);s.snippet(n,()=>s.get(c),()=>i.icon),s.reset(t),s.append(e,t)};s.if(n,e=>{i.icon&&s.get(c)&&e(o)},!0),s.append(e,t)};s.if(f,e=>{i.customIcon?e(m):e(v,!1)});var w=s.sibling(f,2),y=s.child(w),x=e=>{var t=Ee(),n=s.child(t,!0);s.reset(t),s.template_effect(()=>{s.set_attribute(t,"id",i.titleId),s.set_text(n,i.title)}),s.append(e,t)},z=e=>{var t=He(),n=s.child(t,!0);s.reset(t),s.template_effect(()=>s.set_text(n,i.title)),s.append(e,t)};s.if(y,e=>{i.titleId?e(x):e(z,!1)}),s.reset(w),s.reset(p),s.next(2),s.append(e,t)},m=e=>{var t=Ye(),n=s.first_child(t),o=s.child(n),l=e=>{var t=Le(),n=s.child(t);s.snippet(n,()=>i.customIcon),s.reset(t),s.append(e,t)},g=e=>{var t=s.comment(),n=s.first_child(t),o=e=>{var t=We(),n=s.child(t);s.snippet(n,()=>s.get(c),()=>i.icon),s.reset(t),s.append(e,t)};s.if(n,e=>{i.icon&&s.get(c)&&e(o)},!0),s.append(e,t)};s.if(o,e=>{i.customIcon?e(l):e(g,!1)});var u=s.sibling(o,2),h=e=>{var t=Ae(),n=s.child(t,!0);s.reset(t),s.template_effect(()=>{s.set_attribute(t,"id",i.titleId),s.set_text(n,i.title)}),s.append(e,t)},p=e=>{var t=$e(),n=s.child(t,!0);s.reset(t),s.template_effect(()=>s.set_text(n,i.title)),s.append(e,t)};s.if(u,e=>{i.titleId?e(h):e(p,!1)}),s.reset(n);var f=s.sibling(n,2),m=s.child(f),v=e=>{var t=Fe();t.__click=function(...e){var t;null==(t=i.onToggleStyle)||t.apply(this,e)},s.append(e,t)};s.if(m,e=>{a()&&e(v)});var w=s.sibling(m,2),y=e=>{var t=Xe();let n;t.__click=function(...e){var t;null==(t=d()?void 0:i.onMinimize)||t.apply(this,e)},s.template_effect(()=>{n=s.set_class(t,1,"modal-header-btn-windows",null,n,{"modal-header-btn-windows-disabled":d()}),t.disabled=d(),s.set_attribute(t,"title",d()?"Enable dock to minimize":void 0)}),s.append(e,t)};s.if(w,e=>{r()&&e(y)}),s.sibling(w,2).__click=function(...e){var t;null==(t=i.onClose)||t.apply(this,e)},s.reset(f),s.append(e,t)};s.if(p,e=>{s.get(g)?e(f):e(m,!1)}),s.reset(u),s.template_effect(()=>h=s.set_class(u,1,"modal-header",null,h,{"modal-header-draggable":!!i.onStartDrag,transparent:n()})),s.append(e,u),s.pop()}(r,{get title(){return d.title},get customIcon(){return d.customIcon},get icon(){return d.icon},get isTransparent(){return s.get(C)},get titleId(){return s.get(pe)},get headerLayout(){return s.get(I)},get onStartDrag(){return s.get(e)},onToggleStyle:ot,onMinimize:it,onClose:nt,get minimizable(){return s.get(w)},get minimizeDisabled(){return s.get(y)},get transparencyEnabled(){return s.get(x)}})}var a=s.sibling(r,2),l=s.child(a);s.snippet(l,()=>d.children??s.noop),s.reset(a);var c=s.sibling(a,2),g=e=>{var t=Ge(),i=s.child(t);s.snippet(i,()=>d.footer),s.reset(t),s.append(e,t)};s.if(c,e=>{d.footer&&e(g)});var u=s.sibling(c,2);{let e=s.derived(()=>s.get(z)&&!s.get(Q)?be.handlers.startResize:void 0);!function(e,t){s.push(t,!0);const i=["n","s","e","w","ne","nw","se","sw"];var n=s.comment(),o=s.first_child(n),r=e=>{var n=je();s.each(n,21,()=>i,s.index,(e,i)=>{var n=Ne();n.__pointerdown=e=>function(e,i){var n;null==(n=t.onStartResize)||n.call(t,e,i)}(e,s.get(i)),s.template_effect(()=>s.set_class(n,1,`modal-resize-handle modal-resize-${s.get(i)??""}`)),s.append(e,n)}),s.reset(n),s.append(e,n)};s.if(o,e=>{t.onStartResize&&e(r)}),s.append(e,n),s.pop()}(u,{get onStartResize(){return s.get(e)}})}var h=s.sibling(u,2),p=e=>{var t=Ke();let i;s.template_effect(()=>i=s.set_class(t,1,"modal-child-overlay",null,i,{"modal-overlay-closing":s.get(B)})),s.append(e,t)};s.if(h,e=>{s.get(ne)&&e(p)}),s.reset(n),s.bind_this(n,e=>s.set(M,e),()=>s.get(M)),s.template_effect(()=>{var e;o=s.set_class(n,1,"modal-dialog",null,o,{"modal-dragging":me.isDragging,"modal-resizing":be.isResizing,"modal-positioned":me.hasBeenDragged,"modal-minimizing":_e.isMinimizing,"modal-restoring":_e.isRestoring,"modal-opening":_e.isOpening,"modal-closing":_e.isClosing,"modal-centered":s.get(et),"modal-solid":!s.get(C),"modal-transparent":s.get(C),"modal-glow":s.get(oe),"modal-has-child":s.get(Q),"modal-is-child":s.get(te),"modal-visible-by-animation":s.get(Ze),"modal-animating-to-center":s.get(ye),"modal-animating-position":null==(e=s.get(j))?void 0:e.isAnimatingPosition,"modal-attention":s.get(N)}),s.set_attribute(n,"data-modal-id",d.id),s.set_style(n,s.get(tt)),s.set_attribute(n,"aria-labelledby",s.get(pe))}),s.event("pointerdown",n,()=>ee(d.id),!0),s.append(e,n)},$$slots:{default:!0}})};s.if(ut,e=>{s.get(U)&&e(ht)}),s.append(r,gt),s.pop()}(r,{get id(){return d.id},get title(){return d.title},get icon(){return d.icon},get customIcon(){return d.customIcon},get maxWidth(){return a()},get preferredHeight(){return d.preferredHeight},get autoOpen(){return l()},get openSourcePosition(){return d.openSourcePosition},get glow(){return d.glow},get config(){return d.config},get closeOnEscape(){return c()},get onClose(){return d.onClose},get children(){return d.children},get footer(){return d.footer},skipRegistration:!0})};s.if(f,e=>{s.get(u)&&e(w)}),s.append(r,h),s.pop()}s.delegate(["keydown"]);var Qe=s.from_html('<button type="button" aria-label="Drag dock"></button>'),Je=s.from_html('<span class="modal-dock-item-icon-placeholder"> </span>'),Ze=s.from_html('<span class="modal-dock-item-label"> </span>'),et=s.from_html("<span>+</span>"),tt=s.from_html('<span class="modal-dock-child-indicator"><!></span>'),it=s.from_html('<button><span class="modal-dock-item-icon"><!></span> <!> <span class="modal-dock-item-glow"></span> <!></button>'),nt=s.from_html('<div data-dock-container="true"><div><!> <!></div></div>');function ot(e,i){s.push(i,!0);const n=t(xe),o=s.derived(()=>i.renderIcon??(null==n?void 0:n())),r=me(),d=s.derived(()=>(m(),v())),c=s.derived(()=>z("DOCK")),h=s.derived(()=>s.get(d).dock.position),p=s.derived(()=>s.get(d).dock.labelMode);let f=s.state("horizontal"),w=s.state(s.proxy({x:100,y:100})),y=s.state(null),x=s.state(!1),I={x:0,y:0},_=null;const M=s.derived(()=>(se(),Array.from(r.modals.values()).filter(e=>e.isMinimized).sort((e,t)=>e.dockPosition-t.dockPosition))),k=s.derived(()=>{switch(s.get(h)){case"left":return{x:-20,duration:250,easing:g};case"right":return{x:20,duration:250,easing:g};default:return{y:20,duration:250,easing:g}}});function D(e){var t;"free"===s.get(h)&&(s.set(x,!0),_=e.pointerId,I={x:e.clientX-s.get(w).x,y:e.clientY-s.get(w).y},null==(t=e.currentTarget)||t.setPointerCapture(e.pointerId),window.addEventListener("pointermove",P),window.addEventListener("pointerup",C),window.addEventListener("pointercancel",C))}function P(e){if(e.pointerId!==_||!s.get(y))return;const t=s.get(y).getBoundingClientRect(),i=window.innerWidth-t.width-8,n=window.innerHeight-t.height-8,o=Math.min(Math.max(e.clientX-I.x,8),Math.max(8,i)),r=Math.min(Math.max(e.clientY-I.y,8),Math.max(8,n));s.set(w,{x:Math.round(o),y:Math.round(r)},!0)}function C(e){e.pointerId===_&&(s.set(x,!1),_=null,window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",C),window.removeEventListener("pointercancel",C))}const{addListener:B}=function(){function e(e,t,i){return"undefined"==typeof window?()=>{}:(window.addEventListener(e,t,i),()=>{window.removeEventListener(e,t,i)})}return{addListener:e,addListenerEffect:function(t,i,n){s.user_effect(()=>{if("undefined"!=typeof window)return e(t,i,n)})}}}();function O(){if("free"!==s.get(h)||!s.get(y))return;const e=s.get(y).getBoundingClientRect(),t=b(s.get(w).x,s.get(w).y,e.width,e.height);t.x===s.get(w).x&&t.y===s.get(w).y||s.set(w,{x:Math.round(t.x),y:Math.round(t.y)},!0)}s.user_effect(()=>{"undefined"!=typeof window&&B("resize",O)});var R={setDockOrientation:function(e){s.set(f,e,!0)},setDockFreePosition:function(e){s.set(w,e,!0)},getDockState:function(){return{dockPosition:s.get(h),dockOrientation:s.get(f),dockFreePosition:s.get(w),dockLabelMode:s.get(p)}}};return Ce(e,{get target(){return s.get(d).portalTarget},children:(e,t)=>{var i=nt();let n,d;var g=s.child(i);let m;var v=s.child(g),z=e=>{var t=Qe();let i;t.__pointerdown=D,s.template_effect(()=>i=s.set_class(t,1,"modal-dock-handle",null,i,{"modal-dock-handle-dragging":s.get(x)})),s.append(e,t)};s.if(v,e=>{"free"===s.get(h)&&e(z)});var I=s.sibling(v,2);s.each(I,19,()=>s.get(M),e=>e.id,(e,t,i)=>{const n=s.derived(()=>s.get(t).lastChildId?r.modals.get(s.get(t).lastChildId):null);var d=it();let l;d.__click=e=>{var i;i=s.get(t).id,q.has(i)?e.currentTarget.animate([{transform:"translateX(0)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"translateX(0)"}],{duration:300,easing:"ease-in-out"}):U(s.get(t).id)};var c=s.child(d),g=s.child(c),h=e=>{var i=s.comment(),n=s.first_child(i);s.snippet(n,()=>s.get(o),()=>s.get(t).icon),s.append(e,i)},f=e=>{var i=Je(),n=s.child(i,!0);s.reset(i),s.template_effect(e=>s.set_text(n,e),[()=>s.get(t).title.charAt(0)]),s.append(e,i)};s.if(g,e=>{s.get(t).icon&&s.get(o)?e(h):e(f,!1)}),s.reset(c);var m=s.sibling(c,2),v=e=>{var i=Ze(),n=s.child(i,!0);s.reset(i),s.template_effect(()=>s.set_text(n,s.get(t).title)),s.append(e,i)};s.if(m,e=>{"hidden"!==s.get(p)&&e(v)});var w=s.sibling(m,4),y=e=>{var t=tt(),i=s.child(t),r=e=>{var t=s.comment(),i=s.first_child(t);s.snippet(i,()=>s.get(o),()=>s.get(n).icon),s.append(e,t)},d=e=>{var t=et();s.append(e,t)};s.if(i,e=>{s.get(n).icon&&s.get(o)?e(r):e(d,!1)}),s.reset(t),s.append(e,t)};s.if(w,e=>{s.get(t).lastChildId&&s.get(n)&&e(y)}),s.reset(d),s.template_effect(()=>{l=s.set_class(d,1,"modal-dock-item",null,l,{"modal-dock-item-has-glow":!!s.get(t).glow,"modal-dock-item-has-child":!!s.get(t).lastChildId,"modal-dock-item-label-beside":"beside"===s.get(p),"modal-dock-item-label-below":"below"===s.get(p)}),s.set_attribute(d,"data-modal-id",s.get(t).id),s.set_style(d,s.get(t).glow?`--modal-dock-glow-color: ${s.get(t).glow.color};`:"")}),s.transition(3,d,()=>a,()=>({duration:300,delay:50*s.get(i),easing:u,start:.5})),s.append(e,d)}),s.reset(g),s.reset(i),s.bind_this(i,e=>s.set(y,e),()=>s.get(y)),s.template_effect(()=>{n=s.set_class(i,1,"modal-dock-container",null,n,{"modal-dock-left":"left"===s.get(h),"modal-dock-right":"right"===s.get(h),"modal-dock-bottom":"bottom"===s.get(h),"modal-dock-free":"free"===s.get(h),"modal-dock-empty":0===s.get(M).length}),d=s.set_style(i,"free"===s.get(h)?`left: ${s.get(w).x}px; top: ${s.get(w).y}px;`:"",d,{"z-index":s.get(c)}),m=s.set_class(g,1,"modal-dock",null,m,{"modal-dock-free-horizontal":"free"===s.get(h)&&"horizontal"===s.get(f),"modal-dock-free-vertical":"free"===s.get(h)&&"vertical"===s.get(f)})}),s.transition(3,i,()=>l,()=>s.get(M).length>0?s.get(k):{duration:0}),s.append(e,i)},$$slots:{default:!0}}),s.pop(R)}s.delegate(["pointerdown","click"]);var rt=s.from_html('<div class="modal-backdrop svelte-1d3nq4t" aria-hidden="true"></div>');function dt(e,t){s.push(t,!0);const i=me(),n=s.derived(()=>(m(),v())),o=s.derived(()=>s.get(n).features.backdrop),r=s.derived(()=>(se(),Array.from(i.modals.values()).some(e=>e.isOpen&&!e.isMinimized&&!e.isHiddenWithParent))),d=s.derived(()=>s.get(o)&&s.get(r)),a=s.derived(()=>z("MODAL")-1);Ce(e,{get target(){return s.get(n).portalTarget},children:(e,t)=>{var i=s.comment(),n=s.first_child(i),o=e=>{var t=rt();let i;s.template_effect(()=>i=s.set_style(t,"",i,{"z-index":s.get(a)})),s.transition(3,t,()=>c,()=>({duration:200})),s.append(e,t)};s.if(n,e=>{s.get(d)&&e(o)}),s.append(e,i)},$$slots:{default:!0}}),s.pop()}function st(e){const{content:t,footer:i,icon:n,...o}=e,s=r(Ue,{target:document.body,props:{...o,children:t?()=>lt(t):void 0,footer:i?()=>lt(i):void 0,icon:n?()=>lt(n):void 0}});return{destroy:()=>d(s)}}function at(){const e=r(ot,{target:document.body,props:{}});return{destroy:()=>d(e)}}function lt(e){if("string"==typeof e){const t=document.createElement("div");return t.innerHTML=e,t}return e}function ct(){const e=r(dt,{target:document.body,props:{}});return{destroy:()=>d(e)}}function gt(e={}){const{config:t}=e;t&&w(t),s.set(x,v().zIndex.base,!0);const i=v(),n=e.backdrop??i.features.backdrop?ct():null,o=e.dock??i.features.dock?at():null;return{backdrop:n,dock:o,destroy:()=>{null==n||n.destroy(),null==o||o.destroy()}}}export{ee as bringToFront,ne as closeAllModals,ie as closeModal,ct as createBackdrop,at as createDock,st as createModal,v as getConfig,gt as init,pe as isModalOpen,fe as isModalRegistered,V as minimizeModal,oe as openChildModal,te as openModal,U as restoreModal,w as setConfig,ve as toggleModalTransparency};
|
|
1
|
+
import{m as o,x as t,a as n,s as e,i as r,g as s,D as a,B as d}from"./runtime.js";import{l as c,q as i,e as l,v as u,p,f,j as m,o as y,h as g,w as M}from"./runtime.js";function b(e){const{content:r,footer:s,icon:a,...d}=e,c=o(t,{target:document.body,props:{...d,children:r?()=>v(r):void 0,footer:s?()=>v(s):void 0,icon:a?()=>v(a):void 0}});return{destroy:()=>n(c)}}function k(){const t=o(a,{target:document.body,props:{}});return{destroy:()=>n(t)}}function v(o){if("string"==typeof o){const t=document.createElement("div");return t.innerHTML=o,t}return o}function T(){const t=o(d,{target:document.body,props:{}});return{destroy:()=>n(t)}}function h(o={}){const{config:t}=o;t&&e(t),r();const n=s(),a=o.backdrop??n.features.backdrop?T():null,d=o.dock??n.features.dock?k():null;return{backdrop:a,dock:d,destroy:()=>{null==a||a.destroy(),null==d||d.destroy()}}}export{c as bringToFront,i as closeAllModals,l as closeModal,T as createBackdrop,k as createDock,b as createModal,s as getConfig,h as init,u as isModalOpen,p as isModalRegistered,f as minimizeModal,m as openChildModal,y as openModal,g as restoreModal,e as setConfig,M as toggleModalTransparency};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "epic-modals",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "A stunning modal library with macOS-style animations, drag, resize, and dock. Supports Svelte 5, React, and vanilla JS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"modal",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
],
|
|
51
51
|
"scripts": {
|
|
52
52
|
"dev": "vite dev",
|
|
53
|
-
"build": "
|
|
54
|
-
"build:
|
|
53
|
+
"build": "vite build && BUILD_TYPE=standalone vite build && node scripts/build-css.js",
|
|
54
|
+
"build:dev": "vite build --mode development && BUILD_TYPE=standalone vite build --mode development && node scripts/build-css.js",
|
|
55
55
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
56
56
|
"test": "vitest run",
|
|
57
57
|
"test:watch": "vitest",
|
|
@@ -70,6 +70,9 @@
|
|
|
70
70
|
},
|
|
71
71
|
"react-dom": {
|
|
72
72
|
"optional": true
|
|
73
|
+
},
|
|
74
|
+
"svelte": {
|
|
75
|
+
"optional": true
|
|
73
76
|
}
|
|
74
77
|
},
|
|
75
78
|
"devDependencies": {
|