@yoopta/image 4.0.0-rc.8 → 4.0.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/dist/index.js +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/ui/ImageBlockOptions.d.ts.map +1 -1
- package/dist/ui/Placeholder.d.ts.map +1 -1
- package/package.json +5 -5
- package/LICENSE +0 -21
- package/dist/index.es.js +0 -6
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@yoopta/editor"),e=require("react/jsx-runtime"),i=require("react"),n=require("react-dom");function o(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var r=o(i),s=o(n);const a=({width:t,height:i,src:n,alt:o,fit:r,bgColor:s,layout:a="intrinsic"})=>{const l={objectFit:r||"contain",backgroundColor:s||"transparent"},c="fixed"===a,d="fill"===a,u="intrinsic"===a;return"responsive"===a&&(l.width="100%",l.height="auto"),c&&(l.width="100%",l.height="100%"),d&&(l.width="100%",l.height="100%"),u&&(l.width="100%",l.height="100%"),e.jsx("div",Object.assign({className:"w-full","data-layout":a},{children:n&&e.jsx("img",{src:n,width:t,height:i,alt:o||"",decoding:"async",loading:"lazy",style:l})}))};var l,c=(l=function(t,e){return l=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])},l(t,e)},function(t,e){function i(){this.constructor=t}l(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),d=function(){return d=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},d.apply(this,arguments)},u={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},p={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},h={width:"20px",height:"20px",position:"absolute"},f={top:d(d({},u),{top:"-5px"}),right:d(d({},p),{left:void 0,right:"-5px"}),bottom:d(d({},u),{top:void 0,bottom:"-5px"}),left:d(d({},p),{left:"-5px"}),topRight:d(d({},h),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:d(d({},h),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:d(d({},h),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:d(d({},h),{left:"-10px",top:"-10px",cursor:"nw-resize"})},g=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onMouseDown=function(t){e.props.onResizeStart(t,e.props.direction)},e.onTouchStart=function(t){e.props.onResizeStart(t,e.props.direction)},e}return c(e,t),e.prototype.render=function(){return r.createElement("div",{className:this.props.className||"",style:d(d({position:"absolute",userSelect:"none"},f[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},e}(r.PureComponent),m=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)}}(),x=function(){return x=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},x.apply(this,arguments)},w={width:"auto",height:"auto"},b=function(t,e,i){return Math.max(Math.min(t,i),e)},v=function(t,e){return Math.round(t/e)*e},y=function(t,e){return new RegExp(t,"i").test(e)},C=function(t){return Boolean(t.touches&&t.touches.length)},z=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},S=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"},R=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},_=["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"],E="__resizable_base__",k=function(t){function e(e){var i=t.call(this,e)||this;return i.ratio=1,i.resizable=null,i.parentLeft=0,i.parentTop=0,i.resizableLeft=0,i.resizableRight=0,i.resizableTop=0,i.resizableBottom=0,i.targetLeft=0,i.targetTop=0,i.appendBase=function(){if(!i.resizable||!i.window)return null;var t=i.parentNode;if(!t)return null;var e=i.window.document.createElement("div");return e.style.width="100%",e.style.height="100%",e.style.position="absolute",e.style.transform="scale(0, 0)",e.style.left="0",e.style.flex="0 0 100%",e.classList?e.classList.add(E):e.className+=E,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 m(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 S(t.state[e])};return{width:e&&void 0!==e.width&&!this.state.isResizing?S(e.width):i("width"),height:e&&void 0!==e.height&&!this.state.isResizing?S(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&&y("left",r),a=o&&y("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 y("right",r)&&(u=s.width+(t-s.x)*n/i,l&&(p=(u-f)/this.ratio+h)),y("left",r)&&(u=s.width-(t-s.x)*n/i,l&&(p=(u-f)/this.ratio+h)),y("bottom",r)&&(p=s.height+(e-s.y)*n/i,l&&(u=(p-h)*this.ratio+f)),y("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,x=(c-h)/this.ratio+p,w=Math.max(l,f),v=Math.min(c,g),y=Math.max(d,m),C=Math.min(u,x);t=b(t,w,v),e=b(e,y,C)}else t=b(t,l,c),e=b(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&&C(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:x(x({},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&&C(t))try{t.preventDefault(),t.stopPropagation()}catch(t){}var i=this.props,o=i.maxWidth,r=i.maxHeight,s=i.minWidth,a=i.minHeight,l=C(t)?t.touches[0].clientX:t.clientX,c=C(t)?t.touches[0].clientY:t.clientY,d=this.state,u=d.direction,p=d.original,h=d.width,f=d.height,g=this.getParentSize(),m=function(t,e,i,n,o,r,s){return n=R(n,t.width,e,i),o=R(o,t.height,e,i),r=R(r,t.width,e,i),s=R(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)}}(g,this.window.innerWidth,this.window.innerHeight,o,r,s,a);o=m.maxWidth,r=m.maxHeight,s=m.minWidth,a=m.minHeight;var x=this.calculateNewSizeFromDirection(l,c),w=x.newHeight,b=x.newWidth,y=this.calculateNewMaxFromBoundary(o,r);this.props.snap&&this.props.snap.x&&(b=z(b,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(w=z(w,this.props.snap.y,this.props.snapGap));var S=this.calculateNewSizeFromAspectRatio(b,w,{width:y.maxWidth,height:y.maxHeight},{width:s,height:a});if(b=S.newWidth,w=S.newHeight,this.props.grid){var _=v(b,this.props.grid[0]),E=v(w,this.props.grid[1]),k=this.props.snapGap||0;b=0===k||Math.abs(_-b)<=k?_:b,w=0===k||Math.abs(E-w)<=k?E:w}var j={width:b-p.width,height:w-p.height};if(h&&"string"==typeof h)if(h.endsWith("%"))b=b/g.width*100+"%";else if(h.endsWith("vw")){b=b/this.window.innerWidth*100+"vw"}else if(h.endsWith("vh")){b=b/this.window.innerHeight*100+"vh"}if(f&&"string"==typeof f)if(f.endsWith("%"))w=w/g.height*100+"%";else if(f.endsWith("vw")){w=w/this.window.innerWidth*100+"vw"}else if(f.endsWith("vh")){w=w/this.window.innerHeight*100+"vh"}var L={width:this.createSizeForCssProperty(b,"width"),height:this.createSizeForCssProperty(w,"height")};"row"===this.flexDir?L.flexBasis=L.width:"column"===this.flexDir&&(L.flexBasis=L.height),n.flushSync((function(){e.setState(L)})),this.props.onResize&&this.props.onResize(t,u,this.resizable,j)}},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:x(x({},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,s=e.handleWrapperStyle,a=e.handleWrapperClass,l=e.handleComponent;if(!i)return null;var c=Object.keys(i).map((function(e){return!1!==i[e]?r.createElement(g,{key:e,direction:e,onResizeStart:t.onResizeStart,replaceStyles:n&&n[e],className:o&&o[e]},l&&l[e]?l[e]:null):null}));return r.createElement("div",{className:a,style:s},c)},e.prototype.render=function(){var t=this,e=Object.keys(this.props).reduce((function(e,i){return-1!==_.indexOf(i)||(e[i]=t.props[i]),e}),{}),i=x(x(x({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 r.createElement(n,x({ref:this.ref,style:i,className:this.props.className},e),this.state.isResizing&&r.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}(r.PureComponent);function j(t){return N(t)?(t.nodeName||"").toLowerCase():"#document"}function L(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function O(t){var e;return null==(e=(N(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function N(t){return t instanceof Node||t instanceof L(t).Node}function M(t){return t instanceof Element||t instanceof L(t).Element}function W(t){return t instanceof HTMLElement||t instanceof L(t).HTMLElement}function A(t){return"undefined"!=typeof ShadowRoot&&(t instanceof ShadowRoot||t instanceof L(t).ShadowRoot)}function T(t){const{overflow:e,overflowX:i,overflowY:n,display:o}=D(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+i)&&!["inline","contents"].includes(o)}function B(t){return["table","td","th"].includes(j(t))}function P(t){const e=H(),i=D(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 H(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function I(t){return["html","body","#document"].includes(j(t))}function D(t){return L(t).getComputedStyle(t)}function F(t){return M(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function V(t){if("html"===j(t))return t;const e=t.assignedSlot||t.parentNode||A(t)&&t.host||O(t);return A(e)?e.host:e}function U(t){const e=V(t);return I(e)?t.ownerDocument?t.ownerDocument.body:t.body:W(e)&&T(e)?e:U(e)}function Y(t,e,i){var n;void 0===e&&(e=[]),void 0===i&&(i=!0);const o=U(t),r=o===(null==(n=t.ownerDocument)?void 0:n.body),s=L(o);return r?e.concat(s,s.visualViewport||[],T(o)?o:[],s.frameElement&&i?Y(s.frameElement):[]):e.concat(o,Y(o,[],i))}const Z=Math.min,X=Math.max,G=Math.round,q=t=>({x:t,y:t}),$={left:"right",right:"left",bottom:"top",top:"bottom"},J={start:"end",end:"start"};function K(t,e,i){return X(t,Z(e,i))}function Q(t,e){return"function"==typeof t?t(e):t}function tt(t){return t.split("-")[0]}function et(t){return t.split("-")[1]}function it(t){return"x"===t?"y":"x"}function nt(t){return"y"===t?"height":"width"}function ot(t){return["top","bottom"].includes(tt(t))?"y":"x"}function rt(t){return it(ot(t))}function st(t){return t.replace(/start|end/g,(t=>J[t]))}function at(t){return t.replace(/left|right|bottom|top/g,(t=>$[t]))}function lt(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 ct(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function dt(t,e,i){let{reference:n,floating:o}=t;const r=ot(e),s=rt(e),a=nt(s),l=tt(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(et(e)){case"start":h[s]-=p*(i&&c?-1:1);break;case"end":h[s]+=p*(i&&c?-1:1)}return h}async function ut(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}=Q(e,t),f=lt(h),g=a[p?"floating"===u?"reference":"floating":u],m=ct(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})),x="floating"===u?{...s.floating,x:n,y:o}:s.reference,w=await(null==r.getOffsetParent?void 0:r.getOffsetParent(a.floating)),b=await(null==r.isElement?void 0:r.isElement(w))&&await(null==r.getScale?void 0:r.getScale(w))||{x:1,y:1},v=ct(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:w,strategy:l}):x);return{top:(m.top-v.top+f.top)/b.y,bottom:(v.bottom-m.bottom+f.bottom)/b.y,left:(m.left-v.left+f.left)/b.x,right:(v.right-m.right+f.right)/b.x}}function pt(t){const e=Z(...t.map((t=>t.left))),i=Z(...t.map((t=>t.top)));return{x:e,y:i,width:X(...t.map((t=>t.right)))-e,height:X(...t.map((t=>t.bottom)))-i}}const ht=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=tt(i),a=et(i),l="y"===ot(i),c=["left","top"].includes(s)?-1:1,d=r&&l?-1:1,u=Q(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 ft(t){const e=D(t);let i=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const o=W(t),r=o?t.offsetWidth:i,s=o?t.offsetHeight:n,a=G(i)!==r||G(n)!==s;return a&&(i=r,n=s),{width:i,height:n,$:a}}function gt(t){return M(t)?t:t.contextElement}function mt(t){const e=gt(t);if(!W(e))return q(1);const i=e.getBoundingClientRect(),{width:n,height:o,$:r}=ft(e);let s=(r?G(i.width):i.width)/n,a=(r?G(i.height):i.height)/o;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const xt=q(0);function wt(t){const e=L(t);return H()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:xt}function bt(t,e,i,n){void 0===e&&(e=!1),void 0===i&&(i=!1);const o=t.getBoundingClientRect(),r=gt(t);let s=q(1);e&&(n?M(n)&&(s=mt(n)):s=mt(t));const a=function(t,e,i){return void 0===e&&(e=!1),!(!i||e&&i!==L(t))&&e}(r,i,n)?wt(r):q(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=L(r),e=n&&M(n)?L(n):n;let i=t,o=i.frameElement;for(;o&&n&&e!==i;){const t=mt(o),e=o.getBoundingClientRect(),n=D(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=L(o),o=i.frameElement}}return ct({width:d,height:u,x:l,y:c})}const vt=[":popover-open",":modal"];function yt(t){return vt.some((e=>{try{return t.matches(e)}catch(t){return!1}}))}function Ct(t){return bt(O(t)).left+F(t).scrollLeft}function zt(t,e,i){let n;if("viewport"===e)n=function(t,e){const i=L(t),n=O(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=H();(!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=O(t),i=F(t),n=t.ownerDocument.body,o=X(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=X(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-i.scrollLeft+Ct(t);const a=-i.scrollTop;return"rtl"===D(n).direction&&(s+=X(e.clientWidth,n.clientWidth)-o),{width:o,height:r,x:s,y:a}}(O(t));else if(M(e))n=function(t,e){const i=bt(t,!0,"fixed"===e),n=i.top+t.clientTop,o=i.left+t.clientLeft,r=W(t)?mt(t):q(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 ct(n)}function St(t,e){const i=V(t);return!(i===e||!M(i)||I(i))&&("fixed"===D(i).position||St(i,e))}function Rt(t,e,i){const n=W(e),o=O(e),r="fixed"===i,s=bt(t,!0,r,e);let a={scrollLeft:0,scrollTop:0};const l=q(0);if(n||!n&&!r)if(("body"!==j(e)||T(o))&&(a=F(e)),n){const t=bt(e,!0,r,e);l.x=t.x+e.clientLeft,l.y=t.y+e.clientTop}else o&&(l.x=Ct(o));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function _t(t,e){return W(t)&&"fixed"!==D(t).position?e?e(t):t.offsetParent:null}function Et(t,e){const i=L(t);if(!W(t)||yt(t))return i;let n=_t(t,e);for(;n&&B(n)&&"static"===D(n).position;)n=_t(n,e);return n&&("html"===j(n)||"body"===j(n)&&"static"===D(n).position&&!P(n))?i:n||function(t){let e=V(t);for(;W(e)&&!I(e);){if(P(e))return e;e=V(e)}return null}(t)||i}const kt={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:i,offsetParent:n,strategy:o}=t;const r="fixed"===o,s=O(n),a=!!e&&yt(e.floating);if(n===s||a&&r)return i;let l={scrollLeft:0,scrollTop:0},c=q(1);const d=q(0),u=W(n);if((u||!u&&!r)&&(("body"!==j(n)||T(s))&&(l=F(n)),W(n))){const t=bt(n);c=mt(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:O,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=Y(t,[],!1).filter((t=>M(t)&&"body"!==j(t))),o=null;const r="fixed"===D(t).position;let s=r?V(t):t;for(;M(s)&&!I(s);){const e=D(s),i=P(s);i||"fixed"!==e.position||(o=null),(r?!i&&!o:!i&&"static"===e.position&&o&&["absolute","fixed"].includes(o.position)||T(s)&&!i&&St(t,s))?n=n.filter((t=>t!==s)):o=e,s=V(s)}return e.set(t,n),n}(e,this._c):[].concat(i),n],s=r[0],a=r.reduce(((t,i)=>{const n=zt(e,i,o);return t.top=X(n.top,t.top),t.right=Z(n.right,t.right),t.bottom=Z(n.bottom,t.bottom),t.left=X(n.left,t.left),t}),zt(e,s,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Et,getElementRects:async function(t){const e=this.getOffsetParent||Et,i=this.getDimensions;return{reference:Rt(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}=ft(t);return{width:e,height:i}},getScale:mt,isElement:M,isRTL:function(t){return"rtl"===D(t).direction}},jt=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}=Q(t,e),c={x:i,y:n},d=await ut(e,l),u=ot(tt(o)),p=it(u);let h=c[p],f=c[u];if(r){const t="y"===p?"bottom":"right";h=K(h+d["y"===p?"top":"left"],h,h-d[t])}if(s){const t="y"===u?"bottom":"right";f=K(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}}}}},Lt=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}=Q(t,e);if(null!=(i=r.arrow)&&i.alignmentOffset)return{};const x=tt(o),w=tt(a)===a,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),v=p||(w||!g?[at(a)]:function(t){const e=at(t);return[st(t),e,st(e)]}(a));p||"none"===f||v.push(...function(t,e,i,n){const o=et(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[]}}(tt(t),"start"===i,n);return o&&(r=r.map((t=>t+"-"+o)),e&&(r=r.concat(r.map(st)))),r}(a,g,f,b));const y=[a,...v],C=await ut(e,m),z=[];let S=(null==(n=r.flip)?void 0:n.overflows)||[];if(d&&z.push(C[x]),u){const t=function(t,e,i){void 0===i&&(i=!1);const n=et(t),o=rt(t),r=nt(o);let s="x"===o?n===(i?"end":"start")?"right":"left":"start"===n?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=at(s)),[s,at(s)]}(o,s,b);z.push(C[t[0]],C[t[1]])}if(S=[...S,{placement:o,overflows:z}],!z.every((t=>t<=0))){var R,_;const t=((null==(R=r.flip)?void 0:R.index)||0)+1,e=y[t];if(e)return{data:{index:t,overflows:S},reset:{placement:e}};let i=null==(_=S.filter((t=>t.overflows[0]<=0)).sort(((t,e)=>t.overflows[1]-e.overflows[1]))[0])?void 0:_.placement;if(!i)switch(h){case"bestFit":{var E;const t=null==(E=S.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:E[0];t&&(i=t);break}case"initialPlacement":i=a}if(o!==i)return{reset:{placement:i}}}return{}}}},Ot=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}=Q(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=>ct(pt(t))))}(d),p=ct(pt(d)),h=lt(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"===ot(i)){const t=u[0],e=u[u.length-1],n="top"===tt(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"===tt(i),e=X(...u.map((t=>t.right))),n=Z(...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}}:{}}}},Nt=(t,e,i)=>{const n=new Map,o={platform:kt,...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}=dt(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:x,data:w,reset:b}=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!=x?x:u,h={...h,[r]:{...h[r],...w}},b&&f<=50&&(f++,"object"==typeof b&&(b.placement&&(p=b.placement),b.rects&&(c=!0===b.rects?await s.getElementRects({reference:t,floating:e,strategy:o}):b.rects),({x:d,y:u}=dt(c,p,l))),i=-1)}return{x:d,y:u,placement:p,strategy:o,middlewareData:h}})(t,e,{...o,platform:r})};var Mt="undefined"!=typeof document?i.useLayoutEffect:i.useEffect;function Wt(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(!Wt(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)&&!Wt(t[i],e[i]))return!1}return!0}return t!=t&&e!=e}function At(t){if("undefined"==typeof window)return 1;return(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Tt(t,e){const i=At(t);return Math.round(e*i)/i}function Bt(t){const e=r.useRef(t);return Mt((()=>{e.current=t})),e}
|
|
1
|
+
import{useYooptaEditor as e,useYooptaPluginOptions as t,UI as o,useBlockData as i,useYooptaReadOnly as n,useBlockSelected as r,YooptaPlugin as a,generateId as s}from"@yoopta/editor";import{jsx as l,jsxs as c,Fragment as d}from"react/jsx-runtime";import*as p from"react";import{useLayoutEffect as u,useEffect as h,forwardRef as g,createElement as m,useState as f,useMemo as y}from"react";import*as w from"react-dom";import{flushSync as x,createPortal as b}from"react-dom";const v=({width:e,height:t,src:o,alt:i,fit:n,bgColor:r,layout:a="intrinsic"})=>{const s={objectFit:n||"contain",backgroundColor:r||"transparent"},c="fixed"===a,d="fill"===a,p="intrinsic"===a;return"responsive"===a&&(s.width="100%",s.height="auto"),c&&(s.width="100%",s.height="100%"),d&&(s.width="100%",s.height="100%"),p&&(s.width="100%",s.height="100%"),l("div",Object.assign({className:"yoo-image-w-full","data-layout":a},{children:o&&l("img",{src:o,width:e,height:t,alt:i||"",decoding:"async",loading:"lazy",style:s})}))};var z,C=(z=function(e,t){return z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},z(e,t)},function(e,t){function o(){this.constructor=e}z(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),S=function(){return S=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},S.apply(this,arguments)},R={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},_={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},E={width:"20px",height:"20px",position:"absolute"},k={top:S(S({},R),{top:"-5px"}),right:S(S({},_),{left:void 0,right:"-5px"}),bottom:S(S({},R),{top:void 0,bottom:"-5px"}),left:S(S({},_),{left:"-5px"}),topRight:S(S({},E),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:S(S({},E),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:S(S({},E),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:S(S({},E),{left:"-10px",top:"-10px",cursor:"nw-resize"})},L=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onMouseDown=function(e){t.props.onResizeStart(e,t.props.direction)},t.onTouchStart=function(e){t.props.onResizeStart(e,t.props.direction)},t}return C(t,e),t.prototype.render=function(){return p.createElement("div",{className:this.props.className||"",style:S(S({position:"absolute",userSelect:"none"},k[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(p.PureComponent),O=function(){var e=function(t,o){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},e(t,o)};return function(t,o){function i(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)}}(),N=function(){return N=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},N.apply(this,arguments)},j={width:"auto",height:"auto"},M=function(e,t,o){return Math.max(Math.min(e,o),t)},W=function(e,t){return Math.round(e/t)*t},A=function(e,t){return new RegExp(e,"i").test(t)},T=function(e){return Boolean(e.touches&&e.touches.length)},B=function(e,t,o){void 0===o&&(o=0);var i=t.reduce((function(o,i,n){return Math.abs(i-e)<Math.abs(t[o]-e)?n:o}),0),n=Math.abs(t[i]-e);return 0===o||n<o?t[i]:e},P=function(e){return"auto"===(e=e.toString())||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:e+"px"},F=function(e,t,o,i){if(e&&"string"==typeof e){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%"))return t*(Number(e.replace("%",""))/100);if(e.endsWith("vw"))return o*(Number(e.replace("vw",""))/100);if(e.endsWith("vh"))return i*(Number(e.replace("vh",""))/100)}return e},H=["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"],I="__resizable_base__",D=function(e){function t(t){var o=e.call(this,t)||this;return o.ratio=1,o.resizable=null,o.parentLeft=0,o.parentTop=0,o.resizableLeft=0,o.resizableRight=0,o.resizableTop=0,o.resizableBottom=0,o.targetLeft=0,o.targetTop=0,o.appendBase=function(){if(!o.resizable||!o.window)return null;var e=o.parentNode;if(!e)return null;var t=o.window.document.createElement("div");return t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.transform="scale(0, 0)",t.style.left="0",t.style.flex="0 0 100%",t.classList?t.classList.add(I):t.className+=I,e.appendChild(t),t},o.removeBase=function(e){var t=o.parentNode;t&&t.removeChild(e)},o.ref=function(e){e&&(o.resizable=e)},o.state={isResizing:!1,width:void 0===(o.propsSize&&o.propsSize.width)?"auto":o.propsSize&&o.propsSize.width,height:void 0===(o.propsSize&&o.propsSize.height)?"auto":o.propsSize&&o.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},o.onResizeStart=o.onResizeStart.bind(o),o.onMouseMove=o.onMouseMove.bind(o),o.onMouseUp=o.onMouseUp.bind(o),o}return O(t,e),Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return this.resizable&&this.resizable.ownerDocument?this.resizable.ownerDocument.defaultView:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||j},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=0,t=0;if(this.resizable&&this.window){var o=this.resizable.offsetWidth,i=this.resizable.offsetHeight,n=this.resizable.style.position;"relative"!==n&&(this.resizable.style.position="relative"),e="auto"!==this.resizable.style.width?this.resizable.offsetWidth:o,t="auto"!==this.resizable.style.height?this.resizable.offsetHeight:i,this.resizable.style.position=n}return{width:e,height:t}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var e=this,t=this.props.size,o=function(t){if(void 0===e.state[t]||"auto"===e.state[t])return"auto";if(e.propsSize&&e.propsSize[t]&&e.propsSize[t].toString().endsWith("%")){if(e.state[t].toString().endsWith("%"))return e.state[t].toString();var o=e.getParentSize();return Number(e.state[t].toString().replace("px",""))/o[t]*100+"%"}return P(e.state[t])};return{width:t&&void 0!==t.width&&!this.state.isResizing?P(t.width):o("width"),height:t&&void 0!==t.height&&!this.state.isResizing?P(t.height):o("height")}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var e=this.appendBase();if(!e)return{width:0,height:0};var t=!1,o=this.parentNode.style.flexWrap;"wrap"!==o&&(t=!0,this.parentNode.style.flexWrap="wrap"),e.style.position="relative",e.style.minWidth="100%",e.style.minHeight="100%";var i={width:e.offsetWidth,height:e.offsetHeight};return t&&(this.parentNode.style.flexWrap=o),this.removeBase(e),i},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(this.resizable&&this.window){var e=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:"auto"!==e.flexBasis?e.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(e,t){var o=this.propsSize&&this.propsSize[t];return"auto"!==this.state[t]||this.state.original[t]!==e||void 0!==o&&"auto"!==o?e:"auto"},t.prototype.calculateNewMaxFromBoundary=function(e,t){var o,i,n=this.props.boundsByDirection,r=this.state.direction,a=n&&A("left",r),s=n&&A("top",r);if("parent"===this.props.bounds){var l=this.parentNode;l&&(o=a?this.resizableRight-this.parentLeft:l.offsetWidth+(this.parentLeft-this.resizableLeft),i=s?this.resizableBottom-this.parentTop:l.offsetHeight+(this.parentTop-this.resizableTop))}else"window"===this.props.bounds?this.window&&(o=a?this.resizableRight:this.window.innerWidth-this.resizableLeft,i=s?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(o=a?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),i=s?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return o&&Number.isFinite(o)&&(e=e&&e<o?e:o),i&&Number.isFinite(i)&&(t=t&&t<i?t:i),{maxWidth:e,maxHeight:t}},t.prototype.calculateNewSizeFromDirection=function(e,t){var o=this.props.scale||1,i=this.props.resizeRatio||1,n=this.state,r=n.direction,a=n.original,s=this.props,l=s.lockAspectRatio,c=s.lockAspectRatioExtraHeight,d=s.lockAspectRatioExtraWidth,p=a.width,u=a.height,h=c||0,g=d||0;return A("right",r)&&(p=a.width+(e-a.x)*i/o,l&&(u=(p-g)/this.ratio+h)),A("left",r)&&(p=a.width-(e-a.x)*i/o,l&&(u=(p-g)/this.ratio+h)),A("bottom",r)&&(u=a.height+(t-a.y)*i/o,l&&(p=(u-h)*this.ratio+g)),A("top",r)&&(u=a.height-(t-a.y)*i/o,l&&(p=(u-h)*this.ratio+g)),{newWidth:p,newHeight:u}},t.prototype.calculateNewSizeFromAspectRatio=function(e,t,o,i){var n=this.props,r=n.lockAspectRatio,a=n.lockAspectRatioExtraHeight,s=n.lockAspectRatioExtraWidth,l=void 0===i.width?10:i.width,c=void 0===o.width||o.width<0?e:o.width,d=void 0===i.height?10:i.height,p=void 0===o.height||o.height<0?t:o.height,u=a||0,h=s||0;if(r){var g=(d-u)*this.ratio+h,m=(p-u)*this.ratio+h,f=(l-h)/this.ratio+u,y=(c-h)/this.ratio+u,w=Math.max(l,g),x=Math.min(c,m),b=Math.max(d,f),v=Math.min(p,y);e=M(e,w,x),t=M(t,b,v)}else e=M(e,l,c),t=M(t,d,p);return{newWidth:e,newHeight:t}},t.prototype.setBoundingClientRect=function(){if("parent"===this.props.bounds){var e=this.parentNode;if(e){var t=e.getBoundingClientRect();this.parentLeft=t.left,this.parentTop=t.top}}if(this.props.bounds&&"string"!=typeof this.props.bounds){var o=this.props.bounds.getBoundingClientRect();this.targetLeft=o.left,this.targetTop=o.top}if(this.resizable){var i=this.resizable.getBoundingClientRect(),n=i.left,r=i.top,a=i.right,s=i.bottom;this.resizableLeft=n,this.resizableRight=a,this.resizableTop=r,this.resizableBottom=s}},t.prototype.onResizeStart=function(e,t){if(this.resizable&&this.window){var o,i=0,n=0;if(e.nativeEvent&&function(e){return Boolean((e.clientX||0===e.clientX)&&(e.clientY||0===e.clientY))}(e.nativeEvent)?(i=e.nativeEvent.clientX,n=e.nativeEvent.clientY):e.nativeEvent&&T(e.nativeEvent)&&(i=e.nativeEvent.touches[0].clientX,n=e.nativeEvent.touches[0].clientY),this.props.onResizeStart)if(this.resizable)if(!1===this.props.onResizeStart(e,t,this.resizable))return;this.props.size&&(void 0!==this.props.size.height&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),void 0!==this.props.size.width&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio="number"==typeof this.props.lockAspectRatio?this.props.lockAspectRatio:this.size.width/this.size.height;var r=this.window.getComputedStyle(this.resizable);if("auto"!==r.flexBasis){var a=this.parentNode;if(a){var s=this.window.getComputedStyle(a).flexDirection;this.flexDir=s.startsWith("row")?"row":"column",o=r.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var l={original:{x:i,y:n,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:N(N({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||"auto"}),direction:t,flexBasis:o};this.setState(l)}},t.prototype.onMouseMove=function(e){var t=this;if(this.state.isResizing&&this.resizable&&this.window){if(this.window.TouchEvent&&T(e))try{e.preventDefault(),e.stopPropagation()}catch(e){}var o=this.props,i=o.maxWidth,n=o.maxHeight,r=o.minWidth,a=o.minHeight,s=T(e)?e.touches[0].clientX:e.clientX,l=T(e)?e.touches[0].clientY:e.clientY,c=this.state,d=c.direction,p=c.original,u=c.width,h=c.height,g=this.getParentSize(),m=function(e,t,o,i,n,r,a){return i=F(i,e.width,t,o),n=F(n,e.height,t,o),r=F(r,e.width,t,o),a=F(a,e.height,t,o),{maxWidth:void 0===i?void 0:Number(i),maxHeight:void 0===n?void 0:Number(n),minWidth:void 0===r?void 0:Number(r),minHeight:void 0===a?void 0:Number(a)}}(g,this.window.innerWidth,this.window.innerHeight,i,n,r,a);i=m.maxWidth,n=m.maxHeight,r=m.minWidth,a=m.minHeight;var f=this.calculateNewSizeFromDirection(s,l),y=f.newHeight,w=f.newWidth,b=this.calculateNewMaxFromBoundary(i,n);this.props.snap&&this.props.snap.x&&(w=B(w,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(y=B(y,this.props.snap.y,this.props.snapGap));var v=this.calculateNewSizeFromAspectRatio(w,y,{width:b.maxWidth,height:b.maxHeight},{width:r,height:a});if(w=v.newWidth,y=v.newHeight,this.props.grid){var z=W(w,this.props.grid[0]),C=W(y,this.props.grid[1]),S=this.props.snapGap||0;w=0===S||Math.abs(z-w)<=S?z:w,y=0===S||Math.abs(C-y)<=S?C:y}var R={width:w-p.width,height:y-p.height};if(u&&"string"==typeof u)if(u.endsWith("%"))w=w/g.width*100+"%";else if(u.endsWith("vw")){w=w/this.window.innerWidth*100+"vw"}else if(u.endsWith("vh")){w=w/this.window.innerHeight*100+"vh"}if(h&&"string"==typeof h)if(h.endsWith("%"))y=y/g.height*100+"%";else if(h.endsWith("vw")){y=y/this.window.innerWidth*100+"vw"}else if(h.endsWith("vh")){y=y/this.window.innerHeight*100+"vh"}var _={width:this.createSizeForCssProperty(w,"width"),height:this.createSizeForCssProperty(y,"height")};"row"===this.flexDir?_.flexBasis=_.width:"column"===this.flexDir&&(_.flexBasis=_.height),x((function(){t.setState(_)})),this.props.onResize&&this.props.onResize(e,d,this.resizable,R)}},t.prototype.onMouseUp=function(e){var t=this.state,o=t.isResizing,i=t.direction,n=t.original;if(o&&this.resizable){var r={width:this.size.width-n.width,height:this.size.height-n.height};this.props.onResizeStop&&this.props.onResizeStop(e,i,this.resizable,r),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:N(N({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(e){this.setState({width:e.width,height:e.height})},t.prototype.renderResizer=function(){var e=this,t=this.props,o=t.enable,i=t.handleStyles,n=t.handleClasses,r=t.handleWrapperStyle,a=t.handleWrapperClass,s=t.handleComponent;if(!o)return null;var l=Object.keys(o).map((function(t){return!1!==o[t]?p.createElement(L,{key:t,direction:t,onResizeStart:e.onResizeStart,replaceStyles:i&&i[t],className:n&&n[t]},s&&s[t]?s[t]:null):null}));return p.createElement("div",{className:a,style:r},l)},t.prototype.render=function(){var e=this,t=Object.keys(this.props).reduce((function(t,o){return-1!==H.indexOf(o)||(t[o]=e.props[o]),t}),{}),o=N(N(N({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&&(o.flexBasis=this.state.flexBasis);var i=this.props.as||"div";return p.createElement(i,N({ref:this.ref,style:o,className:this.props.className},t),this.state.isResizing&&p.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(p.PureComponent);function V(e){return X(e)?(e.nodeName||"").toLowerCase():"#document"}function U(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Z(e){var t;return null==(t=(X(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function X(e){return e instanceof Node||e instanceof U(e).Node}function Y(e){return e instanceof Element||e instanceof U(e).Element}function G(e){return e instanceof HTMLElement||e instanceof U(e).HTMLElement}function $(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof U(e).ShadowRoot)}function q(e){const{overflow:t,overflowX:o,overflowY:i,display:n}=te(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+o)&&!["inline","contents"].includes(n)}function J(e){return["table","td","th"].includes(V(e))}function K(e){const t=Q(),o=te(e);return"none"!==o.transform||"none"!==o.perspective||!!o.containerType&&"normal"!==o.containerType||!t&&!!o.backdropFilter&&"none"!==o.backdropFilter||!t&&!!o.filter&&"none"!==o.filter||["transform","perspective","filter"].some((e=>(o.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(o.contain||"").includes(e)))}function Q(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function ee(e){return["html","body","#document"].includes(V(e))}function te(e){return U(e).getComputedStyle(e)}function oe(e){return Y(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ie(e){if("html"===V(e))return e;const t=e.assignedSlot||e.parentNode||$(e)&&e.host||Z(e);return $(t)?t.host:t}function ne(e){const t=ie(e);return ee(t)?e.ownerDocument?e.ownerDocument.body:e.body:G(t)&&q(t)?t:ne(t)}function re(e,t,o){var i;void 0===t&&(t=[]),void 0===o&&(o=!0);const n=ne(e),r=n===(null==(i=e.ownerDocument)?void 0:i.body),a=U(n);return r?t.concat(a,a.visualViewport||[],q(n)?n:[],a.frameElement&&o?re(a.frameElement):[]):t.concat(n,re(n,[],o))}const ae=Math.min,se=Math.max,le=Math.round,ce=e=>({x:e,y:e}),de={left:"right",right:"left",bottom:"top",top:"bottom"},pe={start:"end",end:"start"};function ue(e,t,o){return se(e,ae(t,o))}function he(e,t){return"function"==typeof e?e(t):e}function ge(e){return e.split("-")[0]}function me(e){return e.split("-")[1]}function fe(e){return"x"===e?"y":"x"}function ye(e){return"y"===e?"height":"width"}function we(e){return["top","bottom"].includes(ge(e))?"y":"x"}function xe(e){return fe(we(e))}function be(e){return e.replace(/start|end/g,(e=>pe[e]))}function ve(e){return e.replace(/left|right|bottom|top/g,(e=>de[e]))}function ze(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Ce(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function Se(e,t,o){let{reference:i,floating:n}=e;const r=we(t),a=xe(t),s=ye(a),l=ge(t),c="y"===r,d=i.x+i.width/2-n.width/2,p=i.y+i.height/2-n.height/2,u=i[s]/2-n[s]/2;let h;switch(l){case"top":h={x:d,y:i.y-n.height};break;case"bottom":h={x:d,y:i.y+i.height};break;case"right":h={x:i.x+i.width,y:p};break;case"left":h={x:i.x-n.width,y:p};break;default:h={x:i.x,y:i.y}}switch(me(t)){case"start":h[a]-=u*(o&&c?-1:1);break;case"end":h[a]+=u*(o&&c?-1:1)}return h}async function Re(e,t){var o;void 0===t&&(t={});const{x:i,y:n,platform:r,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:u=!1,padding:h=0}=he(t,e),g=ze(h),m=s[u?"floating"===p?"reference":"floating":p],f=Ce(await r.getClippingRect({element:null==(o=await(null==r.isElement?void 0:r.isElement(m)))||o?m:m.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:l})),y="floating"===p?{...a.floating,x:i,y:n}:a.reference,w=await(null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating)),x=await(null==r.isElement?void 0:r.isElement(w))&&await(null==r.getScale?void 0:r.getScale(w))||{x:1,y:1},b=Ce(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:w,strategy:l}):y);return{top:(f.top-b.top+g.top)/x.y,bottom:(b.bottom-f.bottom+g.bottom)/x.y,left:(f.left-b.left+g.left)/x.x,right:(b.right-f.right+g.right)/x.x}}function _e(e){const t=ae(...e.map((e=>e.left))),o=ae(...e.map((e=>e.top)));return{x:t,y:o,width:se(...e.map((e=>e.right)))-t,height:se(...e.map((e=>e.bottom)))-o}}const Ee=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var o,i;const{x:n,y:r,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:o,platform:i,elements:n}=e,r=await(null==i.isRTL?void 0:i.isRTL(n.floating)),a=ge(o),s=me(o),l="y"===we(o),c=["left","top"].includes(a)?-1:1,d=r&&l?-1:1,p=he(t,e);let{mainAxis:u,crossAxis:h,alignmentAxis:g}="number"==typeof p?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...p};return s&&"number"==typeof g&&(h="end"===s?-1*g:g),l?{x:h*d,y:u*c}:{x:u*c,y:h*d}}(t,e);return a===(null==(o=s.offset)?void 0:o.placement)&&null!=(i=s.arrow)&&i.alignmentOffset?{}:{x:n+l.x,y:r+l.y,data:{...l,placement:a}}}}};function ke(e){const t=te(e);let o=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const n=G(e),r=n?e.offsetWidth:o,a=n?e.offsetHeight:i,s=le(o)!==r||le(i)!==a;return s&&(o=r,i=a),{width:o,height:i,$:s}}function Le(e){return Y(e)?e:e.contextElement}function Oe(e){const t=Le(e);if(!G(t))return ce(1);const o=t.getBoundingClientRect(),{width:i,height:n,$:r}=ke(t);let a=(r?le(o.width):o.width)/i,s=(r?le(o.height):o.height)/n;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const Ne=ce(0);function je(e){const t=U(e);return Q()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Ne}function Me(e,t,o,i){void 0===t&&(t=!1),void 0===o&&(o=!1);const n=e.getBoundingClientRect(),r=Le(e);let a=ce(1);t&&(i?Y(i)&&(a=Oe(i)):a=Oe(e));const s=function(e,t,o){return void 0===t&&(t=!1),!(!o||t&&o!==U(e))&&t}(r,o,i)?je(r):ce(0);let l=(n.left+s.x)/a.x,c=(n.top+s.y)/a.y,d=n.width/a.x,p=n.height/a.y;if(r){const e=U(r),t=i&&Y(i)?U(i):i;let o=e,n=o.frameElement;for(;n&&i&&t!==o;){const e=Oe(n),t=n.getBoundingClientRect(),i=te(n),r=t.left+(n.clientLeft+parseFloat(i.paddingLeft))*e.x,a=t.top+(n.clientTop+parseFloat(i.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,p*=e.y,l+=r,c+=a,o=U(n),n=o.frameElement}}return Ce({width:d,height:p,x:l,y:c})}const We=[":popover-open",":modal"];function Ae(e){return We.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Te(e){return Me(Z(e)).left+oe(e).scrollLeft}function Be(e,t,o){let i;if("viewport"===t)i=function(e,t){const o=U(e),i=Z(e),n=o.visualViewport;let r=i.clientWidth,a=i.clientHeight,s=0,l=0;if(n){r=n.width,a=n.height;const e=Q();(!e||e&&"fixed"===t)&&(s=n.offsetLeft,l=n.offsetTop)}return{width:r,height:a,x:s,y:l}}(e,o);else if("document"===t)i=function(e){const t=Z(e),o=oe(e),i=e.ownerDocument.body,n=se(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),r=se(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let a=-o.scrollLeft+Te(e);const s=-o.scrollTop;return"rtl"===te(i).direction&&(a+=se(t.clientWidth,i.clientWidth)-n),{width:n,height:r,x:a,y:s}}(Z(e));else if(Y(t))i=function(e,t){const o=Me(e,!0,"fixed"===t),i=o.top+e.clientTop,n=o.left+e.clientLeft,r=G(e)?Oe(e):ce(1);return{width:e.clientWidth*r.x,height:e.clientHeight*r.y,x:n*r.x,y:i*r.y}}(t,o);else{const o=je(e);i={...t,x:t.x-o.x,y:t.y-o.y}}return Ce(i)}function Pe(e,t){const o=ie(e);return!(o===t||!Y(o)||ee(o))&&("fixed"===te(o).position||Pe(o,t))}function Fe(e,t,o){const i=G(t),n=Z(t),r="fixed"===o,a=Me(e,!0,r,t);let s={scrollLeft:0,scrollTop:0};const l=ce(0);if(i||!i&&!r)if(("body"!==V(t)||q(n))&&(s=oe(t)),i){const e=Me(t,!0,r,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else n&&(l.x=Te(n));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function He(e,t){return G(e)&&"fixed"!==te(e).position?t?t(e):e.offsetParent:null}function Ie(e,t){const o=U(e);if(!G(e)||Ae(e))return o;let i=He(e,t);for(;i&&J(i)&&"static"===te(i).position;)i=He(i,t);return i&&("html"===V(i)||"body"===V(i)&&"static"===te(i).position&&!K(i))?o:i||function(e){let t=ie(e);for(;G(t)&&!ee(t);){if(K(t))return t;t=ie(t)}return null}(e)||o}const De={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:o,offsetParent:i,strategy:n}=e;const r="fixed"===n,a=Z(i),s=!!t&&Ae(t.floating);if(i===a||s&&r)return o;let l={scrollLeft:0,scrollTop:0},c=ce(1);const d=ce(0),p=G(i);if((p||!p&&!r)&&(("body"!==V(i)||q(a))&&(l=oe(i)),G(i))){const e=Me(i);c=Oe(i),d.x=e.x+i.clientLeft,d.y=e.y+i.clientTop}return{width:o.width*c.x,height:o.height*c.y,x:o.x*c.x-l.scrollLeft*c.x+d.x,y:o.y*c.y-l.scrollTop*c.y+d.y}},getDocumentElement:Z,getClippingRect:function(e){let{element:t,boundary:o,rootBoundary:i,strategy:n}=e;const r=[..."clippingAncestors"===o?function(e,t){const o=t.get(e);if(o)return o;let i=re(e,[],!1).filter((e=>Y(e)&&"body"!==V(e))),n=null;const r="fixed"===te(e).position;let a=r?ie(e):e;for(;Y(a)&&!ee(a);){const t=te(a),o=K(a);o||"fixed"!==t.position||(n=null),(r?!o&&!n:!o&&"static"===t.position&&n&&["absolute","fixed"].includes(n.position)||q(a)&&!o&&Pe(e,a))?i=i.filter((e=>e!==a)):n=t,a=ie(a)}return t.set(e,i),i}(t,this._c):[].concat(o),i],a=r[0],s=r.reduce(((e,o)=>{const i=Be(t,o,n);return e.top=se(i.top,e.top),e.right=ae(i.right,e.right),e.bottom=ae(i.bottom,e.bottom),e.left=se(i.left,e.left),e}),Be(t,a,n));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:Ie,getElementRects:async function(e){const t=this.getOffsetParent||Ie,o=this.getDimensions;return{reference:Fe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await o(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:o}=ke(e);return{width:t,height:o}},getScale:Oe,isElement:Y,isRTL:function(e){return"rtl"===te(e).direction}},Ve=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:i,placement:n}=t,{mainAxis:r=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:o}=e;return{x:t,y:o}}},...l}=he(e,t),c={x:o,y:i},d=await Re(t,l),p=we(ge(n)),u=fe(p);let h=c[u],g=c[p];if(r){const e="y"===u?"bottom":"right";h=ue(h+d["y"===u?"top":"left"],h,h-d[e])}if(a){const e="y"===p?"bottom":"right";g=ue(g+d["y"===p?"top":"left"],g,g-d[e])}const m=s.fn({...t,[u]:h,[p]:g});return{...m,data:{x:m.x-o,y:m.y-i}}}}},Ue=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var o,i;const{placement:n,middlewareData:r,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...f}=he(e,t);if(null!=(o=r.arrow)&&o.alignmentOffset)return{};const y=ge(n),w=ge(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),b=u||(w||!m?[ve(s)]:function(e){const t=ve(e);return[be(e),t,be(t)]}(s));u||"none"===g||b.push(...function(e,t,o,i){const n=me(e);let r=function(e,t,o){const i=["left","right"],n=["right","left"],r=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return o?t?n:i:t?i:n;case"left":case"right":return t?r:a;default:return[]}}(ge(e),"start"===o,i);return n&&(r=r.map((e=>e+"-"+n)),t&&(r=r.concat(r.map(be)))),r}(s,m,g,x));const v=[s,...b],z=await Re(t,f),C=[];let S=(null==(i=r.flip)?void 0:i.overflows)||[];if(d&&C.push(z[y]),p){const e=function(e,t,o){void 0===o&&(o=!1);const i=me(e),n=xe(e),r=ye(n);let a="x"===n?i===(o?"end":"start")?"right":"left":"start"===i?"bottom":"top";return t.reference[r]>t.floating[r]&&(a=ve(a)),[a,ve(a)]}(n,a,x);C.push(z[e[0]],z[e[1]])}if(S=[...S,{placement:n,overflows:C}],!C.every((e=>e<=0))){var R,_;const e=((null==(R=r.flip)?void 0:R.index)||0)+1,t=v[e];if(t)return{data:{index:e,overflows:S},reset:{placement:t}};let o=null==(_=S.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:_.placement;if(!o)switch(h){case"bestFit":{var E;const e=null==(E=S.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:E[0];e&&(o=e);break}case"initialPlacement":o=s}if(n!==o)return{reset:{placement:o}}}return{}}}},Ze=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:o,elements:i,rects:n,platform:r,strategy:a}=t,{padding:s=2,x:l,y:c}=he(e,t),d=Array.from(await(null==r.getClientRects?void 0:r.getClientRects(i.reference))||[]),p=function(e){const t=e.slice().sort(((e,t)=>e.y-t.y)),o=[];let i=null;for(let e=0;e<t.length;e++){const n=t[e];!i||n.y-i.y>i.height/2?o.push([n]):o[o.length-1].push(n),i=n}return o.map((e=>Ce(_e(e))))}(d),u=Ce(_e(d)),h=ze(s);const g=await r.getElementRects({reference:{getBoundingClientRect:function(){if(2===p.length&&p[0].left>p[1].right&&null!=l&&null!=c)return p.find((e=>l>e.left-h.left&&l<e.right+h.right&&c>e.top-h.top&&c<e.bottom+h.bottom))||u;if(p.length>=2){if("y"===we(o)){const e=p[0],t=p[p.length-1],i="top"===ge(o),n=e.top,r=t.bottom,a=i?e.left:t.left,s=i?e.right:t.right;return{top:n,bottom:r,left:a,right:s,width:s-a,height:r-n,x:a,y:n}}const e="left"===ge(o),t=se(...p.map((e=>e.right))),i=ae(...p.map((e=>e.left))),n=p.filter((o=>e?o.left===i:o.right===t)),r=n[0].top,a=n[n.length-1].bottom;return{top:r,bottom:a,left:i,right:t,width:t-i,height:a-r,x:i,y:r}}return u}},floating:i.floating,strategy:a});return n.reference.x!==g.reference.x||n.reference.y!==g.reference.y||n.reference.width!==g.reference.width||n.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},Xe=(e,t,o)=>{const i=new Map,n={platform:De,...o},r={...n.platform,_c:i};return(async(e,t,o)=>{const{placement:i="bottom",strategy:n="absolute",middleware:r=[],platform:a}=o,s=r.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:n}),{x:d,y:p}=Se(c,i,l),u=i,h={},g=0;for(let o=0;o<s.length;o++){const{name:r,fn:m}=s[o],{x:f,y:y,data:w,reset:x}=await m({x:d,y:p,initialPlacement:i,placement:u,strategy:n,middlewareData:h,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=f?f:d,p=null!=y?y:p,h={...h,[r]:{...h[r],...w}},x&&g<=50&&(g++,"object"==typeof x&&(x.placement&&(u=x.placement),x.rects&&(c=!0===x.rects?await a.getElementRects({reference:e,floating:t,strategy:n}):x.rects),({x:d,y:p}=Se(c,u,l))),o=-1)}return{x:d,y:p,placement:u,strategy:n,middlewareData:h}})(e,t,{...n,platform:r})};var Ye="undefined"!=typeof document?u:h;function Ge(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let o,i,n;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(o=e.length,o!==t.length)return!1;for(i=o;0!=i--;)if(!Ge(e[i],t[i]))return!1;return!0}if(n=Object.keys(e),o=n.length,o!==Object.keys(t).length)return!1;for(i=o;0!=i--;)if(!{}.hasOwnProperty.call(t,n[i]))return!1;for(i=o;0!=i--;){const o=n[i];if(("_owner"!==o||!e.$$typeof)&&!Ge(e[o],t[o]))return!1}return!0}return e!=e&&t!=t}function $e(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qe(e,t){const o=$e(e);return Math.round(t*o)/o}function Je(e){const t=p.useRef(e);return Ye((()=>{t.current=e})),t}
|
|
2
2
|
/*!
|
|
3
3
|
* tabbable 6.2.0
|
|
4
4
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
5
|
*/
|
|
6
|
-
var Pt=["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(","),Ht="undefined"==typeof Element,It=Ht?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Dt=!Ht&&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},Ft=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)},Vt=function t(e,i,n){for(var o=[],r=Array.from(e);r.length;){var s=r.shift();if(!Ft(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{It.call(s,Pt)&&n.filter(s)&&(i||!e.includes(s))&&o.push(s);var c=s.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(s),d=!Ft(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},Ut=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Yt=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))&&!Ut(t)?0:t.tabIndex},Zt=function(t,e){return t.tabIndex===e.tabIndex?t.documentOrder-e.documentOrder:t.tabIndex-e.tabIndex},Xt=function(t){return"INPUT"===t.tagName},Gt=function(t){return function(t){return Xt(t)&&"radio"===t.type}(t)&&!function(t){if(!t.name)return!0;var e,i=t.form||Dt(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)},qt=function(t){var e=t.getBoundingClientRect(),i=e.width,n=e.height;return 0===i&&0===n},$t=function(t,e){var i=e.displayCheck,n=e.getShadowRoot;if("hidden"===getComputedStyle(t).visibility)return!0;var o=It.call(t,"details>summary:first-of-type")?t.parentElement:t;if(It.call(o,"details:not([open]) *"))return!0;if(i&&"full"!==i&&"legacy-full"!==i){if("non-zero-area"===i)return qt(t)}else{if("function"==typeof n){for(var r=t;t;){var s=t.parentElement,a=Dt(t);if(s&&!s.shadowRoot&&!0===n(s))return qt(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&&Dt(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=Dt(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},Jt=function(t,e){return!(e.disabled||Ft(e)||function(t){return Xt(t)&&"hidden"===t.type}(e)||$t(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!!It.call(e,"fieldset[disabled] *")||!n.contains(t)}return!0}e=e.parentElement}return!1}(e))},Kt=function(t,e){return!(Gt(e)||Yt(e)<0||!Jt(t,e))},Qt=function(t){var e=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(e)||e>=0)},te=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=Yt(t);return i<0&&e&&!Ut(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(Zt).reduce((function(t,e){return e.isScope?t.push.apply(t,e.content):t.push(e.content),t}),[]).concat(i)},ee=function(t,e){var i;return i=(e=e||{}).getShadowRoot?Vt([t],e.includeContainer,{filter:Kt.bind(null,e),flatten:!1,getShadowRoot:e.getShadowRoot,shadowRootFilter:Qt}):function(t,e,i){if(Ft(t))return[];var n=Array.prototype.slice.apply(t.querySelectorAll(Pt));return e&&It.call(t,Pt)&&n.unshift(t),n.filter(i)}(t,e.includeContainer,Kt.bind(null,e)),te(i)};const ie=r["useInsertionEffect".toString()]||(t=>t());var ne="undefined"!=typeof document?i.useLayoutEffect:i.useEffect;function oe(){return oe=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},oe.apply(this,arguments)}let re=!1,se=0;const ae=()=>"floating-ui-"+se++;const le=r["useId".toString()]||function(){const[t,e]=r.useState((()=>re?ae():void 0));return ne((()=>{null==t&&e(ae())}),[]),r.useEffect((()=>{re||(re=!0)}),[]),t};const ce=r.createContext(null),de=r.createContext(null);function ue(t){return"data-floating-ui-"+t}const pe=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function he(t,e){const i=ee(t,pe());"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 fe(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&&A(i)){let i=e;for(;i;){if(t===i)return!0;i=i.parentNode||i.host}}return!1}(i,n)}function ge(t){ee(t,pe()).forEach((t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")}))}function me(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 xe={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 be=r.forwardRef((function(t,e){const[i,n]=r.useState();ne((()=>(/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,[ue("focus-guard")]:"",style:xe};return r.createElement("span",oe({},t,o))})),ve=r.createContext(null),ye=ue("portal");function Ce(t){let{children:e,id:i,root:o=null,preserveTabOrder:s=!0}=t;const a=function(t){let{id:e,root:i}=void 0===t?{}:t;const[n,o]=r.useState(null),s=le(),a=ze(),l=r.useRef(null);return ne((()=>()=>{null==n||n.remove(),queueMicrotask((()=>{l.current=null}))}),[n]),ne((()=>{if(l.current)return;const t=e?document.getElementById(e):null;if(!t)return;const i=document.createElement("div");i.id=s,i.setAttribute(ye,""),t.appendChild(i),l.current=i,o(i)}),[e,s]),ne((()=>{if(l.current)return;let t=i||(null==a?void 0:a.portalNode);t&&!M(t)&&(t=t.current),t=t||document.body;let n=null;e&&(n=document.createElement("div"),n.id=e,t.appendChild(n));const r=document.createElement("div");r.id=s,r.setAttribute(ye,""),t=n||t,t.appendChild(r),l.current=r,o(r)}),[e,i,s,a]),n}({id:i,root:o}),[l,c]=r.useState(null),d=r.useRef(null),u=r.useRef(null),p=r.useRef(null),h=r.useRef(null),f=!!l&&!l.modal&&l.open&&s&&!(!o&&!a);return r.useEffect((()=>{if(a&&s&&(null==l||!l.modal))return a.addEventListener("focusin",t,!0),a.addEventListener("focusout",t,!0),()=>{a.removeEventListener("focusin",t,!0),a.removeEventListener("focusout",t,!0)};function t(t){if(a&&fe(t)){("focusin"===t.type?me:ge)(a)}}}),[a,s,null==l?void 0:l.modal]),r.createElement(ve.Provider,{value:r.useMemo((()=>({preserveTabOrder:s,beforeOutsideRef:d,afterOutsideRef:u,beforeInsideRef:p,afterInsideRef:h,portalNode:a,setFocusManagerState:c})),[s,a])},f&&a&&r.createElement(be,{"data-type":"outside",ref:d,onFocus:t=>{if(fe(t,a)){var e;null==(e=p.current)||e.focus()}else{const t=he(document.body,"prev")||(null==l?void 0:l.refs.domReference.current);null==t||t.focus()}}}),f&&a&&r.createElement("span",{"aria-owns":a.id,style:xe}),a&&n.createPortal(e,a),f&&a&&r.createElement(be,{"data-type":"outside",ref:u,onFocus:t=>{if(fe(t,a)){var e;null==(e=h.current)||e.focus()}else{const e=he(document.body,"next")||(null==l?void 0:l.refs.domReference.current);null==e||e.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1,t.nativeEvent))}}}))}const ze=()=>r.useContext(ve),Se=new Set,Re=r.forwardRef((function(t,e){let{lockScroll:i=!1,...n}=t;const o=le();return ne((()=>{if(!i)return;Se.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()=>{Se.delete(o),0===Se.size&&(Object.assign(e,{overflow:"",[n]:""}),t&&(Object.assign(e,{position:"",top:"",left:"",right:""}),window.scrollTo(s,a)))}}),[o,i]),r.createElement("div",oe({ref:e},n,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...n.style}}))}));function _e(t){var e;void 0===t&&(t={});const{open:i=!1,onOpenChange:n,nodeId:o}=t,[a,l]=r.useState(null),c=(null==(e=t.elements)?void 0:e.reference)||a,d=function(t){void 0===t&&(t={});const{placement:e="bottom",strategy:i="absolute",middleware:n=[],platform:o,elements:{reference:a,floating:l}={},transform:c=!0,whileElementsMounted:d,open:u}=t,[p,h]=r.useState({x:0,y:0,strategy:i,placement:e,middlewareData:{},isPositioned:!1}),[f,g]=r.useState(n);Wt(f,n)||g(n);const[m,x]=r.useState(null),[w,b]=r.useState(null),v=r.useCallback((t=>{t!==S.current&&(S.current=t,x(t))}),[]),y=r.useCallback((t=>{t!==R.current&&(R.current=t,b(t))}),[]),C=a||m,z=l||w,S=r.useRef(null),R=r.useRef(null),_=r.useRef(p),E=null!=d,k=Bt(d),j=Bt(o),L=r.useCallback((()=>{if(!S.current||!R.current)return;const t={placement:e,strategy:i,middleware:f};j.current&&(t.platform=j.current),Nt(S.current,R.current,t).then((t=>{const e={...t,isPositioned:!0};O.current&&!Wt(_.current,e)&&(_.current=e,s.flushSync((()=>{h(e)})))}))}),[f,e,i,j]);Mt((()=>{!1===u&&_.current.isPositioned&&(_.current.isPositioned=!1,h((t=>({...t,isPositioned:!1}))))}),[u]);const O=r.useRef(!1);Mt((()=>(O.current=!0,()=>{O.current=!1})),[]),Mt((()=>{if(C&&(S.current=C),z&&(R.current=z),C&&z){if(k.current)return k.current(C,z,L);L()}}),[C,z,L,k,E]);const N=r.useMemo((()=>({reference:S,floating:R,setReference:v,setFloating:y})),[v,y]),M=r.useMemo((()=>({reference:C,floating:z})),[C,z]),W=r.useMemo((()=>{const t={position:i,left:0,top:0};if(!M.floating)return t;const e=Tt(M.floating,p.x),n=Tt(M.floating,p.y);return c?{...t,transform:"translate("+e+"px, "+n+"px)",...At(M.floating)>=1.5&&{willChange:"transform"}}:{position:i,left:e,top:n}}),[i,c,M.floating,p.x,p.y]);return r.useMemo((()=>({...p,update:L,refs:N,elements:M,floatingStyles:W})),[p,L,N,M,W])}(t),u=r.useContext(de),p=null!=((null==(h=r.useContext(ce))?void 0:h.id)||null);var h;const f=function(t){const e=r.useRef((()=>{}));return ie((()=>{e.current=t})),r.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&&(m.current.openEvent=e),x.emit("openchange",{open:t,event:e,reason:i,nested:p}),null==n||n(t,e,i)})),g=r.useRef(null),m=r.useRef({}),x=r.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],w=le(),b=r.useCallback((t=>{const e=M(t)?{getBoundingClientRect:()=>t.getBoundingClientRect(),contextElement:t}:t;d.refs.setReference(e)}),[d.refs]),v=r.useCallback((t=>{(M(t)||null===t)&&(g.current=t,l(t)),(M(d.refs.reference.current)||null===d.refs.reference.current||null!==t&&!M(t))&&d.refs.setReference(t)}),[d.refs]),y=r.useMemo((()=>({...d.refs,setReference:v,setPositionReference:b,domReference:g})),[d.refs,v,b]),C=r.useMemo((()=>({...d.elements,domReference:c})),[d.elements,c]),z=r.useMemo((()=>({...d,refs:y,elements:C,dataRef:m,nodeId:o,floatingId:w,events:x,open:i,onOpenChange:f})),[d,o,w,x,i,f,y,C]);return ne((()=>{const t=null==u?void 0:u.nodesRef.current.find((t=>t.id===o));t&&(t.context=z)})),r.useMemo((()=>({...d,context:z,refs:y,elements:C})),[d,y,C,z])}function Ee(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 ke=["color"],je=i.forwardRef((function(t,e){var n=t.color,o=void 0===n?"currentColor":n,r=Ee(t,ke);return i.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),i.createElement("path",{d:"M7.50005 1.04999C7.74858 1.04999 7.95005 1.25146 7.95005 1.49999V8.41359L10.1819 6.18179C10.3576 6.00605 10.6425 6.00605 10.8182 6.18179C10.994 6.35753 10.994 6.64245 10.8182 6.81819L7.81825 9.81819C7.64251 9.99392 7.35759 9.99392 7.18185 9.81819L4.18185 6.81819C4.00611 6.64245 4.00611 6.35753 4.18185 6.18179C4.35759 6.00605 4.64251 6.00605 4.81825 6.18179L7.05005 8.41359V1.49999C7.05005 1.25146 7.25152 1.04999 7.50005 1.04999ZM2.5 10C2.77614 10 3 10.2239 3 10.5V12C3 12.5539 3.44565 13 3.99635 13H11.0012C11.5529 13 12 12.5528 12 12V10.5C12 10.2239 12.2239 10 12.5 10C12.7761 10 13 10.2239 13 10.5V12C13 13.1041 12.1062 14 11.0012 14H3.99635C2.89019 14 2 13.103 2 12V10.5C2 10.2239 2.22386 10 2.5 10Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))})),Le=["color"],Oe=i.forwardRef((function(t,e){var n=t.color,o=void 0===n?"currentColor":n,r=Ee(t,Le);return i.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),i.createElement("path",{d:"M2.5 1H12.5C13.3284 1 14 1.67157 14 2.5V12.5C14 13.3284 13.3284 14 12.5 14H2.5C1.67157 14 1 13.3284 1 12.5V2.5C1 1.67157 1.67157 1 2.5 1ZM2.5 2C2.22386 2 2 2.22386 2 2.5V8.3636L3.6818 6.6818C3.76809 6.59551 3.88572 6.54797 4.00774 6.55007C4.12975 6.55216 4.24568 6.60372 4.32895 6.69293L7.87355 10.4901L10.6818 7.6818C10.8575 7.50607 11.1425 7.50607 11.3182 7.6818L13 9.3636V2.5C13 2.22386 12.7761 2 12.5 2H2.5ZM2 12.5V9.6364L3.98887 7.64753L7.5311 11.4421L8.94113 13H2.5C2.22386 13 2 12.7761 2 12.5ZM12.5 13H10.155L8.48336 11.153L11 8.6364L13 10.6364V12.5C13 12.7761 12.7761 13 12.5 13ZM6.64922 5.5C6.64922 5.03013 7.03013 4.64922 7.5 4.64922C7.96987 4.64922 8.35078 5.03013 8.35078 5.5C8.35078 5.96987 7.96987 6.35078 7.5 6.35078C7.03013 6.35078 6.64922 5.96987 6.64922 5.5ZM7.5 3.74922C6.53307 3.74922 5.74922 4.53307 5.74922 5.5C5.74922 6.46693 6.53307 7.25078 7.5 7.25078C8.46693 7.25078 9.25078 6.46693 9.25078 5.5C9.25078 4.53307 8.46693 3.74922 7.5 3.74922Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))})),Ne=["color"],Me=i.forwardRef((function(t,e){var n=t.color,o=void 0===n?"currentColor":n,r=Ee(t,Ne);return i.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),i.createElement("path",{d:"M7.81832 0.68179C7.64258 0.506054 7.35766 0.506054 7.18192 0.68179L5.18192 2.68179C5.00619 2.85753 5.00619 3.14245 5.18192 3.31819C5.35766 3.49392 5.64258 3.49392 5.81832 3.31819L7.05012 2.08638L7.05012 5.50023C7.05012 5.74876 7.25159 5.95023 7.50012 5.95023C7.74865 5.95023 7.95012 5.74876 7.95012 5.50023L7.95012 2.08638L9.18192 3.31819C9.35766 3.49392 9.64258 3.49392 9.81832 3.31819C9.99406 3.14245 9.99406 2.85753 9.81832 2.68179L7.81832 0.68179ZM7.95012 12.9136V9.50023C7.95012 9.2517 7.74865 9.05023 7.50012 9.05023C7.25159 9.05023 7.05012 9.2517 7.05012 9.50023V12.9136L5.81832 11.6818C5.64258 11.5061 5.35766 11.5061 5.18192 11.6818C5.00619 11.8575 5.00619 12.1424 5.18192 12.3182L7.18192 14.3182C7.26632 14.4026 7.38077 14.45 7.50012 14.45C7.61947 14.45 7.73393 14.4026 7.81832 14.3182L9.81832 12.3182C9.99406 12.1424 9.99406 11.8575 9.81832 11.6818C9.64258 11.5061 9.35766 11.5061 9.18192 11.6818L7.95012 12.9136ZM1.49994 7.00017C1.2238 7.00017 0.999939 7.22403 0.999939 7.50017C0.999939 7.77631 1.2238 8.00017 1.49994 8.00017L13.4999 8.00017C13.7761 8.00017 13.9999 7.77631 13.9999 7.50017C13.9999 7.22403 13.7761 7.00017 13.4999 7.00017L1.49994 7.00017Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))})),We=["color"],Ae=i.forwardRef((function(t,e){var n=t.color,o=void 0===n?"currentColor":n,r=Ee(t,We);return i.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),i.createElement("path",{d:"M11.5 3.04999C11.7485 3.04999 11.95 3.25146 11.95 3.49999V7.49999C11.95 7.74852 11.7485 7.94999 11.5 7.94999C11.2515 7.94999 11.05 7.74852 11.05 7.49999V4.58639L4.58638 11.05H7.49999C7.74852 11.05 7.94999 11.2515 7.94999 11.5C7.94999 11.7485 7.74852 11.95 7.49999 11.95L3.49999 11.95C3.38064 11.95 3.26618 11.9026 3.18179 11.8182C3.0974 11.7338 3.04999 11.6193 3.04999 11.5L3.04999 7.49999C3.04999 7.25146 3.25146 7.04999 3.49999 7.04999C3.74852 7.04999 3.94999 7.25146 3.94999 7.49999L3.94999 10.4136L10.4136 3.94999L7.49999 3.94999C7.25146 3.94999 7.04999 3.74852 7.04999 3.49999C7.04999 3.25146 7.25146 3.04999 7.49999 3.04999L11.5 3.04999Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))})),Te=["color"],Be=i.forwardRef((function(t,e){var n=t.color,o=void 0===n?"currentColor":n,r=Ee(t,Te);return i.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),i.createElement("path",{d:"M4.81812 4.68161C4.99386 4.85734 4.99386 5.14227 4.81812 5.318L3.08632 7.0498H11.9135L10.1817 5.318C10.006 5.14227 10.006 4.85734 10.1817 4.68161C10.3575 4.50587 10.6424 4.50587 10.8181 4.68161L13.3181 7.18161C13.4939 7.35734 13.4939 7.64227 13.3181 7.818L10.8181 10.318C10.6424 10.4937 10.3575 10.4937 10.1817 10.318C10.006 10.1423 10.006 9.85734 10.1817 9.68161L11.9135 7.9498H3.08632L4.81812 9.68161C4.99386 9.85734 4.99386 10.1423 4.81812 10.318C4.64239 10.4937 4.35746 10.4937 4.18173 10.318L1.68173 7.818C1.50599 7.64227 1.50599 7.35734 1.68173 7.18161L4.18173 4.68161C4.35746 4.50587 4.64239 4.50587 4.81812 4.68161Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))}));const Pe=({blockId:n,onClose:o})=>{const r=t.useYooptaEditor(),[s,a]=i.useState(""),l=0===s.length;return e.jsxs("div",Object.assign({className:"cursor-pointer user-select-none transition-bg duration-20 ease-in white-space-nowrap w-full"},{children:[e.jsx("input",{type:"text",placeholder:"Paste image link",value:s,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=>a(t.target.value)}),e.jsx("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:()=>{0!==s.length&&(r.blocks.Image.updateElement(n,"image",{src:s}),o())}},{children:"Embed image"}))]}))};function He(t,e,i,n){return new(i||(i=Promise))((function(o,r){function s(t){try{l(n.next(t))}catch(t){r(t)}}function a(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const Ie=({accept:i="image/*",onClose:n,blockId:o,onSetLoading:r})=>{const s=t.useYooptaPluginOptions("Image"),a=t.useYooptaEditor();return e.jsx("div",Object.assign({className:"user-select-none transition-bg duration-20 ease-in white-space-nowrap rounded-[4px] h-[32px] px-[12px] border border-[rgba(55,53,47,0.16)] w-full cursor-pointer"},{children:e.jsxs("label",Object.assign({htmlFor:"image-uploader",className:"text-[14px] leading-[1.2] font-medium cursor-pointer w-full flex items-center justify-center h-full"},{children:[e.jsx("input",{type:"file",id:"image-uploader",className:"absolute left-0 top-0 invisible",accept:(null==s?void 0:s.accept)||i,onChange:t=>{const e=t.target.files[0];e&&(t=>{He(void 0,void 0,void 0,(function*(){if(null==s?void 0:s.onUpload){n(),r(!0);try{const e=yield null==s?void 0:s.onUpload(t);a.blocks.Image.updateElement(o,"image",{src:e.src,alt:e.alt,sizes:e.sizes,bgColor:e.bgColor,fit:"contain"})}catch(t){}finally{r(!1)}}else console.warn("onUpload not provided")}))})(e)},multiple:!1}),"Upload image"]}))}))},De=({floatingStyles:t,refs:n,onClose:o,blockId:r,onSetLoading:s})=>{const[a,l]=i.useState("upload"),c=t=>l(t),d="upload"===a,u="embed"===a,p=t=>({borderBottom:t?"2px solid #2483e2":"2px solid transparent"});return e.jsx(Ce,Object.assign({root:document.getElementById("yoopta-editor")},{children:e.jsx(Re,Object.assign({lockScroll:!0,className:"z-[100]",onClick:o},{children:e.jsx("div",Object.assign({ref:n.setFloating,style:t,onClick:t=>t.stopPropagation()},{children:e.jsxs("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:[e.jsxs("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:[e.jsx("button",Object.assign({type:"button",onClick:()=>c("upload"),style:p(d),className:"py-[6px] whitespace-nowrap min-w-0 flex-shrink-0 text-[rgb(55,53,47)] relative cursor-pointer user-select-none bg-inherit transition-[height_20ms_ease-in] inline-flex items-center h-full text-[14px] leading-[1.2] px-[8px]"},{children:"Upload"})),e.jsx("button",Object.assign({type:"button",onClick:()=>c("embed"),style:p(u),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:"Image link"}))]})),e.jsxs("div",Object.assign({className:"pt-[6px] pb-[6px] mt-[4px] flex justify-center mr-[12px] ml-[12px]"},{children:[u&&e.jsx(Pe,{onClose:o,blockId:r}),d&&e.jsx(Ie,{onClose:o,blockId:r,onSetLoading:s})]}))]}))}))}))}))},Fe=({className:t,width:i,height:n,children:o})=>e.jsxs("div",Object.assign({className:t},{children:[o,e.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:i,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-2 h-4 w-4 animate-spin"},{children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}))]})),Ve=({attributes:t,children:n,blockId:o})=>{const[r,s]=i.useState(!1),[a,l]=i.useState(!1),{refs:c,floatingStyles:d}=_e({placement:"bottom",open:r,onOpenChange:s,middleware:[Ot(),Lt(),jt(),ht(10)]});return e.jsxs("div",Object.assign({className:"w-full user-select-none m-[20px_0_10px] relative flex"},t,{contentEditable:!1},{children:[e.jsxs("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:()=>s(!0),disabled:a,ref:c.setReference},{children:[a?e.jsx(Fe,{className:"mr-2 user-select-none",width:24,height:24}):e.jsx(Oe,{className:"mr-2 user-select-none",width:24,height:24}),e.jsx("span",Object.assign({className:"font-medium"},{children:a?"Loading...":"Click to add image"})),a&&e.jsx("div",{className:"absolute top-0 left-0 h-full bg-[rgba(55,53,47,0.16)]",style:{width:"100%",transition:"width 100ms ease-in"}})]})),r&&e.jsx(De,{blockId:o,floatingStyles:d,refs:c,onClose:()=>s(!1),onSetLoading:t=>l(t)}),n]}))},{ExtendedBlockActions:Ue,BlockOptionsMenuGroup:Ye,BlockOptionsMenuItem:Ze,BlockOptionsSeparator:Xe}=t.UI,Ge=({editor:t,block:i,props:n})=>e.jsxs(Ue,Object.assign({onClick:()=>t.setSelection([i.meta.order]),className:"yoopta-image-options"},{children:[e.jsx(Xe,{}),e.jsxs(Ye,{children:[e.jsx(Ze,{children:e.jsxs("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:()=>{t.blocks.Image.updateElement(i.id,"image",{fit:"contain"})}},{children:[e.jsx(Me,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Fit"]}))}),e.jsx(Ze,{children:e.jsxs("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:()=>{t.blocks.Image.updateElement(i.id,"image",{fit:"fill"})}},{children:[e.jsx(Be,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Fill"]}))}),e.jsx(Ze,{children:e.jsxs("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:()=>{t.blocks.Image.updateElement(i.id,"image",{fit:"cover"})}},{children:[e.jsx(Ae,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Cover"]}))})]}),e.jsx(Xe,{}),e.jsx(Ye,{children:e.jsx(Ze,{children:e.jsxs("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{if(!n||!n.src)return;const t=document.createElement("a");t.href=n.src,t.download=n.alt||n.src,t.target="_blank",t.rel="noopener noreferrer",document.body.appendChild(t),t.click(),document.body.removeChild(t)}},{children:[e.jsx(je,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Download"]}))})})]})),qe=({position:t})=>e.jsx("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:e.jsx("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]"})})),$e=new t.YooptaPlugin({type:"Image",elements:{image:{render:({element:n,attributes:o,children:r,blockId:s})=>{const{src:l,alt:c,srcSet:d,bgColor:u,fit:p,sizes:h}=n.props||{},f=t.useBlockData(s),g=t.useYooptaEditor(),m=t.useYooptaReadOnly(),x=t.useYooptaPluginOptions("Image"),[w,b]=i.useState({width:(null==h?void 0:h.width)||650,height:(null==h?void 0:h.height)||440});i.useEffect((()=>b({width:(null==h?void 0:h.width)||650,height:(null==h?void 0:h.height)||440})),[n.props]);const v=t.useBlockSelected({blockId:s}),y=i.useMemo((()=>{var t,i;return{minWidth:300,size:{width:w.width,height:w.height},maxWidth:(null===(t=null==x?void 0:x.maxSizes)||void 0===t?void 0:t.maxWidth)||800,maxHeight:(null===(i=null==x?void 0:x.maxSizes)||void 0===i?void 0:i.maxHeight)||720,lockAspectRatio:!0,resizeRatio:2,enable:{left:!m,right:!m},handleStyles:{left:{left:0},right:{right:0}},onResize:(t,e,i)=>{m||b({width:i.offsetWidth,height:i.offsetHeight})},onResizeStop:(t,e,i)=>{m||g.blocks.Image.updateElement(s,"image",{sizes:{width:i.offsetWidth,height:i.offsetHeight}})},handleComponent:{left:m?e.jsx(e.Fragment,{}):e.jsx(qe,{position:"left"}),right:m?e.jsx(e.Fragment,{}):e.jsx(qe,{position:"right"})}}}),[w.width,w.height]);return l?e.jsx("div",Object.assign({"data-element-type":n.type,contentEditable:!1,draggable:!1,className:"mt-4 relative yoopta-image"},o,{children:e.jsxs(k,Object.assign({},y,{className:"mx-auto my-0 flex"},{children:[v&&e.jsx("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"}),e.jsx(a,{src:l,alt:c,srcSet:d,fit:p,width:null==w?void 0:w.width,bgColor:u,height:null==w?void 0:w.height}),!m&&e.jsx(Ge,{block:f,editor:g,props:n.props}),r]}))})):m?null:e.jsx(Ve,Object.assign({attributes:o,blockId:s},{children:r}))},props:{src:null,alt:null,srcSet:null,bgColor:null,fit:"contain",sizes:{width:650,height:500},nodeType:"void"}}},options:{display:{title:"Image",description:"Upload from device or embed with link"},onUpload:()=>Promise.resolve({src:null,alt:null}),accept:"image/png, image/jpeg, image/gif, image/webp",maxSizes:{maxWidth:650,maxHeight:550}},parsers:{html:{deserialize:{nodeNames:["IMG"],parse:e=>{if("IMG"===e.nodeName){const i={src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",srcSet:e.getAttribute("srcset")||"",sizes:{width:e.getAttribute("width")?parseInt(e.getAttribute("width")||"650",10):650,height:e.getAttribute("height")?parseInt(e.getAttribute("height")||"500",10):500}};return{id:t.generateId(),type:"image",children:[{text:""}],props:i}}}}}}});!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}.invisible{visibility:hidden}.fixed{position:fixed}.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}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.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)}.border-\\[rgba\\(55\\2c 53\\2c 47\\2c 0\\.16\\)\\]{border-color:rgba(55,53,47,.16)}.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-\\[rgba\\(55\\2c 53\\2c 47\\2c 0\\.16\\)\\]{background-color:rgba(55,53,47,.16)}.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{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.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)}.yoopta-image .yoopta-image-options{opacity:0;transition:opacity .15s ease-in-out}.yoopta-image:hover .yoopta-image-options{opacity: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)}"),exports.default=$e;
|
|
6
|
+
var Ke=["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(","),Qe="undefined"==typeof Element,et=Qe?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,tt=!Qe&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},ot=function e(t,o){var i;void 0===o&&(o=!0);var n=null==t||null===(i=t.getAttribute)||void 0===i?void 0:i.call(t,"inert");return""===n||"true"===n||o&&t&&e(t.parentNode)},it=function e(t,o,i){for(var n=[],r=Array.from(t);r.length;){var a=r.shift();if(!ot(a,!1))if("SLOT"===a.tagName){var s=a.assignedElements(),l=e(s.length?s:a.children,!0,i);i.flatten?n.push.apply(n,l):n.push({scopeParent:a,candidates:l})}else{et.call(a,Ke)&&i.filter(a)&&(o||!t.includes(a))&&n.push(a);var c=a.shadowRoot||"function"==typeof i.getShadowRoot&&i.getShadowRoot(a),d=!ot(c,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(a));if(c&&d){var p=e(!0===c?a.children:c.children,!0,i);i.flatten?n.push.apply(n,p):n.push({scopeParent:a,candidates:p})}else r.unshift.apply(r,a.children)}}return n},nt=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},rt=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,o=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===o||"true"===o}(e))&&!nt(e)?0:e.tabIndex},at=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},st=function(e){return"INPUT"===e.tagName},lt=function(e){return function(e){return st(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,o=e.form||tt(e),i=function(e){return o.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=i(window.CSS.escape(e.name));else try{t=i(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var n=function(e,t){for(var o=0;o<e.length;o++)if(e[o].checked&&e[o].form===t)return e[o]}(t,e.form);return!n||n===e}(e)},ct=function(e){var t=e.getBoundingClientRect(),o=t.width,i=t.height;return 0===o&&0===i},dt=function(e,t){var o=t.displayCheck,i=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var n=et.call(e,"details>summary:first-of-type")?e.parentElement:e;if(et.call(n,"details:not([open]) *"))return!0;if(o&&"full"!==o&&"legacy-full"!==o){if("non-zero-area"===o)return ct(e)}else{if("function"==typeof i){for(var r=e;e;){var a=e.parentElement,s=tt(e);if(a&&!a.shadowRoot&&!0===i(a))return ct(e);e=e.assignedSlot?e.assignedSlot:a||s===e.ownerDocument?a:s.host}e=r}if(function(e){var t,o,i,n,r=e&&tt(e),a=null===(t=r)||void 0===t?void 0:t.host,s=!1;if(r&&r!==e)for(s=!!(null!==(o=a)&&void 0!==o&&null!==(i=o.ownerDocument)&&void 0!==i&&i.contains(a)||null!=e&&null!==(n=e.ownerDocument)&&void 0!==n&&n.contains(e));!s&&a;){var l,c,d;s=!(null===(c=a=null===(l=r=tt(a))||void 0===l?void 0:l.host)||void 0===c||null===(d=c.ownerDocument)||void 0===d||!d.contains(a))}return s}(e))return!e.getClientRects().length;if("legacy-full"!==o)return!0}return!1},pt=function(e,t){return!(t.disabled||ot(t)||function(e){return st(e)&&"hidden"===e.type}(t)||dt(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var o=0;o<t.children.length;o++){var i=t.children.item(o);if("LEGEND"===i.tagName)return!!et.call(t,"fieldset[disabled] *")||!i.contains(e)}return!0}t=t.parentElement}return!1}(t))},ut=function(e,t){return!(lt(t)||rt(t)<0||!pt(e,t))},ht=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},gt=function e(t){var o=[],i=[];return t.forEach((function(t,n){var r=!!t.scopeParent,a=r?t.scopeParent:t,s=function(e,t){var o=rt(e);return o<0&&t&&!nt(e)?0:o}(a,r),l=r?e(t.candidates):a;0===s?r?o.push.apply(o,l):o.push(a):i.push({documentOrder:n,tabIndex:s,item:t,isScope:r,content:l})})),i.sort(at).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(o)},mt=function(e,t){var o;return o=(t=t||{}).getShadowRoot?it([e],t.includeContainer,{filter:ut.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:ht}):function(e,t,o){if(ot(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(Ke));return t&&et.call(e,Ke)&&i.unshift(e),i.filter(o)}(e,t.includeContainer,ut.bind(null,t)),gt(o)};const ft=p["useInsertionEffect".toString()]||(e=>e());var yt="undefined"!=typeof document?u:h;function wt(){return wt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},wt.apply(this,arguments)}let xt=!1,bt=0;const vt=()=>"floating-ui-"+bt++;const zt=p["useId".toString()]||function(){const[e,t]=p.useState((()=>xt?vt():void 0));return yt((()=>{null==e&&t(vt())}),[]),p.useEffect((()=>{xt||(xt=!0)}),[]),e};const Ct=p.createContext(null),St=p.createContext(null);function Rt(e){return"data-floating-ui-"+e}const _t=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Et(e,t){const o=mt(e,_t());"prev"===t&&o.reverse();const i=o.indexOf(function(e){let t=e.activeElement;for(;null!=(null==(o=t)||null==(o=o.shadowRoot)?void 0:o.activeElement);){var o;t=t.shadowRoot.activeElement}return t}((null==(n=e)?void 0:n.ownerDocument)||document));var n;return o.slice(i+1)[0]}function kt(e,t){const o=t||e.currentTarget,i=e.relatedTarget;return!i||!function(e,t){if(!e||!t)return!1;const o=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(o&&$(o)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}(o,i)}function Lt(e){mt(e,_t()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function Ot(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const Nt={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 jt(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Mt=p.forwardRef((function(e,t){const[o,i]=p.useState();yt((()=>(/apple/i.test(navigator.vendor)&&i("button"),document.addEventListener("keydown",jt),()=>{document.removeEventListener("keydown",jt)})),[]);const n={ref:t,tabIndex:0,role:o,"aria-hidden":!o||void 0,[Rt("focus-guard")]:"",style:Nt};return p.createElement("span",wt({},e,n))})),Wt=p.createContext(null),At=Rt("portal");function Tt(e){let{children:t,id:o,root:i=null,preserveTabOrder:n=!0}=e;const r=function(e){let{id:t,root:o}=void 0===e?{}:e;const[i,n]=p.useState(null),r=zt(),a=Bt(),s=p.useRef(null);return yt((()=>()=>{null==i||i.remove(),queueMicrotask((()=>{s.current=null}))}),[i]),yt((()=>{if(s.current)return;const e=t?document.getElementById(t):null;if(!e)return;const o=document.createElement("div");o.id=r,o.setAttribute(At,""),e.appendChild(o),s.current=o,n(o)}),[t,r]),yt((()=>{if(s.current)return;let e=o||(null==a?void 0:a.portalNode);e&&!Y(e)&&(e=e.current),e=e||document.body;let i=null;t&&(i=document.createElement("div"),i.id=t,e.appendChild(i));const l=document.createElement("div");l.id=r,l.setAttribute(At,""),e=i||e,e.appendChild(l),s.current=l,n(l)}),[t,o,r,a]),i}({id:o,root:i}),[a,s]=p.useState(null),l=p.useRef(null),c=p.useRef(null),d=p.useRef(null),u=p.useRef(null),h=!!a&&!a.modal&&a.open&&n&&!(!i&&!r);return p.useEffect((()=>{if(r&&n&&(null==a||!a.modal))return r.addEventListener("focusin",e,!0),r.addEventListener("focusout",e,!0),()=>{r.removeEventListener("focusin",e,!0),r.removeEventListener("focusout",e,!0)};function e(e){if(r&&kt(e)){("focusin"===e.type?Ot:Lt)(r)}}}),[r,n,null==a?void 0:a.modal]),p.createElement(Wt.Provider,{value:p.useMemo((()=>({preserveTabOrder:n,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:d,afterInsideRef:u,portalNode:r,setFocusManagerState:s})),[n,r])},h&&r&&p.createElement(Mt,{"data-type":"outside",ref:l,onFocus:e=>{if(kt(e,r)){var t;null==(t=d.current)||t.focus()}else{const e=Et(document.body,"prev")||(null==a?void 0:a.refs.domReference.current);null==e||e.focus()}}}),h&&r&&p.createElement("span",{"aria-owns":r.id,style:Nt}),r&&b(t,r),h&&r&&p.createElement(Mt,{"data-type":"outside",ref:c,onFocus:e=>{if(kt(e,r)){var t;null==(t=u.current)||t.focus()}else{const t=Et(document.body,"next")||(null==a?void 0:a.refs.domReference.current);null==t||t.focus(),(null==a?void 0:a.closeOnFocusOut)&&(null==a||a.onOpenChange(!1,e.nativeEvent))}}}))}const Bt=()=>p.useContext(Wt),Pt=new Set,Ft=p.forwardRef((function(e,t){let{lockScroll:o=!1,...i}=e;const n=zt();return yt((()=>{if(!o)return;Pt.add(n);const e=/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()),t=document.body.style,i=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",r=window.innerWidth-document.documentElement.clientWidth,a=t.left?parseFloat(t.left):window.pageXOffset,s=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",r&&(t[i]=r+"px"),e){var l,c;const e=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,o=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(s-Math.floor(o))+"px",left:-(a-Math.floor(e))+"px",right:"0"})}return()=>{Pt.delete(n),0===Pt.size&&(Object.assign(t,{overflow:"",[i]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(a,s)))}}),[n,o]),p.createElement("div",wt({ref:t},i,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...i.style}}))}));function Ht(e){var t;void 0===e&&(e={});const{open:o=!1,onOpenChange:i,nodeId:n}=e,[r,a]=p.useState(null),s=(null==(t=e.elements)?void 0:t.reference)||r,l=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:o="absolute",middleware:i=[],platform:n,elements:{reference:r,floating:a}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[d,u]=p.useState({x:0,y:0,strategy:o,placement:t,middlewareData:{},isPositioned:!1}),[h,g]=p.useState(i);Ge(h,i)||g(i);const[m,f]=p.useState(null),[y,x]=p.useState(null),b=p.useCallback((e=>{e!==S.current&&(S.current=e,f(e))}),[]),v=p.useCallback((e=>{e!==R.current&&(R.current=e,x(e))}),[]),z=r||m,C=a||y,S=p.useRef(null),R=p.useRef(null),_=p.useRef(d),E=null!=l,k=Je(l),L=Je(n),O=p.useCallback((()=>{if(!S.current||!R.current)return;const e={placement:t,strategy:o,middleware:h};L.current&&(e.platform=L.current),Xe(S.current,R.current,e).then((e=>{const t={...e,isPositioned:!0};N.current&&!Ge(_.current,t)&&(_.current=t,w.flushSync((()=>{u(t)})))}))}),[h,t,o,L]);Ye((()=>{!1===c&&_.current.isPositioned&&(_.current.isPositioned=!1,u((e=>({...e,isPositioned:!1}))))}),[c]);const N=p.useRef(!1);Ye((()=>(N.current=!0,()=>{N.current=!1})),[]),Ye((()=>{if(z&&(S.current=z),C&&(R.current=C),z&&C){if(k.current)return k.current(z,C,O);O()}}),[z,C,O,k,E]);const j=p.useMemo((()=>({reference:S,floating:R,setReference:b,setFloating:v})),[b,v]),M=p.useMemo((()=>({reference:z,floating:C})),[z,C]),W=p.useMemo((()=>{const e={position:o,left:0,top:0};if(!M.floating)return e;const t=qe(M.floating,d.x),i=qe(M.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+i+"px)",...$e(M.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:t,top:i}}),[o,s,M.floating,d.x,d.y]);return p.useMemo((()=>({...d,update:O,refs:j,elements:M,floatingStyles:W})),[d,O,j,M,W])}(e),c=p.useContext(St),d=null!=((null==(u=p.useContext(Ct))?void 0:u.id)||null);var u;const h=function(e){const t=p.useRef((()=>{}));return ft((()=>{t.current=e})),p.useCallback((function(){for(var e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];return null==t.current?void 0:t.current(...o)}),[])}(((e,t,o)=>{e&&(m.current.openEvent=t),f.emit("openchange",{open:e,event:t,reason:o,nested:d}),null==i||i(e,t,o)})),g=p.useRef(null),m=p.useRef({}),f=p.useState((()=>function(){const e=new Map;return{emit(t,o){var i;null==(i=e.get(t))||i.forEach((e=>e(o)))},on(t,o){e.set(t,[...e.get(t)||[],o])},off(t,o){var i;e.set(t,(null==(i=e.get(t))?void 0:i.filter((e=>e!==o)))||[])}}}()))[0],y=zt(),x=p.useCallback((e=>{const t=Y(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l.refs.setReference(t)}),[l.refs]),b=p.useCallback((e=>{(Y(e)||null===e)&&(g.current=e,a(e)),(Y(l.refs.reference.current)||null===l.refs.reference.current||null!==e&&!Y(e))&&l.refs.setReference(e)}),[l.refs]),v=p.useMemo((()=>({...l.refs,setReference:b,setPositionReference:x,domReference:g})),[l.refs,b,x]),z=p.useMemo((()=>({...l.elements,domReference:s})),[l.elements,s]),C=p.useMemo((()=>({...l,refs:v,elements:z,dataRef:m,nodeId:n,floatingId:y,events:f,open:o,onOpenChange:h})),[l,n,y,f,o,h,v,z]);return yt((()=>{const e=null==c?void 0:c.nodesRef.current.find((e=>e.id===n));e&&(e.context=C)})),p.useMemo((()=>({...l,context:C,refs:v,elements:z})),[l,v,z,C])}function It(e,t){if(null==e)return{};var o,i,n={},r=Object.keys(e);for(i=0;i<r.length;i++)o=r[i],t.indexOf(o)>=0||(n[o]=e[o]);return n}var Dt=["color"],Vt=g((function(e,t){var o=e.color,i=void 0===o?"currentColor":o,n=It(e,Dt);return m("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n,{ref:t}),m("path",{d:"M2.5 1H12.5C13.3284 1 14 1.67157 14 2.5V12.5C14 13.3284 13.3284 14 12.5 14H2.5C1.67157 14 1 13.3284 1 12.5V2.5C1 1.67157 1.67157 1 2.5 1ZM2.5 2C2.22386 2 2 2.22386 2 2.5V8.3636L3.6818 6.6818C3.76809 6.59551 3.88572 6.54797 4.00774 6.55007C4.12975 6.55216 4.24568 6.60372 4.32895 6.69293L7.87355 10.4901L10.6818 7.6818C10.8575 7.50607 11.1425 7.50607 11.3182 7.6818L13 9.3636V2.5C13 2.22386 12.7761 2 12.5 2H2.5ZM2 12.5V9.6364L3.98887 7.64753L7.5311 11.4421L8.94113 13H2.5C2.22386 13 2 12.7761 2 12.5ZM12.5 13H10.155L8.48336 11.153L11 8.6364L13 10.6364V12.5C13 12.7761 12.7761 13 12.5 13ZM6.64922 5.5C6.64922 5.03013 7.03013 4.64922 7.5 4.64922C7.96987 4.64922 8.35078 5.03013 8.35078 5.5C8.35078 5.96987 7.96987 6.35078 7.5 6.35078C7.03013 6.35078 6.64922 5.96987 6.64922 5.5ZM7.5 3.74922C6.53307 3.74922 5.74922 4.53307 5.74922 5.5C5.74922 6.46693 6.53307 7.25078 7.5 7.25078C8.46693 7.25078 9.25078 6.46693 9.25078 5.5C9.25078 4.53307 8.46693 3.74922 7.5 3.74922Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))})),Ut=["color"],Zt=g((function(e,t){var o=e.color,i=void 0===o?"currentColor":o,n=It(e,Ut);return m("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n,{ref:t}),m("path",{d:"M7.81832 0.68179C7.64258 0.506054 7.35766 0.506054 7.18192 0.68179L5.18192 2.68179C5.00619 2.85753 5.00619 3.14245 5.18192 3.31819C5.35766 3.49392 5.64258 3.49392 5.81832 3.31819L7.05012 2.08638L7.05012 5.50023C7.05012 5.74876 7.25159 5.95023 7.50012 5.95023C7.74865 5.95023 7.95012 5.74876 7.95012 5.50023L7.95012 2.08638L9.18192 3.31819C9.35766 3.49392 9.64258 3.49392 9.81832 3.31819C9.99406 3.14245 9.99406 2.85753 9.81832 2.68179L7.81832 0.68179ZM7.95012 12.9136V9.50023C7.95012 9.2517 7.74865 9.05023 7.50012 9.05023C7.25159 9.05023 7.05012 9.2517 7.05012 9.50023V12.9136L5.81832 11.6818C5.64258 11.5061 5.35766 11.5061 5.18192 11.6818C5.00619 11.8575 5.00619 12.1424 5.18192 12.3182L7.18192 14.3182C7.26632 14.4026 7.38077 14.45 7.50012 14.45C7.61947 14.45 7.73393 14.4026 7.81832 14.3182L9.81832 12.3182C9.99406 12.1424 9.99406 11.8575 9.81832 11.6818C9.64258 11.5061 9.35766 11.5061 9.18192 11.6818L7.95012 12.9136ZM1.49994 7.00017C1.2238 7.00017 0.999939 7.22403 0.999939 7.50017C0.999939 7.77631 1.2238 8.00017 1.49994 8.00017L13.4999 8.00017C13.7761 8.00017 13.9999 7.77631 13.9999 7.50017C13.9999 7.22403 13.7761 7.00017 13.4999 7.00017L1.49994 7.00017Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))})),Xt=["color"],Yt=g((function(e,t){var o=e.color,i=void 0===o?"currentColor":o,n=It(e,Xt);return m("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n,{ref:t}),m("path",{d:"M11.5 3.04999C11.7485 3.04999 11.95 3.25146 11.95 3.49999V7.49999C11.95 7.74852 11.7485 7.94999 11.5 7.94999C11.2515 7.94999 11.05 7.74852 11.05 7.49999V4.58639L4.58638 11.05H7.49999C7.74852 11.05 7.94999 11.2515 7.94999 11.5C7.94999 11.7485 7.74852 11.95 7.49999 11.95L3.49999 11.95C3.38064 11.95 3.26618 11.9026 3.18179 11.8182C3.0974 11.7338 3.04999 11.6193 3.04999 11.5L3.04999 7.49999C3.04999 7.25146 3.25146 7.04999 3.49999 7.04999C3.74852 7.04999 3.94999 7.25146 3.94999 7.49999L3.94999 10.4136L10.4136 3.94999L7.49999 3.94999C7.25146 3.94999 7.04999 3.74852 7.04999 3.49999C7.04999 3.25146 7.25146 3.04999 7.49999 3.04999L11.5 3.04999Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))})),Gt=["color"],$t=g((function(e,t){var o=e.color,i=void 0===o?"currentColor":o,n=It(e,Gt);return m("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n,{ref:t}),m("path",{d:"M4.81812 4.68161C4.99386 4.85734 4.99386 5.14227 4.81812 5.318L3.08632 7.0498H11.9135L10.1817 5.318C10.006 5.14227 10.006 4.85734 10.1817 4.68161C10.3575 4.50587 10.6424 4.50587 10.8181 4.68161L13.3181 7.18161C13.4939 7.35734 13.4939 7.64227 13.3181 7.818L10.8181 10.318C10.6424 10.4937 10.3575 10.4937 10.1817 10.318C10.006 10.1423 10.006 9.85734 10.1817 9.68161L11.9135 7.9498H3.08632L4.81812 9.68161C4.99386 9.85734 4.99386 10.1423 4.81812 10.318C4.64239 10.4937 4.35746 10.4937 4.18173 10.318L1.68173 7.818C1.50599 7.64227 1.50599 7.35734 1.68173 7.18161L4.18173 4.68161C4.35746 4.50587 4.64239 4.50587 4.81812 4.68161Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}));const qt=({blockId:t,onClose:o})=>{const i=e(),[n,r]=f(""),a=0===n.length;return c("div",Object.assign({className:"yoo-image-cursor-pointer yoo-image-user-select-none yoo-image-transition-bg yoo-image-duration-20 yoo-image-ease-in yoo-image-white-space-nowrap yoo-image-w-full"},{children:[l("input",{type:"text",placeholder:"Paste image link",value:n,className:"yoo-image-items-center yoo-image-bg-[hsla(45,13%,94%,.6)] yoo-image-rounded-[4px] yoo-image-shadow-[inset_0_0_0_1px_hsla(0,0%,6%,.1)] yoo-image-cursor-text yoo-image-flex yoo-image-text-[14px] yoo-image-h-[32px] yoo-image-leading-[20px] yoo-image-px-[6px] yoo-image-relative yoo-image-w-full yoo-image-border-none",onChange:e=>r(e.target.value)}),l("button",Object.assign({type:"button",className:"yoo-image-user-select-none yoo-image-transition-bg yoo-image-duration-20 yoo-image-ease-in yoo-image-cursor-pointer yoo-image-flex yoo-image-items-center yoo-image-justify-center yoo-image-flex-shrink-0 yoo-image-white-space-nowrap yoo-image-h-[28px] yoo-image-rounded-[4px] yoo-image-shadow-[rgba(15,15,15,0.1)_0px_0px_0px_1px_inset,_rgba(15,15,15,0.1)_0px_1px_2px] yoo-image-bg-[rgb(35,131,226)] yoo-image-text-white yoo-image-fill-white yoo-image-leading-[1.2] yoo-image-px-[12px] yoo-image-text-[14px] yoo-image-font-medium yoo-image-w-full yoo-image-max-w-[300px] yoo-image-mx-auto yoo-image-m-[12px_0_6px] disabled:yoo-image-bg-[rgba(35,131,226,0.5)] disabled:yoo-image-cursor-not-allowed",disabled:a,onClick:()=>{0!==n.length&&(i.blocks.Image.updateElement(t,"image",{src:n}),o())}},{children:"Embed image"}))]}))};function Jt(e,t,o,i){return new(o||(o=Promise))((function(n,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const Kt=({accept:o="image/*",onClose:i,blockId:n,onSetLoading:r})=>{const a=t("Image"),s=e();return l("div",Object.assign({className:"yoo-image-user-select-none yoo-image-transition-bg yoo-image-duration-20 yoo-image-ease-in yoo-image-white-space-nowrap yoo-image-rounded-[4px] yoo-image-h-[32px] yoo-image-px-[12px] yoo-image-border yoo-image-border-solid yoo-image-border-[rgba(55,53,47,0.16)] yoo-image-w-full yoo-image-cursor-pointer"},{children:c("label",Object.assign({htmlFor:"image-uploader",className:"yoo-image-text-[14px] yoo-image-leading-[1.2] yoo-image-font-medium yoo-image-cursor-pointer yoo-image-w-full yoo-image-flex yoo-image-items-center yoo-image-justify-center yoo-image-h-full"},{children:[l("input",{type:"file",id:"image-uploader",className:"yoo-image-absolute yoo-image-left-0 yoo-image-top-0 yoo-image-invisible",accept:(null==a?void 0:a.accept)||o,onChange:e=>{const t=e.target.files[0];t&&(e=>{Jt(void 0,void 0,void 0,(function*(){if(null==a?void 0:a.onUpload){i(),r(!0);try{const t=yield null==a?void 0:a.onUpload(e);s.blocks.Image.updateElement(n,"image",{src:t.src,alt:t.alt,sizes:t.sizes,bgColor:t.bgColor,fit:"contain"})}catch(e){}finally{r(!1)}}else console.warn("onUpload not provided")}))})(t)},multiple:!1}),"Upload image"]}))}))},Qt=({floatingStyles:e,refs:t,onClose:o,blockId:i,onSetLoading:n})=>{const[r,a]=f("upload"),s=e=>a(e),d="upload"===r,p="embed"===r,u=e=>({borderBottom:e?"2px solid #2483e2":"2px solid transparent"});return l(Tt,Object.assign({id:"yoo-image-uploader-portal",root:document.getElementById("yoopta-editor")},{children:l(Ft,Object.assign({lockScroll:!0,className:"yoo-image-z-[100]",onClick:o},{children:l("div",Object.assign({ref:t.setFloating,style:e,onClick:e=>e.stopPropagation()},{children:c("div",Object.assign({className:"yoo-image-flex yoo-image-flex-col yoo-image-min-w-[540px] yoo-image-max-w-[calc(100vw-24px)] yoo-image-h-full yoo-image-max-h-[420px] yoo-image-bg-[#FFFFFF] yoo-image-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:[c("div",Object.assign({className:"yoo-image-w-full yoo-image-flex yoo-image-text-[14px] yoo-image-p-[0_8px] yoo-image-shadow-[rgb(55_53_47_/9%)_0px_-1px_0px_inset] yoo-image-relative yoo-image-z-10 yoo-image-h-[40px]"},{children:[l("button",Object.assign({type:"button",onClick:()=>s("upload"),style:u(d),className:"yoo-image-py-[6px] yoo-image-whitespace-nowrap yoo-image-min-w-0 yoo-image-flex-shrink-0 yoo-image-text-[rgb(55,53,47)] yoo-image-relative yoo-image-cursor-pointer yoo-image-user-select-none yoo-image-bg-inherit yoo-image-transition-[height_20ms_ease-in] yoo-image-inline-flex yoo-image-items-center yoo-image-h-full yoo-image-text-[14px] yoo-image-leading-[1.2] yoo-image-px-[8px]"},{children:"Upload"})),l("button",Object.assign({type:"button",onClick:()=>s("embed"),style:u(p),className:"yoo-image-py-[6px] yoo-image-whitespace-nowrap yoo-image-min-w-0 yoo-image-flex-shrink-0 yoo-image-text-[rgb(55,53,47)] yoo-image-relative yoo-image-cursor-pointer yoo-image-user-select-none yoo-image-bg-inherit yoo-image-transition-[height_20ms_ease-in] yoo-image-inline-flex yoo-image-items-center yoo-image-h-full yoo-image-text-[14px] yoo-image-leading-[1.2] yoo-image-px-[8px]"},{children:"Image link"}))]})),c("div",Object.assign({className:"yoo-image-pt-[6px] yoo-image-pb-[6px] yoo-image-mt-[4px] yoo-image-flex yoo-image-justify-center yoo-image-mr-[12px] yoo-image-ml-[12px]"},{children:[p&&l(qt,{onClose:o,blockId:i}),d&&l(Kt,{onClose:o,blockId:i,onSetLoading:n})]}))]}))}))}))}))},eo=({className:e,width:t,height:o,children:i})=>c("div",Object.assign({className:e},{children:[i,l("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:t,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-2 yoo-image-h-4 yoo-image-w-4 yoo-image-animate-spin"},{children:l("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}))]})),to=({attributes:e,children:t,blockId:o})=>{const[i,n]=f(!1),[r,a]=f(!1),{refs:s,floatingStyles:d}=Ht({placement:"bottom",open:i,onOpenChange:n,middleware:[Ze(),Ue(),Ve(),Ee(10)]});return c("div",Object.assign({className:"yoo-image-w-full yoo-image-user-select-none yoo-image-m-[20px_0_10px] yoo-image-relative yoo-image-flex"},e,{contentEditable:!1},{children:[c("button",Object.assign({className:"yoo-image-p-[12px_36px_12px_12px] yoo-image-flex yoo-image-items-center yoo-image-text-left yoo-image-w-full yoo-image-overflow-hidden yoo-image-rounded-[3px] yoo-image-text-[14px] yoo-image-text-[rgba(55,53,47,0.65)] yoo-image-relative yoo-image-cursor-pointer yoo-image-border-none yoo-image-bg-[#efefef] yoo-image-transition-[background-color_100ms_ease-in] hover:yoo-image-bg-[#e3e3e3]",onClick:()=>n(!0),disabled:r,ref:s.setReference},{children:[l(r?eo:Vt,{className:"yoo-image-mr-2 yoo-image-user-select-none",width:24,height:24}),l("span",Object.assign({className:"yoo-image-font-medium"},{children:r?"Loading...":"Click to add image"})),r&&l("div",{className:"yoo-image-absolute yoo-image-top-0 yoo-image-left-0 yoo-image-h-full yoo-image-bg-[rgba(55,53,47,0.16)]",style:{width:"100%",transition:"width 100ms ease-in"}})]})),i&&l(Qt,{blockId:o,floatingStyles:d,refs:s,onClose:()=>n(!1),onSetLoading:e=>a(e)}),t]}))};var oo;function io(){return io=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},io.apply(this,arguments)}var no,ro=function(e){return p.createElement("svg",io({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"checkmark_svg__lucide checkmark_svg__lucide-check"},e),oo||(oo=p.createElement("path",{d:"M20 6 9 17l-5-5"})))};function ao(){return ao=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},ao.apply(this,arguments)}var so=function(e){return p.createElement("svg",ao({viewBox:"0 0 16 16",style:{width:16,height:16,display:"block",fill:"rgba(55,53,47,.85)",flexShrink:0}},e),no||(no=p.createElement("path",{d:"M8.215 15.126c3.862 0 7.061-3.192 7.061-7.062 0-3.862-3.199-7.061-7.068-7.061-3.862 0-7.055 3.2-7.055 7.061 0 3.87 3.2 7.062 7.062 7.062zm0-1.388a5.654 5.654 0 0 1-5.667-5.674 5.642 5.642 0 0 1 5.66-5.667 5.66 5.66 0 0 1 5.68 5.667 5.66 5.66 0 0 1-5.673 5.674zm0-9.174c-.342 0-.602.247-.602.588v3.234l.062 1.401-.622-.766-.766-.8a.557.557 0 0 0-.41-.177.54.54 0 0 0-.56.547c0 .164.054.3.163.41l2.256 2.283c.15.157.294.226.479.226.191 0 .335-.075.485-.226l2.256-2.283a.557.557 0 0 0 .164-.41.539.539 0 0 0-.56-.547.523.523 0 0 0-.41.178l-.766.793-.622.779.054-1.408V5.152c0-.341-.253-.588-.601-.588z"})))};const{ExtendedBlockActions:lo,BlockOptionsMenuGroup:co,BlockOptionsMenuItem:po,BlockOptionsSeparator:uo}=o,ho=({editor:e,block:t,props:o})=>c(lo,Object.assign({onClick:()=>e.setSelection([t.meta.order]),className:"yoopta-image-options"},{children:[l(uo,{}),c(co,{children:[l(po,{children:c("button",Object.assign({type:"button",className:"yoo-image-rounded-sm yoo-image-justify-between hover:yoo-image-bg-[#37352f14] yoo-image-leading-[120%] yoo-image-px-2 yoo-image-py-1.5 yoo-image-mx-[4px] yoo-image-cursor-pointer yoo-image-w-full yoo-image-flex yoo-image-justify-start",onClick:()=>{e.blocks.Image.updateElement(t.id,"image",{fit:"contain"})}},{children:[c("span",Object.assign({className:"yoo-image-flex"},{children:[l(Zt,{width:16,height:16,className:"yoo-image-w-4 yoo-image-h-4 yoo-image-mr-2"}),"Fit"]})),"contain"===(null==o?void 0:o.fit)&&l(ro,{width:16,height:16,className:"yoo-image-w-4 yoo-image-h-4"})]}))}),l(po,{children:c("button",Object.assign({type:"button",className:"yoo-image-rounded-sm yoo-image-justify-between hover:yoo-image-bg-[#37352f14] yoo-image-leading-[120%] yoo-image-px-2 yoo-image-py-1.5 yoo-image-mx-[4px] yoo-image-cursor-pointer yoo-image-w-full yoo-image-flex yoo-image-justify-start",onClick:()=>{e.blocks.Image.updateElement(t.id,"image",{fit:"fill"})}},{children:[c("span",Object.assign({className:"yoo-image-flex"},{children:[l($t,{width:16,height:16,className:"yoo-image-w-4 yoo-image-h-4 yoo-image-mr-2"}),"Fill"]})),"fill"===(null==o?void 0:o.fit)&&l(ro,{width:16,height:16,className:"yoo-image-w-4 yoo-image-h-4"})]}))}),l(po,{children:c("button",Object.assign({type:"button",className:"yoo-image-rounded-sm yoo-image-justify-between hover:yoo-image-bg-[#37352f14] yoo-image-leading-[120%] yoo-image-px-2 yoo-image-py-1.5 yoo-image-mx-[4px] yoo-image-cursor-pointer yoo-image-w-full yoo-image-flex yoo-image-justify-start",onClick:()=>{e.blocks.Image.updateElement(t.id,"image",{fit:"cover"})}},{children:[c("span",Object.assign({className:"yoo-image-flex"},{children:[l(Yt,{width:16,height:16,className:"yoo-image-w-4 yoo-image-h-4 yoo-image-mr-2"}),"Cover"]})),"cover"===(null==o?void 0:o.fit)&&l(ro,{width:16,height:16,className:"yoo-image-w-4 yoo-image-h-4"})]}))})]}),l(uo,{}),l(co,{children:l(po,{children:c("button",Object.assign({type:"button",className:"yoo-image-rounded-sm hover:yoo-image-bg-[#37352f14] yoo-image-leading-[120%] yoo-image-px-2 yoo-image-py-1.5 yoo-image-mx-[4px] yoo-image-cursor-pointer yoo-image-w-full yoo-image-flex yoo-image-justify-start",onClick:()=>{if(!o||!o.src)return;const e=document.createElement("a");e.href=o.src,e.download=o.alt||o.src,e.target="_blank",e.rel="noopener noreferrer",document.body.appendChild(e),e.click(),document.body.removeChild(e)}},{children:[l(so,{width:16,height:16,className:"yoo-image-w-4 yoo-image-h-4 yoo-image-mr-2"}),"Download"]}))})})]})),go=({position:e})=>l("div",Object.assign({contentEditable:!1,className:"yoo-image-absolute yoo-image-pointer-events-none yoo-image-flex yoo-image-items-center yoo-image-justify-center yoo-image-z-10 yoo-image-opacity-1 yoo-image-h-full yoo-image-w-[15px] yoo-image-cursor-col-resize yoo-image-transition-opacity yoo-image-duration-150 yoo-image-ease-in "+("left"===e?"yoo-image-left-0 yoo-image-top-0":"yoo-image-right-0 yoo-image-top-0")},{children:l("div",{className:"yoo-image-opacity-100 yoo-image-transition-opacity yoo-image-duration-300 yoo-image-ease-in yoo-image-rounded-[20px] yoo-image-bg-[rgba(15,15,15,0.6)] yoo-image-border yoo-image-border-solid yoo-image-border-[rgba(255,255,255,0.9)] yoo-image-w-[6px] yoo-image-h-[48px] yoo-image-max-h-[50%] yoo-image-shadow-[0_0_0_.5px_#FFF]"})})),mo=new a({type:"Image",elements:{image:{render:({element:o,attributes:a,children:s,blockId:p})=>{const{src:u,alt:g,srcSet:m,bgColor:w,fit:x,sizes:b}=o.props||{},z=i(p),C=e(),S=n(),R=t("Image"),[_,E]=f({width:(null==b?void 0:b.width)||650,height:(null==b?void 0:b.height)||440});h((()=>E({width:(null==b?void 0:b.width)||650,height:(null==b?void 0:b.height)||440})),[o.props]);const k=r({blockId:p}),L=y((()=>{var e,t;return{minWidth:300,size:{width:_.width,height:_.height},maxWidth:(null===(e=null==R?void 0:R.maxSizes)||void 0===e?void 0:e.maxWidth)||800,maxHeight:(null===(t=null==R?void 0:R.maxSizes)||void 0===t?void 0:t.maxHeight)||720,lockAspectRatio:!0,resizeRatio:2,enable:{left:!S,right:!S},handleStyles:{left:{left:0},right:{right:0}},onResize:(e,t,o)=>{S||E({width:o.offsetWidth,height:o.offsetHeight})},onResizeStop:(e,t,o)=>{S||C.blocks.Image.updateElement(p,"image",{sizes:{width:o.offsetWidth,height:o.offsetHeight}})},handleComponent:{left:S?l(d,{}):l(go,{position:"left"}),right:S?l(d,{}):l(go,{position:"right"})}}}),[_.width,_.height]);return u?l("div",Object.assign({"data-element-type":o.type,contentEditable:!1,draggable:!1,className:"yoo-image-mt-4 yoo-image-relative yoopta-image"},a,{children:c(D,Object.assign({},L,{className:"yoo-image-mx-auto yoo-image-my-0 yoo-image-flex"},{children:[k&&l("div",{className:"yoo-image-absolute yoo-image-pointer-events-none yoo-image-inset-0 yoo-image-bg-[rgba(35,131,226,0.14)] yoo-image-z-[81] yoo-image-rounded-[3px] yoo-image-opacity-100 yoo-image-transition-opacity yoo-image-duration-150 yoo-image-ease-in"}),l(v,{src:u,alt:g,srcSet:m,fit:x,width:null==_?void 0:_.width,bgColor:w,height:null==_?void 0:_.height}),!S&&l(ho,{block:z,editor:C,props:o.props}),s]}))})):S?null:l(to,Object.assign({attributes:a,blockId:p},{children:s}))},props:{src:null,alt:null,srcSet:null,bgColor:null,fit:"contain",sizes:{width:650,height:500},nodeType:"void"}}},options:{display:{title:"Image",description:"Upload from device or embed with link"},onUpload:()=>Promise.resolve({src:null,alt:null}),accept:"image/png, image/jpeg, image/gif, image/webp",maxSizes:{maxWidth:650,maxHeight:550}},parsers:{html:{deserialize:{nodeNames:["IMG"],parse:e=>{if("IMG"===e.nodeName){const t={src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",srcSet:e.getAttribute("srcset")||"",sizes:{width:e.getAttribute("width")?parseInt(e.getAttribute("width")||"650",10):650,height:e.getAttribute("height")?parseInt(e.getAttribute("height")||"500",10):500}};return{id:s(),type:"image",children:[{text:""}],props:t}}}}}}});!function(e,t){void 0===t&&(t={});var o=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===o&&i.firstChild?i.insertBefore(n,i.firstChild):i.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("#yoopta-editor .yoo-image-pointer-events-none{pointer-events:none}#yoopta-editor .yoo-image-invisible{visibility:hidden}#yoopta-editor .yoo-image-absolute{position:absolute}#yoopta-editor .yoo-image-relative{position:relative}#yoopta-editor .yoo-image-inset-0{inset:0}#yoopta-editor .yoo-image-left-0{left:0}#yoopta-editor .yoo-image-right-0{right:0}#yoopta-editor .yoo-image-top-0{top:0}#yoopta-editor .yoo-image-z-10{z-index:10}#yoopta-editor .yoo-image-z-\\[100\\]{z-index:100}#yoopta-editor .yoo-image-z-\\[81\\]{z-index:81}#yoopta-editor .yoo-image-m-\\[12px_0_6px\\]{margin:12px 0 6px}#yoopta-editor .yoo-image-m-\\[20px_0_10px\\]{margin:20px 0 10px}#yoopta-editor .yoo-image-mx-\\[4px\\]{margin-left:4px;margin-right:4px}#yoopta-editor .yoo-image-mx-auto{margin-left:auto;margin-right:auto}#yoopta-editor .yoo-image-my-0{margin-bottom:0;margin-top:0}#yoopta-editor .yoo-image-ml-\\[12px\\]{margin-left:12px}#yoopta-editor .yoo-image-mr-2{margin-right:.5rem}#yoopta-editor .yoo-image-mr-\\[12px\\]{margin-right:12px}#yoopta-editor .yoo-image-mt-4{margin-top:1rem}#yoopta-editor .yoo-image-mt-\\[4px\\]{margin-top:4px}#yoopta-editor .yoo-image-flex{display:flex}#yoopta-editor .yoo-image-inline-flex{display:inline-flex}#yoopta-editor .yoo-image-h-4{height:1rem}#yoopta-editor .yoo-image-h-\\[28px\\]{height:28px}#yoopta-editor .yoo-image-h-\\[32px\\]{height:32px}#yoopta-editor .yoo-image-h-\\[40px\\]{height:40px}#yoopta-editor .yoo-image-h-\\[48px\\]{height:48px}#yoopta-editor .yoo-image-h-full{height:100%}#yoopta-editor .yoo-image-max-h-\\[420px\\]{max-height:420px}#yoopta-editor .yoo-image-max-h-\\[50\\%\\]{max-height:50%}#yoopta-editor .yoo-image-w-4{width:1rem}#yoopta-editor .yoo-image-w-\\[15px\\]{width:15px}#yoopta-editor .yoo-image-w-\\[6px\\]{width:6px}#yoopta-editor .yoo-image-w-full{width:100%}#yoopta-editor .yoo-image-min-w-0{min-width:0}#yoopta-editor .yoo-image-min-w-\\[540px\\]{min-width:540px}#yoopta-editor .yoo-image-max-w-\\[300px\\]{max-width:300px}#yoopta-editor .yoo-image-max-w-\\[calc\\(100vw-24px\\)\\]{max-width:calc(100vw - 24px)}#yoopta-editor .yoo-image-flex-shrink-0{flex-shrink:0}@keyframes yoo-image-spin{#yoopta-editor to{transform:rotate(1turn)}}#yoopta-editor .yoo-image-animate-spin{animation:yoo-image-spin 1s linear infinite}#yoopta-editor .yoo-image-cursor-col-resize{cursor:col-resize}#yoopta-editor .yoo-image-cursor-pointer{cursor:pointer}#yoopta-editor .yoo-image-cursor-text{cursor:text}#yoopta-editor .yoo-image-flex-col{flex-direction:column}#yoopta-editor .yoo-image-items-center{align-items:center}#yoopta-editor .yoo-image-justify-start{justify-content:flex-start}#yoopta-editor .yoo-image-justify-center{justify-content:center}#yoopta-editor .yoo-image-justify-between{justify-content:space-between}#yoopta-editor .yoo-image-overflow-hidden{overflow:hidden}#yoopta-editor .yoo-image-whitespace-nowrap{white-space:nowrap}#yoopta-editor .yoo-image-rounded-\\[20px\\]{border-radius:20px}#yoopta-editor .yoo-image-rounded-\\[3px\\]{border-radius:3px}#yoopta-editor .yoo-image-rounded-\\[4px\\]{border-radius:4px}#yoopta-editor .yoo-image-rounded-sm{border-radius:.125rem}#yoopta-editor .yoo-image-border{border-width:1px}#yoopta-editor .yoo-image-border-solid{border-style:solid}#yoopta-editor .yoo-image-border-none{border-style:none}#yoopta-editor .yoo-image-border-\\[rgba\\(255\\,255\\,255\\,0\\.9\\)\\]{border-color:hsla(0,0%,100%,.9)}#yoopta-editor .yoo-image-border-\\[rgba\\(55\\,53\\,47\\,0\\.16\\)\\]{border-color:rgba(55,53,47,.16)}#yoopta-editor .yoo-image-bg-\\[\\#FFFFFF\\]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#yoopta-editor .yoo-image-bg-\\[\\#efefef\\]{--tw-bg-opacity:1;background-color:rgb(239 239 239/var(--tw-bg-opacity))}#yoopta-editor .yoo-image-bg-\\[hsla\\(45\\,13\\%\\,94\\%\\,\\.6\\)\\]{background-color:hsla(45,13%,94%,.6)}#yoopta-editor .yoo-image-bg-\\[rgb\\(35\\,131\\,226\\)\\]{--tw-bg-opacity:1;background-color:rgb(35 131 226/var(--tw-bg-opacity))}#yoopta-editor .yoo-image-bg-\\[rgba\\(15\\,15\\,15\\,0\\.6\\)\\]{background-color:hsla(0,0%,6%,.6)}#yoopta-editor .yoo-image-bg-\\[rgba\\(35\\,131\\,226\\,0\\.14\\)\\]{background-color:rgba(35,131,226,.14)}#yoopta-editor .yoo-image-bg-\\[rgba\\(55\\,53\\,47\\,0\\.16\\)\\]{background-color:rgba(55,53,47,.16)}#yoopta-editor .yoo-image-bg-inherit{background-color:inherit}#yoopta-editor .yoo-image-fill-white{fill:#fff}#yoopta-editor .yoo-image-p-\\[0_8px\\]{padding:0 8px}#yoopta-editor .yoo-image-p-\\[12px_36px_12px_12px\\]{padding:12px 36px 12px 12px}#yoopta-editor .yoo-image-px-2{padding-left:.5rem;padding-right:.5rem}#yoopta-editor .yoo-image-px-\\[12px\\]{padding-left:12px;padding-right:12px}#yoopta-editor .yoo-image-px-\\[6px\\]{padding-left:6px;padding-right:6px}#yoopta-editor .yoo-image-px-\\[8px\\]{padding-left:8px;padding-right:8px}#yoopta-editor .yoo-image-py-1{padding-bottom:.25rem;padding-top:.25rem}#yoopta-editor .yoo-image-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}#yoopta-editor .yoo-image-py-\\[6px\\]{padding-bottom:6px;padding-top:6px}#yoopta-editor .yoo-image-pb-\\[6px\\]{padding-bottom:6px}#yoopta-editor .yoo-image-pt-\\[6px\\]{padding-top:6px}#yoopta-editor .yoo-image-text-left{text-align:left}#yoopta-editor .yoo-image-text-\\[14px\\]{font-size:14px}#yoopta-editor .yoo-image-font-medium{font-weight:500}#yoopta-editor .yoo-image-leading-\\[1\\.2\\]{line-height:1.2}#yoopta-editor .yoo-image-leading-\\[120\\%\\]{line-height:120%}#yoopta-editor .yoo-image-leading-\\[20px\\]{line-height:20px}#yoopta-editor .yoo-image-text-\\[rgb\\(55\\,53\\,47\\)\\]{--tw-text-opacity:1;color:rgb(55 53 47/var(--tw-text-opacity))}#yoopta-editor .yoo-image-text-\\[rgba\\(55\\,53\\,47\\,0\\.65\\)\\]{color:rgba(55,53,47,.65)}#yoopta-editor .yoo-image-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#yoopta-editor .yoo-image-opacity-100{opacity:1}#yoopta-editor .yoo-image-shadow-\\[0_0_0_\\.5px_\\#FFF\\]{--tw-shadow:0 0 0 .5px #fff;--tw-shadow-colored:0 0 0 .5px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#yoopta-editor .yoo-image-shadow-\\[inset_0_0_0_1px_hsla\\(0\\,0\\%\\,6\\%\\,\\.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#yoopta-editor .yoo-image-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\\]{--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)}#yoopta-editor .yoo-image-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)}#yoopta-editor .yoo-image-shadow-\\[rgba\\(15\\,15\\,15\\,0\\.1\\)_0px_0px_0px_1px_inset\\,_rgba\\(15\\,15\\,15\\,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)}#yoopta-editor .yoo-image-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)}#yoopta-editor .yoo-image-transition-\\[height_20ms_ease-in\\]{transition-duration:.15s;transition-property:height 20ms ease-in;transition-timing-function:cubic-bezier(.4,0,.2,1)}#yoopta-editor .yoo-image-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}#yoopta-editor .yoo-image-duration-150{transition-duration:.15s}#yoopta-editor .yoo-image-duration-300{transition-duration:.3s}#yoopta-editor .yoo-image-ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}#yoopta-editor .yoopta-image .yoopta-image-options{opacity:0;transition:opacity .15s ease-in-out}#yoopta-editor .yoopta-image:hover .yoopta-image-options{opacity:1}#yoopta-editor .hover\\:yoo-image-bg-\\[\\#37352f14\\]:hover{background-color:#37352f14}#yoopta-editor .hover\\:yoo-image-bg-\\[\\#e3e3e3\\]:hover{--tw-bg-opacity:1;background-color:rgb(227 227 227/var(--tw-bg-opacity))}#yoopta-editor .disabled\\:yoo-image-cursor-not-allowed:disabled{cursor:not-allowed}#yoopta-editor .disabled\\:yoo-image-bg-\\[rgba\\(35\\2c 131\\2c 226\\2c 0\\.5\\)\\]:disabled{background-color:rgba(35,131,226,.5)}");export{mo as default};
|
package/dist/types.d.ts
CHANGED
|
@@ -13,13 +13,13 @@ export type ImageElementProps = {
|
|
|
13
13
|
};
|
|
14
14
|
export type ImagePluginElements = 'image';
|
|
15
15
|
export type ImageElement = SlateElement<'image', ImageElementProps>;
|
|
16
|
-
export type
|
|
16
|
+
export type OnUploadResponse = Omit<ImageElementProps, 'fit' | 'srcSet'>;
|
|
17
17
|
export type ImageOptimizationFields = {
|
|
18
18
|
deviceSizes?: number[];
|
|
19
19
|
provider?: 'imgix' | 'cloudinary' | 'akamai';
|
|
20
20
|
};
|
|
21
21
|
export type ImagePluginOptions = {
|
|
22
|
-
onUpload: (file: File) => Promise<
|
|
22
|
+
onUpload: (file: File) => Promise<OnUploadResponse>;
|
|
23
23
|
accept?: string;
|
|
24
24
|
optimizations?: ImageOptimizationFields;
|
|
25
25
|
maxSizes?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageBlockOptions.d.ts","sourceRoot":"","sources":["../../src/ui/ImageBlockOptions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAM,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAuB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"ImageBlockOptions.d.ts","sourceRoot":"","sources":["../../src/ui/ImageBlockOptions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAM,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAuB,MAAM,UAAU,CAAC;AAMlE,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,4CAwGrE,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Placeholder.d.ts","sourceRoot":"","sources":["../../src/ui/Placeholder.tsx"],"names":[],"mappings":"AAMA,QAAA,MAAM,WAAW;;;;
|
|
1
|
+
{"version":3,"file":"Placeholder.d.ts","sourceRoot":"","sources":["../../src/ui/Placeholder.tsx"],"names":[],"mappings":"AAMA,QAAA,MAAM,WAAW;;;;6CAuDhB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/image",
|
|
3
|
-
"version": "4.0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "Image plugin for Yoopta Editor",
|
|
5
5
|
"author": "Darginec05 <devopsbanda@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"private": false,
|
|
9
9
|
"main": "dist/index.js",
|
|
10
|
-
"
|
|
10
|
+
"type": "module",
|
|
11
|
+
"module": "dist/index.js",
|
|
11
12
|
"types": "./dist/index.d.ts",
|
|
12
13
|
"files": [
|
|
13
14
|
"dist/"
|
|
@@ -37,6 +38,5 @@
|
|
|
37
38
|
"@floating-ui/react": "^0.26.9",
|
|
38
39
|
"@radix-ui/react-icons": "^1.3.0",
|
|
39
40
|
"re-resizable": "^6.9.11"
|
|
40
|
-
}
|
|
41
|
-
"gitHead": "2ab435c70924d16a80928f05657f0f9db1ff42f0"
|
|
41
|
+
}
|
|
42
42
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023-present Akhmed Ibragimov
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/index.es.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{useYooptaEditor as t,useYooptaPluginOptions as e,UI as i,useBlockData as n,useYooptaReadOnly as o,useBlockSelected as r,YooptaPlugin as s,generateId as a}from"@yoopta/editor";import{jsx as l,jsxs as c,Fragment as d}from"react/jsx-runtime";import*as p from"react";import{useLayoutEffect as u,useEffect as h,forwardRef as f,createElement as g,useState as m,useMemo as x}from"react";import*as w from"react-dom";import{flushSync as b,createPortal as v}from"react-dom";const y=({width:t,height:e,src:i,alt:n,fit:o,bgColor:r,layout:s="intrinsic"})=>{const a={objectFit:o||"contain",backgroundColor:r||"transparent"},c="fixed"===s,d="fill"===s,p="intrinsic"===s;return"responsive"===s&&(a.width="100%",a.height="auto"),c&&(a.width="100%",a.height="100%"),d&&(a.width="100%",a.height="100%"),p&&(a.width="100%",a.height="100%"),l("div",Object.assign({className:"w-full","data-layout":s},{children:i&&l("img",{src:i,width:t,height:e,alt:n||"",decoding:"async",loading:"lazy",style:a})}))};var C,z=(C=function(t,e){return C=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])},C(t,e)},function(t,e){function i(){this.constructor=t}C(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),R=function(){return R=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},R.apply(this,arguments)},S={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},_={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},k={width:"20px",height:"20px",position:"absolute"},E={top:R(R({},S),{top:"-5px"}),right:R(R({},_),{left:void 0,right:"-5px"}),bottom:R(R({},S),{top:void 0,bottom:"-5px"}),left:R(R({},_),{left:"-5px"}),topRight:R(R({},k),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:R(R({},k),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:R(R({},k),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:R(R({},k),{left:"-10px",top:"-10px",cursor:"nw-resize"})},L=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 z(e,t),e.prototype.render=function(){return p.createElement("div",{className:this.props.className||"",style:R(R({position:"absolute",userSelect:"none"},E[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},e}(p.PureComponent),N=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)}}(),O=function(){return O=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},O.apply(this,arguments)},M={width:"auto",height:"auto"},W=function(t,e,i){return Math.max(Math.min(t,i),e)},j=function(t,e){return Math.round(t/e)*e},A=function(t,e){return new RegExp(t,"i").test(e)},T=function(t){return Boolean(t.touches&&t.touches.length)},B=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},H=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"},P=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},I=["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"],D="__resizable_base__",F=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(D):e.className+=D,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 N(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||M},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 H(t.state[e])};return{width:e&&void 0!==e.width&&!this.state.isResizing?H(e.width):i("width"),height:e&&void 0!==e.height&&!this.state.isResizing?H(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,p=s.width,u=s.height,h=c||0,f=d||0;return A("right",r)&&(p=s.width+(t-s.x)*n/i,l&&(u=(p-f)/this.ratio+h)),A("left",r)&&(p=s.width-(t-s.x)*n/i,l&&(u=(p-f)/this.ratio+h)),A("bottom",r)&&(u=s.height+(e-s.y)*n/i,l&&(p=(u-h)*this.ratio+f)),A("top",r)&&(u=s.height-(e-s.y)*n/i,l&&(p=(u-h)*this.ratio+f)),{newWidth:p,newHeight:u}},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,p=void 0===i.height||i.height<0?e:i.height,u=s||0,h=a||0;if(r){var f=(d-u)*this.ratio+h,g=(p-u)*this.ratio+h,m=(l-h)/this.ratio+u,x=(c-h)/this.ratio+u,w=Math.max(l,f),b=Math.min(c,g),v=Math.max(d,m),y=Math.min(p,x);t=W(t,w,b),e=W(e,v,y)}else t=W(t,l,c),e=W(e,d,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 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&&T(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:O(O({},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&&T(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=T(t)?t.touches[0].clientX:t.clientX,l=T(t)?t.touches[0].clientY:t.clientY,c=this.state,d=c.direction,p=c.original,u=c.width,h=c.height,f=this.getParentSize(),g=function(t,e,i,n,o,r,s){return n=P(n,t.width,e,i),o=P(o,t.height,e,i),r=P(r,t.width,e,i),s=P(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),x=m.newHeight,w=m.newWidth,v=this.calculateNewMaxFromBoundary(n,o);this.props.snap&&this.props.snap.x&&(w=B(w,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(x=B(x,this.props.snap.y,this.props.snapGap));var y=this.calculateNewSizeFromAspectRatio(w,x,{width:v.maxWidth,height:v.maxHeight},{width:r,height:s});if(w=y.newWidth,x=y.newHeight,this.props.grid){var C=j(w,this.props.grid[0]),z=j(x,this.props.grid[1]),R=this.props.snapGap||0;w=0===R||Math.abs(C-w)<=R?C:w,x=0===R||Math.abs(z-x)<=R?z:x}var S={width:w-p.width,height:x-p.height};if(u&&"string"==typeof u)if(u.endsWith("%"))w=w/f.width*100+"%";else if(u.endsWith("vw")){w=w/this.window.innerWidth*100+"vw"}else if(u.endsWith("vh")){w=w/this.window.innerHeight*100+"vh"}if(h&&"string"==typeof h)if(h.endsWith("%"))x=x/f.height*100+"%";else if(h.endsWith("vw")){x=x/this.window.innerWidth*100+"vw"}else if(h.endsWith("vh")){x=x/this.window.innerHeight*100+"vh"}var _={width:this.createSizeForCssProperty(w,"width"),height:this.createSizeForCssProperty(x,"height")};"row"===this.flexDir?_.flexBasis=_.width:"column"===this.flexDir&&(_.flexBasis=_.height),b((function(){e.setState(_)})),this.props.onResize&&this.props.onResize(t,d,this.resizable,S)}},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:O(O({},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 l=Object.keys(i).map((function(e){return!1!==i[e]?p.createElement(L,{key:e,direction:e,onResizeStart:t.onResizeStart,replaceStyles:n&&n[e],className:o&&o[e]},a&&a[e]?a[e]:null):null}));return p.createElement("div",{className:s,style:r},l)},e.prototype.render=function(){var t=this,e=Object.keys(this.props).reduce((function(e,i){return-1!==I.indexOf(i)||(e[i]=t.props[i]),e}),{}),i=O(O(O({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 p.createElement(n,O({ref:this.ref,style:i,className:this.props.className},e),this.state.isResizing&&p.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}(p.PureComponent);function V(t){return X(t)?(t.nodeName||"").toLowerCase():"#document"}function U(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function Z(t){var e;return null==(e=(X(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function X(t){return t instanceof Node||t instanceof U(t).Node}function Y(t){return t instanceof Element||t instanceof U(t).Element}function G(t){return t instanceof HTMLElement||t instanceof U(t).HTMLElement}function $(t){return"undefined"!=typeof ShadowRoot&&(t instanceof ShadowRoot||t instanceof U(t).ShadowRoot)}function q(t){const{overflow:e,overflowX:i,overflowY:n,display:o}=et(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+i)&&!["inline","contents"].includes(o)}function J(t){return["table","td","th"].includes(V(t))}function K(t){const e=Q(),i=et(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 Q(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function tt(t){return["html","body","#document"].includes(V(t))}function et(t){return U(t).getComputedStyle(t)}function it(t){return Y(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function nt(t){if("html"===V(t))return t;const e=t.assignedSlot||t.parentNode||$(t)&&t.host||Z(t);return $(e)?e.host:e}function ot(t){const e=nt(t);return tt(e)?t.ownerDocument?t.ownerDocument.body:t.body:G(e)&&q(e)?e:ot(e)}function rt(t,e,i){var n;void 0===e&&(e=[]),void 0===i&&(i=!0);const o=ot(t),r=o===(null==(n=t.ownerDocument)?void 0:n.body),s=U(o);return r?e.concat(s,s.visualViewport||[],q(o)?o:[],s.frameElement&&i?rt(s.frameElement):[]):e.concat(o,rt(o,[],i))}const st=Math.min,at=Math.max,lt=Math.round,ct=t=>({x:t,y:t}),dt={left:"right",right:"left",bottom:"top",top:"bottom"},pt={start:"end",end:"start"};function ut(t,e,i){return at(t,st(e,i))}function ht(t,e){return"function"==typeof t?t(e):t}function ft(t){return t.split("-")[0]}function gt(t){return t.split("-")[1]}function mt(t){return"x"===t?"y":"x"}function xt(t){return"y"===t?"height":"width"}function wt(t){return["top","bottom"].includes(ft(t))?"y":"x"}function bt(t){return mt(wt(t))}function vt(t){return t.replace(/start|end/g,(t=>pt[t]))}function yt(t){return t.replace(/left|right|bottom|top/g,(t=>dt[t]))}function Ct(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 zt(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function Rt(t,e,i){let{reference:n,floating:o}=t;const r=wt(e),s=bt(e),a=xt(s),l=ft(e),c="y"===r,d=n.x+n.width/2-o.width/2,p=n.y+n.height/2-o.height/2,u=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:p};break;case"left":h={x:n.x-o.width,y:p};break;default:h={x:n.x,y:n.y}}switch(gt(e)){case"start":h[s]-=u*(i&&c?-1:1);break;case"end":h[s]+=u*(i&&c?-1:1)}return h}async function St(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:p="floating",altBoundary:u=!1,padding:h=0}=ht(e,t),f=Ct(h),g=a[u?"floating"===p?"reference":"floating":p],m=zt(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})),x="floating"===p?{...s.floating,x:n,y:o}:s.reference,w=await(null==r.getOffsetParent?void 0:r.getOffsetParent(a.floating)),b=await(null==r.isElement?void 0:r.isElement(w))&&await(null==r.getScale?void 0:r.getScale(w))||{x:1,y:1},v=zt(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:w,strategy:l}):x);return{top:(m.top-v.top+f.top)/b.y,bottom:(v.bottom-m.bottom+f.bottom)/b.y,left:(m.left-v.left+f.left)/b.x,right:(v.right-m.right+f.right)/b.x}}function _t(t){const e=st(...t.map((t=>t.left))),i=st(...t.map((t=>t.top)));return{x:e,y:i,width:at(...t.map((t=>t.right)))-e,height:at(...t.map((t=>t.bottom)))-i}}const kt=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=ft(i),a=gt(i),l="y"===wt(i),c=["left","top"].includes(s)?-1:1,d=r&&l?-1:1,p=ht(e,t);let{mainAxis:u,crossAxis:h,alignmentAxis:f}="number"==typeof p?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...p};return a&&"number"==typeof f&&(h="end"===a?-1*f:f),l?{x:h*d,y:u*c}:{x:u*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 Et(t){const e=et(t);let i=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const o=G(t),r=o?t.offsetWidth:i,s=o?t.offsetHeight:n,a=lt(i)!==r||lt(n)!==s;return a&&(i=r,n=s),{width:i,height:n,$:a}}function Lt(t){return Y(t)?t:t.contextElement}function Nt(t){const e=Lt(t);if(!G(e))return ct(1);const i=e.getBoundingClientRect(),{width:n,height:o,$:r}=Et(e);let s=(r?lt(i.width):i.width)/n,a=(r?lt(i.height):i.height)/o;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const Ot=ct(0);function Mt(t){const e=U(t);return Q()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:Ot}function Wt(t,e,i,n){void 0===e&&(e=!1),void 0===i&&(i=!1);const o=t.getBoundingClientRect(),r=Lt(t);let s=ct(1);e&&(n?Y(n)&&(s=Nt(n)):s=Nt(t));const a=function(t,e,i){return void 0===e&&(e=!1),!(!i||e&&i!==U(t))&&e}(r,i,n)?Mt(r):ct(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,d=o.width/s.x,p=o.height/s.y;if(r){const t=U(r),e=n&&Y(n)?U(n):n;let i=t,o=i.frameElement;for(;o&&n&&e!==i;){const t=Nt(o),e=o.getBoundingClientRect(),n=et(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,p*=t.y,l+=r,c+=s,i=U(o),o=i.frameElement}}return zt({width:d,height:p,x:l,y:c})}const jt=[":popover-open",":modal"];function At(t){return jt.some((e=>{try{return t.matches(e)}catch(t){return!1}}))}function Tt(t){return Wt(Z(t)).left+it(t).scrollLeft}function Bt(t,e,i){let n;if("viewport"===e)n=function(t,e){const i=U(t),n=Z(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=Q();(!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=Z(t),i=it(t),n=t.ownerDocument.body,o=at(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=at(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-i.scrollLeft+Tt(t);const a=-i.scrollTop;return"rtl"===et(n).direction&&(s+=at(e.clientWidth,n.clientWidth)-o),{width:o,height:r,x:s,y:a}}(Z(t));else if(Y(e))n=function(t,e){const i=Wt(t,!0,"fixed"===e),n=i.top+t.clientTop,o=i.left+t.clientLeft,r=G(t)?Nt(t):ct(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=Mt(t);n={...e,x:e.x-i.x,y:e.y-i.y}}return zt(n)}function Ht(t,e){const i=nt(t);return!(i===e||!Y(i)||tt(i))&&("fixed"===et(i).position||Ht(i,e))}function Pt(t,e,i){const n=G(e),o=Z(e),r="fixed"===i,s=Wt(t,!0,r,e);let a={scrollLeft:0,scrollTop:0};const l=ct(0);if(n||!n&&!r)if(("body"!==V(e)||q(o))&&(a=it(e)),n){const t=Wt(e,!0,r,e);l.x=t.x+e.clientLeft,l.y=t.y+e.clientTop}else o&&(l.x=Tt(o));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function It(t,e){return G(t)&&"fixed"!==et(t).position?e?e(t):t.offsetParent:null}function Dt(t,e){const i=U(t);if(!G(t)||At(t))return i;let n=It(t,e);for(;n&&J(n)&&"static"===et(n).position;)n=It(n,e);return n&&("html"===V(n)||"body"===V(n)&&"static"===et(n).position&&!K(n))?i:n||function(t){let e=nt(t);for(;G(e)&&!tt(e);){if(K(e))return e;e=nt(e)}return null}(t)||i}const Ft={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:i,offsetParent:n,strategy:o}=t;const r="fixed"===o,s=Z(n),a=!!e&&At(e.floating);if(n===s||a&&r)return i;let l={scrollLeft:0,scrollTop:0},c=ct(1);const d=ct(0),p=G(n);if((p||!p&&!r)&&(("body"!==V(n)||q(s))&&(l=it(n)),G(n))){const t=Wt(n);c=Nt(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:Z,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=rt(t,[],!1).filter((t=>Y(t)&&"body"!==V(t))),o=null;const r="fixed"===et(t).position;let s=r?nt(t):t;for(;Y(s)&&!tt(s);){const e=et(s),i=K(s);i||"fixed"!==e.position||(o=null),(r?!i&&!o:!i&&"static"===e.position&&o&&["absolute","fixed"].includes(o.position)||q(s)&&!i&&Ht(t,s))?n=n.filter((t=>t!==s)):o=e,s=nt(s)}return e.set(t,n),n}(e,this._c):[].concat(i),n],s=r[0],a=r.reduce(((t,i)=>{const n=Bt(e,i,o);return t.top=at(n.top,t.top),t.right=st(n.right,t.right),t.bottom=st(n.bottom,t.bottom),t.left=at(n.left,t.left),t}),Bt(e,s,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Dt,getElementRects:async function(t){const e=this.getOffsetParent||Dt,i=this.getDimensions;return{reference:Pt(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}=Et(t);return{width:e,height:i}},getScale:Nt,isElement:Y,isRTL:function(t){return"rtl"===et(t).direction}},Vt=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}=ht(t,e),c={x:i,y:n},d=await St(e,l),p=wt(ft(o)),u=mt(p);let h=c[u],f=c[p];if(r){const t="y"===u?"bottom":"right";h=ut(h+d["y"===u?"top":"left"],h,h-d[t])}if(s){const t="y"===p?"bottom":"right";f=ut(f+d["y"===p?"top":"left"],f,f-d[t])}const g=a.fn({...e,[u]:h,[p]:f});return{...g,data:{x:g.x-i,y:g.y-n}}}}},Ut=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:p=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:g=!0,...m}=ht(t,e);if(null!=(i=r.arrow)&&i.alignmentOffset)return{};const x=ft(o),w=ft(a)===a,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),v=u||(w||!g?[yt(a)]:function(t){const e=yt(t);return[vt(t),e,vt(e)]}(a));u||"none"===f||v.push(...function(t,e,i,n){const o=gt(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[]}}(ft(t),"start"===i,n);return o&&(r=r.map((t=>t+"-"+o)),e&&(r=r.concat(r.map(vt)))),r}(a,g,f,b));const y=[a,...v],C=await St(e,m),z=[];let R=(null==(n=r.flip)?void 0:n.overflows)||[];if(d&&z.push(C[x]),p){const t=function(t,e,i){void 0===i&&(i=!1);const n=gt(t),o=bt(t),r=xt(o);let s="x"===o?n===(i?"end":"start")?"right":"left":"start"===n?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=yt(s)),[s,yt(s)]}(o,s,b);z.push(C[t[0]],C[t[1]])}if(R=[...R,{placement:o,overflows:z}],!z.every((t=>t<=0))){var S,_;const t=((null==(S=r.flip)?void 0:S.index)||0)+1,e=y[t];if(e)return{data:{index:t,overflows:R},reset:{placement:e}};let i=null==(_=R.filter((t=>t.overflows[0]<=0)).sort(((t,e)=>t.overflows[1]-e.overflows[1]))[0])?void 0:_.placement;if(!i)switch(h){case"bestFit":{var k;const t=null==(k=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:k[0];t&&(i=t);break}case"initialPlacement":i=a}if(o!==i)return{reset:{placement:i}}}return{}}}},Zt=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}=ht(t,e),d=Array.from(await(null==r.getClientRects?void 0:r.getClientRects(n.reference))||[]),p=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=>zt(_t(t))))}(d),u=zt(_t(d)),h=Ct(a);const f=await r.getElementRects({reference:{getBoundingClientRect:function(){if(2===p.length&&p[0].left>p[1].right&&null!=l&&null!=c)return p.find((t=>l>t.left-h.left&&l<t.right+h.right&&c>t.top-h.top&&c<t.bottom+h.bottom))||u;if(p.length>=2){if("y"===wt(i)){const t=p[0],e=p[p.length-1],n="top"===ft(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"===ft(i),e=at(...p.map((t=>t.right))),n=st(...p.map((t=>t.left))),o=p.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 u}},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}}:{}}}},Xt=(t,e,i)=>{const n=new Map,o={platform:Ft,...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:p}=Rt(c,n,l),u=n,h={},f=0;for(let i=0;i<a.length;i++){const{name:r,fn:g}=a[i],{x:m,y:x,data:w,reset:b}=await g({x:d,y:p,initialPlacement:n,placement:u,strategy:o,middlewareData:h,rects:c,platform:s,elements:{reference:t,floating:e}});d=null!=m?m:d,p=null!=x?x:p,h={...h,[r]:{...h[r],...w}},b&&f<=50&&(f++,"object"==typeof b&&(b.placement&&(u=b.placement),b.rects&&(c=!0===b.rects?await s.getElementRects({reference:t,floating:e,strategy:o}):b.rects),({x:d,y:p}=Rt(c,u,l))),i=-1)}return{x:d,y:p,placement:u,strategy:o,middlewareData:h}})(t,e,{...o,platform:r})};var Yt="undefined"!=typeof document?u:h;function Gt(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(!Gt(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)&&!Gt(t[i],e[i]))return!1}return!0}return t!=t&&e!=e}function $t(t){if("undefined"==typeof window)return 1;return(t.ownerDocument.defaultView||window).devicePixelRatio||1}function qt(t,e){const i=$t(t);return Math.round(e*i)/i}function Jt(t){const e=p.useRef(t);return Yt((()=>{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 Kt=["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(","),Qt="undefined"==typeof Element,te=Qt?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ee=!Qt&&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},ie=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)},ne=function t(e,i,n){for(var o=[],r=Array.from(e);r.length;){var s=r.shift();if(!ie(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{te.call(s,Kt)&&n.filter(s)&&(i||!e.includes(s))&&o.push(s);var c=s.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(s),d=!ie(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(s));if(c&&d){var p=t(!0===c?s.children:c.children,!0,n);n.flatten?o.push.apply(o,p):o.push({scopeParent:s,candidates:p})}else r.unshift.apply(r,s.children)}}return o},oe=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},re=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))&&!oe(t)?0:t.tabIndex},se=function(t,e){return t.tabIndex===e.tabIndex?t.documentOrder-e.documentOrder:t.tabIndex-e.tabIndex},ae=function(t){return"INPUT"===t.tagName},le=function(t){return function(t){return ae(t)&&"radio"===t.type}(t)&&!function(t){if(!t.name)return!0;var e,i=t.form||ee(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)},ce=function(t){var e=t.getBoundingClientRect(),i=e.width,n=e.height;return 0===i&&0===n},de=function(t,e){var i=e.displayCheck,n=e.getShadowRoot;if("hidden"===getComputedStyle(t).visibility)return!0;var o=te.call(t,"details>summary:first-of-type")?t.parentElement:t;if(te.call(o,"details:not([open]) *"))return!0;if(i&&"full"!==i&&"legacy-full"!==i){if("non-zero-area"===i)return ce(t)}else{if("function"==typeof n){for(var r=t;t;){var s=t.parentElement,a=ee(t);if(s&&!s.shadowRoot&&!0===n(s))return ce(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&&ee(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=ee(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||ie(e)||function(t){return ae(t)&&"hidden"===t.type}(e)||de(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!!te.call(e,"fieldset[disabled] *")||!n.contains(t)}return!0}e=e.parentElement}return!1}(e))},ue=function(t,e){return!(le(e)||re(e)<0||!pe(t,e))},he=function(t){var e=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(e)||e>=0)},fe=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=re(t);return i<0&&e&&!oe(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(se).reduce((function(t,e){return e.isScope?t.push.apply(t,e.content):t.push(e.content),t}),[]).concat(i)},ge=function(t,e){var i;return i=(e=e||{}).getShadowRoot?ne([t],e.includeContainer,{filter:ue.bind(null,e),flatten:!1,getShadowRoot:e.getShadowRoot,shadowRootFilter:he}):function(t,e,i){if(ie(t))return[];var n=Array.prototype.slice.apply(t.querySelectorAll(Kt));return e&&te.call(t,Kt)&&n.unshift(t),n.filter(i)}(t,e.includeContainer,ue.bind(null,e)),fe(i)};const me=p["useInsertionEffect".toString()]||(t=>t());var xe="undefined"!=typeof document?u:h;function we(){return we=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},we.apply(this,arguments)}let be=!1,ve=0;const ye=()=>"floating-ui-"+ve++;const Ce=p["useId".toString()]||function(){const[t,e]=p.useState((()=>be?ye():void 0));return xe((()=>{null==t&&e(ye())}),[]),p.useEffect((()=>{be||(be=!0)}),[]),t};const ze=p.createContext(null),Re=p.createContext(null);function Se(t){return"data-floating-ui-"+t}const _e=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ke(t,e){const i=ge(t,_e());"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 Ee(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&&$(i)){let i=e;for(;i;){if(t===i)return!0;i=i.parentNode||i.host}}return!1}(i,n)}function Le(t){ge(t,_e()).forEach((t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")}))}function Ne(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 Oe={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 Me(t){"Tab"===t.key&&(t.target,clearTimeout(undefined))}const We=p.forwardRef((function(t,e){const[i,n]=p.useState();xe((()=>(/apple/i.test(navigator.vendor)&&n("button"),document.addEventListener("keydown",Me),()=>{document.removeEventListener("keydown",Me)})),[]);const o={ref:e,tabIndex:0,role:i,"aria-hidden":!i||void 0,[Se("focus-guard")]:"",style:Oe};return p.createElement("span",we({},t,o))})),je=p.createContext(null),Ae=Se("portal");function Te(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]=p.useState(null),r=Ce(),s=Be(),a=p.useRef(null);return xe((()=>()=>{null==n||n.remove(),queueMicrotask((()=>{a.current=null}))}),[n]),xe((()=>{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]),xe((()=>{if(a.current)return;let t=i||(null==s?void 0:s.portalNode);t&&!Y(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]=p.useState(null),l=p.useRef(null),c=p.useRef(null),d=p.useRef(null),u=p.useRef(null),h=!!s&&!s.modal&&s.open&&o&&!(!n&&!r);return p.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&&Ee(t)){("focusin"===t.type?Ne:Le)(r)}}}),[r,o,null==s?void 0:s.modal]),p.createElement(je.Provider,{value:p.useMemo((()=>({preserveTabOrder:o,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:d,afterInsideRef:u,portalNode:r,setFocusManagerState:a})),[o,r])},h&&r&&p.createElement(We,{"data-type":"outside",ref:l,onFocus:t=>{if(Ee(t,r)){var e;null==(e=d.current)||e.focus()}else{const t=ke(document.body,"prev")||(null==s?void 0:s.refs.domReference.current);null==t||t.focus()}}}),h&&r&&p.createElement("span",{"aria-owns":r.id,style:Oe}),r&&v(e,r),h&&r&&p.createElement(We,{"data-type":"outside",ref:c,onFocus:t=>{if(Ee(t,r)){var e;null==(e=u.current)||e.focus()}else{const e=ke(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 Be=()=>p.useContext(je),He=new Set,Pe=p.forwardRef((function(t,e){let{lockScroll:i=!1,...n}=t;const o=Ce();return xe((()=>{if(!i)return;He.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()=>{He.delete(o),0===He.size&&(Object.assign(e,{overflow:"",[n]:""}),t&&(Object.assign(e,{position:"",top:"",left:"",right:""}),window.scrollTo(s,a)))}}),[o,i]),p.createElement("div",we({ref:e},n,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...n.style}}))}));function Ie(t){var e;void 0===t&&(t={});const{open:i=!1,onOpenChange:n,nodeId:o}=t,[r,s]=p.useState(null),a=(null==(e=t.elements)?void 0:e.reference)||r,l=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:l,open:c}=t,[d,u]=p.useState({x:0,y:0,strategy:i,placement:e,middlewareData:{},isPositioned:!1}),[h,f]=p.useState(n);Gt(h,n)||f(n);const[g,m]=p.useState(null),[x,b]=p.useState(null),v=p.useCallback((t=>{t!==R.current&&(R.current=t,m(t))}),[]),y=p.useCallback((t=>{t!==S.current&&(S.current=t,b(t))}),[]),C=r||g,z=s||x,R=p.useRef(null),S=p.useRef(null),_=p.useRef(d),k=null!=l,E=Jt(l),L=Jt(o),N=p.useCallback((()=>{if(!R.current||!S.current)return;const t={placement:e,strategy:i,middleware:h};L.current&&(t.platform=L.current),Xt(R.current,S.current,t).then((t=>{const e={...t,isPositioned:!0};O.current&&!Gt(_.current,e)&&(_.current=e,w.flushSync((()=>{u(e)})))}))}),[h,e,i,L]);Yt((()=>{!1===c&&_.current.isPositioned&&(_.current.isPositioned=!1,u((t=>({...t,isPositioned:!1}))))}),[c]);const O=p.useRef(!1);Yt((()=>(O.current=!0,()=>{O.current=!1})),[]),Yt((()=>{if(C&&(R.current=C),z&&(S.current=z),C&&z){if(E.current)return E.current(C,z,N);N()}}),[C,z,N,E,k]);const M=p.useMemo((()=>({reference:R,floating:S,setReference:v,setFloating:y})),[v,y]),W=p.useMemo((()=>({reference:C,floating:z})),[C,z]),j=p.useMemo((()=>{const t={position:i,left:0,top:0};if(!W.floating)return t;const e=qt(W.floating,d.x),n=qt(W.floating,d.y);return a?{...t,transform:"translate("+e+"px, "+n+"px)",...$t(W.floating)>=1.5&&{willChange:"transform"}}:{position:i,left:e,top:n}}),[i,a,W.floating,d.x,d.y]);return p.useMemo((()=>({...d,update:N,refs:M,elements:W,floatingStyles:j})),[d,N,M,W,j])}(t),c=p.useContext(Re),d=null!=((null==(u=p.useContext(ze))?void 0:u.id)||null);var u;const h=function(t){const e=p.useRef((()=>{}));return me((()=>{e.current=t})),p.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),m.emit("openchange",{open:t,event:e,reason:i,nested:d}),null==n||n(t,e,i)})),f=p.useRef(null),g=p.useRef({}),m=p.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],x=Ce(),b=p.useCallback((t=>{const e=Y(t)?{getBoundingClientRect:()=>t.getBoundingClientRect(),contextElement:t}:t;l.refs.setReference(e)}),[l.refs]),v=p.useCallback((t=>{(Y(t)||null===t)&&(f.current=t,s(t)),(Y(l.refs.reference.current)||null===l.refs.reference.current||null!==t&&!Y(t))&&l.refs.setReference(t)}),[l.refs]),y=p.useMemo((()=>({...l.refs,setReference:v,setPositionReference:b,domReference:f})),[l.refs,v,b]),C=p.useMemo((()=>({...l.elements,domReference:a})),[l.elements,a]),z=p.useMemo((()=>({...l,refs:y,elements:C,dataRef:g,nodeId:o,floatingId:x,events:m,open:i,onOpenChange:h})),[l,o,x,m,i,h,y,C]);return xe((()=>{const t=null==c?void 0:c.nodesRef.current.find((t=>t.id===o));t&&(t.context=z)})),p.useMemo((()=>({...l,context:z,refs:y,elements:C})),[l,y,C,z])}function De(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 Fe=["color"],Ve=f((function(t,e){var i=t.color,n=void 0===i?"currentColor":i,o=De(t,Fe);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:e}),g("path",{d:"M7.50005 1.04999C7.74858 1.04999 7.95005 1.25146 7.95005 1.49999V8.41359L10.1819 6.18179C10.3576 6.00605 10.6425 6.00605 10.8182 6.18179C10.994 6.35753 10.994 6.64245 10.8182 6.81819L7.81825 9.81819C7.64251 9.99392 7.35759 9.99392 7.18185 9.81819L4.18185 6.81819C4.00611 6.64245 4.00611 6.35753 4.18185 6.18179C4.35759 6.00605 4.64251 6.00605 4.81825 6.18179L7.05005 8.41359V1.49999C7.05005 1.25146 7.25152 1.04999 7.50005 1.04999ZM2.5 10C2.77614 10 3 10.2239 3 10.5V12C3 12.5539 3.44565 13 3.99635 13H11.0012C11.5529 13 12 12.5528 12 12V10.5C12 10.2239 12.2239 10 12.5 10C12.7761 10 13 10.2239 13 10.5V12C13 13.1041 12.1062 14 11.0012 14H3.99635C2.89019 14 2 13.103 2 12V10.5C2 10.2239 2.22386 10 2.5 10Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))})),Ue=["color"],Ze=f((function(t,e){var i=t.color,n=void 0===i?"currentColor":i,o=De(t,Ue);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:e}),g("path",{d:"M2.5 1H12.5C13.3284 1 14 1.67157 14 2.5V12.5C14 13.3284 13.3284 14 12.5 14H2.5C1.67157 14 1 13.3284 1 12.5V2.5C1 1.67157 1.67157 1 2.5 1ZM2.5 2C2.22386 2 2 2.22386 2 2.5V8.3636L3.6818 6.6818C3.76809 6.59551 3.88572 6.54797 4.00774 6.55007C4.12975 6.55216 4.24568 6.60372 4.32895 6.69293L7.87355 10.4901L10.6818 7.6818C10.8575 7.50607 11.1425 7.50607 11.3182 7.6818L13 9.3636V2.5C13 2.22386 12.7761 2 12.5 2H2.5ZM2 12.5V9.6364L3.98887 7.64753L7.5311 11.4421L8.94113 13H2.5C2.22386 13 2 12.7761 2 12.5ZM12.5 13H10.155L8.48336 11.153L11 8.6364L13 10.6364V12.5C13 12.7761 12.7761 13 12.5 13ZM6.64922 5.5C6.64922 5.03013 7.03013 4.64922 7.5 4.64922C7.96987 4.64922 8.35078 5.03013 8.35078 5.5C8.35078 5.96987 7.96987 6.35078 7.5 6.35078C7.03013 6.35078 6.64922 5.96987 6.64922 5.5ZM7.5 3.74922C6.53307 3.74922 5.74922 4.53307 5.74922 5.5C5.74922 6.46693 6.53307 7.25078 7.5 7.25078C8.46693 7.25078 9.25078 6.46693 9.25078 5.5C9.25078 4.53307 8.46693 3.74922 7.5 3.74922Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))})),Xe=["color"],Ye=f((function(t,e){var i=t.color,n=void 0===i?"currentColor":i,o=De(t,Xe);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:e}),g("path",{d:"M7.81832 0.68179C7.64258 0.506054 7.35766 0.506054 7.18192 0.68179L5.18192 2.68179C5.00619 2.85753 5.00619 3.14245 5.18192 3.31819C5.35766 3.49392 5.64258 3.49392 5.81832 3.31819L7.05012 2.08638L7.05012 5.50023C7.05012 5.74876 7.25159 5.95023 7.50012 5.95023C7.74865 5.95023 7.95012 5.74876 7.95012 5.50023L7.95012 2.08638L9.18192 3.31819C9.35766 3.49392 9.64258 3.49392 9.81832 3.31819C9.99406 3.14245 9.99406 2.85753 9.81832 2.68179L7.81832 0.68179ZM7.95012 12.9136V9.50023C7.95012 9.2517 7.74865 9.05023 7.50012 9.05023C7.25159 9.05023 7.05012 9.2517 7.05012 9.50023V12.9136L5.81832 11.6818C5.64258 11.5061 5.35766 11.5061 5.18192 11.6818C5.00619 11.8575 5.00619 12.1424 5.18192 12.3182L7.18192 14.3182C7.26632 14.4026 7.38077 14.45 7.50012 14.45C7.61947 14.45 7.73393 14.4026 7.81832 14.3182L9.81832 12.3182C9.99406 12.1424 9.99406 11.8575 9.81832 11.6818C9.64258 11.5061 9.35766 11.5061 9.18192 11.6818L7.95012 12.9136ZM1.49994 7.00017C1.2238 7.00017 0.999939 7.22403 0.999939 7.50017C0.999939 7.77631 1.2238 8.00017 1.49994 8.00017L13.4999 8.00017C13.7761 8.00017 13.9999 7.77631 13.9999 7.50017C13.9999 7.22403 13.7761 7.00017 13.4999 7.00017L1.49994 7.00017Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))})),Ge=["color"],$e=f((function(t,e){var i=t.color,n=void 0===i?"currentColor":i,o=De(t,Ge);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:e}),g("path",{d:"M11.5 3.04999C11.7485 3.04999 11.95 3.25146 11.95 3.49999V7.49999C11.95 7.74852 11.7485 7.94999 11.5 7.94999C11.2515 7.94999 11.05 7.74852 11.05 7.49999V4.58639L4.58638 11.05H7.49999C7.74852 11.05 7.94999 11.2515 7.94999 11.5C7.94999 11.7485 7.74852 11.95 7.49999 11.95L3.49999 11.95C3.38064 11.95 3.26618 11.9026 3.18179 11.8182C3.0974 11.7338 3.04999 11.6193 3.04999 11.5L3.04999 7.49999C3.04999 7.25146 3.25146 7.04999 3.49999 7.04999C3.74852 7.04999 3.94999 7.25146 3.94999 7.49999L3.94999 10.4136L10.4136 3.94999L7.49999 3.94999C7.25146 3.94999 7.04999 3.74852 7.04999 3.49999C7.04999 3.25146 7.25146 3.04999 7.49999 3.04999L11.5 3.04999Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))})),qe=["color"],Je=f((function(t,e){var i=t.color,n=void 0===i?"currentColor":i,o=De(t,qe);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:e}),g("path",{d:"M4.81812 4.68161C4.99386 4.85734 4.99386 5.14227 4.81812 5.318L3.08632 7.0498H11.9135L10.1817 5.318C10.006 5.14227 10.006 4.85734 10.1817 4.68161C10.3575 4.50587 10.6424 4.50587 10.8181 4.68161L13.3181 7.18161C13.4939 7.35734 13.4939 7.64227 13.3181 7.818L10.8181 10.318C10.6424 10.4937 10.3575 10.4937 10.1817 10.318C10.006 10.1423 10.006 9.85734 10.1817 9.68161L11.9135 7.9498H3.08632L4.81812 9.68161C4.99386 9.85734 4.99386 10.1423 4.81812 10.318C4.64239 10.4937 4.35746 10.4937 4.18173 10.318L1.68173 7.818C1.50599 7.64227 1.50599 7.35734 1.68173 7.18161L4.18173 4.68161C4.35746 4.50587 4.64239 4.50587 4.81812 4.68161Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}));const Ke=({blockId:e,onClose:i})=>{const n=t(),[o,r]=m(""),s=0===o.length;return c("div",Object.assign({className:"cursor-pointer user-select-none transition-bg duration-20 ease-in white-space-nowrap w-full"},{children:[l("input",{type:"text",placeholder:"Paste image 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)}),l("button",Object.assign({type:"button",className:"user-select-none transition-bg duration-20 ease-in cursor-pointer flex items-center justify-center flex-shrink-0 white-space-nowrap h-[28px] rounded-[4px] shadow-[rgba(15,15,15,0.1)_0px_0px_0px_1px_inset,_rgba(15,15,15,0.1)_0px_1px_2px] bg-[rgb(35,131,226)] text-white fill-white leading-[1.2] px-[12px] text-[14px] font-medium w-full max-w-[300px] mx-auto m-[12px_0_6px] disabled:bg-[rgba(35,131,226,0.5)] disabled:cursor-not-allowed",disabled:s,onClick:()=>{0!==o.length&&(n.blocks.Image.updateElement(e,"image",{src:o}),i())}},{children:"Embed image"}))]}))};function Qe(t,e,i,n){return new(i||(i=Promise))((function(o,r){function s(t){try{l(n.next(t))}catch(t){r(t)}}function a(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const ti=({accept:i="image/*",onClose:n,blockId:o,onSetLoading:r})=>{const s=e("Image"),a=t();return l("div",Object.assign({className:"user-select-none transition-bg duration-20 ease-in white-space-nowrap rounded-[4px] h-[32px] px-[12px] border border-[rgba(55,53,47,0.16)] w-full cursor-pointer"},{children:c("label",Object.assign({htmlFor:"image-uploader",className:"text-[14px] leading-[1.2] font-medium cursor-pointer w-full flex items-center justify-center h-full"},{children:[l("input",{type:"file",id:"image-uploader",className:"absolute left-0 top-0 invisible",accept:(null==s?void 0:s.accept)||i,onChange:t=>{const e=t.target.files[0];e&&(t=>{Qe(void 0,void 0,void 0,(function*(){if(null==s?void 0:s.onUpload){n(),r(!0);try{const e=yield null==s?void 0:s.onUpload(t);a.blocks.Image.updateElement(o,"image",{src:e.src,alt:e.alt,sizes:e.sizes,bgColor:e.bgColor,fit:"contain"})}catch(t){}finally{r(!1)}}else console.warn("onUpload not provided")}))})(e)},multiple:!1}),"Upload image"]}))}))},ei=({floatingStyles:t,refs:e,onClose:i,blockId:n,onSetLoading:o})=>{const[r,s]=m("upload"),a=t=>s(t),d="upload"===r,p="embed"===r,u=t=>({borderBottom:t?"2px solid #2483e2":"2px solid transparent"});return l(Te,Object.assign({root:document.getElementById("yoopta-editor")},{children:l(Pe,Object.assign({lockScroll:!0,className:"z-[100]",onClick:i},{children:l("div",Object.assign({ref:e.setFloating,style:t,onClick:t=>t.stopPropagation()},{children:c("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:[c("div",Object.assign({className:"w-full flex text-[14px] p-[0_8px] shadow-[rgb(55_53_47_/9%)_0px_-1px_0px_inset] relative z-10 h-[40px]"},{children:[l("button",Object.assign({type:"button",onClick:()=>a("upload"),style:u(d),className:"py-[6px] whitespace-nowrap min-w-0 flex-shrink-0 text-[rgb(55,53,47)] relative cursor-pointer user-select-none bg-inherit transition-[height_20ms_ease-in] inline-flex items-center h-full text-[14px] leading-[1.2] px-[8px]"},{children:"Upload"})),l("button",Object.assign({type:"button",onClick:()=>a("embed"),style:u(p),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:"Image link"}))]})),c("div",Object.assign({className:"pt-[6px] pb-[6px] mt-[4px] flex justify-center mr-[12px] ml-[12px]"},{children:[p&&l(Ke,{onClose:i,blockId:n}),d&&l(ti,{onClose:i,blockId:n,onSetLoading:o})]}))]}))}))}))}))},ii=({className:t,width:e,height:i,children:n})=>c("div",Object.assign({className:t},{children:[n,l("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:e,height:i,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-2 h-4 w-4 animate-spin"},{children:l("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}))]})),ni=({attributes:t,children:e,blockId:i})=>{const[n,o]=m(!1),[r,s]=m(!1),{refs:a,floatingStyles:d}=Ie({placement:"bottom",open:n,onOpenChange:o,middleware:[Zt(),Ut(),Vt(),kt(10)]});return c("div",Object.assign({className:"w-full user-select-none m-[20px_0_10px] relative flex"},t,{contentEditable:!1},{children:[c("button",Object.assign({className:"p-[12px_36px_12px_12px] flex items-center text-left w-full overflow-hidden rounded-[3px] text-[14px] text-[rgba(55,53,47,0.65)] relative cursor-pointer border-none bg-[#efefef] transition-[background-color_100ms_ease-in] hover:bg-[#e3e3e3]",onClick:()=>o(!0),disabled:r,ref:a.setReference},{children:[l(r?ii:Ze,{className:"mr-2 user-select-none",width:24,height:24}),l("span",Object.assign({className:"font-medium"},{children:r?"Loading...":"Click to add image"})),r&&l("div",{className:"absolute top-0 left-0 h-full bg-[rgba(55,53,47,0.16)]",style:{width:"100%",transition:"width 100ms ease-in"}})]})),n&&l(ei,{blockId:i,floatingStyles:d,refs:a,onClose:()=>o(!1),onSetLoading:t=>s(t)}),e]}))},{ExtendedBlockActions:oi,BlockOptionsMenuGroup:ri,BlockOptionsMenuItem:si,BlockOptionsSeparator:ai}=i,li=({editor:t,block:e,props:i})=>c(oi,Object.assign({onClick:()=>t.setSelection([e.meta.order]),className:"yoopta-image-options"},{children:[l(ai,{}),c(ri,{children:[l(si,{children:c("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:()=>{t.blocks.Image.updateElement(e.id,"image",{fit:"contain"})}},{children:[l(Ye,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Fit"]}))}),l(si,{children:c("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:()=>{t.blocks.Image.updateElement(e.id,"image",{fit:"fill"})}},{children:[l(Je,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Fill"]}))}),l(si,{children:c("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:()=>{t.blocks.Image.updateElement(e.id,"image",{fit:"cover"})}},{children:[l($e,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Cover"]}))})]}),l(ai,{}),l(ri,{children:l(si,{children:c("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{if(!i||!i.src)return;const t=document.createElement("a");t.href=i.src,t.download=i.alt||i.src,t.target="_blank",t.rel="noopener noreferrer",document.body.appendChild(t),t.click(),document.body.removeChild(t)}},{children:[l(Ve,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Download"]}))})})]})),ci=({position:t})=>l("div",Object.assign({contentEditable:!1,className:"absolute pointer-events-none flex items-center justify-center z-10 opacity-1 h-full w-[15px] cursor-col-resize transition-opacity duration-150 ease-in "+("left"===t?"left-0 top-0":"right-0 top-0")},{children:l("div",{className:"opacity-100 transition-opacity duration-300 ease-in rounded-[20px] bg-[rgba(15,15,15,0.6)] border border-[rgba(255,255,255,0.9)] w-[6px] h-[48px] max-h-[50%] shadow-[0_0_0_.5px_#FFF]"})})),di=new s({type:"Image",elements:{image:{render:({element:i,attributes:s,children:a,blockId:p})=>{const{src:u,alt:f,srcSet:g,bgColor:w,fit:b,sizes:v}=i.props||{},C=n(p),z=t(),R=o(),S=e("Image"),[_,k]=m({width:(null==v?void 0:v.width)||650,height:(null==v?void 0:v.height)||440});h((()=>k({width:(null==v?void 0:v.width)||650,height:(null==v?void 0:v.height)||440})),[i.props]);const E=r({blockId:p}),L=x((()=>{var t,e;return{minWidth:300,size:{width:_.width,height:_.height},maxWidth:(null===(t=null==S?void 0:S.maxSizes)||void 0===t?void 0:t.maxWidth)||800,maxHeight:(null===(e=null==S?void 0:S.maxSizes)||void 0===e?void 0:e.maxHeight)||720,lockAspectRatio:!0,resizeRatio:2,enable:{left:!R,right:!R},handleStyles:{left:{left:0},right:{right:0}},onResize:(t,e,i)=>{R||k({width:i.offsetWidth,height:i.offsetHeight})},onResizeStop:(t,e,i)=>{R||z.blocks.Image.updateElement(p,"image",{sizes:{width:i.offsetWidth,height:i.offsetHeight}})},handleComponent:{left:R?l(d,{}):l(ci,{position:"left"}),right:R?l(d,{}):l(ci,{position:"right"})}}}),[_.width,_.height]);return u?l("div",Object.assign({"data-element-type":i.type,contentEditable:!1,draggable:!1,className:"mt-4 relative yoopta-image"},s,{children:c(F,Object.assign({},L,{className:"mx-auto my-0 flex"},{children:[E&&l("div",{className:"absolute pointer-events-none inset-0 bg-[rgba(35,131,226,0.14)] z-[81] rounded-[3px] opacity-100 transition-opacity duration-150 ease-in"}),l(y,{src:u,alt:f,srcSet:g,fit:b,width:null==_?void 0:_.width,bgColor:w,height:null==_?void 0:_.height}),!R&&l(li,{block:C,editor:z,props:i.props}),a]}))})):R?null:l(ni,Object.assign({attributes:s,blockId:p},{children:a}))},props:{src:null,alt:null,srcSet:null,bgColor:null,fit:"contain",sizes:{width:650,height:500},nodeType:"void"}}},options:{display:{title:"Image",description:"Upload from device or embed with link"},onUpload:()=>Promise.resolve({src:null,alt:null}),accept:"image/png, image/jpeg, image/gif, image/webp",maxSizes:{maxWidth:650,maxHeight:550}},parsers:{html:{deserialize:{nodeNames:["IMG"],parse:t=>{if("IMG"===t.nodeName){const e={src:t.getAttribute("src")||"",alt:t.getAttribute("alt")||"",srcSet:t.getAttribute("srcset")||"",sizes:{width:t.getAttribute("width")?parseInt(t.getAttribute("width")||"650",10):650,height:t.getAttribute("height")?parseInt(t.getAttribute("height")||"500",10):500}};return{id:a(),type:"image",children:[{text:""}],props:e}}}}}}});!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}.invisible{visibility:hidden}.fixed{position:fixed}.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}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.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)}.border-\\[rgba\\(55\\2c 53\\2c 47\\2c 0\\.16\\)\\]{border-color:rgba(55,53,47,.16)}.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-\\[rgba\\(55\\2c 53\\2c 47\\2c 0\\.16\\)\\]{background-color:rgba(55,53,47,.16)}.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{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.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)}.yoopta-image .yoopta-image-options{opacity:0;transition:opacity .15s ease-in-out}.yoopta-image:hover .yoopta-image-options{opacity: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{di as default};
|