@yoopta/ui 6.0.0-beta.5 → 6.0.0-beta.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/dist/action-menu-list/utils.d.ts +1 -1
- package/dist/action-menu-list/utils.d.ts.map +1 -1
- package/dist/action-menu-list.js +1 -1
- package/dist/block-options/block-options.d.ts +68 -8
- package/dist/block-options/block-options.d.ts.map +1 -1
- package/dist/block-options/context.d.ts +11 -0
- package/dist/block-options/context.d.ts.map +1 -0
- package/dist/block-options/hooks.d.ts +14 -894
- package/dist/block-options/hooks.d.ts.map +1 -1
- package/dist/block-options/index.d.ts +2 -3
- package/dist/block-options/index.d.ts.map +1 -1
- package/dist/block-options.js +1 -1
- package/dist/chunks/floating-ui.react-33212df0.js +5 -0
- package/dist/chunks/{highlight-color-picker-13e8f1eb.js → highlight-color-picker-534fa3e2.js} +1 -1
- package/dist/chunks/{hooks-8cbb0736.js → hooks-814f49b9.js} +1 -1
- package/dist/chunks/{hooks-907f8ea7.js → hooks-879d4b4f.js} +1 -1
- package/dist/highlight-color-picker.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/overlay.js +1 -1
- package/dist/portal.js +1 -1
- package/dist/slash-command-menu.js +1 -1
- package/dist/toolbar/index.d.ts +1 -1
- package/dist/toolbar/index.d.ts.map +1 -1
- package/dist/toolbar.js +1 -1
- package/package.json +2 -2
- package/dist/block-options/store.d.ts +0 -15
- package/dist/block-options/store.d.ts.map +0 -1
- package/dist/block-options/store.test.d.ts +0 -2
- package/dist/block-options/store.test.d.ts.map +0 -1
- package/dist/chunks/floating-ui.react-0123aadf.js +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/block-options/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/block-options/hooks.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe;8BAId,MAAM;6BAWN,MAAM;2BA8BN,MAAM;CAgBnB,CAAC;AAGF,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { useBlockOptions, useBlockOptionsActions } from './hooks';
|
|
2
1
|
export { BlockOptions } from './block-options';
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
2
|
+
export type { BlockOptionsContentProps, BlockOptionsGroupProps, BlockOptionsItemProps, BlockOptionsLabelProps, BlockOptionsRootProps, BlockOptionsSeparatorProps, BlockOptionsTriggerProps, } from './block-options';
|
|
3
|
+
export { useBlockActions, useBlockOptionsContext } from './hooks';
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/block-options/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/block-options/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EACV,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/block-options.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_ as o}from"./chunks/_tslib-5e145dfd.js";import{jsx as t,jsxs as i}from"react/jsx-runtime";import{createContext as n,useContext as e,forwardRef as a,useCallback as r,isValidElement as s,cloneElement as p,useState as c,useMemo as l}from"react";import{d as u,u as b,b as d,e as y,g as k,F as g,h,o as m,f as v,s as x,a as f}from"./chunks/floating-ui.react-33212df0.js";import{s as O}from"./chunks/style-inject.es-e87a8d02.js";import{Overlay as w}from"./overlay.js";import{Portal as j}from"./portal.js";import{useYooptaEditor as N}from"@yoopta/editor";import"react-dom";const B=n(null),C=()=>{const o=e(B);if(!o)throw new Error("BlockOptions components must be used within <BlockOptions>");return o};O(":root{--yoopta-ui-block-options-bg:var(--yoopta-ui-background);--yoopta-ui-block-options-border:var(--yoopta-ui-border);--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--yoopta-ui-block-options-radius:0.5rem;--yoopta-ui-block-options-padding:4px;--yoopta-ui-block-options-min-width:220px;--yoopta-ui-block-options-z-index:200;--yoopta-ui-block-options-group-gap:1px;--yoopta-ui-block-options-button-padding-y:8px;--yoopta-ui-block-options-button-padding-x:12px;--yoopta-ui-block-options-button-font-size:0.875rem;--yoopta-ui-block-options-button-line-height:1.25rem;--yoopta-ui-block-options-button-color:var(--yoopta-ui-foreground);--yoopta-ui-block-options-button-bg:transparent;--yoopta-ui-block-options-button-hover:var(--yoopta-ui-accent);--yoopta-ui-block-options-button-active:var(--yoopta-ui-accent);--yoopta-ui-block-options-button-radius:0.375rem;--yoopta-ui-destructive:0 84.2% 60.2%;--yoopta-ui-destructive-foreground:210 40% 98%;--yoopta-ui-block-options-button-destructive-color:hsl(var(--yoopta-ui-destructive));--yoopta-ui-block-options-button-destructive-hover:hsl(var(--yoopta-ui-destructive)/0.1);--yoopta-ui-block-options-icon-size:1rem;--yoopta-ui-block-options-icon-gap:8px;--yoopta-ui-block-options-separator-color:var(--yoopta-ui-border);--yoopta-ui-block-options-separator-height:1px;--yoopta-ui-block-options-separator-margin:4px 0;--yoopta-ui-block-options-transition:color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out}.dark,[data-theme=dark],[data-yoopta-theme=dark]{--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.5),0 4px 6px -4px rgba(0,0,0,.3)}.yoopta-ui-block-options{background-color:hsl(var(--yoopta-ui-block-options-bg));border:1px solid hsl(var(--yoopta-ui-block-options-border));border-radius:var(--yoopta-ui-block-options-radius);box-shadow:var(--yoopta-ui-block-options-shadow);min-width:var(--yoopta-ui-block-options-min-width);padding:var(--yoopta-ui-block-options-padding);position:fixed;z-index:var(--yoopta-ui-block-options-z-index)}.yoopta-ui-block-options-content{display:flex;flex-direction:column;gap:var(--yoopta-ui-block-options-group-gap)}.yoopta-ui-block-options-group{display:flex;flex-direction:column;gap:1px}.yoopta-ui-block-options-button{align-items:center;background-color:var(--yoopta-ui-block-options-button-bg);border:none;border-radius:var(--yoopta-ui-block-options-button-radius);color:hsl(var(--yoopta-ui-block-options-button-color));cursor:pointer;display:flex;font-size:var(--yoopta-ui-block-options-button-font-size);font-weight:400;line-height:var(--yoopta-ui-block-options-button-line-height);outline:none;padding:var(--yoopta-ui-block-options-button-padding-y) var(--yoopta-ui-block-options-button-padding-x);text-align:left;transition:var(--yoopta-ui-block-options-transition);-moz-user-select:none;user-select:none;-webkit-user-select:none;width:100%}.yoopta-ui-block-options-button:hover{background-color:hsl(var(--yoopta-ui-block-options-button-hover));color:hsl(var(--yoopta-ui-accent-foreground))}.yoopta-ui-block-options-button:active{background-color:hsl(var(--yoopta-ui-block-options-button-active))}.yoopta-ui-block-options-button:focus-visible{box-shadow:0 0 0 2px hsl(var(--yoopta-ui-background)),0 0 0 4px hsl(var(--yoopta-ui-ring));outline:none}.yoopta-ui-block-options-button:disabled{opacity:.5;pointer-events:none}.yoopta-ui-block-options-button-destructive{color:var(--yoopta-ui-block-options-button-destructive-color)}.yoopta-ui-block-options-button-destructive:hover{background-color:var(--yoopta-ui-block-options-button-destructive-hover);color:hsl(var(--yoopta-ui-destructive))}.yoopta-ui-block-options-button-icon{align-items:center;display:inline-flex;flex-shrink:0;justify-content:center;margin-right:var(--yoopta-ui-block-options-icon-gap)}.yoopta-ui-block-options-button-icon svg{height:var(--yoopta-ui-block-options-icon-size);width:var(--yoopta-ui-block-options-icon-size)}.yoopta-ui-block-options-button-text{flex:1}.yoopta-ui-block-options-separator{background-color:hsl(var(--yoopta-ui-block-options-separator-color));height:var(--yoopta-ui-block-options-separator-height);margin:var(--yoopta-ui-block-options-separator-margin)}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.5),0 4px 6px -4px rgba(0,0,0,.3)}}");const $=({children:o,open:i,onOpenChange:n,defaultOpen:e=!1,anchor:a=null})=>{const[s,p]=c(e),[u,b]=c(null),d=h(),y=void 0!==i,k=y?i:s,g=null!=a?a:u,m=r(o=>{y||p(o),null==n||n(o)},[y,n]),v=l(()=>({open:k,onOpenChange:m,triggerRef:g,setTriggerRef:b,contentId:d}),[k,m,g,d]);return t(B.Provider,Object.assign({value:v},{children:o}))};$.displayName="BlockOptions";const z=a(({children:o,asChild:i=!1,className:n=""},e)=>{const{open:a,onOpenChange:c,setTriggerRef:l,contentId:b}=C(),d=r(o=>{o.stopPropagation(),c(!a)},[a,c]),y={ref:u([e,l]),onClick:d,"aria-expanded":a,"aria-haspopup":"menu","aria-controls":a?b:void 0};return i&&s(o)?p(o,y):t("button",Object.assign({type:"button",className:`yoopta-ui-block-options-trigger ${n}`},y,{children:o}))});z.displayName="BlockOptions.Trigger";const I=({children:o})=>t(j,Object.assign({id:"yoopta-ui-block-options-portal"},{children:o}));I.displayName="BlockOptions.Portal";const P=a(({children:o,className:i="",style:n,side:e="right",align:a="start",sideOffset:r=5},s)=>{const{open:p,onOpenChange:c,triggerRef:l,contentId:h}=C(),O="center"===a?e:`${e}-${a}`,{refs:j,floatingStyles:N,context:B}=b({elements:{reference:l},placement:O,open:p,onOpenChange:c,middleware:[m(r),v(),x({padding:8})],whileElementsMounted:f,strategy:"fixed"}),{isMounted:$,styles:z}=d(B,{duration:150,initial:{opacity:0},open:{opacity:1},close:{opacity:0}}),P=y(B,{outsidePress:!0,escapeKey:!0}),{getFloatingProps:E}=k([P]),S=u([j.setFloating,s]);return $?t(I,{children:t(w,Object.assign({lockScroll:!1,onClick:()=>c(!1)},{children:t(g,Object.assign({context:B,modal:!1},{children:t("div",Object.assign({ref:S,id:h,role:"menu","aria-orientation":"vertical",className:`yoopta-ui-block-options ${i}`,style:Object.assign(Object.assign(Object.assign({},N),z),n),contentEditable:!1},E({onClick:o=>o.stopPropagation(),onMouseDown:o=>o.stopPropagation()}),{children:o}))}))}))}):null});P.displayName="BlockOptions.Content";const E=a(({children:o,className:i=""},n)=>t("div",Object.assign({ref:n,role:"group",className:`yoopta-ui-block-options-group ${i}`},{children:o})));E.displayName="BlockOptions.Group";const S=a((n,e)=>{var{children:a,onSelect:s,className:p="",disabled:c,icon:l,variant:u="default",keepOpen:b=!1}=n,d=o(n,["children","onSelect","className","disabled","icon","variant","keepOpen"]);const{onOpenChange:y}=C(),k=r(o=>{c||(null==s||s(o),b||y(!1))},[c,s,y,b]);return i("button",Object.assign({ref:e,type:"button",role:"menuitem",disabled:c,className:`yoopta-ui-block-options-button yoopta-ui-block-options-button-${u} ${p}`,onClick:k},d,{children:[l&&t("span",Object.assign({className:"yoopta-ui-block-options-button-icon"},{children:l})),t("span",Object.assign({className:"yoopta-ui-block-options-button-text"},{children:a}))]}))});S.displayName="BlockOptions.Item";const T=a(({className:o=""},i)=>t("div",{ref:i,role:"separator",className:`yoopta-ui-block-options-separator ${o}`}));T.displayName="BlockOptions.Separator";const R=a(({children:o,className:i=""},n)=>t("div",Object.assign({ref:n,className:`yoopta-ui-block-options-label ${i}`},{children:o})));R.displayName="BlockOptions.Label";const D=Object.assign($,{Root:$,Trigger:z,Portal:I,Content:P,Group:E,Item:S,Separator:T,Label:R}),q=()=>{const o=N();return{duplicateBlock:r(t=>{if(!t)throw new Error("Block ID is required to duplicate block");o.duplicateBlock({blockId:t,focus:!0})},[o]),copyBlockLink:r(t=>{var i;if(!t)throw new Error("Block ID is required to copy block link");const n=o.children[t];if(n){const t=`${window.location.origin}${window.location.pathname}#${n.id}`;if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(t);else{const o=document.createElement("textarea");o.value=t,o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)}null===(i=o.emit)||void 0===i||i.call(o,"block:copy",n)}},[o]),deleteBlock:r(t=>{if(!t)throw new Error("Block ID is required to delete block");o.deleteBlock({blockId:t}),o.setPath({current:null})},[o])}};export{D as BlockOptions,q as useBlockActions,C as useBlockOptionsContext};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import*as e from"react";import{useLayoutEffect as t,useEffect as n,useRef as o}from"react";import*as r from"react-dom";function i(){return"undefined"!=typeof window}function l(e){return s(e)?(e.nodeName||"").toLowerCase():"#document"}function c(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function u(e){var t;return null==(t=(s(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function s(e){return!!i()&&(e instanceof Node||e instanceof c(e).Node)}function a(e){return!!i()&&(e instanceof Element||e instanceof c(e).Element)}function f(e){return!!i()&&(e instanceof HTMLElement||e instanceof c(e).HTMLElement)}function d(e){return!(!i()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof c(e).ShadowRoot)}const p=new Set(["inline","contents"]);function m(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=C(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!p.has(r)}const h=new Set(["table","td","th"]);function g(e){return h.has(l(e))}const v=[":popover-open",":modal"];function y(e){return v.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const w=["transform","translate","scale","rotate","perspective"],b=["transform","translate","scale","rotate","perspective","filter"],x=["paint","layout","strict","content"];function R(e){const t=E(),n=a(e)?C(e):e;return w.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||b.some(e=>(n.willChange||"").includes(e))||x.some(e=>(n.contain||"").includes(e))}function E(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const S=new Set(["html","body","#document"]);function A(e){return S.has(l(e))}function C(e){return c(e).getComputedStyle(e)}function L(e){return a(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function k(e){if("html"===l(e))return e;const t=e.assignedSlot||e.parentNode||d(e)&&e.host||u(e);return d(t)?t.host:t}function T(e){const t=k(e);return A(t)?e.ownerDocument?e.ownerDocument.body:e.body:f(t)&&m(t)?t:T(t)}function O(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const r=T(e),i=r===(null==(o=e.ownerDocument)?void 0:o.body),l=c(r);if(i){const e=M(l);return t.concat(l,l.visualViewport||[],m(r)?r:[],e&&n?O(e):[])}return t.concat(r,O(r,[],n))}function M(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function P(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}function D(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&d(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function F(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function I(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+"/"+n}).join(" "):navigator.userAgent}function N(e){return!I().includes("jsdom/")&&(!W()&&0===e.width&&0===e.height||W()&&1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"===e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail&&"touch"===e.pointerType)}function W(){const e=/android/i;return e.test(F())||e.test(I())}function j(e){return(null==e?void 0:e.ownerDocument)||document}function B(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function V(e){return"composedPath"in e?e.composedPath()[0]:e.target}function H(e){e.preventDefault(),e.stopPropagation()}function q(e){return!!e&&("combobox"===e.getAttribute("role")&&function(e){return f(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}(e))}const z=Math.min,K=Math.max,_=Math.round,U=Math.floor,X=e=>({x:e,y:e}),$={left:"right",right:"left",bottom:"top",top:"bottom"},Y={start:"end",end:"start"};function Z(e,t,n){return K(e,z(t,n))}function G(e,t){return"function"==typeof e?e(t):e}function J(e){return e.split("-")[0]}function Q(e){return e.split("-")[1]}function ee(e){return"x"===e?"y":"x"}function te(e){return"y"===e?"height":"width"}const ne=new Set(["top","bottom"]);function oe(e){return ne.has(J(e))?"y":"x"}function re(e){return ee(oe(e))}function ie(e){return e.replace(/start|end/g,e=>Y[e])}const le=["left","right"],ce=["right","left"],ue=["top","bottom"],se=["bottom","top"];function ae(e,t,n,o){const r=Q(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?ce:le:t?le:ce;case"left":case"right":return t?ue:se;default:return[]}}(J(e),"start"===n,o);return r&&(i=i.map(e=>e+"-"+r),t&&(i=i.concat(i.map(ie)))),i}function fe(e){return e.replace(/left|right|bottom|top/g,e=>$[e])}function de(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function pe(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}
|
|
2
|
+
/*!
|
|
3
|
+
* tabbable 6.4.0
|
|
4
|
+
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
|
+
*/var me=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"].join(","),he="undefined"==typeof Element,ge=he?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ve=!he&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},ye=function(e,t){var n;void 0===t&&(t=!0);var o=null==e||null===(n=e.getAttribute)||void 0===n?void 0:n.call(e,"inert");return""===o||"true"===o||t&&e&&("function"==typeof e.closest?e.closest("[inert]"):ye(e.parentNode))},we=function(e,t,n){for(var o=[],r=Array.from(e);r.length;){var i=r.shift();if(!ye(i,!1))if("SLOT"===i.tagName){var l=i.assignedElements(),c=l.length?l:i.children,u=we(c,!0,n);n.flatten?o.push.apply(o,u):o.push({scopeParent:i,candidates:u})}else{ge.call(i,me)&&n.filter(i)&&(t||!e.includes(i))&&o.push(i);var s=i.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(i),a=!ye(s,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(s&&a){var f=we(!0===s?i.children:s.children,!0,n);n.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else r.unshift.apply(r,i.children)}}return o},be=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},xe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!be(e)?0:e.tabIndex},Re=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ee=function(e){return"INPUT"===e.tagName},Se=function(e){return function(e){return Ee(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||ve(e),o=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=o(window.CSS.escape(e.name));else try{t=o(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var r=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!r||r===e}(e)},Ae=function(e){var t=e.getBoundingClientRect(),n=t.width,o=t.height;return 0===n&&0===o},Ce=function(e,t){var n=t.displayCheck,o=t.getShadowRoot;if("full-native"===n&&"checkVisibility"in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if("hidden"===getComputedStyle(e).visibility)return!0;var r=ge.call(e,"details>summary:first-of-type")?e.parentElement:e;if(ge.call(r,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"full-native"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Ae(e)}else{if("function"==typeof o){for(var i=e;e;){var l=e.parentElement,c=ve(e);if(l&&!l.shadowRoot&&!0===o(l))return Ae(e);e=e.assignedSlot?e.assignedSlot:l||c===e.ownerDocument?l:c.host}e=i}if(function(e){var t,n,o,r,i=e&&ve(e),l=null===(t=i)||void 0===t?void 0:t.host,c=!1;if(i&&i!==e)for(c=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!c&&l;){var u,s,a;c=!(null===(s=l=null===(u=i=ve(l))||void 0===u?void 0:u.host)||void 0===s||null===(a=s.ownerDocument)||void 0===a||!a.contains(l))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Le=function(e,t){return!(t.disabled||function(e){return Ee(e)&&"hidden"===e.type}(t)||Ce(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some(function(e){return"SUMMARY"===e.tagName})}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var o=t.children.item(n);if("LEGEND"===o.tagName)return!!ge.call(t,"fieldset[disabled] *")||!o.contains(e)}return!0}t=t.parentElement}return!1}(t))},ke=function(e,t){return!(Se(t)||xe(t)<0||!Le(e,t))},Te=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Oe=function(e){var t=[],n=[];return e.forEach(function(e,o){var r=!!e.scopeParent,i=r?e.scopeParent:e,l=function(e,t){var n=xe(e);return n<0&&t&&!be(e)?0:n}(i,r),c=r?Oe(e.candidates):i;0===l?r?t.push.apply(t,c):t.push(i):n.push({documentOrder:o,tabIndex:l,item:e,isScope:r,content:c})}),n.sort(Re).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},Me=function(e,t){var n;return n=(t=t||{}).getShadowRoot?we([e],t.includeContainer,{filter:ke.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Te}):function(e,t,n){if(ye(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(me));return t&&ge.call(e,me)&&o.unshift(e),o.filter(n)}(e,t.includeContainer,ke.bind(null,t)),Oe(n)};function Pe(e,t,n){let{reference:o,floating:r}=e;const i=oe(t),l=re(t),c=te(l),u=J(t),s="y"===i,a=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,d=o[c]/2-r[c]/2;let p;switch(u){case"top":p={x:a,y:o.y-r.height};break;case"bottom":p={x:a,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:f};break;case"left":p={x:o.x-r.width,y:f};break;default:p={x:o.x,y:o.y}}switch(Q(t)){case"start":p[l]-=d*(n&&s?-1:1);break;case"end":p[l]+=d*(n&&s?-1:1)}return p}async function De(e,t){var n;void 0===t&&(t={});const{x:o,y:r,platform:i,rects:l,elements:c,strategy:u}=e,{boundary:s="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=G(t,e),m=de(p),h=c[d?"floating"===f?"reference":"floating":f],g=pe(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:s,rootBoundary:a,strategy:u})),v="floating"===f?{x:o,y:r,width:l.floating.width,height:l.floating.height}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),w=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},b=pe(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:y,strategy:u}):v);return{top:(g.top-b.top+m.top)/w.y,bottom:(b.bottom-g.bottom+m.bottom)/w.y,left:(g.left-b.left+m.left)/w.x,right:(b.right-g.right+m.right)/w.x}}function Fe(e){const t=z(...e.map(e=>e.left)),n=z(...e.map(e=>e.top));return{x:t,y:n,width:K(...e.map(e=>e.right))-t,height:K(...e.map(e=>e.bottom))-n}}const Ie=new Set(["left","top"]);function Ne(e){const t=C(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=f(e),i=r?e.offsetWidth:n,l=r?e.offsetHeight:o,c=_(n)!==i||_(o)!==l;return c&&(n=i,o=l),{width:n,height:o,$:c}}function We(e){return a(e)?e:e.contextElement}function je(e){const t=We(e);if(!f(t))return X(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=Ne(t);let l=(i?_(n.width):n.width)/o,c=(i?_(n.height):n.height)/r;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const Be=X(0);function Ve(e){const t=c(e);return E()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Be}function He(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=We(e);let l=X(1);t&&(o?a(o)&&(l=je(o)):l=je(e));const u=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==c(e))&&t}(i,n,o)?Ve(i):X(0);let s=(r.left+u.x)/l.x,f=(r.top+u.y)/l.y,d=r.width/l.x,p=r.height/l.y;if(i){const e=c(i),t=o&&a(o)?c(o):o;let n=e,r=M(n);for(;r&&o&&t!==n;){const e=je(r),t=r.getBoundingClientRect(),o=C(r),i=t.left+(r.clientLeft+parseFloat(o.paddingLeft))*e.x,l=t.top+(r.clientTop+parseFloat(o.paddingTop))*e.y;s*=e.x,f*=e.y,d*=e.x,p*=e.y,s+=i,f+=l,n=c(r),r=M(n)}}return pe({width:d,height:p,x:s,y:f})}function qe(e,t){const n=L(e).scrollLeft;return t?t.left+n:He(u(e)).left+n}function ze(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-qe(e,n),y:n.top+t.scrollTop}}const Ke=new Set(["absolute","fixed"]);function _e(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=c(e),o=u(e),r=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,s=0,a=0;if(r){i=r.width,l=r.height;const e=E();(!e||e&&"fixed"===t)&&(s=r.offsetLeft,a=r.offsetTop)}const f=qe(o);if(f<=0){const e=o.ownerDocument,t=e.body,n=getComputedStyle(t),r="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,l=Math.abs(o.clientWidth-t.clientWidth-r);l<=25&&(i-=l)}else f<=25&&(i+=f);return{width:i,height:l,x:s,y:a}}(e,n);else if("document"===t)o=function(e){const t=u(e),n=L(e),o=e.ownerDocument.body,r=K(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=K(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+qe(e);const c=-n.scrollTop;return"rtl"===C(o).direction&&(l+=K(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:c}}(u(e));else if(a(t))o=function(e,t){const n=He(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=f(e)?je(e):X(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:r*i.x,y:o*i.y}}(t,n);else{const n=Ve(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return pe(o)}function Ue(e,t){const n=k(e);return!(n===t||!a(n)||A(n))&&("fixed"===C(n).position||Ue(n,t))}function Xe(e,t,n){const o=f(t),r=u(t),i="fixed"===n,c=He(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const a=X(0);function d(){a.x=qe(r)}if(o||!o&&!i)if(("body"!==l(t)||m(r))&&(s=L(t)),o){const e=He(t,!0,i,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else r&&d();i&&!o&&r&&d();const p=!r||o||i?X(0):ze(r,s);return{x:c.left+s.scrollLeft-a.x-p.x,y:c.top+s.scrollTop-a.y-p.y,width:c.width,height:c.height}}function $e(e){return"static"===C(e).position}function Ye(e,t){if(!f(e)||"fixed"===C(e).position)return null;if(t)return t(e);let n=e.offsetParent;return u(e)===n&&(n=n.ownerDocument.body),n}function Ze(e,t){const n=c(e);if(y(e))return n;if(!f(e)){let t=k(e);for(;t&&!A(t);){if(a(t)&&!$e(t))return t;t=k(t)}return n}let o=Ye(e,t);for(;o&&g(o)&&$e(o);)o=Ye(o,t);return o&&A(o)&&$e(o)&&!R(o)?n:o||function(e){let t=k(e);for(;f(t)&&!A(t);){if(R(t))return t;if(y(t))return null;t=k(t)}return null}(e)||n}const Ge={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i="fixed"===r,c=u(o),s=!!t&&y(t.floating);if(o===c||s&&i)return n;let a={scrollLeft:0,scrollTop:0},d=X(1);const p=X(0),h=f(o);if((h||!h&&!i)&&(("body"!==l(o)||m(c))&&(a=L(o)),f(o))){const e=He(o);d=je(o),p.x=e.x+o.clientLeft,p.y=e.y+o.clientTop}const g=!c||h||i?X(0):ze(c,a);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-a.scrollLeft*d.x+p.x+g.x,y:n.y*d.y-a.scrollTop*d.y+p.y+g.y}},getDocumentElement:u,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[..."clippingAncestors"===n?y(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=O(e,[],!1).filter(e=>a(e)&&"body"!==l(e)),r=null;const i="fixed"===C(e).position;let c=i?k(e):e;for(;a(c)&&!A(c);){const t=C(c),n=R(c);n||"fixed"!==t.position||(r=null),(i?!n&&!r:!n&&"static"===t.position&&r&&Ke.has(r.position)||m(c)&&!n&&Ue(e,c))?o=o.filter(e=>e!==c):r=t,c=k(c)}return t.set(e,o),o}(t,this._c):[].concat(n),o],c=i[0],u=i.reduce((e,n)=>{const o=_e(t,n,r);return e.top=K(o.top,e.top),e.right=z(o.right,e.right),e.bottom=z(o.bottom,e.bottom),e.left=K(o.left,e.left),e},_e(t,c,r));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}},getOffsetParent:Ze,getElementRects:async function(e){const t=this.getOffsetParent||Ze,n=this.getDimensions,o=await n(e.floating);return{reference:Xe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Ne(e);return{width:t,height:n}},getScale:je,isElement:a,isRTL:function(e){return"rtl"===C(e).direction}};function Je(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qe(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=o,a=We(e),f=r||i?[...a?O(a):[],...O(t)]:[];f.forEach(e=>{r&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)});const d=a&&c?function(e,t){let n,o=null;const r=u(e);function i(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function l(c,u){void 0===c&&(c=!1),void 0===u&&(u=1),i();const s=e.getBoundingClientRect(),{left:a,top:f,width:d,height:p}=s;if(c||t(),!d||!p)return;const m={rootMargin:-U(f)+"px "+-U(r.clientWidth-(a+d))+"px "+-U(r.clientHeight-(f+p))+"px "+-U(a)+"px",threshold:K(0,z(1,u))||1};let h=!0;function g(t){const o=t[0].intersectionRatio;if(o!==u){if(!h)return l();o?l(!1,o):n=setTimeout(()=>{l(!1,1e-7)},1e3)}1!==o||Je(s,e.getBoundingClientRect())||l(),h=!1}try{o=new IntersectionObserver(g,{...m,root:r.ownerDocument})}catch(e){o=new IntersectionObserver(g,m)}o.observe(e)}(!0),i}(a,n):null;let p,m=-1,h=null;l&&(h=new ResizeObserver(e=>{let[o]=e;o&&o.target===a&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),a&&!s&&h.observe(a),h.observe(t));let g=s?He(e):null;return s&&function t(){const o=He(e);g&&!Je(g,o)&&n();g=o,p=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach(e=>{r&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=h)||e.disconnect(),h=null,s&&cancelAnimationFrame(p)}}const et=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:l,middlewareData:c}=t,u=await async function(e,t){const{placement:n,platform:o,elements:r}=e,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),l=J(n),c=Q(n),u="y"===oe(n),s=Ie.has(l)?-1:1,a=i&&u?-1:1,f=G(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&"number"==typeof m&&(p="end"===c?-1*m:m),u?{x:p*a,y:d*s}:{x:d*s,y:p*a}}(t,e);return l===(null==(n=c.offset)?void 0:n.placement)&&null!=(o=c.arrow)&&o.alignmentOffset?{}:{x:r+u.x,y:i+u.y,data:{...u,placement:l}}}}},tt=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...u}=G(e,t),s={x:n,y:o},a=await De(t,u),f=oe(J(r)),d=ee(f);let p=s[d],m=s[f];if(i){const e="y"===d?"bottom":"right";p=Z(p+a["y"===d?"top":"left"],p,p-a[e])}if(l){const e="y"===f?"bottom":"right";m=Z(m+a["y"===f?"top":"left"],m,m-a[e])}const h=c.fn({...t,[d]:p,[f]:m});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[d]:i,[f]:l}}}}}},nt=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:l,initialPlacement:c,platform:u,elements:s}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=G(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=J(r),y=oe(c),w=J(c)===c,b=await(null==u.isRTL?void 0:u.isRTL(s.floating)),x=d||(w||!h?[fe(c)]:function(e){const t=fe(e);return[ie(e),t,ie(t)]}(c)),R="none"!==m;!d&&R&&x.push(...ae(c,h,m,b));const E=[c,...x],S=await De(t,g),A=[];let C=(null==(o=i.flip)?void 0:o.overflows)||[];if(a&&A.push(S[v]),f){const e=function(e,t,n){void 0===n&&(n=!1);const o=Q(e),r=re(e),i=te(r);let l="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=fe(l)),[l,fe(l)]}(r,l,b);A.push(S[e[0]],S[e[1]])}if(C=[...C,{placement:r,overflows:A}],!A.every(e=>e<=0)){var L,k;const e=((null==(L=i.flip)?void 0:L.index)||0)+1,t=E[e];if(t){if(!("alignment"===f&&y!==oe(t))||C.every(e=>oe(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:C},reset:{placement:t}}}let n=null==(k=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:k.placement;if(!n)switch(p){case"bestFit":{var T;const e=null==(T=C.filter(e=>{if(R){const t=oe(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:T[0];e&&(n=e);break}case"initialPlacement":n=c}if(r!==n)return{reset:{placement:n}}}return{}}}},ot=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:i,platform:l,elements:c}=t,{apply:u=()=>{},...s}=G(e,t),a=await De(t,s),f=J(r),d=Q(r),p="y"===oe(r),{width:m,height:h}=i.floating;let g,v;"top"===f||"bottom"===f?(g=f,v=d===(await(null==l.isRTL?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(v=f,g="end"===d?"top":"bottom");const y=h-a.top-a.bottom,w=m-a.left-a.right,b=z(h-a[g],y),x=z(m-a[v],w),R=!t.middlewareData.shift;let E=b,S=x;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(S=w),null!=(o=t.middlewareData.shift)&&o.enabled.y&&(E=y),R&&!d){const e=K(a.left,0),t=K(a.right,0),n=K(a.top,0),o=K(a.bottom,0);p?S=m-2*(0!==e||0!==t?e+t:K(a.left,a.right)):E=h-2*(0!==n||0!==o?n+o:K(a.top,a.bottom))}await u({...t,availableWidth:S,availableHeight:E});const A=await l.getDimensions(c.floating);return m!==A.width||h!==A.height?{reset:{rects:!0}}:{}}}},rt=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:o,rects:r,platform:i,strategy:l}=t,{padding:c=2,x:u,y:s}=G(e,t),a=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(o.reference))||[]),f=function(e){const t=e.slice().sort((e,t)=>e.y-t.y),n=[];let o=null;for(let e=0;e<t.length;e++){const r=t[e];!o||r.y-o.y>o.height/2?n.push([r]):n[n.length-1].push(r),o=r}return n.map(e=>pe(Fe(e)))}(a),d=pe(Fe(a)),p=de(c);const m=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===f.length&&f[0].left>f[1].right&&null!=u&&null!=s)return f.find(e=>u>e.left-p.left&&u<e.right+p.right&&s>e.top-p.top&&s<e.bottom+p.bottom)||d;if(f.length>=2){if("y"===oe(n)){const e=f[0],t=f[f.length-1],o="top"===J(n),r=e.top,i=t.bottom,l=o?e.left:t.left,c=o?e.right:t.right;return{top:r,bottom:i,left:l,right:c,width:c-l,height:i-r,x:l,y:r}}const e="left"===J(n),t=K(...f.map(e=>e.right)),o=z(...f.map(e=>e.left)),r=f.filter(n=>e?n.left===o:n.right===t),i=r[0].top,l=r[r.length-1].bottom;return{top:i,bottom:l,left:o,right:t,width:t-o,height:l-i,x:o,y:i}}return d}},floating:o.floating,strategy:l});return r.reference.x!==m.reference.x||r.reference.y!==m.reference.y||r.reference.width!==m.reference.width||r.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}},it=(e,t,n)=>{const o=new Map,r={platform:Ge,...n},i={...r.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:l}=n,c=i.filter(Boolean),u=await(null==l.isRTL?void 0:l.isRTL(t));let s=await l.getElementRects({reference:e,floating:t,strategy:r}),{x:a,y:f}=Pe(s,o,u),d=o,p={},m=0;for(let n=0;n<c.length;n++){const{name:i,fn:h}=c[n],{x:g,y:v,data:y,reset:w}=await h({x:a,y:f,initialPlacement:o,placement:d,strategy:r,middlewareData:p,rects:s,platform:l,elements:{reference:e,floating:t}});a=null!=g?g:a,f=null!=v?v:f,p={...p,[i]:{...p[i],...y}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(s=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:r}):w.rects),({x:a,y:f}=Pe(s,d,u))),n=-1)}return{x:a,y:f,placement:d,strategy:r,middlewareData:p}})(e,t,{...r,platform:i})};var lt="undefined"!=typeof document?t:function(){};function ct(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;0!==o--;)if(!ct(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;0!==o--;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;0!==o--;){const n=r[o];if(("_owner"!==n||!e.$$typeof)&&!ct(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function ut(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function st(e,t){const n=ut(e);return Math.round(t*n)/n}function at(t){const n=e.useRef(t);return lt(()=>{n.current=t}),n}const ft=(e,t)=>({...et(e),options:[e,t]}),dt=(e,t)=>({...tt(e),options:[e,t]}),pt=(e,t)=>({...nt(e),options:[e,t]}),mt=(e,t)=>({...ot(e),options:[e,t]}),ht=(e,t)=>({...rt(e),options:[e,t]});function gt(t){return e.useMemo(()=>t.every(e=>null==e)?null:e=>{t.forEach(t=>{"function"==typeof t?t(e):null!=t&&(t.current=e)})},t)}const vt={...e},yt=vt.useInsertionEffect||(e=>e());function wt(t){const n=e.useRef(()=>{});return yt(()=>{n.current=t}),e.useCallback(function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return null==n.current?void 0:n.current(...t)},[])}var bt="undefined"!=typeof document?t:n;function xt(){return xt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},xt.apply(this,arguments)}let Rt=!1,Et=0;const St=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Et++;const At=vt.useId||function(){const[t,n]=e.useState(()=>Rt?St():void 0);return bt(()=>{null==t&&n(St())},[]),e.useEffect(()=>{Rt=!0},[]),t};const Ct=e.createContext(null),Lt=e.createContext(null),kt=()=>e.useContext(Lt);function Tt(e){return"data-floating-ui-"+e}function Ot(e){const t=o(e);return bt(()=>{t.current=e}),t}let Mt=0;function Pt(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:o=!0,sync:r=!1}=t;o&&cancelAnimationFrame(Mt);const i=()=>null==e?void 0:e.focus({preventScroll:n});r?i():Mt=requestAnimationFrame(i)}function Dt(e,t){let n=e.filter(e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}),o=n;for(;o.length;)o=e.filter(e=>{var t;return null==(t=o)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})}),n=n.concat(o);return n}let Ft=new WeakMap,It=new WeakSet,Nt={},Wt=0;const jt=e=>e&&(e.host||jt(e.parentNode));function Bt(e,t,n,o){const r="data-floating-ui-inert",i=o?"inert":n?"aria-hidden":null,c=(u=t,e.map(e=>{if(u.contains(e))return e;const t=jt(e);return u.contains(t)?t:null}).filter(e=>null!=e));var u;const s=new Set,a=new Set(c),f=[];Nt[r]||(Nt[r]=new WeakMap);const d=Nt[r];return c.forEach(function e(t){if(!t||s.has(t))return;s.add(t),t.parentNode&&e(t.parentNode)}),function e(t){if(!t||a.has(t))return;[].forEach.call(t.children,t=>{if("script"!==l(t))if(s.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,o=(Ft.get(t)||0)+1,l=(d.get(t)||0)+1;Ft.set(t,o),d.set(t,l),f.push(t),1===o&&n&&It.add(t),1===l&&t.setAttribute(r,""),!n&&i&&t.setAttribute(i,"true")}})}(t),s.clear(),Wt++,()=>{f.forEach(e=>{const t=(Ft.get(e)||0)-1,n=(d.get(e)||0)-1;Ft.set(e,t),d.set(e,n),t||(!It.has(e)&&i&&e.removeAttribute(i),It.delete(e)),n||e.removeAttribute(r)}),Wt--,Wt||(Ft=new WeakMap,Ft=new WeakMap,It=new WeakSet,Nt={})}}function Vt(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=j(e[0]).body;return Bt(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,t,n)}const Ht=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function qt(e,t){const n=Me(e,Ht());"prev"===t&&n.reverse();const o=n.indexOf(P(j(e)));return n.slice(o+1)[0]}function zt(){return qt(document.body,"next")}function Kt(){return qt(document.body,"prev")}function _t(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!D(n,o)}function Ut(e){Me(e,Ht()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}function Xt(e){e.querySelectorAll("[data-tabindex]").forEach(e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}const $t={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function Yt(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Zt=e.forwardRef(function(t,n){const[o,r]=e.useState();bt(()=>(/apple/i.test(navigator.vendor)&&r("button"),document.addEventListener("keydown",Yt),()=>{document.removeEventListener("keydown",Yt)}),[]);const i={ref:n,tabIndex:0,role:o,"aria-hidden":!o||void 0,[Tt("focus-guard")]:"",style:$t};return e.createElement("span",xt({},t,i))}),Gt=e.createContext(null),Jt=Tt("portal");function Qt(t){const{children:n,id:o,root:i,preserveTabOrder:l=!0}=t,c=function(t){void 0===t&&(t={});const{id:n,root:o}=t,r=At(),i=en(),[l,c]=e.useState(null),u=e.useRef(null);return bt(()=>()=>{null==l||l.remove(),queueMicrotask(()=>{u.current=null})},[l]),bt(()=>{if(!r)return;if(u.current)return;const e=n?document.getElementById(n):null;if(!e)return;const t=document.createElement("div");t.id=r,t.setAttribute(Jt,""),e.appendChild(t),u.current=t,c(t)},[n,r]),bt(()=>{if(null===o)return;if(!r)return;if(u.current)return;let e=o||(null==i?void 0:i.portalNode);e&&!a(e)&&(e=e.current),e=e||document.body;let t=null;n&&(t=document.createElement("div"),t.id=n,e.appendChild(t));const l=document.createElement("div");l.id=r,l.setAttribute(Jt,""),e=t||e,e.appendChild(l),u.current=l,c(l)},[n,o,r,i]),l}({id:o,root:i}),[u,s]=e.useState(null),f=e.useRef(null),d=e.useRef(null),p=e.useRef(null),m=e.useRef(null),h=null==u?void 0:u.modal,g=null==u?void 0:u.open,v=!!u&&!u.modal&&u.open&&l&&!(!i&&!c);return e.useEffect(()=>{if(c&&l&&!h)return c.addEventListener("focusin",e,!0),c.addEventListener("focusout",e,!0),()=>{c.removeEventListener("focusin",e,!0),c.removeEventListener("focusout",e,!0)};function e(e){if(c&&_t(e)){("focusin"===e.type?Xt:Ut)(c)}}},[c,l,h]),e.useEffect(()=>{c&&(g||Xt(c))},[g,c]),e.createElement(Gt.Provider,{value:e.useMemo(()=>({preserveTabOrder:l,beforeOutsideRef:f,afterOutsideRef:d,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:s}),[l,c])},v&&c&&e.createElement(Zt,{"data-type":"outside",ref:f,onFocus:e=>{if(_t(e,c)){var t;null==(t=p.current)||t.focus()}else{const e=Kt()||(null==u?void 0:u.refs.domReference.current);null==e||e.focus()}}}),v&&c&&e.createElement("span",{"aria-owns":c.id,style:$t}),c&&r.createPortal(n,c),v&&c&&e.createElement(Zt,{"data-type":"outside",ref:d,onFocus:e=>{if(_t(e,c)){var t;null==(t=m.current)||t.focus()}else{const t=zt()||(null==u?void 0:u.refs.domReference.current);null==t||t.focus(),(null==u?void 0:u.closeOnFocusOut)&&(null==u||u.onOpenChange(!1,e.nativeEvent,"focus-out"))}}}))}const en=()=>e.useContext(Gt),tn="data-floating-ui-focusable";let nn=[];function on(e){nn=nn.filter(e=>e.isConnected);let t=e;if(t&&"body"!==l(t)){if(!function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==ge.call(e,me)&&ke(t,e)}(t,Ht())){const e=Me(t,Ht())[0];e&&(t=e)}nn.push(t),nn.length>20&&(nn=nn.slice(-20))}}function rn(){return nn.slice().reverse().find(e=>e.isConnected)}const ln=e.forwardRef(function(t,n){return e.createElement("button",xt({},t,{type:"button",ref:n,tabIndex:-1,style:$t}))});function cn(t){const{context:n,children:o,disabled:r=!1,order:i=["content"],guards:l=!0,initialFocus:c=0,returnFocus:u=!0,restoreFocus:s=!1,modal:a=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:p=!0}=t,{open:m,refs:h,nodeId:g,onOpenChange:v,events:y,dataRef:w,floatingId:b,elements:{domReference:x,floating:R}}=n,E="number"==typeof c&&c<0,S=q(x)&&E,A="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||l,C=Ot(i),L=Ot(c),k=Ot(u),T=kt(),O=en(),M=e.useRef(null),F=e.useRef(null),I=e.useRef(!1),B=e.useRef(!1),z=e.useRef(-1),K=null!=O,_=(U=R)?U.hasAttribute(tn)?U:U.querySelector("["+tn+"]")||U:null;var U;const X=wt(function(e){return void 0===e&&(e=_),e?Me(e,Ht()):[]}),$=wt(e=>{const t=X(e);return C.current.map(e=>x&&"reference"===e?x:_&&"floating"===e?_:t).filter(Boolean).flat()});function Y(t){return!r&&d&&a?e.createElement(ln,{ref:"start"===t?M:F,onClick:e=>v(!1,e.nativeEvent)},"string"==typeof d?d:"Dismiss"):null}e.useEffect(()=>{if(r)return;if(!a)return;function e(e){if("Tab"===e.key){D(_,P(j(_)))&&0===X().length&&!S&&H(e);const t=$(),n=V(e);"reference"===C.current[0]&&n===x&&(H(e),e.shiftKey?Pt(t[t.length-1]):Pt(t[1])),"floating"===C.current[1]&&n===_&&e.shiftKey&&(H(e),Pt(t[0]))}}const t=j(_);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[r,x,_,a,C,S,X,$]),e.useEffect(()=>{if(!r&&R)return R.addEventListener("focusin",e),()=>{R.removeEventListener("focusin",e)};function e(e){const t=V(e),n=X().indexOf(t);-1!==n&&(z.current=n)}},[r,R,X]),e.useEffect(()=>{if(!r&&p)return R&&f(x)?(x.addEventListener("focusout",t),x.addEventListener("pointerdown",e),R.addEventListener("focusout",t),()=>{x.removeEventListener("focusout",t),x.removeEventListener("pointerdown",e),R.removeEventListener("focusout",t)}):void 0;function e(){B.current=!0,setTimeout(()=>{B.current=!1})}function t(e){const t=e.relatedTarget;queueMicrotask(()=>{const n=!(D(x,t)||D(R,t)||D(t,R)||D(null==O?void 0:O.portalNode,t)||null!=t&&t.hasAttribute(Tt("focus-guard"))||T&&(Dt(T.nodesRef.current,g).find(e=>{var n,o;return D(null==(n=e.context)?void 0:n.elements.floating,t)||D(null==(o=e.context)?void 0:o.elements.domReference,t)})||function(e,t){var n;let o=[],r=null==(n=e.find(e=>e.id===t))?void 0:n.parentId;for(;r;){const t=e.find(e=>e.id===r);r=null==t?void 0:t.parentId,t&&(o=o.concat(t))}return o}(T.nodesRef.current,g).find(e=>{var n,o;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(o=e.context)?void 0:o.elements.domReference)===t})));if(s&&n&&P(j(_))===j(_).body){f(_)&&_.focus();const e=z.current,t=X(),n=t[e]||t[t.length-1]||_;f(n)&&n.focus()}!S&&a||!t||!n||B.current||t===rn()||(I.current=!0,v(!1,e,"focus-out"))})}},[r,x,R,_,a,g,T,O,v,p,s,X,S]),e.useEffect(()=>{var e;if(r)return;const t=Array.from((null==O||null==(e=O.portalNode)?void 0:e.querySelectorAll("["+Tt("portal")+"]"))||[]);if(R){const e=[R,...t,M.current,F.current,C.current.includes("reference")||S?x:null].filter(e=>null!=e),n=a||S?Vt(e,A,!A):Vt(e);return()=>{n()}}},[r,x,R,a,C,O,S,A]),bt(()=>{if(r||!f(_))return;const e=P(j(_));queueMicrotask(()=>{const t=$(_),n=L.current,o=("number"==typeof n?t[n]:n.current)||_,r=D(_,e);E||r||!m||Pt(o,{preventScroll:o===_})})},[r,m,_,E,$,L]),bt(()=>{if(r||!_)return;let e=!1;const t=j(_),n=P(t);let o=w.current.openEvent;function i(t){let{open:n,reason:r,event:i,nested:l}=t;n&&(o=i),"escape-key"===r&&h.domReference.current&&on(h.domReference.current),"hover"===r&&"mouseleave"===i.type&&(I.current=!0),"outside-press"===r&&(l?(I.current=!1,e=!0):I.current=!(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(W()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(i)||N(i)))}on(n),y.on("openchange",i);const l=t.createElement("span");return l.setAttribute("tabindex","-1"),l.setAttribute("aria-hidden","true"),Object.assign(l.style,$t),K&&x&&x.insertAdjacentElement("afterend",l),()=>{y.off("openchange",i);const n=P(t),r=D(R,n)||T&&Dt(T.nodesRef.current,g).some(e=>{var t;return D(null==(t=e.context)?void 0:t.elements.floating,n)});(r||o&&["click","mousedown"].includes(o.type))&&h.domReference.current&&on(h.domReference.current);const c="boolean"==typeof k.current?rn()||l:k.current.current||l;queueMicrotask(()=>{k.current&&!I.current&&f(c)&&(c===n||n===t.body||r)&&c.focus({preventScroll:e}),l.remove()})}},[r,R,_,k,w,h,y,T,g,K,x]),e.useEffect(()=>{queueMicrotask(()=>{I.current=!1})},[r]),bt(()=>{if(!r&&O)return O.setFocusManagerState({modal:a,closeOnFocusOut:p,open:m,onOpenChange:v,refs:h}),()=>{O.setFocusManagerState(null)}},[r,O,a,m,v,h,p]),bt(()=>{if(r)return;if(!_)return;if("function"!=typeof MutationObserver)return;if(E)return;const e=()=>{const e=_.getAttribute("tabindex"),t=X(),n=P(j(R)),o=t.indexOf(n);-1!==o&&(z.current=o),C.current.includes("floating")||n!==h.domReference.current&&0===t.length?"0"!==e&&_.setAttribute("tabindex","0"):"-1"!==e&&_.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(_,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}},[r,R,_,h,C,X,E]);const Z=!r&&A&&(!a||!S)&&(K||a);return e.createElement(e.Fragment,null,Z&&e.createElement(Zt,{"data-type":"inside",ref:null==O?void 0:O.beforeInsideRef,onFocus:e=>{if(a){const e=$();Pt("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=O&&O.preserveTabOrder&&O.portalNode)if(I.current=!1,_t(e,O.portalNode)){const e=zt()||x;null==e||e.focus()}else{var t;null==(t=O.beforeOutsideRef.current)||t.focus()}}}),!S&&Y("start"),o,Y("end"),Z&&e.createElement(Zt,{"data-type":"inside",ref:null==O?void 0:O.afterInsideRef,onFocus:e=>{if(a)Pt($()[0]);else if(null!=O&&O.preserveTabOrder&&O.portalNode)if(p&&(I.current=!0),_t(e,O.portalNode)){const e=Kt()||x;null==e||e.focus()}else{var t;null==(t=O.afterOutsideRef.current)||t.focus()}}}))}let un=0;let sn=()=>{};const an=e.forwardRef(function(t,n){const{lockScroll:o=!1,...r}=t;return bt(()=>{if(o)return un++,1===un&&(sn=function(){const e=/iP(hone|ad|od)|iOS/.test(F()),t=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,r=t.left?parseFloat(t.left):window.scrollX,i=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",o&&(t[n]=o+"px"),e){var l,c;const e=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(i-Math.floor(n))+"px",left:-(r-Math.floor(e))+"px",right:"0"})}return()=>{Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(r,i))}}()),()=>{un--,0===un&&sn()}},[o]),e.createElement("div",xt({ref:n},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}),fn={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},dn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},pn=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function mn(t,n){void 0===n&&(n={});const{open:o,onOpenChange:r,elements:i,dataRef:l}=t,{enabled:c=!0,escapeKey:u=!0,outsidePress:s=!0,outsidePressEvent:d="pointerdown",referencePress:p=!1,referencePressEvent:m="pointerdown",ancestorScroll:h=!1,bubbles:g,capture:v}=n,y=kt(),w=wt("function"==typeof s?s:()=>!1),b="function"==typeof s?w:s,x=e.useRef(!1),R=e.useRef(!1),{escapeKey:S,outsidePress:L}=pn(g),{escapeKey:T,outsidePress:M}=pn(v),P=e.useRef(!1),F=wt(e=>{var t;if(!o||!c||!u||"Escape"!==e.key)return;if(P.current)return;const n=null==(t=l.current.floatingContext)?void 0:t.nodeId,i=y?Dt(y.nodesRef.current,n):[];if(!S&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)}),!e)return}r(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")}),I=wt(e=>{var t;const n=()=>{var t;F(e),null==(t=V(e))||t.removeEventListener("keydown",n)};null==(t=V(e))||t.addEventListener("keydown",n)}),N=wt(e=>{var t;const n=x.current;x.current=!1;const o=R.current;if(R.current=!1,"click"===d&&o)return;if(n)return;if("function"==typeof b&&!b(e))return;const c=V(e),u="["+Tt("inert")+"]",s=j(i.floating).querySelectorAll(u);let p=a(c)?c:null;for(;p&&!A(p);){const e=k(p);if(A(e)||!a(e))break;p=e}if(s.length&&a(c)&&!c.matches("html,body")&&!D(c,i.floating)&&Array.from(s).every(e=>!D(p,e)))return;if(f(c)&&q){const t=c.clientWidth>0&&c.scrollWidth>c.clientWidth,n=c.clientHeight>0&&c.scrollHeight>c.clientHeight;let o=n&&e.offsetX>c.clientWidth;if(n){"rtl"===C(c).direction&&(o=e.offsetX<=c.offsetWidth-c.clientWidth)}if(o||t&&e.offsetY>c.clientHeight)return}const m=null==(t=l.current.floatingContext)?void 0:t.nodeId,h=y&&Dt(y.nodesRef.current,m).some(t=>{var n;return B(e,null==(n=t.context)?void 0:n.elements.floating)});if(B(e,i.floating)||B(e,i.domReference)||h)return;const g=y?Dt(y.nodesRef.current,m):[];if(g.length>0){let e=!0;if(g.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)}),!e)return}r(!1,e,"outside-press")}),W=wt(e=>{var t;const n=()=>{var t;N(e),null==(t=V(e))||t.removeEventListener(d,n)};null==(t=V(e))||t.addEventListener(d,n)});e.useEffect(()=>{if(!o||!c)return;l.current.__escapeKeyBubbles=S,l.current.__outsidePressBubbles=L;let e=-1;function t(e){r(!1,e,"ancestor-scroll")}function n(){window.clearTimeout(e),P.current=!0}function s(){e=window.setTimeout(()=>{P.current=!1},E()?5:0)}const f=j(i.floating);u&&(f.addEventListener("keydown",T?I:F,T),f.addEventListener("compositionstart",n),f.addEventListener("compositionend",s)),b&&f.addEventListener(d,M?W:N,M);let p=[];return h&&(a(i.domReference)&&(p=O(i.domReference)),a(i.floating)&&(p=p.concat(O(i.floating))),!a(i.reference)&&i.reference&&i.reference.contextElement&&(p=p.concat(O(i.reference.contextElement)))),p=p.filter(e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)}),p.forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{u&&(f.removeEventListener("keydown",T?I:F,T),f.removeEventListener("compositionstart",n),f.removeEventListener("compositionend",s)),b&&f.removeEventListener(d,M?W:N,M),p.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[l,i,u,b,d,o,r,h,c,S,L,F,T,I,N,M,W]),e.useEffect(()=>{x.current=!1},[b,d]);const H=e.useMemo(()=>({onKeyDown:F,[fn[m]]:e=>{p&&r(!1,e.nativeEvent,"reference-press")}}),[F,r,p,m]),q=e.useMemo(()=>({onKeyDown:F,onMouseDown(){R.current=!0},onMouseUp(){R.current=!0},[dn[d]]:()=>{x.current=!0}}),[F,d]);return e.useMemo(()=>c?{reference:H,floating:q}:{},[c,H,q])}function hn(t){const{open:n=!1,onOpenChange:o,elements:r}=t,i=At(),l=e.useRef({}),[c]=e.useState(()=>function(){const e=new Map;return{emit(t,n){var o;null==(o=e.get(t))||o.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var o;e.set(t,(null==(o=e.get(t))?void 0:o.filter(e=>e!==n))||[])}}}()),u=null!=((null==(s=e.useContext(Ct))?void 0:s.id)||null);var s;const[a,f]=e.useState(r.reference),d=wt((e,t,n)=>{l.current.openEvent=e?t:void 0,c.emit("openchange",{open:e,event:t,reason:n,nested:u}),null==o||o(e,t,n)}),p=e.useMemo(()=>({setPositionReference:f}),[]),m=e.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return e.useMemo(()=>({dataRef:l,open:n,onOpenChange:d,elements:m,events:c,floatingId:i,refs:p}),[n,d,m,c,i,p])}function gn(t){void 0===t&&(t={});const{nodeId:n}=t,o=hn({...t,elements:{reference:null,floating:null,...t.elements}}),i=t.rootContext||o,l=i.elements,[c,u]=e.useState(null),[s,f]=e.useState(null),d=(null==l?void 0:l.domReference)||c,p=e.useRef(null),m=kt();bt(()=>{d&&(p.current=d)},[d]);const h=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:l,elements:{reference:c,floating:u}={},transform:s=!0,whileElementsMounted:a,open:f}=t,[d,p]=e.useState({x:0,y:0,strategy:o,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=e.useState(i);ct(m,i)||h(i);const[g,v]=e.useState(null),[y,w]=e.useState(null),b=e.useCallback(e=>{e!==S.current&&(S.current=e,v(e))},[]),x=e.useCallback(e=>{e!==A.current&&(A.current=e,w(e))},[]),R=c||g,E=u||y,S=e.useRef(null),A=e.useRef(null),C=e.useRef(d),L=null!=a,k=at(a),T=at(l),O=at(f),M=e.useCallback(()=>{if(!S.current||!A.current)return;const e={placement:n,strategy:o,middleware:m};T.current&&(e.platform=T.current),it(S.current,A.current,e).then(e=>{const t={...e,isPositioned:!1!==O.current};P.current&&!ct(C.current,t)&&(C.current=t,r.flushSync(()=>{p(t)}))})},[m,n,o,T,O]);lt(()=>{!1===f&&C.current.isPositioned&&(C.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[f]);const P=e.useRef(!1);lt(()=>(P.current=!0,()=>{P.current=!1}),[]),lt(()=>{if(R&&(S.current=R),E&&(A.current=E),R&&E){if(k.current)return k.current(R,E,M);M()}},[R,E,M,k,L]);const D=e.useMemo(()=>({reference:S,floating:A,setReference:b,setFloating:x}),[b,x]),F=e.useMemo(()=>({reference:R,floating:E}),[R,E]),I=e.useMemo(()=>{const e={position:o,left:0,top:0};if(!F.floating)return e;const t=st(F.floating,d.x),n=st(F.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...ut(F.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:t,top:n}},[o,s,F.floating,d.x,d.y]);return e.useMemo(()=>({...d,update:M,refs:D,elements:F,floatingStyles:I}),[d,M,D,F,I])}({...t,elements:{...l,...s&&{reference:s}}}),g=e.useCallback(e=>{const t=a(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;f(t),h.refs.setReference(t)},[h.refs]),v=e.useCallback(e=>{(a(e)||null===e)&&(p.current=e,u(e)),(a(h.refs.reference.current)||null===h.refs.reference.current||null!==e&&!a(e))&&h.refs.setReference(e)},[h.refs]),y=e.useMemo(()=>({...h.refs,setReference:v,setPositionReference:g,domReference:p}),[h.refs,v,g]),w=e.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=e.useMemo(()=>({...h,...i,refs:y,elements:w,nodeId:n}),[h,y,w,n,i]);return bt(()=>{i.dataRef.current.floatingContext=b;const e=null==m?void 0:m.nodesRef.current.find(e=>e.id===n);e&&(e.context=b)}),e.useMemo(()=>({...h,context:b,refs:y,elements:w}),[h,y,w,b])}const vn="active",yn="selected";function wn(e,t,n){const o=new Map,r="item"===n;let i=e;if(r&&e){const{[vn]:t,[yn]:n,...o}=e;i=o}return{..."floating"===n&&{tabIndex:-1,[tn]:""},...i,...t.map(t=>{const o=t?t[n]:null;return"function"==typeof o?e?o(e):null:o}).concat(e).reduce((e,t)=>t?(Object.entries(t).forEach(t=>{let[n,i]=t;var l;r&&[vn,yn].includes(n)||(0===n.indexOf("on")?(o.has(n)||o.set(n,[]),"function"==typeof i&&(null==(l=o.get(n))||l.push(i),e[n]=function(){for(var e,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return null==(e=o.get(n))?void 0:e.map(e=>e(...r)).find(e=>void 0!==e)})):e[n]=i)}),e):e,{})}}function bn(t){void 0===t&&(t=[]);const n=t.map(e=>null==e?void 0:e.reference),o=t.map(e=>null==e?void 0:e.floating),r=t.map(e=>null==e?void 0:e.item),i=e.useCallback(e=>wn(e,t,"reference"),n),l=e.useCallback(e=>wn(e,t,"floating"),o),c=e.useCallback(e=>wn(e,t,"item"),r);return e.useMemo(()=>({getReferenceProps:i,getFloatingProps:l,getItemProps:c}),[i,l,c])}const xn=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase());function Rn(e,t){return"function"==typeof e?e(t):e}function En(t,n){void 0===n&&(n={});const{open:o,elements:{floating:r}}=t,{duration:i=250}=n,l=("number"==typeof i?i:i.close)||0,[c,u]=e.useState("unmounted"),s=function(t,n){const[o,r]=e.useState(t);return t&&!o&&r(!0),e.useEffect(()=>{if(!t&&o){const e=setTimeout(()=>r(!1),n);return()=>clearTimeout(e)}},[t,o,n]),o}(o,l);return s||"close"!==c||u("unmounted"),bt(()=>{if(r){if(o){u("initial");const e=requestAnimationFrame(()=>{u("open")});return()=>{cancelAnimationFrame(e)}}u("close")}},[o,r]),{isMounted:s,status:c}}function Sn(t,n){void 0===n&&(n={});const{initial:o={opacity:0},open:r,close:i,common:l,duration:c=250}=n,u=t.placement,s=u.split("-")[0],a=e.useMemo(()=>({side:s,placement:u}),[s,u]),f="number"==typeof c,d=(f?c:c.open)||0,p=(f?c:c.close)||0,[m,h]=e.useState(()=>({...Rn(l,a),...Rn(o,a)})),{isMounted:g,status:v}=En(t,{duration:c}),y=Ot(o),w=Ot(r),b=Ot(i),x=Ot(l);return bt(()=>{const e=Rn(y.current,a),t=Rn(b.current,a),n=Rn(x.current,a),o=Rn(w.current,a)||Object.keys(e).reduce((e,t)=>(e[t]="",e),{});if("initial"===v&&h(t=>({transitionProperty:t.transitionProperty,...n,...e})),"open"===v&&h({transitionProperty:Object.keys(o).map(xn).join(","),transitionDuration:d+"ms",...n,...o}),"close"===v){const o=t||e;h({transitionProperty:Object.keys(o).map(xn).join(","),transitionDuration:p+"ms",...n,...o})}},[p,b,y,w,x,d,v,a]),{isMounted:g,styles:m}}export{cn as F,Qe as a,Sn as b,mt as c,gt as d,mn as e,pt as f,bn as g,At as h,ht as i,Qt as j,an as k,ft as o,dt as s,gn as u};
|
package/dist/chunks/{highlight-color-picker-13e8f1eb.js → highlight-color-picker-534fa3e2.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as r,jsx as o}from"react/jsx-runtime";import t,{useRef as n,useMemo as a,useEffect as c,useCallback as l,useState as i,useLayoutEffect as u,forwardRef as s,cloneElement as f}from"react";import{u as h,o as d,f as p,s as g,a as v}from"./floating-ui.react-0123aadf.js";function m(){return(m=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e}).apply(this,arguments)}function b(e,r){if(null==e)return{};var o,t,n={},a=Object.keys(e);for(t=0;t<a.length;t++)r.indexOf(o=a[t])>=0||(n[o]=e[o]);return n}function _(e){var r=n(e),o=n(function(e){r.current&&r.current(e)});return r.current=e,o.current}var C=function(e,r,o){return void 0===r&&(r=0),void 0===o&&(o=1),e>o?o:e<r?r:e},k=function(e){return"touches"in e},x=function(e){return e&&e.ownerDocument.defaultView||self},w=function(e,r,o){var t=e.getBoundingClientRect(),n=k(r)?function(e,r){for(var o=0;o<e.length;o++)if(e[o].identifier===r)return e[o];return e[0]}(r.touches,o):r;return{left:C((n.pageX-(t.left+x(e).pageXOffset))/t.width),top:C((n.pageY-(t.top+x(e).pageYOffset))/t.height)}},y=function(e){!k(e)&&e.preventDefault()},F=t.memo(function(e){var r=e.onMove,o=e.onKey,l=b(e,["onMove","onKey"]),i=n(null),u=_(r),s=_(o),f=n(null),h=n(!1),d=a(function(){var e=function(e){y(e),(k(e)?e.touches.length>0:e.buttons>0)&&i.current?u(w(i.current,e,f.current)):o(!1)},r=function(){return o(!1)};function o(o){var t=h.current,n=x(i.current),a=o?n.addEventListener:n.removeEventListener;a(t?"touchmove":"mousemove",e),a(t?"touchend":"mouseup",r)}return[function(e){var r=e.nativeEvent,t=i.current;if(t&&(y(r),!function(e,r){return r&&!k(e)}(r,h.current)&&t)){if(k(r)){h.current=!0;var n=r.changedTouches||[];n.length&&(f.current=n[0].identifier)}t.focus(),u(w(t,r,f.current)),o(!0)}},function(e){var r=e.which||e.keyCode;r<37||r>40||(e.preventDefault(),s({left:39===r?.05:37===r?-.05:0,top:40===r?.05:38===r?-.05:0}))},o]},[s,u]),p=d[0],g=d[1],v=d[2];return c(function(){return v},[v]),t.createElement("div",m({},l,{onTouchStart:p,onMouseDown:p,className:"react-colorful__interactive",ref:i,onKeyDown:g,tabIndex:0,role:"slider"}))}),N=function(e){return e.filter(Boolean).join(" ")},E=function(e){var r=e.color,o=e.left,n=e.top,a=void 0===n?.5:n,c=N(["react-colorful__pointer",e.className]);return t.createElement("div",{className:c,style:{top:100*a+"%",left:100*o+"%"}},t.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:r}}))},O=function(e,r,o){return void 0===r&&(r=0),void 0===o&&(o=Math.pow(10,r)),Math.round(o*e)/o},M=function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?O(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?O(parseInt(e.substring(6,8),16)/255,2):1}},j=function(e){var r=function(e){var r=e.s,o=e.v,t=e.a,n=(200-r)*o/100;return{h:O(e.h),s:O(n>0&&n<200?r*o/100/(n<=100?n:200-n)*100:0),l:O(n/2),a:O(t,2)}}(e);return"hsl("+r.h+", "+r.s+"%, "+r.l+"%)"},H=function(e){var r=e.h,o=e.s,t=e.v,n=e.a;r=r/360*6,o/=100,t/=100;var a=Math.floor(r),c=t*(1-o),l=t*(1-(r-a)*o),i=t*(1-(1-r+a)*o),u=a%6;return{r:O(255*[t,l,c,c,i,t][u]),g:O(255*[i,t,t,l,c,c][u]),b:O(255*[c,c,i,t,t,l][u]),a:O(n,2)}},I=function(e){var r=e.toString(16);return r.length<2?"0"+r:r},L=function(e){var r=e.r,o=e.g,t=e.b,n=e.a,a=n<1?I(O(255*n)):"";return"#"+I(r)+I(o)+I(t)+a},B=function(e){var r=e.r,o=e.g,t=e.b,n=e.a,a=Math.max(r,o,t),c=a-Math.min(r,o,t),l=c?a===r?(o-t)/c:a===o?2+(t-r)/c:4+(r-o)/c:0;return{h:O(60*(l<0?l+6:l)),s:O(a?c/a*100:0),v:O(a/255*100),a:n}},z=t.memo(function(e){var r=e.hue,o=e.onChange,n=N(["react-colorful__hue",e.className]);return t.createElement("div",{className:n},t.createElement(F,{onMove:function(e){o({h:360*e.left})},onKey:function(e){o({h:C(r+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":O(r),"aria-valuemax":"360","aria-valuemin":"0"},t.createElement(E,{className:"react-colorful__hue-pointer",left:r/360,color:j({h:r,s:100,v:100,a:1})})))}),D=t.memo(function(e){var r=e.hsva,o=e.onChange,n={backgroundColor:j({h:r.h,s:100,v:100,a:1})};return t.createElement("div",{className:"react-colorful__saturation",style:n},t.createElement(F,{onMove:function(e){o({s:100*e.left,v:100-100*e.top})},onKey:function(e){o({s:C(r.s+100*e.left,0,100),v:C(r.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+O(r.s)+"%, Brightness "+O(r.v)+"%"},t.createElement(E,{className:"react-colorful__saturation-pointer",top:1-r.v/100,left:r.s/100,color:j(r)})))}),K=function(e,r){if(e===r)return!0;for(var o in e)if(e[o]!==r[o])return!1;return!0};function P(e,r,o){var t=_(o),a=i(function(){return e.toHsva(r)}),u=a[0],s=a[1],f=n({color:r,hsva:u});c(function(){if(!e.equal(r,f.current.color)){var o=e.toHsva(r);f.current={hsva:o,color:r},s(o)}},[r,e]),c(function(){var r;K(u,f.current.hsva)||e.equal(r=e.fromHsva(u),f.current.color)||(f.current={hsva:u,color:r},t(r))},[u,e,t]);var h=l(function(e){s(function(r){return Object.assign({},r,e)})},[]);return[u,h]}var S="undefined"!=typeof window?u:c,T=new Map,q=function(e){S(function(){var r=e.current?e.current.ownerDocument:document;if(void 0!==r&&!T.has(r)){var o=r.createElement("style");o.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',T.set(r,o);var t="undefined"!=typeof __webpack_nonce__?__webpack_nonce__:void 0;t&&o.setAttribute("nonce",t),r.head.appendChild(o)}},[])},A=function(e){var r=e.className,o=e.colorModel,a=e.color,c=void 0===a?o.defaultColor:a,l=e.onChange,i=b(e,["className","colorModel","color","onChange"]),u=n(null);q(u);var s=P(o,c,l),f=s[0],h=s[1],d=N(["react-colorful",r]);return t.createElement("div",m({},i,{ref:u,className:d}),t.createElement(D,{hsva:f,onChange:h}),t.createElement(z,{hue:f.h,onChange:h,className:"react-colorful__last-control"}))},$={defaultColor:"000",toHsva:function(e){return B(M(e))},fromHsva:function(e){return function(e){return L(H(e))}({h:e.h,s:e.s,v:e.v,a:1})},equal:function(e,r){return e.toLowerCase()===r.toLowerCase()||K(M(e),M(r))}},R=function(e){return t.createElement(A,m({},e,{colorModel:$}))},X=/^#?([0-9A-F]{3,8})$/i,Y=function(e){var r=e.color,o=void 0===r?"":r,n=e.onChange,a=e.onBlur,u=e.escape,s=e.validate,f=e.format,h=e.process,d=b(e,["color","onChange","onBlur","escape","validate","format","process"]),p=i(function(){return u(o)}),g=p[0],v=p[1],C=_(n),k=_(a),x=l(function(e){var r=u(e.target.value);v(r),s(r)&&C(h?h(r):r)},[u,h,s,C]),w=l(function(e){s(e.target.value)||v(u(o)),k(e)},[o,u,s,k]);return c(function(){v(u(o))},[o,u]),t.createElement("input",m({},d,{value:f?f(g):g,spellCheck:"false",onChange:x,onBlur:w}))},V=function(e){return"#"+e},G=function(e){var r=e.prefixed,o=e.alpha,n=b(e,["prefixed","alpha"]),a=l(function(e){return e.replace(/([^0-9A-F]+)/gi,"").substring(0,o?8:6)},[o]),c=l(function(e){return function(e,r){var o=X.exec(e),t=o?o[1].length:0;return 3===t||6===t||!!r&&4===t||!!r&&8===t}(e,o)},[o]);return t.createElement(Y,m({},n,{escape:a,format:r?V:void 0,process:V,validate:c}))};const J=["#FFFF00","#FFE066","#FFCC99","#FF9999","#99CCFF","#99FF99","#FF99FF","#CC99FF"],Q=s(({value:t={backgroundColor:"#FFFF00"},onChange:n,presets:a=J,showInput:l=!0,className:u,children:s,placement:m="bottom",offset:b=8},_)=>{const[C,k]=i(!1),[x,w]=i("backgroundColor"),[y,F]=i(t.backgroundColor),[N,E]=i(t.color),{refs:O,floatingStyles:M}=h({open:C,onOpenChange:k,placement:m,middleware:[d(b),p(),g()],whileElementsMounted:v});c(()=>{t.backgroundColor&&F(t.backgroundColor),t.color&&E(t.color)},[t]),c(()=>{if(!C)return;const e=e=>{const r=e.target,o=O.reference.current,t=O.floating.current;o&&o instanceof Element&&o.contains(r)||(null==t?void 0:t.contains(r))||k(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[C,O.floating,O.reference]);const j=e=>{"backgroundColor"===x?(F(e),null==n||n(Object.assign(Object.assign({},t),{backgroundColor:e}))):(E(e),null==n||n(Object.assign(Object.assign({},t),{color:e})))},H="backgroundColor"===x?y:N,I=f(s,{ref:O.setReference,onClick:e=>{var r,o;e.stopPropagation(),k(e=>!e),null===(o=(r=s.props).onClick)||void 0===o||o.call(r,e)}});return e(r,{children:[I,C&&e("div",Object.assign({ref:e=>{O.setFloating(e),_&&("function"==typeof _?_(e):_.current=e)},style:M,className:`yoopta-highlight-color-picker ${null!=u?u:""}`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()},{children:[e("div",Object.assign({className:"yoopta-highlight-color-picker__mode-toggle"},{children:[o("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"backgroundColor"===x,onClick:()=>w("backgroundColor"),"aria-label":"Background color"},{children:"Background"})),o("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"color"===x,onClick:()=>w("color"),"aria-label":"Text color"},{children:"Text"}))]})),o("div",Object.assign({className:"yoopta-highlight-color-picker__picker"},{children:o(R,{color:H,onChange:j,className:"yoopta-highlight-color-picker__react-colorful"})})),a.length>0&&o("div",Object.assign({className:"yoopta-highlight-color-picker__presets"},{children:a.map(e=>{const r=(null==H?void 0:H.toLowerCase())===e.toLowerCase();return o("button",{type:"button",className:"yoopta-highlight-color-picker__preset","data-selected":r,style:{backgroundColor:e},onClick:()=>j(e),"aria-label":`Select color ${e}`},e)})})),l&&e("div",Object.assign({className:"yoopta-highlight-color-picker__hex-row"},{children:[o("div",{className:"yoopta-highlight-color-picker__swatch",style:{backgroundColor:H}}),o(G,{color:H,onChange:j,className:"yoopta-highlight-color-picker__hex-input",prefixed:!0})]}))]}))]})});Q.displayName="HighlightColorPicker";export{Q as H};
|
|
1
|
+
import{jsxs as e,Fragment as r,jsx as o}from"react/jsx-runtime";import t,{useRef as n,useMemo as a,useEffect as c,useCallback as l,useState as i,useLayoutEffect as u,forwardRef as s,cloneElement as f}from"react";import{u as h,o as d,f as p,s as g,a as v}from"./floating-ui.react-33212df0.js";function m(){return(m=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e}).apply(this,arguments)}function b(e,r){if(null==e)return{};var o,t,n={},a=Object.keys(e);for(t=0;t<a.length;t++)r.indexOf(o=a[t])>=0||(n[o]=e[o]);return n}function _(e){var r=n(e),o=n(function(e){r.current&&r.current(e)});return r.current=e,o.current}var C=function(e,r,o){return void 0===r&&(r=0),void 0===o&&(o=1),e>o?o:e<r?r:e},k=function(e){return"touches"in e},x=function(e){return e&&e.ownerDocument.defaultView||self},w=function(e,r,o){var t=e.getBoundingClientRect(),n=k(r)?function(e,r){for(var o=0;o<e.length;o++)if(e[o].identifier===r)return e[o];return e[0]}(r.touches,o):r;return{left:C((n.pageX-(t.left+x(e).pageXOffset))/t.width),top:C((n.pageY-(t.top+x(e).pageYOffset))/t.height)}},y=function(e){!k(e)&&e.preventDefault()},F=t.memo(function(e){var r=e.onMove,o=e.onKey,l=b(e,["onMove","onKey"]),i=n(null),u=_(r),s=_(o),f=n(null),h=n(!1),d=a(function(){var e=function(e){y(e),(k(e)?e.touches.length>0:e.buttons>0)&&i.current?u(w(i.current,e,f.current)):o(!1)},r=function(){return o(!1)};function o(o){var t=h.current,n=x(i.current),a=o?n.addEventListener:n.removeEventListener;a(t?"touchmove":"mousemove",e),a(t?"touchend":"mouseup",r)}return[function(e){var r=e.nativeEvent,t=i.current;if(t&&(y(r),!function(e,r){return r&&!k(e)}(r,h.current)&&t)){if(k(r)){h.current=!0;var n=r.changedTouches||[];n.length&&(f.current=n[0].identifier)}t.focus(),u(w(t,r,f.current)),o(!0)}},function(e){var r=e.which||e.keyCode;r<37||r>40||(e.preventDefault(),s({left:39===r?.05:37===r?-.05:0,top:40===r?.05:38===r?-.05:0}))},o]},[s,u]),p=d[0],g=d[1],v=d[2];return c(function(){return v},[v]),t.createElement("div",m({},l,{onTouchStart:p,onMouseDown:p,className:"react-colorful__interactive",ref:i,onKeyDown:g,tabIndex:0,role:"slider"}))}),N=function(e){return e.filter(Boolean).join(" ")},E=function(e){var r=e.color,o=e.left,n=e.top,a=void 0===n?.5:n,c=N(["react-colorful__pointer",e.className]);return t.createElement("div",{className:c,style:{top:100*a+"%",left:100*o+"%"}},t.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:r}}))},O=function(e,r,o){return void 0===r&&(r=0),void 0===o&&(o=Math.pow(10,r)),Math.round(o*e)/o},M=function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?O(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?O(parseInt(e.substring(6,8),16)/255,2):1}},j=function(e){var r=function(e){var r=e.s,o=e.v,t=e.a,n=(200-r)*o/100;return{h:O(e.h),s:O(n>0&&n<200?r*o/100/(n<=100?n:200-n)*100:0),l:O(n/2),a:O(t,2)}}(e);return"hsl("+r.h+", "+r.s+"%, "+r.l+"%)"},H=function(e){var r=e.h,o=e.s,t=e.v,n=e.a;r=r/360*6,o/=100,t/=100;var a=Math.floor(r),c=t*(1-o),l=t*(1-(r-a)*o),i=t*(1-(1-r+a)*o),u=a%6;return{r:O(255*[t,l,c,c,i,t][u]),g:O(255*[i,t,t,l,c,c][u]),b:O(255*[c,c,i,t,t,l][u]),a:O(n,2)}},I=function(e){var r=e.toString(16);return r.length<2?"0"+r:r},L=function(e){var r=e.r,o=e.g,t=e.b,n=e.a,a=n<1?I(O(255*n)):"";return"#"+I(r)+I(o)+I(t)+a},B=function(e){var r=e.r,o=e.g,t=e.b,n=e.a,a=Math.max(r,o,t),c=a-Math.min(r,o,t),l=c?a===r?(o-t)/c:a===o?2+(t-r)/c:4+(r-o)/c:0;return{h:O(60*(l<0?l+6:l)),s:O(a?c/a*100:0),v:O(a/255*100),a:n}},z=t.memo(function(e){var r=e.hue,o=e.onChange,n=N(["react-colorful__hue",e.className]);return t.createElement("div",{className:n},t.createElement(F,{onMove:function(e){o({h:360*e.left})},onKey:function(e){o({h:C(r+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":O(r),"aria-valuemax":"360","aria-valuemin":"0"},t.createElement(E,{className:"react-colorful__hue-pointer",left:r/360,color:j({h:r,s:100,v:100,a:1})})))}),D=t.memo(function(e){var r=e.hsva,o=e.onChange,n={backgroundColor:j({h:r.h,s:100,v:100,a:1})};return t.createElement("div",{className:"react-colorful__saturation",style:n},t.createElement(F,{onMove:function(e){o({s:100*e.left,v:100-100*e.top})},onKey:function(e){o({s:C(r.s+100*e.left,0,100),v:C(r.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+O(r.s)+"%, Brightness "+O(r.v)+"%"},t.createElement(E,{className:"react-colorful__saturation-pointer",top:1-r.v/100,left:r.s/100,color:j(r)})))}),K=function(e,r){if(e===r)return!0;for(var o in e)if(e[o]!==r[o])return!1;return!0};function P(e,r,o){var t=_(o),a=i(function(){return e.toHsva(r)}),u=a[0],s=a[1],f=n({color:r,hsva:u});c(function(){if(!e.equal(r,f.current.color)){var o=e.toHsva(r);f.current={hsva:o,color:r},s(o)}},[r,e]),c(function(){var r;K(u,f.current.hsva)||e.equal(r=e.fromHsva(u),f.current.color)||(f.current={hsva:u,color:r},t(r))},[u,e,t]);var h=l(function(e){s(function(r){return Object.assign({},r,e)})},[]);return[u,h]}var S="undefined"!=typeof window?u:c,T=new Map,q=function(e){S(function(){var r=e.current?e.current.ownerDocument:document;if(void 0!==r&&!T.has(r)){var o=r.createElement("style");o.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',T.set(r,o);var t="undefined"!=typeof __webpack_nonce__?__webpack_nonce__:void 0;t&&o.setAttribute("nonce",t),r.head.appendChild(o)}},[])},A=function(e){var r=e.className,o=e.colorModel,a=e.color,c=void 0===a?o.defaultColor:a,l=e.onChange,i=b(e,["className","colorModel","color","onChange"]),u=n(null);q(u);var s=P(o,c,l),f=s[0],h=s[1],d=N(["react-colorful",r]);return t.createElement("div",m({},i,{ref:u,className:d}),t.createElement(D,{hsva:f,onChange:h}),t.createElement(z,{hue:f.h,onChange:h,className:"react-colorful__last-control"}))},$={defaultColor:"000",toHsva:function(e){return B(M(e))},fromHsva:function(e){return function(e){return L(H(e))}({h:e.h,s:e.s,v:e.v,a:1})},equal:function(e,r){return e.toLowerCase()===r.toLowerCase()||K(M(e),M(r))}},R=function(e){return t.createElement(A,m({},e,{colorModel:$}))},X=/^#?([0-9A-F]{3,8})$/i,Y=function(e){var r=e.color,o=void 0===r?"":r,n=e.onChange,a=e.onBlur,u=e.escape,s=e.validate,f=e.format,h=e.process,d=b(e,["color","onChange","onBlur","escape","validate","format","process"]),p=i(function(){return u(o)}),g=p[0],v=p[1],C=_(n),k=_(a),x=l(function(e){var r=u(e.target.value);v(r),s(r)&&C(h?h(r):r)},[u,h,s,C]),w=l(function(e){s(e.target.value)||v(u(o)),k(e)},[o,u,s,k]);return c(function(){v(u(o))},[o,u]),t.createElement("input",m({},d,{value:f?f(g):g,spellCheck:"false",onChange:x,onBlur:w}))},V=function(e){return"#"+e},G=function(e){var r=e.prefixed,o=e.alpha,n=b(e,["prefixed","alpha"]),a=l(function(e){return e.replace(/([^0-9A-F]+)/gi,"").substring(0,o?8:6)},[o]),c=l(function(e){return function(e,r){var o=X.exec(e),t=o?o[1].length:0;return 3===t||6===t||!!r&&4===t||!!r&&8===t}(e,o)},[o]);return t.createElement(Y,m({},n,{escape:a,format:r?V:void 0,process:V,validate:c}))};const J=["#FFFF00","#FFE066","#FFCC99","#FF9999","#99CCFF","#99FF99","#FF99FF","#CC99FF"],Q=s(({value:t={backgroundColor:"#FFFF00"},onChange:n,presets:a=J,showInput:l=!0,className:u,children:s,placement:m="bottom",offset:b=8},_)=>{const[C,k]=i(!1),[x,w]=i("backgroundColor"),[y,F]=i(t.backgroundColor),[N,E]=i(t.color),{refs:O,floatingStyles:M}=h({open:C,onOpenChange:k,placement:m,middleware:[d(b),p(),g()],whileElementsMounted:v});c(()=>{t.backgroundColor&&F(t.backgroundColor),t.color&&E(t.color)},[t]),c(()=>{if(!C)return;const e=e=>{const r=e.target,o=O.reference.current,t=O.floating.current;o&&o instanceof Element&&o.contains(r)||(null==t?void 0:t.contains(r))||k(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[C,O.floating,O.reference]);const j=e=>{"backgroundColor"===x?(F(e),null==n||n(Object.assign(Object.assign({},t),{backgroundColor:e}))):(E(e),null==n||n(Object.assign(Object.assign({},t),{color:e})))},H="backgroundColor"===x?y:N,I=f(s,{ref:O.setReference,onClick:e=>{var r,o;e.stopPropagation(),k(e=>!e),null===(o=(r=s.props).onClick)||void 0===o||o.call(r,e)}});return e(r,{children:[I,C&&e("div",Object.assign({ref:e=>{O.setFloating(e),_&&("function"==typeof _?_(e):_.current=e)},style:M,className:`yoopta-highlight-color-picker ${null!=u?u:""}`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()},{children:[e("div",Object.assign({className:"yoopta-highlight-color-picker__mode-toggle"},{children:[o("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"backgroundColor"===x,onClick:()=>w("backgroundColor"),"aria-label":"Background color"},{children:"Background"})),o("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"color"===x,onClick:()=>w("color"),"aria-label":"Text color"},{children:"Text"}))]})),o("div",Object.assign({className:"yoopta-highlight-color-picker__picker"},{children:o(R,{color:H,onChange:j,className:"yoopta-highlight-color-picker__react-colorful"})})),a.length>0&&o("div",Object.assign({className:"yoopta-highlight-color-picker__presets"},{children:a.map(e=>{const r=(null==H?void 0:H.toLowerCase())===e.toLowerCase();return o("button",{type:"button",className:"yoopta-highlight-color-picker__preset","data-selected":r,style:{backgroundColor:e},onClick:()=>j(e),"aria-label":`Select color ${e}`},e)})})),l&&e("div",Object.assign({className:"yoopta-highlight-color-picker__hex-row"},{children:[o("div",{className:"yoopta-highlight-color-picker__swatch",style:{backgroundColor:H}}),o(G,{color:H,onChange:j,className:"yoopta-highlight-color-picker__hex-input",prefixed:!0})]}))]}))]})});Q.displayName="HighlightColorPicker";export{Q as H};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./_tslib-5e145dfd.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{forwardRef as o,isValidElement as i,cloneElement as s,useMemo as a,useState as l,useCallback as c,useEffect as r}from"react";import{u as p,f as d,s as u,o as m,a as v,b as f}from"./floating-ui.react-
|
|
1
|
+
import{_ as e}from"./_tslib-5e145dfd.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{forwardRef as o,isValidElement as i,cloneElement as s,useMemo as a,useState as l,useCallback as c,useEffect as r}from"react";import{u as p,f as d,s as u,o as m,a as v,b as f}from"./floating-ui.react-33212df0.js";import{Blocks as g,getAllowedPluginsFromElement as y,getRootBlockElement as b,useYooptaEditor as N}from"@yoopta/editor";import{c as h}from"./index-06d5c4e7.js";const w=o((n,o)=>{var{children:i,style:s,className:a}=n,l=e(n,["children","style","className"]);return t("div",Object.assign({ref:o,role:"listbox",tabIndex:0,style:s,className:`yoopta-ui-action-menu-list-content ${a||""}`,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()},l,{children:i}))});w.displayName="ActionMenuList.Root";const j=o((n,o)=>{var{children:i,className:s}=n,a=e(n,["children","className"]);return t("div",Object.assign({ref:o,className:`yoopta-ui-action-menu-list-group ${s||""}`},a,{children:i}))});j.displayName="ActionMenuList.Group";const k=o((o,a)=>{var{action:l,selected:c,icon:r,className:p}=o,d=e(o,["action","selected","icon","className"]);return n("button",Object.assign({ref:a,type:"button",className:`yoopta-ui-action-menu-list-item ${c?"selected":""} ${p||""}`},d,{children:[r&&t("div",Object.assign({className:"yoopta-ui-action-menu-list-item-icon"},{children:(e=>{if(!e)return null;if("string"==typeof e)return t("img",{src:e,alt:"icon"});if(i(e))return s(e);return t(e,{})})(r)})),n("div",Object.assign({className:"yoopta-ui-action-menu-list-item-content"},{children:[t("div",Object.assign({className:"yoopta-ui-action-menu-list-item-title"},{children:l.title})),l.description&&t("div",Object.assign({className:"yoopta-ui-action-menu-list-item-description"},{children:l.description}))]}))]}))});k.displayName="ActionMenuList.Item";const O=o((n,o)=>{var{children:i,className:s}=n,a=e(n,["children","className"]);return t("div",Object.assign({ref:o,className:`yoopta-ui-action-menu-list-empty ${s||""}`},a,{children:i||"No actions available"}))});O.displayName="ActionMenuList.Empty";const I={Root:w,Group:j,Item:k,Empty:O},M=h()(e=>({state:"closed",view:"default",reference:null,placement:"bottom-start",blockId:null,open(t={}){const{reference:n,view:o,placement:i,blockId:s}=t;e(e=>({state:"open",reference:void 0!==n?n:e.reference,view:void 0!==o?o:e.view,placement:void 0!==i?i:e.placement,blockId:void 0!==s?s:e.blockId}))},close(){e({state:"closed",view:"default",placement:"bottom-start",blockId:null})},toggle(t){e({state:t})},setView(t){e({view:t})},setReference(t){e({reference:t})},reset(){e({state:"closed",view:"default",reference:null,placement:"bottom-start",blockId:null})}}));const P=()=>{const e=M();return{open:e.open,close:e.close,toggle:e.toggle,isOpen:"open"===e.state}},A=({view:e="default"}={})=>{const t=N(),n=M(),{state:o,view:i,reference:s,blockId:h,open:w,close:j,setView:k,placement:O}=n,{refs:I,floatingStyles:P,context:A,update:x}=p({placement:O,open:"open"===o,middleware:[d(),u(),m(10)],whileElementsMounted:v}),{isMounted:R,styles:$}=f(A,{duration:100}),C=a(()=>function(e){const t=Object.keys(e.plugins);let n=null;if("number"==typeof e.path.current){const t=g.getBlockSlate(e,{at:e.path.current});t&&(n=y(e,t))}let o=t;return n&&n.length>0&&(o="string"==typeof t[0]?t.filter(e=>n.includes(e)):t.filter(e=>n.includes(e.type))),o.map(t=>{var n,o,i,s,a,l;return"string"==typeof t?{type:t,title:(null===(o=null===(n=e.plugins[t].options)||void 0===n?void 0:n.display)||void 0===o?void 0:o.title)||t,description:null===(s=null===(i=e.plugins[t].options)||void 0===i?void 0:i.display)||void 0===s?void 0:s.description,icon:null===(l=null===(a=e.plugins[t].options)||void 0===a?void 0:a.display)||void 0===l?void 0:l.icon}:t})}(t).filter(e=>function(e,t){var n;const o=e.plugins[t];if(!o)return!1;const i=b(o.elements);return"void"!==(null===(n=null==i?void 0:i.props)||void 0===n?void 0:n.nodeType)}(t,e.type)),[t]),[E,L]=l(C[0]),[B,D]=l(C),F=c(()=>{j(),D(C),L(C[0]),k(e)},[j,C,e,k]);r(()=>{s&&I.setReference(s),"open"===o&&x()},[s,o,I,x]);const G=c(e=>{const{reference:t,view:n,placement:o,blockId:i}=e;n&&k(n),w({reference:t,view:n,placement:o,blockId:i})},[w,k]),S=c(e=>{const t=e.currentTarget.getAttribute("data-action-menu-item-type"),n=C.find(e=>e.type===t);L(n)},[C]),T=c(e=>({onMouseEnter:S,onMouseDown:e=>e.stopPropagation(),onClick:n=>{if(!h)return;const o=g.getBlock(t,{id:h});o&&(n.stopPropagation(),t.toggleBlock(e,{preserveContent:!0,focus:!0,at:o.meta.order}),F())},"data-action-menu-item":!0,"data-action-menu-item-type":e,"aria-selected":e===(null==E?void 0:E.type)}),[S,E,t,F]),V=c(()=>({"data-action-menu-list":!0,ref:I.setFloating,style:Object.assign(Object.assign(Object.assign({},P),$),{minWidth:"small"===i?200:244}),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()}),[I.setFloating,P,$,i]);return{isOpen:R,state:o,actions:B,selectedAction:E,empty:0===B.length,view:i,open:G,close:F,getItemProps:T,getRootProps:V}};export{I as A,P as a,M as b,A as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./_tslib-5e145dfd.js";import{jsx as t}from"react/jsx-runtime";import{forwardRef as o,useCallback as a,useMemo as s,useEffect as n}from"react";import{Portal as r}from"../portal.js";import{u as i,i as l,f as c,s as d,o as p,a as u,b as m}from"./floating-ui.react-
|
|
1
|
+
import{_ as e}from"./_tslib-5e145dfd.js";import{jsx as t}from"react/jsx-runtime";import{forwardRef as o,useCallback as a,useMemo as s,useEffect as n}from"react";import{Portal as r}from"../portal.js";import{u as i,i as l,f as c,s as d,o as p,a as u,b as m}from"./floating-ui.react-33212df0.js";import{useYooptaEditor as f}from"@yoopta/editor";import{c as g}from"./index-06d5c4e7.js";import{t as h}from"./throttle-dea4a39e.js";const v=o((o,a)=>{var{className:s,children:n}=o,i=e(o,["className","children"]);return t(r,Object.assign({id:"yoopta-ui-toolbar-portal"},{children:t("div",Object.assign({ref:a,className:`yoopta-ui-toolbar ${s||""}`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()},i,{children:n}))}))});v.displayName="Toolbar.Root";const b=o((o,a)=>{var{className:s,children:n}=o,r=e(o,["className","children"]);return t("div",Object.assign({ref:a,className:`yoopta-ui-toolbar-group ${s}`},r,{children:n}))});b.displayName="Toolbar.Group";const y=o((o,a)=>{var{className:s}=o,n=e(o,["className"]);return t("div",Object.assign({ref:a,className:`yoopta-ui-toolbar-separator ${s}`},n))});y.displayName="Toolbar.Separator";const N=o((o,a)=>{var{className:s,children:n,active:r,disabled:i,type:l="button"}=o,c=e(o,["className","children","active","disabled","type"]);return t("button",Object.assign({ref:a,type:l,disabled:i,"data-active":r,className:`yoopta-ui-toolbar-button ${s}`},c,{children:n}))});N.displayName="Toolbar.Button";const j={Root:v,Group:b,Separator:y,Button:N},w=g()(e=>({state:"closed",frozen:!1,open(){e({state:"open"})},close(){e({state:"closed",frozen:!1})},toggle(t){e({state:t})},setFrozen(t){e({frozen:t})},reset(){e({state:"closed",frozen:!1})}})),O=()=>{const e=f(),{state:t,frozen:o,open:r,close:g,setFrozen:v,toggle:b,reset:y}=w(),{refs:N,floatingStyles:j,context:O}=i({placement:"top",open:"open"===t,middleware:[l(),c(),d(),p(10)],whileElementsMounted:u}),{isMounted:R,styles:z}=m(O,{duration:100}),A=a(()=>{var a,s;if(o)return;const n=N.floating.current;if(n&&n.contains(document.activeElement))return;const i=window.getSelection();if(!i||(null==i?void 0:i.isCollapsed)||(null==i?void 0:i.anchorOffset)===(null==i?void 0:i.focusOffset))return void("open"===t&&g());const l=i.getRangeAt(0),c=l.getBoundingClientRect(),d=l.toString().trim(),p=null==l?void 0:l.commonAncestorContainer,u=!!(null===(a=null==p?void 0:p.closest)||void 0===a?void 0:a.call(p,"[data-custom-editor]"));if((null===(s=e.refElement)||void 0===s?void 0:s.contains(p))&&!u){if(l&&d.length>0){const e={getBoundingClientRect:()=>c,getClientRects:()=>l.getClientRects()};N.setReference(e),"open"!==t&&r()}}else"open"===t&&g()},[o,N,e.refElement,g,r,t]),C=a(()=>{var o;if(!Array.isArray(e.path.selected)||0===e.path.selected.length||"mousemove"!==e.path.source&&"keyboard"!==e.path.source)return void("open"===t&&g());const a=Math.min(...e.path.selected),s=Math.max(...e.path.selected);let n=!0;"number"==typeof e.path.current&&(n=Math.abs(e.path.current-s)<=Math.abs(e.path.current-a));const i=e.getBlock({at:n?s:a});if(!i)return;const l=null===(o=e.refElement)||void 0===o?void 0:o.querySelector(`[data-yoopta-block-id="${i.id}"]`);l&&(N.setReference(l),"open"!==t&&r())},[e,N,g,r,t]),M=s(()=>h(A,200,{leading:!0,trailing:!0}),[A]);n(()=>{if(Array.isArray(e.path.selected)||e.path.selection){if(!Array.isArray(e.path.selected)||e.path.selection)return window.document.addEventListener("selectionchange",M),()=>window.document.removeEventListener("selectionchange",M);C()}else"open"===t&&g()},[e.path.selected,e.path.selection,t,M,g,C]);const E=s(()=>Object.assign(Object.assign({},j),z),[j,z]);return{isOpen:R,state:t,frozen:o,open:r,close:g,toggle:b,setFrozen:v,reset:y,getRootProps:()=>({ref:N.setFloating,style:E,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()})}};export{j as T,w as a,O as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as r}from"./chunks/style-inject.es-e87a8d02.js";export{H as HighlightColorPicker}from"./chunks/highlight-color-picker-
|
|
1
|
+
import{s as r}from"./chunks/style-inject.es-e87a8d02.js";export{H as HighlightColorPicker}from"./chunks/highlight-color-picker-534fa3e2.js";import"react/jsx-runtime";import"react";import"./chunks/floating-ui.react-33212df0.js";import"react-dom";r(".yoopta-highlight-color-picker{--hcp-bg:#fff;--hcp-fg:#18181b;--hcp-muted:#71717a;--hcp-border:#e4e4e7;--hcp-ring:#3b82f6;--hcp-shadow:0 16px 48px -12px rgba(0,0,0,.18),0 4px 16px -4px rgba(0,0,0,.1);--hcp-radius:10px;--hcp-pad:10px;--hcp-gap:10px;--hcp-width:224px;--hcp-picker-height:120px;--hcp-preset-size:24px;--hcp-input-height:26px;background:var(--hcp-bg);border:1px solid var(--hcp-border);border-radius:var(--hcp-radius);box-shadow:var(--hcp-shadow);color:var(--hcp-fg);display:flex;flex-direction:column;gap:8px;outline:none;padding:var(--hcp-pad);-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--hcp-width);z-index:9999}.dark .yoopta-highlight-color-picker,.yoopta-highlight-color-picker[data-theme=dark]{--hcp-bg:#18181b;--hcp-fg:#fafafa;--hcp-muted:#a1a1aa;--hcp-border:#3f3f46;--hcp-shadow:0 16px 48px -12px rgba(0,0,0,.5),0 4px 16px -4px rgba(0,0,0,.3)}.yoopta-highlight-color-picker__mode-toggle{background:var(--hcp-border);border-radius:8px;display:flex;flex-shrink:0;gap:4px;padding:4px}.yoopta-highlight-color-picker__mode-btn{background:transparent;border:none;border-radius:6px;color:var(--hcp-muted);cursor:pointer;flex:1;font-size:11px;font-weight:500;line-height:1.4;outline:none;padding:4px 8px;text-align:center;transition:background-color .12s ease,color .12s ease}.yoopta-highlight-color-picker__mode-btn:hover{color:var(--hcp-fg)}.yoopta-highlight-color-picker__mode-btn[data-active=true]{background:var(--hcp-bg);box-shadow:0 1px 2px rgba(0,0,0,.1);color:var(--hcp-fg)}.yoopta-highlight-color-picker__mode-btn:focus-visible{outline:2px solid var(--hcp-ring);outline-offset:2px}.yoopta-highlight-color-picker__react-colorful{height:var(--hcp-picker-height)!important;width:100%!important}.yoopta-highlight-color-picker__react-colorful .react-colorful__saturation{border:1px solid var(--hcp-border);border-radius:8px}.yoopta-highlight-color-picker__react-colorful .react-colorful__hue{border:1px solid var(--hcp-border);border-radius:999px;height:10px;margin-top:8px}.yoopta-highlight-color-picker__react-colorful .react-colorful__pointer{border:2px solid var(--hcp-bg);border-radius:999px;box-shadow:0 2px 6px rgba(0,0,0,.22);height:16px;width:16px}.yoopta-highlight-color-picker__presets{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;gap:6px;overflow-x:auto;padding-bottom:2px;scrollbar-color:var(--hcp-border) transparent;scrollbar-width:thin}.yoopta-highlight-color-picker__presets::-webkit-scrollbar{height:6px}.yoopta-highlight-color-picker__presets::-webkit-scrollbar-track{background:transparent}.yoopta-highlight-color-picker__presets::-webkit-scrollbar-thumb{background-color:var(--hcp-border);border-radius:999px}.yoopta-highlight-color-picker__preset{border:2px solid var(--hcp-border);border-radius:7px;cursor:pointer;flex:0 0 auto;height:var(--hcp-preset-size);outline:none;padding:0;transition:transform .12s ease,border-color .12s ease,box-shadow .12s ease;width:var(--hcp-preset-size)}.yoopta-highlight-color-picker__preset:hover{transform:scale(1.08)}.yoopta-highlight-color-picker__preset:focus-visible{border-color:var(--hcp-ring);box-shadow:0 0 0 2px var(--hcp-ring)}.yoopta-highlight-color-picker__preset[data-selected=true]{border-color:var(--hcp-ring);box-shadow:0 0 0 2px rgba(59,130,246,.35)}.yoopta-highlight-color-picker__hex-row{align-items:center;display:flex;gap:8px}.yoopta-highlight-color-picker__swatch{border:1px solid var(--hcp-border);border-radius:7px;flex:0 0 auto;height:var(--hcp-input-height);width:var(--hcp-input-height)}.yoopta-highlight-color-picker__hex-input{background:transparent;border:1px solid var(--hcp-border);border-radius:9px;color:var(--hcp-fg);flex:1;font-size:12px;height:var(--hcp-input-height);line-height:1;min-width:0;outline:none;padding:0 10px}.yoopta-highlight-color-picker__hex-input:focus{border-color:var(--hcp-ring);box-shadow:0 0 0 2px rgba(59,130,246,.25)}.yoopta-highlight-color-picker__hex-input::-moz-placeholder{color:var(--hcp-muted)}.yoopta-highlight-color-picker__hex-input::placeholder{color:var(--hcp-muted)}");
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { FloatingBlockActions, useFloatingBlockActions,
|
|
2
|
-
export { BlockOptions,
|
|
1
|
+
export { FloatingBlockActions, useFloatingBlockActions, } from './floating-block-actions';
|
|
2
|
+
export { BlockOptions, useBlockActions, useBlockOptionsContext } from './block-options';
|
|
3
3
|
export { Toolbar, useToolbar } from './toolbar';
|
|
4
4
|
export { ActionMenuList, useActionMenuList, useActionMenuListActions } from './action-menu-list';
|
|
5
5
|
export { SlashCommandMenu } from './slash-command-menu';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAChF,YAAY,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,YAAY,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SlashCommandMenu}from"./slash-command-menu.js";export{FloatingBlockActions,useFloatingBlockActions
|
|
1
|
+
export{SlashCommandMenu}from"./slash-command-menu.js";export{FloatingBlockActions,useFloatingBlockActions}from"./floating-block-actions.js";export{BlockOptions,useBlockActions,useBlockOptionsContext}from"./block-options.js";export{T as Toolbar,u as useToolbar}from"./chunks/hooks-879d4b4f.js";export{A as ActionMenuList,u as useActionMenuList,a as useActionMenuListActions}from"./chunks/hooks-814f49b9.js";export{ThemeProvider,ThemeToggle,useTheme,useThemeContext}from"./theme.js";export{Portal}from"./portal.js";export{Overlay}from"./overlay.js";export{H as HighlightColorPicker}from"./chunks/highlight-color-picker-534fa3e2.js";import"react/jsx-runtime";import"react";import"@yoopta/editor";import"./chunks/floating-ui.react-33212df0.js";import"react-dom";import"./chunks/style-inject.es-e87a8d02.js";import"./chunks/_tslib-5e145dfd.js";import"./chunks/index-06d5c4e7.js";import"./chunks/throttle-dea4a39e.js";
|
package/dist/overlay.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as o}from"./chunks/_tslib-5e145dfd.js";import{jsx as l}from"react/jsx-runtime";import{
|
|
1
|
+
import{_ as o}from"./chunks/_tslib-5e145dfd.js";import{jsx as l}from"react/jsx-runtime";import{k as r}from"./chunks/floating-ui.react-33212df0.js";import"react";import"react-dom";const c=c=>{var{className:a,children:s,lockScroll:n=!0}=c,t=o(c,["className","children","lockScroll"]);return l(r,Object.assign({lockScroll:n,className:a},t,{onClick:o=>{var l;o.stopPropagation(),null===(l=t.onClick)||void 0===l||l.call(t,o)},onMouseDown:o=>{var l;o.stopPropagation(),null===(l=t.onMouseDown)||void 0===l||l.call(t,o)}},{children:s}))};export{c as Overlay};
|
package/dist/portal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{useState as t,useRef as e,useEffect as n}from"react";import{
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{useState as t,useRef as e,useEffect as n}from"react";import{j as o}from"./chunks/floating-ui.react-33212df0.js";import{useYooptaEditor as c}from"@yoopta/editor";import"react-dom";const a=new WeakMap,i=i=>{const[u,m]=t(!1),l=e(null),s=c();return n(()=>{m(!0);const r=s.refElement;if(!r)return;let t=r.querySelector(".yoopta-portal-container");t||(t=document.createElement("div"),t.className="yoopta-portal-container",r.appendChild(t),a.set(t,0));const e=a.get(t)||0;return a.set(t,e+1),l.current=t,()=>{if(l.current){const r=a.get(l.current)||0,t=Math.max(0,r-1);a.set(l.current,t),0===t&&l.current.parentNode&&(l.current.remove(),a.delete(l.current))}}},[s]),u&&l.current?r(o,Object.assign({id:`${i.id}-${s.id}`,root:l.current},{children:i.children})):null};export{i as Portal};
|