@yoopta/embed 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.
- package/README.md +2 -2
- package/dist/{utils → hooks}/useIntersectionObserver.d.ts +1 -0
- package/dist/hooks/useIntersectionObserver.d.ts.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -1
- package/dist/plugin/index.d.ts +5 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/providers/DailyMotion.d.ts +7 -0
- package/dist/providers/DailyMotion.d.ts.map +1 -0
- package/dist/providers/Figma.d.ts +6 -0
- package/dist/providers/Figma.d.ts.map +1 -0
- package/dist/providers/Twitter.d.ts +11 -0
- package/dist/providers/Twitter.d.ts.map +1 -0
- package/dist/providers/Vimeo.d.ts +7 -0
- package/dist/providers/Vimeo.d.ts.map +1 -0
- package/dist/providers/Youtube.d.ts +7 -0
- package/dist/providers/Youtube.d.ts.map +1 -0
- package/dist/types.d.ts +21 -15
- package/dist/types.d.ts.map +1 -0
- package/dist/ui/Embed.d.ts +6 -11
- package/dist/ui/Embed.d.ts.map +1 -0
- package/dist/ui/EmbedBlockOptions.d.ts +11 -0
- package/dist/ui/EmbedBlockOptions.d.ts.map +1 -0
- package/dist/ui/EmbedComponent.d.ts +10 -0
- package/dist/ui/EmbedComponent.d.ts.map +1 -0
- package/dist/ui/EmbedLinkUploader.d.ts +7 -0
- package/dist/ui/EmbedLinkUploader.d.ts.map +1 -0
- package/dist/ui/EmbedUploader.d.ts +10 -0
- package/dist/ui/EmbedUploader.d.ts.map +1 -0
- package/dist/ui/Placeholder.d.ts +8 -0
- package/dist/ui/Placeholder.d.ts.map +1 -0
- package/dist/ui/Resizer.d.ts +6 -0
- package/dist/ui/Resizer.d.ts.map +1 -0
- package/dist/utils/providers.d.ts +15 -0
- package/dist/utils/providers.d.ts.map +1 -0
- package/package.json +11 -3
- package/dist/components/EditorPlaceholder.d.ts +0 -12
- package/dist/components/EditorUploader.d.ts +0 -7
- package/dist/providers/DayliMotion.d.ts +0 -6
- package/dist/providers/DefaultEmbed.d.ts +0 -7
- package/dist/providers/FigmaEmbed.d.ts +0 -7
- package/dist/providers/TweetEmbed.d.ts +0 -7
- package/dist/providers/VimeoPlayer.d.ts +0 -6
- package/dist/providers/YoutubePlayer.d.ts +0 -6
- package/dist/ui/EmbedEditor.d.ts +0 -8
- package/dist/utils/parsers.d.ts +0 -7
package/README.md
CHANGED
|
@@ -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 {
|
|
2
|
-
import { EmbedElement
|
|
1
|
+
import { Embed } from './plugin';
|
|
2
|
+
import { EmbedElement } from './types';
|
|
3
|
+
import './styles.css';
|
|
3
4
|
declare module 'slate' {
|
|
4
5
|
interface CustomTypes {
|
|
5
|
-
Editor: YooEditor;
|
|
6
6
|
Element: EmbedElement;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
declare const Embed: any;
|
|
10
9
|
export default Embed;
|
|
11
|
-
export { EmbedElement
|
|
10
|
+
export { EmbedElement };
|
|
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{jsx as l,jsxs as d}from"react/jsx-runtime";import*as h from"react";import{useState as p,useEffect as c,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{l(o.next(t))}catch(t){s(t)}}function a(t){try{l(o.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,a)}l((o=o.apply(t,e||[])).next())}))}function x(t,{threshold:e=0,root:i=null,rootMargin:o="0%",freezeOnceVisible:n=!1}={}){const[s,r]=p({}),a=s.isIntersecting&&n,l=([t])=>r(t);return c((()=>{const n=null==t?void 0:t.current;if(!window.IntersectionObserver||a||!n)return;const s=new IntersectionObserver(l,{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 O="ypSFFbjd",S="DQszzmj7",N="yc58m72J",j="DYsS-Bbu",R="a1CpYHeG";z(".ypSFFbjd{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.DQszzmj7{background-color:#fff}.DQszzmj7,.yc58m72J{border-radius:1px;height:100%;pointer-events:auto;width:100%}.DQszzmj7,.DYsS-Bbu,.yc58m72J{left:0;position:absolute;top:0}.DYsS-Bbu{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.a1CpYHeG{height:100%;position:relative;width:100%}");var E="C8Z8IWw5",W="aGHn-pry",H="-qZtVrzy",C="srCuArtd";function L(t){var{providerId:e,url:i}=t;w(t,["providerId","url"]);const o=u(null),{isIntersecting:n}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return l("div",Object.assign({className:E,ref:o},{children:l("div",Object.assign({className:H},{children:l("div",Object.assign({className:C},{children:n&&l("iframe",{src:i,frameBorder:0,allowFullScreen:!0,className:W,height:"450px"})}))}))}))}z(".C8Z8IWw5{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.aGHn-pry{background-color:#fff}.-qZtVrzy,.aGHn-pry{border-radius:1px;height:100%;pointer-events:auto;width:100%}.-qZtVrzy,.aGHn-pry,.kmC7RiaF{left:0;position:absolute;top:0}.kmC7RiaF{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.srCuArtd{height:100%;position:relative;width:100%}");var P="w4l4tKlB",M="cbJcegGv",k="g8V-uGLl",B="j6pRoOC1";z(".w4l4tKlB{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.cbJcegGv{background-color:#fff}.cbJcegGv,.g8V-uGLl{border-radius:1px;height:100%;pointer-events:auto;width:100%}.cbJcegGv,.g8V-uGLl,.hZuYZ7vp{left:0;position:absolute;top:0}.hZuYZ7vp{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.j6pRoOC1{height:100%;position:relative;width:100%}");var I="e3lQDjTT",_="zxjqcq4y",A="ymOgdXs4";z(".e3lQDjTT{display:flex;justify-content:center;min-height:100px;position:relative;width:100%}.O5Z0OWN-{background-color:#fff;position:absolute}.O5Z0OWN-,.zxjqcq4y{border-radius:1px;height:auto;left:0;pointer-events:auto;top:0;width:100%}._5kC3Lf5J{filter:blur(10px);left:0;object-fit:cover;top:0;transition:opacity .15s ease-in,filter .15s ease-in}.ymOgdXs4{position:relative;width:100%}.ymOgdXs4,.ymOgdXs4>div,.ymOgdXs4>div>div{height:auto}");var T="sD5QN14F",V="mRrF4hwM",F="LyyH1fsE",U="U9EPxemn",D="_4AQiBYad";z(".sD5QN14F{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.mRrF4hwM{background-color:#fff}.LyyH1fsE,.mRrF4hwM{border-radius:1px;height:100%;pointer-events:auto;width:100%}.LyyH1fsE,.U9EPxemn,.mRrF4hwM{left:0;position:absolute;top:0}.U9EPxemn{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}._4AQiBYad{height:100%;position:relative;width:100%}");var G="zoqyIXwI",Y="WgoSECbO",q="m07CnIxO",J="NSr-cxfm",Z="Cv1rIJbN";z(".zoqyIXwI{display:flex;height:0;justify-content:center;min-height:100px;padding-bottom:56.25%;position:relative;width:100%}.WgoSECbO{background-color:#fff}.WgoSECbO,.m07CnIxO{border-radius:1px;height:100%;pointer-events:auto;width:100%}.NSr-cxfm,.WgoSECbO,.m07CnIxO{left:0;position:absolute;top:0}.NSr-cxfm{filter:blur(10px);object-fit:cover;transition:opacity .15s ease-in,filter .15s ease-in}.Cv1rIJbN{height:100%;position:relative;width:100%}");var Q="HUtGPcJq";z(".HUtGPcJq{margin:20px auto 10px;position:relative}");const X={vimeo:function(t){var{providerId:e}=t,i=w(t,["providerId"]);const o=u(null),[n,s]=p(null),[r,a]=p(!1),{isIntersecting:h}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return c((()=>{fetch(`https://vimeo.com/api/v2/video/${e}.json`).then((t=>t.json())).then((t=>s(t[0].thumbnail_medium))).catch((()=>s(null)))}),[e]),l("div",Object.assign({className:T,ref:o},{children:l("div",Object.assign({className:F},{children:d("div",Object.assign({className:D},{children:[l("img",{src:n||"",alt:"vimeo_video_preview",width:"100%",height:"100%",className:U,style:{opacity:h&&r?0:1,zIndex:h&&r?-1:0}}),h&&l("iframe",Object.assign({title:"Vimeo Player",src:`https://player.vimeo.com/video/${e}?badge=0&byline=0&portrait=0&title=0`,frameBorder:0,allowFullScreen:!0,onLoad:()=>a(!0),className:V},i))]}))}))}))},youtube:function(t){var{providerId:e}=t,i=w(t,["providerId"]);const o=u(null),[n,s]=p(!1),{isIntersecting:r}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return l("div",Object.assign({className:G,ref:o},{children:l("div",Object.assign({className:q},{children:d("div",Object.assign({className:Z},{children:[l("img",{src:`https://i.ytimg.com/vi/${e}/default.jpg`,alt:"youtube_video_preview",width:"100%",height:"100%",className:J,style:{opacity:r&&n?0:1,zIndex:r&&n?-1:0}}),r&&l("iframe",Object.assign({title:"Youtube Player",src:`https://www.youtube.com/embed/${e}`,frameBorder:0,onLoad:()=>s(!0),allowFullScreen:!0,className:Y},i))]}))}))}))},dailymotion:function(t){var{providerId:e}=t,i=w(t,["providerId"]);const o=u(null),[n,s]=p(null),[r,a]=p(!1),{isIntersecting:h}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return c((()=>{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]),l("div",Object.assign({className:O,ref:o},{children:l("div",Object.assign({className:N},{children:d("div",Object.assign({className:R},{children:[l("img",{src:n||"",alt:"daylimotion_video_preview",width:"100%",height:"100%",className:j,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:S},i))]}))}))}))},twitter:function({providerId:t}){const e=u(null),{isIntersecting:i}=x(e,{freezeOnceVisible:!0,rootMargin:"50%"});return c((()=>{var o;if(!i)return;const n=document.createElement("script");n.src="https://platform.twitter.com/widgets.js",null===(o=e.current)||void 0===o||o.appendChild(n),n.onload=()=>{window.twttr&&window.twttr.widgets.createTweet(t,document.getElementById(t),{align:"center",conversation:"none",dnt:!0,theme:"dark",height:500})}}),[t,i]),l("div",Object.assign({className:I,ref:e},{children:l("div",Object.assign({className:_},{children:l("div",Object.assign({className:A},{children:l("div",{id:t})}))}))}))},figma:function(t){var{providerId:e,url:i}=t;w(t,["providerId","url"]);const o=u(null),{isIntersecting:n}=x(o,{freezeOnceVisible:!0,rootMargin:"50%"});return l("div",Object.assign({className:P,ref:o},{children:l("div",Object.assign({className:k},{children:l("div",Object.assign({className:B},{children:n&&l("iframe",{src:`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(i)}`,frameBorder:0,allowFullScreen:!0,className:M,height:"450px"})}))}))}))}};var $,K,tt=($=function(t,e){return $=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)},function(t,e){function i(){this.constructor=t}$(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),et=function(){return et=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},et.apply(this,arguments)},it={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},ot={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},nt={width:"20px",height:"20px",position:"absolute"},st={top:et(et({},it),{top:"-5px"}),right:et(et({},ot),{left:void 0,right:"-5px"}),bottom:et(et({},it),{top:void 0,bottom:"-5px"}),left:et(et({},ot),{left:"-5px"}),topRight:et(et({},nt),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:et(et({},nt),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:et(et({},nt),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:et(et({},nt),{left:"-10px",top:"-10px",cursor:"nw-resize"})},rt=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 tt(e,t),e.prototype.render=function(){return h.createElement("div",{className:this.props.className||"",style:et(et({position:"absolute",userSelect:"none"},st[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},e}(h.PureComponent),at=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)}}(),lt=function(){return lt=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},lt.apply(this,arguments)},dt={width:"auto",height:"auto"},ht=function(t,e,i){return Math.max(Math.min(t,i),e)},pt=function(t,e){return Math.round(t/e)*e},ct=function(t,e){return new RegExp(t,"i").test(e)},ut=function(t){return Boolean(t.touches&&t.touches.length)},gt=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},ft=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"},mt=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},vt=["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"],bt="__resizable_base__",wt=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(bt):e.className+=bt,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 at(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||dt},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 ft(t.state[e])};return{width:e&&void 0!==e.width&&!this.state.isResizing?ft(e.width):i("width"),height:e&&void 0!==e.height&&!this.state.isResizing?ft(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&&ct("left",s),a=n&&ct("top",s);if("parent"===this.props.bounds){var l=this.parentNode;l&&(i=r?this.resizableRight-this.parentLeft:l.offsetWidth+(this.parentLeft-this.resizableLeft),o=a?this.resizableBottom-this.parentTop:l.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,l=a.lockAspectRatio,d=a.lockAspectRatioExtraHeight,h=a.lockAspectRatioExtraWidth,p=r.width,c=r.height,u=d||0,g=h||0;return ct("right",s)&&(p=r.width+(t-r.x)*o/i,l&&(c=(p-g)/this.ratio+u)),ct("left",s)&&(p=r.width-(t-r.x)*o/i,l&&(c=(p-g)/this.ratio+u)),ct("bottom",s)&&(c=r.height+(e-r.y)*o/i,l&&(p=(c-u)*this.ratio+g)),ct("top",s)&&(c=r.height-(e-r.y)*o/i,l&&(p=(c-u)*this.ratio+g)),{newWidth:p,newHeight:c}},e.prototype.calculateNewSizeFromAspectRatio=function(t,e,i,o){var n=this.props,s=n.lockAspectRatio,r=n.lockAspectRatioExtraHeight,a=n.lockAspectRatioExtraWidth,l=void 0===o.width?10:o.width,d=void 0===i.width||i.width<0?t:i.width,h=void 0===o.height?10:o.height,p=void 0===i.height||i.height<0?e:i.height,c=r||0,u=a||0;if(s){var g=(h-c)*this.ratio+u,f=(p-c)*this.ratio+u,m=(l-u)/this.ratio+c,v=(d-u)/this.ratio+c,b=Math.max(l,g),w=Math.min(d,f),y=Math.max(h,m),x=Math.min(p,v);t=ht(t,b,w),e=ht(e,y,x)}else t=ht(t,l,d),e=ht(e,h,p);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&&ut(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 l={original:{x:o,y:n,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:lt(lt({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(t.target).cursor||"auto"}),direction:e,flexBasis:i};this.setState(l)}},e.prototype.onMouseMove=function(t){var e=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&ut(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=ut(t)?t.touches[0].clientX:t.clientX,l=ut(t)?t.touches[0].clientY:t.clientY,d=this.state,h=d.direction,p=d.original,c=d.width,u=d.height,g=this.getParentSize(),m=function(t,e,i,o,n,s,r){return o=mt(o,t.width,e,i),n=mt(n,t.height,e,i),s=mt(s,t.width,e,i),r=mt(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,l),b=v.newHeight,w=v.newWidth,y=this.calculateNewMaxFromBoundary(o,n);this.props.snap&&this.props.snap.x&&(w=gt(w,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(b=gt(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=pt(w,this.props.grid[0]),O=pt(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(O-b)<=S?O:b}var N={width:w-p.width,height:b-p.height};if(c&&"string"==typeof c)if(c.endsWith("%"))w=w/g.width*100+"%";else if(c.endsWith("vw")){w=w/this.window.innerWidth*100+"vw"}else if(c.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 j={width:this.createSizeForCssProperty(w,"width"),height:this.createSizeForCssProperty(b,"height")};"row"===this.flexDir?j.flexBasis=j.width:"column"===this.flexDir&&(j.flexBasis=j.height),f((function(){e.setState(j)})),this.props.onResize&&this.props.onResize(t,h,this.resizable,N)}},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:lt(lt({},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 l=Object.keys(i).map((function(e){return!1!==i[e]?h.createElement(rt,{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},l)},e.prototype.render=function(){var t=this,e=Object.keys(this.props).reduce((function(e,i){return-1!==vt.indexOf(i)||(e[i]=t.props[i]),e}),{}),i=lt(lt(lt({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,lt({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 yt(){return yt=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},yt.apply(this,arguments)}var xt=function(t){return h.createElement("svg",yt({fill:"currentColor","aria-hidden":"true",viewBox:"0 0 24 24","data-testid":"uploadImage"},t),K||(K=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"})))},zt="_5ZnGUwAU",Ot="wlwFaZpx",St="Obm15-qh",Nt="gJ5-oVLV",jt="_6jUel99o",Rt="HZgHUcV-",Et="GF1PbH1g gU1gU-Wq",Wt="i7UwLauz",Ht="cJSOiHYH";z('._5ZnGUwAU{position:fixed}.wlwFaZpx{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}.Obm15-qh{box-shadow:inset 0 -1px 0 rgba(55,53,47,.09);display:flex;height:40px;padding:0 8px;width:100%;z-index:1}.Obm15-qh,.gJ5-oVLV{font-size:14px;position:relative}.gJ5-oVLV{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}._6jUel99o:after{background-color:#37352f;bottom:0;content:"";height:2px;left:0;position:absolute;width:100%}.HZgHUcV-{display:flex;justify-content:center;margin-left:12px;margin-right:12px;margin-top:4px;padding-bottom:6px;padding-top:6px}.gU1gU-Wq{border:1px solid rgba(55,53,47,.16);border-radius:4px;cursor:pointer;height:32px;padding-left:12px;padding-right:12px;transition:background 20ms ease-in 0s;user-select:none;white-space:nowrap;width:100%}.GF1PbH1g{border:none!important;cursor:pointer!important;height:auto!important;padding-left:0!important;padding-right:0!important}.i2lz5EKx{align-items:center;cursor:pointer;display:inline-flex;font-size:14px;font-weight:500;height:100%;justify-content:center;line-height:1.2;width:100%}._3cPFLttW{left:0;position:absolute;top:0;visibility:hidden}.i7UwLauz{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}.cJSOiHYH,.i7UwLauz{align-items:center;border:none;border-radius:4px;display:flex;font-size:14px;width:100%}.cJSOiHYH{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 Ct=({onEmbed:t})=>{const[e,i]=p("");return d("div",Object.assign({className:Et},{children:[l("input",{type:"text",placeholder:"Paste embed link",value:e,className:Wt,onChange:t=>i(t.target.value)}),l("button",Object.assign({type:"button",className:Ht,onClick:()=>t(e)},{children:"Embed"}))]}))},Lt=({style:t,onEmbed:o,onClose:n})=>d(e.Overlay,Object.assign({onClose:n},{children:[l("div",Object.assign({className:zt,style:t},{children:d("div",Object.assign({className:Ot},{children:[l("div",Object.assign({className:St},{children:l("button",Object.assign({type:"button",className:i(Nt,{[jt]:!0})},{children:"Embed link"}))})),l("div",Object.assign({className:Rt},{children:l(Ct,{onEmbed:o})}))]}))})),l("div",{})]}));var Pt=!1;if("undefined"!=typeof window){var Mt={get passive(){Pt=!0}};window.addEventListener("testPassive",null,Mt),window.removeEventListener("testPassive",null,Mt)}var kt="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),Bt=[],It=!1,_t=-1,At=void 0,Tt=void 0,Vt=void 0,Ft=function(t){return Bt.some((function(e){return!(!e.options.allowTouchMove||!e.options.allowTouchMove(t))}))},Ut=function(t){var e=t||window.event;return!!Ft(e.target)||(e.touches.length>1||(e.preventDefault&&e.preventDefault(),!1))},Dt=function(t,e){if(t){if(!Bt.some((function(e){return e.targetElement===t}))){var i={targetElement:t,options:e||{}};Bt=[].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)}(Bt),[i]),kt?window.requestAnimationFrame((function(){if(void 0===Tt){Tt={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===Vt){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);Vt=document.body.style.paddingRight,document.body.style.paddingRight=o+i+"px"}}void 0===At&&(At=document.body.style.overflow,document.body.style.overflow="hidden")}(e),kt&&(t.ontouchstart=function(t){1===t.targetTouches.length&&(_t=t.targetTouches[0].clientY)},t.ontouchmove=function(e){1===e.targetTouches.length&&function(t,e){var i=t.targetTouches[0].clientY-_t;!Ft(t.target)&&(e&&0===e.scrollTop&&i>0||function(t){return!!t&&t.scrollHeight-t.scrollTop<=t.clientHeight}(e)&&i<0?Ut(t):t.stopPropagation())}(e,t)},It||(document.addEventListener("touchmove",Ut,Pt?{passive:!1}:void 0),It=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},Gt=function(t){t?(Bt=Bt.filter((function(e){return e.targetElement!==t})),kt&&(t.ontouchstart=null,t.ontouchmove=null,It&&0===Bt.length&&(document.removeEventListener("touchmove",Ut,Pt?{passive:!1}:void 0),It=!1)),kt?function(){if(void 0!==Tt){var t=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=Tt.position,document.body.style.top=Tt.top,document.body.style.left=Tt.left,window.scrollTo(e,t),Tt=void 0}}():(void 0!==Vt&&(document.body.style.paddingRight=Vt,Vt=void 0),void 0!==At&&(document.body.style.overflow=At,At=void 0))):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")},Yt="PoOhS4FU",qt="PcGiiPpV",Jt="iQZH4Lf-";z(".PoOhS4FU{margin:20px 0 10px;user-select:none}.PcGiiPpV,.PoOhS4FU{position:relative;width:100%}.PcGiiPpV{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}.PcGiiPpV:hover{background-color:#e3e3e3}.iQZH4Lf-{margin-right:8px;user-select:none}");const Zt=({element:t,attributes:e,maxSizes:i,children:o,editor:n})=>{const[s,h]=p(null),c=u(null),g=t=>{var e;if(t.stopPropagation(),null!==s)return Gt(document.body),void h(null);const i=null===(e=c.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}),Dt(document.body,{reserveScrollBarGap:!0}),h({left:i.left,top:t?i.top-88-5:i.top+i.height+5})}};return d("div",Object.assign({className:Yt},e,{contentEditable:!1},{children:[d("div",Object.assign({ref:c},{children:[d("button",Object.assign({className:qt,onClick:g},{children:[l(xt,{className:Jt,width:24,height:24}),l("span",{children:"Click to add embed"})]})),null!==s&&l(Lt,{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":o.includes("twitter")?"twitter":o.includes("figma")?"figma":null;var o;let s=null;"youtube"===i?s=(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?s=(t=>new URL(t).pathname.split("/")[1])(e):"dailymotion"===i?s=(t=>{var e=t.match(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);return null!==e?void 0!==e[4]?e[4]:e[2]:null})(e):"twitter"===i?s=function(t){const e=t.match(/\/status\/(\d+)/);return e?e[1]:null}(e):"figma"===i&&(s=function(t){const e=new URL(t).searchParams,i=e.get("node-id");return e.get("node-id")?i:"unknown"}(e)),console.log({provider:i,providerId:s,element:t});try{console.log("path",m.findPath(n,t)),Gt(document.body),h(null);const o={data:Object.assign(Object.assign({},t.data),{url:e,size:{width:t.data.size.width,height:t.data.size.height},provider:i,providerId:s})};r.setNodes(n,o,{at:m.findPath(n,t),match:t=>a.isElement(t)&&"embed"===t.type})}catch(t){console.log("provider adding error",t),Gt(document.body),h(null)}})),onClose:g,style:s})]})),o]}))};var Qt="s8SlWwrL",Xt="_5qhGnBQW",$t="_6GzVi0JR",Kt="HLz36qUX OLRmQVp3",te="Tv1Fs118 OLRmQVp3",ee="_33V0MBSa",ie="VdsHNo29",oe="WARAR91D",ne="_92ciCRYx";z(".s8SlWwrL{cursor:pointer;display:block;position:relative}.s8SlWwrL:hover .OLRmQVp3,.s8SlWwrL:hover ._5qhGnBQW{opacity:1}._0z3X-ysz{pointer-events:none}._9GorNz7R{margin:20px 0 30px}._6GzVi0JR{margin:0 auto}.OLRmQVp3{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}.HLz36qUX{left:0;top:0}.Tv1Fs118{right:0;top:0}._33V0MBSa{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}.VdsHNo29{opacity:0}.WARAR91D{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}._8VNstZwX{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}._5qhGnBQW{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}._92ciCRYx{background-color:gray;border-radius:50%;min-height:3px;min-width:3px}");function se(t){var o,n,s,h,u;const{element:f,editor:w,plugin:y}=t,x=v(),z=b(),[O,S]=p(null),[N,j]=p({width:(null===(n=null===(o=f.data)||void 0===o?void 0:o.size)||void 0===n?void 0:n.width)||750,height:(null===(h=null===(s=f.data)||void 0===s?void 0:s.size)||void 0===h?void 0:h.height)||440}),R=t=>j(Object.assign(Object.assign({},N),t));c((()=>{var t,e,i,o;f.data&&R({width:(null===(e=null===(t=f.data)||void 0===t?void 0:t.size)||void 0===e?void 0:e.width)||750,height:(null===(o=null===(i=f.data)||void 0===i?void 0:i.size)||void 0===o?void 0:o.height)||440})}),[null===(u=f.data)||void 0===u?void 0:u.size]);const E=g((()=>{var t,e;return{minWidth:300,size:{width:N.width,height:N.height},maxWidth:(null===(t=y.options)||void 0===t?void 0:t.maxWidth)||800,maxHeight:(null===(e=y.options)||void 0===e?void 0:e.maxHeight)||720,lockAspectRatio:!0,resizeRatio:2,enable:{left:!z,right:!z},handleStyles:{left:{left:0},right:{right:0}},onResize:(t,e,i)=>{R({width:i.offsetWidth,height:i.offsetHeight})},onResizeStop:(t,e,i)=>{console.log("image editor editor.children",w.children),console.log("ReactEditor.findPath(editor, element)",m.findPath(w,f)),console.log("element",f),r.setNodes(w,{data:Object.assign(Object.assign({},f.data),{size:{width:i.offsetWidth,height:i.offsetHeight}})},{at:m.findPath(w,f),match:t=>a.isElement(t)&&"embed"===t.type})},handleComponent:{left:l("div",Object.assign({contentEditable:!1,className:Kt},{children:l("div",{className:ee})})),right:l("div",Object.assign({contentEditable:!1,className:te},{children:l("div",{className:ee})}))}}}),[N.width,N.height,w]),W=()=>{Gt(document.body),S(null)},H=t=>{var e;if(null==t||t.stopPropagation(),null!==O)return W();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;Dt(document.body,{reserveScrollBarGap:!0}),S({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(!f.data.url&&!f.data["data-src"]){const{maxWidth:o=750,maxHeight:n=800}=y.options||{};return d("div",Object.assign({className:Qt,contentEditable:!1,draggable:!1},{children:[l("div",{className:i(ie,{[oe]:x})}),l(Zt,Object.assign({attributes:t.attributes,element:f,editor:w,maxSizes:{maxWidth:o,maxHeight:n}},{children:!z&&d("div",{children:[d("button",Object.assign({type:"button",className:Xt,onClick:H},{children:[l("span",{className:ne}),l("span",{className:ne}),l("span",{className:ne})]})),null!==O&&l(e.ElementOptions,{onClose:W,style:O,element:f,onCopy:W,onDelete:W,onDuplicate:W},f.id)]})})),t.children]}),f.id)}return l("div",Object.assign({contentEditable:!1,draggable:!1,className:Qt},{children:d(wt,Object.assign({},E,{className:$t},{children:[y.renderer.render(Object.assign(Object.assign({},t),{size:N,isEdit:!0})),l("div",{className:i(ie,{[oe]:x})}),!z&&d("div",{children:[d("button",Object.assign({type:"button",className:Xt,onClick:H},{children:[l("span",{className:ne}),l("span",{className:ne}),l("span",{className:ne})]})),null!==O&&l(e.ElementOptions,{onClose:W,style:O,element:f,onCopy:W,onDelete:W,onDuplicate:W},f.id)]})]}))}),f.id)}const re=o({type:"embed",shortcut:"embed",renderer:{editor:(t,e)=>i=>l(se,Object.assign({editor:t,plugin:e},i)),render:({attributes:e,element:i,children:o,HTMLAttributes:n,isEdit:s=!1})=>{if("string"==typeof i.data.provider&&i.data.providerId&&X[i.data.provider]){const r=X[i.data.provider];return d("div",Object.assign({},e,{contentEditable:!1,draggable:!1},n,{style:s?void 0:i.data.size,className:t({element:i,HTMLAttributes:n,className:Q})},{children:[l(r,Object.assign({},i.data,{providerId:i.data.providerId})),o]}))}return i.data.url?d("div",Object.assign({},e,{contentEditable:!1,draggable:!1},n,{className:t({element:i,HTMLAttributes:n,className:Q}),style:s?void 0:i.data.size},{children:[l(L,Object.assign({},i.data,{providerId:i.data.providerId})),o]})):l("div",{})}},extendEditor(t){const{isVoid:e}=t;return t.isVoid=t=>t.type===re.getPlugin.type||e(t),t},events:{onKeyDown:(t,{defaultNode:e,hotkeys:i})=>o=>{var s;if("embed"===n(t,null===(s=t.selection)||void 0===s?void 0:s.anchor.path,"highest").type&&t.selection)return i.isEnter(o)?(o.preventDefault(),void r.insertNodes(t,e,{mode:"highest"})):void 0}},defineElement:()=>({id:s(),type:"embed",nodeType:"void",data:{url:null,size:{width:"auto",height:"auto"},providerId:null},children:[{text:""}]}),createElement:(t,e)=>{var i;const o=Object.assign(Object.assign({},re.getPlugin.defineElement()),e);r.setNodes(t,o,{at:null===(i=t.selection)||void 0===i?void 0:i.anchor})},exports:{markdown:{serialize:(t,e)=>`[embed-url](${t.data.url})\n`},html:{serialize:(t,e)=>{var i,o;return`<iframe src="https://player.vimeo.com/video/807053663?badge=0&byline=0&portrait=0&title=0" frameborder="0" height="${null===(i=t.data.size)||void 0===i?void 0:i.height}" width="${null===(o=t.data.size)||void 0===o?void 0:o.width}" allowfullscreen="" url="https://vimeo.com/807053663" provider="${t.data.provider||""}" />`},deserialize:{nodeName:"IFRAME",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:"Embed media",displayLabel:"Embed"}});export{re as default};
|
|
1
|
+
import{useYooptaEditor as t,UI as e,useBlockData as i,useYooptaPluginOptions as n,useBlockSelected as o,YooptaPlugin as r}from"@yoopta/editor";import{jsxs as s,jsx as a}from"react/jsx-runtime";import*as l from"react";import{useState as c,useEffect as d,useRef as u,useLayoutEffect as p,forwardRef as h,createElement as f,useMemo as g}from"react";import*as m from"react-dom";import{flushSync as w,createPortal as b}from"react-dom";function x(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]])}return i}function v(t,{threshold:e=0,root:i=null,rootMargin:n="0%",freezeOnceVisible:o=!1}={}){const[r,s]=c({}),a=r.isIntersecting&&o,l=([t])=>s(t);return d((()=>{const o=null==t?void 0:t.current;if(!window.IntersectionObserver||a||!o)return;const r=new IntersectionObserver(l,{threshold:e,root:i,rootMargin:n});return r.observe(o),()=>r.disconnect()}),[t,e,i,n,a]),r}"function"==typeof SuppressedError&&SuppressedError;const y={vimeo:function(t){var{embedId:e}=t,i=x(t,["embedId"]);const n=u(null),[o,r]=c(null),[l,p]=c(!1),{isIntersecting:h}=v(n,{freezeOnceVisible:!0,rootMargin:"50%"});return d((()=>{fetch(`https://vimeo.com/api/v2/embed/${e}.json`).then((t=>t.json())).then((t=>r(t[0].thumbnail_medium))).catch((()=>r(null)))}),[e]),s("div",Object.assign({ref:n,className:"yoo-video-relative"},{children:[a("img",{src:o||"",alt:"vimeo_embed_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:h&&l?0:1,zIndex:h&&l?-1:0}}),h&&a("iframe",Object.assign({title:"Embed Player",src:`https://player.vimeo.com/embed/${e}?badge=0&byline=0&portrait=0&title=0`,frameBorder:0,allowFullScreen:!0,onLoad:()=>p(!0),className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0"},i))]}))},youtube:function(t){var{embedId:e}=t,i=x(t,["embedId"]);const n=u(null),[o,r]=c(!1),{isIntersecting:l}=v(n,{freezeOnceVisible:!0,rootMargin:"50%"});return s("div",Object.assign({ref:n,className:"yoo-video-relative"},{children:[a("img",{src:`https://i.ytimg.com/vi/${e}/default.jpg`,alt:"youtube_embed_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:l&&o?0:1,zIndex:l&&o?-1:0}}),l&&a("iframe",Object.assign({title:"Embed Player",src:`https://www.youtube.com/embed/${e}`,frameBorder:0,onLoad:()=>r(!0),allowFullScreen:!0,className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0"},i))]}))},dailymotion:function(t){var{embedId:e}=t,i=x(t,["embedId"]);const n=u(null),[o,r]=c(null),[l,p]=c(!1),{isIntersecting:h}=v(n,{freezeOnceVisible:!0,rootMargin:"50%"});return d((()=>{fetch((t=>`https://api.dailymotion.com/embed/${t}?fields=thumbnail_url`)(e)).then((t=>t.json())).then((t=>r(t.thumbnail_url))).catch((()=>r(null)))}),[e]),s("div",Object.assign({ref:n,className:"yoo-video-relative"},{children:[a("img",{src:o||"",alt:"daylimotion_embed_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:h&&l?0:1,zIndex:h&&l?-1:0}}),h&&a("iframe",Object.assign({title:"Dailymotion Embed Player",frameBorder:0,onLoad:()=>p(!0),src:`https://www.dailymotion.com/embed/embed/${e}`,allowFullScreen:!0,className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0"},i))]}))},figma:({provider:t})=>{const e=u(null),{isIntersecting:i}=v(e,{freezeOnceVisible:!0,rootMargin:"50%"});return a("div",Object.assign({className:"yoo-video-relative",ref:e},{children:i&&a("iframe",{src:`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(t.url)}`,frameBorder:0,allowFullScreen:!0,className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0"})}))},twitter:function({provider:e,blockId:i}){const n=u(null);t();const{isIntersecting:o}=v(n,{freezeOnceVisible:!0,rootMargin:"50%"}),r=`${i}-${e.id}`;return console.log("elementId",r),d((()=>{var t;if(!o)return;const i=document.createElement("script");i.src="https://platform.twitter.com/widgets.js",null===(t=n.current)||void 0===t||t.appendChild(i),i.onload=()=>{window.twttr&&window.twttr.widgets.createTweet(e.id,document.getElementById(r),{align:"center",conversation:"none",dnt:!0,theme:"dark",height:500,width:550})}}),[e.id,o]),a("div",Object.assign({className:"w-full h-full",ref:n},{children:a("div",{id:r})}))}},z=({width:t,height:e,provider:i,blockId:n})=>{if(!i)return null;if(i&&i.id&&i.type&&y[i.type]){const o=y[i.type];return a(o,{embedId:i.id,provider:i,width:t,height:e,blockId:n})}return a("div",Object.assign({className:"w-full"},{children:a("iframe",{src:i.url,width:"100%",height:"100%",frameBorder:0,allowFullScreen:!0,className:"yoo-video-absolute yoo-video-top-0 yoo-video-left-0"})}))};var S,R=(S=function(t,e){return S=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])},S(t,e)},function(t,e){function i(){this.constructor=t}S(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),_=function(){return _=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},_.apply(this,arguments)},E={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},C={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},O={width:"20px",height:"20px",position:"absolute"},k={top:_(_({},E),{top:"-5px"}),right:_(_({},C),{left:void 0,right:"-5px"}),bottom:_(_({},E),{top:void 0,bottom:"-5px"}),left:_(_({},C),{left:"-5px"}),topRight:_(_({},O),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:_(_({},O),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:_(_({},O),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:_(_({},O),{left:"-10px",top:"-10px",cursor:"nw-resize"})},N=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 R(e,t),e.prototype.render=function(){return l.createElement("div",{className:this.props.className||"",style:_(_({position:"absolute",userSelect:"none"},k[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},e}(l.PureComponent),L=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 n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),M=function(){return M=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},M.apply(this,arguments)},W={width:"auto",height:"auto"},j=function(t,e,i){return Math.max(Math.min(t,i),e)},T=function(t,e){return Math.round(t/e)*e},A=function(t,e){return new RegExp(t,"i").test(e)},B=function(t){return Boolean(t.touches&&t.touches.length)},I=function(t,e,i){void 0===i&&(i=0);var n=e.reduce((function(i,n,o){return Math.abs(n-t)<Math.abs(e[i]-t)?o:i}),0),o=Math.abs(e[n]-t);return 0===i||o<i?e[n]:t},P=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"},H=function(t,e,i,n){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 n*(Number(t.replace("vh",""))/100)}return t},D=["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"],F="__resizable_base__",V=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(F):e.className+=F,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 L(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||W},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,n=this.resizable.offsetHeight,o=this.resizable.style.position;"relative"!==o&&(this.resizable.style.position="relative"),t="auto"!==this.resizable.style.width?this.resizable.offsetWidth:i,e="auto"!==this.resizable.style.height?this.resizable.offsetHeight:n,this.resizable.style.position=o}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 P(t.state[e])};return{width:e&&void 0!==e.width&&!this.state.isResizing?P(e.width):i("width"),height:e&&void 0!==e.height&&!this.state.isResizing?P(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 n={width:t.offsetWidth,height:t.offsetHeight};return e&&(this.parentNode.style.flexWrap=i),this.removeBase(t),n},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,n,o=this.props.boundsByDirection,r=this.state.direction,s=o&&A("left",r),a=o&&A("top",r);if("parent"===this.props.bounds){var l=this.parentNode;l&&(i=s?this.resizableRight-this.parentLeft:l.offsetWidth+(this.parentLeft-this.resizableLeft),n=a?this.resizableBottom-this.parentTop:l.offsetHeight+(this.parentTop-this.resizableTop))}else"window"===this.props.bounds?this.window&&(i=s?this.resizableRight:this.window.innerWidth-this.resizableLeft,n=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(i=s?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),n=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return i&&Number.isFinite(i)&&(t=t&&t<i?t:i),n&&Number.isFinite(n)&&(e=e&&e<n?e:n),{maxWidth:t,maxHeight:e}},e.prototype.calculateNewSizeFromDirection=function(t,e){var i=this.props.scale||1,n=this.props.resizeRatio||1,o=this.state,r=o.direction,s=o.original,a=this.props,l=a.lockAspectRatio,c=a.lockAspectRatioExtraHeight,d=a.lockAspectRatioExtraWidth,u=s.width,p=s.height,h=c||0,f=d||0;return A("right",r)&&(u=s.width+(t-s.x)*n/i,l&&(p=(u-f)/this.ratio+h)),A("left",r)&&(u=s.width-(t-s.x)*n/i,l&&(p=(u-f)/this.ratio+h)),A("bottom",r)&&(p=s.height+(e-s.y)*n/i,l&&(u=(p-h)*this.ratio+f)),A("top",r)&&(p=s.height-(e-s.y)*n/i,l&&(u=(p-h)*this.ratio+f)),{newWidth:u,newHeight:p}},e.prototype.calculateNewSizeFromAspectRatio=function(t,e,i,n){var o=this.props,r=o.lockAspectRatio,s=o.lockAspectRatioExtraHeight,a=o.lockAspectRatioExtraWidth,l=void 0===n.width?10:n.width,c=void 0===i.width||i.width<0?t:i.width,d=void 0===n.height?10:n.height,u=void 0===i.height||i.height<0?e:i.height,p=s||0,h=a||0;if(r){var f=(d-p)*this.ratio+h,g=(u-p)*this.ratio+h,m=(l-h)/this.ratio+p,w=(c-h)/this.ratio+p,b=Math.max(l,f),x=Math.min(c,g),v=Math.max(d,m),y=Math.min(u,w);t=j(t,b,x),e=j(e,v,y)}else t=j(t,l,c),e=j(e,d,u);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 n=this.resizable.getBoundingClientRect(),o=n.left,r=n.top,s=n.right,a=n.bottom;this.resizableLeft=o,this.resizableRight=s,this.resizableTop=r,this.resizableBottom=a}},e.prototype.onResizeStart=function(t,e){if(this.resizable&&this.window){var i,n=0,o=0;if(t.nativeEvent&&function(t){return Boolean((t.clientX||0===t.clientX)&&(t.clientY||0===t.clientY))}(t.nativeEvent)?(n=t.nativeEvent.clientX,o=t.nativeEvent.clientY):t.nativeEvent&&B(t.nativeEvent)&&(n=t.nativeEvent.touches[0].clientX,o=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 r=this.window.getComputedStyle(this.resizable);if("auto"!==r.flexBasis){var s=this.parentNode;if(s){var a=this.window.getComputedStyle(s).flexDirection;this.flexDir=a.startsWith("row")?"row":"column",i=r.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var l={original:{x:n,y:o,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:M(M({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(t.target).cursor||"auto"}),direction:e,flexBasis:i};this.setState(l)}},e.prototype.onMouseMove=function(t){var e=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&B(t))try{t.preventDefault(),t.stopPropagation()}catch(t){}var i=this.props,n=i.maxWidth,o=i.maxHeight,r=i.minWidth,s=i.minHeight,a=B(t)?t.touches[0].clientX:t.clientX,l=B(t)?t.touches[0].clientY:t.clientY,c=this.state,d=c.direction,u=c.original,p=c.width,h=c.height,f=this.getParentSize(),g=function(t,e,i,n,o,r,s){return n=H(n,t.width,e,i),o=H(o,t.height,e,i),r=H(r,t.width,e,i),s=H(s,t.height,e,i),{maxWidth:void 0===n?void 0:Number(n),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,n,o,r,s);n=g.maxWidth,o=g.maxHeight,r=g.minWidth,s=g.minHeight;var m=this.calculateNewSizeFromDirection(a,l),b=m.newHeight,x=m.newWidth,v=this.calculateNewMaxFromBoundary(n,o);this.props.snap&&this.props.snap.x&&(x=I(x,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(b=I(b,this.props.snap.y,this.props.snapGap));var y=this.calculateNewSizeFromAspectRatio(x,b,{width:v.maxWidth,height:v.maxHeight},{width:r,height:s});if(x=y.newWidth,b=y.newHeight,this.props.grid){var z=T(x,this.props.grid[0]),S=T(b,this.props.grid[1]),R=this.props.snapGap||0;x=0===R||Math.abs(z-x)<=R?z:x,b=0===R||Math.abs(S-b)<=R?S:b}var _={width:x-u.width,height:b-u.height};if(p&&"string"==typeof p)if(p.endsWith("%"))x=x/f.width*100+"%";else if(p.endsWith("vw")){x=x/this.window.innerWidth*100+"vw"}else if(p.endsWith("vh")){x=x/this.window.innerHeight*100+"vh"}if(h&&"string"==typeof h)if(h.endsWith("%"))b=b/f.height*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"}var E={width:this.createSizeForCssProperty(x,"width"),height:this.createSizeForCssProperty(b,"height")};"row"===this.flexDir?E.flexBasis=E.width:"column"===this.flexDir&&(E.flexBasis=E.height),w((function(){e.setState(E)})),this.props.onResize&&this.props.onResize(t,d,this.resizable,_)}},e.prototype.onMouseUp=function(t){var e=this.state,i=e.isResizing,n=e.direction,o=e.original;if(i&&this.resizable){var r={width:this.size.width-o.width,height:this.size.height-o.height};this.props.onResizeStop&&this.props.onResizeStop(t,n,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"})})}},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,n=e.handleStyles,o=e.handleClasses,r=e.handleWrapperStyle,s=e.handleWrapperClass,a=e.handleComponent;if(!i)return null;var c=Object.keys(i).map((function(e){return!1!==i[e]?l.createElement(N,{key:e,direction:e,onResizeStart:t.onResizeStart,replaceStyles:n&&n[e],className:o&&o[e]},a&&a[e]?a[e]:null):null}));return l.createElement("div",{className:s,style:r},c)},e.prototype.render=function(){var t=this,e=Object.keys(this.props).reduce((function(e,i){return-1!==D.indexOf(i)||(e[i]=t.props[i]),e}),{}),i=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&&(i.flexBasis=this.state.flexBasis);var n=this.props.as||"div";return l.createElement(n,M({ref:this.ref,style:i,className:this.props.className},e),this.state.isResizing&&l.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}(l.PureComponent);function U(t){return Y(t)?(t.nodeName||"").toLowerCase():"#document"}function $(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function X(t){var e;return null==(e=(Y(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function Y(t){return t instanceof Node||t instanceof $(t).Node}function G(t){return t instanceof Element||t instanceof $(t).Element}function Z(t){return t instanceof HTMLElement||t instanceof $(t).HTMLElement}function q(t){return"undefined"!=typeof ShadowRoot&&(t instanceof ShadowRoot||t instanceof $(t).ShadowRoot)}function J(t){const{overflow:e,overflowX:i,overflowY:n,display:o}=it(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+i)&&!["inline","contents"].includes(o)}function K(t){return["table","td","th"].includes(U(t))}function Q(t){const e=tt(),i=it(t);return"none"!==i.transform||"none"!==i.perspective||!!i.containerType&&"normal"!==i.containerType||!e&&!!i.backdropFilter&&"none"!==i.backdropFilter||!e&&!!i.filter&&"none"!==i.filter||["transform","perspective","filter"].some((t=>(i.willChange||"").includes(t)))||["paint","layout","strict","content"].some((t=>(i.contain||"").includes(t)))}function tt(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function et(t){return["html","body","#document"].includes(U(t))}function it(t){return $(t).getComputedStyle(t)}function nt(t){return G(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function ot(t){if("html"===U(t))return t;const e=t.assignedSlot||t.parentNode||q(t)&&t.host||X(t);return q(e)?e.host:e}function rt(t){const e=ot(t);return et(e)?t.ownerDocument?t.ownerDocument.body:t.body:Z(e)&&J(e)?e:rt(e)}function st(t,e,i){var n;void 0===e&&(e=[]),void 0===i&&(i=!0);const o=rt(t),r=o===(null==(n=t.ownerDocument)?void 0:n.body),s=$(o);return r?e.concat(s,s.visualViewport||[],J(o)?o:[],s.frameElement&&i?st(s.frameElement):[]):e.concat(o,st(o,[],i))}const at=Math.min,lt=Math.max,ct=Math.round,dt=t=>({x:t,y:t}),ut={left:"right",right:"left",bottom:"top",top:"bottom"},pt={start:"end",end:"start"};function ht(t,e,i){return lt(t,at(e,i))}function ft(t,e){return"function"==typeof t?t(e):t}function gt(t){return t.split("-")[0]}function mt(t){return t.split("-")[1]}function wt(t){return"x"===t?"y":"x"}function bt(t){return"y"===t?"height":"width"}function xt(t){return["top","bottom"].includes(gt(t))?"y":"x"}function vt(t){return wt(xt(t))}function yt(t){return t.replace(/start|end/g,(t=>pt[t]))}function zt(t){return t.replace(/left|right|bottom|top/g,(t=>ut[t]))}function St(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}function Rt(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function _t(t,e,i){let{reference:n,floating:o}=t;const r=xt(e),s=vt(e),a=bt(s),l=gt(e),c="y"===r,d=n.x+n.width/2-o.width/2,u=n.y+n.height/2-o.height/2,p=n[a]/2-o[a]/2;let h;switch(l){case"top":h={x:d,y:n.y-o.height};break;case"bottom":h={x:d,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:u};break;case"left":h={x:n.x-o.width,y:u};break;default:h={x:n.x,y:n.y}}switch(mt(e)){case"start":h[s]-=p*(i&&c?-1:1);break;case"end":h[s]+=p*(i&&c?-1:1)}return h}async function Et(t,e){var i;void 0===e&&(e={});const{x:n,y:o,platform:r,rects:s,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=!1,padding:h=0}=ft(e,t),f=St(h),g=a[p?"floating"===u?"reference":"floating":u],m=Rt(await r.getClippingRect({element:null==(i=await(null==r.isElement?void 0:r.isElement(g)))||i?g:g.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),w="floating"===u?{...s.floating,x:n,y:o}:s.reference,b=await(null==r.getOffsetParent?void 0:r.getOffsetParent(a.floating)),x=await(null==r.isElement?void 0:r.isElement(b))&&await(null==r.getScale?void 0:r.getScale(b))||{x:1,y:1},v=Rt(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:b,strategy:l}):w);return{top:(m.top-v.top+f.top)/x.y,bottom:(v.bottom-m.bottom+f.bottom)/x.y,left:(m.left-v.left+f.left)/x.x,right:(v.right-m.right+f.right)/x.x}}function Ct(t){const e=at(...t.map((t=>t.left))),i=at(...t.map((t=>t.top)));return{x:e,y:i,width:lt(...t.map((t=>t.right)))-e,height:lt(...t.map((t=>t.bottom)))-i}}const Ot=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var i,n;const{x:o,y:r,placement:s,middlewareData:a}=e,l=await async function(t,e){const{placement:i,platform:n,elements:o}=t,r=await(null==n.isRTL?void 0:n.isRTL(o.floating)),s=gt(i),a=mt(i),l="y"===xt(i),c=["left","top"].includes(s)?-1:1,d=r&&l?-1:1,u=ft(e,t);let{mainAxis:p,crossAxis:h,alignmentAxis:f}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return a&&"number"==typeof f&&(h="end"===a?-1*f:f),l?{x:h*d,y:p*c}:{x:p*c,y:h*d}}(e,t);return s===(null==(i=a.offset)?void 0:i.placement)&&null!=(n=a.arrow)&&n.alignmentOffset?{}:{x:o+l.x,y:r+l.y,data:{...l,placement:s}}}}};function kt(t){const e=it(t);let i=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const o=Z(t),r=o?t.offsetWidth:i,s=o?t.offsetHeight:n,a=ct(i)!==r||ct(n)!==s;return a&&(i=r,n=s),{width:i,height:n,$:a}}function Nt(t){return G(t)?t:t.contextElement}function Lt(t){const e=Nt(t);if(!Z(e))return dt(1);const i=e.getBoundingClientRect(),{width:n,height:o,$:r}=kt(e);let s=(r?ct(i.width):i.width)/n,a=(r?ct(i.height):i.height)/o;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const Mt=dt(0);function Wt(t){const e=$(t);return tt()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:Mt}function jt(t,e,i,n){void 0===e&&(e=!1),void 0===i&&(i=!1);const o=t.getBoundingClientRect(),r=Nt(t);let s=dt(1);e&&(n?G(n)&&(s=Lt(n)):s=Lt(t));const a=function(t,e,i){return void 0===e&&(e=!1),!(!i||e&&i!==$(t))&&e}(r,i,n)?Wt(r):dt(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,d=o.width/s.x,u=o.height/s.y;if(r){const t=$(r),e=n&&G(n)?$(n):n;let i=t,o=i.frameElement;for(;o&&n&&e!==i;){const t=Lt(o),e=o.getBoundingClientRect(),n=it(o),r=e.left+(o.clientLeft+parseFloat(n.paddingLeft))*t.x,s=e.top+(o.clientTop+parseFloat(n.paddingTop))*t.y;l*=t.x,c*=t.y,d*=t.x,u*=t.y,l+=r,c+=s,i=$(o),o=i.frameElement}}return Rt({width:d,height:u,x:l,y:c})}const Tt=[":popover-open",":modal"];function At(t){return Tt.some((e=>{try{return t.matches(e)}catch(t){return!1}}))}function Bt(t){return jt(X(t)).left+nt(t).scrollLeft}function It(t,e,i){let n;if("viewport"===e)n=function(t,e){const i=$(t),n=X(t),o=i.visualViewport;let r=n.clientWidth,s=n.clientHeight,a=0,l=0;if(o){r=o.width,s=o.height;const t=tt();(!t||t&&"fixed"===e)&&(a=o.offsetLeft,l=o.offsetTop)}return{width:r,height:s,x:a,y:l}}(t,i);else if("document"===e)n=function(t){const e=X(t),i=nt(t),n=t.ownerDocument.body,o=lt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=lt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-i.scrollLeft+Bt(t);const a=-i.scrollTop;return"rtl"===it(n).direction&&(s+=lt(e.clientWidth,n.clientWidth)-o),{width:o,height:r,x:s,y:a}}(X(t));else if(G(e))n=function(t,e){const i=jt(t,!0,"fixed"===e),n=i.top+t.clientTop,o=i.left+t.clientLeft,r=Z(t)?Lt(t):dt(1);return{width:t.clientWidth*r.x,height:t.clientHeight*r.y,x:o*r.x,y:n*r.y}}(e,i);else{const i=Wt(t);n={...e,x:e.x-i.x,y:e.y-i.y}}return Rt(n)}function Pt(t,e){const i=ot(t);return!(i===e||!G(i)||et(i))&&("fixed"===it(i).position||Pt(i,e))}function Ht(t,e,i){const n=Z(e),o=X(e),r="fixed"===i,s=jt(t,!0,r,e);let a={scrollLeft:0,scrollTop:0};const l=dt(0);if(n||!n&&!r)if(("body"!==U(e)||J(o))&&(a=nt(e)),n){const t=jt(e,!0,r,e);l.x=t.x+e.clientLeft,l.y=t.y+e.clientTop}else o&&(l.x=Bt(o));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function Dt(t,e){return Z(t)&&"fixed"!==it(t).position?e?e(t):t.offsetParent:null}function Ft(t,e){const i=$(t);if(!Z(t)||At(t))return i;let n=Dt(t,e);for(;n&&K(n)&&"static"===it(n).position;)n=Dt(n,e);return n&&("html"===U(n)||"body"===U(n)&&"static"===it(n).position&&!Q(n))?i:n||function(t){let e=ot(t);for(;Z(e)&&!et(e);){if(Q(e))return e;e=ot(e)}return null}(t)||i}const Vt={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:i,offsetParent:n,strategy:o}=t;const r="fixed"===o,s=X(n),a=!!e&&At(e.floating);if(n===s||a&&r)return i;let l={scrollLeft:0,scrollTop:0},c=dt(1);const d=dt(0),u=Z(n);if((u||!u&&!r)&&(("body"!==U(n)||J(s))&&(l=nt(n)),Z(n))){const t=jt(n);c=Lt(n),d.x=t.x+n.clientLeft,d.y=t.y+n.clientTop}return{width:i.width*c.x,height:i.height*c.y,x:i.x*c.x-l.scrollLeft*c.x+d.x,y:i.y*c.y-l.scrollTop*c.y+d.y}},getDocumentElement:X,getClippingRect:function(t){let{element:e,boundary:i,rootBoundary:n,strategy:o}=t;const r=[..."clippingAncestors"===i?function(t,e){const i=e.get(t);if(i)return i;let n=st(t,[],!1).filter((t=>G(t)&&"body"!==U(t))),o=null;const r="fixed"===it(t).position;let s=r?ot(t):t;for(;G(s)&&!et(s);){const e=it(s),i=Q(s);i||"fixed"!==e.position||(o=null),(r?!i&&!o:!i&&"static"===e.position&&o&&["absolute","fixed"].includes(o.position)||J(s)&&!i&&Pt(t,s))?n=n.filter((t=>t!==s)):o=e,s=ot(s)}return e.set(t,n),n}(e,this._c):[].concat(i),n],s=r[0],a=r.reduce(((t,i)=>{const n=It(e,i,o);return t.top=lt(n.top,t.top),t.right=at(n.right,t.right),t.bottom=at(n.bottom,t.bottom),t.left=lt(n.left,t.left),t}),It(e,s,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Ft,getElementRects:async function(t){const e=this.getOffsetParent||Ft,i=this.getDimensions;return{reference:Ht(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,...await i(t.floating)}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:i}=kt(t);return{width:e,height:i}},getScale:Lt,isElement:G,isRTL:function(t){return"rtl"===it(t).direction}},Ut=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:i,y:n,placement:o}=e,{mainAxis:r=!0,crossAxis:s=!1,limiter:a={fn:t=>{let{x:e,y:i}=t;return{x:e,y:i}}},...l}=ft(t,e),c={x:i,y:n},d=await Et(e,l),u=xt(gt(o)),p=wt(u);let h=c[p],f=c[u];if(r){const t="y"===p?"bottom":"right";h=ht(h+d["y"===p?"top":"left"],h,h-d[t])}if(s){const t="y"===u?"bottom":"right";f=ht(f+d["y"===u?"top":"left"],f,f-d[t])}const g=a.fn({...e,[p]:h,[u]:f});return{...g,data:{x:g.x-i,y:g.y-n}}}}},$t=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var i,n;const{placement:o,middlewareData:r,rects:s,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:g=!0,...m}=ft(t,e);if(null!=(i=r.arrow)&&i.alignmentOffset)return{};const w=gt(o),b=gt(a)===a,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),v=p||(b||!g?[zt(a)]:function(t){const e=zt(t);return[yt(t),e,yt(e)]}(a));p||"none"===f||v.push(...function(t,e,i,n){const o=mt(t);let r=function(t,e,i){const n=["left","right"],o=["right","left"],r=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return i?e?o:n:e?n:o;case"left":case"right":return e?r:s;default:return[]}}(gt(t),"start"===i,n);return o&&(r=r.map((t=>t+"-"+o)),e&&(r=r.concat(r.map(yt)))),r}(a,g,f,x));const y=[a,...v],z=await Et(e,m),S=[];let R=(null==(n=r.flip)?void 0:n.overflows)||[];if(d&&S.push(z[w]),u){const t=function(t,e,i){void 0===i&&(i=!1);const n=mt(t),o=vt(t),r=bt(o);let s="x"===o?n===(i?"end":"start")?"right":"left":"start"===n?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=zt(s)),[s,zt(s)]}(o,s,x);S.push(z[t[0]],z[t[1]])}if(R=[...R,{placement:o,overflows:S}],!S.every((t=>t<=0))){var _,E;const t=((null==(_=r.flip)?void 0:_.index)||0)+1,e=y[t];if(e)return{data:{index:t,overflows:R},reset:{placement:e}};let i=null==(E=R.filter((t=>t.overflows[0]<=0)).sort(((t,e)=>t.overflows[1]-e.overflows[1]))[0])?void 0:E.placement;if(!i)switch(h){case"bestFit":{var C;const t=null==(C=R.map((t=>[t.placement,t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)])).sort(((t,e)=>t[1]-e[1]))[0])?void 0:C[0];t&&(i=t);break}case"initialPlacement":i=a}if(o!==i)return{reset:{placement:i}}}return{}}}},Xt=function(t){return void 0===t&&(t={}),{name:"inline",options:t,async fn(e){const{placement:i,elements:n,rects:o,platform:r,strategy:s}=e,{padding:a=2,x:l,y:c}=ft(t,e),d=Array.from(await(null==r.getClientRects?void 0:r.getClientRects(n.reference))||[]),u=function(t){const e=t.slice().sort(((t,e)=>t.y-e.y)),i=[];let n=null;for(let t=0;t<e.length;t++){const o=e[t];!n||o.y-n.y>n.height/2?i.push([o]):i[i.length-1].push(o),n=o}return i.map((t=>Rt(Ct(t))))}(d),p=Rt(Ct(d)),h=St(a);const f=await r.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=l&&null!=c)return u.find((t=>l>t.left-h.left&&l<t.right+h.right&&c>t.top-h.top&&c<t.bottom+h.bottom))||p;if(u.length>=2){if("y"===xt(i)){const t=u[0],e=u[u.length-1],n="top"===gt(i),o=t.top,r=e.bottom,s=n?t.left:e.left,a=n?t.right:e.right;return{top:o,bottom:r,left:s,right:a,width:a-s,height:r-o,x:s,y:o}}const t="left"===gt(i),e=lt(...u.map((t=>t.right))),n=at(...u.map((t=>t.left))),o=u.filter((i=>t?i.left===n:i.right===e)),r=o[0].top,s=o[o.length-1].bottom;return{top:r,bottom:s,left:n,right:e,width:e-n,height:s-r,x:n,y:r}}return p}},floating:n.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}}:{}}}},Yt=(t,e,i)=>{const n=new Map,o={platform:Vt,...i},r={...o.platform,_c:n};return(async(t,e,i)=>{const{placement:n="bottom",strategy:o="absolute",middleware:r=[],platform:s}=i,a=r.filter(Boolean),l=await(null==s.isRTL?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:d,y:u}=_t(c,n,l),p=n,h={},f=0;for(let i=0;i<a.length;i++){const{name:r,fn:g}=a[i],{x:m,y:w,data:b,reset:x}=await g({x:d,y:u,initialPlacement:n,placement:p,strategy:o,middlewareData:h,rects:c,platform:s,elements:{reference:t,floating:e}});d=null!=m?m:d,u=null!=w?w:u,h={...h,[r]:{...h[r],...b}},x&&f<=50&&(f++,"object"==typeof x&&(x.placement&&(p=x.placement),x.rects&&(c=!0===x.rects?await s.getElementRects({reference:t,floating:e,strategy:o}):x.rects),({x:d,y:u}=_t(c,p,l))),i=-1)}return{x:d,y:u,placement:p,strategy:o,middlewareData:h}})(t,e,{...o,platform:r})};var Gt="undefined"!=typeof document?p:d;function Zt(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if("function"==typeof t&&t.toString()===e.toString())return!0;let i,n,o;if(t&&e&&"object"==typeof t){if(Array.isArray(t)){if(i=t.length,i!==e.length)return!1;for(n=i;0!=n--;)if(!Zt(t[n],e[n]))return!1;return!0}if(o=Object.keys(t),i=o.length,i!==Object.keys(e).length)return!1;for(n=i;0!=n--;)if(!{}.hasOwnProperty.call(e,o[n]))return!1;for(n=i;0!=n--;){const i=o[n];if(("_owner"!==i||!t.$$typeof)&&!Zt(t[i],e[i]))return!1}return!0}return t!=t&&e!=e}function qt(t){if("undefined"==typeof window)return 1;return(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Jt(t,e){const i=qt(t);return Math.round(e*i)/i}function Kt(t){const e=l.useRef(t);return Gt((()=>{e.current=t})),e}
|
|
2
|
+
/*!
|
|
3
|
+
* tabbable 6.2.0
|
|
4
|
+
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
|
+
*/
|
|
6
|
+
var Qt=["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(","),te="undefined"==typeof Element,ee=te?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ie=!te&&Element.prototype.getRootNode?function(t){var e;return null==t||null===(e=t.getRootNode)||void 0===e?void 0:e.call(t)}:function(t){return null==t?void 0:t.ownerDocument},ne=function t(e,i){var n;void 0===i&&(i=!0);var o=null==e||null===(n=e.getAttribute)||void 0===n?void 0:n.call(e,"inert");return""===o||"true"===o||i&&e&&t(e.parentNode)},oe=function t(e,i,n){for(var o=[],r=Array.from(e);r.length;){var s=r.shift();if(!ne(s,!1))if("SLOT"===s.tagName){var a=s.assignedElements(),l=t(a.length?a:s.children,!0,n);n.flatten?o.push.apply(o,l):o.push({scopeParent:s,candidates:l})}else{ee.call(s,Qt)&&n.filter(s)&&(i||!e.includes(s))&&o.push(s);var c=s.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(s),d=!ne(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(s));if(c&&d){var u=t(!0===c?s.children:c.children,!0,n);n.flatten?o.push.apply(o,u):o.push({scopeParent:s,candidates:u})}else r.unshift.apply(r,s.children)}}return o},re=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},se=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||function(t){var e,i=null==t||null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return""===i||"true"===i}(t))&&!re(t)?0:t.tabIndex},ae=function(t,e){return t.tabIndex===e.tabIndex?t.documentOrder-e.documentOrder:t.tabIndex-e.tabIndex},le=function(t){return"INPUT"===t.tagName},ce=function(t){return function(t){return le(t)&&"radio"===t.type}(t)&&!function(t){if(!t.name)return!0;var e,i=t.form||ie(t),n=function(t){return i.querySelectorAll('input[type="radio"][name="'+t+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)e=n(window.CSS.escape(t.name));else try{e=n(t.name)}catch(t){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",t.message),!1}var o=function(t,e){for(var i=0;i<t.length;i++)if(t[i].checked&&t[i].form===e)return t[i]}(e,t.form);return!o||o===t}(t)},de=function(t){var e=t.getBoundingClientRect(),i=e.width,n=e.height;return 0===i&&0===n},ue=function(t,e){var i=e.displayCheck,n=e.getShadowRoot;if("hidden"===getComputedStyle(t).visibility)return!0;var o=ee.call(t,"details>summary:first-of-type")?t.parentElement:t;if(ee.call(o,"details:not([open]) *"))return!0;if(i&&"full"!==i&&"legacy-full"!==i){if("non-zero-area"===i)return de(t)}else{if("function"==typeof n){for(var r=t;t;){var s=t.parentElement,a=ie(t);if(s&&!s.shadowRoot&&!0===n(s))return de(t);t=t.assignedSlot?t.assignedSlot:s||a===t.ownerDocument?s:a.host}t=r}if(function(t){var e,i,n,o,r=t&&ie(t),s=null===(e=r)||void 0===e?void 0:e.host,a=!1;if(r&&r!==t)for(a=!!(null!==(i=s)&&void 0!==i&&null!==(n=i.ownerDocument)&&void 0!==n&&n.contains(s)||null!=t&&null!==(o=t.ownerDocument)&&void 0!==o&&o.contains(t));!a&&s;){var l,c,d;a=!(null===(c=s=null===(l=r=ie(s))||void 0===l?void 0:l.host)||void 0===c||null===(d=c.ownerDocument)||void 0===d||!d.contains(s))}return a}(t))return!t.getClientRects().length;if("legacy-full"!==i)return!0}return!1},pe=function(t,e){return!(e.disabled||ne(e)||function(t){return le(t)&&"hidden"===t.type}(e)||ue(e,t)||function(t){return"DETAILS"===t.tagName&&Array.prototype.slice.apply(t.children).some((function(t){return"SUMMARY"===t.tagName}))}(e)||function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var e=t.parentElement;e;){if("FIELDSET"===e.tagName&&e.disabled){for(var i=0;i<e.children.length;i++){var n=e.children.item(i);if("LEGEND"===n.tagName)return!!ee.call(e,"fieldset[disabled] *")||!n.contains(t)}return!0}e=e.parentElement}return!1}(e))},he=function(t,e){return!(ce(e)||se(e)<0||!pe(t,e))},fe=function(t){var e=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(e)||e>=0)},ge=function t(e){var i=[],n=[];return e.forEach((function(e,o){var r=!!e.scopeParent,s=r?e.scopeParent:e,a=function(t,e){var i=se(t);return i<0&&e&&!re(t)?0:i}(s,r),l=r?t(e.candidates):s;0===a?r?i.push.apply(i,l):i.push(s):n.push({documentOrder:o,tabIndex:a,item:e,isScope:r,content:l})})),n.sort(ae).reduce((function(t,e){return e.isScope?t.push.apply(t,e.content):t.push(e.content),t}),[]).concat(i)},me=function(t,e){var i;return i=(e=e||{}).getShadowRoot?oe([t],e.includeContainer,{filter:he.bind(null,e),flatten:!1,getShadowRoot:e.getShadowRoot,shadowRootFilter:fe}):function(t,e,i){if(ne(t))return[];var n=Array.prototype.slice.apply(t.querySelectorAll(Qt));return e&&ee.call(t,Qt)&&n.unshift(t),n.filter(i)}(t,e.includeContainer,he.bind(null,e)),ge(i)};const we=l["useInsertionEffect".toString()]||(t=>t());var be="undefined"!=typeof document?p:d;function xe(){return xe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},xe.apply(this,arguments)}let ve=!1,ye=0;const ze=()=>"floating-ui-"+ye++;const Se=l["useId".toString()]||function(){const[t,e]=l.useState((()=>ve?ze():void 0));return be((()=>{null==t&&e(ze())}),[]),l.useEffect((()=>{ve||(ve=!0)}),[]),t};const Re=l.createContext(null),_e=l.createContext(null);function Ee(t){return"data-floating-ui-"+t}const Ce=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Oe(t,e){const i=me(t,Ce());"prev"===e&&i.reverse();const n=i.indexOf(function(t){let e=t.activeElement;for(;null!=(null==(i=e)||null==(i=i.shadowRoot)?void 0:i.activeElement);){var i;e=e.shadowRoot.activeElement}return e}((null==(o=t)?void 0:o.ownerDocument)||document));var o;return i.slice(n+1)[0]}function ke(t,e){const i=e||t.currentTarget,n=t.relatedTarget;return!n||!function(t,e){if(!t||!e)return!1;const i=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(i&&q(i)){let i=e;for(;i;){if(t===i)return!0;i=i.parentNode||i.host}}return!1}(i,n)}function Ne(t){me(t,Ce()).forEach((t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")}))}function Le(t){t.querySelectorAll("[data-tabindex]").forEach((t=>{const e=t.dataset.tabindex;delete t.dataset.tabindex,e?t.setAttribute("tabindex",e):t.removeAttribute("tabindex")}))}const Me={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 We(t){"Tab"===t.key&&(t.target,clearTimeout(undefined))}const je=l.forwardRef((function(t,e){const[i,n]=l.useState();be((()=>(/apple/i.test(navigator.vendor)&&n("button"),document.addEventListener("keydown",We),()=>{document.removeEventListener("keydown",We)})),[]);const o={ref:e,tabIndex:0,role:i,"aria-hidden":!i||void 0,[Ee("focus-guard")]:"",style:Me};return l.createElement("span",xe({},t,o))})),Te=l.createContext(null),Ae=Ee("portal");function Be(t){let{children:e,id:i,root:n=null,preserveTabOrder:o=!0}=t;const r=function(t){let{id:e,root:i}=void 0===t?{}:t;const[n,o]=l.useState(null),r=Se(),s=Ie(),a=l.useRef(null);return be((()=>()=>{null==n||n.remove(),queueMicrotask((()=>{a.current=null}))}),[n]),be((()=>{if(a.current)return;const t=e?document.getElementById(e):null;if(!t)return;const i=document.createElement("div");i.id=r,i.setAttribute(Ae,""),t.appendChild(i),a.current=i,o(i)}),[e,r]),be((()=>{if(a.current)return;let t=i||(null==s?void 0:s.portalNode);t&&!G(t)&&(t=t.current),t=t||document.body;let n=null;e&&(n=document.createElement("div"),n.id=e,t.appendChild(n));const l=document.createElement("div");l.id=r,l.setAttribute(Ae,""),t=n||t,t.appendChild(l),a.current=l,o(l)}),[e,i,r,s]),n}({id:i,root:n}),[s,a]=l.useState(null),c=l.useRef(null),d=l.useRef(null),u=l.useRef(null),p=l.useRef(null),h=!!s&&!s.modal&&s.open&&o&&!(!n&&!r);return l.useEffect((()=>{if(r&&o&&(null==s||!s.modal))return r.addEventListener("focusin",t,!0),r.addEventListener("focusout",t,!0),()=>{r.removeEventListener("focusin",t,!0),r.removeEventListener("focusout",t,!0)};function t(t){if(r&&ke(t)){("focusin"===t.type?Le:Ne)(r)}}}),[r,o,null==s?void 0:s.modal]),l.createElement(Te.Provider,{value:l.useMemo((()=>({preserveTabOrder:o,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:p,portalNode:r,setFocusManagerState:a})),[o,r])},h&&r&&l.createElement(je,{"data-type":"outside",ref:c,onFocus:t=>{if(ke(t,r)){var e;null==(e=u.current)||e.focus()}else{const t=Oe(document.body,"prev")||(null==s?void 0:s.refs.domReference.current);null==t||t.focus()}}}),h&&r&&l.createElement("span",{"aria-owns":r.id,style:Me}),r&&b(e,r),h&&r&&l.createElement(je,{"data-type":"outside",ref:d,onFocus:t=>{if(ke(t,r)){var e;null==(e=p.current)||e.focus()}else{const e=Oe(document.body,"next")||(null==s?void 0:s.refs.domReference.current);null==e||e.focus(),(null==s?void 0:s.closeOnFocusOut)&&(null==s||s.onOpenChange(!1,t.nativeEvent))}}}))}const Ie=()=>l.useContext(Te),Pe=new Set,He=l.forwardRef((function(t,e){let{lockScroll:i=!1,...n}=t;const o=Se();return be((()=>{if(!i)return;Pe.add(o);const t=/iP(hone|ad|od)|iOS/.test(function(){const t=navigator.userAgentData;return null!=t&&t.platform?t.platform:navigator.platform}()),e=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",r=window.innerWidth-document.documentElement.clientWidth,s=e.left?parseFloat(e.left):window.pageXOffset,a=e.top?parseFloat(e.top):window.pageYOffset;if(e.overflow="hidden",r&&(e[n]=r+"px"),t){var l,c;const t=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,i=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(e,{position:"fixed",top:-(a-Math.floor(i))+"px",left:-(s-Math.floor(t))+"px",right:"0"})}return()=>{Pe.delete(o),0===Pe.size&&(Object.assign(e,{overflow:"",[n]:""}),t&&(Object.assign(e,{position:"",top:"",left:"",right:""}),window.scrollTo(s,a)))}}),[o,i]),l.createElement("div",xe({ref:e},n,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...n.style}}))}));function De(t){var e;void 0===t&&(t={});const{open:i=!1,onOpenChange:n,nodeId:o}=t,[r,s]=l.useState(null),a=(null==(e=t.elements)?void 0:e.reference)||r,c=function(t){void 0===t&&(t={});const{placement:e="bottom",strategy:i="absolute",middleware:n=[],platform:o,elements:{reference:r,floating:s}={},transform:a=!0,whileElementsMounted:c,open:d}=t,[u,p]=l.useState({x:0,y:0,strategy:i,placement:e,middlewareData:{},isPositioned:!1}),[h,f]=l.useState(n);Zt(h,n)||f(n);const[g,w]=l.useState(null),[b,x]=l.useState(null),v=l.useCallback((t=>{t!==R.current&&(R.current=t,w(t))}),[]),y=l.useCallback((t=>{t!==_.current&&(_.current=t,x(t))}),[]),z=r||g,S=s||b,R=l.useRef(null),_=l.useRef(null),E=l.useRef(u),C=null!=c,O=Kt(c),k=Kt(o),N=l.useCallback((()=>{if(!R.current||!_.current)return;const t={placement:e,strategy:i,middleware:h};k.current&&(t.platform=k.current),Yt(R.current,_.current,t).then((t=>{const e={...t,isPositioned:!0};L.current&&!Zt(E.current,e)&&(E.current=e,m.flushSync((()=>{p(e)})))}))}),[h,e,i,k]);Gt((()=>{!1===d&&E.current.isPositioned&&(E.current.isPositioned=!1,p((t=>({...t,isPositioned:!1}))))}),[d]);const L=l.useRef(!1);Gt((()=>(L.current=!0,()=>{L.current=!1})),[]),Gt((()=>{if(z&&(R.current=z),S&&(_.current=S),z&&S){if(O.current)return O.current(z,S,N);N()}}),[z,S,N,O,C]);const M=l.useMemo((()=>({reference:R,floating:_,setReference:v,setFloating:y})),[v,y]),W=l.useMemo((()=>({reference:z,floating:S})),[z,S]),j=l.useMemo((()=>{const t={position:i,left:0,top:0};if(!W.floating)return t;const e=Jt(W.floating,u.x),n=Jt(W.floating,u.y);return a?{...t,transform:"translate("+e+"px, "+n+"px)",...qt(W.floating)>=1.5&&{willChange:"transform"}}:{position:i,left:e,top:n}}),[i,a,W.floating,u.x,u.y]);return l.useMemo((()=>({...u,update:N,refs:M,elements:W,floatingStyles:j})),[u,N,M,W,j])}(t),d=l.useContext(_e),u=null!=((null==(p=l.useContext(Re))?void 0:p.id)||null);var p;const h=function(t){const e=l.useRef((()=>{}));return we((()=>{e.current=t})),l.useCallback((function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return null==e.current?void 0:e.current(...i)}),[])}(((t,e,i)=>{t&&(g.current.openEvent=e),w.emit("openchange",{open:t,event:e,reason:i,nested:u}),null==n||n(t,e,i)})),f=l.useRef(null),g=l.useRef({}),w=l.useState((()=>function(){const t=new Map;return{emit(e,i){var n;null==(n=t.get(e))||n.forEach((t=>t(i)))},on(e,i){t.set(e,[...t.get(e)||[],i])},off(e,i){var n;t.set(e,(null==(n=t.get(e))?void 0:n.filter((t=>t!==i)))||[])}}}()))[0],b=Se(),x=l.useCallback((t=>{const e=G(t)?{getBoundingClientRect:()=>t.getBoundingClientRect(),contextElement:t}:t;c.refs.setReference(e)}),[c.refs]),v=l.useCallback((t=>{(G(t)||null===t)&&(f.current=t,s(t)),(G(c.refs.reference.current)||null===c.refs.reference.current||null!==t&&!G(t))&&c.refs.setReference(t)}),[c.refs]),y=l.useMemo((()=>({...c.refs,setReference:v,setPositionReference:x,domReference:f})),[c.refs,v,x]),z=l.useMemo((()=>({...c.elements,domReference:a})),[c.elements,a]),S=l.useMemo((()=>({...c,refs:y,elements:z,dataRef:g,nodeId:o,floatingId:b,events:w,open:i,onOpenChange:h})),[c,o,b,w,i,h,y,z]);return be((()=>{const t=null==d?void 0:d.nodesRef.current.find((t=>t.id===o));t&&(t.context=S)})),l.useMemo((()=>({...c,context:S,refs:y,elements:z})),[c,y,z,S])}function Fe(t,e){if(null==t)return{};var i,n,o={},r=Object.keys(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||(o[i]=t[i]);return o}var Ve=["color"],Ue=h((function(t,e){var i=t.color,n=void 0===i?"currentColor":i,o=Fe(t,Ve);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:e}),f("path",{d:"M9.96424 2.68571C10.0668 2.42931 9.94209 2.13833 9.6857 2.03577C9.4293 1.93322 9.13832 2.05792 9.03576 2.31432L5.03576 12.3143C4.9332 12.5707 5.05791 12.8617 5.3143 12.9642C5.5707 13.0668 5.86168 12.9421 5.96424 12.6857L9.96424 2.68571ZM3.85355 5.14646C4.04882 5.34172 4.04882 5.6583 3.85355 5.85356L2.20711 7.50001L3.85355 9.14646C4.04882 9.34172 4.04882 9.6583 3.85355 9.85356C3.65829 10.0488 3.34171 10.0488 3.14645 9.85356L1.14645 7.85356C0.951184 7.6583 0.951184 7.34172 1.14645 7.14646L3.14645 5.14646C3.34171 4.9512 3.65829 4.9512 3.85355 5.14646ZM11.1464 5.14646C11.3417 4.9512 11.6583 4.9512 11.8536 5.14646L13.8536 7.14646C14.0488 7.34172 14.0488 7.6583 13.8536 7.85356L11.8536 9.85356C11.6583 10.0488 11.3417 10.0488 11.1464 9.85356C10.9512 9.6583 10.9512 9.34172 11.1464 9.14646L12.7929 7.50001L11.1464 5.85356C10.9512 5.6583 10.9512 5.34172 11.1464 5.14646Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))})),$e=["color"],Xe=h((function(t,e){var i=t.color,n=void 0===i?"currentColor":i,o=Fe(t,$e);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:e}),f("path",{d:"M3 2C2.44772 2 2 2.44772 2 3V12C2 12.5523 2.44772 13 3 13H12C12.5523 13 13 12.5523 13 12V8.5C13 8.22386 12.7761 8 12.5 8C12.2239 8 12 8.22386 12 8.5V12H3V3L6.5 3C6.77614 3 7 2.77614 7 2.5C7 2.22386 6.77614 2 6.5 2H3ZM12.8536 2.14645C12.9015 2.19439 12.9377 2.24964 12.9621 2.30861C12.9861 2.36669 12.9996 2.4303 13 2.497L13 2.5V2.50049V5.5C13 5.77614 12.7761 6 12.5 6C12.2239 6 12 5.77614 12 5.5V3.70711L6.85355 8.85355C6.65829 9.04882 6.34171 9.04882 6.14645 8.85355C5.95118 8.65829 5.95118 8.34171 6.14645 8.14645L11.2929 3H9.5C9.22386 3 9 2.77614 9 2.5C9 2.22386 9.22386 2 9.5 2H12.4999H12.5C12.5678 2 12.6324 2.01349 12.6914 2.03794C12.7504 2.06234 12.8056 2.09851 12.8536 2.14645Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}));const Ye={youtube:t=>{const e=t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return e&&11===e[2].length?e[2]:null},vimeo:t=>new URL(t).pathname.split("/")[1],dailymotion:t=>{const e=t.match(/^.+dailymotion.com\/(embed|hub)\/([^_]+)[^#]*(#embed=([^_&]+))?/);return null!==e?void 0!==e[4]?e[4]:e[2]:null},twitter:function(t){const e=t.match(/\/status\/(\d+)/);return e?e[1]:null},figma:function(t){const e=new URL(t).searchParams,i=e.get("node-id");return e.get("node-id")?i:"unknown"}},Ge=({blockId:e,onClose:i})=>{const n=t(),[o,r]=c(""),l=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:[a("input",{type:"text",placeholder:"Paste embed 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:t=>r(t.target.value)}),a("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:l,onClick:()=>{var t;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":s.includes("twitter")?"twitter":s.includes("figma")?"figma":null;var s;const a=r?null===(t=Ye[r])||void 0===t?void 0:t.call(Ye,o):null,l={type:r,id:a};r&&a||(l.url=o,l.id=o),n.blocks.Embed.updateElement(e,"embed",{provider:l}),i()}},{children:"Embed embed"}))]}))},Ze=({floatingStyles:t,refs:e,onClose:i,blockId:n})=>a(Be,Object.assign({root:document.getElementById("yoopta-editor")},{children:a(He,Object.assign({lockScroll:!0,className:"z-[100]",onClick:i},{children:a("div",Object.assign({ref:e.setFloating,style:t,onClick:t=>t.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:[a("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:a("button",Object.assign({type:"button",style:{borderBottom:"2px solid #2483e2"},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:"Embed link"}))})),a("div",Object.assign({className:"pt-[6px] pb-[6px] mt-[4px] flex justify-center mr-[12px] ml-[12px]"},{children:a(Ge,{onClose:i,blockId:n})}))]}))}))}))})),qe=({attributes:t,children:e,blockId:i})=>{const[n,o]=c(!1),{refs:r,floatingStyles:l}=De({placement:"bottom",open:n,onOpenChange:o,middleware:[Xt(),$t(),Ut(),Ot(10)]});return s("div",Object.assign({className:"w-full user-select-none m-[20px_0_10px] relative flex"},t,{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),ref:r.setReference},{children:[a(Ue,{className:"mr-2 user-select-none",width:24,height:24}),a("span",Object.assign({className:"font-medium"},{children:"Click to add embed"}))]})),n&&a(Ze,{blockId:i,floatingStyles:l,refs:r,onClose:()=>o(!1)}),e]}))},{ExtendedBlockActions:Je,BlockOptionsMenuGroup:Ke,BlockOptionsMenuItem:Qe,BlockOptionsSeparator:ti}=e,ei=({editor:t,block:e,props:i})=>s(Je,Object.assign({onClick:()=>t.setSelection([e.meta.order])},{children:[a(ti,{}),a(Ke,{children:a(Qe,{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:()=>{var t;window.open(null===(t=null==i?void 0:i.provider)||void 0===t?void 0:t.url,"_blank")}},{children:[a(Xe,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Open"]}))})})]})),ii=({position:t})=>a("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"===t?"left-0 top-0":"right-0 top-0")},{children:a("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]"})})),ni=new r({type:"Embed",elements:{embed:{render:({element:e,attributes:r,children:l,blockId:u})=>{const{sizes:p,provider:h}=e.props||{},f=i(u),m=t(),w=n("Embed"),[b,x]=c({width:(null==p?void 0:p.width)||750,height:(null==p?void 0:p.height)||440});d((()=>x({width:(null==p?void 0:p.width)||650,height:(null==p?void 0:p.height)||440})),[e.props]);const v=o({blockId:u});const y=g((()=>{var t,e;return{minWidth:300,size:{width:b.width,height:b.height},maxWidth:(null===(t=null==w?void 0:w.maxSizes)||void 0===t?void 0:t.maxWidth)||800,maxHeight:(null===(e=null==w?void 0:w.maxSizes)||void 0===e?void 0:e.maxHeight)||720,lockAspectRatio:!0,resizeRatio:2,enable:{left:!0,right:!0},handleStyles:{left:{left:0},right:{right:0}},onResize:(t,e,i)=>{x({width:i.offsetWidth,height:i.offsetHeight})},onResizeStop:(t,e,i)=>{m.blocks.Embed.updateElement(u,"embed",{sizes:{width:i.offsetWidth,height:i.offsetHeight}})},handleComponent:{left:a(ii,{position:"left"}),right:a(ii,{position:"right"})}}}),[b.width,b.height]);return h&&(null==h?void 0:h.id)?a("div",Object.assign({contentEditable:!1,draggable:!1,className:"mt-4 relative"},r,{children:s(V,Object.assign({},y,{className:"mx-auto my-0 flex"},{children:[v&&a("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"}),a(z,{width:null==b?void 0:b.width,height:null==b?void 0:b.height,provider:h,blockId:u}),a(ei,{block:f,editor:m,props:e.props}),l]}))})):a(qe,Object.assign({attributes:r,blockId:u},{children:l}))},props:{sizes:{width:650,height:400},nodeType:"void"}}},options:{displayLabel:"Embed",maxSizes:{maxWidth:650,maxHeight:550}}});!function(t,e){void 0===e&&(e={});var i=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}}(".pointer-events-none{pointer-events:none}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.z-10{z-index:10}.z-\\[100\\]{z-index:100}.z-\\[81\\]{z-index:81}.m-\\[12px_0_6px\\]{margin:12px 0 6px}.m-\\[20px_0_10px\\]{margin:20px 0 10px}.mx-\\[4px\\]{margin-left:4px;margin-right:4px}.mx-auto{margin-left:auto;margin-right:auto}.my-0{margin-bottom:0;margin-top:0}.ml-\\[12px\\]{margin-left:12px}.mr-2{margin-right:.5rem}.mr-\\[12px\\]{margin-right:12px}.mt-4{margin-top:1rem}.mt-\\[4px\\]{margin-top:4px}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.h-4{height:1rem}.h-\\[28px\\]{height:28px}.h-\\[32px\\]{height:32px}.h-\\[40px\\]{height:40px}.h-\\[48px\\]{height:48px}.h-full{height:100%}.max-h-\\[420px\\]{max-height:420px}.max-h-\\[50\\%\\]{max-height:50%}.w-4{width:1rem}.w-\\[15px\\]{width:15px}.w-\\[6px\\]{width:6px}.w-full{width:100%}.min-w-0{min-width:0}.min-w-\\[540px\\]{min-width:540px}.max-w-\\[300px\\]{max-width:300px}.max-w-\\[calc\\(100vw-24px\\)\\]{max-width:calc(100vw - 24px)}.flex-shrink-0{flex-shrink:0}.cursor-col-resize{cursor:col-resize}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-center{justify-content:center}.overflow-hidden{overflow:hidden}.whitespace-nowrap{white-space:nowrap}.rounded-\\[20px\\]{border-radius:20px}.rounded-\\[3px\\]{border-radius:3px}.rounded-\\[4px\\]{border-radius:4px}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-none{border-style:none}.border-\\[rgba\\(255\\2c 255\\2c 255\\2c 0\\.9\\)\\]{border-color:hsla(0,0%,100%,.9)}.bg-\\[\\#efefef\\]{--tw-bg-opacity:1;background-color:rgb(239 239 239/var(--tw-bg-opacity))}.bg-\\[hsla\\(45\\2c 13\\%\\2c 94\\%\\2c \\.6\\)\\]{background-color:hsla(45,13%,94%,.6)}.bg-\\[rgb\\(35\\2c 131\\2c 226\\)\\]{--tw-bg-opacity:1;background-color:rgb(35 131 226/var(--tw-bg-opacity))}.bg-\\[rgba\\(15\\2c 15\\2c 15\\2c 0\\.6\\)\\]{background-color:hsla(0,0%,6%,.6)}.bg-\\[rgba\\(35\\2c 131\\2c 226\\2c 0\\.14\\)\\]{background-color:rgba(35,131,226,.14)}.bg-inherit{background-color:inherit}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.fill-white{fill:#fff}.p-\\[0_8px\\]{padding:0 8px}.p-\\[12px_36px_12px_12px\\]{padding:12px 36px 12px 12px}.px-2{padding-left:.5rem;padding-right:.5rem}.px-\\[12px\\]{padding-left:12px;padding-right:12px}.px-\\[6px\\]{padding-left:6px;padding-right:6px}.px-\\[8px\\]{padding-left:8px;padding-right:8px}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.py-\\[6px\\]{padding-top:6px}.pb-\\[6px\\],.py-\\[6px\\]{padding-bottom:6px}.pt-\\[6px\\]{padding-top:6px}.text-left{text-align:left}.text-\\[14px\\]{font-size:14px}.font-medium{font-weight:500}.leading-\\[1\\.2\\]{line-height:1.2}.leading-\\[120\\%\\]{line-height:120%}.leading-\\[20px\\]{line-height:20px}.text-\\[rgb\\(55\\2c 53\\2c 47\\)\\]{--tw-text-opacity:1;color:rgb(55 53 47/var(--tw-text-opacity))}.text-\\[rgba\\(55\\2c 53\\2c 47\\2c 0\\.65\\)\\]{color:rgba(55,53,47,.65)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.opacity-100{opacity:1}.shadow-\\[0_0_0_\\.5px_\\#FFF\\]{--tw-shadow:0 0 0 .5px #fff;--tw-shadow-colored:0 0 0 .5px var(--tw-shadow-color)}.shadow-\\[0_0_0_\\.5px_\\#FFF\\],.shadow-\\[inset_0_0_0_1px_hsla\\(0\\2c 0\\%\\2c 6\\%\\2c \\.1\\)\\]{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-\\[inset_0_0_0_1px_hsla\\(0\\2c 0\\%\\2c 6\\%\\2c \\.1\\)\\]{--tw-shadow:inset 0 0 0 1px hsla(0,0%,6%,.1);--tw-shadow-colored:inset 0 0 0 1px var(--tw-shadow-color)}.shadow-\\[rgb\\(15_15_15_\\/5\\%\\)_0px_0px_0px_1px\\2c _rgb\\(15_15_15_\\/10\\%\\)_0px_3px_6px\\2c _rgb\\(15_15_15_\\/20\\%\\)_0px_9px_24px\\]{--tw-shadow:rgb(15 15 15/5%) 0px 0px 0px 1px,hsla(0,0%,6%,.1) 0px 3px 6px,hsla(0,0%,6%,.2) 0px 9px 24px;--tw-shadow-colored:0px 0px 0px 1px var(--tw-shadow-color),0px 3px 6px var(--tw-shadow-color),0px 9px 24px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-\\[rgb\\(55_53_47_\\/9\\%\\)_0px_-1px_0px_inset\\]{--tw-shadow:rgb(55 53 47/9%) 0px -1px 0px inset;--tw-shadow-colored:inset 0px -1px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-\\[rgba\\(15\\2c 15\\2c 15\\2c 0\\.1\\)_0px_0px_0px_1px_inset\\2c _rgba\\(15\\2c 15\\2c 15\\2c 0\\.1\\)_0px_1px_2px\\]{--tw-shadow:hsla(0,0%,6%,.1) 0px 0px 0px 1px inset,hsla(0,0%,6%,.1) 0px 1px 2px;--tw-shadow-colored:inset 0px 0px 0px 1px var(--tw-shadow-color),0px 1px 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.transition-\\[background-color_100ms_ease-in\\]{transition-duration:.15s;transition-property:background-color .1s ease-in;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\\[height_20ms_ease-in\\]{transition-duration:.15s;transition-property:height 20ms ease-in;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-150,.transition-opacity{transition-duration:.15s}.duration-300{transition-duration:.3s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.hover\\:bg-\\[\\#37352f14\\]:hover{background-color:#37352f14}.hover\\:bg-\\[\\#e3e3e3\\]:hover{--tw-bg-opacity:1;background-color:rgb(227 227 227/var(--tw-bg-opacity))}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-\\[rgba\\(35\\2c 131\\2c 226\\2c 0\\.5\\)\\]:disabled{background-color:rgba(35,131,226,.5)}");export{ni as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAuB,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGtF,QAAA,MAAM,KAAK,8DAmBT,CAAC;AAEH,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DailyMotion.d.ts","sourceRoot":"","sources":["../../src/providers/DailyMotion.tsx"],"names":[],"mappings":";AAKA,iBAAS,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE;;;CAAA,eA2CzC;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Figma.d.ts","sourceRoot":"","sources":["../../src/providers/Figma.tsx"],"names":[],"mappings":";AAGA,QAAA,MAAM,KAAK;;iBAoBV,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { EmbedProvider } from '../types';
|
|
3
|
+
type Props = {
|
|
4
|
+
provider: EmbedProvider;
|
|
5
|
+
blockId: string;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
};
|
|
9
|
+
declare function Twitter({ provider, blockId }: Props): JSX.Element;
|
|
10
|
+
export default Twitter;
|
|
11
|
+
//# sourceMappingURL=Twitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Twitter.d.ts","sourceRoot":"","sources":["../../src/providers/Twitter.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,iBAAS,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,KAAK,eAwC5C;AAED,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Vimeo.d.ts","sourceRoot":"","sources":["../../src/providers/Vimeo.tsx"],"names":[],"mappings":";AAKA,iBAAS,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE;;;CAAA,eA4CnC;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Youtube.d.ts","sourceRoot":"","sources":["../../src/providers/Youtube.tsx"],"names":[],"mappings":";AAGA,iBAAS,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE;;;CAAA,eAoCrC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type SlateElement } from '@yoopta/editor';
|
|
2
|
+
export type EmbedSizes = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
export type EmbedProviderTypes = 'youtube' | 'vimeo' | 'dailymotion' | 'twitter' | 'figma' | string | null;
|
|
7
|
+
export type EmbedProvider = {
|
|
8
|
+
type: EmbedProviderTypes;
|
|
9
|
+
id: string;
|
|
10
|
+
url?: string;
|
|
11
|
+
};
|
|
12
|
+
export type EmbedElementProps = {
|
|
13
|
+
sizes?: EmbedSizes;
|
|
14
|
+
provider?: EmbedProvider;
|
|
15
|
+
};
|
|
16
|
+
export type EmbedPluginElements = 'embed';
|
|
17
|
+
export type EmbedElement = SlateElement<'embed', EmbedElementProps>;
|
|
2
18
|
export type EmbedPluginOptions = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export type EmbedElementData = {
|
|
7
|
-
size: {
|
|
8
|
-
width: number | 'auto';
|
|
9
|
-
height: number | 'auto';
|
|
19
|
+
maxSizes?: {
|
|
20
|
+
maxWidth?: number;
|
|
21
|
+
maxHeight?: number;
|
|
10
22
|
};
|
|
11
|
-
url: string | null | undefined;
|
|
12
|
-
provider?: SupporedEmbedProviders | null;
|
|
13
|
-
providerId: string | null;
|
|
14
23
|
};
|
|
15
|
-
|
|
16
|
-
data: EmbedElementData;
|
|
17
|
-
}>;
|
|
18
|
-
export type SupporedEmbedProviders = 'youtube' | 'vimeo' | 'dailymotion' | 'twitter' | 'figma' | string;
|
|
24
|
+
//# 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,kBAAkB,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;AAC3G,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,kBAAkB,CAAC;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAC1C,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AAEpE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC"}
|
package/dist/ui/Embed.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
updateSize?: (size: Partial<EmbedElementData['size']>) => void;
|
|
8
|
-
isEdit?: boolean;
|
|
9
|
-
};
|
|
10
|
-
declare const Embed: ({ attributes, element, children, HTMLAttributes, isEdit }: Props) => JSX.Element;
|
|
11
|
-
export { Embed };
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PluginElementRenderProps } from '@yoopta/editor';
|
|
3
|
+
import { EmbedPluginOptions } from '../types';
|
|
4
|
+
declare const EmbedRender: ({ element, attributes, children, blockId }: PluginElementRenderProps<EmbedPluginOptions>) => JSX.Element;
|
|
5
|
+
export { EmbedRender };
|
|
6
|
+
//# sourceMappingURL=Embed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Embed.d.ts","sourceRoot":"","sources":["../../src/ui/Embed.tsx"],"names":[],"mappings":";AACA,OAAO,EAEL,wBAAwB,EAIzB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAI9C,QAAA,MAAM,WAAW,+CAAgD,yBAAyB,kBAAkB,CAAC,gBA2E5G,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { YooEditor, YooptaBlockData } from '@yoopta/editor';
|
|
3
|
+
import { EmbedElementProps } from '../types';
|
|
4
|
+
type Props = {
|
|
5
|
+
editor: YooEditor;
|
|
6
|
+
block: YooptaBlockData;
|
|
7
|
+
props?: EmbedElementProps;
|
|
8
|
+
};
|
|
9
|
+
declare const EmbedBlockOptions: ({ editor, block, props: embedProps }: Props) => JSX.Element;
|
|
10
|
+
export { EmbedBlockOptions };
|
|
11
|
+
//# sourceMappingURL=EmbedBlockOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmbedBlockOptions.d.ts","sourceRoot":"","sources":["../../src/ui/EmbedBlockOptions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAI7C,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC3B,CAAC;AAEF,QAAA,MAAM,iBAAiB,yCAA0C,KAAK,gBAsBrE,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { EmbedElementProps } from '../types';
|
|
3
|
+
type EmbedComponentProps = Omit<EmbedElementProps, 'sizes'> & {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
blockId: string;
|
|
7
|
+
};
|
|
8
|
+
declare const EmbedComponent: ({ width, height, provider, blockId }: EmbedComponentProps) => JSX.Element | null;
|
|
9
|
+
export { EmbedComponent, EmbedComponentProps };
|
|
10
|
+
//# sourceMappingURL=EmbedComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmbedComponent.d.ts","sourceRoot":"","sources":["../../src/ui/EmbedComponent.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,KAAK,mBAAmB,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAUF,QAAA,MAAM,cAAc,yCAA0C,mBAAmB,uBAoBhF,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmbedLinkUploader.d.ts","sourceRoot":"","sources":["../../src/ui/EmbedLinkUploader.tsx"],"names":[],"mappings":";AAKA,QAAA,MAAM,iBAAiB;;;iBA8CtB,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
floatingStyles: CSSProperties;
|
|
4
|
+
refs: any;
|
|
5
|
+
blockId: string;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
};
|
|
8
|
+
declare const EmbedUploader: ({ floatingStyles, refs, onClose, blockId }: Props) => JSX.Element;
|
|
9
|
+
export { EmbedUploader };
|
|
10
|
+
//# sourceMappingURL=EmbedUploader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmbedUploader.d.ts","sourceRoot":"","sources":["../../src/ui/EmbedUploader.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,KAAK,KAAK,GAAG;IACX,cAAc,EAAE,aAAa,CAAC;IAC9B,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,aAAa,+CAAgD,KAAK,gBA6BvE,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Placeholder.d.ts","sourceRoot":"","sources":["../../src/ui/Placeholder.tsx"],"names":[],"mappings":";AAKA,QAAA,MAAM,WAAW;;;;iBA+BhB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EmbedProviderTypes } 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): EmbedProviderTypes | null;
|
|
6
|
+
export declare function getTwitterEmbedId(url: any): any;
|
|
7
|
+
export declare function getFigmaUrl(url: any): string | null;
|
|
8
|
+
export declare const ProviderGetters: {
|
|
9
|
+
youtube: (url: string) => string | null;
|
|
10
|
+
vimeo: (url: string) => string;
|
|
11
|
+
dailymotion: (url: string) => string | null;
|
|
12
|
+
twitter: typeof getTwitterEmbedId;
|
|
13
|
+
figma: typeof getFigmaUrl;
|
|
14
|
+
};
|
|
15
|
+
//# 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,wBAAgB,iBAAiB,CAAC,GAAG,KAAA,OAMpC;AAED,wBAAgB,WAAW,CAAC,GAAG,KAAA,iBAQ9B;AAED,eAAO,MAAM,eAAe;mBA1DM,MAAM;iBAOR,MAAM;uBAMA,MAAM;;;CAmD3C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/embed",
|
|
3
|
-
"version": "
|
|
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": ">=
|
|
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,9 +28,17 @@
|
|
|
28
28
|
"url": "git+https://github.com/Darginec05/Editor-Yoopta.git"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
|
-
"test": "node ./__tests__
|
|
31
|
+
"test": "node ./__tests__/yoopta-embed.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"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@floating-ui/react": "^0.26.9",
|
|
41
|
+
"@radix-ui/react-icons": "^1.3.0",
|
|
42
|
+
"re-resizable": "^6.9.11"
|
|
35
43
|
}
|
|
36
44
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { RenderYooptaElementProps, YooEditor } from '@yoopta/editor';
|
|
3
|
-
import { EmbedElement } from '../types';
|
|
4
|
-
type Props = RenderYooptaElementProps<EmbedElement> & {
|
|
5
|
-
editor: YooEditor;
|
|
6
|
-
maxSizes: {
|
|
7
|
-
maxWidth: number;
|
|
8
|
-
maxHeight: number;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
declare const EditorPlaceholder: ({ element, attributes, maxSizes, children, editor }: Props) => JSX.Element;
|
|
12
|
-
export { EditorPlaceholder };
|
package/dist/ui/EmbedEditor.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { EmbedElementData } from '../types';
|
|
3
|
-
declare const EmbedEditorFactory: (editor: YooEditor, plugin: YooptaPluginType<any, Modify<YooptaBaseElement<"embed">, {
|
|
4
|
-
data: EmbedElementData;
|
|
5
|
-
}>>) => (props: RenderYooptaElementProps<Modify<YooptaBaseElement<"embed">, {
|
|
6
|
-
data: EmbedElementData;
|
|
7
|
-
}>>) => JSX.Element;
|
|
8
|
-
export { EmbedEditorFactory };
|
package/dist/utils/parsers.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SupporedEmbedProviders } 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 getTwitterEmbedId(url: any): any;
|
|
6
|
-
export declare function getFigmaUrl(url: any): string | null;
|
|
7
|
-
export declare function getProvider(url: string): SupporedEmbedProviders | null;
|