@yoopta/video 2.0.1 → 4.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +2 -2
  2. package/dist/{utils → hooks}/useIntersectionObserver.d.ts +1 -0
  3. package/dist/hooks/useIntersectionObserver.d.ts.map +1 -0
  4. package/dist/index.d.ts +4 -4
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +6 -1
  7. package/dist/plugin/index.d.ts +3 -0
  8. package/dist/plugin/index.d.ts.map +1 -0
  9. package/dist/types.d.ts +37 -21
  10. package/dist/types.d.ts.map +1 -0
  11. package/dist/{components/DayliMotion.d.ts → ui/DailyMotionPlayer.d.ts} +1 -0
  12. package/dist/ui/DailyMotionPlayer.d.ts.map +1 -0
  13. package/dist/ui/EmbedUploader.d.ts +7 -0
  14. package/dist/ui/EmbedUploader.d.ts.map +1 -0
  15. package/dist/ui/FileUploader.d.ts +10 -0
  16. package/dist/ui/FileUploader.d.ts.map +1 -0
  17. package/dist/ui/Loader.d.ts +10 -0
  18. package/dist/ui/Loader.d.ts.map +1 -0
  19. package/dist/ui/Placeholder.d.ts +8 -0
  20. package/dist/ui/Placeholder.d.ts.map +1 -0
  21. package/dist/ui/Resizer.d.ts +6 -0
  22. package/dist/ui/Resizer.d.ts.map +1 -0
  23. package/dist/ui/Video.d.ts +5 -9
  24. package/dist/ui/Video.d.ts.map +1 -0
  25. package/dist/ui/VideoBlockOptions.d.ts +12 -0
  26. package/dist/ui/VideoBlockOptions.d.ts.map +1 -0
  27. package/dist/ui/VideoComponent.d.ts +9 -0
  28. package/dist/ui/VideoComponent.d.ts.map +1 -0
  29. package/dist/ui/VideoUploader.d.ts +11 -0
  30. package/dist/ui/VideoUploader.d.ts.map +1 -0
  31. package/dist/{components → ui}/VimeoPlayer.d.ts +1 -0
  32. package/dist/ui/VimeoPlayer.d.ts.map +1 -0
  33. package/dist/{components/YoutubePlayer.d.ts → ui/YootubePlayer.d.ts} +1 -0
  34. package/dist/ui/YootubePlayer.d.ts.map +1 -0
  35. package/dist/utils/providers.d.ts +11 -0
  36. package/dist/utils/providers.d.ts.map +1 -0
  37. package/package.json +9 -5
  38. package/dist/components/EditorPlaceholder.d.ts +0 -13
  39. package/dist/components/EditorUploader.d.ts +0 -10
  40. package/dist/components/Loader.d.ts +0 -3
  41. package/dist/ui/VideoEditor.d.ts +0 -12
  42. package/dist/utils/aspect.d.ts +0 -7
  43. package/dist/utils/base64.d.ts +0 -1
  44. package/dist/utils/parsers.d.ts +0 -5
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # `@yoopta/code`
1
+ # `yoopta-video`
2
2
 
3
3
  > TODO: description
4
4
 
5
5
  ## Usage
6
6
 
7
7
  ```
8
- const blockquote = require('@yoopta/code');
8
+ const video = require('yoopta-video');
9
9
 
10
10
  // TODO: DEMONSTRATE API
11
11
  ```
@@ -10,3 +10,4 @@ export declare function useIntersectionObserver(elementRef: any, { threshold, ro
10
10
  rootMargin?: string | undefined;
11
11
  freezeOnceVisible?: boolean | undefined;
12
12
  }): IntersectionObserverEntry;
13
+ //# sourceMappingURL=useIntersectionObserver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIntersectionObserver.d.ts","sourceRoot":"","sources":["../../src/hooks/useIntersectionObserver.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,KAAA,EACV,EAAE,SAAa,EAAE,IAAW,EAAE,UAAiB,EAAE,iBAAyB,EAAE;;;;;CAAK,GAChF,yBAAyB,CAsB3B"}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { YooEditor } from '@yoopta/editor';
2
- import { VideoElement, VideoPluginOptions } from './types';
1
+ import { Video } from './plugin';
2
+ import { VideoElement } from './types';
3
+ import './styles.css';
3
4
  declare module 'slate' {
4
5
  interface CustomTypes {
5
- Editor: YooEditor;
6
6
  Element: VideoElement;
7
7
  }
8
8
  }
9
- declare const Video: import("@yoopta/editor").YooptaPlugin<VideoPluginOptions, VideoElement>;
10
9
  export default Video;
11
10
  export { VideoElement };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,cAAc,CAAC;AAEtB,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,WAAW;QACnB,OAAO,EAAE,YAAY,CAAC;KACvB;CACF;AAED,eAAe,KAAK,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1,6 @@
1
- import{getElementClassname as t,UI_HELPERS as e,cx as i,createYooptaPlugin as o,getElementByPath as n,generateId as s}from"@yoopta/editor";import{Transforms as r,Element as a}from"slate";import{jsxs as d,jsx as l}from"react/jsx-runtime";import*as h from"react";import{useState as c,useEffect as p,useRef as u,useMemo as g}from"react";import{flushSync as f}from"react-dom";import{ReactEditor as m,useSelected as v,useReadOnly as b}from"slate-react";function w(t,e){var i={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(i[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(i[o[n]]=t[o[n]])}return i}function y(t,e,i,o){return new(i||(i=Promise))((function(n,s){function r(t){try{d(o.next(t))}catch(t){s(t)}}function a(t){try{d(o.throw(t))}catch(t){s(t)}}function d(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,a)}d((o=o.apply(t,e||[])).next())}))}function x(t,{threshold:e=0,root:i=null,rootMargin:o="0%",freezeOnceVisible:n=!1}={}){const[s,r]=c({}),a=s.isIntersecting&&n,d=([t])=>r(t);return p((()=>{const n=null==t?void 0:t.current;if(!window.IntersectionObserver||a||!n)return;const s=new IntersectionObserver(d,{threshold:e,root:i,rootMargin:o});return s.observe(n),()=>s.disconnect()}),[t,e,i,o,a]),s}function z(t,e){void 0===e&&(e={});var i=e.insertAt;if(t&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}}"function"==typeof SuppressedError&&SuppressedError;var N="TvZseAeh",S="EZu95fyq",j="dkxsZ5ZT",O="KsFU0JBg",E="D-8E3vsv",k="eEtEqZrx",R="_0icGyC6M";z(".TvZseAeh{margin:20px 0 10px;position:relative}.EZu95fyq{border-radius:1px;display:block;margin:0 auto;max-width:100%;object-fit:cover;pointer-events:auto}.dkxsZ5ZT{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.KsFU0JBg{background-color:#fff}.D-8E3vsv,.KsFU0JBg{border-radius:1px;height:100%;pointer-events:auto;width:100%}.D-8E3vsv,.KsFU0JBg,.eEtEqZrx{left:0;position:absolute;top:0}.eEtEqZrx{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}._0icGyC6M{height:100%;position:relative;width:100%}");const W={vimeo:function(t){var{videoId:e}=t,i=w(t,["videoId"]);const o=u(null),[n,s]=c(null),[r,a]=c(!1),{isIntersecting:h}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{fetch(`https://vimeo.com/api/v2/video/${e}.json`).then((t=>t.json())).then((t=>s(t[0].thumbnail_medium))).catch((()=>s(null)))}),[e]),d("div",Object.assign({ref:o,className:R},{children:[l("img",{src:n||"",alt:"vimeo_video_preview",width:"100%",height:"100%",className:k,style:{opacity:h&&r?0:1,zIndex:h&&r?-1:0}}),h&&l("iframe",Object.assign({title:"Video Player",src:`https://player.vimeo.com/video/${e}?badge=0&byline=0&portrait=0&title=0`,frameBorder:0,allowFullScreen:!0,onLoad:()=>a(!0),className:O},i))]}))},youtube:function(t){var{videoId:e}=t,i=w(t,["videoId"]);const o=u(null),[n,s]=c(!1),{isIntersecting:r}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return d("div",Object.assign({ref:o,className:R},{children:[l("img",{src:`https://i.ytimg.com/vi/${e}/default.jpg`,alt:"youtube_video_preview",width:"100%",height:"100%",className:k,style:{opacity:r&&n?0:1,zIndex:r&&n?-1:0}}),r&&l("iframe",Object.assign({title:"Video Player",src:`https://www.youtube.com/embed/${e}`,frameBorder:0,onLoad:()=>s(!0),allowFullScreen:!0,className:O},i))]}))},dailymotion:function(t){var{videoId:e}=t,i=w(t,["videoId"]);const o=u(null),[n,s]=c(null),[r,a]=c(!1),{isIntersecting:h}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return p((()=>{fetch((t=>`https://api.dailymotion.com/video/${t}?fields=thumbnail_url`)(e)).then((t=>t.json())).then((t=>s(t.thumbnail_url))).catch((()=>s(null)))}),[e]),d("div",Object.assign({ref:o,className:R},{children:[l("img",{src:n||"",alt:"daylimotion_video_preview",width:"100%",height:"100%",className:k,style:{opacity:h&&r?0:1,zIndex:h&&r?-1:0}}),h&&l("iframe",Object.assign({title:"Dailymotion Video Player",frameBorder:0,onLoad:()=>a(!0),src:`https://www.dailymotion.com/embed/video/${e}`,allowFullScreen:!0,className:O},i))]}))}};var H,M,C=(H=function(t,e){return H=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},H(t,e)},function(t,e){function i(){this.constructor=t}H(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),B=function(){return B=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},B.apply(this,arguments)},A={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},L={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},P={width:"20px",height:"20px",position:"absolute"},D={top:B(B({},A),{top:"-5px"}),right:B(B({},L),{left:void 0,right:"-5px"}),bottom:B(B({},A),{top:void 0,bottom:"-5px"}),left:B(B({},L),{left:"-5px"}),topRight:B(B({},P),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:B(B({},P),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:B(B({},P),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:B(B({},P),{left:"-10px",top:"-10px",cursor:"nw-resize"})},I=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onMouseDown=function(t){e.props.onResizeStart(t,e.props.direction)},e.onTouchStart=function(t){e.props.onResizeStart(t,e.props.direction)},e}return C(e,t),e.prototype.render=function(){return h.createElement("div",{className:this.props.className||"",style:B(B({position:"absolute",userSelect:"none"},D[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},e}(h.PureComponent),_=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function o(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}(),T=function(){return T=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},T.apply(this,arguments)},V={width:"auto",height:"auto"},G=function(t,e,i){return Math.max(Math.min(t,i),e)},U=function(t,e){return Math.round(t/e)*e},F=function(t,e){return new RegExp(t,"i").test(e)},Y=function(t){return Boolean(t.touches&&t.touches.length)},X=function(t,e,i){void 0===i&&(i=0);var o=e.reduce((function(i,o,n){return Math.abs(o-t)<Math.abs(e[i]-t)?n:i}),0),n=Math.abs(e[o]-t);return 0===i||n<i?e[o]:t},Q=function(t){return"auto"===(t=t.toString())||t.endsWith("px")||t.endsWith("%")||t.endsWith("vh")||t.endsWith("vw")||t.endsWith("vmax")||t.endsWith("vmin")?t:t+"px"},q=function(t,e,i,o){if(t&&"string"==typeof t){if(t.endsWith("px"))return Number(t.replace("px",""));if(t.endsWith("%"))return e*(Number(t.replace("%",""))/100);if(t.endsWith("vw"))return i*(Number(t.replace("vw",""))/100);if(t.endsWith("vh"))return o*(Number(t.replace("vh",""))/100)}return t},J=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],Z="__resizable_base__",K=function(t){function e(e){var i=t.call(this,e)||this;return i.ratio=1,i.resizable=null,i.parentLeft=0,i.parentTop=0,i.resizableLeft=0,i.resizableRight=0,i.resizableTop=0,i.resizableBottom=0,i.targetLeft=0,i.targetTop=0,i.appendBase=function(){if(!i.resizable||!i.window)return null;var t=i.parentNode;if(!t)return null;var e=i.window.document.createElement("div");return e.style.width="100%",e.style.height="100%",e.style.position="absolute",e.style.transform="scale(0, 0)",e.style.left="0",e.style.flex="0 0 100%",e.classList?e.classList.add(Z):e.className+=Z,t.appendChild(e),e},i.removeBase=function(t){var e=i.parentNode;e&&e.removeChild(t)},i.ref=function(t){t&&(i.resizable=t)},i.state={isResizing:!1,width:void 0===(i.propsSize&&i.propsSize.width)?"auto":i.propsSize&&i.propsSize.width,height:void 0===(i.propsSize&&i.propsSize.height)?"auto":i.propsSize&&i.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},i.onResizeStart=i.onResizeStart.bind(i),i.onMouseMove=i.onMouseMove.bind(i),i.onMouseUp=i.onMouseUp.bind(i),i}return _(e,t),Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return this.resizable&&this.resizable.ownerDocument?this.resizable.ownerDocument.defaultView:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||V},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){var t=0,e=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,o=this.resizable.offsetHeight,n=this.resizable.style.position;"relative"!==n&&(this.resizable.style.position="relative"),t="auto"!==this.resizable.style.width?this.resizable.offsetWidth:i,e="auto"!==this.resizable.style.height?this.resizable.offsetHeight:o,this.resizable.style.position=n}return{width:t,height:e}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sizeStyle",{get:function(){var t=this,e=this.props.size,i=function(e){if(void 0===t.state[e]||"auto"===t.state[e])return"auto";if(t.propsSize&&t.propsSize[e]&&t.propsSize[e].toString().endsWith("%")){if(t.state[e].toString().endsWith("%"))return t.state[e].toString();var i=t.getParentSize();return Number(t.state[e].toString().replace("px",""))/i[e]*100+"%"}return Q(t.state[e])};return{width:e&&void 0!==e.width&&!this.state.isResizing?Q(e.width):i("width"),height:e&&void 0!==e.height&&!this.state.isResizing?Q(e.height):i("height")}},enumerable:!1,configurable:!0}),e.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var t=this.appendBase();if(!t)return{width:0,height:0};var e=!1,i=this.parentNode.style.flexWrap;"wrap"!==i&&(e=!0,this.parentNode.style.flexWrap="wrap"),t.style.position="relative",t.style.minWidth="100%",t.style.minHeight="100%";var o={width:t.offsetWidth,height:t.offsetHeight};return e&&(this.parentNode.style.flexWrap=i),this.removeBase(t),o},e.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},e.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},e.prototype.componentDidMount=function(){if(this.resizable&&this.window){var t=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:"auto"!==t.flexBasis?t.flexBasis:void 0})}},e.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},e.prototype.createSizeForCssProperty=function(t,e){var i=this.propsSize&&this.propsSize[e];return"auto"!==this.state[e]||this.state.original[e]!==t||void 0!==i&&"auto"!==i?t:"auto"},e.prototype.calculateNewMaxFromBoundary=function(t,e){var i,o,n=this.props.boundsByDirection,s=this.state.direction,r=n&&F("left",s),a=n&&F("top",s);if("parent"===this.props.bounds){var d=this.parentNode;d&&(i=r?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),o=a?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else"window"===this.props.bounds?this.window&&(i=r?this.resizableRight:this.window.innerWidth-this.resizableLeft,o=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(i=r?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),o=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return i&&Number.isFinite(i)&&(t=t&&t<i?t:i),o&&Number.isFinite(o)&&(e=e&&e<o?e:o),{maxWidth:t,maxHeight:e}},e.prototype.calculateNewSizeFromDirection=function(t,e){var i=this.props.scale||1,o=this.props.resizeRatio||1,n=this.state,s=n.direction,r=n.original,a=this.props,d=a.lockAspectRatio,l=a.lockAspectRatioExtraHeight,h=a.lockAspectRatioExtraWidth,c=r.width,p=r.height,u=l||0,g=h||0;return F("right",s)&&(c=r.width+(t-r.x)*o/i,d&&(p=(c-g)/this.ratio+u)),F("left",s)&&(c=r.width-(t-r.x)*o/i,d&&(p=(c-g)/this.ratio+u)),F("bottom",s)&&(p=r.height+(e-r.y)*o/i,d&&(c=(p-u)*this.ratio+g)),F("top",s)&&(p=r.height-(e-r.y)*o/i,d&&(c=(p-u)*this.ratio+g)),{newWidth:c,newHeight:p}},e.prototype.calculateNewSizeFromAspectRatio=function(t,e,i,o){var n=this.props,s=n.lockAspectRatio,r=n.lockAspectRatioExtraHeight,a=n.lockAspectRatioExtraWidth,d=void 0===o.width?10:o.width,l=void 0===i.width||i.width<0?t:i.width,h=void 0===o.height?10:o.height,c=void 0===i.height||i.height<0?e:i.height,p=r||0,u=a||0;if(s){var g=(h-p)*this.ratio+u,f=(c-p)*this.ratio+u,m=(d-u)/this.ratio+p,v=(l-u)/this.ratio+p,b=Math.max(d,g),w=Math.min(l,f),y=Math.max(h,m),x=Math.min(c,v);t=G(t,b,w),e=G(e,y,x)}else t=G(t,d,l),e=G(e,h,c);return{newWidth:t,newHeight:e}},e.prototype.setBoundingClientRect=function(){if("parent"===this.props.bounds){var t=this.parentNode;if(t){var e=t.getBoundingClientRect();this.parentLeft=e.left,this.parentTop=e.top}}if(this.props.bounds&&"string"!=typeof this.props.bounds){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left,this.targetTop=i.top}if(this.resizable){var o=this.resizable.getBoundingClientRect(),n=o.left,s=o.top,r=o.right,a=o.bottom;this.resizableLeft=n,this.resizableRight=r,this.resizableTop=s,this.resizableBottom=a}},e.prototype.onResizeStart=function(t,e){if(this.resizable&&this.window){var i,o=0,n=0;if(t.nativeEvent&&function(t){return Boolean((t.clientX||0===t.clientX)&&(t.clientY||0===t.clientY))}(t.nativeEvent)?(o=t.nativeEvent.clientX,n=t.nativeEvent.clientY):t.nativeEvent&&Y(t.nativeEvent)&&(o=t.nativeEvent.touches[0].clientX,n=t.nativeEvent.touches[0].clientY),this.props.onResizeStart)if(this.resizable)if(!1===this.props.onResizeStart(t,e,this.resizable))return;this.props.size&&(void 0!==this.props.size.height&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),void 0!==this.props.size.width&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio="number"==typeof this.props.lockAspectRatio?this.props.lockAspectRatio:this.size.width/this.size.height;var s=this.window.getComputedStyle(this.resizable);if("auto"!==s.flexBasis){var r=this.parentNode;if(r){var a=this.window.getComputedStyle(r).flexDirection;this.flexDir=a.startsWith("row")?"row":"column",i=s.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var d={original:{x:o,y:n,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:T(T({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(t.target).cursor||"auto"}),direction:e,flexBasis:i};this.setState(d)}},e.prototype.onMouseMove=function(t){var e=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&Y(t))try{t.preventDefault(),t.stopPropagation()}catch(t){}var i=this.props,o=i.maxWidth,n=i.maxHeight,s=i.minWidth,r=i.minHeight,a=Y(t)?t.touches[0].clientX:t.clientX,d=Y(t)?t.touches[0].clientY:t.clientY,l=this.state,h=l.direction,c=l.original,p=l.width,u=l.height,g=this.getParentSize(),m=function(t,e,i,o,n,s,r){return o=q(o,t.width,e,i),n=q(n,t.height,e,i),s=q(s,t.width,e,i),r=q(r,t.height,e,i),{maxWidth:void 0===o?void 0:Number(o),maxHeight:void 0===n?void 0:Number(n),minWidth:void 0===s?void 0:Number(s),minHeight:void 0===r?void 0:Number(r)}}(g,this.window.innerWidth,this.window.innerHeight,o,n,s,r);o=m.maxWidth,n=m.maxHeight,s=m.minWidth,r=m.minHeight;var v=this.calculateNewSizeFromDirection(a,d),b=v.newHeight,w=v.newWidth,y=this.calculateNewMaxFromBoundary(o,n);this.props.snap&&this.props.snap.x&&(w=X(w,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(b=X(b,this.props.snap.y,this.props.snapGap));var x=this.calculateNewSizeFromAspectRatio(w,b,{width:y.maxWidth,height:y.maxHeight},{width:s,height:r});if(w=x.newWidth,b=x.newHeight,this.props.grid){var z=U(w,this.props.grid[0]),N=U(b,this.props.grid[1]),S=this.props.snapGap||0;w=0===S||Math.abs(z-w)<=S?z:w,b=0===S||Math.abs(N-b)<=S?N:b}var j={width:w-c.width,height:b-c.height};if(p&&"string"==typeof p)if(p.endsWith("%"))w=w/g.width*100+"%";else if(p.endsWith("vw")){w=w/this.window.innerWidth*100+"vw"}else if(p.endsWith("vh")){w=w/this.window.innerHeight*100+"vh"}if(u&&"string"==typeof u)if(u.endsWith("%"))b=b/g.height*100+"%";else if(u.endsWith("vw")){b=b/this.window.innerWidth*100+"vw"}else if(u.endsWith("vh")){b=b/this.window.innerHeight*100+"vh"}var O={width:this.createSizeForCssProperty(w,"width"),height:this.createSizeForCssProperty(b,"height")};"row"===this.flexDir?O.flexBasis=O.width:"column"===this.flexDir&&(O.flexBasis=O.height),f((function(){e.setState(O)})),this.props.onResize&&this.props.onResize(t,h,this.resizable,j)}},e.prototype.onMouseUp=function(t){var e=this.state,i=e.isResizing,o=e.direction,n=e.original;if(i&&this.resizable){var s={width:this.size.width-n.width,height:this.size.height-n.height};this.props.onResizeStop&&this.props.onResizeStop(t,o,this.resizable,s),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:T(T({},this.state.backgroundStyle),{cursor:"auto"})})}},e.prototype.updateSize=function(t){this.setState({width:t.width,height:t.height})},e.prototype.renderResizer=function(){var t=this,e=this.props,i=e.enable,o=e.handleStyles,n=e.handleClasses,s=e.handleWrapperStyle,r=e.handleWrapperClass,a=e.handleComponent;if(!i)return null;var d=Object.keys(i).map((function(e){return!1!==i[e]?h.createElement(I,{key:e,direction:e,onResizeStart:t.onResizeStart,replaceStyles:o&&o[e],className:n&&n[e]},a&&a[e]?a[e]:null):null}));return h.createElement("div",{className:r,style:s},d)},e.prototype.render=function(){var t=this,e=Object.keys(this.props).reduce((function(e,i){return-1!==J.indexOf(i)||(e[i]=t.props[i]),e}),{}),i=T(T(T({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(i.flexBasis=this.state.flexBasis);var o=this.props.as||"div";return h.createElement(o,T({ref:this.ref,style:i,className:this.props.className},e),this.state.isResizing&&h.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},e.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},e}(h.PureComponent);function $(){return $=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},$.apply(this,arguments)}var tt=function(t){return h.createElement("svg",$({fill:"currentColor","aria-hidden":"true",viewBox:"0 0 24 24","data-testid":"uploadImage"},t),M||(M=h.createElement("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"})))},et="rq2V2ceB",it="rc-sSm2o",ot="pa2jWsNN",nt="WCrDI0dy",st="d-YDdEGm",rt="zaYe5qHX",at="M0t11tGQ",dt="_9cpXcl96",lt="DZJetA3e",ht="oVy3BbqO M0t11tGQ",ct="GIpAKCJ0",pt="k7HVhRkA";z('.rq2V2ceB{position:fixed}.rc-sSm2o{background:#fff;box-shadow:0 0 0 1px hsla(0,0%,6%,.05),0 3px 6px hsla(0,0%,6%,.1),0 9px 24px hsla(0,0%,6%,.2);display:flex;flex-direction:column;height:100%;max-height:420px;max-width:calc(100vw - 24px);min-width:540px}.pa2jWsNN{box-shadow:inset 0 -1px 0 rgba(55,53,47,.09);display:flex;height:40px;padding:0 8px;width:100%;z-index:1}.WCrDI0dy,.pa2jWsNN{font-size:14px;position:relative}.WCrDI0dy{align-items:center;background-color:inherit;border:none;border-radius:4px;color:#37352f;cursor:pointer;display:inline-flex;flex-shrink:0;height:100%;line-height:1.2;min-width:0;padding:6px 8px;transition:height 20ms ease-in 0s;user-select:none;white-space:nowrap}.d-YDdEGm:after{background-color:#37352f;bottom:0;content:"";height:2px;left:0;position:absolute;width:100%}.zaYe5qHX{display:flex;justify-content:center;margin-left:12px;margin-right:12px;margin-top:4px;padding-bottom:6px;padding-top:6px}.M0t11tGQ{border:1px solid rgba(55,53,47,.16);border-radius:4px;height:32px;padding-left:12px;padding-right:12px;transition:background 20ms ease-in 0s;user-select:none;white-space:nowrap}.M0t11tGQ,._9cpXcl96{cursor:pointer;width:100%}._9cpXcl96{align-items:center;display:inline-flex;font-size:14px;font-weight:500;height:100%;justify-content:center;line-height:1.2}.DZJetA3e{left:0;position:absolute;top:0;visibility:hidden}.oVy3BbqO{border:none!important;cursor:pointer!important;height:auto!important;padding-left:0!important;padding-right:0!important}.GIpAKCJ0{background:hsla(45,13%,94%,.6);box-shadow:inset 0 0 0 1px hsla(0,0%,6%,.1);cursor:text;height:32px;line-height:20px;padding:3px 6px;position:relative}.GIpAKCJ0,.k7HVhRkA{align-items:center;border:none;border-radius:4px;display:flex;font-size:14px;width:100%}.k7HVhRkA{fill:#fff;background:#2383e2;box-shadow:inset 0 0 0 1px hsla(0,0%,6%,.1),0 1px 2px hsla(0,0%,6%,.1);color:#fff;cursor:pointer;flex-shrink:0;font-weight:500;height:28px;justify-content:center;line-height:1.2;margin:12px auto 6px;max-width:300px;padding-left:12px;padding-right:12px;transition:background 20ms ease-in 0s;user-select:none;white-space:nowrap}');const ut=({onChange:t})=>l("div",Object.assign({className:at},{children:d("label",Object.assign({htmlFor:"video-uploader",className:dt},{children:[l("input",{type:"file",id:"video-uploader",className:lt,accept:"video/*",onChange:e=>{const i=e.currentTarget.files;i&&i.length>0&&t(i[0])},multiple:!1}),"Upload file"]}))})),gt=({onEmbed:t})=>{const[e,i]=c("");return d("div",Object.assign({className:ht},{children:[l("input",{type:"text",placeholder:"Paste video link (Youtube, Vimeo, Dailymotion)",value:e,className:ct,onChange:t=>i(t.target.value)}),l("button",Object.assign({type:"button",className:pt,onClick:()=>t(e)},{children:"Embed video"}))]}))},ft=({activeTab:t="upload",style:o,switchTab:n,onChange:s,onClose:r,onEmbed:a})=>{const h="upload"===t,c="embed"===t;return l(e.Overlay,Object.assign({onClose:r},{children:l("div",Object.assign({className:et,style:o},{children:d("div",Object.assign({className:it},{children:[d("div",Object.assign({className:ot},{children:[l("button",Object.assign({type:"button",onClick:()=>n("upload"),className:i(nt,{[st]:h})},{children:"Upload"})),l("button",Object.assign({type:"button",onClick:()=>n("embed"),className:i(nt,{[st]:c})},{children:"Video link"}))]})),d("div",Object.assign({className:rt},{children:[h&&l(ut,{onChange:s}),c&&l(gt,{onEmbed:a})]}))]}))}))}))};var mt=!1;if("undefined"!=typeof window){var vt={get passive(){mt=!0}};window.addEventListener("testPassive",null,vt),window.removeEventListener("testPassive",null,vt)}var bt="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),wt=[],yt=!1,xt=-1,zt=void 0,Nt=void 0,St=void 0,jt=function(t){return wt.some((function(e){return!(!e.options.allowTouchMove||!e.options.allowTouchMove(t))}))},Ot=function(t){var e=t||window.event;return!!jt(e.target)||(e.touches.length>1||(e.preventDefault&&e.preventDefault(),!1))},Et=function(t,e){if(t){if(!wt.some((function(e){return e.targetElement===t}))){var i={targetElement:t,options:e||{}};wt=[].concat(function(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}(wt),[i]),bt?window.requestAnimationFrame((function(){if(void 0===Nt){Nt={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var t=window,e=t.scrollY,i=t.scrollX,o=t.innerHeight;document.body.style.position="fixed",document.body.style.top=-e,document.body.style.left=-i,setTimeout((function(){return window.requestAnimationFrame((function(){var t=o-window.innerHeight;t&&e>=o&&(document.body.style.top=-(e+t))}))}),300)}})):function(t){if(void 0===St){var e=!!t&&!0===t.reserveScrollBarGap,i=window.innerWidth-document.documentElement.clientWidth;if(e&&i>0){var o=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);St=document.body.style.paddingRight,document.body.style.paddingRight=o+i+"px"}}void 0===zt&&(zt=document.body.style.overflow,document.body.style.overflow="hidden")}(e),bt&&(t.ontouchstart=function(t){1===t.targetTouches.length&&(xt=t.targetTouches[0].clientY)},t.ontouchmove=function(e){1===e.targetTouches.length&&function(t,e){var i=t.targetTouches[0].clientY-xt;!jt(t.target)&&(e&&0===e.scrollTop&&i>0||function(t){return!!t&&t.scrollHeight-t.scrollTop<=t.clientHeight}(e)&&i<0?Ot(t):t.stopPropagation())}(e,t)},yt||(document.addEventListener("touchmove",Ot,mt?{passive:!1}:void 0),yt=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},kt=function(t){t?(wt=wt.filter((function(e){return e.targetElement!==t})),bt&&(t.ontouchstart=null,t.ontouchmove=null,yt&&0===wt.length&&(document.removeEventListener("touchmove",Ot,mt?{passive:!1}:void 0),yt=!1)),bt?function(){if(void 0!==Nt){var t=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=Nt.position,document.body.style.top=Nt.top,document.body.style.left=Nt.left,window.scrollTo(e,t),Nt=void 0}}():(void 0!==St&&(document.body.style.paddingRight=St,St=void 0),void 0!==zt&&(document.body.style.overflow=zt,zt=void 0))):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")};var Rt="ejxIcizu",Wt="tGCxkSAc",Ht="BAqjz8jz",Mt="tab3XKrp",Ct="UnxRu3H0";z(".ejxIcizu{margin:20px 0 10px;user-select:none}.ejxIcizu,.tGCxkSAc{position:relative;width:100%}.tGCxkSAc{align-items:center;background-color:#efefef;border:none;border-radius:3px;color:rgba(55,53,47,.65);cursor:pointer;display:flex;font-size:14px;overflow:hidden;padding:12px 36px 12px 12px;text-align:left;transition:background-color .1s ease-in}.tGCxkSAc:hover{background-color:#e3e3e3}.BAqjz8jz{background-color:#efefef;color:rgba(55,53,47,.65);cursor:not-allowed;pointer-events:none}.tab3XKrp{margin-right:8px;user-select:none}.UnxRu3H0{left:50%;position:absolute;top:50%}");var Bt="tmpFyHNs",At="NdlfkJmx";z(".tmpFyHNs{height:100%;position:relative;width:100%}.tmpFyHNs .NdlfkJmx{background-color:#909090;border-radius:5rem;height:10px;position:absolute;top:50%;transform:translate(-50%,-50%);width:10px}.tmpFyHNs .NdlfkJmx:first-child{animation:p3veiLIQ 2s,_4Q-HiXe1 2s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:calc(50% - 60px)}.tmpFyHNs .NdlfkJmx:nth-child(2){animation:p3veiLIQ 2s,NAkUMYzr 2s;animation-delay:.15s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:calc(50% - 30px)}.tmpFyHNs .NdlfkJmx:nth-child(3){animation:p3veiLIQ 2s,_4Q-HiXe1 2s;animation-delay:.3s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:50%}.tmpFyHNs .NdlfkJmx:nth-child(4){animation:p3veiLIQ 2s,NAkUMYzr 2s;animation-delay:.45s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:calc(50% + 30px)}.tmpFyHNs .NdlfkJmx:nth-child(5){animation:p3veiLIQ 2s,_4Q-HiXe1 2s;animation-delay:.6s;animation-iteration-count:infinite;animation-timing-function:ease-in-out;left:calc(50% + 60px)}@keyframes p3veiLIQ{0%,15%{top:50%}45%,65%{top:42.5%}85%,to{top:50%}}@keyframes _4Q-HiXe1{0%,8%{background-color:#909090;height:10px}14%,34%{background-color:#f8f8f8;height:17.5px}46%,to{background-color:#909090;height:10px}}@keyframes NAkUMYzr{0%,8%{background-color:#909090;height:10px}14%,34%{background-color:#f8f8f8;height:32.5px}46%,to{background-color:#909090;height:10px}}");const Lt=()=>d("div",Object.assign({className:Bt},{children:[l("div",{className:At}),l("div",{className:At}),l("div",{className:At}),l("div",{className:At}),l("div",{className:At})]})),Pt=({element:t,attributes:e,maxSizes:o,children:n,editor:s,onUpload:h})=>{const[p,g]=c(null),[f,v]=c(!1),[b,w]=c("upload"),x=u(null),z=t=>{var e;if(t.stopPropagation(),null!==p)return kt(document.body),void g(null);const i=null===(e=x.current)||void 0===e?void 0:e.getBoundingClientRect();if(i){const t=i.top+i.height+88+20>window.innerHeight,e=!t;console.log({showAtTop:t,showAtBottom:e}),Et(document.body,{reserveScrollBarGap:!0}),g({left:i.left,top:t?i.top-88-5:i.top+i.height+5})}};return d("div",Object.assign({className:i(Rt,{[Ht]:f})},e,{contentEditable:!1},{children:[d("div",Object.assign({ref:x},{children:[d("button",Object.assign({className:Wt,onClick:z,disabled:f},{children:[f&&l("div",Object.assign({className:Ct},{children:l(Lt,{})})),l(tt,{className:Mt,width:24,height:24}),l("span",{children:"Click to add video"})]})),null!==p&&l(ft,{onChange:e=>y(void 0,void 0,void 0,(function*(){if(kt(document.body),g(null),v(!0),!h)return console.error("Provide `onUpload` props in Video options");try{const i=yield h(e),{width:n,height:d}=((t,e,i,o)=>{if(!t||!e)return{};const n=Math.min(i/t,o/e);return{width:t*n,height:e*n}})(i.width,i.height,o.maxWidth,o.maxHeight),l={data:{url:i.url,"data-src":void 0,size:{width:n||t.data.size.width,height:d||t.data.size.height}}};v(!1),r.setNodes(s,l,{at:m.findPath(s,t),match:t=>a.isElement(t)&&"video"===t.type})}catch(t){kt(document.body),g(null),v(!1)}})),onClose:z,activeTab:b,switchTab:t=>w(t),style:p,onEmbed:e=>y(void 0,void 0,void 0,(function*(){if(0===e.length)return;const i=(o=e).includes("youtube.com")||o.includes("youtu.be")?"youtube":o.includes("vimeo.com")?"vimeo":o.includes("dailymotion.com")||o.includes("dai.ly")?"dailymotion":null;var o;let n=null;if("youtube"===i?n=(t=>{const e=t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return e&&11===e[2].length?e[2]:null})(e):"vimeo"===i?n=(t=>new URL(t).pathname.split("/")[1])(e):"dailymotion"===i&&(n=(t=>{var e=t.match(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);return null!==e?void 0!==e[4]?e[4]:e[2]:null})(e)),console.log({provider:i,videoId:n,path:m.findPath(s,t),element:t}),n)try{kt(document.body),g(null);const e={data:Object.assign(Object.assign({},t.data),{url:null,"data-src":void 0,size:{width:t.data.size.width,height:t.data.size.height},provider:i,videoId:n})};r.setNodes(s,e,{at:m.findPath(s,t),match:t=>a.isElement(t)&&"video"===t.type})}catch(t){console.log("error in video on embed",t),kt(document.body),g(null)}}))})]})),n]}))};var Dt="jsof5eGh",It="_9ivUDLVr",_t="hD5QV2jP",Tt="M9o3j8I5",Vt="-dEl6QRc",Gt="_72L6ylPc WOn73-dw",Ut="OhmV3u2l WOn73-dw",Ft="fdfDEgiq",Yt="_7b-PdGXE",Xt="YKGzSDVj",Qt="yDd0Sn4a",qt="VZUnkjYn";z(".jsof5eGh{cursor:pointer;display:block;position:relative}.jsof5eGh:hover .WOn73-dw,.jsof5eGh:hover ._9ivUDLVr{opacity:1}.hD5QV2jP{pointer-events:none}.M9o3j8I5{margin:20px 0 30px}.-dEl6QRc{margin:0 auto}.WOn73-dw{align-items:center;cursor:col-resize;display:flex;height:100%;justify-content:center;opacity:0;pointer-events:none;position:absolute;transition:opacity .15s ease-in 0s;width:15px;z-index:1}._72L6ylPc{left:0;top:0}.OhmV3u2l{right:0;top:0}.fdfDEgiq{background:hsla(0,0%,6%,.6);border:1px solid hsla(0,0%,100%,.9);border-radius:20px;box-shadow:0 0 0 .5px #fff;height:48px;max-height:50%;opacity:1;transition:opacity .3s ease-in 0s;width:6px}._7b-PdGXE{opacity:0}.YKGzSDVj{background:rgba(35,131,226,.14);border-radius:3px;inset:0;opacity:1;pointer-events:none;position:absolute;transition:opacity .15s ease-in 0s;z-index:81}.yDd0Sn4a{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}._9ivUDLVr{align-items:center;background-color:#eee;border:none;border-radius:2px;cursor:pointer;display:flex;height:22px;justify-content:space-between;opacity:0;padding:0 4px;position:absolute;right:10px;top:10px;transition:opacity .15s ease-in 0s;width:22px;z-index:1}.VZUnkjYn{background-color:gray;border-radius:50%;min-height:3px;min-width:3px}");function Jt(t){var o,n,s,h,u,f,w;const{element:y,editor:x,plugin:z}=t,N=v(),S=b(),[j,O]=c(null),[E,k]=c({width:(null===(n=null===(o=y.data)||void 0===o?void 0:o.size)||void 0===n?void 0:n.width)||"auto",height:(null===(h=null===(s=y.data)||void 0===s?void 0:s.size)||void 0===h?void 0:h.height)||"auto"});p((()=>{var t,e,i,o;y.data&&k({width:(null===(e=null===(t=y.data)||void 0===t?void 0:t.size)||void 0===e?void 0:e.width)||"auto",height:(null===(o=null===(i=y.data)||void 0===i?void 0:i.size)||void 0===o?void 0:o.height)||"auto"})}),[null===(u=y.data)||void 0===u?void 0:u.size]);const R=g((()=>{var t;return{minWidth:92,size:{width:E.width,height:E.height},maxWidth:(null===(t=z.options)||void 0===t?void 0:t.maxWidth)||800,lockAspectRatio:!0,resizeRatio:2,enable:{left:!S,right:!S},handleStyles:{left:{left:0},right:{right:0}},onResize:(t,e,i)=>{k({width:i.offsetWidth,height:i.offsetHeight})},onResizeStop:(t,e,i)=>{console.log("video editor editor.children",x.children),console.log("ReactEditor.findPath(editor, element)",m.findPath(x,y)),console.log("element",y),r.setNodes(x,{data:Object.assign(Object.assign({},y.data),{size:{width:i.offsetWidth,height:i.offsetHeight}})},{at:m.findPath(x,y),match:t=>a.isElement(t)&&"video"===t.type})},handleComponent:{left:l("div",Object.assign({contentEditable:!1,className:Gt},{children:l("div",{className:Ft})})),right:l("div",Object.assign({contentEditable:!1,className:Ut},{children:l("div",{className:Ft})}))}}}),[E.width,E.height,x]),W=!!(null===(f=y.data)||void 0===f?void 0:f.caption),H=!!y.data["data-src"]&&!y.data.url,M=()=>{kt(document.body),O(null)},C=t=>{var e;if(null==t||t.stopPropagation(),null!==j)return M();const i=null===(e=null==t?void 0:t.currentTarget)||void 0===e?void 0:e.getBoundingClientRect();if(i){const t=i.top+i.height+164+20>window.innerHeight;Et(document.body,{reserveScrollBarGap:!0}),O({left:i.right-i.width+265>window.innerWidth?window.innerWidth-265-i.width:i.right-i.width,top:t?i.top-82-i.height:i.top+i.height+5})}};if(!y.data.url&&!y.data["data-src"]&&!y.data.videoId){const{maxWidth:o=750,maxHeight:n=800}=z.options||{};return d("div",Object.assign({className:Dt,contentEditable:!1},{children:[l("div",{className:i(Yt,{[Xt]:N})}),l(Pt,Object.assign({attributes:t.attributes,element:t.element,editor:x,onUpload:null===(w=z.options)||void 0===w?void 0:w.onUpload,maxSizes:{maxWidth:o,maxHeight:n}},{children:!S&&d("div",{children:[d("button",Object.assign({type:"button",className:It,onClick:C},{children:[l("span",{className:qt}),l("span",{className:qt}),l("span",{className:qt})]})),null!==j&&l(e.ElementOptions,{onClose:M,style:j,element:y,onCopy:M,onDelete:M,onDuplicate:M},y.id)]})})),t.children]}),y.id)}return l("div",Object.assign({contentEditable:!1,draggable:!1,className:i(Dt,{[Tt]:W,[_t]:H})},{children:d(K,Object.assign({},R,{className:Vt},{children:[z.renderer.render(Object.assign(Object.assign({},t),{size:E})),l("div",{className:i(Yt,{[Xt]:N})}),H&&l("div",Object.assign({className:Qt},{children:l(Lt,{})})),!S&&d("div",{children:[d("button",Object.assign({type:"button",className:It,onClick:C},{children:[l("span",{className:qt}),l("span",{className:qt}),l("span",{className:qt})]})),null!==j&&l(e.ElementOptions,{onClose:M,style:j,element:y,onCopy:M,onDelete:M,onDuplicate:M},y.id)]})]}))}),y.id)}const Zt=o({type:"video",renderer:{editor:(t,e)=>i=>l(Jt,Object.assign({editor:t,plugin:e},i)),render:({attributes:e,element:i,children:o,size:n,HTMLAttributes:s})=>{var r,a,h,c;const p=(null==n?void 0:n.width)||(null===(a=null===(r=i.data)||void 0===r?void 0:r.size)||void 0===a?void 0:a.width)||"100%",u=(null==n?void 0:n.height)||(null===(c=null===(h=i.data)||void 0===h?void 0:h.size)||void 0===c?void 0:c.height)||400;if("string"==typeof i.data.provider&&i.data.videoId&&W[i.data.provider]){const n=W[i.data.provider];return d("div",Object.assign({},e,s,{className:t({element:i,HTMLAttributes:s,className:N}),contentEditable:!1,draggable:!1},{children:[l("div",Object.assign({className:j},{children:l("div",Object.assign({className:E},{children:l(n,{videoId:i.data.videoId})}))})),o]}))}return i.data.url||i.data["data-src"]?d("div",Object.assign({},e,{className:N,contentEditable:!1,draggable:!1},{children:[l("video",Object.assign({controls:!0,preload:"metadata",playsInline:!0,src:i.data.url||i.data["data-src"]||"",width:p,height:u,onDragStart:t=>t.preventDefault()},s,{className:t({element:i,HTMLAttributes:s,className:S})})),o]})):l("div",Object.assign({},e,{className:N,contentEditable:!1,draggable:!1},{children:o}))}},extendEditor(t){const{isVoid:e}=t;return t.isVoid=t=>t.type===Zt.getPlugin.type||e(t),t},events:{onKeyDown:(t,{defaultNode:e,hotkeys:i})=>o=>{var s;if("video"===n(t,null===(s=t.selection)||void 0===s?void 0:s.anchor.path,"highest").type&&t.selection)return console.log("hotkeys.isEnter(event)",i.isEnter(o)),i.isEnter(o)?(o.preventDefault(),void r.insertNodes(t,e,{mode:"highest"})):void 0}},defineElement:()=>({id:s(),type:"video",nodeType:"void",data:{url:null,size:{width:"auto",height:"auto"}},children:[{text:""}]}),createElement:(t,e)=>{var i;const o=Object.assign(Object.assign({},Zt.getPlugin.defineElement()),e);r.setNodes(t,o,{at:null===(i=t.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(t,e)=>`<video preload controls src="${t.data.url}" height="${t.data.size.height}" width="${t.data.size.width}"></video>\n`},html:{serialize:t=>`<video preload controls src="${t.data.url}" height="${t.data.size.height}" width="${t.data.size.width}"></video>`,deserialize:{nodeName:"VIDEO",parse:t=>({url:t.getAttribute("src"),size:{height:"string"==typeof t.getAttribute("height")?Number(t.getAttribute("height")):"auto",width:"string"==typeof t.getAttribute("width")?Number(t.getAttribute("width")):"auto"}})}}},options:{searchString:"video media",displayLabel:"Video"}});export{Zt as default};
1
+ import{useYooptaEditor as e,useYooptaPluginOptions as t,UI as n,useBlockData as i,useBlockSelected as o,YooptaPlugin as r}from"@yoopta/editor";import{jsxs as s,jsx as l}from"react/jsx-runtime";import*as a from"react";import{useState as c,useEffect as u,useRef as d,useLayoutEffect as h,forwardRef as p,createElement as f,useMemo as g}from"react";import*as m from"react-dom";import{flushSync as v,createPortal as w}from"react-dom";function b(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}function y(e,t,n,i){return new(n||(n=Promise))((function(o,r){function s(e){try{a(i.next(e))}catch(e){r(e)}}function l(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,l)}a((i=i.apply(e,t||[])).next())}))}function x(e,{threshold:t=0,root:n=null,rootMargin:i="0%",freezeOnceVisible:o=!1}={}){const[r,s]=c({}),l=r.isIntersecting&&o,a=([e])=>s(e);return u((()=>{const o=null==e?void 0:e.current;if(!window.IntersectionObserver||l||!o)return;const r=new IntersectionObserver(a,{threshold:t,root:n,rootMargin:i});return r.observe(o),()=>r.disconnect()}),[e,t,n,i,l]),r}"function"==typeof SuppressedError&&SuppressedError;const C={vimeo:function(e){var{videoId:t}=e,n=b(e,["videoId"]);const i=d(null),[o,r]=c(null),[a,h]=c(!1),{isIntersecting:p}=x(i,{freezeOnceVisible:!0,rootMargin:"50%"});return u((()=>{fetch(`https://vimeo.com/api/v2/video/${t}.json`).then((e=>e.json())).then((e=>r(e[0].thumbnail_medium))).catch((()=>r(null)))}),[t]),s("div",Object.assign({ref:i,className:"yoo-video-relative"},{children:[l("img",{src:o||"",alt:"vimeo_video_preview",width:"100%",height:"100%",className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0 yoo-video-w-full yoo-video-h-full",style:{opacity:p&&a?0:1,zIndex:p&&a?-1:0}}),p&&l("iframe",Object.assign({title:"Video Player",src:`https://player.vimeo.com/video/${t}?badge=0&byline=0&portrait=0&title=0`,frameBorder:0,allowFullScreen:!0,onLoad:()=>h(!0),className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0"},n))]}))},youtube:function(e){var{videoId:t}=e,n=b(e,["videoId"]);const i=d(null),[o,r]=c(!1),{isIntersecting:a}=x(i,{freezeOnceVisible:!0,rootMargin:"50%"});return s("div",Object.assign({ref:i,className:"yoo-video-relative"},{children:[l("img",{src:`https://i.ytimg.com/vi/${t}/default.jpg`,alt:"youtube_video_preview",width:"100%",height:"100%",className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0 yoo-video-w-full yoo-video-h-full",style:{opacity:a&&o?0:1,zIndex:a&&o?-1:0}}),a&&l("iframe",Object.assign({title:"Video Player",src:`https://www.youtube.com/embed/${t}`,frameBorder:0,onLoad:()=>r(!0),allowFullScreen:!0,className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0"},n))]}))},dailymotion:function(e){var{videoId:t}=e,n=b(e,["videoId"]);const i=d(null),[o,r]=c(null),[a,h]=c(!1),{isIntersecting:p}=x(i,{freezeOnceVisible:!0,rootMargin:"50%"});return u((()=>{fetch((e=>`https://api.dailymotion.com/video/${e}?fields=thumbnail_url`)(t)).then((e=>e.json())).then((e=>r(e.thumbnail_url))).catch((()=>r(null)))}),[t]),s("div",Object.assign({ref:i,className:"yoo-video-relative"},{children:[l("img",{src:o||"",alt:"daylimotion_video_preview",width:"100%",height:"100%",className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0 yoo-video-w-full yoo-video-h-full",style:{opacity:p&&a?0:1,zIndex:p&&a?-1:0}}),p&&l("iframe",Object.assign({title:"Dailymotion Video Player",frameBorder:0,onLoad:()=>h(!0),src:`https://www.dailymotion.com/embed/video/${t}`,allowFullScreen:!0,className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0"},n))]}))}},S=({width:e,height:t,src:n,settings:i,bgColor:o,poster:r,provider:s,fit:a})=>{const c={backgroundColor:o||"transparent",objectFit:a||"contain"};if(s&&s.id&&s.type&&C[s.type]){const n=C[s.type];return l(n,{videoId:s.id,width:e,height:t})}return l("div",Object.assign({className:"w-full"},{children:n&&l("video",{preload:"metadata",poster:r,src:n,width:e,height:t,onDragStart:e=>e.preventDefault(),className:"object-cover w-full h-full",style:c,playsInline:!0,controls:!0})}))};var R,z=(R=function(e,t){return R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},R(e,t)},function(e,t){function n(){this.constructor=e}R(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),E=function(){return E=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},E.apply(this,arguments)},O={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},L={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},N={width:"20px",height:"20px",position:"absolute"},k={top:E(E({},O),{top:"-5px"}),right:E(E({},L),{left:void 0,right:"-5px"}),bottom:E(E({},O),{top:void 0,bottom:"-5px"}),left:E(E({},L),{left:"-5px"}),topRight:E(E({},N),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:E(E({},N),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:E(E({},N),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:E(E({},N),{left:"-10px",top:"-10px",cursor:"nw-resize"})},_=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onMouseDown=function(e){t.props.onResizeStart(e,t.props.direction)},t.onTouchStart=function(e){t.props.onResizeStart(e,t.props.direction)},t}return z(t,e),t.prototype.render=function(){return a.createElement("div",{className:this.props.className||"",style:E(E({position:"absolute",userSelect:"none"},k[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(a.PureComponent),j=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),M=function(){return M=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},M.apply(this,arguments)},W={width:"auto",height:"auto"},T=function(e,t,n){return Math.max(Math.min(e,n),t)},A=function(e,t){return Math.round(e/t)*t},B=function(e,t){return new RegExp(e,"i").test(t)},P=function(e){return Boolean(e.touches&&e.touches.length)},I=function(e,t,n){void 0===n&&(n=0);var i=t.reduce((function(n,i,o){return Math.abs(i-e)<Math.abs(t[n]-e)?o:n}),0),o=Math.abs(t[i]-e);return 0===n||o<n?t[i]:e},H=function(e){return"auto"===(e=e.toString())||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:e+"px"},D=function(e,t,n,i){if(e&&"string"==typeof e){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%"))return t*(Number(e.replace("%",""))/100);if(e.endsWith("vw"))return n*(Number(e.replace("vw",""))/100);if(e.endsWith("vh"))return i*(Number(e.replace("vh",""))/100)}return e},F=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],V="__resizable_base__",U=function(e){function t(t){var n=e.call(this,t)||this;return n.ratio=1,n.resizable=null,n.parentLeft=0,n.parentTop=0,n.resizableLeft=0,n.resizableRight=0,n.resizableTop=0,n.resizableBottom=0,n.targetLeft=0,n.targetTop=0,n.appendBase=function(){if(!n.resizable||!n.window)return null;var e=n.parentNode;if(!e)return null;var t=n.window.document.createElement("div");return t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.transform="scale(0, 0)",t.style.left="0",t.style.flex="0 0 100%",t.classList?t.classList.add(V):t.className+=V,e.appendChild(t),t},n.removeBase=function(e){var t=n.parentNode;t&&t.removeChild(e)},n.ref=function(e){e&&(n.resizable=e)},n.state={isResizing:!1,width:void 0===(n.propsSize&&n.propsSize.width)?"auto":n.propsSize&&n.propsSize.width,height:void 0===(n.propsSize&&n.propsSize.height)?"auto":n.propsSize&&n.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},n.onResizeStart=n.onResizeStart.bind(n),n.onMouseMove=n.onMouseMove.bind(n),n.onMouseUp=n.onMouseUp.bind(n),n}return j(t,e),Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return this.resizable&&this.resizable.ownerDocument?this.resizable.ownerDocument.defaultView:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||W},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=0,t=0;if(this.resizable&&this.window){var n=this.resizable.offsetWidth,i=this.resizable.offsetHeight,o=this.resizable.style.position;"relative"!==o&&(this.resizable.style.position="relative"),e="auto"!==this.resizable.style.width?this.resizable.offsetWidth:n,t="auto"!==this.resizable.style.height?this.resizable.offsetHeight:i,this.resizable.style.position=o}return{width:e,height:t}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var e=this,t=this.props.size,n=function(t){if(void 0===e.state[t]||"auto"===e.state[t])return"auto";if(e.propsSize&&e.propsSize[t]&&e.propsSize[t].toString().endsWith("%")){if(e.state[t].toString().endsWith("%"))return e.state[t].toString();var n=e.getParentSize();return Number(e.state[t].toString().replace("px",""))/n[t]*100+"%"}return H(e.state[t])};return{width:t&&void 0!==t.width&&!this.state.isResizing?H(t.width):n("width"),height:t&&void 0!==t.height&&!this.state.isResizing?H(t.height):n("height")}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var e=this.appendBase();if(!e)return{width:0,height:0};var t=!1,n=this.parentNode.style.flexWrap;"wrap"!==n&&(t=!0,this.parentNode.style.flexWrap="wrap"),e.style.position="relative",e.style.minWidth="100%",e.style.minHeight="100%";var i={width:e.offsetWidth,height:e.offsetHeight};return t&&(this.parentNode.style.flexWrap=n),this.removeBase(e),i},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(this.resizable&&this.window){var e=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:"auto"!==e.flexBasis?e.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(e,t){var n=this.propsSize&&this.propsSize[t];return"auto"!==this.state[t]||this.state.original[t]!==e||void 0!==n&&"auto"!==n?e:"auto"},t.prototype.calculateNewMaxFromBoundary=function(e,t){var n,i,o=this.props.boundsByDirection,r=this.state.direction,s=o&&B("left",r),l=o&&B("top",r);if("parent"===this.props.bounds){var a=this.parentNode;a&&(n=s?this.resizableRight-this.parentLeft:a.offsetWidth+(this.parentLeft-this.resizableLeft),i=l?this.resizableBottom-this.parentTop:a.offsetHeight+(this.parentTop-this.resizableTop))}else"window"===this.props.bounds?this.window&&(n=s?this.resizableRight:this.window.innerWidth-this.resizableLeft,i=l?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(n=s?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),i=l?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return n&&Number.isFinite(n)&&(e=e&&e<n?e:n),i&&Number.isFinite(i)&&(t=t&&t<i?t:i),{maxWidth:e,maxHeight:t}},t.prototype.calculateNewSizeFromDirection=function(e,t){var n=this.props.scale||1,i=this.props.resizeRatio||1,o=this.state,r=o.direction,s=o.original,l=this.props,a=l.lockAspectRatio,c=l.lockAspectRatioExtraHeight,u=l.lockAspectRatioExtraWidth,d=s.width,h=s.height,p=c||0,f=u||0;return B("right",r)&&(d=s.width+(e-s.x)*i/n,a&&(h=(d-f)/this.ratio+p)),B("left",r)&&(d=s.width-(e-s.x)*i/n,a&&(h=(d-f)/this.ratio+p)),B("bottom",r)&&(h=s.height+(t-s.y)*i/n,a&&(d=(h-p)*this.ratio+f)),B("top",r)&&(h=s.height-(t-s.y)*i/n,a&&(d=(h-p)*this.ratio+f)),{newWidth:d,newHeight:h}},t.prototype.calculateNewSizeFromAspectRatio=function(e,t,n,i){var o=this.props,r=o.lockAspectRatio,s=o.lockAspectRatioExtraHeight,l=o.lockAspectRatioExtraWidth,a=void 0===i.width?10:i.width,c=void 0===n.width||n.width<0?e:n.width,u=void 0===i.height?10:i.height,d=void 0===n.height||n.height<0?t:n.height,h=s||0,p=l||0;if(r){var f=(u-h)*this.ratio+p,g=(d-h)*this.ratio+p,m=(a-p)/this.ratio+h,v=(c-p)/this.ratio+h,w=Math.max(a,f),b=Math.min(c,g),y=Math.max(u,m),x=Math.min(d,v);e=T(e,w,b),t=T(t,y,x)}else e=T(e,a,c),t=T(t,u,d);return{newWidth:e,newHeight:t}},t.prototype.setBoundingClientRect=function(){if("parent"===this.props.bounds){var e=this.parentNode;if(e){var t=e.getBoundingClientRect();this.parentLeft=t.left,this.parentTop=t.top}}if(this.props.bounds&&"string"!=typeof this.props.bounds){var n=this.props.bounds.getBoundingClientRect();this.targetLeft=n.left,this.targetTop=n.top}if(this.resizable){var i=this.resizable.getBoundingClientRect(),o=i.left,r=i.top,s=i.right,l=i.bottom;this.resizableLeft=o,this.resizableRight=s,this.resizableTop=r,this.resizableBottom=l}},t.prototype.onResizeStart=function(e,t){if(this.resizable&&this.window){var n,i=0,o=0;if(e.nativeEvent&&function(e){return Boolean((e.clientX||0===e.clientX)&&(e.clientY||0===e.clientY))}(e.nativeEvent)?(i=e.nativeEvent.clientX,o=e.nativeEvent.clientY):e.nativeEvent&&P(e.nativeEvent)&&(i=e.nativeEvent.touches[0].clientX,o=e.nativeEvent.touches[0].clientY),this.props.onResizeStart)if(this.resizable)if(!1===this.props.onResizeStart(e,t,this.resizable))return;this.props.size&&(void 0!==this.props.size.height&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),void 0!==this.props.size.width&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio="number"==typeof this.props.lockAspectRatio?this.props.lockAspectRatio:this.size.width/this.size.height;var r=this.window.getComputedStyle(this.resizable);if("auto"!==r.flexBasis){var s=this.parentNode;if(s){var l=this.window.getComputedStyle(s).flexDirection;this.flexDir=l.startsWith("row")?"row":"column",n=r.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var a={original:{x:i,y:o,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:M(M({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||"auto"}),direction:t,flexBasis:n};this.setState(a)}},t.prototype.onMouseMove=function(e){var t=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&P(e))try{e.preventDefault(),e.stopPropagation()}catch(e){}var n=this.props,i=n.maxWidth,o=n.maxHeight,r=n.minWidth,s=n.minHeight,l=P(e)?e.touches[0].clientX:e.clientX,a=P(e)?e.touches[0].clientY:e.clientY,c=this.state,u=c.direction,d=c.original,h=c.width,p=c.height,f=this.getParentSize(),g=function(e,t,n,i,o,r,s){return i=D(i,e.width,t,n),o=D(o,e.height,t,n),r=D(r,e.width,t,n),s=D(s,e.height,t,n),{maxWidth:void 0===i?void 0:Number(i),maxHeight:void 0===o?void 0:Number(o),minWidth:void 0===r?void 0:Number(r),minHeight:void 0===s?void 0:Number(s)}}(f,this.window.innerWidth,this.window.innerHeight,i,o,r,s);i=g.maxWidth,o=g.maxHeight,r=g.minWidth,s=g.minHeight;var m=this.calculateNewSizeFromDirection(l,a),w=m.newHeight,b=m.newWidth,y=this.calculateNewMaxFromBoundary(i,o);this.props.snap&&this.props.snap.x&&(b=I(b,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(w=I(w,this.props.snap.y,this.props.snapGap));var x=this.calculateNewSizeFromAspectRatio(b,w,{width:y.maxWidth,height:y.maxHeight},{width:r,height:s});if(b=x.newWidth,w=x.newHeight,this.props.grid){var C=A(b,this.props.grid[0]),S=A(w,this.props.grid[1]),R=this.props.snapGap||0;b=0===R||Math.abs(C-b)<=R?C:b,w=0===R||Math.abs(S-w)<=R?S:w}var z={width:b-d.width,height:w-d.height};if(h&&"string"==typeof h)if(h.endsWith("%"))b=b/f.width*100+"%";else if(h.endsWith("vw")){b=b/this.window.innerWidth*100+"vw"}else if(h.endsWith("vh")){b=b/this.window.innerHeight*100+"vh"}if(p&&"string"==typeof p)if(p.endsWith("%"))w=w/f.height*100+"%";else if(p.endsWith("vw")){w=w/this.window.innerWidth*100+"vw"}else if(p.endsWith("vh")){w=w/this.window.innerHeight*100+"vh"}var E={width:this.createSizeForCssProperty(b,"width"),height:this.createSizeForCssProperty(w,"height")};"row"===this.flexDir?E.flexBasis=E.width:"column"===this.flexDir&&(E.flexBasis=E.height),v((function(){t.setState(E)})),this.props.onResize&&this.props.onResize(e,u,this.resizable,z)}},t.prototype.onMouseUp=function(e){var t=this.state,n=t.isResizing,i=t.direction,o=t.original;if(n&&this.resizable){var r={width:this.size.width-o.width,height:this.size.height-o.height};this.props.onResizeStop&&this.props.onResizeStop(e,i,this.resizable,r),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:M(M({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(e){this.setState({width:e.width,height:e.height})},t.prototype.renderResizer=function(){var e=this,t=this.props,n=t.enable,i=t.handleStyles,o=t.handleClasses,r=t.handleWrapperStyle,s=t.handleWrapperClass,l=t.handleComponent;if(!n)return null;var c=Object.keys(n).map((function(t){return!1!==n[t]?a.createElement(_,{key:t,direction:t,onResizeStart:e.onResizeStart,replaceStyles:i&&i[t],className:o&&o[t]},l&&l[t]?l[t]:null):null}));return a.createElement("div",{className:s,style:r},c)},t.prototype.render=function(){var e=this,t=Object.keys(this.props).reduce((function(t,n){return-1!==F.indexOf(n)||(t[n]=e.props[n]),t}),{}),n=M(M(M({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(n.flexBasis=this.state.flexBasis);var i=this.props.as||"div";return a.createElement(i,M({ref:this.ref,style:n,className:this.props.className},t),this.state.isResizing&&a.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(a.PureComponent);function $(e){return Z(e)?(e.nodeName||"").toLowerCase():"#document"}function X(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Y(e){var t;return null==(t=(Z(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Z(e){return e instanceof Node||e instanceof X(e).Node}function G(e){return e instanceof Element||e instanceof X(e).Element}function q(e){return e instanceof HTMLElement||e instanceof X(e).HTMLElement}function J(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof X(e).ShadowRoot)}function K(e){const{overflow:t,overflowX:n,overflowY:i,display:o}=ie(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!["inline","contents"].includes(o)}function Q(e){return["table","td","th"].includes($(e))}function ee(e){const t=te(),n=ie(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function te(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function ne(e){return["html","body","#document"].includes($(e))}function ie(e){return X(e).getComputedStyle(e)}function oe(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function re(e){if("html"===$(e))return e;const t=e.assignedSlot||e.parentNode||J(e)&&e.host||Y(e);return J(t)?t.host:t}function se(e){const t=re(e);return ne(t)?e.ownerDocument?e.ownerDocument.body:e.body:q(t)&&K(t)?t:se(t)}function le(e,t,n){var i;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=se(e),r=o===(null==(i=e.ownerDocument)?void 0:i.body),s=X(o);return r?t.concat(s,s.visualViewport||[],K(o)?o:[],s.frameElement&&n?le(s.frameElement):[]):t.concat(o,le(o,[],n))}const ae=Math.min,ce=Math.max,ue=Math.round,de=e=>({x:e,y:e}),he={left:"right",right:"left",bottom:"top",top:"bottom"},pe={start:"end",end:"start"};function fe(e,t,n){return ce(e,ae(t,n))}function ge(e,t){return"function"==typeof e?e(t):e}function me(e){return e.split("-")[0]}function ve(e){return e.split("-")[1]}function we(e){return"x"===e?"y":"x"}function be(e){return"y"===e?"height":"width"}function ye(e){return["top","bottom"].includes(me(e))?"y":"x"}function xe(e){return we(ye(e))}function Ce(e){return e.replace(/start|end/g,(e=>pe[e]))}function Se(e){return e.replace(/left|right|bottom|top/g,(e=>he[e]))}function Re(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 ze(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function Ee(e,t,n){let{reference:i,floating:o}=e;const r=ye(t),s=xe(t),l=be(s),a=me(t),c="y"===r,u=i.x+i.width/2-o.width/2,d=i.y+i.height/2-o.height/2,h=i[l]/2-o[l]/2;let p;switch(a){case"top":p={x:u,y:i.y-o.height};break;case"bottom":p={x:u,y:i.y+i.height};break;case"right":p={x:i.x+i.width,y:d};break;case"left":p={x:i.x-o.width,y:d};break;default:p={x:i.x,y:i.y}}switch(ve(t)){case"start":p[s]-=h*(n&&c?-1:1);break;case"end":p[s]+=h*(n&&c?-1:1)}return p}async function Oe(e,t){var n;void 0===t&&(t={});const{x:i,y:o,platform:r,rects:s,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=ge(t,e),f=Re(p),g=l[h?"floating"===d?"reference":"floating":d],m=ze(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(g)))||n?g:g.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),v="floating"===d?{...s.floating,x:i,y:o}:s.reference,w=await(null==r.getOffsetParent?void 0:r.getOffsetParent(l.floating)),b=await(null==r.isElement?void 0:r.isElement(w))&&await(null==r.getScale?void 0:r.getScale(w))||{x:1,y:1},y=ze(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:w,strategy:a}):v);return{top:(m.top-y.top+f.top)/b.y,bottom:(y.bottom-m.bottom+f.bottom)/b.y,left:(m.left-y.left+f.left)/b.x,right:(y.right-m.right+f.right)/b.x}}function Le(e){const t=ae(...e.map((e=>e.left))),n=ae(...e.map((e=>e.top)));return{x:t,y:n,width:ce(...e.map((e=>e.right)))-t,height:ce(...e.map((e=>e.bottom)))-n}}const Ne=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,i;const{x:o,y:r,placement:s,middlewareData:l}=t,a=await async function(e,t){const{placement:n,platform:i,elements:o}=e,r=await(null==i.isRTL?void 0:i.isRTL(o.floating)),s=me(n),l=ve(n),a="y"===ye(n),c=["left","top"].includes(s)?-1:1,u=r&&a?-1:1,d=ge(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:f}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return l&&"number"==typeof f&&(p="end"===l?-1*f:f),a?{x:p*u,y:h*c}:{x:h*c,y:p*u}}(t,e);return s===(null==(n=l.offset)?void 0:n.placement)&&null!=(i=l.arrow)&&i.alignmentOffset?{}:{x:o+a.x,y:r+a.y,data:{...a,placement:s}}}}};function ke(e){const t=ie(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const o=q(e),r=o?e.offsetWidth:n,s=o?e.offsetHeight:i,l=ue(n)!==r||ue(i)!==s;return l&&(n=r,i=s),{width:n,height:i,$:l}}function _e(e){return G(e)?e:e.contextElement}function je(e){const t=_e(e);if(!q(t))return de(1);const n=t.getBoundingClientRect(),{width:i,height:o,$:r}=ke(t);let s=(r?ue(n.width):n.width)/i,l=(r?ue(n.height):n.height)/o;return s&&Number.isFinite(s)||(s=1),l&&Number.isFinite(l)||(l=1),{x:s,y:l}}const Me=de(0);function We(e){const t=X(e);return te()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Me}function Te(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),r=_e(e);let s=de(1);t&&(i?G(i)&&(s=je(i)):s=je(e));const l=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==X(e))&&t}(r,n,i)?We(r):de(0);let a=(o.left+l.x)/s.x,c=(o.top+l.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(r){const e=X(r),t=i&&G(i)?X(i):i;let n=e,o=n.frameElement;for(;o&&i&&t!==n;){const e=je(o),t=o.getBoundingClientRect(),i=ie(o),r=t.left+(o.clientLeft+parseFloat(i.paddingLeft))*e.x,s=t.top+(o.clientTop+parseFloat(i.paddingTop))*e.y;a*=e.x,c*=e.y,u*=e.x,d*=e.y,a+=r,c+=s,n=X(o),o=n.frameElement}}return ze({width:u,height:d,x:a,y:c})}const Ae=[":popover-open",":modal"];function Be(e){return Ae.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Pe(e){return Te(Y(e)).left+oe(e).scrollLeft}function Ie(e,t,n){let i;if("viewport"===t)i=function(e,t){const n=X(e),i=Y(e),o=n.visualViewport;let r=i.clientWidth,s=i.clientHeight,l=0,a=0;if(o){r=o.width,s=o.height;const e=te();(!e||e&&"fixed"===t)&&(l=o.offsetLeft,a=o.offsetTop)}return{width:r,height:s,x:l,y:a}}(e,n);else if("document"===t)i=function(e){const t=Y(e),n=oe(e),i=e.ownerDocument.body,o=ce(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),r=ce(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let s=-n.scrollLeft+Pe(e);const l=-n.scrollTop;return"rtl"===ie(i).direction&&(s+=ce(t.clientWidth,i.clientWidth)-o),{width:o,height:r,x:s,y:l}}(Y(e));else if(G(t))i=function(e,t){const n=Te(e,!0,"fixed"===t),i=n.top+e.clientTop,o=n.left+e.clientLeft,r=q(e)?je(e):de(1);return{width:e.clientWidth*r.x,height:e.clientHeight*r.y,x:o*r.x,y:i*r.y}}(t,n);else{const n=We(e);i={...t,x:t.x-n.x,y:t.y-n.y}}return ze(i)}function He(e,t){const n=re(e);return!(n===t||!G(n)||ne(n))&&("fixed"===ie(n).position||He(n,t))}function De(e,t,n){const i=q(t),o=Y(t),r="fixed"===n,s=Te(e,!0,r,t);let l={scrollLeft:0,scrollTop:0};const a=de(0);if(i||!i&&!r)if(("body"!==$(t)||K(o))&&(l=oe(t)),i){const e=Te(t,!0,r,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=Pe(o));return{x:s.left+l.scrollLeft-a.x,y:s.top+l.scrollTop-a.y,width:s.width,height:s.height}}function Fe(e,t){return q(e)&&"fixed"!==ie(e).position?t?t(e):e.offsetParent:null}function Ve(e,t){const n=X(e);if(!q(e)||Be(e))return n;let i=Fe(e,t);for(;i&&Q(i)&&"static"===ie(i).position;)i=Fe(i,t);return i&&("html"===$(i)||"body"===$(i)&&"static"===ie(i).position&&!ee(i))?n:i||function(e){let t=re(e);for(;q(t)&&!ne(t);){if(ee(t))return t;t=re(t)}return null}(e)||n}const Ue={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:i,strategy:o}=e;const r="fixed"===o,s=Y(i),l=!!t&&Be(t.floating);if(i===s||l&&r)return n;let a={scrollLeft:0,scrollTop:0},c=de(1);const u=de(0),d=q(i);if((d||!d&&!r)&&(("body"!==$(i)||K(s))&&(a=oe(i)),q(i))){const e=Te(i);c=je(i),u.x=e.x+i.clientLeft,u.y=e.y+i.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x,y:n.y*c.y-a.scrollTop*c.y+u.y}},getDocumentElement:Y,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:i,strategy:o}=e;const r=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let i=le(e,[],!1).filter((e=>G(e)&&"body"!==$(e))),o=null;const r="fixed"===ie(e).position;let s=r?re(e):e;for(;G(s)&&!ne(s);){const t=ie(s),n=ee(s);n||"fixed"!==t.position||(o=null),(r?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||K(s)&&!n&&He(e,s))?i=i.filter((e=>e!==s)):o=t,s=re(s)}return t.set(e,i),i}(t,this._c):[].concat(n),i],s=r[0],l=r.reduce(((e,n)=>{const i=Ie(t,n,o);return e.top=ce(i.top,e.top),e.right=ae(i.right,e.right),e.bottom=ae(i.bottom,e.bottom),e.left=ce(i.left,e.left),e}),Ie(t,s,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:Ve,getElementRects:async function(e){const t=this.getOffsetParent||Ve,n=this.getDimensions;return{reference:De(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=ke(e);return{width:t,height:n}},getScale:je,isElement:G,isRTL:function(e){return"rtl"===ie(e).direction}},$e=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:i,placement:o}=t,{mainAxis:r=!0,crossAxis:s=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...a}=ge(e,t),c={x:n,y:i},u=await Oe(t,a),d=ye(me(o)),h=we(d);let p=c[h],f=c[d];if(r){const e="y"===h?"bottom":"right";p=fe(p+u["y"===h?"top":"left"],p,p-u[e])}if(s){const e="y"===d?"bottom":"right";f=fe(f+u["y"===d?"top":"left"],f,f-u[e])}const g=l.fn({...t,[h]:p,[d]:f});return{...g,data:{x:g.x-n,y:g.y-i}}}}},Xe=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,i;const{placement:o,middlewareData:r,rects:s,initialPlacement:l,platform:a,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:g=!0,...m}=ge(e,t);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const v=me(o),w=me(l)===l,b=await(null==a.isRTL?void 0:a.isRTL(c.floating)),y=h||(w||!g?[Se(l)]:function(e){const t=Se(e);return[Ce(e),t,Ce(t)]}(l));h||"none"===f||y.push(...function(e,t,n,i){const o=ve(e);let r=function(e,t,n){const i=["left","right"],o=["right","left"],r=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:i:t?i:o;case"left":case"right":return t?r:s;default:return[]}}(me(e),"start"===n,i);return o&&(r=r.map((e=>e+"-"+o)),t&&(r=r.concat(r.map(Ce)))),r}(l,g,f,b));const x=[l,...y],C=await Oe(t,m),S=[];let R=(null==(i=r.flip)?void 0:i.overflows)||[];if(u&&S.push(C[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const i=ve(e),o=xe(e),r=be(o);let s="x"===o?i===(n?"end":"start")?"right":"left":"start"===i?"bottom":"top";return t.reference[r]>t.floating[r]&&(s=Se(s)),[s,Se(s)]}(o,s,b);S.push(C[e[0]],C[e[1]])}if(R=[...R,{placement:o,overflows:S}],!S.every((e=>e<=0))){var z,E;const e=((null==(z=r.flip)?void 0:z.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:R},reset:{placement:t}};let n=null==(E=R.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:E.placement;if(!n)switch(p){case"bestFit":{var O;const e=null==(O=R.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:O[0];e&&(n=e);break}case"initialPlacement":n=l}if(o!==n)return{reset:{placement:n}}}return{}}}},Ye=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:i,rects:o,platform:r,strategy:s}=t,{padding:l=2,x:a,y:c}=ge(e,t),u=Array.from(await(null==r.getClientRects?void 0:r.getClientRects(i.reference))||[]),d=function(e){const t=e.slice().sort(((e,t)=>e.y-t.y)),n=[];let i=null;for(let e=0;e<t.length;e++){const o=t[e];!i||o.y-i.y>i.height/2?n.push([o]):n[n.length-1].push(o),i=o}return n.map((e=>ze(Le(e))))}(u),h=ze(Le(u)),p=Re(l);const f=await r.getElementRects({reference:{getBoundingClientRect:function(){if(2===d.length&&d[0].left>d[1].right&&null!=a&&null!=c)return d.find((e=>a>e.left-p.left&&a<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom))||h;if(d.length>=2){if("y"===ye(n)){const e=d[0],t=d[d.length-1],i="top"===me(n),o=e.top,r=t.bottom,s=i?e.left:t.left,l=i?e.right:t.right;return{top:o,bottom:r,left:s,right:l,width:l-s,height:r-o,x:s,y:o}}const e="left"===me(n),t=ce(...d.map((e=>e.right))),i=ae(...d.map((e=>e.left))),o=d.filter((n=>e?n.left===i:n.right===t)),r=o[0].top,s=o[o.length-1].bottom;return{top:r,bottom:s,left:i,right:t,width:t-i,height:s-r,x:i,y:r}}return h}},floating:i.floating,strategy:s});return o.reference.x!==f.reference.x||o.reference.y!==f.reference.y||o.reference.width!==f.reference.width||o.reference.height!==f.reference.height?{reset:{rects:f}}:{}}}},Ze=(e,t,n)=>{const i=new Map,o={platform:Ue,...n},r={...o.platform,_c:i};return(async(e,t,n)=>{const{placement:i="bottom",strategy:o="absolute",middleware:r=[],platform:s}=n,l=r.filter(Boolean),a=await(null==s.isRTL?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Ee(c,i,a),h=i,p={},f=0;for(let n=0;n<l.length;n++){const{name:r,fn:g}=l[n],{x:m,y:v,data:w,reset:b}=await g({x:u,y:d,initialPlacement:i,placement:h,strategy:o,middlewareData:p,rects:c,platform:s,elements:{reference:e,floating:t}});u=null!=m?m:u,d=null!=v?v:d,p={...p,[r]:{...p[r],...w}},b&&f<=50&&(f++,"object"==typeof b&&(b.placement&&(h=b.placement),b.rects&&(c=!0===b.rects?await s.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:d}=Ee(c,h,a))),n=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:p}})(e,t,{...o,platform:r})};var Ge="undefined"!=typeof document?h:u;function qe(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,i,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(i=n;0!=i--;)if(!qe(e[i],t[i]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(i=n;0!=i--;)if(!{}.hasOwnProperty.call(t,o[i]))return!1;for(i=n;0!=i--;){const n=o[i];if(("_owner"!==n||!e.$$typeof)&&!qe(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Je(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ke(e,t){const n=Je(e);return Math.round(t*n)/n}function Qe(e){const t=a.useRef(e);return Ge((()=>{t.current=e})),t}
2
+ /*!
3
+ * tabbable 6.2.0
4
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
5
+ */
6
+ var et=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),tt="undefined"==typeof Element,nt=tt?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,it=!tt&&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},ot=function e(t,n){var i;void 0===n&&(n=!0);var o=null==t||null===(i=t.getAttribute)||void 0===i?void 0:i.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},rt=function e(t,n,i){for(var o=[],r=Array.from(t);r.length;){var s=r.shift();if(!ot(s,!1))if("SLOT"===s.tagName){var l=s.assignedElements(),a=e(l.length?l:s.children,!0,i);i.flatten?o.push.apply(o,a):o.push({scopeParent:s,candidates:a})}else{nt.call(s,et)&&i.filter(s)&&(n||!t.includes(s))&&o.push(s);var c=s.shadowRoot||"function"==typeof i.getShadowRoot&&i.getShadowRoot(s),u=!ot(c,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(s));if(c&&u){var d=e(!0===c?s.children:c.children,!0,i);i.flatten?o.push.apply(o,d):o.push({scopeParent:s,candidates:d})}else r.unshift.apply(r,s.children)}}return o},st=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},lt=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))&&!st(e)?0:e.tabIndex},at=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},ct=function(e){return"INPUT"===e.tagName},ut=function(e){return function(e){return ct(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||it(e),i=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=i(window.CSS.escape(e.name));else try{t=i(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 o=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!o||o===e}(e)},dt=function(e){var t=e.getBoundingClientRect(),n=t.width,i=t.height;return 0===n&&0===i},ht=function(e,t){var n=t.displayCheck,i=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=nt.call(e,"details>summary:first-of-type")?e.parentElement:e;if(nt.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return dt(e)}else{if("function"==typeof i){for(var r=e;e;){var s=e.parentElement,l=it(e);if(s&&!s.shadowRoot&&!0===i(s))return dt(e);e=e.assignedSlot?e.assignedSlot:s||l===e.ownerDocument?s:l.host}e=r}if(function(e){var t,n,i,o,r=e&&it(e),s=null===(t=r)||void 0===t?void 0:t.host,l=!1;if(r&&r!==e)for(l=!!(null!==(n=s)&&void 0!==n&&null!==(i=n.ownerDocument)&&void 0!==i&&i.contains(s)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!l&&s;){var a,c,u;l=!(null===(c=s=null===(a=r=it(s))||void 0===a?void 0:a.host)||void 0===c||null===(u=c.ownerDocument)||void 0===u||!u.contains(s))}return l}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},pt=function(e,t){return!(t.disabled||ot(t)||function(e){return ct(e)&&"hidden"===e.type}(t)||ht(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 i=t.children.item(n);if("LEGEND"===i.tagName)return!!nt.call(t,"fieldset[disabled] *")||!i.contains(e)}return!0}t=t.parentElement}return!1}(t))},ft=function(e,t){return!(ut(t)||lt(t)<0||!pt(e,t))},gt=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},mt=function e(t){var n=[],i=[];return t.forEach((function(t,o){var r=!!t.scopeParent,s=r?t.scopeParent:t,l=function(e,t){var n=lt(e);return n<0&&t&&!st(e)?0:n}(s,r),a=r?e(t.candidates):s;0===l?r?n.push.apply(n,a):n.push(s):i.push({documentOrder:o,tabIndex:l,item:t,isScope:r,content:a})})),i.sort(at).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},vt=function(e,t){var n;return n=(t=t||{}).getShadowRoot?rt([e],t.includeContainer,{filter:ft.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:gt}):function(e,t,n){if(ot(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(et));return t&&nt.call(e,et)&&i.unshift(e),i.filter(n)}(e,t.includeContainer,ft.bind(null,t)),mt(n)};const wt=a["useInsertionEffect".toString()]||(e=>e());var bt="undefined"!=typeof document?h:u;function yt(){return yt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},yt.apply(this,arguments)}let xt=!1,Ct=0;const St=()=>"floating-ui-"+Ct++;const Rt=a["useId".toString()]||function(){const[e,t]=a.useState((()=>xt?St():void 0));return bt((()=>{null==e&&t(St())}),[]),a.useEffect((()=>{xt||(xt=!0)}),[]),e};const zt=a.createContext(null),Et=a.createContext(null);function Ot(e){return"data-floating-ui-"+e}const Lt=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Nt(e,t){const n=vt(e,Lt());"prev"===t&&n.reverse();const i=n.indexOf(function(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}((null==(o=e)?void 0:o.ownerDocument)||document));var o;return n.slice(i+1)[0]}function kt(e,t){const n=t||e.currentTarget,i=e.relatedTarget;return!i||!function(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&J(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,i)}function _t(e){vt(e,Lt()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function jt(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 Mt={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 Wt(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Tt=a.forwardRef((function(e,t){const[n,i]=a.useState();bt((()=>(/apple/i.test(navigator.vendor)&&i("button"),document.addEventListener("keydown",Wt),()=>{document.removeEventListener("keydown",Wt)})),[]);const o={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[Ot("focus-guard")]:"",style:Mt};return a.createElement("span",yt({},e,o))})),At=a.createContext(null),Bt=Ot("portal");function Pt(e){let{children:t,id:n,root:i=null,preserveTabOrder:o=!0}=e;const r=function(e){let{id:t,root:n}=void 0===e?{}:e;const[i,o]=a.useState(null),r=Rt(),s=It(),l=a.useRef(null);return bt((()=>()=>{null==i||i.remove(),queueMicrotask((()=>{l.current=null}))}),[i]),bt((()=>{if(l.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=r,n.setAttribute(Bt,""),e.appendChild(n),l.current=n,o(n)}),[t,r]),bt((()=>{if(l.current)return;let e=n||(null==s?void 0:s.portalNode);e&&!G(e)&&(e=e.current),e=e||document.body;let i=null;t&&(i=document.createElement("div"),i.id=t,e.appendChild(i));const a=document.createElement("div");a.id=r,a.setAttribute(Bt,""),e=i||e,e.appendChild(a),l.current=a,o(a)}),[t,n,r,s]),i}({id:n,root:i}),[s,l]=a.useState(null),c=a.useRef(null),u=a.useRef(null),d=a.useRef(null),h=a.useRef(null),p=!!s&&!s.modal&&s.open&&o&&!(!i&&!r);return a.useEffect((()=>{if(r&&o&&(null==s||!s.modal))return r.addEventListener("focusin",e,!0),r.addEventListener("focusout",e,!0),()=>{r.removeEventListener("focusin",e,!0),r.removeEventListener("focusout",e,!0)};function e(e){if(r&&kt(e)){("focusin"===e.type?jt:_t)(r)}}}),[r,o,null==s?void 0:s.modal]),a.createElement(At.Provider,{value:a.useMemo((()=>({preserveTabOrder:o,beforeOutsideRef:c,afterOutsideRef:u,beforeInsideRef:d,afterInsideRef:h,portalNode:r,setFocusManagerState:l})),[o,r])},p&&r&&a.createElement(Tt,{"data-type":"outside",ref:c,onFocus:e=>{if(kt(e,r)){var t;null==(t=d.current)||t.focus()}else{const e=Nt(document.body,"prev")||(null==s?void 0:s.refs.domReference.current);null==e||e.focus()}}}),p&&r&&a.createElement("span",{"aria-owns":r.id,style:Mt}),r&&w(t,r),p&&r&&a.createElement(Tt,{"data-type":"outside",ref:u,onFocus:e=>{if(kt(e,r)){var t;null==(t=h.current)||t.focus()}else{const t=Nt(document.body,"next")||(null==s?void 0:s.refs.domReference.current);null==t||t.focus(),(null==s?void 0:s.closeOnFocusOut)&&(null==s||s.onOpenChange(!1,e.nativeEvent))}}}))}const It=()=>a.useContext(At),Ht=new Set,Dt=a.forwardRef((function(e,t){let{lockScroll:n=!1,...i}=e;const o=Rt();return bt((()=>{if(!n)return;Ht.add(o);const e=/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()),t=document.body.style,i=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",r=window.innerWidth-document.documentElement.clientWidth,s=t.left?parseFloat(t.left):window.pageXOffset,l=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",r&&(t[i]=r+"px"),e){var a,c;const e=(null==(a=window.visualViewport)?void 0:a.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(l-Math.floor(n))+"px",left:-(s-Math.floor(e))+"px",right:"0"})}return()=>{Ht.delete(o),0===Ht.size&&(Object.assign(t,{overflow:"",[i]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(s,l)))}}),[o,n]),a.createElement("div",yt({ref:t},i,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...i.style}}))}));function Ft(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:i,nodeId:o}=e,[r,s]=a.useState(null),l=(null==(t=e.elements)?void 0:t.reference)||r,c=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:i=[],platform:o,elements:{reference:r,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,h]=a.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=a.useState(i);qe(p,i)||f(i);const[g,v]=a.useState(null),[w,b]=a.useState(null),y=a.useCallback((e=>{e!==R.current&&(R.current=e,v(e))}),[]),x=a.useCallback((e=>{e!==z.current&&(z.current=e,b(e))}),[]),C=r||g,S=s||w,R=a.useRef(null),z=a.useRef(null),E=a.useRef(d),O=null!=c,L=Qe(c),N=Qe(o),k=a.useCallback((()=>{if(!R.current||!z.current)return;const e={placement:t,strategy:n,middleware:p};N.current&&(e.platform=N.current),Ze(R.current,z.current,e).then((e=>{const t={...e,isPositioned:!0};_.current&&!qe(E.current,t)&&(E.current=t,m.flushSync((()=>{h(t)})))}))}),[p,t,n,N]);Ge((()=>{!1===u&&E.current.isPositioned&&(E.current.isPositioned=!1,h((e=>({...e,isPositioned:!1}))))}),[u]);const _=a.useRef(!1);Ge((()=>(_.current=!0,()=>{_.current=!1})),[]),Ge((()=>{if(C&&(R.current=C),S&&(z.current=S),C&&S){if(L.current)return L.current(C,S,k);k()}}),[C,S,k,L,O]);const j=a.useMemo((()=>({reference:R,floating:z,setReference:y,setFloating:x})),[y,x]),M=a.useMemo((()=>({reference:C,floating:S})),[C,S]),W=a.useMemo((()=>{const e={position:n,left:0,top:0};if(!M.floating)return e;const t=Ke(M.floating,d.x),i=Ke(M.floating,d.y);return l?{...e,transform:"translate("+t+"px, "+i+"px)",...Je(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:i}}),[n,l,M.floating,d.x,d.y]);return a.useMemo((()=>({...d,update:k,refs:j,elements:M,floatingStyles:W})),[d,k,j,M,W])}(e),u=a.useContext(Et),d=null!=((null==(h=a.useContext(zt))?void 0:h.id)||null);var h;const p=function(e){const t=a.useRef((()=>{}));return wt((()=>{t.current=e})),a.useCallback((function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return null==t.current?void 0:t.current(...n)}),[])}(((e,t,n)=>{e&&(g.current.openEvent=t),v.emit("openchange",{open:e,event:t,reason:n,nested:d}),null==i||i(e,t,n)})),f=a.useRef(null),g=a.useRef({}),v=a.useState((()=>function(){const e=new Map;return{emit(t,n){var i;null==(i=e.get(t))||i.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var i;e.set(t,(null==(i=e.get(t))?void 0:i.filter((e=>e!==n)))||[])}}}()))[0],w=Rt(),b=a.useCallback((e=>{const t=G(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;c.refs.setReference(t)}),[c.refs]),y=a.useCallback((e=>{(G(e)||null===e)&&(f.current=e,s(e)),(G(c.refs.reference.current)||null===c.refs.reference.current||null!==e&&!G(e))&&c.refs.setReference(e)}),[c.refs]),x=a.useMemo((()=>({...c.refs,setReference:y,setPositionReference:b,domReference:f})),[c.refs,y,b]),C=a.useMemo((()=>({...c.elements,domReference:l})),[c.elements,l]),S=a.useMemo((()=>({...c,refs:x,elements:C,dataRef:g,nodeId:o,floatingId:w,events:v,open:n,onOpenChange:p})),[c,o,w,v,n,p,x,C]);return bt((()=>{const e=null==u?void 0:u.nodesRef.current.find((e=>e.id===o));e&&(e.context=S)})),a.useMemo((()=>({...c,context:S,refs:x,elements:C})),[c,x,C,S])}function Vt(e,t){if(null==e)return{};var n,i,o={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var Ut=["color"],$t=p((function(e,t){var n=e.color,i=void 0===n?"currentColor":n,o=Vt(e,Ut);return f("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),f("path",{d:"M7.50005 1.04999C7.74858 1.04999 7.95005 1.25146 7.95005 1.49999V8.41359L10.1819 6.18179C10.3576 6.00605 10.6425 6.00605 10.8182 6.18179C10.994 6.35753 10.994 6.64245 10.8182 6.81819L7.81825 9.81819C7.64251 9.99392 7.35759 9.99392 7.18185 9.81819L4.18185 6.81819C4.00611 6.64245 4.00611 6.35753 4.18185 6.18179C4.35759 6.00605 4.64251 6.00605 4.81825 6.18179L7.05005 8.41359V1.49999C7.05005 1.25146 7.25152 1.04999 7.50005 1.04999ZM2.5 10C2.77614 10 3 10.2239 3 10.5V12C3 12.5539 3.44565 13 3.99635 13H11.0012C11.5529 13 12 12.5528 12 12V10.5C12 10.2239 12.2239 10 12.5 10C12.7761 10 13 10.2239 13 10.5V12C13 13.1041 12.1062 14 11.0012 14H3.99635C2.89019 14 2 13.103 2 12V10.5C2 10.2239 2.22386 10 2.5 10Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))})),Xt=["color"],Yt=p((function(e,t){var n=e.color,i=void 0===n?"currentColor":n,o=Vt(e,Xt);return f("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),f("path",{d:"M7.81832 0.68179C7.64258 0.506054 7.35766 0.506054 7.18192 0.68179L5.18192 2.68179C5.00619 2.85753 5.00619 3.14245 5.18192 3.31819C5.35766 3.49392 5.64258 3.49392 5.81832 3.31819L7.05012 2.08638L7.05012 5.50023C7.05012 5.74876 7.25159 5.95023 7.50012 5.95023C7.74865 5.95023 7.95012 5.74876 7.95012 5.50023L7.95012 2.08638L9.18192 3.31819C9.35766 3.49392 9.64258 3.49392 9.81832 3.31819C9.99406 3.14245 9.99406 2.85753 9.81832 2.68179L7.81832 0.68179ZM7.95012 12.9136V9.50023C7.95012 9.2517 7.74865 9.05023 7.50012 9.05023C7.25159 9.05023 7.05012 9.2517 7.05012 9.50023V12.9136L5.81832 11.6818C5.64258 11.5061 5.35766 11.5061 5.18192 11.6818C5.00619 11.8575 5.00619 12.1424 5.18192 12.3182L7.18192 14.3182C7.26632 14.4026 7.38077 14.45 7.50012 14.45C7.61947 14.45 7.73393 14.4026 7.81832 14.3182L9.81832 12.3182C9.99406 12.1424 9.99406 11.8575 9.81832 11.6818C9.64258 11.5061 9.35766 11.5061 9.18192 11.6818L7.95012 12.9136ZM1.49994 7.00017C1.2238 7.00017 0.999939 7.22403 0.999939 7.50017C0.999939 7.77631 1.2238 8.00017 1.49994 8.00017L13.4999 8.00017C13.7761 8.00017 13.9999 7.77631 13.9999 7.50017C13.9999 7.22403 13.7761 7.00017 13.4999 7.00017L1.49994 7.00017Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))})),Zt=["color"],Gt=p((function(e,t){var n=e.color,i=void 0===n?"currentColor":n,o=Vt(e,Zt);return f("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),f("path",{d:"M11.5 3.04999C11.7485 3.04999 11.95 3.25146 11.95 3.49999V7.49999C11.95 7.74852 11.7485 7.94999 11.5 7.94999C11.2515 7.94999 11.05 7.74852 11.05 7.49999V4.58639L4.58638 11.05H7.49999C7.74852 11.05 7.94999 11.2515 7.94999 11.5C7.94999 11.7485 7.74852 11.95 7.49999 11.95L3.49999 11.95C3.38064 11.95 3.26618 11.9026 3.18179 11.8182C3.0974 11.7338 3.04999 11.6193 3.04999 11.5L3.04999 7.49999C3.04999 7.25146 3.25146 7.04999 3.49999 7.04999C3.74852 7.04999 3.94999 7.25146 3.94999 7.49999L3.94999 10.4136L10.4136 3.94999L7.49999 3.94999C7.25146 3.94999 7.04999 3.74852 7.04999 3.49999C7.04999 3.25146 7.25146 3.04999 7.49999 3.04999L11.5 3.04999Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))})),qt=["color"],Jt=p((function(e,t){var n=e.color,i=void 0===n?"currentColor":n,o=Vt(e,qt);return f("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),f("path",{d:"M4.76447 3.12199C5.63151 3.04859 6.56082 3 7.5 3C8.43918 3 9.36849 3.04859 10.2355 3.12199C11.2796 3.21037 11.9553 3.27008 12.472 3.39203C12.9425 3.50304 13.2048 3.64976 13.4306 3.88086C13.4553 3.90618 13.4902 3.94414 13.5133 3.97092C13.7126 4.20149 13.8435 4.4887 13.918 5.03283C13.9978 5.6156 14 6.37644 14 7.52493C14 8.66026 13.9978 9.41019 13.9181 9.98538C13.8439 10.5206 13.7137 10.8061 13.5125 11.0387C13.4896 11.0651 13.4541 11.1038 13.4296 11.1287C13.2009 11.3625 12.9406 11.5076 12.4818 11.6164C11.9752 11.7365 11.3143 11.7942 10.2878 11.8797C9.41948 11.9521 8.47566 12 7.5 12C6.52434 12 5.58052 11.9521 4.7122 11.8797C3.68572 11.7942 3.02477 11.7365 2.51816 11.6164C2.05936 11.5076 1.7991 11.3625 1.57037 11.1287C1.54593 11.1038 1.51035 11.0651 1.48748 11.0387C1.28628 10.8061 1.15612 10.5206 1.08193 9.98538C1.00221 9.41019 1 8.66026 1 7.52493C1 6.37644 1.00216 5.6156 1.082 5.03283C1.15654 4.4887 1.28744 4.20149 1.48666 3.97092C1.5098 3.94414 1.54468 3.90618 1.56942 3.88086C1.7952 3.64976 2.05752 3.50304 2.52796 3.39203C3.04473 3.27008 3.7204 3.21037 4.76447 3.12199ZM0 7.52493C0 5.28296 0 4.16198 0.729985 3.31713C0.766457 3.27491 0.815139 3.22194 0.854123 3.18204C1.63439 2.38339 2.64963 2.29744 4.68012 2.12555C5.56923 2.05028 6.52724 2 7.5 2C8.47276 2 9.43077 2.05028 10.3199 2.12555C12.3504 2.29744 13.3656 2.38339 14.1459 3.18204C14.1849 3.22194 14.2335 3.27491 14.27 3.31713C15 4.16198 15 5.28296 15 7.52493C15 9.74012 15 10.8477 14.2688 11.6929C14.2326 11.7348 14.1832 11.7885 14.1444 11.8281C13.3629 12.6269 12.3655 12.71 10.3709 12.8763C9.47971 12.9505 8.50782 13 7.5 13C6.49218 13 5.52028 12.9505 4.62915 12.8763C2.63446 12.71 1.63712 12.6269 0.855558 11.8281C0.816844 11.7885 0.767442 11.7348 0.731221 11.6929C0 10.8477 0 9.74012 0 7.52493ZM5.25 5.38264C5.25 5.20225 5.43522 5.08124 5.60041 5.15369L10.428 7.27105C10.6274 7.35853 10.6274 7.64147 10.428 7.72895L5.60041 9.84631C5.43522 9.91876 5.25 9.79775 5.25 9.61736V5.38264Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))})),Kt=["color"],Qt=p((function(e,t){var n=e.color,i=void 0===n?"currentColor":n,o=Vt(e,Kt);return f("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),f("path",{d:"M4.81812 4.68161C4.99386 4.85734 4.99386 5.14227 4.81812 5.318L3.08632 7.0498H11.9135L10.1817 5.318C10.006 5.14227 10.006 4.85734 10.1817 4.68161C10.3575 4.50587 10.6424 4.50587 10.8181 4.68161L13.3181 7.18161C13.4939 7.35734 13.4939 7.64227 13.3181 7.818L10.8181 10.318C10.6424 10.4937 10.3575 10.4937 10.1817 10.318C10.006 10.1423 10.006 9.85734 10.1817 9.68161L11.9135 7.9498H3.08632L4.81812 9.68161C4.99386 9.85734 4.99386 10.1423 4.81812 10.318C4.64239 10.4937 4.35746 10.4937 4.18173 10.318L1.68173 7.818C1.50599 7.64227 1.50599 7.35734 1.68173 7.18161L4.18173 4.68161C4.35746 4.50587 4.64239 4.50587 4.81812 4.68161Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}));const en={youtube:e=>{const t=e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return t&&11===t[2].length?t[2]:null},vimeo:e=>new URL(e).pathname.split("/")[1],dailymotion:e=>{const t=e.match(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);return null!==t?void 0!==t[4]?t[4]:t[2]:null}},tn=({blockId:t,onClose:n})=>{const i=e(),[o,r]=c(""),a=0===o.length;return s("div",Object.assign({className:"cursor-pointer user-select-none transition-bg duration-20 ease-in white-space-nowrap w-full"},{children:[l("input",{type:"text",placeholder:"Paste video link",value:o,className:"items-center bg-[hsla(45,13%,94%,.6)] rounded-[4px] shadow-[inset_0_0_0_1px_hsla(0,0%,6%,.1)] cursor-text flex text-[14px] h-[32px] leading-[20px] px-[6px] relative w-full border-none",onChange:e=>r(e.target.value)}),l("button",Object.assign({type:"button",className:"user-select-none transition-bg duration-20 ease-in cursor-pointer flex items-center justify-center flex-shrink-0 white-space-nowrap h-[28px] rounded-[4px] shadow-[rgba(15,15,15,0.1)_0px_0px_0px_1px_inset,_rgba(15,15,15,0.1)_0px_1px_2px] bg-[rgb(35,131,226)] text-white fill-white leading-[1.2] px-[12px] text-[14px] font-medium w-full max-w-[300px] mx-auto m-[12px_0_6px] disabled:bg-[rgba(35,131,226,0.5)] disabled:cursor-not-allowed",disabled:a,onClick:()=>{var e;if(0===o.length)return;const r=(s=o).includes("youtube.com")||s.includes("youtu.be")?"youtube":s.includes("vimeo.com")?"vimeo":s.includes("dailymotion.com")||s.includes("dai.ly")?"dailymotion":null;var s;const l=r?null===(e=en[r])||void 0===e?void 0:e.call(en,o):null;if(console.log({type:r,id:l}),!r||!l)return console.warn("Unsopperted video provider or video id is not found.");i.blocks.Video.updateElement(t,"video",{src:o,provider:{type:r,id:l}}),n()}},{children:"Embed video"}))]}))},nn=({accept:n="video/*",onClose:i,blockId:o,onSetLoading:r})=>{const a=t("Video"),c=e();u((()=>{}),[]);return l("div",Object.assign({className:"user-select-none transition-bg duration-20 ease-in white-space-nowrap rounded-[4px] h-[32px] px-[12px] border border-[rgba(55,53,47,0.16)] w-full cursor-pointer"},{children:s("label",Object.assign({htmlFor:"video-uploader",className:"text-[14px] leading-[1.2] font-medium cursor-pointer w-full flex items-center justify-center h-full"},{children:[l("input",{type:"file",id:"video-uploader",className:"absolute left-0 top-0 invisible",accept:(null==a?void 0:a.accept)||n,onChange:e=>{const t=e.target.files[0];t&&(e=>{y(void 0,void 0,void 0,(function*(){if(!(null==a?void 0:a.onUpload))throw new Error("onUpload not provided in plugin options. Check Video.extend({}) method");i(),r(!0);try{const t=yield null==a?void 0:a.onUpload(e);c.blocks.Video.updateElement(o,"video",{src:t.src,sizes:t.sizes,bgColor:t.bgColor})}catch(e){}finally{r(!1)}}))})(t)},multiple:!1}),"Upload video"]}))}))},on=({floatingStyles:e,refs:t,onClose:n,blockId:i,onSetLoading:o})=>{const[r,a]=c("upload"),u=e=>a(e),d="upload"===r,h="embed"===r,p=e=>({borderBottom:e?"2px solid #2483e2":"2px solid transparent"});return l(Pt,Object.assign({root:document.getElementById("yoopta-editor")},{children:l(Dt,Object.assign({lockScroll:!0,className:"z-[100]",onClick:n},{children:l("div",Object.assign({ref:t.setFloating,style:e,onClick:e=>e.stopPropagation()},{children:s("div",Object.assign({className:"flex flex-col min-w-[540px] max-w-[calc(100vw-24px)] h-full max-h-[420px] bg-white shadow-[rgb(15_15_15_/5%)_0px_0px_0px_1px,_rgb(15_15_15_/10%)_0px_3px_6px,_rgb(15_15_15_/20%)_0px_9px_24px]"},{children:[s("div",Object.assign({className:"w-full flex text-[14px] p-[0_8px] shadow-[rgb(55_53_47_/9%)_0px_-1px_0px_inset] relative z-10 h-[40px]"},{children:[l("button",Object.assign({type:"button",onClick:()=>u("upload"),style:p(d),className:"py-[6px] whitespace-nowrap min-w-0 flex-shrink-0 text-[rgb(55,53,47)] relative cursor-pointer user-select-none bg-inherit transition-[height_20ms_ease-in] inline-flex items-center h-full text-[14px] leading-[1.2] px-[8px]"},{children:"Upload"})),l("button",Object.assign({type:"button",onClick:()=>u("embed"),style:p(h),className:"py-[6px] whitespace-nowrap min-w-0 flex-shrink-0 text-[rgb(55,53,47)] relative cursor-pointer user-select-none bg-inherit transition-[height_20ms_ease-in] inline-flex items-center h-full text-[14px] leading-[1.2] px-[8px]"},{children:"Video link"}))]})),s("div",Object.assign({className:"pt-[6px] pb-[6px] mt-[4px] flex justify-center mr-[12px] ml-[12px]"},{children:[h&&l(tn,{onClose:n,blockId:i}),d&&l(nn,{onClose:n,blockId:i,onSetLoading:o})]}))]}))}))}))}))},rn=({className:e,width:t,height:n,children:i})=>s("div",Object.assign({className:e},{children:[i,l("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-2 h-4 w-4 animate-spin"},{children:l("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}))]})),sn=({attributes:e,children:t,blockId:n})=>{const[i,o]=c(!1),[r,a]=c(!1),{refs:u,floatingStyles:d}=Ft({placement:"bottom",open:i,onOpenChange:o,middleware:[Ye(),Xe(),$e(),Ne(10)]});return s("div",Object.assign({className:"w-full user-select-none m-[20px_0_10px] relative flex"},e,{contentEditable:!1},{children:[s("button",Object.assign({className:"p-[12px_36px_12px_12px] flex items-center text-left w-full overflow-hidden rounded-[3px] text-[14px] text-[rgba(55,53,47,0.65)] relative cursor-pointer border-none bg-[#efefef] transition-[background-color_100ms_ease-in] hover:bg-[#e3e3e3]",onClick:()=>o(!0),disabled:r,ref:u.setReference},{children:[l(r?rn:Jt,{className:"mr-2 user-select-none",width:24,height:24}),l("span",Object.assign({className:"font-medium"},{children:r?"Loading...":"Click to add video"})),r&&l("div",{className:"absolute top-0 left-0 h-full bg-[rgba(55,53,47,0.16)]",style:{width:"100%",transition:"width 100ms ease-in"}})]})),i&&l(on,{blockId:n,floatingStyles:d,refs:u,onClose:()=>o(!1),onSetLoading:e=>a(e)}),t]}))},{ExtendedBlockActions:ln,BlockOptionsMenuGroup:an,BlockOptionsMenuItem:cn,BlockOptionsSeparator:un}=n,dn=({editor:e,block:t,props:n})=>s(ln,Object.assign({onClick:()=>e.setSelection([t.meta.order])},{children:[l(un,{}),s(an,{children:[l(cn,{children:s("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{e.blocks.Image.updateElement(t.id,"video",{fit:"contain"})}},{children:[l(Yt,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Fit"]}))}),l(cn,{children:s("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{e.blocks.Image.updateElement(t.id,"video",{fit:"fill"})}},{children:[l(Qt,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Fill"]}))}),l(cn,{children:s("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{e.blocks.Image.updateElement(t.id,"video",{fit:"cover"})}},{children:[l(Gt,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Cover"]}))})]}),l(un,{}),l(an,{children:l(cn,{children:s("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{if(!n||!n.src)return;const e=document.createElement("a");e.href=n.src,e.download=n.src,e.target="_blank",e.rel="noopener noreferrer",document.body.appendChild(e),e.click(),document.body.removeChild(e)}},{children:[l($t,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Download"]}))})})]})),hn=({position:e})=>l("div",Object.assign({contentEditable:!1,className:"absolute pointer-events-none flex items-center justify-center z-10 opacity-1 h-full w-[15px] cursor-col-resize transition-opacity duration-150 ease-in "+("left"===e?"left-0 top-0":"right-0 top-0")},{children:l("div",{className:"opacity-100 transition-opacity duration-300 ease-in rounded-[20px] bg-[rgba(15,15,15,0.6)] border border-[rgba(255,255,255,0.9)] w-[6px] h-[48px] max-h-[50%] shadow-[0_0_0_.5px_#FFF]"})})),pn=new r({type:"Video",elements:{video:{render:({element:n,attributes:r,children:a,blockId:d})=>{const{src:h,srcSet:p,bgColor:f,settings:m,sizes:v,poster:w,provider:b,fit:y}=n.props||{},x=i(d),C=e(),R=t("Video"),[z,E]=c({width:(null==v?void 0:v.width)||750,height:(null==v?void 0:v.height)||440});u((()=>E({width:(null==v?void 0:v.width)||650,height:(null==v?void 0:v.height)||440})),[n.props]);const O=o({blockId:d});const L=g((()=>{var e,t;return{minWidth:300,size:{width:z.width,height:z.height},maxWidth:(null===(e=null==R?void 0:R.maxSizes)||void 0===e?void 0:e.maxWidth)||800,maxHeight:(null===(t=null==R?void 0:R.maxSizes)||void 0===t?void 0:t.maxHeight)||720,lockAspectRatio:!0,resizeRatio:2,enable:{left:!0,right:!0},handleStyles:{left:{left:0},right:{right:0}},onResize:(e,t,n)=>{E({width:n.offsetWidth,height:n.offsetHeight})},onResizeStop:(e,t,n)=>{C.blocks.Video.updateElement(d,"video",{sizes:{width:n.offsetWidth,height:n.offsetHeight}})},handleComponent:{left:l(hn,{position:"left"}),right:l(hn,{position:"right"})}}}),[z.width,z.height]);return h?l("div",Object.assign({contentEditable:!1,draggable:!1,className:"mt-4 relative"},r,{children:s(U,Object.assign({},L,{className:"mx-auto my-0 flex"},{children:[O&&l("div",{className:"absolute pointer-events-none inset-0 bg-[rgba(35,131,226,0.14)] z-[81] rounded-[3px] opacity-100 transition-opacity duration-150 ease-in"}),l(S,{src:h,srcSet:p,width:null==z?void 0:z.width,settings:m,bgColor:f,height:null==z?void 0:z.height,poster:w,provider:b,fit:y}),l(dn,{block:x,editor:C,settings:m,props:n.props}),a]}))})):l(sn,Object.assign({attributes:r,blockId:d},{children:a}))},props:{src:null,srcSet:null,bgColor:null,sizes:{width:650,height:400},nodeType:"void",settings:{controls:!1,loop:!0,muted:!0,autoPlay:!0}}}},options:{displayLabel:"Video",accept:"video/*",maxSizes:{maxWidth:650,maxHeight:550}}});!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".yoo-video-absolute{position:absolute}.yoo-video-relative{position:relative}.yoo-video-left-0{left:0}.yoo-video-top-0{top:0}.yoo-video-h-full{height:100%}.yoo-video-w-full{width:100%}");export{pn as default};
@@ -0,0 +1,3 @@
1
+ declare const Video: any;
2
+ export { Video };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.tsx"],"names":[],"mappings":"AAIA,QAAA,MAAM,KAAK,KA6BT,CAAC;AAEH,OAAO,EAAE,KAAK,EAAE,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,27 +1,43 @@
1
- import { Modify, YooptaBaseElement, YooptaPluginBaseOptions } from '@yoopta/editor';
2
- export type VideoUploadResponse = {
3
- url: string;
1
+ import { type SlateElement } from '@yoopta/editor';
2
+ export type VideoSizes = {
4
3
  width: number;
5
4
  height: number;
6
- srcSet?: string[];
5
+ };
6
+ export type VideoElementSettings = {
7
+ controls?: boolean;
8
+ loop?: boolean;
9
+ muted?: boolean;
10
+ autoPlay?: boolean;
11
+ };
12
+ export type VideoProviderTypes = 'youtube' | 'vimeo' | 'dailymotion' | null;
13
+ export type VideoProvider = {
14
+ type: VideoProviderTypes;
15
+ id: string;
16
+ };
17
+ export type VideoElementProps = {
18
+ src?: string | null;
19
+ srcSet?: string | null;
20
+ bgColor?: string | null;
21
+ settings?: VideoElementSettings;
22
+ sizes?: VideoSizes;
23
+ provider?: VideoProvider;
24
+ fit?: 'contain' | 'cover' | 'fill' | null;
25
+ poster?: string;
26
+ };
27
+ export type VideoPluginElements = 'video';
28
+ export type VideoElement = SlateElement<'video', VideoElementProps>;
29
+ export type onUploadResponse = Omit<VideoElementProps, 'fit' | 'srcSet'>;
30
+ export type VideoOptimizationFields = {
31
+ deviceSizes?: number[];
32
+ provider?: 'imgix' | 'cloudinary' | 'akamai';
7
33
  };
8
34
  export type VideoPluginOptions = {
9
- maxWidth?: number;
10
- maxHeight?: number;
11
- onUpload: (file: File) => Promise<VideoUploadResponse>;
12
- } & YooptaPluginBaseOptions;
13
- export type VideoElementData = {
14
- size: {
15
- width: number | 'auto';
16
- height: number | 'auto';
35
+ onUpload: (file: File) => Promise<onUploadResponse>;
36
+ accept?: string;
37
+ optimizations?: VideoOptimizationFields;
38
+ maxSizes?: {
39
+ maxWidth?: number;
40
+ maxHeight?: number;
17
41
  };
18
- caption?: string;
19
- url: string | null | undefined;
20
- 'data-src'?: string | null | undefined;
21
- provider?: VideoProviders | null;
22
- videoId?: string | null;
23
42
  };
24
- export type VideoElement = Modify<YooptaBaseElement<'video'>, {
25
- data: VideoElementData;
26
- }>;
27
- export type VideoProviders = 'youtube' | 'vimeo' | 'dailymotion';
43
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,GAAG,IAAI,CAAC;AAC5E,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,kBAAkB,CAAC;IACzB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,GAAG,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAC1C,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,EAAE,KAAK,GAAG,QAAQ,CAAC,CAAC;AAEzE,MAAM,MAAM,uBAAuB,GAAG;IACpC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,GAAG,YAAY,GAAG,QAAQ,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC"}
@@ -4,3 +4,4 @@ declare function DailyMotion({ videoId, ...other }: {
4
4
  videoId: any;
5
5
  }): JSX.Element;
6
6
  export default DailyMotion;
7
+ //# sourceMappingURL=DailyMotionPlayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DailyMotionPlayer.d.ts","sourceRoot":"","sources":["../../src/ui/DailyMotionPlayer.tsx"],"names":[],"mappings":";AAKA,iBAAS,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE;;;CAAA,eA2CzC;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ declare const EmbedUploader: ({ blockId, onClose }: {
3
+ blockId: any;
4
+ onClose: any;
5
+ }) => JSX.Element;
6
+ export { EmbedUploader };
7
+ //# sourceMappingURL=EmbedUploader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmbedUploader.d.ts","sourceRoot":"","sources":["../../src/ui/EmbedUploader.tsx"],"names":[],"mappings":";AAKA,QAAA,MAAM,aAAa;;;iBA6ClB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ type Props = {
3
+ onClose: () => void;
4
+ blockId: string;
5
+ accept?: string;
6
+ onSetLoading: (_s: boolean) => void;
7
+ };
8
+ declare const FileUploader: ({ accept, onClose, blockId, onSetLoading }: Props) => JSX.Element;
9
+ export { FileUploader };
10
+ //# sourceMappingURL=FileUploader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileUploader.d.ts","sourceRoot":"","sources":["../../src/ui/FileUploader.tsx"],"names":[],"mappings":";AAIA,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF,QAAA,MAAM,YAAY,+CAA4D,KAAK,gBAmDlF,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ type Props = {
3
+ className?: string;
4
+ children?: ReactNode;
5
+ width?: number;
6
+ height?: number;
7
+ };
8
+ declare const Loader: ({ className, width, height, children }: Props) => JSX.Element;
9
+ export { Loader };
10
+ //# sourceMappingURL=Loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Loader.d.ts","sourceRoot":"","sources":["../../src/ui/Loader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,QAAA,MAAM,MAAM,2CAA4C,KAAK,gBAoB5D,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ declare const Placeholder: ({ attributes, children, blockId }: {
3
+ attributes: any;
4
+ children: any;
5
+ blockId: any;
6
+ }) => JSX.Element;
7
+ export { Placeholder };
8
+ //# sourceMappingURL=Placeholder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Placeholder.d.ts","sourceRoot":"","sources":["../../src/ui/Placeholder.tsx"],"names":[],"mappings":";AAMA,QAAA,MAAM,WAAW;;;;iBA8ChB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const Resizer: ({ position }: {
3
+ position: any;
4
+ }) => JSX.Element;
5
+ export { Resizer };
6
+ //# sourceMappingURL=Resizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Resizer.d.ts","sourceRoot":"","sources":["../../src/ui/Resizer.tsx"],"names":[],"mappings":";AAAA,QAAA,MAAM,OAAO;;iBASZ,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -1,9 +1,5 @@
1
- import { RenderYooptaElementProps } from '@yoopta/editor';
2
- import { ReactNode } from 'react';
3
- import { VideoElement, VideoElementData } from '../types';
4
- type Props = RenderYooptaElementProps<VideoElement> & {
5
- children?: ReactNode;
6
- size?: VideoElementData['size'];
7
- };
8
- declare const Video: ({ attributes, element, children, size, HTMLAttributes }: Props) => JSX.Element;
9
- export { Video };
1
+ /// <reference types="react" />
2
+ import { VideoPluginOptions } from '../types';
3
+ declare const VideoRender: ({ element, attributes, children, blockId }: PluginElementRenderProps<VideoPluginOptions>) => JSX.Element;
4
+ export { VideoRender };
5
+ //# sourceMappingURL=Video.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Video.d.ts","sourceRoot":"","sources":["../../src/ui/Video.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAI9C,QAAA,MAAM,WAAW,2GAqFhB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { YooEditor, YooptaBlockData } from '@yoopta/editor';
3
+ import { VideoElementProps } from '../types';
4
+ type Props = {
5
+ editor: YooEditor;
6
+ block: YooptaBlockData;
7
+ props?: VideoElementProps;
8
+ settings?: VideoElementProps['settings'];
9
+ };
10
+ declare const VideoBlockOptions: ({ editor, block, props: videoProps }: Props) => JSX.Element;
11
+ export { VideoBlockOptions };
12
+ //# sourceMappingURL=VideoBlockOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoBlockOptions.d.ts","sourceRoot":"","sources":["../../src/ui/VideoBlockOptions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAuB,MAAM,UAAU,CAAC;AAIlE,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;CAC1C,CAAC;AAEF,QAAA,MAAM,iBAAiB,yCAA0C,KAAK,gBA6ErE,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { VideoElementProps } from '../types';
3
+ type VideoComponentProps = Omit<VideoElementProps, 'sizes'> & {
4
+ width: number;
5
+ height: number;
6
+ };
7
+ declare const VideoComponent: ({ width, height, src, settings, bgColor, poster, provider, fit }: VideoComponentProps) => JSX.Element;
8
+ export { VideoComponent, VideoComponentProps };
9
+ //# sourceMappingURL=VideoComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoComponent.d.ts","sourceRoot":"","sources":["../../src/ui/VideoComponent.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAK7C,KAAK,mBAAmB,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAQF,QAAA,MAAM,cAAc,qEAAsE,mBAAmB,gBAmD5G,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { CSSProperties } from 'react';
2
+ type Props = {
3
+ floatingStyles: CSSProperties;
4
+ refs: any;
5
+ blockId: string;
6
+ onClose: () => void;
7
+ onSetLoading: (_s: boolean) => void;
8
+ };
9
+ declare const VideoUploader: ({ floatingStyles, refs, onClose, blockId, onSetLoading }: Props) => JSX.Element;
10
+ export { VideoUploader };
11
+ //# sourceMappingURL=VideoUploader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoUploader.d.ts","sourceRoot":"","sources":["../../src/ui/VideoUploader.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAY,MAAM,OAAO,CAAC;AAIhD,KAAK,KAAK,GAAG;IACX,cAAc,EAAE,aAAa,CAAC;IAC9B,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,IAAI,CAAC;CACrC,CAAC;AAIF,QAAA,MAAM,aAAa,6DAA8D,KAAK,gBA8CrF,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -4,3 +4,4 @@ declare function VimeoPlayer({ videoId, ...other }: {
4
4
  videoId: any;
5
5
  }): JSX.Element;
6
6
  export default VimeoPlayer;
7
+ //# sourceMappingURL=VimeoPlayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VimeoPlayer.d.ts","sourceRoot":"","sources":["../../src/ui/VimeoPlayer.tsx"],"names":[],"mappings":";AAKA,iBAAS,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE;;;CAAA,eA4CzC;AAED,eAAe,WAAW,CAAC"}
@@ -4,3 +4,4 @@ declare function YouTubePlayer({ videoId, ...other }: {
4
4
  videoId: any;
5
5
  }): JSX.Element;
6
6
  export default YouTubePlayer;
7
+ //# sourceMappingURL=YootubePlayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YootubePlayer.d.ts","sourceRoot":"","sources":["../../src/ui/YootubePlayer.tsx"],"names":[],"mappings":";AAGA,iBAAS,aAAa,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE;;;CAAA,eAoC3C;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { VideoProviderTypes } from '../types';
2
+ export declare const getYoutubeId: (url: string) => string | null;
3
+ export declare const getVimeoId: (url: string) => string;
4
+ export declare const getDailymotionId: (url: string) => string | null;
5
+ export declare function getProvider(url: string): VideoProviderTypes | null;
6
+ export declare const ProviderGetters: {
7
+ youtube: (url: string) => string | null;
8
+ vimeo: (url: string) => string;
9
+ dailymotion: (url: string) => string | null;
10
+ };
11
+ //# sourceMappingURL=providers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/utils/providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,eAAO,MAAM,YAAY,QAAS,MAAM,kBAKvC,CAAC;AAEF,eAAO,MAAM,UAAU,QAAS,MAAM,WAIrC,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAS,MAAM,kBAS3C,CAAC;AAEF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAclE;AAED,eAAO,MAAM,eAAe;mBAxCM,MAAM;iBAOR,MAAM;uBAMA,MAAM;CA+B3C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoopta/video",
3
- "version": "2.0.1",
3
+ "version": "4.0.0-rc.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "Darginec05 <devopsbanda@gmail.com>",
6
6
  "homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
@@ -14,7 +14,7 @@
14
14
  "dist/"
15
15
  ],
16
16
  "peerDependencies": {
17
- "@yoopta/editor": ">=1.9.18-rc",
17
+ "@yoopta/editor": ">=4.0.0-rc.0",
18
18
  "react": ">=17.0.2",
19
19
  "react-dom": ">=17.0.2",
20
20
  "slate": ">=0.72.3",
@@ -28,13 +28,17 @@
28
28
  "url": "git+https://github.com/Darginec05/Editor-Yoopta.git"
29
29
  },
30
30
  "scripts": {
31
- "test": "node ./__tests__/yoopta-code.test.js"
31
+ "test": "node ./__tests__/yoopta-video.test.js",
32
+ "start": "rollup --config rollup.config.js --watch --bundleConfigAsCjs --environment NODE_ENV:development",
33
+ "build": "rollup --config rollup.config.js --bundleConfigAsCjs --environment NODE_ENV:production",
34
+ "publish": "yarn build && npm publish --access public"
32
35
  },
33
36
  "bugs": {
34
37
  "url": "https://github.com/Darginec05/Editor-Yoopta/issues"
35
38
  },
36
39
  "dependencies": {
37
- "body-scroll-lock": "^4.0.0-beta.0",
38
- "re-resizable": "^6.9.9"
40
+ "@floating-ui/react": "^0.26.9",
41
+ "@radix-ui/react-icons": "^1.3.0",
42
+ "re-resizable": "^6.9.11"
39
43
  }
40
44
  }
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import { RenderYooptaElementProps, YooEditor } from '@yoopta/editor';
3
- import { VideoElement, VideoPluginOptions } from '../types';
4
- type Props = RenderYooptaElementProps<VideoElement> & {
5
- editor: YooEditor;
6
- onUpload?: VideoPluginOptions['onUpload'];
7
- maxSizes: {
8
- maxWidth: number;
9
- maxHeight: number;
10
- };
11
- };
12
- declare const EditorPlaceholder: ({ element, attributes, maxSizes, children, editor, onUpload }: Props) => JSX.Element;
13
- export { EditorPlaceholder };
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- declare const EditorUploader: ({ activeTab, style, switchTab, onChange, onClose, onEmbed }: {
3
- activeTab?: string | undefined;
4
- style: any;
5
- switchTab: any;
6
- onChange: any;
7
- onClose: any;
8
- onEmbed: any;
9
- }) => JSX.Element;
10
- export { EditorUploader };
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare const Loader: () => JSX.Element;
3
- export { Loader };
@@ -1,12 +0,0 @@
1
- /// <reference types="react" />
2
- import { RenderYooptaElementProps, YooEditor, YooptaPluginType } from '@yoopta/editor';
3
- import { VideoElement, VideoPluginOptions } from '../types';
4
- type Props = {
5
- editor: YooEditor;
6
- plugin: YooptaPluginType<VideoPluginOptions, VideoElement>;
7
- element: RenderYooptaElementProps<VideoElement>['element'];
8
- children: RenderYooptaElementProps<VideoElement>['children'];
9
- attributes: RenderYooptaElementProps<VideoElement>['attributes'];
10
- };
11
- declare const VideoEditorFactory: (editor: Props['editor'], plugin: Props['plugin']) => (props: RenderYooptaElementProps<VideoElement>) => JSX.Element;
12
- export { VideoEditorFactory };
@@ -1,7 +0,0 @@
1
- export declare const getAspectRatio: (srcWidth: number, srcHeight: number, maxWidth: number, maxHeight: number) => {
2
- width?: undefined;
3
- height?: undefined;
4
- } | {
5
- width: number;
6
- height: number;
7
- };
@@ -1 +0,0 @@
1
- export declare function toBase64(file: File): Promise<any>;
@@ -1,5 +0,0 @@
1
- import { VideoProviders } from '../types';
2
- export declare const getYoutubeId: (url: string) => string | null;
3
- export declare const getVimeoId: (url: string) => string;
4
- export declare const getDailymotionId: (url: string) => string | null;
5
- export declare function getProvider(url: string): VideoProviders | null;