@1urso/generic-editor 0.1.77 → 0.1.78
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/generic-editor.js +1406 -1405
- package/dist/generic-editor.umd.cjs +18 -18
- package/package.json +1 -1
|
@@ -54,13 +54,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${n.do
|
|
|
54
54
|
top: ${r}px !important;
|
|
55
55
|
}
|
|
56
56
|
`),()=>{m.contains(p)&&m.removeChild(p)}},[n]),(0,r.jsx)(RD,{isPresent:n,childRef:s,sizeRef:c,children:t.cloneElement(e,{ref:u})})}var BD=({children:e,initial:n,isPresent:i,onExitComplete:a,custom:o,presenceAffectsLayout:s,mode:c,anchorX:l,root:u})=>{let d=HS(VD),f=(0,t.useId)(),p=!0,m=(0,t.useMemo)(()=>(p=!1,{id:f,initial:n,isPresent:i,custom:o,onExitComplete:e=>{d.set(e,!0);for(let e of d.values())if(!e)return;a&&a()},register:e=>(d.set(e,!1),()=>d.delete(e))}),[i,d,a]);return s&&p&&(m={...m}),(0,t.useMemo)(()=>{d.forEach((e,t)=>d.set(t,!1))},[i]),t.useEffect(()=>{!i&&!d.size&&a&&a()},[i]),c===`popLayout`&&(e=(0,r.jsx)(zD,{isPresent:i,anchorX:l,root:u,children:e})),(0,r.jsx)(GS.Provider,{value:m,children:e})};function VD(){return new Map}function HD(e=!0){let n=(0,t.useContext)(GS);if(n===null)return[!0,null];let{isPresent:r,onExitComplete:i,register:a}=n,o=(0,t.useId)();(0,t.useEffect)(()=>{if(e)return a(o)},[e]);let s=(0,t.useCallback)(()=>e&&i&&i(o),[o,i,e]);return!r&&i?[!1,s]:[!0]}var UD=e=>e.key||``;function WD(e){let n=[];return t.Children.forEach(e,e=>{(0,t.isValidElement)(e)&&n.push(e)}),n}var GD=({children:e,custom:n,initial:i=!0,onExitComplete:a,presenceAffectsLayout:o=!0,mode:s=`sync`,propagate:c=!1,anchorX:l=`left`,root:u})=>{let[d,f]=HD(c),p=(0,t.useMemo)(()=>WD(e),[e]),m=c&&!d?[]:p.map(UD),h=(0,t.useRef)(!0),g=(0,t.useRef)(p),_=HS(()=>new Map),v=(0,t.useRef)(new Set),[y,b]=(0,t.useState)(p),[x,S]=(0,t.useState)(p);WS(()=>{h.current=!1,g.current=p;for(let e=0;e<x.length;e++){let t=UD(x[e]);m.includes(t)?(_.delete(t),v.current.delete(t)):_.get(t)!==!0&&_.set(t,!1)}},[x,m.length,m.join(`-`)]);let C=[];if(p!==y){let e=[...p];for(let t=0;t<x.length;t++){let n=x[t],r=UD(n);m.includes(r)||(e.splice(t,0,n),C.push(n))}return s===`wait`&&C.length&&(e=C),S(WD(e)),b(p),null}process.env.NODE_ENV!==`production`&&s===`wait`&&x.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);let{forceRender:w}=(0,t.useContext)(VS);return(0,r.jsx)(r.Fragment,{children:x.map(e=>{let t=UD(e),y=c&&!d?!1:p===x||m.includes(t);return(0,r.jsx)(BD,{isPresent:y,initial:!h.current||i?void 0:!1,custom:n,presenceAffectsLayout:o,mode:s,root:u,onExitComplete:y?void 0:()=>{if(v.current.has(t))return;if(v.current.add(t),_.has(t))_.set(t,!0);else return;let e=!0;_.forEach(t=>{t||(e=!1)}),e&&(w?.(),S(g.current),c&&f?.(),a&&a())},anchorX:l,children:e},t)})})},KD=(0,t.createContext)({strict:!1}),qD={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},JD={};for(let e in qD)JD[e]={isEnabled:t=>qD[e].some(e=>!!t[e])};function YD(e){for(let t in e)JD[t]={...JD[t],...e[t]}}var XD=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.ignoreStrict.viewport`.split(`.`));function ZD(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||XD.has(e)}function QD(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var $D=d((()=>{})),eO=p({default:()=>nO}),tO,nO,rO=d((()=>{$D(),tO=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,nO=QD(function(e){return tO.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91})})),iO=e=>!ZD(e);function aO(e){typeof e==`function`&&(iO=t=>t.startsWith(`on`)?!ZD(t):e(t))}try{aO((rO(),g(eO)).default)}catch{}function oO(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||(iO(i)||n===!0&&ZD(i)||!t&&!ZD(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var sO=(0,t.createContext)({});function cO(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function lO(e){return typeof e==`string`||Array.isArray(e)}var uO=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],dO=[`initial`,...uO];function fO(e){return cO(e.animate)||dO.some(t=>lO(e[t]))}function pO(e){return!!(fO(e)||e.variants)}function mO(e,t){if(fO(e)){let{initial:t,animate:n}=e;return{initial:t===!1||lO(t)?t:void 0,animate:lO(n)?n:void 0}}return e.inherit===!1?{}:t}function hO(e){let{initial:n,animate:r}=mO(e,(0,t.useContext)(sO));return(0,t.useMemo)(()=>({initial:n,animate:r}),[gO(n),gO(r)])}function gO(e){return Array.isArray(e)?e.join(` `):e}function _O(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var vO={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(Q.test(e))e=parseFloat(e);else return e;return`${_O(e,t.target.x)}% ${_O(e,t.target.y)}%`}},yO={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Fw.parse(e);if(i.length>5)return r;let a=Fw.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=zw(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},bO={borderRadius:{...vO,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:vO,borderTopRightRadius:vO,borderBottomLeftRadius:vO,borderBottomRightRadius:vO,boxShadow:yO};function xO(e,{layout:t,layoutId:n}){return qT.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!bO[e]||e===`opacity`)}var SO={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},CO=KT.length;function wO(e,t,n){let r=``,i=!0;for(let a=0;a<CO;a++){let o=KT[a],s=e[o];if(s===void 0)continue;let c=!0;if(c=typeof s==`number`?s===(o.startsWith(`scale`)?1:0):parseFloat(s)===0,!c||n){let e=iD(s,XE[o]);if(!c){i=!1;let t=SO[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function TO(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(qT.has(e)){o=!0;continue}else if(YC(e)){i[e]=n;continue}else{let t=iD(n,XE[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=wO(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}var EO=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function DO(e,t,n){for(let r in t)!jD(t[r])&&!xO(r,n)&&(e[r]=t[r])}function OO({transformTemplate:e},n){return(0,t.useMemo)(()=>{let t=EO();return TO(t,n,e),Object.assign({},t.vars,t.style)},[n])}function kO(e,t){let n=e.style||{},r={};return DO(r,n,e),Object.assign(r,OO(e,t)),r}function AO(e,t){let n={},r=kO(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var jO={offset:`stroke-dashoffset`,array:`stroke-dasharray`},MO={offset:`strokeDashoffset`,array:`strokeDasharray`};function NO(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?jO:MO;e[a.offset]=Q.transform(-r);let o=Q.transform(t),s=Q.transform(n);e[a.array]=`${o} ${s}`}var PO=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function FO(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(TO(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of PO)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&NO(d,i,a,o,!1)}var IO=()=>({...EO(),attrs:{}}),LO=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function RO(e,n,r,i){let a=(0,t.useMemo)(()=>{let t=IO();return FO(t,n,LO(i),e.transformTemplate,e.style),{...t.attrs,style:{...t.style}}},[n]);if(e.style){let t={};DO(t,e.style,e),a.style={...t,...a.style}}return a}var zO=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function BO(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(zO.indexOf(e)>-1||/[A-Z]/u.test(e))}function VO(e,n,r,{latestValues:i},a,o=!1,s){let c=(s??BO(e)?RO:AO)(n,i,a,e),l=oO(n,typeof e==`string`,o),u=e===t.Fragment?{}:{...l,...c,ref:r},{children:d}=n,f=(0,t.useMemo)(()=>jD(d)?d.get():d,[d]);return(0,t.createElement)(e,{...u,children:f})}function HO(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function UO(e,t,n,r){if(typeof t==`function`){let[i,a]=HO(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=HO(r);t=t(n===void 0?e.custom:n,i,a)}return t}function WO(e){return jD(e)?e.get():e}function GO({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:KO(n,r,i,e),renderState:t()}}function KO(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=WO(a[e]);let{initial:o,animate:s}=e,c=fO(e),l=pO(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!cO(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=UO(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var qO=e=>(n,r)=>{let i=(0,t.useContext)(sO),a=(0,t.useContext)(GS),o=()=>GO(e,n,i,a);return r?o():HS(o)};function JO(e,t,n){let{style:r}=e,i={};for(let a in r)(jD(r[a])||t.style&&jD(t.style[a])||xO(a,e)||n?.getValue(a)?.liveStyle!==void 0)&&(i[a]=r[a]);return i}var YO=qO({scrapeMotionValuesFromProps:JO,createRenderState:EO});function XO(e,t,n){let r=JO(e,t,n);for(let n in e)if(jD(e[n])||jD(t[n])){let t=KT.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var ZO=qO({scrapeMotionValuesFromProps:XO,createRenderState:IO}),QO=Symbol.for(`motionComponentSymbol`);function $O(e,n,r){let i=(0,t.useRef)(r);(0,t.useInsertionEffect)(()=>{i.current=r});let a=(0,t.useRef)(null);return(0,t.useCallback)(t=>{t&&e.onMount?.(t),n&&(t?n.mount(t):n.unmount());let r=i.current;if(typeof r==`function`)if(t){let e=r(t);typeof e==`function`&&(a.current=e)}else a.current?(a.current(),a.current=null):r(t);else r&&(r.current=t)},[n])}var ek=e=>e.replace(/([a-z])([A-Z])/gu,`$1-$2`).toLowerCase(),tk=`data-`+ek(`framerAppearId`),nk=(0,t.createContext)({});function rk(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function ik(e,n,r,i,a,o){let{visualElement:s}=(0,t.useContext)(sO),c=(0,t.useContext)(KD),l=(0,t.useContext)(GS),u=(0,t.useContext)(PD).reducedMotion,d=(0,t.useRef)(null);i||=c.renderer,!d.current&&i&&(d.current=i(e,{visualState:n,parent:s,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,isSVG:o}));let f=d.current,p=(0,t.useContext)(nk);f&&!f.projection&&a&&(f.type===`html`||f.type===`svg`)&&ak(d.current,r,a,p);let m=(0,t.useRef)(!1);(0,t.useInsertionEffect)(()=>{f&&m.current&&f.update(r,l)});let h=r[tk],g=(0,t.useRef)(!!h&&!window.MotionHandoffIsComplete?.(h)&&window.MotionHasOptimisedAnimation?.(h));return WS(()=>{f&&(m.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),f.scheduleRenderMicrotask(),g.current&&f.animationState&&f.animationState.animateChanges())}),(0,t.useEffect)(()=>{f&&(!g.current&&f.animationState&&f.animationState.animateChanges(),g.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(h)}),!1),f.enteringChildren=void 0)}),f}function ak(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:ok(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&rk(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:u,layoutScroll:c,layoutRoot:l})}function ok(e){if(e)return e.options.allowProjection===!1?ok(e.parent):e.projection}function sk(e,{forwardMotionProps:n=!1,type:i}={},a,o){a&&YD(a);let s=i?i===`svg`:BO(e),c=s?ZO:YO;function l(i,l){let u,d={...(0,t.useContext)(PD),...i,layoutId:ck(i)},{isStatic:f}=d,p=hO(i),m=c(i,f);if(!f&&US){lk(d,a);let t=uk(d);u=t.MeasureLayout,p.visualElement=ik(e,m,d,o,t.ProjectionNode,s)}return(0,r.jsxs)(sO.Provider,{value:p,children:[u&&p.visualElement?(0,r.jsx)(u,{visualElement:p.visualElement,...d}):null,VO(e,i,$O(m,p.visualElement,l),m,f,n,s)]})}l.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let u=(0,t.forwardRef)(l);return u[QO]=e,u}function ck({layoutId:e}){let n=(0,t.useContext)(VS).id;return n&&e!==void 0?n+`-`+e:e}function lk(e,n){let r=(0,t.useContext)(KD).strict;if(process.env.NODE_ENV!==`production`&&n&&r){let t="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?XS(!1,t,`lazy-strict-mode`):ZS(!1,t,`lazy-strict-mode`)}}function uk(e){let{drag:t,layout:n}=JD;if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function dk(e,t){if(typeof Proxy>`u`)return sk;let n=new Map,r=(n,r)=>sk(n,r,e,t);return new Proxy((e,t)=>(process.env.NODE_ENV!==`production`&&fC(!1,`motion() is deprecated. Use motion.create() instead.`),r(e,t)),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,sk(a,void 0,e,t)),n.get(a))})}function fk({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function pk({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function mk(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function hk(e){return e===void 0||e===1}function gk({scale:e,scaleX:t,scaleY:n}){return!hk(e)||!hk(t)||!hk(n)}function _k(e){return gk(e)||vk(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function vk(e){return yk(e.x)||yk(e.y)}function yk(e){return e&&e!==`0%`}function bk(e,t,n){return n+t*(e-n)}function xk(e,t,n,r,i){return i!==void 0&&(e=bk(e,i,r)),bk(e,n,r)+t}function Sk(e,t=0,n=1,r,i){e.min=xk(e.min,t,n,r,i),e.max=xk(e.max,t,n,r,i)}function Ck(e,{x:t,y:n}){Sk(e.x,t.translate,t.scale,t.originPoint),Sk(e.y,n.translate,n.scale,n.originPoint)}var wk=.999999999999,Tk=1.0000000000001;function Ek(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&kk(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Ck(e,o)),r&&_k(a.latestValues)&&kk(e,a.latestValues))}t.x<Tk&&t.x>wk&&(t.x=1),t.y<Tk&&t.y>wk&&(t.y=1)}function Dk(e,t){e.min+=t,e.max+=t}function Ok(e,t,n,r,i=.5){Sk(e,t,n,zw(e.min,e.max,i),r)}function kk(e,t){Ok(e.x,t.x,t.scaleX,t.scale,t.originX),Ok(e.y,t.y,t.scaleY,t.scale,t.originY)}function Ak(e,t){return fk(mk(e.getBoundingClientRect(),t))}function jk(e,t,n){let r=Ak(e,n),{scroll:i}=t;return i&&(Dk(r.x,i.offset.x),Dk(r.y,i.offset.y)),r}var Mk=()=>({translate:0,scale:1,origin:0,originPoint:0}),Nk=()=>({x:Mk(),y:Mk()}),Pk=()=>({min:0,max:0}),Fk=()=>({x:Pk(),y:Pk()}),Ik={current:null},Lk={current:!1};function Rk(){if(Lk.current=!0,US)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>Ik.current=e.matches;e.addEventListener(`change`,t),t()}else Ik.current=!1}var zk=new WeakMap;function Bk(e,t,n){for(let r in t){let i=t[r],a=n[r];if(jD(i))e.addValue(r,i);else if(jD(a))e.addValue(r,uD(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,uD(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var Vk=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Hk=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:i,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=oE,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=KC.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,BC.render(this.render,!1,!0))};let{latestValues:s,renderState:c}=a;this.latestValues=s,this.baseTarget={...s},this.initialValues=t.initial?{...s}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=o,this.blockInitialAnimation=!!i,this.isControllingVariants=fO(t),this.isVariantNode=pO(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:l,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in u){let t=u[e];s[e]!==void 0&&jD(t)&&t.set(s[e])}}mount(e){this.current=e,zk.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(Lk.current||Rk(),this.shouldReduceMotion=Ik.current),process.env.NODE_ENV!==`production`&&fC(this.shouldReduceMotion!==!0,`You have Reduced Motion enabled on your device. Animations may not appear as expected.`,`reduced-motion-disabled`),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in this.projection&&this.projection.unmount(),VC(this.notifyUpdate),VC(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let n=qT.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&BC.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in JD){let t=JD[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Fk()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<Vk.length;t++){let n=Vk[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=Bk(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=uD(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&($S(n)||tC(n))?n=parseFloat(n):!ND(n)&&Fw.test(t)&&(n=$E(e,t)),this.setBaseTarget(e,jD(n)?n.get():n)),jD(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=UO(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!jD(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new sC),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){dD.render(this.render)}},Uk=class extends Hk{constructor(){super(...arguments),this.KeyframeResolver=nD}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;jD(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}};function Wk(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function Gk(e){return window.getComputedStyle(e)}var Kk=class extends Uk{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Wk}readValueFromInstance(e,t){if(qT.has(t))return this.projection?.isProjecting?HT(t):WT(e,t);{let n=Gk(e),r=(YC(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Ak(e,t)}build(e,t,n){TO(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return JO(e,t,n)}},qk=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]);function Jk(e,t,n,r){for(let n in Wk(e,t,void 0,r),t.attrs)e.setAttribute(qk.has(n)?n:ek(n),t.attrs[n])}var Yk=class extends Uk{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Fk}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(qT.has(t)){let e=QE(t);return e&&e.default||0}return t=qk.has(t)?t:ek(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return XO(e,t,n)}build(e,t,n){FO(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Jk(e,t,n,r)}mount(e){this.isSVGTag=LO(e.tagName),super.mount(e)}},Xk=(e,n)=>n.isSVG??BO(e)?new Yk(n):new Kk(n,{allowProjection:e!==t.Fragment});function Zk(e,t,n){let r=e.getProps();return UO(r,t,n===void 0?r.custom:n,e)}var Qk=e=>Array.isArray(e);function $k(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,uD(n))}function eA(e){return Qk(e)?e[e.length-1]||0:e}function tA(e,t){let{transitionEnd:n={},transition:r={},...i}=Zk(e,t)||{};for(let t in i={...i,...n},i)$k(e,t,eA(i[t]))}function nA(e){return!!(jD(e)&&e.add)}function rA(e,t){let n=e.getValue(`willChange`);if(nA(n))return n.add(t);if(!n&&QS.WillChange){let n=new QS.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function iA(e){return e.props[tk]}var aA=e=>e!==null;function oA(e,{repeat:t,repeatType:n=`loop`},r){let i=e.filter(aA),a=t&&n!==`loop`&&t%2==1?0:i.length-1;return!a||r===void 0?i[a]:r}var sA={type:`spring`,stiffness:500,damping:25,restSpeed:10},cA=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),lA={type:`keyframes`,duration:.8},uA={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},dA=(e,{keyframes:t})=>t.length>2?lA:qT.has(e)?e.startsWith(`scale`)?cA(t[1]):sA:uA;function fA({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:a,repeatType:o,repeatDelay:s,from:c,elapsed:l,...u}){return!!Object.keys(u).length}var pA=(e,t,n,r={},i,a)=>o=>{let s=RE(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=cC(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};fA(s)||Object.assign(u,dA(e,u)),u.duration&&=cC(u.duration),u.repeatDelay&&=cC(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(OE(u),u.delay===0&&(d=!0)),(QS.instantAnimations||QS.skipAnimations)&&(d=!0,OE(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=oA(u.keyframes,s);if(e!==void 0){BC.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new MT(u):new NE(u)};function mA({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function hA(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a=e.getDefaultTransition(),transitionEnd:o,...s}=t;r&&(a=r);let c=[],l=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||l&&mA(l,t))continue;let o={delay:n,...RE(a||{},t)},u=r.get();if(u!==void 0&&!r.isAnimating&&!Array.isArray(i)&&i===u&&!o.velocity)continue;let d=!1;if(window.MotionHandoffAnimation){let n=iA(e);if(n){let e=window.MotionHandoffAnimation(n,t,BC);e!==null&&(o.startTime=e,d=!0)}}rA(e,t),r.start(pA(t,r,i,e.shouldReduceMotion&&zE.has(t)?{type:!1}:o,e,d));let f=r.animation;f&&c.push(f)}return o&&Promise.all(c).then(()=>{BC.update(()=>{o&&tA(e,o)})}),c}function gA(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}function _A(e,t,n={}){let r=Zk(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(hA(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return vA(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function vA(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(_A(c,t,{...o,delay:n+(typeof r==`function`?0:r)+gA(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function yA(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>_A(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=_A(e,t,n);else{let i=typeof t==`function`?Zk(e,t,n.custom):t;r=Promise.all(hA(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}function bA(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var xA=dO.length;function SA(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&SA(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<xA;n++){let r=dO[n],i=e.props[r];(lO(i)||i===!1)&&(t[r]=i)}return t}var CA=[...uO].reverse(),wA=uO.length;function TA(e){return t=>Promise.all(t.map(({animation:t,options:n})=>yA(e,t,n)))}function EA(e){let t=TA(e),n=kA(),r=!0,i=t=>(n,r)=>{let i=Zk(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function a(n){t=n(e)}function o(a){let{props:o}=e,s=SA(e.parent)||{},c=[],l=new Set,u={},d=1/0;for(let t=0;t<wA;t++){let f=CA[t],p=n[f],m=o[f]===void 0?s[f]:o[f],h=lO(m),g=f===a?p.isActive:null;g===!1&&(d=t);let _=m===s[f]&&m!==o[f]&&h;if(_&&r&&e.manuallyAnimateOnMount&&(_=!1),p.protectedKeys={...u},!p.isActive&&g===null||!m&&!p.prevProp||cO(m)||typeof m==`boolean`)continue;let v=DA(p.prevProp,m),y=v||f===a&&p.isActive&&!_&&h||t>d&&h,b=!1,x=Array.isArray(m)?m:[m],S=x.reduce(i(f),{});g===!1&&(S={});let{prevResolvedValues:C={}}=p,w={...C,...S},T=t=>{y=!0,l.has(t)&&(b=!0,l.delete(t)),p.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in w){let t=S[e],n=C[e];if(u.hasOwnProperty(e))continue;let r=!1;r=Qk(t)&&Qk(n)?!bA(t,n):t!==n,r?t==null?l.add(e):T(e):t!==void 0&&l.has(e)?T(e):p.protectedKeys[e]=!0}p.prevProp=m,p.prevResolvedValues=S,p.isActive&&(u={...u,...S}),r&&e.blockInitialAnimation&&(y=!1);let E=_&&v;y&&(!E||b)&&c.push(...x.map(t=>{let n={type:f};if(typeof t==`string`&&r&&!E&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=Zk(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=gA(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(l.size){let t={};if(typeof o.initial!=`boolean`){let n=Zk(e,Array.isArray(o.initial)?o.initial[0]:o.initial);n&&n.transition&&(t.transition=n.transition)}l.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),c.push({animation:t})}let f=!!c.length;return r&&(o.initial===!1||o.initial===o.animate)&&!e.manuallyAnimateOnMount&&(f=!1),r=!1,f?t(c):Promise.resolve()}function s(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=o(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:o,setActive:s,setAnimateFunction:a,getState:()=>n,reset:()=>{n=kA()}}}function DA(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!bA(t,e):!1}function OA(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function kA(){return{animate:OA(!0),whileInView:OA(),whileHover:OA(),whileTap:OA(),whileDrag:OA(),whileFocus:OA(),exit:OA()}}var AA=class{constructor(e){this.isMounted=!1,this.node=e}update(){}},jA=class extends AA{constructor(e){super(e),e.animationState||=EA(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();cO(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},MA=0,NA={animation:{Feature:jA},exit:{Feature:class extends AA{constructor(){super(...arguments),this.id=MA++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function PA(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function FA(e){return{point:{x:e.pageX,y:e.pageY}}}var IA=e=>t=>bD(t)&&e(t,FA(t));function LA(e,t,n,r){return PA(e,t,IA(n),r)}var RA=1e-4,zA=1-RA,BA=1+RA,VA=.01,HA=0-VA,UA=0+VA;function WA(e){return e.max-e.min}function GA(e,t,n){return Math.abs(e-t)<=n}function KA(e,t,n,r=.5){e.origin=r,e.originPoint=zw(t.min,t.max,e.origin),e.scale=WA(n)/WA(t),e.translate=zw(n.min,n.max,e.origin)-e.originPoint,(e.scale>=zA&&e.scale<=BA||isNaN(e.scale))&&(e.scale=1),(e.translate>=HA&&e.translate<=UA||isNaN(e.translate))&&(e.translate=0)}function qA(e,t,n,r){KA(e.x,t.x,n.x,r?r.originX:void 0),KA(e.y,t.y,n.y,r?r.originY:void 0)}function JA(e,t,n){e.min=n.min+t.min,e.max=e.min+WA(t)}function YA(e,t,n){JA(e.x,t.x,n.x),JA(e.y,t.y,n.y)}function XA(e,t,n){e.min=t.min-n.min,e.max=e.min+WA(t)}function ZA(e,t,n){XA(e.x,t.x,n.x),XA(e.y,t.y,n.y)}function QA(e){return[e(`x`),e(`y`)]}var $A=({current:e})=>e?e.ownerDocument.defaultView:null,ej=(e,t)=>Math.abs(e-t);function tj(e,t){let n=ej(e.x,t.x),r=ej(e.y,t.y);return Math.sqrt(n**2+r**2)}var nj=new Set([`auto`,`scroll`]),rj=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let e=oj(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=tj(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=HC;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=ij(t,this.transformPagePoint),BC.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=oj(e.type===`pointercancel`?this.lastMoveEventInfo:ij(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!bD(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=ij(FA(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=HC;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,oj(s,this.history)),this.removeListeners=aC(LA(this.contextWindow,`pointermove`,this.handlePointerMove),LA(this.contextWindow,`pointerup`,this.handlePointerUp),LA(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(nj.has(e.overflowX)||nj.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener(`scroll`,this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),BC.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),VC(this.updatePoint)}};function ij(e,t){return t?{point:t(e.point)}:e}function aj(e,t){return{x:e.x-t.x,y:e.y-t.y}}function oj({point:e},t){return{point:e,delta:aj(e,cj(t)),offset:aj(e,sj(t)),velocity:lj(t,.1)}}function sj(e){return e[0]}function cj(e){return e[e.length-1]}function lj(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=cj(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>cC(t)));)n--;if(!r)return{x:0,y:0};let a=lC(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function uj(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?zw(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?zw(n,e,r.max):Math.min(e,n)),e}function dj(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function fj(e,{top:t,left:n,bottom:r,right:i}){return{x:dj(e.x,n,i),y:dj(e.y,t,r)}}function pj(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function mj(e,t){return{x:pj(e.x,t.x),y:pj(e.y,t.y)}}function hj(e,t){let n=.5,r=WA(e),i=WA(t);return i>r?n=oC(t.min,t.max-r,e.min):r>i&&(n=oC(e.min,e.max-i,t.min)),JS(0,1,n)}function gj(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var _j=.35;function vj(e=_j){return e===!1?e=0:e===!0&&(e=_j),{x:yj(e,`left`,`right`),y:yj(e,`top`,`bottom`)}}function yj(e,t,n){return{min:bj(e,t),max:bj(e,n)}}function bj(e,t){return typeof e==`number`?e:e[t]||0}var xj=new WeakMap,Sj=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Fk(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t?(this.stopAnimation(),this.snapToCursor(FA(e).point)):this.pauseAnimation()},a=(e,t)=>{this.stopAnimation();let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=hD(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),QA(e=>{let t=this.getAxisMotionValue(e).get()||0;if(gw.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=WA(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&BC.postRender(()=>i(e,t)),rA(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=wj(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&a(e,t)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>QA(e=>this.getAnimationState(e)===`paused`&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:l}=this.getProps();this.panSession=new rj(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:$A(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&BC.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!Cj(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=uj(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&rk(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=fj(n.layoutBox,e):this.constraints=!1,this.elastic=vj(t),r!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&QA(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=gj(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!rk(e))return!1;let n=e.current;ZS(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.",`drag-constraints-ref`);let{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=jk(n,r.root,this.visualElement.getTransformPagePoint()),a=mj(r.layout.layoutBox,i);if(t){let e=t(pk(a));this.hasMutatedConstraints=!!e,e&&(a=fk(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=QA(o=>{if(!Cj(o,t,this.currentDirection))return;let c=s&&s[o]||{};a&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return rA(this.visualElement,e),n.start(pA(e,n,0,t,this.visualElement,!1))}stopAnimation(){QA(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){QA(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){QA(t=>{let{drag:n}=this.getProps();if(!Cj(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-zw(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!rk(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};QA(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=hj({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),QA(t=>{if(!Cj(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(zw(i,a,r[t]))})}addListeners(){if(!this.visualElement.current)return;xj.set(this.visualElement,this);let e=this.visualElement.current,t=LA(e,`pointerdown`,e=>{let{drag:t,dragListener:n=!0}=this.getProps();t&&n&&!SD(e.target)&&this.start(e)}),n=()=>{let{dragConstraints:e}=this.getProps();rk(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,i=r.addEventListener(`measure`,n);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),BC.read(n);let a=PA(window,`resize`,()=>this.scalePositionWithinConstraints()),o=r.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(QA(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{a(),t(),i(),o&&o()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=_j,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function Cj(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function wj(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var Tj=class extends AA{constructor(e){super(e),this.removeGroupControls=rC,this.removeListeners=rC,this.controls=new Sj(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||rC}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners()}},Ej=e=>(t,n)=>{e&&BC.postRender(()=>e(t,n))},Dj=class extends AA{constructor(){super(...arguments),this.removePointerDownListener=rC}onPointerDown(e){this.session=new rj(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:$A(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Ej(e),onStart:Ej(t),onMove:n,onEnd:(e,t)=>{delete this.session,r&&BC.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=LA(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},Oj={hasAnimatedSinceResize:!0,hasEverUpdated:!1},kj=!1,Aj=class extends t.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),kj&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Oj.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,kj=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||BC.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),dD.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;kj=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function jj(e){let[n,i]=HD(),a=(0,t.useContext)(VS);return(0,r.jsx)(Aj,{...e,layoutGroup:a,switchLayoutGroup:(0,t.useContext)(nk),isPresent:n,safeToRemove:i})}function Mj(e,t,n){let r=jD(e)?e:uD(e);return r.start(pA(``,r,t,n)),r.animation}var Nj=(e,t)=>e.depth-t.depth,Pj=class{constructor(){this.children=[],this.isDirty=!1}add(e){KS(this.children,e),this.isDirty=!0}remove(e){qS(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Nj),this.isDirty=!1,this.children.forEach(e)}};function Fj(e,t){let n=KC.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(VC(r),e(a-t))};return BC.setup(r,!0),()=>VC(r)}var Ij=[`TopLeft`,`TopRight`,`BottomLeft`,`BottomRight`],Lj=Ij.length,Rj=e=>typeof e==`string`?parseFloat(e):e,zj=e=>typeof e==`number`||Q.test(e);function Bj(e,t,n,r,i,a){i?(e.opacity=zw(0,n.opacity??1,Hj(r)),e.opacityExit=zw(t.opacity??1,0,Uj(r))):a&&(e.opacity=zw(t.opacity??1,n.opacity??1,r));for(let i=0;i<Lj;i++){let a=`border${Ij[i]}Radius`,o=Vj(t,a),s=Vj(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||zj(o)===zj(s)?(e[a]=Math.max(zw(Rj(o),Rj(s),r),0),(gw.test(s)||gw.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=zw(t.rotate||0,n.rotate||0,r))}function Vj(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Hj=Wj(0,.5,TC),Uj=Wj(.5,.95,rC);function Wj(e,t,n){return r=>r<e?0:r>t?1:n(oC(e,t,r))}function Gj(e,t){e.min=t.min,e.max=t.max}function Kj(e,t){Gj(e.x,t.x),Gj(e.y,t.y)}function qj(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Jj(e,t,n,r,i){return e-=t,e=bk(e,1/n,r),i!==void 0&&(e=bk(e,1/i,r)),e}function Yj(e,t=0,n=1,r=.5,i,a=e,o=e){if(gw.test(t)&&(t=parseFloat(t),t=zw(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=zw(a.min,a.max,r);e===a&&(s-=t),e.min=Jj(e.min,t,n,s,i),e.max=Jj(e.max,t,n,s,i)}function Xj(e,t,[n,r,i],a,o){Yj(e,t[n],t[r],t[i],t.scale,a,o)}var Zj=[`x`,`scaleX`,`originX`],Qj=[`y`,`scaleY`,`originY`];function $j(e,t,n,r){Xj(e.x,t,Zj,n?n.x:void 0,r?r.x:void 0),Xj(e.y,t,Qj,n?n.y:void 0,r?r.y:void 0)}function eM(e){return e.translate===0&&e.scale===1}function tM(e){return eM(e.x)&&eM(e.y)}function nM(e,t){return e.min===t.min&&e.max===t.max}function rM(e,t){return nM(e.x,t.x)&&nM(e.y,t.y)}function iM(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function aM(e,t){return iM(e.x,t.x)&&iM(e.y,t.y)}function oM(e){return WA(e.x)/WA(e.y)}function sM(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}var cM=class{constructor(){this.members=[]}add(e){KS(this.members,e),e.scheduleRender()}remove(e){if(qS(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t=this.members.findIndex(t=>e===t);if(t===0)return!1;let n;for(let e=t;e>=0;e--){let t=this.members[e];if(t.isPresent!==!1){n=t;break}}return n?(this.promote(n),!0):!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,t&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);let{crossfade:r}=e.options;r===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:n}=e;t.onExitComplete&&t.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}};function lM(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:o,skewY:s}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),a&&(r+=`rotateY(${a}deg) `),o&&(r+=`skewX(${o}deg) `),s&&(r+=`skewY(${s}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var uM={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},dM=[``,`X`,`Y`,`Z`],fM=1e3,pM=0;function mM(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function hM(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=iA(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,BC,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&hM(r)}function gM({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=pM++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,IC.value&&(uM.nodes=uM.calculatedTargetDeltas=uM.calculatedProjections=0),this.nodes.forEach(yM),this.nodes.forEach(EM),this.nodes.forEach(DM),this.nodes.forEach(bM),IC.addProjectionMetrics&&IC.addProjectionMetrics(uM)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new Pj)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new sC),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=kD(t)&&!AD(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;BC.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Fj(i,250),Oj.hasAnimatedSinceResize&&(Oj.hasAnimatedSinceResize=!1,this.nodes.forEach(TM)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||PM,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!aM(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...RE(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l)}else t||TM(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),VC(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(OM),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&hM(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(SM);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(CM);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(wM),this.nodes.forEach(_M),this.nodes.forEach(vM)):this.nodes.forEach(CM),this.clearAllSnapshots();let e=KC.now();HC.delta=JS(0,1e3/60,e-HC.timestamp),HC.timestamp=e,HC.isProcessing=!0,UC.update.process(HC),UC.preRender.process(HC),UC.render.process(HC),HC.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,dD.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(xM),this.sharedNodes.forEach(kM)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,BC.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){BC.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!WA(this.snapshot.measuredBox.x)&&!WA(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Fk(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!tM(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||_k(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),RM(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return Fk();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(BM))){let{scroll:e}=this.root;e&&(Dk(t.x,e.offset.x),Dk(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Fk();if(Kj(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&Kj(t,e),Dk(t.x,i.offset.x),Dk(t.y,i.offset.y))}return t}applyTransform(e,t=!1){let n=Fk();Kj(n,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];!t&&r.options.layoutScroll&&r.scroll&&r!==r.root&&kk(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),_k(r.latestValues)&&kk(n,r.latestValues)}return _k(this.latestValues)&&kk(n,this.latestValues),n}removeTransform(e){let t=Fk();Kj(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!n.instance||!_k(n.latestValues))continue;gk(n.latestValues)&&n.updateSnapshot();let r=Fk();Kj(r,n.measurePageBox()),$j(t,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return _k(this.latestValues)&&$j(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==HC.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=HC.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Fk(),this.targetWithTransforms=Fk()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),YA(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Kj(this.target,this.layout.layoutBox),Ck(this.target,this.targetDelta)):Kj(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),IC.value&&uM.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||gk(this.parent.latestValues)||vk(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Fk(),this.relativeTargetOrigin=Fk(),ZA(this.relativeTargetOrigin,t,n),Kj(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===HC.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;Kj(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;Ek(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=Fk());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(qj(this.prevProjectionDelta.x,this.projectionDelta.x),qj(this.prevProjectionDelta.y,this.projectionDelta.y)),qA(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!sM(this.projectionDelta.x,this.prevProjectionDelta.x)||!sM(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),IC.value&&uM.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Nk(),this.projectionDelta=Nk(),this.projectionDeltaWithTransform=Nk()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=Nk();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=Fk(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=!!(s&&!l&&this.options.crossfade===!0&&!this.path.some(NM));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;AM(a.x,e.x,n),AM(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ZA(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),MM(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&rM(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=Fk(),Kj(d,this.relativeTarget)),s&&(this.animationValues=i,Bj(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(VC(this.pendingAnimation),void 0),this.pendingAnimation=BC.update(()=>{Oj.hasAnimatedSinceResize=!0,qC.layout++,this.motionValue||=uD(0),this.currentAnimation=Mj(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{qC.layout--},onComplete:()=>{qC.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(fM),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&zM(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Fk();let t=WA(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=WA(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}Kj(t,n),kk(t,i),qA(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new cM),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&mM(`z`,e,r,this.animationValues);for(let t=0;t<dM.length;t++)mM(`rotate${dM[t]}`,e,r,this.animationValues),mM(`skew${dM[t]}`,e,r,this.animationValues);for(let t in e.render(),r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=WO(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=WO(t?.pointerEvents)||``),this.hasProjected&&!_k(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=lM(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;for(let t in e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit,bO){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=bO[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?WO(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(SM),this.root.sharedNodes.clear()}}}function _M(e){e.updateLayout()}function vM(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;i===`size`?QA(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=WA(r);r.min=n[e].min,r.max=r.min+i}):zM(i,t.layoutBox,n)&&QA(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=WA(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=Nk();qA(o,n,t.layoutBox);let s=Nk();a?qA(s,e.applyTransform(r,!0),t.measuredBox):qA(s,n,t.layoutBox);let c=!tM(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=Fk();ZA(o,t.layoutBox,i.layoutBox);let s=Fk();ZA(s,n,a.layoutBox),aM(o,s)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=s,e.relativeTargetOrigin=o,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function yM(e){IC.value&&uM.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function bM(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function xM(e){e.clearSnapshot()}function SM(e){e.clearMeasurements()}function CM(e){e.isLayoutDirty=!1}function wM(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function TM(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function EM(e){e.resolveTargetDelta()}function DM(e){e.calcProjection()}function OM(e){e.resetSkewAndRotation()}function kM(e){e.removeLeadSnapshot()}function AM(e,t,n){e.translate=zw(t.translate,0,n),e.scale=zw(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function jM(e,t,n,r){e.min=zw(t.min,n.min,r),e.max=zw(t.max,n.max,r)}function MM(e,t,n,r){jM(e.x,t.x,n.x,r),jM(e.y,t.y,n.y,r)}function NM(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var PM={duration:.45,ease:[.4,0,.1,1]},FM=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),IM=FM(`applewebkit/`)&&!FM(`chrome/`)?Math.round:rC;function LM(e){e.min=IM(e.min),e.max=IM(e.max)}function RM(e){LM(e.x),LM(e.y)}function zM(e,t,n){return e===`position`||e===`preserve-aspect`&&!GA(oM(t),oM(n),.2)}function BM(e){return e!==e.root&&e.scroll?.wasRoot}var VM=gM({attachResizeListener:(e,t)=>PA(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),HM={current:void 0},UM=gM({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!HM.current){let e=new VM({});e.mount(window),e.setOptions({layoutScroll:!0}),HM.current=e}return HM.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),WM={pan:{Feature:Dj},drag:{Feature:Tj,ProjectionNode:UM,MeasureLayout:jj}};function GM(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&BC.postRender(()=>i(t,FA(t)))}var KM=class extends AA{mount(){let{current:e}=this.node;e&&(this.unmount=vD(e,(e,t)=>(GM(this.node,t,`Start`),e=>GM(this.node,e,`End`))))}unmount(){}},qM=class extends AA{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=aC(PA(this.node.current,`focus`,()=>this.onFocus()),PA(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function JM(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&BC.postRender(()=>i(t,FA(t)))}var YM=class extends AA{mount(){let{current:e}=this.node;e&&(this.unmount=OD(e,(e,t)=>(JM(this.node,t,`Start`),(e,{success:t})=>JM(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}},XM=new WeakMap,ZM=new WeakMap,QM=e=>{let t=XM.get(e.target);t&&t(e)},$M=e=>{e.forEach(QM)};function eN({root:e,...t}){let n=e||document;ZM.has(n)||ZM.set(n,{});let r=ZM.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver($M,{root:e,...t})),r[i]}function tN(e,t,n){let r=eN(t);return XM.set(e,n),r.observe(e),()=>{XM.delete(e),r.unobserve(e)}}var nN={some:0,all:1},rN=class extends AA{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:nN[r]};return tN(this.node.current,a,e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(iN(e,t))&&this.startObserver()}unmount(){}};function iN({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var aN={inView:{Feature:rN},tap:{Feature:YM},focus:{Feature:qM},hover:{Feature:KM}},oN={layout:{ProjectionNode:UM,MeasureLayout:jj}},sN=dk({...NA,...aN,...WM,...oN},Xk),cN=(e,t)=>{if(e.id===t.id)return!1;let n=.1;return e.x>=t.x-n&&e.x+e.width<=t.x+t.width+n&&e.y>=t.y-n&&e.y+e.height<=t.y+t.height+n},lN=(e,t,n,r,i=1.2)=>{if(!e)return 0;let a=document.createElement(`canvas`).getContext(`2d`);if(!a)return 0;a.font=`${r}px ${n}`;let o=e.split(` `),s=``,c=1;for(let e=0;e<o.length;e++){let n=s+o[e]+` `;a.measureText(n).width>t&&e>0?(s=o[e]+` `,c++):s=n}let l=e.split(`
|
|
57
|
-
`).length-1;return c+=l,Math.ceil(c*r*i)};let uN=(e,t)=>{let n=e.map(e=>({...e})),r=new Map(e.map(e=>[e.id,e])),i=[];n.forEach(e=>{let a=e.type===`text`,o=e.type===`text-container`;if((a||o)&&e.autoGrow){let a=e.content;t&&(a=a.replace(/\{\{(.*?)\}\}/g,(n,r)=>{let i=t[r.trim()];return i==null?n:e.formatting?jS(i,e.formatting):String(i)}));let s=parseInt(String(e.style?.fontSize||16)),c=String(e.style?.fontFamily||`Arial`);if(o&&e.containerExpansion===`horizontal`){let t=document.createElement(`canvas`).getContext(`2d`);if(t){t.font=`${s}px ${c}`;let n=t.measureText(a),r=Math.ceil(n.width+parseInt(String(e.style?.padding||0))*2);Math.abs(r-e.width)>1&&(e.width=r,e.content=a)}}else{let t=lN(a,e.width,c,s),o=e.height,l=t-o;if(Math.abs(l)>1){e.height=t,e.content=a;let s=[],c=r.get(e.id);c&&n.forEach(t=>{if(t.id===e.id)return;let n=r.get(t.id);n&&cN(c,n)&&s.push(t)});let u=new Set([e.id]);s.forEach(e=>{e.height+=l,u.add(e.id)}),i.push({triggerY:e.y+o,delta:l,ignoreIds:u})}}}}),n.forEach(e=>{let t=r.get(e.id);if(!t)return;let n=0;i.forEach(r=>{r.ignoreIds.has(e.id)||t.y>=r.triggerY-.1&&(n+=r.delta)}),e.y+=n});let a=0;return n.forEach(e=>{let t=e.y+e.height;t>a&&(a=t)}),{elements:n,totalHeight:a}};var dN=e=>{switch(e){case`linear`:return`linear`;case`ease-in`:return`easeIn`;case`ease-out`:return`easeOut`;case`ease-in-out`:return`easeInOut`;case`bounce`:return`easeOut`;case`ease`:return`easeInOut`;default:return`easeOut`}},fN=e=>{if(!e||e.type===`none`)return{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1}};let t={initial:{},animate:{}};switch(e.type){case`fadeIn`:t.initial={opacity:0},t.animate={opacity:1};break;case`slideInLeft`:t.initial={opacity:0,x:-100},t.animate={opacity:1,x:0};break;case`slideInRight`:t.initial={opacity:0,x:100},t.animate={opacity:1,x:0};break;case`slideInUp`:t.initial={opacity:0,y:100},t.animate={opacity:1,y:0};break;case`slideInDown`:t.initial={opacity:0,y:-100},t.animate={opacity:1,y:0};break;case`zoomIn`:t.initial={opacity:0,scale:.5},t.animate={opacity:1,scale:1};break;case`bounceIn`:t.initial={opacity:0,scale:.3},t.animate={opacity:1,scale:1,transition:{type:`spring`,bounce:.6}};break;case`smoothSlideUp`:t.initial={opacity:0,y:30},t.animate={opacity:1,y:0};break;case`popIn`:t.initial={opacity:0,scale:.8,y:10},t.animate={opacity:1,scale:1,y:0};break;case`blurIn`:t.initial={opacity:0,filter:`blur(10px)`},t.animate={opacity:1,filter:`blur(0px)`};break;case`pulse`:t.animate={scale:[1,1.05,1]};break;case`shake`:t.animate={x:[0,-5,5,-5,5,0]};break;case`spin`:t.animate={rotate:360};break;default:t.initial={opacity:0,y:20},t.animate={opacity:1,y:0}}return t},pN=(e,t)=>{let n={duration:e?.duration||.4,ease:dN(e?.timingFunction),delay:e?.delay||0},r;e?.iterationCount===`infinite`?r=1/0:typeof e?.iterationCount==`number`&&e.iterationCount>1&&(r=e.iterationCount-1);let i=t?.animate?.transition;return i?{...n,...i,delay:n.delay,repeat:r??i.repeat}:r===void 0?n:{...n,repeat:r}},mN=({element:e,offsetY:n=0,dataContext:i,onSelect:a,isSelected:o})=>{let s=e.content;if(i){if(e.type===`text`||e.type===`text-container`)s=s.replace(/\{\{(.*?)\}\}/g,(t,n)=>{let r=i[n.trim()];return r==null?t:e.formatting?jS(r,e.formatting):String(r)});else if(e.type===`image`)if(e.dataBinding){let t=i[e.dataBinding];t!=null&&(s=String(t))}else s=s.replace(/\{\{(.*?)\}\}/g,(e,t)=>{let n=i[t.trim()];return n==null?e:String(n)})}let c={position:`absolute`,left:e.x,top:e.y+n,width:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`max-content`:`${e.width}px`,height:e.autoGrow?`auto`:`${e.height}px`,transform:e.rotation?`rotate(${e.rotation}deg)`:void 0,padding:e.type===`image`||e.type===`text`||e.type===`text-container`?0:`8px`,overflow:e.autoGrow?`visible`:`hidden`,whiteSpace:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`nowrap`:e.autoGrow?`pre-wrap`:void 0,wordBreak:e.autoGrow?`break-word`:void 0,outline:o?`2px solid var(--blue-9)`:void 0,zIndex:o?10:void 0,cursor:a?`pointer`:void 0,...e.style},l=e.animation&&e.animation.type!==`none`,u=t.default.useMemo(()=>l?fN(e.animation):null,[e.animation,l]),d=t.default.useMemo(()=>pN(e.animation,u),[e.animation,u]),f=(0,r.jsxs)(r.Fragment,{children:[(e.type===`text`||e.type===`text-container`)&&(0,r.jsx)(H,{style:{width:`100%`,height:`100%`,display:`block`},children:s}),e.type===`image`&&(s&&MS(s)?(0,r.jsx)(`img`,{src:s,alt:`Element`,style:{width:`100%`,height:`100%`,objectFit:e.style?.objectFit||`cover`,display:`block`}}):(0,r.jsx)(U,{style:{width:`100%`,height:`100%`,backgroundColor:`#eee`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(H,{size:`1`,children:s?`URL inválida`:`Imagem`})})),e.type===`box`&&(0,r.jsx)(U,{style:{width:`100%`,height:`100%`}}),e.type===`checkbox`&&(0,r.jsx)(U,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(`input`,{type:`checkbox`,checked:i&&e.dataBinding?i[e.dataBinding]===!0||String(i[e.dataBinding])===`true`:!1,readOnly:!0,style:{width:`100%`,height:`100%`,margin:0}})})]});return l&&u?(0,r.jsx)(sN.div,{variants:u,initial:`initial`,animate:`animate`,transition:d,style:c,onClick:t=>{t.stopPropagation(),a?.(e.id)},children:f}):(0,r.jsx)(U,{style:c,onClick:t=>{t.stopPropagation(),a?.(e.id)},children:f})},hN=({item:e,elements:n,animation:i,onSelect:a,selectedElementIds:o})=>{let{elements:s,totalHeight:c}=t.default.useMemo(()=>uN(n,e),[n,e]),l=t.default.useMemo(()=>fN(i),[i]),u=t.default.useMemo(()=>l.animate?.transition||{duration:i?.duration||.4,ease:dN(i?.timingFunction)},[i,l]);return(0,r.jsx)(sN.div,{layout:!0,variants:l,initial:`initial`,animate:`animate`,exit:{opacity:0,scale:.9},transition:u,whileHover:{scale:1.02,transition:{duration:.2}},style:{position:`relative`,height:c,width:`100%`,marginBottom:`20px`,transformOrigin:`center center`},children:s.map(t=>(0,r.jsx)(mN,{element:t,offsetY:0,dataContext:e,onSelect:a,isSelected:o?.includes(t.id)},t.id))})};let gN=()=>{let{state:e,setSelectedElements:n}=rS(),[i,a]=t.default.useState(!1),[o,s]=t.default.useState([]);return t.default.useEffect(()=>{let t;return i&&e.isList?(o.length===0&&s([{id:Date.now(),...e.mockData[0]||{}}]),t=setInterval(()=>{s(t=>{let n=t.length%(e.mockData.length||1),r={...e.mockData.length>0?e.mockData[n]:{id:t.length},id:`${Date.now()}-${t.length}`};return e.listSettings.newestPosition===`top`?[r,...t].slice(0,20):[...t,r].slice(-20)})},1500)):s([]),()=>clearInterval(t)},[i,e.isList,e.listSettings.newestPosition,e.mockData]),(0,r.jsxs)(U,{style:{width:`100%`,height:`100%`,position:`relative`,overflow:`hidden`,backgroundColor:`var(--color-panel-solid)`},children:[e.isList&&(0,r.jsx)(U,{style:{position:`absolute`,bottom:10,right:10,zIndex:100,backgroundColor:`var(--color-surface)`,padding:`4px`,borderRadius:`var(--radius-3)`,boxShadow:`0 2px 10px rgba(0,0,0,0.1)`},children:(0,r.jsxs)(G,{size:`1`,variant:i?`soft`:`solid`,color:i?`red`:`green`,onClick:()=>a(!i),children:[i?(0,r.jsx)(Mt,{}):(0,r.jsx)(ft,{}),i?`Parar Simulação`:`Simular Entrada`]})}),(0,r.jsx)(Xv,{type:`auto`,scrollbars:`vertical`,style:{height:`100%`,width:`100%`},children:(0,r.jsx)(U,{style:{position:`relative`,minHeight:`100%`,width:`100%`},children:(()=>{if(e.elements.length===0)return(0,r.jsx)(W,{align:`center`,justify:`center`,style:{height:`100%`},children:(0,r.jsx)(H,{color:`gray`,children:`Preview vazio`})});if(e.isList){let t=[];if(i)t=o;else{if(t=e.mockData.length>0?e.mockData:Array.from({length:10}).map((e,t)=>({id:t})),e.listSettings.sortProp){let n=e.listSettings.sortProp,r=e.listSettings.sortOrder===`asc`?1:-1;t=[...t].sort((e,t)=>{let i=e[n],a=t[n];return i<a?-1*r:i>a?1*r:0})}e.listSettings.newestPosition===`top`&&(t=[...t].reverse())}let a=e.listSettings.containerHeight;return(0,r.jsx)(U,{style:{width:`100%`,minHeight:a?`${a}px`:`100%`,height:a?`${a}px`:void 0,overflowY:a?`auto`:void 0,display:`flex`,flexDirection:`column`,justifyContent:e.listSettings.newestPosition===`top`?`flex-start`:`flex-end`,padding:16},children:(0,r.jsx)(GD,{mode:`popLayout`,children:t.map((t,i)=>(0,r.jsx)(hN,{item:t,elements:e.elements,animation:e.listSettings.entryAnimation,onSelect:e=>n([e]),selectedElementIds:e.selectedElementIds},t.id||i))})})}return(0,r.jsx)(r.Fragment,{children:e.elements.map(t=>(0,r.jsx)(mN,{element:t,dataContext:e.singleMockData,onSelect:e=>n([e]),isSelected:e.selectedElementIds.includes(t.id)},t.id))})})()})})]})};function _N(){return(_N=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function vN(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}function yN(e){var n=(0,t.useRef)(e),r=(0,t.useRef)(function(e){n.current&&n.current(e)});return n.current=e,r.current}var bN=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},xN=function(e){return`touches`in e},SN=function(e){return e&&e.ownerDocument.defaultView||self},CN=function(e,t,n){var r=e.getBoundingClientRect(),i=xN(t)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].identifier===t)return e[n];return e[0]}(t.touches,n):t;return{left:bN((i.pageX-(r.left+SN(e).pageXOffset))/r.width),top:bN((i.pageY-(r.top+SN(e).pageYOffset))/r.height)}},wN=function(e){!xN(e)&&e.preventDefault()},TN=t.default.memo(function(e){var n=e.onMove,r=e.onKey,i=vN(e,[`onMove`,`onKey`]),a=(0,t.useRef)(null),o=yN(n),s=yN(r),c=(0,t.useRef)(null),l=(0,t.useRef)(!1),u=(0,t.useMemo)(function(){var e=function(e){wN(e),(xN(e)?e.touches.length>0:e.buttons>0)&&a.current?o(CN(a.current,e,c.current)):n(!1)},t=function(){return n(!1)};function n(n){var r=l.current,i=SN(a.current),o=n?i.addEventListener:i.removeEventListener;o(r?`touchmove`:`mousemove`,e),o(r?`touchend`:`mouseup`,t)}return[function(e){var t=e.nativeEvent,r=a.current;if(r&&(wN(t),!function(e,t){return t&&!xN(e)}(t,l.current)&&r)){if(xN(t)){l.current=!0;var i=t.changedTouches||[];i.length&&(c.current=i[0].identifier)}r.focus(),o(CN(r,t,c.current)),n(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),s({left:t===39?.05:t===37?-.05:0,top:t===40?.05:t===38?-.05:0}))},n]},[s,o]),d=u[0],f=u[1],p=u[2];return(0,t.useEffect)(function(){return p},[p]),t.default.createElement(`div`,_N({},i,{onTouchStart:d,onMouseDown:d,className:`react-colorful__interactive`,ref:a,onKeyDown:f,tabIndex:0,role:`slider`}))}),EN=function(e){return e.filter(Boolean).join(` `)},DN=function(e){var n=e.color,r=e.left,i=e.top,a=i===void 0?.5:i,o=EN([`react-colorful__pointer`,e.className]);return t.default.createElement(`div`,{className:o,style:{top:100*a+`%`,left:100*r+`%`}},t.default.createElement(`div`,{className:`react-colorful__pointer-fill`,style:{backgroundColor:n}}))},ON=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n};360/(2*Math.PI);var kN=function(e){return RN(AN(e))},AN=function(e){return e[0]===`#`&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?ON(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:e.length===8?ON(parseInt(e.substring(6,8),16)/255,2):1}},jN=function(e){return LN(FN(e))},MN=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:ON(e.h),s:ON(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:ON(i/2),a:ON(r,2)}},NN=function(e){var t=MN(e);return`hsl(`+t.h+`, `+t.s+`%, `+t.l+`%)`},PN=function(e){var t=MN(e);return`hsla(`+t.h+`, `+t.s+`%, `+t.l+`%, `+t.a+`)`},FN=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:ON(255*[r,s,o,o,c,r][l]),g:ON(255*[c,r,r,s,o,o][l]),b:ON(255*[o,o,c,r,r,s][l]),a:ON(i,2)}},IN=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},LN=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=i<1?IN(ON(255*i)):``;return`#`+IN(t)+IN(n)+IN(r)+a},RN=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:ON(60*(s<0?s+6:s)),s:ON(a?o/a*100:0),v:ON(a/255*100),a:i}},zN=t.default.memo(function(e){var n=e.hue,r=e.onChange,i=EN([`react-colorful__hue`,e.className]);return t.default.createElement(`div`,{className:i},t.default.createElement(TN,{onMove:function(e){r({h:360*e.left})},onKey:function(e){r({h:bN(n+360*e.left,0,360)})},"aria-label":`Hue`,"aria-valuenow":ON(n),"aria-valuemax":`360`,"aria-valuemin":`0`},t.default.createElement(DN,{className:`react-colorful__hue-pointer`,left:n/360,color:NN({h:n,s:100,v:100,a:1})})))}),BN=t.default.memo(function(e){var n=e.hsva,r=e.onChange,i={backgroundColor:NN({h:n.h,s:100,v:100,a:1})};return t.default.createElement(`div`,{className:`react-colorful__saturation`,style:i},t.default.createElement(TN,{onMove:function(e){r({s:100*e.left,v:100-100*e.top})},onKey:function(e){r({s:bN(n.s+100*e.left,0,100),v:bN(n.v-100*e.top,0,100)})},"aria-label":`Color`,"aria-valuetext":`Saturation `+ON(n.s)+`%, Brightness `+ON(n.v)+`%`},t.default.createElement(DN,{className:`react-colorful__saturation-pointer`,top:1-n.v/100,left:n.s/100,color:NN(n)})))}),VN=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},HN=function(e,t){return e.toLowerCase()===t.toLowerCase()||VN(AN(e),AN(t))};function UN(e,n,r){var i=yN(r),a=(0,t.useState)(function(){return e.toHsva(n)}),o=a[0],s=a[1],c=(0,t.useRef)({color:n,hsva:o});return(0,t.useEffect)(function(){if(!e.equal(n,c.current.color)){var t=e.toHsva(n);c.current={hsva:t,color:n},s(t)}},[n,e]),(0,t.useEffect)(function(){var t;VN(o,c.current.hsva)||e.equal(t=e.fromHsva(o),c.current.color)||(c.current={hsva:o,color:t},i(t))},[o,e,i]),[o,(0,t.useCallback)(function(e){s(function(t){return Object.assign({},t,e)})},[])]}var WN,GN=typeof window<`u`?t.useLayoutEffect:t.useEffect,KN=function(){return WN||(typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0)},qN=new Map,JN=function(e){GN(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!qN.has(t)){var n=t.createElement(`style`);n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,qN.set(t,n);var r=KN();r&&n.setAttribute(`nonce`,r),t.head.appendChild(n)}},[])},YN=function(e){var n=e.className,r=e.hsva,i=e.onChange,a={backgroundImage:`linear-gradient(90deg, `+PN(Object.assign({},r,{a:0}))+`, `+PN(Object.assign({},r,{a:1}))+`)`},o=EN([`react-colorful__alpha`,n]),s=ON(100*r.a);return t.default.createElement(`div`,{className:o},t.default.createElement(`div`,{className:`react-colorful__alpha-gradient`,style:a}),t.default.createElement(TN,{onMove:function(e){i({a:e.left})},onKey:function(e){i({a:bN(r.a+e.left)})},"aria-label":`Alpha`,"aria-valuetext":s+`%`,"aria-valuenow":s,"aria-valuemin":`0`,"aria-valuemax":`100`},t.default.createElement(DN,{className:`react-colorful__alpha-pointer`,left:r.a,color:PN(r)})))},XN=function(e){var n=e.className,r=e.colorModel,i=e.color,a=i===void 0?r.defaultColor:i,o=e.onChange,s=vN(e,[`className`,`colorModel`,`color`,`onChange`]),c=(0,t.useRef)(null);JN(c);var l=UN(r,a,o),u=l[0],d=l[1],f=EN([`react-colorful`,n]);return t.default.createElement(`div`,_N({},s,{ref:c,className:f}),t.default.createElement(BN,{hsva:u,onChange:d}),t.default.createElement(zN,{hue:u.h,onChange:d}),t.default.createElement(YN,{hsva:u,onChange:d,className:`react-colorful__last-control`}))},ZN={defaultColor:`0001`,toHsva:kN,fromHsva:jN,equal:HN},QN=function(e){return t.default.createElement(XN,_N({},e,{colorModel:ZN}))},$N={black:`#000000`,white:`#ffffff`,red:`#ff0000`,green:`#008000`,blue:`#0000ff`,yellow:`#ffff00`,cyan:`#00ffff`,magenta:`#ff00ff`,gray:`#808080`,grey:`#808080`,silver:`#c0c0c0`,maroon:`#800000`,olive:`#808000`,purple:`#800080`,teal:`#008080`,navy:`#000080`,orange:`#ffa500`,transparent:`#00000000`};let eP=e=>{if(!e)return`#000000`;let t=e.trim().toLowerCase();if(t.startsWith(`#`))return t.length===4?`#`+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:t.length===5?`#`+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4]:t;if($N[t])return $N[t];let n=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)$/);if(n){let e=parseInt(n[1]),t=parseInt(n[2]),r=parseInt(n[3]),i=n[4]?parseFloat(n[4]):1,a=e=>{let t=Math.round(e).toString(16);return t.length===1?`0`+t:t},o=Math.round(i*255);return`#${a(e)}${a(t)}${a(r)}${a(o)}`}return`#000000`},tP=({color:e,onChange:t})=>{let n=(e=>eP(e))(e);return(0,r.jsxs)(W,{direction:`column`,gap:`3`,style:{width:`100%`},children:[(0,r.jsx)(QN,{color:n,onChange:t,style:{width:`100%`}}),(0,r.jsxs)(W,{gap:`2`,align:`center`,children:[(0,r.jsx)(U,{style:{width:32,height:32,backgroundColor:n,borderRadius:4,border:`1px solid var(--gray-5)`,flexShrink:0}}),(0,r.jsx)(X,{value:e,onChange:e=>t(e.target.value),onBlur:()=>{e&&/^[0-9A-Fa-f]{3,8}$/.test(e)&&t(`#`+e)},placeholder:`#RRGGBBAA`,style:{flexGrow:1}})]})]})},nP=({color:e,onChange:t,label:n})=>(0,r.jsxs)(Ay,{children:[(0,r.jsx)(jy,{children:(0,r.jsxs)(G,{variant:`surface`,color:`gray`,style:{width:`100%`,justifyContent:`flex-start`,padding:`0 8px`,height:32},children:[(0,r.jsx)(U,{style:{width:18,height:18,backgroundColor:e||`transparent`,borderRadius:2,border:`1px solid var(--gray-8)`,marginRight:8,backgroundImage:e===`transparent`?`linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)`:`none`,backgroundSize:`8px 8px`,backgroundPosition:`0 0, 0 4px, 4px -4px, -4px 0px`}}),(0,r.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n||e||`Transparente`})]})}),(0,r.jsx)(My,{style:{width:240},children:(0,r.jsx)(tP,{color:e,onChange:t})})]}),rP=({elementId:e})=>{let{state:t,updateElement:n}=rS(),i=t.elements.find(t=>t.id===e);return i?(0,r.jsx)(U,{pt:`2`,children:(0,r.jsxs)(sb,{defaultValue:`formatting`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`formatting`,style:{flex:1},children:`Formatação`}),(0,r.jsx)(lb,{value:`style`,style:{flex:1},children:`Estilo`}),(0,r.jsx)(lb,{value:`bindings`,style:{flex:1},children:`Vínculos`}),(0,r.jsx)(lb,{value:`conditional`,style:{flex:1},children:`Regras`}),(0,r.jsx)(lb,{value:`animation`,style:{flex:1},children:`Anim`})]}),(0,r.jsxs)(U,{pt:`3`,children:[(0,r.jsx)(ub,{value:`formatting`,children:(0,r.jsx)(aP,{element:i,updateElement:n})}),(0,r.jsx)(ub,{value:`style`,children:(0,r.jsx)(oP,{element:i,updateElement:n})}),(0,r.jsx)(ub,{value:`bindings`,children:(0,r.jsx)(mP,{element:i,updateElement:n,availableProps:t.availableProps||[]})}),(0,r.jsx)(ub,{value:`conditional`,children:(0,r.jsx)(hP,{element:i,updateElement:n,availableProps:t.availableProps||[]})}),(0,r.jsx)(ub,{value:`animation`,children:(0,r.jsx)(iP,{element:i,updateElement:n})})]})]})}):null},iP=({element:e,updateElement:t})=>{let n=e.animation||{type:`none`,duration:1,delay:0},i=r=>{t(e.id,{animation:{...n,...r}})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Tipo de Animação`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[n.type===`none`?`Nenhuma`:n.type===`slideIn`?`Slide In (Padrão)`:n.type===`fadeIn`?`Fade In`:n.type===`smoothSlideUp`?`Slide Suave (Up)`:n.type===`popIn`?`Pop In`:n.type===`blurIn`?`Blur In`:n.type===`slideInLeft`?`Slide In (Esquerda)`:n.type===`slideInRight`?`Slide In (Direita)`:n.type===`slideInUp`?`Slide In (Cima)`:n.type===`slideInDown`?`Slide In (Baixo)`:n.type===`zoomIn`?`Zoom In`:n.type===`bounceIn`?`Bounce In`:n.type===`pulse`?`Pulse (Atenção)`:n.type===`shake`?`Shake (Atenção)`:`Spin (Loop)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>i({type:`none`}),children:`Nenhuma`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideIn`}),children:`Slide In (Padrão)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`fadeIn`}),children:`Fade In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`smoothSlideUp`}),children:`Slide Suave (Up)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`popIn`}),children:`Pop In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`blurIn`}),children:`Blur In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInLeft`}),children:`Slide In (Esquerda)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInRight`}),children:`Slide In (Direita)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInUp`}),children:`Slide In (Cima)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInDown`}),children:`Slide In (Baixo)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`zoomIn`}),children:`Zoom In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`bounceIn`}),children:`Bounce In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`pulse`}),children:`Pulse (Atenção)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`shake`}),children:`Shake (Atenção)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`spin`}),children:`Spin (Loop)`})]})]})]}),n.type!==`none`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Duração (s)`}),(0,r.jsx)(X,{type:`number`,step:`0.1`,min:`0.1`,value:n.duration,onChange:e=>i({duration:parseFloat(e.target.value)||.5})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Atraso (s)`}),(0,r.jsx)(X,{type:`number`,step:`0.1`,min:`0`,value:n.delay,onChange:e=>i({delay:parseFloat(e.target.value)||0})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Curva de Tempo`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(n.timingFunction||`ease`)===`linear`?`Linear`:(n.timingFunction||`ease`)===`ease-in`?`Ease In`:(n.timingFunction||`ease`)===`ease-out`?`Ease Out`:(n.timingFunction||`ease`)===`ease-in-out`?`Ease In Out`:(n.timingFunction||`ease`)===`bounce`?`Bounce`:`Ease`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`linear`}),children:`Linear`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease`}),children:`Ease`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease-in`}),children:`Ease In`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease-out`}),children:`Ease Out`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease-in-out`}),children:`Ease In Out`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`bounce`}),children:`Bounce`})]})]})]}),[`pulse`,`shake`,`spin`].includes(n.type)&&(0,r.jsx)(U,{children:(0,r.jsxs)(W,{align:`center`,gap:`2`,mt:`2`,children:[(0,r.jsx)(ib,{checked:n.iterationCount===`infinite`,onCheckedChange:e=>i({iterationCount:e?`infinite`:1})}),(0,r.jsx)(H,{size:`2`,children:`Repetir Infinitamente`})]})})]})]})},aP=({element:e,updateElement:t})=>{let n=e.formatting||{type:`text`},i=r=>{t(e.id,{formatting:{...n,...r}})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(e.type===`text`||e.type===`text-container`)&&(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{align:`center`,gap:`2`,mb:`3`,children:[(0,r.jsx)(ib,{checked:e.autoGrow||!1,onCheckedChange:n=>t(e.id,{autoGrow:n})}),(0,r.jsx)(H,{size:`2`,children:e.type===`text-container`?`Expandir container automaticamente`:`Expandir altura automaticamente`})]}),e.type===`text-container`&&e.autoGrow&&(0,r.jsxs)(U,{mb:`3`,ml:`4`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Direção de Expansão`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(e.containerExpansion||`vertical`)===`vertical`?`Vertical (Altura Cresce)`:`Horizontal (Largura Cresce)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>t(e.id,{containerExpansion:`vertical`}),children:`Vertical (Altura Cresce)`}),(0,r.jsx)(q,{onSelect:()=>t(e.id,{containerExpansion:`horizontal`}),children:`Horizontal (Largura Cresce)`})]})]})]}),(0,r.jsx)(Qy,{size:`4`,mb:`2`})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Tipo de Formatação`}),(0,r.jsxs)(Wy,{value:n.type,onValueChange:e=>i({type:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`text`,children:`Texto (Padrão)`}),(0,r.jsx)(Y,{value:`boolean`,children:`Booleano (Sim/Não)`}),(0,r.jsx)(Y,{value:`date`,children:`Data`}),(0,r.jsx)(Y,{value:`number`,children:`Número / Moeda`})]})]})]}),n.type===`boolean`&&(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Texto para Verdadeiro`}),(0,r.jsx)(X,{placeholder:`Ex: Sim`,value:n.trueLabel||``,onChange:e=>i({trueLabel:e.target.value})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Texto para Falso`}),(0,r.jsx)(X,{placeholder:`Ex: Não`,value:n.falseLabel||``,onChange:e=>i({falseLabel:e.target.value})})]})]}),n.type===`date`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Formato da Data`}),(0,r.jsx)(X,{placeholder:`Ex: DD/MM/YYYY`,value:n.dateFormat||``,onChange:e=>i({dateFormat:e.target.value})}),(0,r.jsx)(H,{size:`1`,color:`gray`,mt:`1`,style:{fontSize:10},children:`Use DD, MM, YYYY, HH, mm, ss.`})]}),n.type===`number`&&(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Estilo`}),(0,r.jsxs)(Wy,{value:n.numberFormat||`decimal`,onValueChange:e=>i({numberFormat:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`decimal`,children:`Decimal`}),(0,r.jsx)(Y,{value:`currency`,children:`Moeda`}),(0,r.jsx)(Y,{value:`percent`,children:`Porcentagem`})]})]})]}),n.numberFormat===`currency`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Símbolo da Moeda`}),(0,r.jsx)(X,{placeholder:`Ex: R$`,value:n.currencySymbol||``,onChange:e=>i({currencySymbol:e.target.value})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Casas Decimais`}),(0,r.jsx)(X,{type:`number`,placeholder:`2`,value:n.decimalPlaces===void 0?``:n.decimalPlaces,onChange:e=>i({decimalPlaces:parseInt(e.target.value)||0})})]})]})]})},oP=({element:e,updateElement:n})=>{let i=e.style||{},[a,o]=(0,t.useState)(i.borderTopLeftRadius!==void 0||i.borderTopRightRadius!==void 0||i.borderBottomRightRadius!==void 0||i.borderBottomLeftRadius!==void 0),s=t=>{n(e.id,{style:{...i,...t}})},c=(e,t)=>{let n=typeof e==`number`?e:parseInt(e)||0;s({[t]:`${n}px`})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{align:`center`,justify:`between`,mb:`2`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Arredondamento`}),(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(H,{size:`1`,children:`Individual`}),(0,r.jsx)(ib,{checked:a,onCheckedChange:e=>{if(o(e),!e)s({borderRadius:i.borderTopLeftRadius||i.borderRadius||0,borderTopLeftRadius:void 0,borderTopRightRadius:void 0,borderBottomRightRadius:void 0,borderBottomLeftRadius:void 0});else{let e=i.borderRadius||0;s({borderRadius:void 0,borderTopLeftRadius:e,borderTopRightRadius:e,borderBottomRightRadius:e,borderBottomLeftRadius:e})}}})]})]}),a?(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Sup. Esq.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderTopLeftRadius)||0,onChange:e=>c(e.target.value,`borderTopLeftRadius`)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Sup. Dir.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderTopRightRadius)||0,onChange:e=>c(e.target.value,`borderTopRightRadius`)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Inf. Esq.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderBottomLeftRadius)||0,onChange:e=>c(e.target.value,`borderBottomLeftRadius`)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Inf. Dir.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderBottomRightRadius)||0,onChange:e=>c(e.target.value,`borderBottomRightRadius`)})]})]}):(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Raio (Todos os cantos)`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderRadius)||0,onChange:e=>s({borderRadius:`${parseInt(e.target.value)||0}px`})})]})]}),(0,r.jsx)(Qy,{size:`4`,my:`2`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,children:`Espaçamento Interno`}),(0,r.jsx)(K,{columns:`2`,gap:`3`,children:(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Tamanho (px)`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.padding)||0,onChange:e=>s({padding:`${parseInt(e.target.value)||0}px`})})]})})]}),(0,r.jsx)(Qy,{size:`4`,my:`2`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,children:`Sombra (Box Shadow)`}),(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Cor`}),(0,r.jsx)(nP,{color:sP(i.boxShadow),onChange:e=>s({boxShadow:uP(i.boxShadow,e)})})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Blur (px)`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:cP(i.boxShadow),onChange:e=>s({boxShadow:dP(i.boxShadow,parseInt(e.target.value)||0)})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Spread (px)`}),(0,r.jsx)(X,{type:`number`,value:lP(i.boxShadow),onChange:e=>s({boxShadow:fP(i.boxShadow,parseInt(e.target.value)||0)})})]})]}),(0,r.jsx)(G,{variant:`soft`,color:`gray`,size:`1`,onClick:()=>s({boxShadow:i.boxShadow?void 0:`0 4px 12px 0 rgba(0,0,0,0.15)`}),children:i.boxShadow?`Remover Sombra`:`Adicionar Sombra`})]})]})]})};var sP=e=>{if(!e||e===`none`)return`#0000001a`;let t=e.match(/(?:rgba?\([^)]+\)|#[0-9a-fA-F]{3,8}|[a-zA-Z]+)\s*$/);return t?t[0].trim():`#0000001a`},cP=e=>{if(!e||e===`none`)return 12;let t=e.match(/(-?\d+(?:\.\d+)?)(?:px)?/g);return t&&t.length>=3?parseFloat(t[2]):12},lP=e=>{if(!e||e===`none`)return 0;let t=e.match(/(-?\d+(?:\.\d+)?)(?:px)?/g);return t&&t.length>=4?parseFloat(t[3]):0},uP=(e,t)=>{let n=cP(e),r=lP(e);return`${e?.includes(`inset`)?`inset `:``}0px 4px ${n}px ${r}px ${t}`},dP=(e,t)=>{let n=(e||`0 4px 12px 0 #0000001a`).match(/(-?\d+(?:\.\d+)?)(?:px)?/g)||[`0`,`4`,`12`,`0`],r=sP(e);return`${e?.includes(`inset`)?`inset `:``}${n[0]||0}px ${n[1]||4}px ${t}px ${n[3]||0}px ${r}`},fP=(e,t)=>{let n=(e||`0 4px 12px 0 #0000001a`).match(/(-?\d+(?:\.\d+)?)(?:px)?/g)||[`0`,`4`,`12`,`0`],r=sP(e);return`${e?.includes(`inset`)?`inset `:``}${n[0]||0}px ${n[1]||4}px ${n[2]||12}px ${t}px ${r}`},pP=[{key:`color`,label:`Cor do texto`},{key:`backgroundColor`,label:`Cor de fundo`},{key:`borderColor`,label:`Cor da borda`},{key:`boxShadowColor`,label:`Cor da sombra`}];let mP=({element:e,updateElement:t,availableProps:n})=>{let i=e.styleBindings||{},a=(n,r)=>{let a={...i};r?a[n]=r:delete a[n],t(e.id,{styleBindings:Object.keys(a).length>0?a:void 0})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Vínculos de Estilo (Data Binding)`}),(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`2`,children:`Vincule propriedades de estilo a variáveis de dados. O valor da variável será aplicado em tempo real (ex.: cores em formato #RRGGBB, rgba(), etc.).`}),pP.map(({key:e,label:t})=>(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:t}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`},children:[i[e]?n.find(t=>t.dataName===i[e])?.name||i[e]:`Nenhum`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>a(e,null),children:`Nenhum`}),n.map(t=>(0,r.jsx)(q,{onSelect:()=>a(e,t.dataName),children:t.name},t.dataName)),n.length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhuma variável disponível`})]})]})]},e))]})},hP=({element:e,updateElement:t,availableProps:n})=>{let i=e.conditions||[],a=()=>{let r={id:crypto.randomUUID(),property:n.length>0?n[0].dataName:``,operator:`equals`,value:``,style:{color:`#ff0000`}};t(e.id,{conditions:[...i,r]})},o=n=>{t(e.id,{conditions:i.filter(e=>e.id!==n)})},s=(n,r)=>{t(e.id,{conditions:i.map(e=>e.id===n?{...e,...r}:e)})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsx)(H,{size:`2`,color:`gray`,children:`Regras de Exibição`}),(0,r.jsxs)(G,{size:`1`,variant:`soft`,onClick:a,children:[(0,r.jsx)(mt,{}),` Nova Regra`]})]}),i.length===0?(0,r.jsx)(H,{size:`1`,color:`gray`,style:{fontStyle:`italic`},children:`Nenhuma regra condicional definida.`}):(0,r.jsx)(W,{direction:`column`,gap:`2`,children:i.map(e=>(0,r.jsxs)(U,{style:{border:`1px solid var(--gray-6)`,borderRadius:4,padding:8},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,mb:`2`,children:[(0,r.jsxs)(H,{size:`1`,weight:`bold`,children:[`Se `,e.property,`...`]}),(0,r.jsx)(J,{size:`1`,color:`red`,variant:`ghost`,onClick:()=>o(e.id),children:(0,r.jsx)(Xt,{})})]}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,mb:`2`,children:[(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`},children:[n.find(t=>t.dataName===e.property)?.name||e.property||`Propriedade`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[n.map(t=>(0,r.jsx)(q,{onSelect:()=>s(e.id,{property:t.dataName}),children:t.name},t.dataName)),n.length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhuma variável disponível`})]})]}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`},children:[e.operator===`equals`?`Igual a`:e.operator===`notEquals`?`Diferente de`:e.operator===`contains`?`Contém`:e.operator===`greaterThan`?`Maior que`:`Menor que`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`equals`}),children:`Igual a`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`notEquals`}),children:`Diferente de`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`contains`}),children:`Contém`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`greaterThan`}),children:`Maior que`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`lessThan`}),children:`Menor que`})]})]})]}),(0,r.jsx)(X,{size:`1`,placeholder:`Valor`,value:e.value,onChange:t=>s(e.id,{value:t.target.value})}),(0,r.jsxs)(U,{mt:`2`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor quando verdadeiro`}),(0,r.jsx)(nP,{color:e.style?.color||`#ff0000`,onChange:t=>s(e.id,{style:{...e.style,color:t}})})]})]},e.id))})]})};var gP=({title:e,isOpen:t,onToggle:n,children:i,onReset:a})=>(0,r.jsxs)(U,{style:{borderBottom:`1px solid var(--gray-4)`},children:[(0,r.jsxs)(W,{align:`center`,style:{width:`100%`},children:[(0,r.jsxs)(G,{variant:`ghost`,onClick:n,style:{flex:1,justifyContent:`space-between`,padding:`12px 8px`,borderRadius:0,height:`auto`,cursor:`pointer`,color:`var(--gray-12)`},children:[(0,r.jsx)(H,{weight:`bold`,size:`2`,children:e}),t?(0,r.jsx)(fe,{}):(0,r.jsx)(me,{})]}),a&&t&&(0,r.jsx)(bb,{content:`Resetar para padrão`,children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:e=>{e.stopPropagation(),a()},style:{marginRight:8},children:(0,r.jsx)(vt,{})})})]}),t&&(0,r.jsx)(U,{p:`3`,style:{backgroundColor:`var(--gray-2)`},children:i})]}),_P=({value:e,onChange:n,units:i=[`px`,`%`,`em`,`rem`,`vw`,`vh`],min:a,max:o,placeholder:s,label:c})=>{let l=e=>{if(e==null||e===``)return{num:``,unit:i[0]};let t=String(e).match(/^(-?[\d.]+)([a-z%]+)?$/i);return t?{num:t[1],unit:t[2]||i[0]}:{num:``,unit:i[0]}},[u,d]=(0,t.useState)(l(e));(0,t.useEffect)(()=>{d(l(e))},[e]);let f=(e,t)=>{if(e===``){n(``);return}n(`${e}${t}`)};return(0,r.jsxs)(U,{children:[c&&(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:c}),(0,r.jsxs)(W,{children:[(0,r.jsx)(X,{type:`number`,value:u.num,onChange:e=>{let t=e.target.value;d({...u,num:t}),f(t,u.unit)},placeholder:s,style:{borderTopRightRadius:0,borderBottomRightRadius:0,flex:1},min:a,max:o}),(0,r.jsxs)(Wy,{value:u.unit,onValueChange:e=>{d({...u,unit:e}),f(u.num,e)},children:[(0,r.jsx)(Gy,{style:{width:60,borderTopLeftRadius:0,borderBottomLeftRadius:0,marginLeft:-1}}),(0,r.jsx)(Ky,{children:i.map(e=>(0,r.jsx)(Y,{value:e,children:e},e))})]})]})]})},vP=({values:e,onChange:n,label:i})=>{let[a,o]=(0,t.useState)(!0),s=e=>{n({top:e,right:e,bottom:e,left:e})},c=(t,r)=>{n({...e,[t]:r})};return(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,mb:`1`,children:[i&&(0,r.jsx)(H,{size:`1`,color:`gray`,children:i}),(0,r.jsx)(bb,{content:a?`Desvincular lados`:`Vincular lados`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:a?`blue`:`gray`,onClick:()=>o(!a),children:a?(0,r.jsx)(yP,{}):(0,r.jsx)(bP,{})})})]}),a?(0,r.jsx)(_P,{value:e.top||``,onChange:s,placeholder:`Todos`}):(0,r.jsxs)(K,{columns:`2`,gap:`2`,children:[(0,r.jsx)(_P,{value:e.top,onChange:e=>c(`top`,e),label:`Top`}),(0,r.jsx)(_P,{value:e.right,onChange:e=>c(`right`,e),label:`Right`}),(0,r.jsx)(_P,{value:e.bottom,onChange:e=>c(`bottom`,e),label:`Bottom`}),(0,r.jsx)(_P,{value:e.left,onChange:e=>c(`left`,e),label:`Left`})]})]})},yP=()=>(0,r.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,r.jsx)(`path`,{d:`M4.5 6.5L1.35355 9.64645C0.908293 10.0917 0.908293 10.8134 1.35355 11.2587L3.74132 13.6464C4.18658 14.0917 4.90829 14.0917 5.35355 13.6464L8.5 10.5M10.5 8.5L13.6464 5.35355C14.0917 4.90829 14.0917 4.18658 13.6464 3.74132L11.2587 1.35355C10.8134 0.908293 10.0917 0.908293 9.64645 1.35355L6.5 4.5M6.5 8.5H8.5`,stroke:`currentColor`})}),bP=()=>(0,r.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,r.jsx)(`path`,{d:`M4.5 6.5L1.35355 9.64645C0.908293 10.0917 0.908293 10.8134 1.35355 11.2587L3.74132 13.6464C4.18658 14.0917 4.90829 14.0917 5.35355 13.6464L8.5 10.5M10.5 8.5L13.6464 5.35355C14.0917 4.90829 14.0917 4.18658 13.6464 3.74132L11.2587 1.35355C10.8134 0.908293 10.0917 0.908293 9.64645 1.35355L6.5 4.5`,stroke:`currentColor`})});let xP=()=>{let{state:e,setPropertiesPanelOpen:n,updateElement:i,updateElements:a,removeSelected:o,copy:s,paste:c,addElement:l}=rS(),{isPropertiesPanelOpen:u,selectedElementIds:d,elements:f}=e,p=(0,t.useMemo)(()=>f.filter(e=>d.includes(e.id)),[f,d]),m=p[0],h=p.length>1,[g,_]=(0,t.useState)({content:!0,layout:!0,typography:!0,appearance:!1,borders:!1,effects:!1,transform:!1,animation:!1,conditions:!1,formatting:!1,spacing:!1}),[v,y]=(0,t.useState)(``),[b,x]=(0,t.useState)({});(0,t.useEffect)(()=>{let e=localStorage.getItem(`editor-presets`);if(e)try{x(JSON.parse(e))}catch(e){console.error(`Failed to load presets`,e)}},[]);let S=e=>{if(!m)return;let t={...b,[e]:{style:m.style}};x(t),localStorage.setItem(`editor-presets`,JSON.stringify(t))},C=e=>{let t=b[e];t&&t.style&&D(t.style)};if(!u||!m)return null;let w=e=>{_(t=>({...t,[e]:!t[e]}))},T=e=>{h?a(d.map(t=>({id:t,changes:e}))):i(m.id,e)},E=()=>{if(h)s(),c();else{let{id:e,...t}=m;l({...t,x:m.x+20,y:m.y+20})}},D=e=>{h?a(p.map(t=>({id:t.id,changes:{style:{...t.style,...e}}}))):i(m.id,{style:{...m.style,...e}})},O=e=>{let t={};e.forEach(e=>t[e]=void 0),D(t)},k=(e,t)=>{if(!v)return!0;let n=v.toLowerCase();return e.toLowerCase().includes(n)||t.some(e=>e.toLowerCase().includes(n))},A=e=>{if(!h)return e(m);let t=e(m);return p.every(n=>e(n)===t)?t:`Mixed`},j=(e,t=``)=>{let n=A(t=>t.style?.[e]);return n===`Mixed`?`Mixed`:n===void 0?t:n},M=String(j(`fontFamily`,`Arial`)),N=AS(M,e.availableFonts||[`Arial`]),P=()=>{let e=j(`fontWeight`,`normal`);return e===`Mixed`?`400`:kS(e,OS)},F=e=>{let t={x:0,y:4,blur:12,spread:0,color:`#0000001a`,inset:!1};if(!e||e===`none`)return t;let n=e.trim(),r=n.includes(`inset`),i=n.replace(`inset`,``).trim(),a=i.match(/(-?\d+(?:\.\d+)?)(?:px)?\s+(-?\d+(?:\.\d+)?)(?:px)?(?:\s+(\d+(?:\.\d+)?)(?:px)?)?(?:\s+(\d+(?:\.\d+)?)(?:px)?)?/);return a?{x:parseFloat(a[1]),y:parseFloat(a[2]),blur:a[3]?parseFloat(a[3]):0,spread:a[4]?parseFloat(a[4]):0,color:i.replace(a[0],``).trim()||t.color,inset:r}:t},I=F(m.style?.boxShadow),re=e=>{let t={...I,...e};D({boxShadow:`${t.inset?`inset `:``}${t.x}px ${t.y}px ${t.blur}px ${t.spread}px ${t.color}`})};return(0,r.jsx)(ny,{open:u,onOpenChange:n,children:(0,r.jsxs)(iy,{style:{maxWidth:500,width:`100%`,maxHeight:`85vh`,height:`100%`,padding:0,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,r.jsxs)(U,{style:{borderBottom:`1px solid var(--gray-4)`},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,p:`4`,pb:`2`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(ay,{style:{margin:0},children:`Propriedades`}),(0,r.jsx)(oy,{size:`1`,color:`gray`,children:h?`${p.length} selecionados`:m.name||`Elemento`})]}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,children:(0,r.jsx)(ee,{})})}),(0,r.jsxs)(fy,{children:[(0,r.jsx)(py,{children:`Presets`}),Object.keys(b).length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhum preset salvo`}),Object.keys(b).map(e=>(0,r.jsx)(q,{onSelect:t=>{t.preventDefault(),C(e)},onClick:()=>C(e),style:{cursor:`pointer`},children:e},e)),(0,r.jsx)(xy,{}),(0,r.jsxs)(q,{onSelect:e=>{e.preventDefault();let t=prompt(`Nome do novo preset:`);t&&S(t)},children:[(0,r.jsx)(mt,{style:{marginRight:8}}),` Salvar Atual`]})]})]}),(0,r.jsx)(sy,{children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,children:(0,r.jsx)(Ee,{})})})]})]}),(0,r.jsxs)(W,{gap:`2`,px:`4`,pb:`3`,children:[(0,r.jsx)(bb,{content:`Bloquear`,children:(0,r.jsx)(J,{variant:`soft`,color:m.locked?`orange`:`gray`,onClick:()=>T({locked:!m.locked}),children:m.locked?(0,r.jsx)(et,{}):(0,r.jsx)(nt,{})})}),(0,r.jsx)(bb,{content:`Ocultar`,children:(0,r.jsx)(J,{variant:`soft`,color:m.hidden?`blue`:`gray`,onClick:()=>T({hidden:!m.hidden}),children:m.hidden?(0,r.jsx)(Be,{}):(0,r.jsx)(He,{})})}),(0,r.jsx)(bb,{content:`Duplicar`,children:(0,r.jsx)(J,{variant:`soft`,color:`gray`,onClick:E,children:(0,r.jsx)(we,{})})}),(0,r.jsx)(U,{style:{flex:1}}),(0,r.jsx)(bb,{content:`Excluir`,children:(0,r.jsx)(J,{variant:`soft`,color:`red`,onClick:()=>{o(),n(!1)},children:(0,r.jsx)(Xt,{})})})]})]}),(0,r.jsx)(U,{p:`3`,style:{borderBottom:`1px solid var(--gray-4)`,backgroundColor:`var(--gray-1)`},children:(0,r.jsx)(X,{placeholder:`Buscar...`,value:v,onChange:e=>y(e.target.value),children:(0,r.jsx)(_b,{children:(0,r.jsx)(ot,{height:`16`,width:`16`})})})}),(0,r.jsxs)(U,{style:{flex:1,overflowY:`auto`,overflowX:`hidden`},children:[k(`Conteúdo`,[`text`,`image`,`url`,`value`,`content`])&&(m.type===`text`||m.type===`text-container`||m.type===`image`)&&(0,r.jsx)(gP,{title:`Conteúdo`,isOpen:g.content,onToggle:()=>w(`content`),children:(0,r.jsxs)(U,{children:[(m.type===`text`||m.type===`text-container`)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Texto`}),(0,r.jsx)(pb,{value:m.content||``,onChange:e=>T({content:e.target.value}),rows:4,placeholder:`Texto ou {{variavel}}...`})]}),m.type===`image`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Vínculo de Propriedade`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`,marginBottom:8},children:[m.dataBinding?e.availableProps.find(e=>e.dataName===m.dataBinding)?.name||m.dataBinding:`Nenhum (URL fixa)`,(0,r.jsx)(fe,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>T({dataBinding:void 0}),children:`Nenhum (URL fixa)`}),(e.availableProps||[]).map(e=>(0,r.jsx)(q,{onSelect:()=>T({dataBinding:e.dataName,content:`{{${e.dataName}}}`}),children:e.name},e.dataName))]})]}),(0,r.jsxs)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:[`URL ou `,`{{variável}}`]}),(0,r.jsx)(X,{value:m.content||``,onChange:e=>T({content:e.target.value}),placeholder:`https://... ou {{profilePicture}}`})]})]})}),k(`Tipografia`,[`font`,`text`,`color`,`align`,`size`,`weight`,`transform`,`decoration`])&&(0,r.jsx)(gP,{title:`Tipografia`,isOpen:g.typography,onToggle:()=>w(`typography`),onReset:()=>O([`fontFamily`,`fontSize`,`fontWeight`,`color`,`textAlign`,`fontStyle`,`textDecoration`,`textTransform`,`lineHeight`,`letterSpacing`]),children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Família da Fonte`}),(0,r.jsxs)(Wy,{value:M,onValueChange:e=>D({fontFamily:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`},placeholder:`Selecione...`}),(0,r.jsx)(Ky,{style:{zIndex:1e5},children:N.map(e=>(0,r.jsx)(Y,{value:e,children:e},e))})]})]}),(0,r.jsx)(_P,{label:`Tamanho`,value:j(`fontSize`,`16px`),onChange:e=>D({fontSize:e})}),(0,r.jsx)(_P,{label:`Altura da Linha`,value:j(`lineHeight`,`normal`),onChange:e=>D({lineHeight:e}),units:[``,`px`,`em`,`%`],placeholder:`Normal`}),(0,r.jsx)(_P,{label:`Espaçamento`,value:j(`letterSpacing`,`normal`),onChange:e=>D({letterSpacing:e}),units:[`px`,`em`],placeholder:`Normal`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Peso`}),(0,r.jsxs)(Wy,{value:P(),onValueChange:e=>D({fontWeight:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`},placeholder:`Normal`}),(0,r.jsxs)(Ky,{style:{zIndex:1e5},children:[(0,r.jsx)(Y,{value:`100`,children:`100 - Thin`}),(0,r.jsx)(Y,{value:`300`,children:`300 - Light`}),(0,r.jsx)(Y,{value:`400`,children:`400 - Normal`}),(0,r.jsx)(Y,{value:`500`,children:`500 - Medium`}),(0,r.jsx)(Y,{value:`600`,children:`600 - Semi Bold`}),(0,r.jsx)(Y,{value:`700`,children:`700 - Bold`}),(0,r.jsx)(Y,{value:`900`,children:`900 - Black`}),(0,r.jsx)(Y,{value:`normal`,children:`Normal`}),(0,r.jsx)(Y,{value:`bold`,children:`Bold`})]})]})]}),(0,r.jsx)(U,{style:{gridColumn:`span 2`},children:(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Estilo`}),(0,r.jsxs)(W,{gap:`1`,children:[(0,r.jsx)(J,{variant:j(`fontStyle`)===`italic`?`solid`:`soft`,onClick:()=>D({fontStyle:j(`fontStyle`)===`italic`?`normal`:`italic`}),children:(0,r.jsx)(Ke,{})}),(0,r.jsx)(J,{variant:j(`textDecoration`)===`underline`?`solid`:`soft`,onClick:()=>D({textDecoration:j(`textDecoration`)===`underline`?`none`:`underline`}),children:(0,r.jsx)(Qt,{})}),(0,r.jsx)(J,{variant:j(`textDecoration`)===`line-through`?`solid`:`soft`,onClick:()=>D({textDecoration:j(`textDecoration`)===`line-through`?`none`:`line-through`}),children:(0,r.jsx)(Pt,{})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Transformação`}),(0,r.jsxs)(Wy,{value:j(`textTransform`,`none`),onValueChange:e=>D({textTransform:e}),children:[(0,r.jsx)(Gy,{style:{width:100}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`none`,children:`Nenhum`}),(0,r.jsx)(Y,{value:`uppercase`,children:`MAIÚSCULA`}),(0,r.jsx)(Y,{value:`lowercase`,children:`minúscula`}),(0,r.jsx)(Y,{value:`capitalize`,children:`Capitalizada`})]})]})]})]})}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Alinhamento`}),(0,r.jsxs)(Ly,{value:j(`textAlign`,`left`),onValueChange:e=>D({textAlign:e}),children:[(0,r.jsx)(Ry,{value:`left`,children:(0,r.jsx)(Wt,{})}),(0,r.jsx)(Ry,{value:`center`,children:(0,r.jsx)(Bt,{})}),(0,r.jsx)(Ry,{value:`right`,children:(0,r.jsx)(Kt,{})}),(0,r.jsx)(Ry,{value:`justify`,children:(0,r.jsx)(Ht,{})})]})]}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor do Texto`}),(0,r.jsx)(nP,{color:j(`color`,`#000000`),onChange:e=>D({color:e})})]})]})}),k(`Aparência`,[`background`,`opacity`,`blend`,`cursor`])&&(0,r.jsxs)(gP,{title:`Aparência`,isOpen:g.appearance,onToggle:()=>w(`appearance`),onReset:()=>O([`backgroundColor`,`backgroundImage`,`backgroundSize`,`opacity`,`mixBlendMode`,`cursor`]),children:[(0,r.jsxs)(sb,{defaultValue:`solid`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`solid`,children:`Sólido`}),(0,r.jsx)(lb,{value:`gradient`,children:`Gradiente`}),(0,r.jsx)(lb,{value:`image`,children:`Imagem`})]}),(0,r.jsxs)(U,{pt:`3`,children:[(0,r.jsxs)(ub,{value:`solid`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor de Fundo`}),(0,r.jsx)(nP,{color:j(`backgroundColor`,`transparent`),onChange:e=>D({backgroundColor:e,backgroundImage:`none`})})]}),(0,r.jsxs)(ub,{value:`gradient`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`CSS Gradient`}),(0,r.jsx)(pb,{value:j(`backgroundImage`,``),onChange:e=>D({backgroundImage:e.target.value}),placeholder:`linear-gradient(to right, red, blue)`,rows:3})]}),(0,r.jsxs)(ub,{value:`image`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`URL da Imagem`}),(0,r.jsx)(X,{value:j(`backgroundImage`,``).replace(/url\(['"]?(.*?)['"]?\)/,`$1`),onChange:e=>D({backgroundImage:`url('${e.target.value}')`}),placeholder:`https://...`,mb:`2`}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Tamanho`}),(0,r.jsxs)(Wy,{value:j(`backgroundSize`,`auto`),onValueChange:e=>D({backgroundSize:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`auto`,children:`Auto`}),(0,r.jsx)(Y,{value:`cover`,children:`Cobrir (Cover)`}),(0,r.jsx)(Y,{value:`contain`,children:`Conter (Contain)`}),(0,r.jsx)(Y,{value:`100% 100%`,children:`Esticar`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Repetição`}),(0,r.jsxs)(Wy,{value:j(`backgroundRepeat`,`repeat`),onValueChange:e=>D({backgroundRepeat:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`repeat`,children:`Repetir`}),(0,r.jsx)(Y,{value:`no-repeat`,children:`Não Repetir`}),(0,r.jsx)(Y,{value:`repeat-x`,children:`Horizontal`}),(0,r.jsx)(Y,{value:`repeat-y`,children:`Vertical`})]})]})]})]})]})]})]}),(0,r.jsxs)(U,{mt:`3`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Opacidade`}),(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(tb,{min:0,max:1,step:.05,value:[parseFloat(j(`opacity`,`1`))],onValueChange:([e])=>D({opacity:e}),style:{flex:1}}),(0,r.jsxs)(H,{size:`1`,children:[Math.round(parseFloat(j(`opacity`,`1`))*100),`%`]})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,mt:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Blend Mode`}),(0,r.jsxs)(Wy,{value:j(`mixBlendMode`,`normal`),onValueChange:e=>D({mixBlendMode:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`normal`,children:`Normal`}),(0,r.jsx)(Y,{value:`multiply`,children:`Multiply`}),(0,r.jsx)(Y,{value:`screen`,children:`Screen`}),(0,r.jsx)(Y,{value:`overlay`,children:`Overlay`}),(0,r.jsx)(Y,{value:`darken`,children:`Darken`}),(0,r.jsx)(Y,{value:`lighten`,children:`Lighten`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cursor`}),(0,r.jsxs)(Wy,{value:j(`cursor`,`auto`),onValueChange:e=>D({cursor:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`auto`,children:`Auto`}),(0,r.jsx)(Y,{value:`default`,children:`Padrão`}),(0,r.jsx)(Y,{value:`pointer`,children:`Mãozinha`}),(0,r.jsx)(Y,{value:`text`,children:`Texto`}),(0,r.jsx)(Y,{value:`move`,children:`Mover`}),(0,r.jsx)(Y,{value:`not-allowed`,children:`Bloqueado`})]})]})]})]})]}),k(`Layout`,[`width`,`height`,`x`,`y`,`z-index`,`overflow`])&&(0,r.jsx)(gP,{title:`Layout & Dimensões`,isOpen:g.layout,onToggle:()=>w(`layout`),onReset:()=>T({width:100,height:100,x:0,y:0,style:{...m.style,zIndex:void 0,overflow:void 0}}),children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsx)(_P,{label:`Largura`,value:m.width,onChange:e=>T({width:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(_P,{label:`Altura`,value:m.height,onChange:e=>T({height:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(_P,{label:`Posição X`,value:m.x,onChange:e=>T({x:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(_P,{label:`Posição Y`,value:m.y,onChange:e=>T({y:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(_P,{label:`Z-Index`,value:j(`zIndex`,`auto`),onChange:e=>D({zIndex:e===``?void 0:parseInt(e)}),units:[``],placeholder:`Auto`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Overflow`}),(0,r.jsxs)(Wy,{value:j(`overflow`,`visible`),onValueChange:e=>D({overflow:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`visible`,children:`Visível`}),(0,r.jsx)(Y,{value:`hidden`,children:`Oculto`}),(0,r.jsx)(Y,{value:`scroll`,children:`Scroll`}),(0,r.jsx)(Y,{value:`auto`,children:`Auto`})]})]})]})]})}),k(`Espaçamento`,[`padding`,`margin`])&&(0,r.jsxs)(gP,{title:`Espaçamento (Margin/Padding)`,isOpen:g.spacing,onToggle:()=>w(`spacing`),onReset:()=>O([`padding`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`,`margin`,`marginTop`,`marginRight`,`marginBottom`,`marginLeft`]),children:[(0,r.jsx)(U,{mb:`3`,children:(0,r.jsx)(vP,{label:`Padding (Interno)`,values:{top:j(`paddingTop`,j(`padding`)),right:j(`paddingRight`,j(`padding`)),bottom:j(`paddingBottom`,j(`padding`)),left:j(`paddingLeft`,j(`padding`))},onChange:e=>{e.top===e.right&&e.right===e.bottom&&e.bottom===e.left?D({padding:e.top,paddingTop:void 0,paddingRight:void 0,paddingBottom:void 0,paddingLeft:void 0}):D({padding:void 0,paddingTop:e.top,paddingRight:e.right,paddingBottom:e.bottom,paddingLeft:e.left})}})}),(0,r.jsx)(U,{children:(0,r.jsx)(vP,{label:`Margin (Externo)`,values:{top:j(`marginTop`,j(`margin`)),right:j(`marginRight`,j(`margin`)),bottom:j(`marginBottom`,j(`margin`)),left:j(`marginLeft`,j(`margin`))},onChange:e=>{e.top===e.right&&e.right===e.bottom&&e.bottom===e.left?D({margin:e.top,marginTop:void 0,marginRight:void 0,marginBottom:void 0,marginLeft:void 0}):D({margin:void 0,marginTop:e.top,marginRight:e.right,marginBottom:e.bottom,marginLeft:e.left})}})})]}),k(`Bordas`,[`border`,`radius`,`stroke`])&&(0,r.jsxs)(gP,{title:`Bordas & Cantos`,isOpen:g.borders,onToggle:()=>w(`borders`),onReset:()=>O([`border`,`borderWidth`,`borderStyle`,`borderColor`,`borderRadius`,`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`]),children:[(0,r.jsxs)(sb,{defaultValue:`all`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`all`,children:(0,r.jsx)(te,{})}),(0,r.jsx)(lb,{value:`top`,children:(0,r.jsx)(ce,{})}),(0,r.jsx)(lb,{value:`right`,children:(0,r.jsx)(oe,{})}),(0,r.jsx)(lb,{value:`bottom`,children:(0,r.jsx)(ne,{})}),(0,r.jsx)(lb,{value:`left`,children:(0,r.jsx)(ie,{})})]}),(0,r.jsx)(U,{pt:`3`,children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Estilo`}),(0,r.jsxs)(Wy,{value:j(`borderStyle`,`none`),onValueChange:e=>D({borderStyle:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`none`,children:`Nenhuma`}),(0,r.jsx)(Y,{value:`solid`,children:`Sólida`}),(0,r.jsx)(Y,{value:`dashed`,children:`Tracejada`}),(0,r.jsx)(Y,{value:`dotted`,children:`Pontilhada`}),(0,r.jsx)(Y,{value:`double`,children:`Dupla`})]})]})]}),(0,r.jsx)(_P,{label:`Espessura`,value:j(`borderWidth`,`0px`),onChange:e=>D({borderWidth:e})}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor`}),(0,r.jsx)(nP,{color:j(`borderColor`,`#000000`),onChange:e=>D({borderColor:e})})]})]})})]}),(0,r.jsx)(U,{mt:`3`,children:(0,r.jsx)(vP,{label:`Arredondamento (Radius)`,values:{top:j(`borderTopLeftRadius`,j(`borderRadius`)),right:j(`borderTopRightRadius`,j(`borderRadius`)),bottom:j(`borderBottomRightRadius`,j(`borderRadius`)),left:j(`borderBottomLeftRadius`,j(`borderRadius`))},onChange:e=>{e.top===e.right&&e.right===e.bottom&&e.bottom===e.left?D({borderRadius:e.top,borderTopLeftRadius:void 0,borderTopRightRadius:void 0,borderBottomRightRadius:void 0,borderBottomLeftRadius:void 0}):D({borderRadius:void 0,borderTopLeftRadius:e.top,borderTopRightRadius:e.right,borderBottomRightRadius:e.bottom,borderBottomLeftRadius:e.left})}})})]}),k(`Efeitos`,[`shadow`,`sombra`])&&(0,r.jsx)(gP,{title:`Efeitos (Sombra)`,isOpen:g.effects,onToggle:()=>w(`effects`),onReset:()=>O([`boxShadow`,`textShadow`]),children:(0,r.jsxs)(sb,{defaultValue:`box`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`box`,children:`Box Shadow`}),(0,r.jsx)(lb,{value:`text`,children:`Text Shadow`})]}),(0,r.jsxs)(U,{pt:`3`,children:[(0,r.jsx)(ub,{value:`box`,children:(0,r.jsxs)(U,{p:`2`,style:{backgroundColor:`var(--gray-3)`,borderRadius:`var(--radius-2)`},children:[(0,r.jsxs)(W,{justify:`between`,mb:`2`,children:[(0,r.jsx)(H,{size:`1`,weight:`bold`,children:`Box Shadow`}),(0,r.jsxs)(W,{gap:`2`,align:`center`,children:[(0,r.jsx)(H,{size:`1`,children:`Inset`}),(0,r.jsx)(`input`,{type:`checkbox`,checked:I.inset,onChange:e=>re({inset:e.target.checked})})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,mb:`2`,children:[(0,r.jsx)(_P,{label:`X`,value:I.x,onChange:e=>re({x:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(_P,{label:`Y`,value:I.y,onChange:e=>re({y:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(_P,{label:`Blur`,value:I.blur,onChange:e=>re({blur:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(_P,{label:`Spread`,value:I.spread,onChange:e=>re({spread:parseFloat(e)}),units:[`px`]})]}),(0,r.jsx)(nP,{color:I.color,onChange:e=>re({color:e})})]})}),(0,r.jsx)(ub,{value:`text`,children:(0,r.jsxs)(U,{p:`2`,style:{backgroundColor:`var(--gray-3)`,borderRadius:`var(--radius-2)`},children:[(0,r.jsx)(H,{size:`1`,weight:`bold`,mb:`2`,as:`div`,children:`Text Shadow`}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,mb:`2`,children:[(0,r.jsx)(_P,{label:`X`,value:F(j(`textShadow`,`none`)).x,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${e}px ${t.y}px ${t.blur}px ${t.color}`})},units:[`px`]}),(0,r.jsx)(_P,{label:`Y`,value:F(j(`textShadow`,`none`)).y,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${t.x}px ${e}px ${t.blur}px ${t.color}`})},units:[`px`]}),(0,r.jsx)(_P,{label:`Blur`,value:F(j(`textShadow`,`none`)).blur,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${t.x}px ${t.y}px ${e}px ${t.color}`})},units:[`px`]})]}),(0,r.jsx)(nP,{color:F(j(`textShadow`,`none`)).color,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${t.x}px ${t.y}px ${t.blur}px ${e}`})}})]})})]})]})}),k(`Transform`,[`scale`,`rotate`,`skew`,`translate`])&&(0,r.jsx)(gP,{title:`Transformação`,isOpen:g.transform,onToggle:()=>w(`transform`),onReset:()=>T({rotation:0,style:{...m.style,transform:void 0}}),children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsx)(_P,{label:`Rotação (deg)`,value:m.rotation,onChange:e=>T({rotation:parseFloat(e)}),units:[`deg`]}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Transform CSS (Scale, Skew, Translate)`}),(0,r.jsx)(X,{value:j(`transform`,``),onChange:e=>D({transform:e.target.value}),placeholder:`ex: scale(1.5) skewX(10deg)`}),(0,r.jsxs)(H,{size:`1`,color:`gray`,mt:`1`,children:[`Use sintaxe CSS padrão. Ex: `,(0,r.jsx)(`code`,{children:`scale(1.2)`}),`, `,(0,r.jsx)(`code`,{children:`skewY(10deg)`})]})]})]})}),!h&&(0,r.jsxs)(r.Fragment,{children:[k(`Animação`,[`animation`])&&(0,r.jsx)(gP,{title:`Animação`,isOpen:g.animation,onToggle:()=>w(`animation`),onReset:()=>T({animation:void 0}),children:(0,r.jsx)(iP,{element:m,updateElement:i})}),k(`Regras`,[`condition`])&&(0,r.jsx)(gP,{title:`Regras Condicionais`,isOpen:g.conditions,onToggle:()=>w(`conditions`),onReset:()=>T({conditions:[]}),children:(0,r.jsx)(hP,{element:m,updateElement:i,availableProps:e.availableProps||[]})}),k(`Formatação`,[`format`])&&(0,r.jsx)(gP,{title:`Formatação`,isOpen:g.formatting,onToggle:()=>w(`formatting`),onReset:()=>T({formatting:void 0}),children:(0,r.jsx)(aP,{element:m,updateElement:i})})]})]},m?.id??d.join(`,`))]})})};var SP=20,CP=`#f5f5f5`,wP=`#999`;let TP=({orientation:e})=>{let{state:n}=rS(),{zoom:i,pan:a}=n,o=(0,t.useRef)(null);return(0,t.useEffect)(()=>{let t=o.current;if(!t)return;let n=t.getContext(`2d`);if(!n)return;let r=t.width,s=t.height;n.fillStyle=CP,n.fillRect(0,0,r,s),n.fillStyle=wP,n.font=`10px sans-serif`,n.strokeStyle=wP,n.lineWidth=1;let c=e===`horizontal`?-a.x/i:-a.y/i,l=e===`horizontal`?(r-a.x)/i:(s-a.y)/i,u=100;u=i>2?10:i>.8?50:i>.4?100:200;let d=Math.floor(c/u)*u;n.beginPath();for(let t=d;t<l;t+=u){let r=t*i+(e===`horizontal`?a.x:a.y);e===`horizontal`?(n.moveTo(r,0),n.lineTo(r,SP),n.fillText(t.toString(),r+2,10)):(n.moveTo(0,r),n.lineTo(SP,r),n.save(),n.translate(10,r+2),n.rotate(-Math.PI/2),n.fillText(t.toString(),0,0),n.restore())}n.stroke()},[i,a,e,n.canvasHeight]),(0,t.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.parentElement?.getBoundingClientRect();t&&(e.width=t.width,e.height=t.height)});return e.parentElement&&t.observe(e.parentElement),()=>t.disconnect()},[]),(0,r.jsx)(`canvas`,{ref:o,style:{width:`100%`,height:`100%`,display:`block`,pointerEvents:`none`}})};var EP=({icon:e,label:n,keys:i})=>(0,r.jsxs)(W,{align:`center`,justify:`between`,py:`2`,children:[(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(U,{style:{color:`var(--gray-10)`},children:(0,r.jsx)(e,{})}),(0,r.jsx)(H,{size:`2`,children:n})]}),(0,r.jsx)(W,{gap:`1`,children:i.map((e,n)=>(0,r.jsxs)(t.default.Fragment,{children:[(0,r.jsx)(Ey,{children:e}),n<i.length-1&&(0,r.jsx)(H,{size:`1`,color:`gray`,children:`+`})]},n))})]});let DP=()=>(0,r.jsxs)(ny,{children:[(0,r.jsx)(ry,{children:(0,r.jsxs)(G,{variant:`solid`,color:`amber`,radius:`full`,style:{height:36,padding:`0 14px`,boxShadow:`0 4px 6px rgba(0,0,0,0.1)`},title:`Atalhos de Teclado`,children:[(0,r.jsx)(gt,{width:`18`,height:`18`}),`Ajuda`]})}),(0,r.jsxs)(iy,{style:{maxWidth:700},onPointerDown:e=>e.stopPropagation(),children:[(0,r.jsx)(ay,{children:`Atalhos de Teclado`}),(0,r.jsx)(H,{size:`2`,color:`gray`,mb:`4`,as:`p`,children:`Agilize seu fluxo de trabalho com estes atalhos.`}),(0,r.jsxs)(K,{columns:{initial:`1`,sm:`2`},gap:`6`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,color:`blue`,children:`Edição Básica`}),(0,r.jsx)(Qy,{size:`4`,mb:`2`}),(0,r.jsx)(EP,{icon:It,label:`Desfazer`,keys:[`Ctrl`,`Z`]}),(0,r.jsx)(EP,{icon:It,label:`Refazer`,keys:[`Ctrl`,`Y`]}),(0,r.jsx)(EP,{icon:Se,label:`Copiar`,keys:[`Ctrl`,`C`]}),(0,r.jsx)(EP,{icon:Se,label:`Colar`,keys:[`Ctrl`,`V`]}),(0,r.jsx)(EP,{icon:Xt,label:`Excluir`,keys:[`Delete`]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,color:`blue`,children:`Navegação e Seleção`}),(0,r.jsx)(Qy,{size:`4`,mb:`2`}),(0,r.jsx)(EP,{icon:ut,label:`Mover Elemento`,keys:[`Setas`]}),(0,r.jsx)(EP,{icon:ut,label:`Mover Rápido`,keys:[`Shift`,`Setas`]}),(0,r.jsx)(EP,{icon:Oe,label:`Multiseleção`,keys:[`Shift`,`Click`]}),(0,r.jsx)(EP,{icon:wt,label:`Mover Canvas (Pan)`,keys:[`Espaço`,`Arrastar`]}),(0,r.jsx)(EP,{icon:ot,label:`Zoom`,keys:[`Ctrl`,`Scroll`]})]})]}),(0,r.jsx)(W,{justify:`end`,mt:`5`,children:(0,r.jsx)(sy,{children:(0,r.jsx)(G,{variant:`soft`,color:`gray`,children:`Fechar`})})})]})]}),OP=()=>{let{state:e,updateListSettings:n,setCanvasHeight:i,setGridSize:a}=rS(),[o,s]=(0,t.useState)(!1),[c,l]=(0,t.useState)(``),[u,d]=(0,t.useState)(`asc`),[f,p]=(0,t.useState)(`bottom`),[m,h]=(0,t.useState)(`down`),[g,_]=(0,t.useState)(`150`),[v,y]=(0,t.useState)(``),[b,x]=(0,t.useState)(`0`),[S,C]=(0,t.useState)(`slideIn`),[w,T]=(0,t.useState)(.3),[E,D]=(0,t.useState)(`ease-out`),O=t.default.useRef(!1);return(0,t.useEffect)(()=>{if(o&&!O.current){O.current=!0,l(e.listSettings.sortProp||`__none__`),d(e.listSettings.sortOrder||`asc`),p(e.listSettings.newestPosition||`bottom`),h(e.listSettings.scrollDirection||`down`),y(e.listSettings.containerHeight?String(e.listSettings.containerHeight):``),_(String(e.canvasHeight||150)),x(String(e.gridSize||0));let t=e.listSettings.entryAnimation;C(t?.type||`slideIn`),T(t?.duration||.3),D(t?.timingFunction||`ease-out`)}o||(O.current=!1)},[o]),(0,t.useEffect)(()=>{if(!o)return;let e=parseInt(g,10);!isNaN(e)&&e>0&&i(e);let t=parseInt(b,10);!isNaN(t)&&t>=0&&a(t)},[g,b,o,i,a]),(0,r.jsxs)(ny,{open:o,onOpenChange:s,children:[(0,r.jsx)(ry,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`center`,cursor:`pointer`},children:[(0,r.jsx)(Je,{}),` Configurações`]})}),(0,r.jsxs)(iy,{style:{maxWidth:600},children:[(0,r.jsx)(ay,{children:`Configurações do Editor`}),(0,r.jsx)(oy,{size:`2`,mb:`4`,children:`Configure o comportamento da lista.`}),(0,r.jsx)(U,{pt:`3`,children:(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Ordenação`}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Propriedade para Ordenar`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[c===`__none__`?`(Nenhum)`:e.availableProps.find(e=>e.dataName===c)?.name||c,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>l(`__none__`),children:`(Nenhum)`}),e.availableProps.map(e=>(0,r.jsx)(q,{onSelect:()=>l(e.dataName),children:e.name},e.dataName))]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Direção`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:150,justifyContent:`space-between`},children:[u===`asc`?`Crescente (A-Z)`:`Decrescente (Z-A)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d(`asc`),children:`Crescente (A-Z)`}),(0,r.jsx)(q,{onSelect:()=>d(`desc`),children:`Decrescente (Z-A)`})]})]})]})]}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Posição do Recente`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[f===`top`?`Topo (Início)`:`Base (Final)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>p(`top`),children:`Topo (Início)`}),(0,r.jsx)(q,{onSelect:()=>p(`bottom`),children:`Base (Final)`})]})]})]}),(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Comportamento de Rolagem`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[m===`down`?`Descer (Padrão)`:`Subir (Chat)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>h(`down`),children:`Descer (Padrão)`}),(0,r.jsx)(q,{onSelect:()=>h(`up`),children:`Subir (Chat)`})]})]})]})]}),(0,r.jsx)(H,{size:`2`,weight:`bold`,mt:`2`,children:`Dimensões`}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Altura do Item (Template) (px)`}),(0,r.jsx)(X,{type:`number`,min:`10`,value:g,onChange:e=>_(e.target.value)}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Altura de cada item individual na lista.`})]}),(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Altura da Lista (Container) (px)`}),(0,r.jsx)(X,{type:`number`,min:`0`,placeholder:`Auto (100%)`,value:v,onChange:e=>y(e.target.value)}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Altura total da lista. Se exceder, rola. Vazio = 100%.`})]})]}),(0,r.jsx)(H,{size:`2`,weight:`bold`,mt:`2`,children:`Animação de Entrada na Lista`}),(0,r.jsxs)(K,{columns:`3`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Efeito`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[S===`slideIn`?`Slide (Padrão)`:S===`smoothSlideUp`?`Slide Suave (Up)`:S===`fadeIn`?`Fade In`:S===`popIn`?`Pop In`:S===`blurIn`?`Blur In`:S===`slideInLeft`?`Slide (Esq)`:S===`slideInRight`?`Slide (Dir)`:S===`zoomIn`?`Zoom In`:S===`bounceIn`?`Bounce`:`Nenhum`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>C(`none`),children:`Nenhum`}),(0,r.jsx)(q,{onSelect:()=>C(`slideIn`),children:`Slide (Padrão)`}),(0,r.jsx)(q,{onSelect:()=>C(`smoothSlideUp`),children:`Slide Suave (Up)`}),(0,r.jsx)(q,{onSelect:()=>C(`fadeIn`),children:`Fade In`}),(0,r.jsx)(q,{onSelect:()=>C(`popIn`),children:`Pop In`}),(0,r.jsx)(q,{onSelect:()=>C(`blurIn`),children:`Blur In`}),(0,r.jsx)(q,{onSelect:()=>C(`slideInLeft`),children:`Slide (Esq)`}),(0,r.jsx)(q,{onSelect:()=>C(`slideInRight`),children:`Slide (Dir)`}),(0,r.jsx)(q,{onSelect:()=>C(`zoomIn`),children:`Zoom In`}),(0,r.jsx)(q,{onSelect:()=>C(`bounceIn`),children:`Bounce`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Duração (s)`}),(0,r.jsx)(X,{type:`number`,step:`0.1`,min:`0.1`,value:w,onChange:e=>T(parseFloat(e.target.value)||.3)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Curva (Easing)`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[E===`ease-out`?`Ease Out`:E===`linear`?`Linear`:E===`bounce`?`Bounce`:`Ease`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>D(`ease`),children:`Ease`}),(0,r.jsx)(q,{onSelect:()=>D(`ease-out`),children:`Ease Out`}),(0,r.jsx)(q,{onSelect:()=>D(`linear`),children:`Linear`}),(0,r.jsx)(q,{onSelect:()=>D(`bounce`),children:`Bounce`})]})]})]})]}),(0,r.jsxs)(U,{mt:`2`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Grid Snapping (Travar)`}),(0,r.jsx)(W,{gap:`3`,align:`center`,mt:`2`,children:(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Tamanho do Grid (px) - 0 para desativar`}),(0,r.jsx)(X,{type:`number`,value:b,onChange:e=>x(e.target.value),placeholder:`0`})]})})]})]})}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(sy,{children:(0,r.jsx)(G,{variant:`soft`,color:`gray`,children:`Cancelar`})}),(0,r.jsx)(sy,{children:(0,r.jsx)(G,{onClick:()=>{let e=parseInt(v,10),t=parseInt(g,10),r=parseInt(b,10),o={type:S,duration:Number(w),delay:0,timingFunction:E};n({sortProp:c===`__none__`?``:c,sortOrder:u,newestPosition:f,scrollDirection:m,containerHeight:!isNaN(e)&&e>0?e:void 0,entryAnimation:o}),!isNaN(t)&&t>0&&i(t),!isNaN(r)&&r>=0&&a(r),s(!1)},children:`Salvar Alterações`})})]})]})]})},kP=({onClose:e})=>{let{state:t,jumpToHistory:n,undo:i,redo:a}=rS(),o=t=>{n(t),e&&e()};return(0,r.jsxs)(W,{direction:`column`,style:{width:`100%`},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,p:`2`,style:{borderBottom:`1px solid var(--gray-5)`},children:[(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(vt,{}),(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Histórico`})]}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsx)(G,{size:`1`,variant:`soft`,onClick:i,disabled:t.historyIndex<=0,children:`Desfazer`}),(0,r.jsx)(G,{size:`1`,variant:`soft`,onClick:a,disabled:t.historyIndex>=t.history.length-1,children:`Refazer`})]})]}),(0,r.jsx)(U,{p:`0`,children:t.history.map((e,n)=>{let i=n===t.historyIndex,a=n>t.historyIndex,s=t.historyDescriptions?.[n]||(n===0?`Estado Inicial`:`Alteração ${n}`);return(0,r.jsx)(U,{p:`2`,style:{backgroundColor:i?`var(--accent-3)`:`transparent`,opacity:a?.5:1,cursor:`pointer`,borderBottom:`1px solid var(--gray-3)`},onClick:()=>o(n),className:`history-item`,children:(0,r.jsxs)(W,{align:`center`,justify:`between`,children:[(0,r.jsx)(H,{size:`2`,weight:i?`bold`:`regular`,children:s}),i&&(0,r.jsx)(H,{size:`1`,color:`blue`,children:`Atual`})]})},n)})})]})};function AP(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return(0,t.useMemo)(()=>e=>{n.forEach(t=>t(e))},n)}var jP=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function MP(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function NP(e){return`nodeType`in e}function PP(e){return e?MP(e)?e:NP(e)?e.ownerDocument?.defaultView??window:window:window}function FP(e){let{Document:t}=PP(e);return e instanceof t}function IP(e){return MP(e)?!1:e instanceof PP(e).HTMLElement}function LP(e){return e instanceof PP(e).SVGElement}function RP(e){return e?MP(e)?e.document:NP(e)?FP(e)?e:IP(e)||LP(e)?e.ownerDocument:document:document:document}var zP=jP?t.useLayoutEffect:t.useEffect;function BP(e){let n=(0,t.useRef)(e);return zP(()=>{n.current=e}),(0,t.useCallback)(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.current==null?void 0:n.current(...t)},[])}function VP(){let e=(0,t.useRef)(null);return[(0,t.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,t.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function HP(e,n){n===void 0&&(n=[e]);let r=(0,t.useRef)(e);return zP(()=>{r.current!==e&&(r.current=e)},n),r}function UP(e,n){let r=(0,t.useRef)();return(0,t.useMemo)(()=>{let t=e(r.current);return r.current=t,t},[...n])}function WP(e){let n=BP(e),r=(0,t.useRef)(null);return[r,(0,t.useCallback)(e=>{e!==r.current&&n?.(e,r.current),r.current=e},[])]}function GP(e){let n=(0,t.useRef)();return(0,t.useEffect)(()=>{n.current=e},[e]),n.current}var KP={};function qP(e,n){return(0,t.useMemo)(()=>{if(n)return n;let t=KP[e]==null?0:KP[e]+1;return KP[e]=t,e+`-`+t},[e,n])}function JP(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var YP=JP(1),XP=JP(-1);function ZP(e){return`clientX`in e&&`clientY`in e}function QP(e){if(!e)return!1;let{KeyboardEvent:t}=PP(e.target);return t&&e instanceof t}function $P(e){if(!e)return!1;let{TouchEvent:t}=PP(e.target);return t&&e instanceof t}function eF(e){if($P(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return ZP(e)?{x:e.clientX,y:e.clientY}:null}var tF=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[tF.Translate.toString(e),tF.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),nF=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function rF(e){return e.matches(nF)?e:e.querySelector(nF)}var iF={display:`none`};function aF(e){let{id:n,value:r}=e;return t.default.createElement(`div`,{id:n,style:iF},r)}function oF(e){let{id:n,announcement:r,ariaLiveType:i=`assertive`}=e;return t.default.createElement(`div`,{id:n,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":i,"aria-atomic":!0},r)}function sF(){let[e,n]=(0,t.useState)(``);return{announce:(0,t.useCallback)(e=>{e!=null&&n(e)},[]),announcement:e}}var cF=(0,t.createContext)(null);function lF(e){let n=(0,t.useContext)(cF);(0,t.useEffect)(()=>{if(!n)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return n(e)},[e,n])}function uF(){let[e]=(0,t.useState)(()=>new Set),n=(0,t.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,t.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),n]}var dF={draggable:`
|
|
57
|
+
`).length-1;return c+=l,Math.ceil(c*r*i)};let uN=(e,t)=>{let n=e.map(e=>({...e})),r=new Map(e.map(e=>[e.id,e])),i=[];n.forEach(e=>{let a=e.type===`text`,o=e.type===`text-container`;if((a||o)&&e.autoGrow){let a=e.content;t&&(a=a.replace(/\{\{(.*?)\}\}/g,(n,r)=>{let i=t[r.trim()];return i==null?n:e.formatting?jS(i,e.formatting):String(i)}));let s=parseInt(String(e.style?.fontSize||16)),c=String(e.style?.fontFamily||`Arial`);if(o&&e.containerExpansion===`horizontal`){let t=document.createElement(`canvas`).getContext(`2d`);if(t){t.font=`${s}px ${c}`;let n=t.measureText(a),r=Math.ceil(n.width+parseInt(String(e.style?.padding||0))*2);Math.abs(r-e.width)>1&&(e.width=r,e.content=a)}}else{let t=lN(a,e.width,c,s),o=e.height,l=t-o;if(Math.abs(l)>1){e.height=t,e.content=a;let s=[],c=r.get(e.id);c&&n.forEach(t=>{if(t.id===e.id)return;let n=r.get(t.id);n&&cN(c,n)&&s.push(t)});let u=new Set([e.id]);s.forEach(e=>{e.height+=l,u.add(e.id)}),i.push({triggerY:e.y+o,delta:l,ignoreIds:u})}}}}),n.forEach(e=>{let t=r.get(e.id);if(!t)return;let n=0;i.forEach(r=>{r.ignoreIds.has(e.id)||t.y>=r.triggerY-.1&&(n+=r.delta)}),e.y+=n});let a=0;return n.forEach(e=>{let t=e.y+e.height;t>a&&(a=t)}),{elements:n,totalHeight:a}};var dN=e=>{switch(e){case`linear`:return`linear`;case`ease-in`:return`easeIn`;case`ease-out`:return`easeOut`;case`ease-in-out`:return`easeInOut`;case`bounce`:return`easeOut`;case`ease`:return`easeInOut`;default:return`easeOut`}},fN=e=>{if(!e||e.type===`none`)return{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1}};let t={initial:{},animate:{}};switch(e.type){case`fadeIn`:t.initial={opacity:0},t.animate={opacity:1};break;case`slideInLeft`:t.initial={opacity:0,x:-100},t.animate={opacity:1,x:0};break;case`slideInRight`:t.initial={opacity:0,x:100},t.animate={opacity:1,x:0};break;case`slideInUp`:t.initial={opacity:0,y:100},t.animate={opacity:1,y:0};break;case`slideInDown`:t.initial={opacity:0,y:-100},t.animate={opacity:1,y:0};break;case`zoomIn`:t.initial={opacity:0,scale:.5},t.animate={opacity:1,scale:1};break;case`bounceIn`:t.initial={opacity:0,scale:.3},t.animate={opacity:1,scale:1,transition:{type:`spring`,bounce:.6}};break;case`smoothSlideUp`:t.initial={opacity:0,y:30},t.animate={opacity:1,y:0};break;case`popIn`:t.initial={opacity:0,scale:.8,y:10},t.animate={opacity:1,scale:1,y:0};break;case`blurIn`:t.initial={opacity:0,filter:`blur(10px)`},t.animate={opacity:1,filter:`blur(0px)`};break;case`pulse`:t.animate={scale:[1,1.05,1]};break;case`shake`:t.animate={x:[0,-5,5,-5,5,0]};break;case`spin`:t.animate={rotate:360};break;default:t.initial={opacity:0,y:20},t.animate={opacity:1,y:0}}return t},pN=(e,t)=>{let n={duration:e?.duration||.4,ease:dN(e?.timingFunction),delay:e?.delay||0},r;e?.iterationCount===`infinite`?r=1/0:typeof e?.iterationCount==`number`&&e.iterationCount>1&&(r=e.iterationCount-1);let i=t?.animate?.transition;return i?{...n,...i,delay:n.delay,repeat:r??i.repeat}:r===void 0?n:{...n,repeat:r}},mN=({element:e,offsetY:n=0,dataContext:i,onSelect:a,isSelected:o})=>{let s=e.content;if(i){if(e.type===`text`||e.type===`text-container`)s=s.replace(/\{\{(.*?)\}\}/g,(t,n)=>{let r=i[n.trim()];return r==null?t:e.formatting?jS(r,e.formatting):String(r)});else if(e.type===`image`)if(e.dataBinding){let t=i[e.dataBinding];t!=null&&(s=String(t))}else s=s.replace(/\{\{(.*?)\}\}/g,(e,t)=>{let n=i[t.trim()];return n==null?e:String(n)})}let c={position:`absolute`,left:e.x,top:e.y+n,width:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`max-content`:`${e.width}px`,height:e.autoGrow?`auto`:`${e.height}px`,transform:e.rotation?`rotate(${e.rotation}deg)`:void 0,padding:e.type===`image`||e.type===`text`||e.type===`text-container`?0:`8px`,overflow:e.autoGrow?`visible`:`hidden`,whiteSpace:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`nowrap`:e.autoGrow?`pre-wrap`:void 0,wordBreak:e.autoGrow?`break-word`:void 0,outline:o?`2px solid var(--blue-9)`:void 0,zIndex:o?10:void 0,cursor:a?`pointer`:void 0,...e.style},l=e.animation&&e.animation.type!==`none`,u=t.default.useMemo(()=>l?fN(e.animation):null,[e.animation,l]),d=t.default.useMemo(()=>pN(e.animation,u),[e.animation,u]),f=(0,r.jsxs)(r.Fragment,{children:[(e.type===`text`||e.type===`text-container`)&&(0,r.jsx)(H,{style:{width:`100%`,height:`100%`,display:`block`},children:s}),e.type===`image`&&(s&&MS(s)?(0,r.jsx)(`img`,{src:s,alt:`Element`,style:{width:`100%`,height:`100%`,objectFit:e.style?.objectFit||`cover`,display:`block`}}):(0,r.jsx)(U,{style:{width:`100%`,height:`100%`,backgroundColor:`#eee`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(H,{size:`1`,children:s?`URL inválida`:`Imagem`})})),e.type===`box`&&(0,r.jsx)(U,{style:{width:`100%`,height:`100%`}}),e.type===`checkbox`&&(0,r.jsx)(U,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(`input`,{type:`checkbox`,checked:i&&e.dataBinding?i[e.dataBinding]===!0||String(i[e.dataBinding])===`true`:!1,readOnly:!0,style:{width:`100%`,height:`100%`,margin:0}})})]});return l&&u?(0,r.jsx)(sN.div,{variants:u,initial:`initial`,animate:`animate`,transition:d,style:c,onClick:t=>{t.stopPropagation(),a?.(e.id)},children:f}):(0,r.jsx)(U,{style:c,onClick:t=>{t.stopPropagation(),a?.(e.id)},children:f})},hN=({item:e,elements:n,animation:i,onSelect:a,selectedElementIds:o})=>{let{elements:s,totalHeight:c}=t.default.useMemo(()=>uN(n,e),[n,e]),l=t.default.useMemo(()=>fN(i),[i]),u=t.default.useMemo(()=>l.animate?.transition||{duration:i?.duration||.4,ease:dN(i?.timingFunction)},[i,l]);return(0,r.jsx)(sN.div,{layout:!0,variants:l,initial:`initial`,animate:`animate`,exit:{opacity:0,scale:.9},transition:u,whileHover:{scale:1.02,transition:{duration:.2}},style:{position:`relative`,height:c,width:`100%`,marginBottom:`20px`,transformOrigin:`center center`},children:s.map(t=>(0,r.jsx)(mN,{element:t,offsetY:0,dataContext:e,onSelect:a,isSelected:o?.includes(t.id)},t.id))})};let gN=()=>{let{state:e,setSelectedElements:n}=rS(),[i,a]=t.default.useState(!1),[o,s]=t.default.useState([]);return t.default.useEffect(()=>{let t;return i&&e.isList?(o.length===0&&s([{id:Date.now(),...e.mockData[0]||{}}]),t=setInterval(()=>{s(t=>{let n=t.length%(e.mockData.length||1),r={...e.mockData.length>0?e.mockData[n]:{id:t.length},id:`${Date.now()}-${t.length}`};return e.listSettings.newestPosition===`top`?[r,...t].slice(0,20):[...t,r].slice(-20)})},1500)):s([]),()=>clearInterval(t)},[i,e.isList,e.listSettings.newestPosition,e.mockData]),(0,r.jsxs)(U,{style:{width:`100%`,height:`100%`,position:`relative`,overflow:`hidden`,backgroundColor:`var(--color-panel-solid)`},children:[e.isList&&(0,r.jsx)(U,{style:{position:`absolute`,bottom:10,right:10,zIndex:100,backgroundColor:`var(--color-surface)`,padding:`4px`,borderRadius:`var(--radius-3)`,boxShadow:`0 2px 10px rgba(0,0,0,0.1)`},children:(0,r.jsxs)(G,{size:`1`,variant:i?`soft`:`solid`,color:i?`red`:`green`,onClick:()=>a(!i),children:[i?(0,r.jsx)(Mt,{}):(0,r.jsx)(ft,{}),i?`Parar Simulação`:`Simular Entrada`]})}),(0,r.jsx)(Xv,{type:`auto`,scrollbars:`vertical`,style:{height:`100%`,width:`100%`},children:(0,r.jsx)(U,{style:{position:`relative`,minHeight:`100%`,width:`100%`},children:(()=>{if(e.elements.length===0)return(0,r.jsx)(W,{align:`center`,justify:`center`,style:{height:`100%`},children:(0,r.jsx)(H,{color:`gray`,children:`Preview vazio`})});if(e.isList){let t=[];if(i)t=o;else{if(t=e.mockData.length>0?e.mockData:Array.from({length:10}).map((e,t)=>({id:t})),e.listSettings.sortProp){let n=e.listSettings.sortProp,r=e.listSettings.sortOrder===`asc`?1:-1;t=[...t].sort((e,t)=>{let i=e[n],a=t[n];return i<a?-1*r:i>a?1*r:0})}e.listSettings.newestPosition===`top`&&(t=[...t].reverse())}let a=e.listSettings.containerHeight;return(0,r.jsx)(U,{style:{width:`100%`,minHeight:a?`${a}px`:`100%`,height:a?`${a}px`:void 0,overflowY:a?`auto`:void 0,display:`flex`,flexDirection:`column`,justifyContent:e.listSettings.newestPosition===`top`?`flex-start`:`flex-end`,padding:16},children:(0,r.jsx)(GD,{mode:`popLayout`,children:t.map((t,i)=>(0,r.jsx)(hN,{item:t,elements:e.elements,animation:e.listSettings.entryAnimation,onSelect:e=>n([e]),selectedElementIds:e.selectedElementIds},t.id||i))})})}return(0,r.jsx)(r.Fragment,{children:e.elements.map(t=>(0,r.jsx)(mN,{element:t,dataContext:e.singleMockData,onSelect:e=>n([e]),isSelected:e.selectedElementIds.includes(t.id)},t.id))})})()})})]})};function _N(){return(_N=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function vN(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}function yN(e){var n=(0,t.useRef)(e),r=(0,t.useRef)(function(e){n.current&&n.current(e)});return n.current=e,r.current}var bN=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},xN=function(e){return`touches`in e},SN=function(e){return e&&e.ownerDocument.defaultView||self},CN=function(e,t,n){var r=e.getBoundingClientRect(),i=xN(t)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].identifier===t)return e[n];return e[0]}(t.touches,n):t;return{left:bN((i.pageX-(r.left+SN(e).pageXOffset))/r.width),top:bN((i.pageY-(r.top+SN(e).pageYOffset))/r.height)}},wN=function(e){!xN(e)&&e.preventDefault()},TN=t.default.memo(function(e){var n=e.onMove,r=e.onKey,i=vN(e,[`onMove`,`onKey`]),a=(0,t.useRef)(null),o=yN(n),s=yN(r),c=(0,t.useRef)(null),l=(0,t.useRef)(!1),u=(0,t.useMemo)(function(){var e=function(e){wN(e),(xN(e)?e.touches.length>0:e.buttons>0)&&a.current?o(CN(a.current,e,c.current)):n(!1)},t=function(){return n(!1)};function n(n){var r=l.current,i=SN(a.current),o=n?i.addEventListener:i.removeEventListener;o(r?`touchmove`:`mousemove`,e),o(r?`touchend`:`mouseup`,t)}return[function(e){var t=e.nativeEvent,r=a.current;if(r&&(wN(t),!function(e,t){return t&&!xN(e)}(t,l.current)&&r)){if(xN(t)){l.current=!0;var i=t.changedTouches||[];i.length&&(c.current=i[0].identifier)}r.focus(),o(CN(r,t,c.current)),n(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),s({left:t===39?.05:t===37?-.05:0,top:t===40?.05:t===38?-.05:0}))},n]},[s,o]),d=u[0],f=u[1],p=u[2];return(0,t.useEffect)(function(){return p},[p]),t.default.createElement(`div`,_N({},i,{onTouchStart:d,onMouseDown:d,className:`react-colorful__interactive`,ref:a,onKeyDown:f,tabIndex:0,role:`slider`}))}),EN=function(e){return e.filter(Boolean).join(` `)},DN=function(e){var n=e.color,r=e.left,i=e.top,a=i===void 0?.5:i,o=EN([`react-colorful__pointer`,e.className]);return t.default.createElement(`div`,{className:o,style:{top:100*a+`%`,left:100*r+`%`}},t.default.createElement(`div`,{className:`react-colorful__pointer-fill`,style:{backgroundColor:n}}))},ON=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n};360/(2*Math.PI);var kN=function(e){return RN(AN(e))},AN=function(e){return e[0]===`#`&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?ON(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:e.length===8?ON(parseInt(e.substring(6,8),16)/255,2):1}},jN=function(e){return LN(FN(e))},MN=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:ON(e.h),s:ON(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:ON(i/2),a:ON(r,2)}},NN=function(e){var t=MN(e);return`hsl(`+t.h+`, `+t.s+`%, `+t.l+`%)`},PN=function(e){var t=MN(e);return`hsla(`+t.h+`, `+t.s+`%, `+t.l+`%, `+t.a+`)`},FN=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:ON(255*[r,s,o,o,c,r][l]),g:ON(255*[c,r,r,s,o,o][l]),b:ON(255*[o,o,c,r,r,s][l]),a:ON(i,2)}},IN=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},LN=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=i<1?IN(ON(255*i)):``;return`#`+IN(t)+IN(n)+IN(r)+a},RN=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:ON(60*(s<0?s+6:s)),s:ON(a?o/a*100:0),v:ON(a/255*100),a:i}},zN=t.default.memo(function(e){var n=e.hue,r=e.onChange,i=EN([`react-colorful__hue`,e.className]);return t.default.createElement(`div`,{className:i},t.default.createElement(TN,{onMove:function(e){r({h:360*e.left})},onKey:function(e){r({h:bN(n+360*e.left,0,360)})},"aria-label":`Hue`,"aria-valuenow":ON(n),"aria-valuemax":`360`,"aria-valuemin":`0`},t.default.createElement(DN,{className:`react-colorful__hue-pointer`,left:n/360,color:NN({h:n,s:100,v:100,a:1})})))}),BN=t.default.memo(function(e){var n=e.hsva,r=e.onChange,i={backgroundColor:NN({h:n.h,s:100,v:100,a:1})};return t.default.createElement(`div`,{className:`react-colorful__saturation`,style:i},t.default.createElement(TN,{onMove:function(e){r({s:100*e.left,v:100-100*e.top})},onKey:function(e){r({s:bN(n.s+100*e.left,0,100),v:bN(n.v-100*e.top,0,100)})},"aria-label":`Color`,"aria-valuetext":`Saturation `+ON(n.s)+`%, Brightness `+ON(n.v)+`%`},t.default.createElement(DN,{className:`react-colorful__saturation-pointer`,top:1-n.v/100,left:n.s/100,color:NN(n)})))}),VN=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},HN=function(e,t){return e.toLowerCase()===t.toLowerCase()||VN(AN(e),AN(t))};function UN(e,n,r){var i=yN(r),a=(0,t.useState)(function(){return e.toHsva(n)}),o=a[0],s=a[1],c=(0,t.useRef)({color:n,hsva:o});return(0,t.useEffect)(function(){if(!e.equal(n,c.current.color)){var t=e.toHsva(n);c.current={hsva:t,color:n},s(t)}},[n,e]),(0,t.useEffect)(function(){var t;VN(o,c.current.hsva)||e.equal(t=e.fromHsva(o),c.current.color)||(c.current={hsva:o,color:t},i(t))},[o,e,i]),[o,(0,t.useCallback)(function(e){s(function(t){return Object.assign({},t,e)})},[])]}var WN,GN=typeof window<`u`?t.useLayoutEffect:t.useEffect,KN=function(){return WN||(typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0)},qN=new Map,JN=function(e){GN(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!qN.has(t)){var n=t.createElement(`style`);n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,qN.set(t,n);var r=KN();r&&n.setAttribute(`nonce`,r),t.head.appendChild(n)}},[])},YN=function(e){var n=e.className,r=e.hsva,i=e.onChange,a={backgroundImage:`linear-gradient(90deg, `+PN(Object.assign({},r,{a:0}))+`, `+PN(Object.assign({},r,{a:1}))+`)`},o=EN([`react-colorful__alpha`,n]),s=ON(100*r.a);return t.default.createElement(`div`,{className:o},t.default.createElement(`div`,{className:`react-colorful__alpha-gradient`,style:a}),t.default.createElement(TN,{onMove:function(e){i({a:e.left})},onKey:function(e){i({a:bN(r.a+e.left)})},"aria-label":`Alpha`,"aria-valuetext":s+`%`,"aria-valuenow":s,"aria-valuemin":`0`,"aria-valuemax":`100`},t.default.createElement(DN,{className:`react-colorful__alpha-pointer`,left:r.a,color:PN(r)})))},XN=function(e){var n=e.className,r=e.colorModel,i=e.color,a=i===void 0?r.defaultColor:i,o=e.onChange,s=vN(e,[`className`,`colorModel`,`color`,`onChange`]),c=(0,t.useRef)(null);JN(c);var l=UN(r,a,o),u=l[0],d=l[1],f=EN([`react-colorful`,n]);return t.default.createElement(`div`,_N({},s,{ref:c,className:f}),t.default.createElement(BN,{hsva:u,onChange:d}),t.default.createElement(zN,{hue:u.h,onChange:d}),t.default.createElement(YN,{hsva:u,onChange:d,className:`react-colorful__last-control`}))},ZN={defaultColor:`0001`,toHsva:kN,fromHsva:jN,equal:HN},QN=function(e){return t.default.createElement(XN,_N({},e,{colorModel:ZN}))},$N={black:`#000000`,white:`#ffffff`,red:`#ff0000`,green:`#008000`,blue:`#0000ff`,yellow:`#ffff00`,cyan:`#00ffff`,magenta:`#ff00ff`,gray:`#808080`,grey:`#808080`,silver:`#c0c0c0`,maroon:`#800000`,olive:`#808000`,purple:`#800080`,teal:`#008080`,navy:`#000080`,orange:`#ffa500`,transparent:`#00000000`};let eP=e=>{if(!e)return`#000000`;let t=e.trim().toLowerCase();if(t.startsWith(`#`))return t.length===4?`#`+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:t.length===5?`#`+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4]:t;if($N[t])return $N[t];let n=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)$/);if(n){let e=parseInt(n[1]),t=parseInt(n[2]),r=parseInt(n[3]),i=n[4]?parseFloat(n[4]):1,a=e=>{let t=Math.round(e).toString(16);return t.length===1?`0`+t:t},o=Math.round(i*255);return`#${a(e)}${a(t)}${a(r)}${a(o)}`}return`#000000`},tP=({color:e,onChange:t})=>{let n=(e=>eP(e))(e);return(0,r.jsxs)(W,{direction:`column`,gap:`3`,style:{width:`100%`},children:[(0,r.jsx)(QN,{color:n,onChange:t,style:{width:`100%`}}),(0,r.jsxs)(W,{gap:`2`,align:`center`,children:[(0,r.jsx)(U,{style:{width:32,height:32,backgroundColor:n,borderRadius:4,border:`1px solid var(--gray-5)`,flexShrink:0}}),(0,r.jsx)(X,{value:e,onChange:e=>t(e.target.value),onBlur:()=>{e&&/^[0-9A-Fa-f]{3,8}$/.test(e)&&t(`#`+e)},placeholder:`#RRGGBBAA`,style:{flexGrow:1}})]})]})},nP=({color:e,onChange:t,label:n})=>(0,r.jsxs)(Ay,{children:[(0,r.jsx)(jy,{children:(0,r.jsxs)(G,{variant:`surface`,color:`gray`,style:{width:`100%`,justifyContent:`flex-start`,padding:`0 8px`,height:32},children:[(0,r.jsx)(U,{style:{width:18,height:18,backgroundColor:e||`transparent`,borderRadius:2,border:`1px solid var(--gray-8)`,marginRight:8,backgroundImage:e===`transparent`?`linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)`:`none`,backgroundSize:`8px 8px`,backgroundPosition:`0 0, 0 4px, 4px -4px, -4px 0px`}}),(0,r.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n||e||`Transparente`})]})}),(0,r.jsx)(My,{style:{width:240},children:(0,r.jsx)(tP,{color:e,onChange:t})})]}),rP=({elementId:e})=>{let{state:t,updateElement:n}=rS(),i=t.elements.find(t=>t.id===e);return i?(0,r.jsx)(U,{pt:`2`,children:(0,r.jsxs)(sb,{defaultValue:`formatting`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`formatting`,style:{flex:1},children:`Formatação`}),(0,r.jsx)(lb,{value:`style`,style:{flex:1},children:`Estilo`}),(0,r.jsx)(lb,{value:`bindings`,style:{flex:1},children:`Vínculos`}),(0,r.jsx)(lb,{value:`conditional`,style:{flex:1},children:`Regras`}),(0,r.jsx)(lb,{value:`animation`,style:{flex:1},children:`Anim`})]}),(0,r.jsxs)(U,{pt:`3`,children:[(0,r.jsx)(ub,{value:`formatting`,children:(0,r.jsx)(aP,{element:i,updateElement:n})}),(0,r.jsx)(ub,{value:`style`,children:(0,r.jsx)(oP,{element:i,updateElement:n})}),(0,r.jsx)(ub,{value:`bindings`,children:(0,r.jsx)(mP,{element:i,updateElement:n,availableProps:t.availableProps||[]})}),(0,r.jsx)(ub,{value:`conditional`,children:(0,r.jsx)(hP,{element:i,updateElement:n,availableProps:t.availableProps||[]})}),(0,r.jsx)(ub,{value:`animation`,children:(0,r.jsx)(iP,{element:i,updateElement:n})})]})]})}):null},iP=({element:e,updateElement:t})=>{let n=e.animation||{type:`none`,duration:1,delay:0},i=r=>{t(e.id,{animation:{...n,...r}})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Tipo de Animação`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[n.type===`none`?`Nenhuma`:n.type===`slideIn`?`Slide In (Padrão)`:n.type===`fadeIn`?`Fade In`:n.type===`smoothSlideUp`?`Slide Suave (Up)`:n.type===`popIn`?`Pop In`:n.type===`blurIn`?`Blur In`:n.type===`slideInLeft`?`Slide In (Esquerda)`:n.type===`slideInRight`?`Slide In (Direita)`:n.type===`slideInUp`?`Slide In (Cima)`:n.type===`slideInDown`?`Slide In (Baixo)`:n.type===`zoomIn`?`Zoom In`:n.type===`bounceIn`?`Bounce In`:n.type===`pulse`?`Pulse (Atenção)`:n.type===`shake`?`Shake (Atenção)`:`Spin (Loop)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>i({type:`none`}),children:`Nenhuma`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideIn`}),children:`Slide In (Padrão)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`fadeIn`}),children:`Fade In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`smoothSlideUp`}),children:`Slide Suave (Up)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`popIn`}),children:`Pop In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`blurIn`}),children:`Blur In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInLeft`}),children:`Slide In (Esquerda)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInRight`}),children:`Slide In (Direita)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInUp`}),children:`Slide In (Cima)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInDown`}),children:`Slide In (Baixo)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`zoomIn`}),children:`Zoom In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`bounceIn`}),children:`Bounce In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`pulse`}),children:`Pulse (Atenção)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`shake`}),children:`Shake (Atenção)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`spin`}),children:`Spin (Loop)`})]})]})]}),n.type!==`none`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Duração (s)`}),(0,r.jsx)(X,{type:`number`,step:`0.1`,min:`0.1`,value:n.duration,onChange:e=>i({duration:parseFloat(e.target.value)||.5})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Atraso (s)`}),(0,r.jsx)(X,{type:`number`,step:`0.1`,min:`0`,value:n.delay,onChange:e=>i({delay:parseFloat(e.target.value)||0})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Curva de Tempo`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(n.timingFunction||`ease`)===`linear`?`Linear`:(n.timingFunction||`ease`)===`ease-in`?`Ease In`:(n.timingFunction||`ease`)===`ease-out`?`Ease Out`:(n.timingFunction||`ease`)===`ease-in-out`?`Ease In Out`:(n.timingFunction||`ease`)===`bounce`?`Bounce`:`Ease`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`linear`}),children:`Linear`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease`}),children:`Ease`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease-in`}),children:`Ease In`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease-out`}),children:`Ease Out`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease-in-out`}),children:`Ease In Out`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`bounce`}),children:`Bounce`})]})]})]}),[`pulse`,`shake`,`spin`].includes(n.type)&&(0,r.jsx)(U,{children:(0,r.jsxs)(W,{align:`center`,gap:`2`,mt:`2`,children:[(0,r.jsx)(ib,{checked:n.iterationCount===`infinite`,onCheckedChange:e=>i({iterationCount:e?`infinite`:1})}),(0,r.jsx)(H,{size:`2`,children:`Repetir Infinitamente`})]})})]})]})},aP=({element:e,updateElement:t})=>{let n=e.formatting||{type:`text`},i=r=>{t(e.id,{formatting:{...n,...r}})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(e.type===`text`||e.type===`text-container`)&&(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{align:`center`,gap:`2`,mb:`3`,children:[(0,r.jsx)(ib,{checked:e.autoGrow||!1,onCheckedChange:n=>t(e.id,{autoGrow:n})}),(0,r.jsx)(H,{size:`2`,children:e.type===`text-container`?`Expandir container automaticamente`:`Expandir altura automaticamente`})]}),e.type===`text-container`&&e.autoGrow&&(0,r.jsxs)(U,{mb:`3`,ml:`4`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Direção de Expansão`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(e.containerExpansion||`vertical`)===`vertical`?`Vertical (Altura Cresce)`:`Horizontal (Largura Cresce)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>t(e.id,{containerExpansion:`vertical`}),children:`Vertical (Altura Cresce)`}),(0,r.jsx)(q,{onSelect:()=>t(e.id,{containerExpansion:`horizontal`}),children:`Horizontal (Largura Cresce)`})]})]})]}),(0,r.jsx)(Qy,{size:`4`,mb:`2`})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Tipo de Formatação`}),(0,r.jsxs)(Wy,{value:n.type,onValueChange:e=>i({type:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`text`,children:`Texto (Padrão)`}),(0,r.jsx)(Y,{value:`boolean`,children:`Booleano (Sim/Não)`}),(0,r.jsx)(Y,{value:`date`,children:`Data`}),(0,r.jsx)(Y,{value:`number`,children:`Número / Moeda`})]})]})]}),n.type===`boolean`&&(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Texto para Verdadeiro`}),(0,r.jsx)(X,{placeholder:`Ex: Sim`,value:n.trueLabel||``,onChange:e=>i({trueLabel:e.target.value})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Texto para Falso`}),(0,r.jsx)(X,{placeholder:`Ex: Não`,value:n.falseLabel||``,onChange:e=>i({falseLabel:e.target.value})})]})]}),n.type===`date`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Formato da Data`}),(0,r.jsx)(X,{placeholder:`Ex: DD/MM/YYYY`,value:n.dateFormat||``,onChange:e=>i({dateFormat:e.target.value})}),(0,r.jsx)(H,{size:`1`,color:`gray`,mt:`1`,style:{fontSize:10},children:`Use DD, MM, YYYY, HH, mm, ss.`})]}),n.type===`number`&&(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Estilo`}),(0,r.jsxs)(Wy,{value:n.numberFormat||`decimal`,onValueChange:e=>i({numberFormat:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`decimal`,children:`Decimal`}),(0,r.jsx)(Y,{value:`currency`,children:`Moeda`}),(0,r.jsx)(Y,{value:`percent`,children:`Porcentagem`})]})]})]}),n.numberFormat===`currency`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Símbolo da Moeda`}),(0,r.jsx)(X,{placeholder:`Ex: R$`,value:n.currencySymbol||``,onChange:e=>i({currencySymbol:e.target.value})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Casas Decimais`}),(0,r.jsx)(X,{type:`number`,placeholder:`2`,value:n.decimalPlaces===void 0?``:n.decimalPlaces,onChange:e=>i({decimalPlaces:parseInt(e.target.value)||0})})]})]})]})},oP=({element:e,updateElement:n})=>{let i=e.style||{},[a,o]=(0,t.useState)(i.borderTopLeftRadius!==void 0||i.borderTopRightRadius!==void 0||i.borderBottomRightRadius!==void 0||i.borderBottomLeftRadius!==void 0),s=t=>{n(e.id,{style:{...i,...t}})},c=(e,t)=>{let n=typeof e==`number`?e:parseInt(e)||0;s({[t]:`${n}px`})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{align:`center`,justify:`between`,mb:`2`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Arredondamento`}),(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(H,{size:`1`,children:`Individual`}),(0,r.jsx)(ib,{checked:a,onCheckedChange:e=>{if(o(e),!e)s({borderRadius:i.borderTopLeftRadius||i.borderRadius||0,borderTopLeftRadius:void 0,borderTopRightRadius:void 0,borderBottomRightRadius:void 0,borderBottomLeftRadius:void 0});else{let e=i.borderRadius||0;s({borderRadius:void 0,borderTopLeftRadius:e,borderTopRightRadius:e,borderBottomRightRadius:e,borderBottomLeftRadius:e})}}})]})]}),a?(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Sup. Esq.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderTopLeftRadius)||0,onChange:e=>c(e.target.value,`borderTopLeftRadius`)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Sup. Dir.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderTopRightRadius)||0,onChange:e=>c(e.target.value,`borderTopRightRadius`)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Inf. Esq.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderBottomLeftRadius)||0,onChange:e=>c(e.target.value,`borderBottomLeftRadius`)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Inf. Dir.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderBottomRightRadius)||0,onChange:e=>c(e.target.value,`borderBottomRightRadius`)})]})]}):(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Raio (Todos os cantos)`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderRadius)||0,onChange:e=>s({borderRadius:`${parseInt(e.target.value)||0}px`})})]})]}),(0,r.jsx)(Qy,{size:`4`,my:`2`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,children:`Espaçamento Interno`}),(0,r.jsx)(K,{columns:`2`,gap:`3`,children:(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Tamanho (px)`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.padding)||0,onChange:e=>s({padding:`${parseInt(e.target.value)||0}px`})})]})})]}),(0,r.jsx)(Qy,{size:`4`,my:`2`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,children:`Sombra (Box Shadow)`}),(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Cor`}),(0,r.jsx)(nP,{color:sP(i.boxShadow),onChange:e=>s({boxShadow:uP(i.boxShadow,e)})})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Blur (px)`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:cP(i.boxShadow),onChange:e=>s({boxShadow:dP(i.boxShadow,parseInt(e.target.value)||0)})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Spread (px)`}),(0,r.jsx)(X,{type:`number`,value:lP(i.boxShadow),onChange:e=>s({boxShadow:fP(i.boxShadow,parseInt(e.target.value)||0)})})]})]}),(0,r.jsx)(G,{variant:`soft`,color:`gray`,size:`1`,onClick:()=>s({boxShadow:i.boxShadow?void 0:`0 4px 12px 0 rgba(0,0,0,0.15)`}),children:i.boxShadow?`Remover Sombra`:`Adicionar Sombra`})]})]})]})};var sP=e=>{if(!e||e===`none`)return`#0000001a`;let t=e.match(/(?:rgba?\([^)]+\)|#[0-9a-fA-F]{3,8}|[a-zA-Z]+)\s*$/);return t?t[0].trim():`#0000001a`},cP=e=>{if(!e||e===`none`)return 12;let t=e.match(/(-?\d+(?:\.\d+)?)(?:px)?/g);return t&&t.length>=3?parseFloat(t[2]):12},lP=e=>{if(!e||e===`none`)return 0;let t=e.match(/(-?\d+(?:\.\d+)?)(?:px)?/g);return t&&t.length>=4?parseFloat(t[3]):0},uP=(e,t)=>{let n=cP(e),r=lP(e);return`${e?.includes(`inset`)?`inset `:``}0px 4px ${n}px ${r}px ${t}`},dP=(e,t)=>{let n=(e||`0 4px 12px 0 #0000001a`).match(/(-?\d+(?:\.\d+)?)(?:px)?/g)||[`0`,`4`,`12`,`0`],r=sP(e);return`${e?.includes(`inset`)?`inset `:``}${n[0]||0}px ${n[1]||4}px ${t}px ${n[3]||0}px ${r}`},fP=(e,t)=>{let n=(e||`0 4px 12px 0 #0000001a`).match(/(-?\d+(?:\.\d+)?)(?:px)?/g)||[`0`,`4`,`12`,`0`],r=sP(e);return`${e?.includes(`inset`)?`inset `:``}${n[0]||0}px ${n[1]||4}px ${n[2]||12}px ${t}px ${r}`},pP=[{key:`color`,label:`Cor do texto`},{key:`backgroundColor`,label:`Cor de fundo`},{key:`borderColor`,label:`Cor da borda`},{key:`boxShadowColor`,label:`Cor da sombra`}];let mP=({element:e,updateElement:t,availableProps:n})=>{let i=e.styleBindings||{},a=(n,r)=>{let a={...i};r?a[n]=r:delete a[n],t(e.id,{styleBindings:Object.keys(a).length>0?a:void 0})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Vínculos de Estilo (Data Binding)`}),(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`2`,children:`Vincule propriedades de estilo a variáveis de dados. O valor da variável será aplicado em tempo real (ex.: cores em formato #RRGGBB, rgba(), etc.).`}),pP.map(({key:e,label:t})=>(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:t}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`},children:[i[e]?n.find(t=>t.dataName===i[e])?.name||i[e]:`Nenhum`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>a(e,null),children:`Nenhum`}),n.map(t=>(0,r.jsx)(q,{onSelect:()=>a(e,t.dataName),children:t.name},t.dataName)),n.length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhuma variável disponível`})]})]})]},e))]})},hP=({element:e,updateElement:t,availableProps:n})=>{let i=e.conditions||[],a=()=>{let r={id:crypto.randomUUID(),property:n.length>0?n[0].dataName:``,operator:`equals`,value:``,style:{color:`#ff0000`}};t(e.id,{conditions:[...i,r]})},o=n=>{t(e.id,{conditions:i.filter(e=>e.id!==n)})},s=(n,r)=>{t(e.id,{conditions:i.map(e=>e.id===n?{...e,...r}:e)})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsx)(H,{size:`2`,color:`gray`,children:`Regras de Exibição`}),(0,r.jsxs)(G,{size:`1`,variant:`soft`,onClick:a,children:[(0,r.jsx)(mt,{}),` Nova Regra`]})]}),i.length===0?(0,r.jsx)(H,{size:`1`,color:`gray`,style:{fontStyle:`italic`},children:`Nenhuma regra condicional definida.`}):(0,r.jsx)(W,{direction:`column`,gap:`2`,children:i.map(e=>(0,r.jsxs)(U,{style:{border:`1px solid var(--gray-6)`,borderRadius:4,padding:8},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,mb:`2`,children:[(0,r.jsxs)(H,{size:`1`,weight:`bold`,children:[`Se `,e.property,`...`]}),(0,r.jsx)(J,{size:`1`,color:`red`,variant:`ghost`,onClick:()=>o(e.id),children:(0,r.jsx)(Xt,{})})]}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,mb:`2`,children:[(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`},children:[n.find(t=>t.dataName===e.property)?.name||e.property||`Propriedade`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[n.map(t=>(0,r.jsx)(q,{onSelect:()=>s(e.id,{property:t.dataName}),children:t.name},t.dataName)),n.length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhuma variável disponível`})]})]}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`},children:[e.operator===`equals`?`Igual a`:e.operator===`notEquals`?`Diferente de`:e.operator===`contains`?`Contém`:e.operator===`greaterThan`?`Maior que`:`Menor que`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`equals`}),children:`Igual a`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`notEquals`}),children:`Diferente de`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`contains`}),children:`Contém`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`greaterThan`}),children:`Maior que`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`lessThan`}),children:`Menor que`})]})]})]}),(0,r.jsx)(X,{size:`1`,placeholder:`Valor`,value:e.value,onChange:t=>s(e.id,{value:t.target.value})}),(0,r.jsxs)(U,{mt:`2`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor quando verdadeiro`}),(0,r.jsx)(nP,{color:e.style?.color||`#ff0000`,onChange:t=>s(e.id,{style:{...e.style,color:t}})})]})]},e.id))})]})};var gP=({title:e,isOpen:t,onToggle:n,children:i,onReset:a})=>(0,r.jsxs)(U,{style:{borderBottom:`1px solid var(--gray-4)`},children:[(0,r.jsxs)(W,{align:`center`,style:{width:`100%`},children:[(0,r.jsxs)(G,{variant:`ghost`,onClick:n,style:{flex:1,justifyContent:`space-between`,padding:`12px 8px`,borderRadius:0,height:`auto`,cursor:`pointer`,color:`var(--gray-12)`},children:[(0,r.jsx)(H,{weight:`bold`,size:`2`,children:e}),t?(0,r.jsx)(fe,{}):(0,r.jsx)(me,{})]}),a&&t&&(0,r.jsx)(bb,{content:`Resetar para padrão`,children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:e=>{e.stopPropagation(),a()},style:{marginRight:8},children:(0,r.jsx)(vt,{})})})]}),t&&(0,r.jsx)(U,{p:`3`,style:{backgroundColor:`var(--gray-2)`},children:i})]}),_P=`__`,vP=({value:e,onChange:n,units:i=[`px`,`%`,`em`,`rem`,`vw`,`vh`],min:a,max:o,placeholder:s,label:c})=>{let l=e=>e===``?_P:e,u=e=>e===_P?``:e,d=e=>{if(e==null||e===``)return{num:``,unit:i[0]};let t=String(e).match(/^(-?[\d.]+)([a-z%]+)?$/i);return t?{num:t[1],unit:t[2]||i[0]}:{num:``,unit:i[0]}},[f,p]=(0,t.useState)(d(e));(0,t.useEffect)(()=>{p(d(e))},[e]);let m=(e,t)=>{if(e===``){n(``);return}n(`${e}${t}`)};return(0,r.jsxs)(U,{children:[c&&(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:c}),(0,r.jsxs)(W,{children:[(0,r.jsx)(X,{type:`number`,value:f.num,onChange:e=>{let t=e.target.value;p({...f,num:t}),m(t,f.unit)},placeholder:s,style:{borderTopRightRadius:0,borderBottomRightRadius:0,flex:1},min:a,max:o}),(0,r.jsxs)(Wy,{value:l(f.unit),onValueChange:e=>{let t=u(e);p({...f,unit:t}),m(f.num,t)},children:[(0,r.jsx)(Gy,{style:{width:60,borderTopLeftRadius:0,borderBottomLeftRadius:0,marginLeft:-1}}),(0,r.jsx)(Ky,{children:i.map(e=>(0,r.jsx)(Y,{value:l(e),children:e||s||`—`},e||_P))})]})]})]})},yP=({values:e,onChange:n,label:i})=>{let[a,o]=(0,t.useState)(!0),s=e=>{n({top:e,right:e,bottom:e,left:e})},c=(t,r)=>{n({...e,[t]:r})};return(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,mb:`1`,children:[i&&(0,r.jsx)(H,{size:`1`,color:`gray`,children:i}),(0,r.jsx)(bb,{content:a?`Desvincular lados`:`Vincular lados`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:a?`blue`:`gray`,onClick:()=>o(!a),children:a?(0,r.jsx)(bP,{}):(0,r.jsx)(xP,{})})})]}),a?(0,r.jsx)(vP,{value:e.top||``,onChange:s,placeholder:`Todos`}):(0,r.jsxs)(K,{columns:`2`,gap:`2`,children:[(0,r.jsx)(vP,{value:e.top,onChange:e=>c(`top`,e),label:`Top`}),(0,r.jsx)(vP,{value:e.right,onChange:e=>c(`right`,e),label:`Right`}),(0,r.jsx)(vP,{value:e.bottom,onChange:e=>c(`bottom`,e),label:`Bottom`}),(0,r.jsx)(vP,{value:e.left,onChange:e=>c(`left`,e),label:`Left`})]})]})},bP=()=>(0,r.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,r.jsx)(`path`,{d:`M4.5 6.5L1.35355 9.64645C0.908293 10.0917 0.908293 10.8134 1.35355 11.2587L3.74132 13.6464C4.18658 14.0917 4.90829 14.0917 5.35355 13.6464L8.5 10.5M10.5 8.5L13.6464 5.35355C14.0917 4.90829 14.0917 4.18658 13.6464 3.74132L11.2587 1.35355C10.8134 0.908293 10.0917 0.908293 9.64645 1.35355L6.5 4.5M6.5 8.5H8.5`,stroke:`currentColor`})}),xP=()=>(0,r.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,r.jsx)(`path`,{d:`M4.5 6.5L1.35355 9.64645C0.908293 10.0917 0.908293 10.8134 1.35355 11.2587L3.74132 13.6464C4.18658 14.0917 4.90829 14.0917 5.35355 13.6464L8.5 10.5M10.5 8.5L13.6464 5.35355C14.0917 4.90829 14.0917 4.18658 13.6464 3.74132L11.2587 1.35355C10.8134 0.908293 10.0917 0.908293 9.64645 1.35355L6.5 4.5`,stroke:`currentColor`})});let SP=()=>{let{state:e,setPropertiesPanelOpen:n,updateElement:i,updateElements:a,removeSelected:o,copy:s,paste:c,addElement:l}=rS(),{isPropertiesPanelOpen:u,selectedElementIds:d,elements:f}=e,p=(0,t.useMemo)(()=>f.filter(e=>d.includes(e.id)),[f,d]),m=p[0],h=p.length>1,[g,_]=(0,t.useState)({content:!0,layout:!0,typography:!0,appearance:!1,borders:!1,effects:!1,transform:!1,animation:!1,conditions:!1,formatting:!1,spacing:!1}),[v,y]=(0,t.useState)(``),[b,x]=(0,t.useState)({});(0,t.useEffect)(()=>{let e=localStorage.getItem(`editor-presets`);if(e)try{x(JSON.parse(e))}catch(e){console.error(`Failed to load presets`,e)}},[]);let S=e=>{if(!m)return;let t={...b,[e]:{style:m.style}};x(t),localStorage.setItem(`editor-presets`,JSON.stringify(t))},C=e=>{let t=b[e];t&&t.style&&D(t.style)};if(!u||!m)return null;let w=e=>{_(t=>({...t,[e]:!t[e]}))},T=e=>{h?a(d.map(t=>({id:t,changes:e}))):i(m.id,e)},E=()=>{if(h)s(),c();else{let{id:e,...t}=m;l({...t,x:m.x+20,y:m.y+20})}},D=e=>{h?a(p.map(t=>({id:t.id,changes:{style:{...t.style,...e}}}))):i(m.id,{style:{...m.style,...e}})},O=e=>{let t={};e.forEach(e=>t[e]=void 0),D(t)},k=(e,t)=>{if(!v)return!0;let n=v.toLowerCase();return e.toLowerCase().includes(n)||t.some(e=>e.toLowerCase().includes(n))},A=e=>{if(!h)return e(m);let t=e(m);return p.every(n=>e(n)===t)?t:`Mixed`},j=(e,t=``)=>{let n=A(t=>t.style?.[e]);return n===`Mixed`?`Mixed`:n===void 0?t:n},M=String(j(`fontFamily`,`Arial`)),N=AS(M,e.availableFonts||[`Arial`]),P=()=>{let e=j(`fontWeight`,`normal`);return e===`Mixed`?`400`:kS(e,OS)},F=e=>{let t={x:0,y:4,blur:12,spread:0,color:`#0000001a`,inset:!1};if(!e||e===`none`)return t;let n=e.trim(),r=n.includes(`inset`),i=n.replace(`inset`,``).trim(),a=i.match(/(-?\d+(?:\.\d+)?)(?:px)?\s+(-?\d+(?:\.\d+)?)(?:px)?(?:\s+(\d+(?:\.\d+)?)(?:px)?)?(?:\s+(\d+(?:\.\d+)?)(?:px)?)?/);return a?{x:parseFloat(a[1]),y:parseFloat(a[2]),blur:a[3]?parseFloat(a[3]):0,spread:a[4]?parseFloat(a[4]):0,color:i.replace(a[0],``).trim()||t.color,inset:r}:t},I=F(m.style?.boxShadow),re=e=>{let t={...I,...e};D({boxShadow:`${t.inset?`inset `:``}${t.x}px ${t.y}px ${t.blur}px ${t.spread}px ${t.color}`})};return(0,r.jsx)(ny,{open:u,onOpenChange:n,children:(0,r.jsxs)(iy,{style:{maxWidth:500,width:`100%`,maxHeight:`85vh`,height:`100%`,padding:0,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,r.jsxs)(U,{style:{borderBottom:`1px solid var(--gray-4)`},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,p:`4`,pb:`2`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(ay,{style:{margin:0},children:`Propriedades`}),(0,r.jsx)(oy,{size:`1`,color:`gray`,children:h?`${p.length} selecionados`:m.name||`Elemento`})]}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,children:(0,r.jsx)(ee,{})})}),(0,r.jsxs)(fy,{children:[(0,r.jsx)(py,{children:`Presets`}),Object.keys(b).length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhum preset salvo`}),Object.keys(b).map(e=>(0,r.jsx)(q,{onSelect:t=>{t.preventDefault(),C(e)},onClick:()=>C(e),style:{cursor:`pointer`},children:e},e)),(0,r.jsx)(xy,{}),(0,r.jsxs)(q,{onSelect:e=>{e.preventDefault();let t=prompt(`Nome do novo preset:`);t&&S(t)},children:[(0,r.jsx)(mt,{style:{marginRight:8}}),` Salvar Atual`]})]})]}),(0,r.jsx)(sy,{children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,children:(0,r.jsx)(Ee,{})})})]})]}),(0,r.jsxs)(W,{gap:`2`,px:`4`,pb:`3`,children:[(0,r.jsx)(bb,{content:`Bloquear`,children:(0,r.jsx)(J,{variant:`soft`,color:m.locked?`orange`:`gray`,onClick:()=>T({locked:!m.locked}),children:m.locked?(0,r.jsx)(et,{}):(0,r.jsx)(nt,{})})}),(0,r.jsx)(bb,{content:`Ocultar`,children:(0,r.jsx)(J,{variant:`soft`,color:m.hidden?`blue`:`gray`,onClick:()=>T({hidden:!m.hidden}),children:m.hidden?(0,r.jsx)(Be,{}):(0,r.jsx)(He,{})})}),(0,r.jsx)(bb,{content:`Duplicar`,children:(0,r.jsx)(J,{variant:`soft`,color:`gray`,onClick:E,children:(0,r.jsx)(we,{})})}),(0,r.jsx)(U,{style:{flex:1}}),(0,r.jsx)(bb,{content:`Excluir`,children:(0,r.jsx)(J,{variant:`soft`,color:`red`,onClick:()=>{o(),n(!1)},children:(0,r.jsx)(Xt,{})})})]})]}),(0,r.jsx)(U,{p:`3`,style:{borderBottom:`1px solid var(--gray-4)`,backgroundColor:`var(--gray-1)`},children:(0,r.jsx)(X,{placeholder:`Buscar...`,value:v,onChange:e=>y(e.target.value),children:(0,r.jsx)(_b,{children:(0,r.jsx)(ot,{height:`16`,width:`16`})})})}),(0,r.jsxs)(U,{style:{flex:1,overflowY:`auto`,overflowX:`hidden`},children:[k(`Conteúdo`,[`text`,`image`,`url`,`value`,`content`])&&(m.type===`text`||m.type===`text-container`||m.type===`image`)&&(0,r.jsx)(gP,{title:`Conteúdo`,isOpen:g.content,onToggle:()=>w(`content`),children:(0,r.jsxs)(U,{children:[(m.type===`text`||m.type===`text-container`)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Texto`}),(0,r.jsx)(pb,{value:m.content||``,onChange:e=>T({content:e.target.value}),rows:4,placeholder:`Texto ou {{variavel}}...`})]}),m.type===`image`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Vínculo de Propriedade`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`,marginBottom:8},children:[m.dataBinding?e.availableProps.find(e=>e.dataName===m.dataBinding)?.name||m.dataBinding:`Nenhum (URL fixa)`,(0,r.jsx)(fe,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>T({dataBinding:void 0}),children:`Nenhum (URL fixa)`}),(e.availableProps||[]).map(e=>(0,r.jsx)(q,{onSelect:()=>T({dataBinding:e.dataName,content:`{{${e.dataName}}}`}),children:e.name},e.dataName))]})]}),(0,r.jsxs)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:[`URL ou `,`{{variável}}`]}),(0,r.jsx)(X,{value:m.content||``,onChange:e=>T({content:e.target.value}),placeholder:`https://... ou {{profilePicture}}`})]})]})}),k(`Tipografia`,[`font`,`text`,`color`,`align`,`size`,`weight`,`transform`,`decoration`])&&(0,r.jsx)(gP,{title:`Tipografia`,isOpen:g.typography,onToggle:()=>w(`typography`),onReset:()=>O([`fontFamily`,`fontSize`,`fontWeight`,`color`,`textAlign`,`fontStyle`,`textDecoration`,`textTransform`,`lineHeight`,`letterSpacing`]),children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Família da Fonte`}),(0,r.jsxs)(Wy,{value:M,onValueChange:e=>D({fontFamily:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`},placeholder:`Selecione...`}),(0,r.jsx)(Ky,{style:{zIndex:1e5},children:N.map(e=>(0,r.jsx)(Y,{value:e,children:e},e))})]})]}),(0,r.jsx)(vP,{label:`Tamanho`,value:j(`fontSize`,`16px`),onChange:e=>D({fontSize:e})}),(0,r.jsx)(vP,{label:`Altura da Linha`,value:j(`lineHeight`,`normal`),onChange:e=>D({lineHeight:e}),units:[``,`px`,`em`,`%`],placeholder:`Normal`}),(0,r.jsx)(vP,{label:`Espaçamento`,value:j(`letterSpacing`,`normal`),onChange:e=>D({letterSpacing:e}),units:[`px`,`em`],placeholder:`Normal`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Peso`}),(0,r.jsxs)(Wy,{value:P(),onValueChange:e=>D({fontWeight:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`},placeholder:`Normal`}),(0,r.jsxs)(Ky,{style:{zIndex:1e5},children:[(0,r.jsx)(Y,{value:`100`,children:`100 - Thin`}),(0,r.jsx)(Y,{value:`300`,children:`300 - Light`}),(0,r.jsx)(Y,{value:`400`,children:`400 - Normal`}),(0,r.jsx)(Y,{value:`500`,children:`500 - Medium`}),(0,r.jsx)(Y,{value:`600`,children:`600 - Semi Bold`}),(0,r.jsx)(Y,{value:`700`,children:`700 - Bold`}),(0,r.jsx)(Y,{value:`900`,children:`900 - Black`}),(0,r.jsx)(Y,{value:`normal`,children:`Normal`}),(0,r.jsx)(Y,{value:`bold`,children:`Bold`})]})]})]}),(0,r.jsx)(U,{style:{gridColumn:`span 2`},children:(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Estilo`}),(0,r.jsxs)(W,{gap:`1`,children:[(0,r.jsx)(J,{variant:j(`fontStyle`)===`italic`?`solid`:`soft`,onClick:()=>D({fontStyle:j(`fontStyle`)===`italic`?`normal`:`italic`}),children:(0,r.jsx)(Ke,{})}),(0,r.jsx)(J,{variant:j(`textDecoration`)===`underline`?`solid`:`soft`,onClick:()=>D({textDecoration:j(`textDecoration`)===`underline`?`none`:`underline`}),children:(0,r.jsx)(Qt,{})}),(0,r.jsx)(J,{variant:j(`textDecoration`)===`line-through`?`solid`:`soft`,onClick:()=>D({textDecoration:j(`textDecoration`)===`line-through`?`none`:`line-through`}),children:(0,r.jsx)(Pt,{})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Transformação`}),(0,r.jsxs)(Wy,{value:j(`textTransform`,`none`),onValueChange:e=>D({textTransform:e}),children:[(0,r.jsx)(Gy,{style:{width:100}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`none`,children:`Nenhum`}),(0,r.jsx)(Y,{value:`uppercase`,children:`MAIÚSCULA`}),(0,r.jsx)(Y,{value:`lowercase`,children:`minúscula`}),(0,r.jsx)(Y,{value:`capitalize`,children:`Capitalizada`})]})]})]})]})}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Alinhamento`}),(0,r.jsxs)(Ly,{value:j(`textAlign`,`left`),onValueChange:e=>D({textAlign:e}),children:[(0,r.jsx)(Ry,{value:`left`,children:(0,r.jsx)(Wt,{})}),(0,r.jsx)(Ry,{value:`center`,children:(0,r.jsx)(Bt,{})}),(0,r.jsx)(Ry,{value:`right`,children:(0,r.jsx)(Kt,{})}),(0,r.jsx)(Ry,{value:`justify`,children:(0,r.jsx)(Ht,{})})]})]}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor do Texto`}),(0,r.jsx)(nP,{color:j(`color`,`#000000`),onChange:e=>D({color:e})})]})]})}),k(`Aparência`,[`background`,`opacity`,`blend`,`cursor`])&&(0,r.jsxs)(gP,{title:`Aparência`,isOpen:g.appearance,onToggle:()=>w(`appearance`),onReset:()=>O([`backgroundColor`,`backgroundImage`,`backgroundSize`,`opacity`,`mixBlendMode`,`cursor`]),children:[(0,r.jsxs)(sb,{defaultValue:`solid`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`solid`,children:`Sólido`}),(0,r.jsx)(lb,{value:`gradient`,children:`Gradiente`}),(0,r.jsx)(lb,{value:`image`,children:`Imagem`})]}),(0,r.jsxs)(U,{pt:`3`,children:[(0,r.jsxs)(ub,{value:`solid`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor de Fundo`}),(0,r.jsx)(nP,{color:j(`backgroundColor`,`transparent`),onChange:e=>D({backgroundColor:e,backgroundImage:`none`})})]}),(0,r.jsxs)(ub,{value:`gradient`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`CSS Gradient`}),(0,r.jsx)(pb,{value:j(`backgroundImage`,``),onChange:e=>D({backgroundImage:e.target.value}),placeholder:`linear-gradient(to right, red, blue)`,rows:3})]}),(0,r.jsxs)(ub,{value:`image`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`URL da Imagem`}),(0,r.jsx)(X,{value:j(`backgroundImage`,``).replace(/url\(['"]?(.*?)['"]?\)/,`$1`),onChange:e=>D({backgroundImage:`url('${e.target.value}')`}),placeholder:`https://...`,mb:`2`}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Tamanho`}),(0,r.jsxs)(Wy,{value:j(`backgroundSize`,`auto`),onValueChange:e=>D({backgroundSize:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`auto`,children:`Auto`}),(0,r.jsx)(Y,{value:`cover`,children:`Cobrir (Cover)`}),(0,r.jsx)(Y,{value:`contain`,children:`Conter (Contain)`}),(0,r.jsx)(Y,{value:`100% 100%`,children:`Esticar`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Repetição`}),(0,r.jsxs)(Wy,{value:j(`backgroundRepeat`,`repeat`),onValueChange:e=>D({backgroundRepeat:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`repeat`,children:`Repetir`}),(0,r.jsx)(Y,{value:`no-repeat`,children:`Não Repetir`}),(0,r.jsx)(Y,{value:`repeat-x`,children:`Horizontal`}),(0,r.jsx)(Y,{value:`repeat-y`,children:`Vertical`})]})]})]})]})]})]})]}),(0,r.jsxs)(U,{mt:`3`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Opacidade`}),(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(tb,{min:0,max:1,step:.05,value:[parseFloat(j(`opacity`,`1`))],onValueChange:([e])=>D({opacity:e}),style:{flex:1}}),(0,r.jsxs)(H,{size:`1`,children:[Math.round(parseFloat(j(`opacity`,`1`))*100),`%`]})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,mt:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Blend Mode`}),(0,r.jsxs)(Wy,{value:j(`mixBlendMode`,`normal`),onValueChange:e=>D({mixBlendMode:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`normal`,children:`Normal`}),(0,r.jsx)(Y,{value:`multiply`,children:`Multiply`}),(0,r.jsx)(Y,{value:`screen`,children:`Screen`}),(0,r.jsx)(Y,{value:`overlay`,children:`Overlay`}),(0,r.jsx)(Y,{value:`darken`,children:`Darken`}),(0,r.jsx)(Y,{value:`lighten`,children:`Lighten`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cursor`}),(0,r.jsxs)(Wy,{value:j(`cursor`,`auto`),onValueChange:e=>D({cursor:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`auto`,children:`Auto`}),(0,r.jsx)(Y,{value:`default`,children:`Padrão`}),(0,r.jsx)(Y,{value:`pointer`,children:`Mãozinha`}),(0,r.jsx)(Y,{value:`text`,children:`Texto`}),(0,r.jsx)(Y,{value:`move`,children:`Mover`}),(0,r.jsx)(Y,{value:`not-allowed`,children:`Bloqueado`})]})]})]})]})]}),k(`Layout`,[`width`,`height`,`x`,`y`,`z-index`,`overflow`])&&(0,r.jsx)(gP,{title:`Layout & Dimensões`,isOpen:g.layout,onToggle:()=>w(`layout`),onReset:()=>T({width:100,height:100,x:0,y:0,style:{...m.style,zIndex:void 0,overflow:void 0}}),children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsx)(vP,{label:`Largura`,value:m.width,onChange:e=>T({width:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(vP,{label:`Altura`,value:m.height,onChange:e=>T({height:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(vP,{label:`Posição X`,value:m.x,onChange:e=>T({x:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(vP,{label:`Posição Y`,value:m.y,onChange:e=>T({y:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(vP,{label:`Z-Index`,value:j(`zIndex`,`auto`),onChange:e=>D({zIndex:e===``?void 0:parseInt(e)}),units:[``],placeholder:`Auto`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Overflow`}),(0,r.jsxs)(Wy,{value:j(`overflow`,`visible`),onValueChange:e=>D({overflow:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`visible`,children:`Visível`}),(0,r.jsx)(Y,{value:`hidden`,children:`Oculto`}),(0,r.jsx)(Y,{value:`scroll`,children:`Scroll`}),(0,r.jsx)(Y,{value:`auto`,children:`Auto`})]})]})]})]})}),k(`Espaçamento`,[`padding`,`margin`])&&(0,r.jsxs)(gP,{title:`Espaçamento (Margin/Padding)`,isOpen:g.spacing,onToggle:()=>w(`spacing`),onReset:()=>O([`padding`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`,`margin`,`marginTop`,`marginRight`,`marginBottom`,`marginLeft`]),children:[(0,r.jsx)(U,{mb:`3`,children:(0,r.jsx)(yP,{label:`Padding (Interno)`,values:{top:j(`paddingTop`,j(`padding`)),right:j(`paddingRight`,j(`padding`)),bottom:j(`paddingBottom`,j(`padding`)),left:j(`paddingLeft`,j(`padding`))},onChange:e=>{e.top===e.right&&e.right===e.bottom&&e.bottom===e.left?D({padding:e.top,paddingTop:void 0,paddingRight:void 0,paddingBottom:void 0,paddingLeft:void 0}):D({padding:void 0,paddingTop:e.top,paddingRight:e.right,paddingBottom:e.bottom,paddingLeft:e.left})}})}),(0,r.jsx)(U,{children:(0,r.jsx)(yP,{label:`Margin (Externo)`,values:{top:j(`marginTop`,j(`margin`)),right:j(`marginRight`,j(`margin`)),bottom:j(`marginBottom`,j(`margin`)),left:j(`marginLeft`,j(`margin`))},onChange:e=>{e.top===e.right&&e.right===e.bottom&&e.bottom===e.left?D({margin:e.top,marginTop:void 0,marginRight:void 0,marginBottom:void 0,marginLeft:void 0}):D({margin:void 0,marginTop:e.top,marginRight:e.right,marginBottom:e.bottom,marginLeft:e.left})}})})]}),k(`Bordas`,[`border`,`radius`,`stroke`])&&(0,r.jsxs)(gP,{title:`Bordas & Cantos`,isOpen:g.borders,onToggle:()=>w(`borders`),onReset:()=>O([`border`,`borderWidth`,`borderStyle`,`borderColor`,`borderRadius`,`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`]),children:[(0,r.jsxs)(sb,{defaultValue:`all`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`all`,children:(0,r.jsx)(te,{})}),(0,r.jsx)(lb,{value:`top`,children:(0,r.jsx)(ce,{})}),(0,r.jsx)(lb,{value:`right`,children:(0,r.jsx)(oe,{})}),(0,r.jsx)(lb,{value:`bottom`,children:(0,r.jsx)(ne,{})}),(0,r.jsx)(lb,{value:`left`,children:(0,r.jsx)(ie,{})})]}),(0,r.jsx)(U,{pt:`3`,children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Estilo`}),(0,r.jsxs)(Wy,{value:j(`borderStyle`,`none`),onValueChange:e=>D({borderStyle:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`none`,children:`Nenhuma`}),(0,r.jsx)(Y,{value:`solid`,children:`Sólida`}),(0,r.jsx)(Y,{value:`dashed`,children:`Tracejada`}),(0,r.jsx)(Y,{value:`dotted`,children:`Pontilhada`}),(0,r.jsx)(Y,{value:`double`,children:`Dupla`})]})]})]}),(0,r.jsx)(vP,{label:`Espessura`,value:j(`borderWidth`,`0px`),onChange:e=>D({borderWidth:e})}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor`}),(0,r.jsx)(nP,{color:j(`borderColor`,`#000000`),onChange:e=>D({borderColor:e})})]})]})})]}),(0,r.jsx)(U,{mt:`3`,children:(0,r.jsx)(yP,{label:`Arredondamento (Radius)`,values:{top:j(`borderTopLeftRadius`,j(`borderRadius`)),right:j(`borderTopRightRadius`,j(`borderRadius`)),bottom:j(`borderBottomRightRadius`,j(`borderRadius`)),left:j(`borderBottomLeftRadius`,j(`borderRadius`))},onChange:e=>{e.top===e.right&&e.right===e.bottom&&e.bottom===e.left?D({borderRadius:e.top,borderTopLeftRadius:void 0,borderTopRightRadius:void 0,borderBottomRightRadius:void 0,borderBottomLeftRadius:void 0}):D({borderRadius:void 0,borderTopLeftRadius:e.top,borderTopRightRadius:e.right,borderBottomRightRadius:e.bottom,borderBottomLeftRadius:e.left})}})})]}),k(`Efeitos`,[`shadow`,`sombra`])&&(0,r.jsx)(gP,{title:`Efeitos (Sombra)`,isOpen:g.effects,onToggle:()=>w(`effects`),onReset:()=>O([`boxShadow`,`textShadow`]),children:(0,r.jsxs)(sb,{defaultValue:`box`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`box`,children:`Box Shadow`}),(0,r.jsx)(lb,{value:`text`,children:`Text Shadow`})]}),(0,r.jsxs)(U,{pt:`3`,children:[(0,r.jsx)(ub,{value:`box`,children:(0,r.jsxs)(U,{p:`2`,style:{backgroundColor:`var(--gray-3)`,borderRadius:`var(--radius-2)`},children:[(0,r.jsxs)(W,{justify:`between`,mb:`2`,children:[(0,r.jsx)(H,{size:`1`,weight:`bold`,children:`Box Shadow`}),(0,r.jsxs)(W,{gap:`2`,align:`center`,children:[(0,r.jsx)(H,{size:`1`,children:`Inset`}),(0,r.jsx)(`input`,{type:`checkbox`,checked:I.inset,onChange:e=>re({inset:e.target.checked})})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,mb:`2`,children:[(0,r.jsx)(vP,{label:`X`,value:I.x,onChange:e=>re({x:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(vP,{label:`Y`,value:I.y,onChange:e=>re({y:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(vP,{label:`Blur`,value:I.blur,onChange:e=>re({blur:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(vP,{label:`Spread`,value:I.spread,onChange:e=>re({spread:parseFloat(e)}),units:[`px`]})]}),(0,r.jsx)(nP,{color:I.color,onChange:e=>re({color:e})})]})}),(0,r.jsx)(ub,{value:`text`,children:(0,r.jsxs)(U,{p:`2`,style:{backgroundColor:`var(--gray-3)`,borderRadius:`var(--radius-2)`},children:[(0,r.jsx)(H,{size:`1`,weight:`bold`,mb:`2`,as:`div`,children:`Text Shadow`}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,mb:`2`,children:[(0,r.jsx)(vP,{label:`X`,value:F(j(`textShadow`,`none`)).x,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${e}px ${t.y}px ${t.blur}px ${t.color}`})},units:[`px`]}),(0,r.jsx)(vP,{label:`Y`,value:F(j(`textShadow`,`none`)).y,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${t.x}px ${e}px ${t.blur}px ${t.color}`})},units:[`px`]}),(0,r.jsx)(vP,{label:`Blur`,value:F(j(`textShadow`,`none`)).blur,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${t.x}px ${t.y}px ${e}px ${t.color}`})},units:[`px`]})]}),(0,r.jsx)(nP,{color:F(j(`textShadow`,`none`)).color,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${t.x}px ${t.y}px ${t.blur}px ${e}`})}})]})})]})]})}),k(`Transform`,[`scale`,`rotate`,`skew`,`translate`])&&(0,r.jsx)(gP,{title:`Transformação`,isOpen:g.transform,onToggle:()=>w(`transform`),onReset:()=>T({rotation:0,style:{...m.style,transform:void 0}}),children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsx)(vP,{label:`Rotação (deg)`,value:m.rotation,onChange:e=>T({rotation:parseFloat(e)}),units:[`deg`]}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Transform CSS (Scale, Skew, Translate)`}),(0,r.jsx)(X,{value:j(`transform`,``),onChange:e=>D({transform:e.target.value}),placeholder:`ex: scale(1.5) skewX(10deg)`}),(0,r.jsxs)(H,{size:`1`,color:`gray`,mt:`1`,children:[`Use sintaxe CSS padrão. Ex: `,(0,r.jsx)(`code`,{children:`scale(1.2)`}),`, `,(0,r.jsx)(`code`,{children:`skewY(10deg)`})]})]})]})}),!h&&(0,r.jsxs)(r.Fragment,{children:[k(`Animação`,[`animation`])&&(0,r.jsx)(gP,{title:`Animação`,isOpen:g.animation,onToggle:()=>w(`animation`),onReset:()=>T({animation:void 0}),children:(0,r.jsx)(iP,{element:m,updateElement:i})}),k(`Regras`,[`condition`])&&(0,r.jsx)(gP,{title:`Regras Condicionais`,isOpen:g.conditions,onToggle:()=>w(`conditions`),onReset:()=>T({conditions:[]}),children:(0,r.jsx)(hP,{element:m,updateElement:i,availableProps:e.availableProps||[]})}),k(`Formatação`,[`format`])&&(0,r.jsx)(gP,{title:`Formatação`,isOpen:g.formatting,onToggle:()=>w(`formatting`),onReset:()=>T({formatting:void 0}),children:(0,r.jsx)(aP,{element:m,updateElement:i})})]})]},m?.id??d.join(`,`))]})})};var CP=20,wP=`#f5f5f5`,TP=`#999`;let EP=({orientation:e})=>{let{state:n}=rS(),{zoom:i,pan:a}=n,o=(0,t.useRef)(null);return(0,t.useEffect)(()=>{let t=o.current;if(!t)return;let n=t.getContext(`2d`);if(!n)return;let r=t.width,s=t.height;n.fillStyle=wP,n.fillRect(0,0,r,s),n.fillStyle=TP,n.font=`10px sans-serif`,n.strokeStyle=TP,n.lineWidth=1;let c=e===`horizontal`?-a.x/i:-a.y/i,l=e===`horizontal`?(r-a.x)/i:(s-a.y)/i,u=100;u=i>2?10:i>.8?50:i>.4?100:200;let d=Math.floor(c/u)*u;n.beginPath();for(let t=d;t<l;t+=u){let r=t*i+(e===`horizontal`?a.x:a.y);e===`horizontal`?(n.moveTo(r,0),n.lineTo(r,CP),n.fillText(t.toString(),r+2,10)):(n.moveTo(0,r),n.lineTo(CP,r),n.save(),n.translate(10,r+2),n.rotate(-Math.PI/2),n.fillText(t.toString(),0,0),n.restore())}n.stroke()},[i,a,e,n.canvasHeight]),(0,t.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.parentElement?.getBoundingClientRect();t&&(e.width=t.width,e.height=t.height)});return e.parentElement&&t.observe(e.parentElement),()=>t.disconnect()},[]),(0,r.jsx)(`canvas`,{ref:o,style:{width:`100%`,height:`100%`,display:`block`,pointerEvents:`none`}})};var DP=({icon:e,label:n,keys:i})=>(0,r.jsxs)(W,{align:`center`,justify:`between`,py:`2`,children:[(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(U,{style:{color:`var(--gray-10)`},children:(0,r.jsx)(e,{})}),(0,r.jsx)(H,{size:`2`,children:n})]}),(0,r.jsx)(W,{gap:`1`,children:i.map((e,n)=>(0,r.jsxs)(t.default.Fragment,{children:[(0,r.jsx)(Ey,{children:e}),n<i.length-1&&(0,r.jsx)(H,{size:`1`,color:`gray`,children:`+`})]},n))})]});let OP=()=>(0,r.jsxs)(ny,{children:[(0,r.jsx)(ry,{children:(0,r.jsxs)(G,{variant:`solid`,color:`amber`,radius:`full`,style:{height:36,padding:`0 14px`,boxShadow:`0 4px 6px rgba(0,0,0,0.1)`},title:`Atalhos de Teclado`,children:[(0,r.jsx)(gt,{width:`18`,height:`18`}),`Ajuda`]})}),(0,r.jsxs)(iy,{style:{maxWidth:700},onPointerDown:e=>e.stopPropagation(),children:[(0,r.jsx)(ay,{children:`Atalhos de Teclado`}),(0,r.jsx)(H,{size:`2`,color:`gray`,mb:`4`,as:`p`,children:`Agilize seu fluxo de trabalho com estes atalhos.`}),(0,r.jsxs)(K,{columns:{initial:`1`,sm:`2`},gap:`6`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,color:`blue`,children:`Edição Básica`}),(0,r.jsx)(Qy,{size:`4`,mb:`2`}),(0,r.jsx)(DP,{icon:It,label:`Desfazer`,keys:[`Ctrl`,`Z`]}),(0,r.jsx)(DP,{icon:It,label:`Refazer`,keys:[`Ctrl`,`Y`]}),(0,r.jsx)(DP,{icon:Se,label:`Copiar`,keys:[`Ctrl`,`C`]}),(0,r.jsx)(DP,{icon:Se,label:`Colar`,keys:[`Ctrl`,`V`]}),(0,r.jsx)(DP,{icon:Xt,label:`Excluir`,keys:[`Delete`]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,color:`blue`,children:`Navegação e Seleção`}),(0,r.jsx)(Qy,{size:`4`,mb:`2`}),(0,r.jsx)(DP,{icon:ut,label:`Mover Elemento`,keys:[`Setas`]}),(0,r.jsx)(DP,{icon:ut,label:`Mover Rápido`,keys:[`Shift`,`Setas`]}),(0,r.jsx)(DP,{icon:Oe,label:`Multiseleção`,keys:[`Shift`,`Click`]}),(0,r.jsx)(DP,{icon:wt,label:`Mover Canvas (Pan)`,keys:[`Espaço`,`Arrastar`]}),(0,r.jsx)(DP,{icon:ot,label:`Zoom`,keys:[`Ctrl`,`Scroll`]})]})]}),(0,r.jsx)(W,{justify:`end`,mt:`5`,children:(0,r.jsx)(sy,{children:(0,r.jsx)(G,{variant:`soft`,color:`gray`,children:`Fechar`})})})]})]}),kP=()=>{let{state:e,updateListSettings:n,setCanvasHeight:i,setGridSize:a}=rS(),[o,s]=(0,t.useState)(!1),[c,l]=(0,t.useState)(``),[u,d]=(0,t.useState)(`asc`),[f,p]=(0,t.useState)(`bottom`),[m,h]=(0,t.useState)(`down`),[g,_]=(0,t.useState)(`150`),[v,y]=(0,t.useState)(``),[b,x]=(0,t.useState)(`0`),[S,C]=(0,t.useState)(`slideIn`),[w,T]=(0,t.useState)(.3),[E,D]=(0,t.useState)(`ease-out`),O=t.default.useRef(!1);return(0,t.useEffect)(()=>{if(o&&!O.current){O.current=!0,l(e.listSettings.sortProp||`__none__`),d(e.listSettings.sortOrder||`asc`),p(e.listSettings.newestPosition||`bottom`),h(e.listSettings.scrollDirection||`down`),y(e.listSettings.containerHeight?String(e.listSettings.containerHeight):``),_(String(e.canvasHeight||150)),x(String(e.gridSize||0));let t=e.listSettings.entryAnimation;C(t?.type||`slideIn`),T(t?.duration||.3),D(t?.timingFunction||`ease-out`)}o||(O.current=!1)},[o]),(0,t.useEffect)(()=>{if(!o)return;let e=parseInt(g,10);!isNaN(e)&&e>0&&i(e);let t=parseInt(b,10);!isNaN(t)&&t>=0&&a(t)},[g,b,o,i,a]),(0,r.jsxs)(ny,{open:o,onOpenChange:s,children:[(0,r.jsx)(ry,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`center`,cursor:`pointer`},children:[(0,r.jsx)(Je,{}),` Configurações`]})}),(0,r.jsxs)(iy,{style:{maxWidth:600},children:[(0,r.jsx)(ay,{children:`Configurações do Editor`}),(0,r.jsx)(oy,{size:`2`,mb:`4`,children:`Configure o comportamento da lista.`}),(0,r.jsx)(U,{pt:`3`,children:(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Ordenação`}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Propriedade para Ordenar`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[c===`__none__`?`(Nenhum)`:e.availableProps.find(e=>e.dataName===c)?.name||c,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>l(`__none__`),children:`(Nenhum)`}),e.availableProps.map(e=>(0,r.jsx)(q,{onSelect:()=>l(e.dataName),children:e.name},e.dataName))]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Direção`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:150,justifyContent:`space-between`},children:[u===`asc`?`Crescente (A-Z)`:`Decrescente (Z-A)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d(`asc`),children:`Crescente (A-Z)`}),(0,r.jsx)(q,{onSelect:()=>d(`desc`),children:`Decrescente (Z-A)`})]})]})]})]}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Posição do Recente`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[f===`top`?`Topo (Início)`:`Base (Final)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>p(`top`),children:`Topo (Início)`}),(0,r.jsx)(q,{onSelect:()=>p(`bottom`),children:`Base (Final)`})]})]})]}),(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Comportamento de Rolagem`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[m===`down`?`Descer (Padrão)`:`Subir (Chat)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>h(`down`),children:`Descer (Padrão)`}),(0,r.jsx)(q,{onSelect:()=>h(`up`),children:`Subir (Chat)`})]})]})]})]}),(0,r.jsx)(H,{size:`2`,weight:`bold`,mt:`2`,children:`Dimensões`}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Altura do Item (Template) (px)`}),(0,r.jsx)(X,{type:`number`,min:`10`,value:g,onChange:e=>_(e.target.value)}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Altura de cada item individual na lista.`})]}),(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Altura da Lista (Container) (px)`}),(0,r.jsx)(X,{type:`number`,min:`0`,placeholder:`Auto (100%)`,value:v,onChange:e=>y(e.target.value)}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Altura total da lista. Se exceder, rola. Vazio = 100%.`})]})]}),(0,r.jsx)(H,{size:`2`,weight:`bold`,mt:`2`,children:`Animação de Entrada na Lista`}),(0,r.jsxs)(K,{columns:`3`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Efeito`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[S===`slideIn`?`Slide (Padrão)`:S===`smoothSlideUp`?`Slide Suave (Up)`:S===`fadeIn`?`Fade In`:S===`popIn`?`Pop In`:S===`blurIn`?`Blur In`:S===`slideInLeft`?`Slide (Esq)`:S===`slideInRight`?`Slide (Dir)`:S===`zoomIn`?`Zoom In`:S===`bounceIn`?`Bounce`:`Nenhum`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>C(`none`),children:`Nenhum`}),(0,r.jsx)(q,{onSelect:()=>C(`slideIn`),children:`Slide (Padrão)`}),(0,r.jsx)(q,{onSelect:()=>C(`smoothSlideUp`),children:`Slide Suave (Up)`}),(0,r.jsx)(q,{onSelect:()=>C(`fadeIn`),children:`Fade In`}),(0,r.jsx)(q,{onSelect:()=>C(`popIn`),children:`Pop In`}),(0,r.jsx)(q,{onSelect:()=>C(`blurIn`),children:`Blur In`}),(0,r.jsx)(q,{onSelect:()=>C(`slideInLeft`),children:`Slide (Esq)`}),(0,r.jsx)(q,{onSelect:()=>C(`slideInRight`),children:`Slide (Dir)`}),(0,r.jsx)(q,{onSelect:()=>C(`zoomIn`),children:`Zoom In`}),(0,r.jsx)(q,{onSelect:()=>C(`bounceIn`),children:`Bounce`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Duração (s)`}),(0,r.jsx)(X,{type:`number`,step:`0.1`,min:`0.1`,value:w,onChange:e=>T(parseFloat(e.target.value)||.3)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Curva (Easing)`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[E===`ease-out`?`Ease Out`:E===`linear`?`Linear`:E===`bounce`?`Bounce`:`Ease`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>D(`ease`),children:`Ease`}),(0,r.jsx)(q,{onSelect:()=>D(`ease-out`),children:`Ease Out`}),(0,r.jsx)(q,{onSelect:()=>D(`linear`),children:`Linear`}),(0,r.jsx)(q,{onSelect:()=>D(`bounce`),children:`Bounce`})]})]})]})]}),(0,r.jsxs)(U,{mt:`2`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Grid Snapping (Travar)`}),(0,r.jsx)(W,{gap:`3`,align:`center`,mt:`2`,children:(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Tamanho do Grid (px) - 0 para desativar`}),(0,r.jsx)(X,{type:`number`,value:b,onChange:e=>x(e.target.value),placeholder:`0`})]})})]})]})}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(sy,{children:(0,r.jsx)(G,{variant:`soft`,color:`gray`,children:`Cancelar`})}),(0,r.jsx)(sy,{children:(0,r.jsx)(G,{onClick:()=>{let e=parseInt(v,10),t=parseInt(g,10),r=parseInt(b,10),o={type:S,duration:Number(w),delay:0,timingFunction:E};n({sortProp:c===`__none__`?``:c,sortOrder:u,newestPosition:f,scrollDirection:m,containerHeight:!isNaN(e)&&e>0?e:void 0,entryAnimation:o}),!isNaN(t)&&t>0&&i(t),!isNaN(r)&&r>=0&&a(r),s(!1)},children:`Salvar Alterações`})})]})]})]})},AP=({onClose:e})=>{let{state:t,jumpToHistory:n,undo:i,redo:a}=rS(),o=t=>{n(t),e&&e()};return(0,r.jsxs)(W,{direction:`column`,style:{width:`100%`},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,p:`2`,style:{borderBottom:`1px solid var(--gray-5)`},children:[(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(vt,{}),(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Histórico`})]}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsx)(G,{size:`1`,variant:`soft`,onClick:i,disabled:t.historyIndex<=0,children:`Desfazer`}),(0,r.jsx)(G,{size:`1`,variant:`soft`,onClick:a,disabled:t.historyIndex>=t.history.length-1,children:`Refazer`})]})]}),(0,r.jsx)(U,{p:`0`,children:t.history.map((e,n)=>{let i=n===t.historyIndex,a=n>t.historyIndex,s=t.historyDescriptions?.[n]||(n===0?`Estado Inicial`:`Alteração ${n}`);return(0,r.jsx)(U,{p:`2`,style:{backgroundColor:i?`var(--accent-3)`:`transparent`,opacity:a?.5:1,cursor:`pointer`,borderBottom:`1px solid var(--gray-3)`},onClick:()=>o(n),className:`history-item`,children:(0,r.jsxs)(W,{align:`center`,justify:`between`,children:[(0,r.jsx)(H,{size:`2`,weight:i?`bold`:`regular`,children:s}),i&&(0,r.jsx)(H,{size:`1`,color:`blue`,children:`Atual`})]})},n)})})]})};function jP(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return(0,t.useMemo)(()=>e=>{n.forEach(t=>t(e))},n)}var MP=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function NP(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function PP(e){return`nodeType`in e}function FP(e){return e?NP(e)?e:PP(e)?e.ownerDocument?.defaultView??window:window:window}function IP(e){let{Document:t}=FP(e);return e instanceof t}function LP(e){return NP(e)?!1:e instanceof FP(e).HTMLElement}function RP(e){return e instanceof FP(e).SVGElement}function zP(e){return e?NP(e)?e.document:PP(e)?IP(e)?e:LP(e)||RP(e)?e.ownerDocument:document:document:document}var BP=MP?t.useLayoutEffect:t.useEffect;function VP(e){let n=(0,t.useRef)(e);return BP(()=>{n.current=e}),(0,t.useCallback)(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.current==null?void 0:n.current(...t)},[])}function HP(){let e=(0,t.useRef)(null);return[(0,t.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,t.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function UP(e,n){n===void 0&&(n=[e]);let r=(0,t.useRef)(e);return BP(()=>{r.current!==e&&(r.current=e)},n),r}function WP(e,n){let r=(0,t.useRef)();return(0,t.useMemo)(()=>{let t=e(r.current);return r.current=t,t},[...n])}function GP(e){let n=VP(e),r=(0,t.useRef)(null);return[r,(0,t.useCallback)(e=>{e!==r.current&&n?.(e,r.current),r.current=e},[])]}function KP(e){let n=(0,t.useRef)();return(0,t.useEffect)(()=>{n.current=e},[e]),n.current}var qP={};function JP(e,n){return(0,t.useMemo)(()=>{if(n)return n;let t=qP[e]==null?0:qP[e]+1;return qP[e]=t,e+`-`+t},[e,n])}function YP(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var XP=YP(1),ZP=YP(-1);function QP(e){return`clientX`in e&&`clientY`in e}function $P(e){if(!e)return!1;let{KeyboardEvent:t}=FP(e.target);return t&&e instanceof t}function eF(e){if(!e)return!1;let{TouchEvent:t}=FP(e.target);return t&&e instanceof t}function tF(e){if(eF(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return QP(e)?{x:e.clientX,y:e.clientY}:null}var nF=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[nF.Translate.toString(e),nF.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),rF=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function iF(e){return e.matches(rF)?e:e.querySelector(rF)}var aF={display:`none`};function oF(e){let{id:n,value:r}=e;return t.default.createElement(`div`,{id:n,style:aF},r)}function sF(e){let{id:n,announcement:r,ariaLiveType:i=`assertive`}=e;return t.default.createElement(`div`,{id:n,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":i,"aria-atomic":!0},r)}function cF(){let[e,n]=(0,t.useState)(``);return{announce:(0,t.useCallback)(e=>{e!=null&&n(e)},[]),announcement:e}}var lF=(0,t.createContext)(null);function uF(e){let n=(0,t.useContext)(lF);(0,t.useEffect)(()=>{if(!n)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return n(e)},[e,n])}function dF(){let[e]=(0,t.useState)(()=>new Set),n=(0,t.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,t.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),n]}var fF={draggable:`
|
|
58
58
|
To pick up a draggable item, press the space bar.
|
|
59
59
|
While dragging, use the arrow keys to move the item.
|
|
60
60
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
61
|
-
`},fF={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function pF(e){let{announcements:r=fF,container:i,hiddenTextDescribedById:a,screenReaderInstructions:o=dF}=e,{announce:s,announcement:c}=sF(),l=qP(`DndLiveRegion`),[u,d]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{d(!0)},[]),lF((0,t.useMemo)(()=>({onDragStart(e){let{active:t}=e;s(r.onDragStart({active:t}))},onDragMove(e){let{active:t,over:n}=e;r.onDragMove&&s(r.onDragMove({active:t,over:n}))},onDragOver(e){let{active:t,over:n}=e;s(r.onDragOver({active:t,over:n}))},onDragEnd(e){let{active:t,over:n}=e;s(r.onDragEnd({active:t,over:n}))},onDragCancel(e){let{active:t,over:n}=e;s(r.onDragCancel({active:t,over:n}))}}),[s,r])),!u)return null;let f=t.default.createElement(t.default.Fragment,null,t.default.createElement(aF,{id:a,value:o.draggable}),t.default.createElement(oF,{id:l,announcement:c}));return i?(0,n.createPortal)(f,i):f}var mF;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(mF||={});function hF(){}function gF(e,n){return(0,t.useMemo)(()=>({sensor:e,options:n??{}}),[e,n])}function _F(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return(0,t.useMemo)(()=>[...n].filter(e=>e!=null),[...n])}var vF=Object.freeze({x:0,y:0});function yF(e,t){let n=eF(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function bF(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function xF(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function SF(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var CF=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=SF(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(bF)};function wF(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function TF(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:vF}function EF(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var DF=EF(1);function OF(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function kF(e,t,n){let r=OF(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var AF={ignoreTransform:!1};function jF(e,t){t===void 0&&(t=AF);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=PP(e).getComputedStyle(e);t&&(n=kF(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function MF(e){return jF(e,{ignoreTransform:!0})}function NF(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function PF(e,t){return t===void 0&&(t=PP(e).getComputedStyle(e)),t.position===`fixed`}function FF(e,t){t===void 0&&(t=PP(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function IF(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(FP(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!IP(i)||LP(i)||n.includes(i))return n;let a=PP(e).getComputedStyle(i);return i!==e&&FF(i,a)&&n.push(i),PF(i,a)?n:r(i.parentNode)}return e?r(e):n}function LF(e){let[t]=IF(e,1);return t??null}function RF(e){return!jP||!e?null:MP(e)?e:NP(e)?FP(e)||e===RP(e).scrollingElement?window:IP(e)?e:null:null}function zF(e){return MP(e)?e.scrollX:e.scrollLeft}function BF(e){return MP(e)?e.scrollY:e.scrollTop}function VF(e){return{x:zF(e),y:BF(e)}}var HF;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(HF||={});function UF(e){return!jP||!e?!1:e===document.scrollingElement}function WF(e){let t={x:0,y:0},n=UF(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var GF={x:.2,y:.2};function KF(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=GF);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=WF(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=HF.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=HF.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=HF.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=HF.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function qF(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function JF(e){return e.reduce((e,t)=>YP(e,VF(t)),vF)}function YF(e){return e.reduce((e,t)=>e+zF(t),0)}function XF(e){return e.reduce((e,t)=>e+BF(t),0)}function ZF(e,t){if(t===void 0&&(t=jF),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);LF(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var QF=[[`x`,[`left`,`right`],YF],[`y`,[`top`,`bottom`],XF]],$F=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=IF(t),r=JF(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of QF)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},eI=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function tI(e){let{EventTarget:t}=PP(e);return e instanceof t?e:RP(e)}function nI(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var rI;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(rI||={});function iI(e){e.preventDefault()}function aI(e){e.stopPropagation()}var $;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})($||={});var oI={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},sI=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},cI=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new eI(RP(t)),this.windowListeners=new eI(PP(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(rI.Resize,this.handleCancel),this.windowListeners.add(rI.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(rI.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&ZF(n),t(vF)}handleKeyDown(e){if(QP(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=oI,coordinateGetter:a=sI,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:vF;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=XP(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=WF(n),p=qF(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===$.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,YP(XP(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};cI.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=oI,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function lI(e){return!!(e&&`distance`in e)}function uI(e){return!!(e&&`delay`in e)}var dI=class{constructor(e,t,n){n===void 0&&(n=tI(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=RP(i),this.documentListeners=new eI(this.document),this.listeners=new eI(n),this.windowListeners=new eI(PP(i)),this.initialCoordinates=eF(r)??vF,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(rI.Resize,this.handleCancel),this.windowListeners.add(rI.DragStart,iI),this.windowListeners.add(rI.VisibilityChange,this.handleCancel),this.windowListeners.add(rI.ContextMenu,iI),this.documentListeners.add(rI.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(uI(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(lI(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(rI.Click,aI,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(rI.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=eF(e)??vF,s=XP(n,o);if(!t&&a){if(lI(a)){if(a.tolerance!=null&&nI(s,a.tolerance))return this.handleCancel();if(nI(s,a.distance))return this.handleStart()}if(uI(a)&&nI(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},fI={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},pI=class extends dI{constructor(e){let{event:t}=e,n=RP(t.target);super(e,fI,n)}};pI.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var mI={move:{name:`mousemove`},end:{name:`mouseup`}},hI;(function(e){e[e.RightClick=2]=`RightClick`})(hI||={});var gI=class extends dI{constructor(e){super(e,mI,RP(e.event.target))}};gI.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===hI.RightClick?!1:(r?.({event:n}),!0)}}];var _I={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},vI=class extends dI{constructor(e){super(e,_I)}static setup(){return window.addEventListener(_I.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(_I.move.name,e)};function e(){}}};vI.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var yI;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(yI||={});var bI;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(bI||={});function xI(e){let{acceleration:n,activator:r=yI.Pointer,canScroll:i,draggingRect:a,enabled:o,interval:s=5,order:c=bI.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:p}=e,m=CI({delta:f,disabled:!o}),[h,g]=VP(),_=(0,t.useRef)({x:0,y:0}),v=(0,t.useRef)({x:0,y:0}),y=(0,t.useMemo)(()=>{switch(r){case yI.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case yI.DraggableRect:return a}},[r,a,l]),b=(0,t.useRef)(null),x=(0,t.useCallback)(()=>{let e=b.current;if(!e)return;let t=_.current.x*v.current.x,n=_.current.y*v.current.y;e.scrollBy(t,n)},[]),S=(0,t.useMemo)(()=>c===bI.TreeOrder?[...u].reverse():u,[c,u]);(0,t.useEffect)(()=>{if(!o||!u.length||!y){g();return}for(let e of S){if(i?.(e)===!1)continue;let t=d[u.indexOf(e)];if(!t)continue;let{direction:r,speed:a}=KF(e,t,y,n,p);for(let e of[`x`,`y`])m[e][r[e]]||(a[e]=0,r[e]=0);if(a.x>0||a.y>0){g(),b.current=e,h(x,s),_.current=a,v.current=r;return}}_.current={x:0,y:0},v.current={x:0,y:0},g()},[n,x,i,g,o,s,JSON.stringify(y),JSON.stringify(m),h,u,S,d,JSON.stringify(p)])}var SI={x:{[HF.Backward]:!1,[HF.Forward]:!1},y:{[HF.Backward]:!1,[HF.Forward]:!1}};function CI(e){let{delta:t,disabled:n}=e,r=GP(t);return UP(e=>{if(n||!r||!e)return SI;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[HF.Backward]:e.x[HF.Backward]||i.x===-1,[HF.Forward]:e.x[HF.Forward]||i.x===1},y:{[HF.Backward]:e.y[HF.Backward]||i.y===-1,[HF.Forward]:e.y[HF.Forward]||i.y===1}}},[n,t,r])}function wI(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return UP(e=>t==null?null:r??e??null,[r,t])}function TI(e,n){return(0,t.useMemo)(()=>e.reduce((e,t)=>{let{sensor:r}=t,i=r.activators.map(e=>({eventName:e.eventName,handler:n(e.handler,t)}));return[...e,...i]},[]),[e,n])}var EI;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(EI||={});var DI;(function(e){e.Optimized=`optimized`})(DI||={});var OI=new Map;function kI(e,n){let{dragging:r,dependencies:i,config:a}=n,[o,s]=(0,t.useState)(null),{frequency:c,measure:l,strategy:u}=a,d=(0,t.useRef)(e),f=_(),p=HP(f),m=(0,t.useCallback)(function(e){e===void 0&&(e=[]),!p.current&&s(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),h=(0,t.useRef)(null),g=UP(t=>{if(f&&!r)return OI;if(!t||t===OI||d.current!==e||o!=null){let t=new Map;for(let n of e){if(!n)continue;if(o&&o.length>0&&!o.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new $F(l(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,o,r,f,l]);return(0,t.useEffect)(()=>{d.current=e},[e]),(0,t.useEffect)(()=>{f||m()},[r,f]),(0,t.useEffect)(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),(0,t.useEffect)(()=>{f||typeof c!=`number`||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},c))},[c,f,m,...i]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:o!=null};function _(){switch(u){case EI.Always:return!1;case EI.BeforeDragging:return r;default:return!r}}}function AI(e,t){return UP(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function jI(e,t){return AI(e,t)}function MI(e){let{callback:n,disabled:r}=e,i=BP(n),a=(0,t.useMemo)(()=>{if(r||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(i)},[i,r]);return(0,t.useEffect)(()=>()=>a?.disconnect(),[a]),a}function NI(e){let{callback:n,disabled:r}=e,i=BP(n),a=(0,t.useMemo)(()=>{if(r||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(i)},[r]);return(0,t.useEffect)(()=>()=>a?.disconnect(),[a]),a}function PI(e){return new $F(jF(e),e)}function FI(e,n,r){n===void 0&&(n=PI);let[i,a]=(0,t.useState)(null);function o(){a(t=>{if(!e)return null;if(e.isConnected===!1)return t??r??null;let i=n(e);return JSON.stringify(t)===JSON.stringify(i)?t:i})}let s=MI({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),c=NI({callback:o});return zP(()=>{o(),e?(c?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),s?.disconnect())},[e]),i}function II(e){return TF(e,AI(e))}var LI=[];function RI(e){let n=(0,t.useRef)(e),r=UP(t=>e?t&&t!==LI&&e&&n.current&&e.parentNode===n.current.parentNode?t:IF(e):LI,[e]);return(0,t.useEffect)(()=>{n.current=e},[e]),r}function zI(e){let[n,r]=(0,t.useState)(null),i=(0,t.useRef)(e),a=(0,t.useCallback)(e=>{let t=RF(e.target);t&&r(e=>e?(e.set(t,VF(t)),new Map(e)):null)},[]);return(0,t.useEffect)(()=>{let t=i.current;if(e!==t){n(t);let o=e.map(e=>{let t=RF(e);return t?(t.addEventListener(`scroll`,a,{passive:!0}),[t,VF(t)]):null}).filter(e=>e!=null);r(o.length?new Map(o):null),i.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{RF(e)?.removeEventListener(`scroll`,a)})}},[a,e]),(0,t.useMemo)(()=>e.length?n?Array.from(n.values()).reduce((e,t)=>YP(e,t),vF):JF(e):vF,[e,n])}function BI(e,n){n===void 0&&(n=[]);let r=(0,t.useRef)(null);return(0,t.useEffect)(()=>{r.current=null},n),(0,t.useEffect)(()=>{let t=e!==vF;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)},[e]),r.current?XP(e,r.current):vF}function VI(e){(0,t.useEffect)(()=>{if(!jP)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function HI(e,n){return(0,t.useMemo)(()=>e.reduce((e,t)=>{let{eventName:r,handler:i}=t;return e[r]=e=>{i(e,n)},e},{}),[e,n])}function UI(e){return(0,t.useMemo)(()=>e?NF(e):null,[e])}var WI=[];function GI(e,n){n===void 0&&(n=jF);let[r]=e,i=UI(r?PP(r):null),[a,o]=(0,t.useState)(WI);function s(){o(()=>e.length?e.map(e=>UF(e)?i:new $F(n(e),e)):WI)}let c=NI({callback:s});return zP(()=>{c?.disconnect(),s(),e.forEach(e=>c?.observe(e))},[e]),a}function KI(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return IP(t)?t:e}function qI(e){let{measure:n}=e,[r,i]=(0,t.useState)(null),a=NI({callback:(0,t.useCallback)(e=>{for(let{target:t}of e)if(IP(t)){i(e=>{let r=n(t);return e?{...e,width:r.width,height:r.height}:r});break}},[n])}),[o,s]=WP((0,t.useCallback)(e=>{let t=KI(e);a?.disconnect(),t&&a?.observe(t),i(t?n(t):null)},[n,a]));return(0,t.useMemo)(()=>({nodeRef:o,rect:r,setRef:s}),[r,o,s])}var JI=[{sensor:pI,options:{}},{sensor:cI,options:{}}],YI={current:{}},XI={draggable:{measure:MF},droppable:{measure:MF,strategy:EI.WhileDragging,frequency:DI.Optimized},dragOverlay:{measure:jF}},ZI=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},QI={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ZI,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:hF},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:XI,measureDroppableContainers:hF,windowRect:null,measuringScheduled:!1},$I={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:hF,draggableNodes:new Map,over:null,measureDroppableContainers:hF},eL=(0,t.createContext)($I),tL=(0,t.createContext)(QI);function nL(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ZI}}}function rL(e,t){switch(t.type){case mF.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case mF.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case mF.DragEnd:case mF.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case mF.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new ZI(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case mF.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new ZI(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case mF.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new ZI(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function iL(e){let{disabled:n}=e,{active:r,activatorEvent:i,draggableNodes:a}=(0,t.useContext)(eL),o=GP(i),s=GP(r?.id);return(0,t.useEffect)(()=>{if(!n&&!i&&o&&s!=null){if(!QP(o)||document.activeElement===o.target)return;let e=a.get(s);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=rF(e);if(t){t.focus();break}}})}},[i,n,a,s,o]),null}function aL(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function oL(e){return(0,t.useMemo)(()=>({draggable:{...XI.draggable,...e?.draggable},droppable:{...XI.droppable,...e?.droppable},dragOverlay:{...XI.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function sL(e){let{activeNode:n,measure:r,initialRect:i,config:a=!0}=e,o=(0,t.useRef)(!1),{x:s,y:c}=typeof a==`boolean`?{x:a,y:a}:a;zP(()=>{if(!s&&!c||!n){o.current=!1;return}if(o.current||!i)return;let e=n?.node.current;if(!e||e.isConnected===!1)return;let t=TF(r(e),i);if(s||(t.x=0),c||(t.y=0),o.current=!0,Math.abs(t.x)>0||Math.abs(t.y)>0){let n=LF(e);n&&n.scrollBy({top:t.y,left:t.x})}},[n,s,c,i,r])}var cL=(0,t.createContext)({...vF,scaleX:1,scaleY:1}),lL;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(lL||={});var uL=(0,t.memo)(function(e){let{id:r,accessibility:i,autoScroll:a=!0,children:o,sensors:s=JI,collisionDetection:c=CF,measuring:l,modifiers:u,...d}=e,[f,p]=(0,t.useReducer)(rL,void 0,nL),[m,h]=uF(),[g,_]=(0,t.useState)(lL.Uninitialized),v=g===lL.Initialized,{draggable:{active:y,nodes:b,translate:x},droppable:{containers:S}}=f,C=y==null?null:b.get(y),w=(0,t.useRef)({initial:null,translated:null}),T=(0,t.useMemo)(()=>y==null?null:{id:y,data:C?.data??YI,rect:w},[y,C]),E=(0,t.useRef)(null),[D,O]=(0,t.useState)(null),[k,A]=(0,t.useState)(null),j=HP(d,Object.values(d)),M=qP(`DndDescribedBy`,r),N=(0,t.useMemo)(()=>S.getEnabled(),[S]),P=oL(l),{droppableRects:ee,measureDroppableContainers:F,measuringScheduled:te}=kI(N,{dragging:v,dependencies:[x.x,x.y],config:P.droppable}),I=wI(b,y),ne=(0,t.useMemo)(()=>k?eF(k):null,[k]),re=Pe(),ie=jI(I,P.draggable.measure);sL({activeNode:y==null?null:b.get(y),config:re.layoutShiftCompensation,initialRect:ie,measure:P.draggable.measure});let ae=FI(I,P.draggable.measure,ie),oe=FI(I?I.parentElement:null),se=(0,t.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=S.getNodeFor(se.current.over?.id),le=qI({measure:P.dragOverlay.measure}),ue=le.nodeRef.current??I,de=v?le.rect??ae:null,fe=!!(le.nodeRef.current&&le.rect),pe=II(fe?null:ae),me=UI(ue?PP(ue):null),he=RI(v?ce??I:null),ge=GI(he),_e=aL(u,{transform:{x:x.x-pe.x,y:x.y-pe.y,scaleX:1,scaleY:1},activatorEvent:k,active:T,activeNodeRect:ae,containerNodeRect:oe,draggingNodeRect:de,over:se.current.over,overlayNodeRect:le.rect,scrollableAncestors:he,scrollableAncestorRects:ge,windowRect:me}),ve=ne?YP(ne,x):null,ye=zI(he),be=BI(ye),xe=BI(ye,[ae]),Se=YP(_e,be),Ce=de?DF(de,_e):null,we=T&&Ce?c({active:T,collisionRect:Ce,droppableRects:ee,droppableContainers:N,pointerCoordinates:ve}):null,Te=xF(we,`id`),[Ee,De]=(0,t.useState)(null),Oe=wF(fe?_e:YP(_e,xe),Ee?.rect??null,ae),ke=(0,t.useRef)(null),Ae=(0,t.useCallback)((e,t)=>{let{sensor:r,options:i}=t;if(E.current==null)return;let a=b.get(E.current);if(!a)return;let o=e.nativeEvent;ke.current=new r({active:E.current,activeNode:a,event:o,options:i,context:se,onAbort(e){if(!b.get(e))return;let{onDragAbort:t}=j.current,n={id:e};t?.(n),m({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!b.get(e))return;let{onDragPending:i}=j.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),m({type:`onDragPending`,event:a})},onStart(e){let t=E.current;if(t==null)return;let r=b.get(t);if(!r)return;let{onDragStart:i}=j.current,a={activatorEvent:o,active:{id:t,data:r.data,rect:w}};(0,n.unstable_batchedUpdates)(()=>{i?.(a),_(lL.Initializing),p({type:mF.DragStart,initialCoordinates:e,active:t}),m({type:`onDragStart`,event:a}),O(ke.current),A(o)})},onMove(e){p({type:mF.DragMove,coordinates:e})},onEnd:s(mF.DragEnd),onCancel:s(mF.DragCancel)});function s(e){return async function(){let{active:t,collisions:r,over:i,scrollAdjustedTranslate:a}=se.current,s=null;if(t&&a){let{cancelDrop:n}=j.current;s={activatorEvent:o,active:t,collisions:r,delta:a,over:i},e===mF.DragEnd&&typeof n==`function`&&await Promise.resolve(n(s))&&(e=mF.DragCancel)}E.current=null,(0,n.unstable_batchedUpdates)(()=>{p({type:e}),_(lL.Uninitialized),De(null),O(null),A(null),ke.current=null;let t=e===mF.DragEnd?`onDragEnd`:`onDragCancel`;if(s){let e=j.current[t];e?.(s),m({type:t,event:s})}})}}},[b]),je=TI(s,(0,t.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=b.get(r);if(E.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},E.current=r,Ae(n,t))},[b,Ae]));VI(s),zP(()=>{ae&&g===lL.Initializing&&_(lL.Initialized)},[ae,g]),(0,t.useEffect)(()=>{let{onDragMove:e}=j.current,{active:t,activatorEvent:r,collisions:i,over:a}=se.current;if(!t||!r)return;let o={active:t,activatorEvent:r,collisions:i,delta:{x:Se.x,y:Se.y},over:a};(0,n.unstable_batchedUpdates)(()=>{e?.(o),m({type:`onDragMove`,event:o})})},[Se.x,Se.y]),(0,t.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:r,droppableContainers:i,scrollAdjustedTranslate:a}=se.current;if(!e||E.current==null||!t||!a)return;let{onDragOver:o}=j.current,s=i.get(Te),c=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,l={active:e,activatorEvent:t,collisions:r,delta:{x:a.x,y:a.y},over:c};(0,n.unstable_batchedUpdates)(()=>{De(c),o?.(l),m({type:`onDragOver`,event:l})})},[Te]),zP(()=>{se.current={activatorEvent:k,active:T,activeNode:I,collisionRect:Ce,collisions:we,droppableRects:ee,draggableNodes:b,draggingNode:ue,draggingNodeRect:de,droppableContainers:S,over:Ee,scrollableAncestors:he,scrollAdjustedTranslate:Se},w.current={initial:de,translated:Ce}},[T,I,we,Ce,b,ue,de,ee,S,Ee,he,Se]),xI({...re,delta:x,draggingRect:Ce,pointerCoordinates:ve,scrollableAncestors:he,scrollableAncestorRects:ge});let Me=(0,t.useMemo)(()=>({active:T,activeNode:I,activeNodeRect:ae,activatorEvent:k,collisions:we,containerNodeRect:oe,dragOverlay:le,draggableNodes:b,droppableContainers:S,droppableRects:ee,over:Ee,measureDroppableContainers:F,scrollableAncestors:he,scrollableAncestorRects:ge,measuringConfiguration:P,measuringScheduled:te,windowRect:me}),[T,I,ae,k,we,oe,le,b,S,ee,Ee,F,he,ge,P,te,me]),Ne=(0,t.useMemo)(()=>({activatorEvent:k,activators:je,active:T,activeNodeRect:ae,ariaDescribedById:{draggable:M},dispatch:p,draggableNodes:b,over:Ee,measureDroppableContainers:F}),[k,je,T,ae,p,M,b,Ee,F]);return t.default.createElement(cF.Provider,{value:h},t.default.createElement(eL.Provider,{value:Ne},t.default.createElement(tL.Provider,{value:Me},t.default.createElement(cL.Provider,{value:Oe},o)),t.default.createElement(iL,{disabled:i?.restoreFocus===!1})),t.default.createElement(pF,{...i,hiddenTextDescribedById:M}));function Pe(){let e=D?.autoScrollEnabled===!1,t=typeof a==`object`?a.enabled===!1:a===!1,n=v&&!e&&!t;return typeof a==`object`?{...a,enabled:n}:{enabled:n}}}),dL=(0,t.createContext)(null),fL=`button`,pL=`Draggable`;function mL(e){let{id:n,data:r,disabled:i=!1,attributes:a}=e,o=qP(pL),{activators:s,activatorEvent:c,active:l,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:p}=(0,t.useContext)(eL),{role:m=fL,roleDescription:h=`draggable`,tabIndex:g=0}=a??{},_=l?.id===n,v=(0,t.useContext)(_?cL:dL),[y,b]=WP(),[x,S]=WP(),C=HI(s,n),w=HP(r);return zP(()=>(f.set(n,{id:n,key:o,node:y,activatorNode:x,data:w}),()=>{let e=f.get(n);e&&e.key===o&&f.delete(n)}),[f,n]),{active:l,activatorEvent:c,activeNodeRect:u,attributes:(0,t.useMemo)(()=>({role:m,tabIndex:g,"aria-disabled":i,"aria-pressed":_&&m===fL?!0:void 0,"aria-roledescription":h,"aria-describedby":d.draggable}),[i,m,g,_,h,d.draggable]),isDragging:_,listeners:i?void 0:C,node:y,over:p,setNodeRef:b,setActivatorNodeRef:S,transform:v}}function hL(){return(0,t.useContext)(tL)}var gL=`Droppable`,_L={timeout:25};function vL(e){let{data:n,disabled:r=!1,id:i,resizeObserverConfig:a}=e,o=qP(gL),{active:s,dispatch:c,over:l,measureDroppableContainers:u}=(0,t.useContext)(eL),d=(0,t.useRef)({disabled:r}),f=(0,t.useRef)(!1),p=(0,t.useRef)(null),m=(0,t.useRef)(null),{disabled:h,updateMeasurementsFor:g,timeout:_}={..._L,...a},v=HP(g??i),y=NI({callback:(0,t.useCallback)(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),m.current=null},_)},[_]),disabled:h||!s}),[b,x]=WP((0,t.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),f.current=!1),e&&y.observe(e))},[y])),S=HP(n);return(0,t.useEffect)(()=>{!y||!b.current||(y.disconnect(),f.current=!1,y.observe(b.current))},[b,y]),(0,t.useEffect)(()=>(c({type:mF.RegisterDroppable,element:{id:i,key:o,disabled:r,node:b,rect:p,data:S}}),()=>c({type:mF.UnregisterDroppable,key:o,id:i})),[i]),(0,t.useEffect)(()=>{r!==d.current.disabled&&(c({type:mF.SetDroppableDisabled,id:i,key:o,disabled:r}),d.current.disabled=r)},[i,o,r,c]),{active:s,rect:p,isOver:l?.id===i,node:b,over:l,setNodeRef:x}}function yL(e){let{animation:n,children:r}=e,[i,a]=(0,t.useState)(null),[o,s]=(0,t.useState)(null),c=GP(r);return!r&&!i&&c&&a(c),zP(()=>{if(!o)return;let e=i?.key,t=i?.props.id;if(e==null||t==null){a(null);return}Promise.resolve(n(t,o)).then(()=>{a(null)})},[n,i,o]),t.default.createElement(t.default.Fragment,null,r,i?(0,t.cloneElement)(i,{ref:s}):null)}var bL={x:0,y:0,scaleX:1,scaleY:1};function xL(e){let{children:n}=e;return t.default.createElement(eL.Provider,{value:$I},t.default.createElement(cL.Provider,{value:bL},n))}var SL={position:`fixed`,touchAction:`none`},CL=e=>QP(e)?`transform 250ms ease`:void 0,wL=(0,t.forwardRef)((e,n)=>{let{as:r,activatorEvent:i,adjustScale:a,children:o,className:s,rect:c,style:l,transform:u,transition:d=CL}=e;if(!c)return null;let f=a?u:{...u,scaleX:1,scaleY:1},p={...SL,width:c.width,height:c.height,top:c.top,left:c.left,transform:tF.Transform.toString(f),transformOrigin:a&&i?yF(i,c):void 0,transition:typeof d==`function`?d(i):d,...l};return t.default.createElement(r,{className:s,style:p,ref:n},o)}),TL={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:tF.Transform.toString(t)},{transform:tF.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function EL(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return BP((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=KI(a);if(!c)return;let{transform:l}=PP(a).getComputedStyle(a),u=OF(l);if(!u)return;let d=typeof t==`function`?t:DL(t);return ZF(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function DL(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...TL,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var OL=0;function kL(e){return(0,t.useMemo)(()=>{if(e!=null)return OL++,OL},[e])}var AL=t.default.memo(e=>{let{adjustScale:n=!1,children:r,dropAnimation:i,style:a,transition:o,modifiers:s,wrapperElement:c=`div`,className:l,zIndex:u=999}=e,{activatorEvent:d,active:f,activeNodeRect:p,containerNodeRect:m,draggableNodes:h,droppableContainers:g,dragOverlay:_,over:v,measuringConfiguration:y,scrollableAncestors:b,scrollableAncestorRects:x,windowRect:S}=hL(),C=(0,t.useContext)(cL),w=kL(f?.id),T=aL(s,{activatorEvent:d,active:f,activeNodeRect:p,containerNodeRect:m,draggingNodeRect:_.rect,over:v,overlayNodeRect:_.rect,scrollableAncestors:b,scrollableAncestorRects:x,transform:C,windowRect:S}),E=AI(p),D=EL({config:i,draggableNodes:h,droppableContainers:g,measuringConfiguration:y}),O=E?_.setRef:void 0;return t.default.createElement(xL,null,t.default.createElement(yL,{animation:D},f&&w?t.default.createElement(wL,{key:w,id:f.id,ref:O,as:c,activatorEvent:d,adjustScale:n,className:l,transition:o,rect:E,style:{zIndex:u,...a},transform:T},r):null))});function jL(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ML(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function NL(e){return e!==null&&e>=0}function PL(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function FL(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var IL=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=jL(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},LL={scaleX:1,scaleY:1},RL=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...LL}:null}let s=zL(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...LL}:r<t&&r>=a?{x:0,y:o.height+s,...LL}:{x:0,y:0,...LL}};function zL(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var BL=`Sortable`,VL=t.default.createContext({activeIndex:-1,containerId:BL,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:IL,disabled:{draggable:!1,droppable:!1}});function HL(e){let{children:n,id:r,items:i,strategy:a=IL,disabled:o=!1}=e,{active:s,dragOverlay:c,droppableRects:l,over:u,measureDroppableContainers:d}=hL(),f=qP(BL,r),p=c.rect!==null,m=(0,t.useMemo)(()=>i.map(e=>typeof e==`object`&&`id`in e?e.id:e),[i]),h=s!=null,g=s?m.indexOf(s.id):-1,_=u?m.indexOf(u.id):-1,v=(0,t.useRef)(m),y=!PL(m,v.current),b=_!==-1&&g===-1||y,x=FL(o);zP(()=>{y&&h&&d(m)},[y,m,h,d]),(0,t.useEffect)(()=>{v.current=m},[m]);let S=(0,t.useMemo)(()=>({activeIndex:g,containerId:f,disabled:x,disableTransforms:b,items:m,overIndex:_,useDragOverlay:p,sortedRects:ML(m,l),strategy:a}),[g,f,x.draggable,x.droppable,b,m,_,l,p,a]);return t.default.createElement(VL.Provider,{value:S},n)}var UL=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return jL(n,r,i).indexOf(t)},WL=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},GL={duration:200,easing:`ease`},KL=`transform`,qL=tF.Transition.toString({property:KL,duration:0,easing:`linear`}),JL={roleDescription:`sortable`};function YL(e){let{disabled:n,index:r,node:i,rect:a}=e,[o,s]=(0,t.useState)(null),c=(0,t.useRef)(r);return zP(()=>{if(!n&&r!==c.current&&i.current){let e=a.current;if(e){let t=jF(i.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&s(n)}}r!==c.current&&(c.current=r)},[n,r,i,a]),(0,t.useEffect)(()=>{o&&s(null)},[o]),o}function XL(e){let{animateLayoutChanges:n=WL,attributes:r,disabled:i,data:a,getNewIndex:o=UL,id:s,strategy:c,resizeObserverConfig:l,transition:u=GL}=e,{items:d,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:_,useDragOverlay:v,strategy:y}=(0,t.useContext)(VL),b=ZL(i,m),x=d.indexOf(s),S=(0,t.useMemo)(()=>({sortable:{containerId:f,index:x,items:d},...a}),[f,a,x,d]),C=(0,t.useMemo)(()=>d.slice(d.indexOf(s)),[d,s]),{rect:w,node:T,isOver:E,setNodeRef:D}=vL({id:s,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...l}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:ee,setActivatorNodeRef:F,transform:te}=mL({id:s,data:S,attributes:{...JL,...r},disabled:b.draggable}),I=AP(D,M),ne=!!O,re=ne&&!h&&NL(p)&&NL(_),ie=!v&&P,ae=re?(ie&&re?te:null)??(c??y)({rects:g,activeNodeRect:A,activeIndex:p,overIndex:_,index:x}):null,oe=NL(p)&&NL(_)?o({id:s,items:d,activeIndex:p,overIndex:_}):x,se=O?.id,ce=(0,t.useRef)({activeId:se,items:d,newIndex:oe,containerId:f}),le=d!==ce.current.items,ue=n({active:O,containerId:f,isDragging:P,isSorting:ne,id:s,index:x,items:d,newIndex:ce.current.newIndex,previousItems:ce.current.items,previousContainerId:ce.current.containerId,transition:u,wasDragging:ce.current.activeId!=null}),de=YL({disabled:!ue,index:x,node:T,rect:w});return(0,t.useEffect)(()=>{ne&&ce.current.newIndex!==oe&&(ce.current.newIndex=oe),f!==ce.current.containerId&&(ce.current.containerId=f),d!==ce.current.items&&(ce.current.items=d)},[ne,oe,f,d]),(0,t.useEffect)(()=>{if(se===ce.current.activeId)return;if(se!=null&&ce.current.activeId==null){ce.current.activeId=se;return}let e=setTimeout(()=>{ce.current.activeId=se},50);return()=>clearTimeout(e)},[se]),{active:O,activeIndex:p,attributes:j,data:S,rect:w,index:x,newIndex:oe,items:d,isOver:E,isSorting:ne,isDragging:P,listeners:N,node:T,overIndex:_,over:ee,setNodeRef:I,setActivatorNodeRef:F,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:de??ae,transition:fe()};function fe(){if(de||le&&ce.current.newIndex===x)return qL;if(!(ie&&!QP(k)||!u)&&(ne||ue))return tF.Transition.toString({...u,property:KL})}}function ZL(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}$.Down,$.Right,$.Up,$.Left;var QL={text:`Texto`,image:`Imagem`,box:`Grupo / Cartão`,"text-container":`Texto em Caixa`,group:`Grupo`,checkbox:`Caixa de Seleção`},$L=({element:e,isSelected:t,onSelect:n,onToggleLock:i,onToggleHide:a})=>{let{attributes:o,listeners:s,setNodeRef:c,transform:l,transition:u,isDragging:d}=XL({id:e.id});return(0,r.jsx)(U,{ref:c,style:{transform:tF.Transform.toString(l),transition:u,opacity:d?.5:1,touchAction:`none`},children:(0,r.jsxs)(W,{align:`center`,style:{padding:`8px 12px`,backgroundColor:t?`var(--accent-a3)`:`var(--gray-2)`,borderRadius:6,cursor:`pointer`,marginBottom:4,border:t?`1px solid var(--accent-9)`:`1px solid transparent`},onClick:e=>n(e.shiftKey),children:[(0,r.jsx)(U,{...o,...s,style:{cursor:`grab`,color:`var(--gray-8)`,marginRight:8},children:(0,r.jsx)(Re,{})}),(0,r.jsxs)(U,{style:{color:`var(--gray-10)`,marginRight:8},children:[e.type===`text`&&(0,r.jsx)(Rt,{}),e.type===`image`&&(0,r.jsx)(Xe,{}),(e.type===`box`||e.type===`group`)&&(0,r.jsx)(ue,{})]}),(0,r.jsx)(H,{size:`2`,weight:t?`bold`:`regular`,style:{flex:1},truncate:!0,children:e.name||QL[e.type]||e.type}),(0,r.jsxs)(W,{gap:`1`,onClick:e=>e.stopPropagation(),children:[(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:e.locked?`orange`:`gray`,onClick:i,title:e.locked?`Desbloquear`:`Bloquear`,children:e.locked?(0,r.jsx)(et,{}):(0,r.jsx)(nt,{})}),(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:e.hidden?`red`:`gray`,onClick:a,title:e.hidden?`Mostrar`:`Ocultar`,children:e.hidden?(0,r.jsx)(Be,{}):(0,r.jsx)(He,{})})]})]})})};let eR=()=>{let{state:e,selectElement:n,moveElement:i,updateElement:a}=rS(),{elements:o,selectedElementIds:s}=e,c=(0,t.useMemo)(()=>[...o].reverse(),[o]),[l,u]=(0,t.useState)(null),d=_F(gF(pI,{activationConstraint:{distance:5}}));return(0,r.jsx)(U,{children:(0,r.jsxs)(uL,{sensors:d,onDragStart:e=>{u(e.active.id)},onDragEnd:e=>{let{active:t,over:n}=e;if(u(null),n&&t.id!==n.id){let e=c.findIndex(e=>e.id===t.id),r=c.findIndex(e=>e.id===n.id);i(o.length-1-e,o.length-1-r)}},children:[(0,r.jsx)(HL,{items:c.map(e=>e.id),strategy:RL,children:(0,r.jsxs)(W,{direction:`column`,children:[c.map(e=>(0,r.jsx)($L,{element:e,isSelected:s.includes(e.id),onSelect:t=>n(e.id,t),onToggleLock:()=>a(e.id,{locked:!e.locked}),onToggleHide:()=>a(e.id,{hidden:!e.hidden})},e.id)),c.length===0&&(0,r.jsx)(H,{size:`2`,color:`gray`,align:`center`,style:{padding:20},children:`Adicione itens para ver a lista aqui.`})]})}),(0,r.jsx)(AL,{children:l?(0,r.jsx)(U,{style:{padding:`8px 12px`,backgroundColor:`var(--gray-4)`,borderRadius:6,boxShadow:`0 4px 12px rgba(0,0,0,0.1)`},children:(0,r.jsx)(H,{children:`Movendo...`})}):null})]})})},tR=()=>{let{state:e,updateElement:n,removeSelected:i,copy:a}=rS(),[o,s]=(0,t.useState)(!1),c=e.selectedElementIds[0],l=e.elements.find(e=>e.id===c);if(!l)return null;let u=e=>{n(l.id,e)},d=e=>{u({style:{...l.style,...e}})},f=l.style?.textAlign||`left`,p=parseInt(l.style?.fontSize||`14`,10),m=parseInt(l.style?.borderWidth||`0`,10),h=parseInt(l.style?.padding||`0`,10),g=parseInt(l.style?.borderRadius||`0`,10),_=Math.round((parseFloat(String(l.style?.opacity??`1`))||1)*100),v=l.style?.fontFamily||`Arial`,y=kS(l.style?.fontWeight,DS),b=AS(v,e.availableFonts||[`Arial`,`Helvetica`,`Times New Roman`,`Courier New`,`Verdana`,`Georgia`,`Tahoma`,`Trebuchet MS`]);return(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsx)(H,{size:`3`,weight:`bold`,children:nR(l.type)}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsx)(J,{variant:`soft`,color:l.locked?`orange`:`gray`,onClick:()=>u({locked:!l.locked}),title:l.locked?`Desbloquear`:`Bloquear`,children:l.locked?(0,r.jsx)(et,{}):(0,r.jsx)(nt,{})}),(0,r.jsx)(J,{variant:`soft`,color:l.hidden?`blue`:`gray`,onClick:()=>u({hidden:!l.hidden}),title:l.hidden?`Mostrar`:`Ocultar`,children:l.hidden?(0,r.jsx)(Be,{}):(0,r.jsx)(He,{})}),(0,r.jsx)(Qy,{orientation:`vertical`}),(0,r.jsx)(J,{variant:`soft`,color:`gray`,onClick:a,title:`Copiar`,children:(0,r.jsx)(we,{})}),(0,r.jsx)(J,{variant:`soft`,color:`red`,onClick:i,title:`Excluir`,children:(0,r.jsx)(Xt,{})})]})]}),(0,r.jsx)(Qy,{size:`4`}),(l.type===`text`||l.type===`text-container`)&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Conteúdo`}),(0,r.jsx)(pb,{value:l.content,onChange:e=>u({content:e.target.value}),rows:3,placeholder:`Digite o texto aqui...`})]}),l.type===`image`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Imagem`}),(0,r.jsxs)(U,{mb:`2`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Vínculo de Propriedade`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[l.dataBinding?e.availableProps.find(e=>e.dataName===l.dataBinding)?.name||l.dataBinding:`Nenhum (URL fixa)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>u({dataBinding:void 0}),children:`Nenhum (URL fixa)`}),e.availableProps.map(e=>(0,r.jsx)(q,{onSelect:()=>u({dataBinding:e.dataName,content:`{{${e.dataName}}}`}),children:e.name},e.dataName)),e.availableProps.length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhuma variável disponível`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`URL ou {{variável}}`}),(0,r.jsx)(X,{value:l.content,onChange:e=>u({content:e.target.value}),placeholder:`https://... ou {{profilePicture}}`}),(0,r.jsx)(H,{size:`1`,color:`gray`,mt:`1`,as:`div`,children:`Se o valor vinculado for um link/URL válido, a imagem será exibida.`})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Aparência`}),(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(l.type===`text`||l.type===`text-container`)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Fonte`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(0,r.jsx)(`span`,{style:{fontFamily:v},children:v}),(0,r.jsx)(ve,{})]})}),(0,r.jsx)(fy,{style:{zIndex:1e5},children:b.map(e=>(0,r.jsx)(q,{onSelect:()=>d({fontFamily:e}),style:{fontFamily:e},children:e},e))})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Peso`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[y===`normal`?`Normal`:y===`bold`?`Negrito`:y===`100`?`Fina`:y===`300`?`Leve`:`Pesada`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({fontWeight:`normal`}),children:`Normal`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`bold`})},children:`Negrito`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`100`})},children:`Fina`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`300`})},children:`Leve`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`900`})},children:`Pesada`})]})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Tamanho do Texto`}),(0,r.jsxs)(H,{size:`1`,children:[p,`px`]})]}),(0,r.jsx)(tb,{min:8,max:72,value:[p],onValueChange:e=>d({fontSize:`${e[0]}px`})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Alinhamento`}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsx)(J,{variant:f===`left`?`solid`:`soft`,color:`gray`,onClick:()=>d({textAlign:`left`}),children:(0,r.jsx)(Wt,{})}),(0,r.jsx)(J,{variant:f===`center`?`solid`:`soft`,color:`gray`,onClick:()=>d({textAlign:`center`}),children:(0,r.jsx)(Bt,{})}),(0,r.jsx)(J,{variant:f===`right`?`solid`:`soft`,color:`gray`,onClick:()=>d({textAlign:`right`}),children:(0,r.jsx)(Kt,{})})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Estilo`}),(0,r.jsxs)(W,{gap:`1`,children:[(0,r.jsx)(J,{variant:l.style?.fontStyle===`italic`?`solid`:`soft`,color:`gray`,onClick:e=>{e.stopPropagation(),d({fontStyle:l.style?.fontStyle===`italic`?`normal`:`italic`})},title:`Itálico`,children:(0,r.jsx)(Ke,{})}),(0,r.jsx)(J,{variant:l.style?.textDecoration===`underline`?`solid`:`soft`,color:`gray`,onClick:e=>{e.stopPropagation(),d({textDecoration:l.style?.textDecoration===`underline`?`none`:`underline`})},title:`Sublinhado`,children:(0,r.jsx)(Qt,{})}),(0,r.jsx)(J,{variant:l.style?.textDecoration===`line-through`?`solid`:`soft`,color:`gray`,onClick:e=>{e.stopPropagation(),d({textDecoration:l.style?.textDecoration===`line-through`?`none`:`line-through`})},title:`Tachado`,children:(0,r.jsx)(Pt,{})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Transformação`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(l.style?.textTransform||`none`)===`none`?`Nenhum`:l.style?.textTransform===`uppercase`?`MAIÚSCULA`:l.style?.textTransform===`lowercase`?`minúscula`:`Capitalizada`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({textTransform:`none`}),children:`Nenhum`}),(0,r.jsx)(q,{onSelect:()=>d({textTransform:`uppercase`}),children:`MAIÚSCULA`}),(0,r.jsx)(q,{onSelect:()=>d({textTransform:`lowercase`}),children:`minúscula`}),(0,r.jsx)(q,{onSelect:()=>d({textTransform:`capitalize`}),children:`Capitalizada`})]})]})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Altura da Linha`}),(0,r.jsx)(X,{placeholder:`Normal`,value:l.style?.lineHeight||``,onChange:e=>d({lineHeight:e.target.value||`normal`})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Espaçamento`}),(0,r.jsx)(X,{placeholder:`Normal`,value:l.style?.letterSpacing||``,onChange:e=>d({letterSpacing:e.target.value||`normal`})})]})]}),l.type===`text-container`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Alinhamento Vertical`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(l.style?.alignItems||`flex-start`)===`flex-start`?`Topo`:l.style?.alignItems===`center`?`Centro`:`Base`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({alignItems:`flex-start`}),children:`Topo`}),(0,r.jsx)(q,{onSelect:()=>d({alignItems:`center`}),children:`Centro`}),(0,r.jsx)(q,{onSelect:()=>d({alignItems:`flex-end`}),children:`Base`})]})]})]})]}),l.type===`image`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Ajuste da Imagem`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(l.style?.objectFit||`cover`)===`cover`?`Cobrir (Cover)`:l.style?.objectFit===`contain`?`Conter (Contain)`:`Esticar (Fill)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({objectFit:`cover`}),children:`Cobrir (Cover)`}),(0,r.jsx)(q,{onSelect:()=>d({objectFit:`contain`}),children:`Conter (Contain)`}),(0,r.jsx)(q,{onSelect:()=>d({objectFit:`fill`}),children:`Esticar (Fill)`})]})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor de Fundo`}),(0,r.jsx)(nP,{color:l.style?.backgroundColor||`transparent`,onChange:e=>d({backgroundColor:e})})]}),(l.type===`text`||l.type===`text-container`)&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor do Texto`}),(0,r.jsx)(nP,{color:l.style?.color||`#000000`,onChange:e=>d({color:e})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Borda (Espessura)`}),(0,r.jsxs)(H,{size:`1`,children:[m,`px`]})]}),(0,r.jsx)(tb,{min:0,max:10,value:[m],onValueChange:e=>d({borderWidth:`${e[0]}px`,borderStyle:e[0]>0?`solid`:`none`,borderColor:l.style?.borderColor||`#000000`})})]}),m>0&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor da Borda`}),(0,r.jsx)(nP,{color:l.style?.borderColor||`#000000`,onChange:e=>d({borderColor:e})})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Cantos Arredondados`}),(0,r.jsxs)(H,{size:`1`,children:[g,`px`]})]}),(0,r.jsx)(tb,{min:0,max:50,value:[g],onValueChange:e=>d({borderRadius:`${e[0]}px`})})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Opacidade`}),(0,r.jsxs)(H,{size:`1`,children:[_,`%`]})]}),(0,r.jsx)(tb,{min:0,max:100,value:[_],onValueChange:e=>d({opacity:e[0]/100})})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Espaçamento Interno (Padding)`}),(0,r.jsxs)(H,{size:`1`,children:[h,`px`]})]}),(0,r.jsx)(tb,{min:0,max:40,value:[h],onValueChange:e=>d({padding:`${e[0]}px`})})]})]})]}),(0,r.jsxs)(U,{mt:`2`,pt:`2`,style:{borderTop:`1px solid var(--gray-5)`},children:[(0,r.jsxs)(G,{variant:`ghost`,onClick:()=>s(!o),style:{width:`100%`,justifyContent:`space-between`,color:`var(--gray-11)`,cursor:`pointer`},children:[(0,r.jsx)(W,{align:`center`,gap:`2`,children:(0,r.jsx)(H,{size:`2`,children:`Mais opções`})}),o?(0,r.jsx)(ve,{}):(0,r.jsx)(be,{})]}),o&&(0,r.jsx)(U,{mt:`3`,className:`advanced-properties-content`,children:(0,r.jsx)(rP,{elementId:l.id})})]})]},c)};var nR=e=>{switch(e){case`text`:return`Texto`;case`image`:return`Imagem`;case`box`:return`Caixa / Grupo`;case`text-container`:return`Texto em Caixa`;default:return`Elemento`}};let rR=({onClose:e})=>{let{state:t,addElement:n,groupElements:i}=rS(),a=t.selectedElementIds.length>0,o=t=>{let r={id:`el-${new Date().toISOString()}`,x:20,y:20,width:150,height:40,style:{}};switch(t){case`text`:n({...r,type:`text`,content:`Novo Texto`,width:120,height:30});break;case`image`:n({...r,type:`image`,content:`https://via.placeholder.com/150`,width:150,height:150});break;case`box`:n({...r,type:`box`,content:``,width:200,height:100,style:{border:`1px solid #ccc`}});break;case`text-container`:n({...r,type:`text-container`,content:`Texto em Caixa`,width:150,height:50,style:{backgroundColor:`#f0f0f0`,padding:`10px`}});break;case`separator`:n({...r,type:`box`,content:``,width:300,height:2,style:{backgroundColor:`#000000`}});break;case`timestamp`:n({...r,type:`text`,content:`{{timestamp}}`,width:150,height:30,formatting:{type:`date`,dateFormat:`dd/MM/yyyy HH:mm`}});break;case`badge`:n({...r,type:`text-container`,content:`Badge`,width:80,height:30,style:{backgroundColor:`#007bff`,color:`white`,borderRadius:`15px`,textAlign:`center`,lineHeight:`30px`}});break;case`list-item`:let e=crypto.randomUUID(),t=crypto.randomUUID(),a=crypto.randomUUID(),o=crypto.randomUUID();n({id:e,type:`box`,x:20,y:20,width:300,height:120,style:{backgroundColor:`#ffffff`,border:`1px solid #e0e0e0`,borderRadius:`8px`,boxShadow:`0 2px 4px rgba(0,0,0,0.05)`}}),n({id:t,type:`image`,content:`https://via.placeholder.com/80`,x:35,y:35,width:80,height:80,style:{borderRadius:`4px`}}),n({id:a,type:`text`,content:`Título do Item`,x:130,y:35,width:170,height:24,style:{fontSize:`18px`,fontWeight:`bold`,color:`#333`}}),n({id:o,type:`text`,content:`Descrição curta do item. Adicione detalhes aqui.`,x:130,y:65,width:170,height:40,style:{fontSize:`14px`,color:`#666`}}),setTimeout(()=>{i([e,t,a,o])},100);break}e&&e()};return(0,r.jsxs)(W,{direction:`column`,style:{height:`100%`},children:[(0,r.jsx)(U,{p:`4`,style:{borderBottom:`1px solid var(--gray-5)`,minHeight:`180px`,flexShrink:0,maxHeight:`calc(100vh - 150px)`,overflowY:`auto`},children:a?(0,r.jsx)(tR,{}):(0,r.jsxs)(W,{direction:`column`,align:`center`,justify:`center`,style:{height:`100%`,minHeight:`100px`},gap:`3`,children:[(0,r.jsxs)(H,{size:`2`,color:`gray`,align:`center`,children:[`Selecione um item no desenho`,(0,r.jsx)(`br`,{}),`para editar suas propriedades`]}),(0,r.jsx)(z_,{color:`blue`,variant:`soft`,children:`Dica: Clique no desenho`})]})}),(0,r.jsxs)(sb,{defaultValue:`blocks`,style:{display:`flex`,flexDirection:`column`,flex:1,overflow:`hidden`},children:[(0,r.jsx)(U,{px:`4`,pt:`4`,style:{flexShrink:0},children:(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`blocks`,children:`Blocos`}),(0,r.jsx)(lb,{value:`layers`,children:`Conteúdo`}),(0,r.jsx)(lb,{value:`history`,children:`Histórico`})]})}),(0,r.jsx)(Xv,{type:`auto`,scrollbars:`vertical`,style:{flex:1},children:(0,r.jsxs)(U,{p:`4`,children:[(0,r.jsxs)(ub,{value:`blocks`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Adicionar Elemento`}),(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`3`,as:`div`,children:`Clique para adicionar ao desenho`}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,children:[(0,r.jsx)(iR,{icon:(0,r.jsx)(We,{width:`20`,height:`20`}),label:`Texto`,onClick:()=>o(`text`)}),(0,r.jsx)(iR,{icon:(0,r.jsx)(Xe,{width:`20`,height:`20`}),label:`Imagem`,onClick:()=>o(`image`)}),(0,r.jsx)(iR,{icon:(0,r.jsx)(Ot,{width:`20`,height:`20`}),label:`Caixa / Grupo`,onClick:()=>o(`box`)}),(0,r.jsx)(iR,{icon:(0,r.jsx)(nn,{width:`20`,height:`20`}),label:`Texto em Caixa`,onClick:()=>o(`text-container`)}),(0,r.jsx)(iR,{icon:(0,r.jsx)(Ae,{width:`20`,height:`20`}),label:`Separador`,onClick:()=>o(`separator`)}),(0,r.jsx)(iR,{icon:(0,r.jsx)(Jt,{width:`20`,height:`20`}),label:`Data/Hora`,onClick:()=>o(`timestamp`)}),(0,r.jsx)(iR,{icon:(0,r.jsx)(At,{width:`20`,height:`20`}),label:`Badge / Etiqueta`,onClick:()=>o(`badge`)})]}),(0,r.jsx)(U,{mt:`4`,children:(0,r.jsx)(OP,{})})]}),(0,r.jsx)(ub,{value:`layers`,children:(0,r.jsx)(eR,{})}),(0,r.jsx)(ub,{value:`history`,children:(0,r.jsx)(kP,{onClose:e})})]})})]})]})};var iR=({icon:e,label:t,onClick:n})=>(0,r.jsx)(Ev,{style:{cursor:`pointer`,transition:`all 0.2s`},onClick:n,children:(0,r.jsxs)(W,{direction:`column`,align:`center`,gap:`2`,p:`2`,children:[(0,r.jsx)(U,{style:{color:`var(--accent-9)`},children:e}),(0,r.jsx)(H,{size:`1`,weight:`medium`,align:`center`,children:t})]})});let aR=()=>{let{state:e,setZoom:t,setPan:n}=rS(),{zoom:i,elements:a}=e;return(0,r.jsxs)(W,{align:`center`,gap:`2`,style:{backgroundColor:`var(--color-panel-solid)`,padding:`4px 8px`,borderRadius:`8px`,boxShadow:`0 2px 10px rgba(0,0,0,0.1)`,border:`1px solid var(--gray-6)`},children:[(0,r.jsx)(bb,{content:`Diminuir Zoom (-)`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>t(Math.max(.1,i-.1)),children:(0,r.jsx)(ct,{})})}),(0,r.jsxs)(H,{size:`1`,style:{width:40,textAlign:`center`,fontVariantNumeric:`tabular-nums`},children:[Math.round(i*100),`%`]}),(0,r.jsx)(bb,{content:`Aumentar Zoom (+)`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>t(Math.min(5,i+.1)),children:(0,r.jsx)(mt,{})})}),(0,r.jsx)(Qy,{orientation:`vertical`,style:{height:16}}),(0,r.jsx)(bb,{content:`Resetar (100%)`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>t(1),children:(0,r.jsx)(St,{})})}),(0,r.jsx)(bb,{content:`Ajustar à Tela`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>{if(a.length===0)return;let e=1/0,r=1/0,i=-1/0,o=-1/0;a.forEach(t=>{e=Math.min(e,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x+t.width),o=Math.max(o,t.y+t.height)});let s=i-e+100,c=o-r+100,l=window.innerWidth<768?0:300,u=window.innerWidth-l,d=window.innerHeight-100,f=u/s,p=d/c,m=Math.min(f,p);m=Math.min(Math.max(m,.1),5),t(m);let h=(e+i)/2,g=(r+o)/2,_=u/2,v=d/2;n({x:_-h*m,y:v-g*m})},children:(0,r.jsx)(N,{})})})]})},oR=({isOpen:e,onClose:n,templates:i,onSelectTemplate:a,initialStep:o=1,onFinishWizard:s,onStartTour:c})=>{let[l,u]=(0,t.useState)(o),[d,f]=(0,t.useState)(null);t.default.useEffect(()=>{e&&o&&u(o)},[e,o]);let p=()=>{l===1&&d?(a(i.find(e=>e.id===d)||null),u(2)):l===2?(n(),c&&c()):l===3&&(s&&s(),n())};return(0,r.jsx)(ny,{open:e,onOpenChange:n,children:(0,r.jsx)(iy,{style:{maxWidth:800},children:(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsx)(ay,{children:(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(it,{}),` Assistente de Criação`]})}),(0,r.jsx)(W,{gap:`2`,children:(0,r.jsx)(sR,{current:l,total:3})})]}),(0,r.jsxs)(U,{children:[l===1&&(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsx)(m_,{size:`4`,children:`Passo 1: Escolha um Modelo (Template)`}),(0,r.jsx)(H,{color:`gray`,size:`2`,children:`Comece com um layout pronto e personalize conforme sua necessidade.`}),(0,r.jsxs)(K,{columns:`3`,gap:`3`,children:[i.map(e=>(0,r.jsx)(Ev,{variant:d===e.id?`surface`:`classic`,style:{cursor:`pointer`,border:d===e.id?`2px solid var(--accent-9)`:void 0,backgroundColor:d===e.id?`var(--accent-2)`:void 0},onClick:()=>f(e.id),children:(0,r.jsxs)(W,{direction:`column`,gap:`2`,align:`center`,p:`2`,children:[(0,r.jsx)(U,{style:{width:`100%`,height:100,backgroundColor:`var(--gray-3)`,borderRadius:4,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(We,{width:32,height:32,color:`var(--gray-8)`})}),(0,r.jsx)(H,{weight:`bold`,size:`2`,children:e.name}),(0,r.jsx)(H,{size:`1`,color:`gray`,align:`center`,children:e.description})]})},e.id)),(0,r.jsx)(Ev,{variant:d===`blank`?`surface`:`classic`,style:{cursor:`pointer`,border:d===`blank`?`2px solid var(--accent-9)`:void 0,backgroundColor:d===`blank`?`var(--accent-2)`:void 0},onClick:()=>f(`blank`),children:(0,r.jsxs)(W,{direction:`column`,gap:`2`,align:`center`,p:`2`,children:[(0,r.jsx)(U,{style:{width:`100%`,height:100,backgroundColor:`var(--gray-3)`,borderRadius:4,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(U,{style:{width:40,height:40,border:`2px dashed var(--gray-8)`,borderRadius:4}})}),(0,r.jsx)(H,{weight:`bold`,size:`2`,children:`Começar do Zero`}),(0,r.jsx)(H,{size:`1`,color:`gray`,align:`center`,children:`Tela em branco`})]})})]}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(G,{variant:`soft`,color:`gray`,onClick:n,children:`Pular Assistente`}),(0,r.jsxs)(G,{onClick:p,disabled:!d,children:[`Continuar `,(0,r.jsx)(j,{})]})]})]}),l===2&&(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsx)(m_,{size:`4`,children:`Passo 2: Personalizar Visual`}),(0,r.jsx)(H,{color:`gray`,size:`2`,children:`Agora é sua vez de ajustar o layout. Use as ferramentas disponíveis.`}),(0,r.jsxs)(K,{columns:`2`,gap:`4`,children:[(0,r.jsx)(Ev,{variant:`surface`,children:(0,r.jsxs)(W,{gap:`3`,align:`start`,children:[(0,r.jsx)(U,{style:{padding:8,backgroundColor:`var(--accent-3)`,borderRadius:4},children:(0,r.jsx)(We,{width:20,height:20,color:`var(--accent-9)`})}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{weight:`bold`,size:`2`,as:`div`,children:`Edite Conteúdo`}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Clique duas vezes em qualquer texto ou imagem para editar suas propriedades.`})]})]})}),(0,r.jsx)(Ev,{variant:`surface`,children:(0,r.jsxs)(W,{gap:`3`,align:`start`,children:[(0,r.jsx)(U,{style:{padding:8,backgroundColor:`var(--green-3)`,borderRadius:4},children:(0,r.jsx)(it,{width:20,height:20,color:`var(--green-9)`})}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{weight:`bold`,size:`2`,as:`div`,children:`Adicione Blocos`}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Use a barra lateral esquerda para arrastar novos elementos.`})]})]})})]}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsxs)(G,{variant:`soft`,color:`gray`,onClick:()=>u(1),children:[(0,r.jsx)(j,{style:{transform:`rotate(180deg)`}}),` Voltar`]}),(0,r.jsxs)(G,{onClick:p,children:[`Começar a Editar `,(0,r.jsx)(j,{})]})]})]}),l===3&&(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsx)(m_,{size:`4`,children:`Passo 3: Testar e Exportar`}),(0,r.jsx)(H,{color:`gray`,size:`2`,children:`Seu layout está pronto? Teste com dados diferentes e exporte o resultado.`}),(0,r.jsx)(Ev,{variant:`surface`,style:{padding:20},children:(0,r.jsxs)(W,{direction:`column`,gap:`3`,align:`center`,children:[(0,r.jsx)(ge,{width:48,height:48,color:`var(--green-9)`}),(0,r.jsx)(m_,{size:`3`,children:`Tudo pronto!`}),(0,r.jsx)(H,{align:`center`,children:`Você completou a criação do layout. Agora você pode salvar, exportar ou continuar editando.`})]})}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(G,{variant:`soft`,color:`gray`,onClick:n,children:`Voltar a Editar`}),(0,r.jsxs)(G,{onClick:p,color:`green`,children:[(0,r.jsx)(ge,{}),` Concluir e Exportar`]})]})]})]})]})})})};var sR=({current:e,total:t})=>(0,r.jsx)(W,{gap:`2`,children:[1,2,3].map(n=>(0,r.jsxs)(W,{align:`center`,gap:`1`,children:[(0,r.jsx)(U,{style:{width:24,height:24,borderRadius:`50%`,backgroundColor:n<=e?`var(--accent-9)`:`var(--gray-4)`,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:12,fontWeight:`bold`},children:n<e?(0,r.jsx)(ge,{}):n}),n<t&&(0,r.jsx)(U,{style:{width:20,height:2,backgroundColor:`var(--gray-4)`}})]},n))}),cR=({initialState:e,onSave:n,theme:i=`light`,templates:a,activeTemplateId:o,onTemplateChange:s})=>{let[c,l]=(0,t.useState)(!0),[u,d]=(0,t.useState)(!0),[f,p]=(0,t.useState)(!1),[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(a&&a.length>0?a[0].id:null),v=t.default.useRef(null),[y,b]=(0,t.useState)(!1),[x,S]=(0,t.useState)(1),[C,w]=(0,t.useState)(!1),{addElement:T,loadState:E,state:D,undo:O,redo:k,copy:A,paste:j,removeSelected:M,updateElements:N}=rS(),P=t.default.useRef(!1);t.default.useEffect(()=>{let e=()=>{let e=window.innerWidth<768;h(e),e&&(d(!1),l(!1))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let ee=()=>{let e={elements:D.elements,isList:D.isList,mockData:D.mockData,singleMockData:D.singleMockData,listSettings:D.listSettings,canvasHeight:D.canvasHeight,gridSize:D.gridSize},t=JSON.stringify(e,null,2),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`layout-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)};t.default.useEffect(()=>{let e=e=>{if(document.activeElement?.tagName===`INPUT`||document.activeElement?.tagName===`TEXTAREA`||document.activeElement?.isContentEditable)return;let t=e.clipboardData?.items;if(t){for(let n=0;n<t.length;n++)if(t[n].type.indexOf(`image`)!==-1){e.preventDefault();let r=t[n].getAsFile();if(r){let e=new FileReader;e.onload=e=>{let t=e.target?.result;T({type:`image`,content:t,width:200,height:200})},e.readAsDataURL(r)}}}};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[T]),t.default.useEffect(()=>{let e=e=>{if(!(document.activeElement?.tagName===`INPUT`||document.activeElement?.tagName===`TEXTAREA`||document.activeElement?.isContentEditable)){if((e.ctrlKey||e.metaKey)&&e.key===`z`)e.shiftKey?(e.preventDefault(),k()):(e.preventDefault(),O());else if((e.ctrlKey||e.metaKey)&&e.key===`y`)e.preventDefault(),k();else if((e.ctrlKey||e.metaKey)&&e.key===`c`)e.preventDefault(),A();else if((e.ctrlKey||e.metaKey)&&e.key===`v`)e.preventDefault(),j();else if(e.key===`Delete`||e.key===`Backspace`)D.selectedElementIds.length>0&&(e.preventDefault(),M());else if([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`].includes(e.key)&&D.selectedElementIds.length>0){e.preventDefault();let t=e.shiftKey?10:1,n=[];D.selectedElementIds.forEach(r=>{let i=D.elements.find(e=>e.id===r);if(i){let a={};e.key===`ArrowUp`&&(a.y=i.y-t),e.key===`ArrowDown`&&(a.y=i.y+t),e.key===`ArrowLeft`&&(a.x=i.x-t),e.key===`ArrowRight`&&(a.x=i.x+t),n.push({id:r,changes:a})}}),n.length>0&&N(n)}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[O,k,A,j,M,D.selectedElementIds,D.elements,N]);let[F,te]=(0,t.useState)(!1);t.default.useEffect(()=>{if(e)try{let t=typeof e==`string`?JSON.parse(e):e;Array.isArray(t)?E({elements:t}):t.elements&&E(t)}catch(e){console.error(`Failed to load initial state`,e)}te(!0)},[e,E]),t.default.useEffect(()=>{F&&(P.current||D.elements.length===0&&(P.current=!0,S(1),b(!0)))},[F,D.elements]),t.default.useEffect(()=>{!a||a.length===0||f&&_(o||a[0].id)},[o,f,a]);let I=t.default.useCallback(e=>{if(e)try{let t=typeof e==`string`?JSON.parse(e):e;if(Array.isArray(t)){E({elements:t});return}if(t&&typeof t==`object`&&`elements`in t){E(t);return}}catch(e){console.error(`Failed to apply template`,e)}},[E]);return t.default.useEffect(()=>{if(!a||a.length===0||!o||v.current===o)return;let e=a.find(e=>e.id===o);e&&(I(e.state),v.current=o)},[o,I,a]),(0,r.jsx)(A_,{appearance:i,accentColor:`blue`,grayColor:`slate`,radius:`large`,scaling:`105%`,children:(0,r.jsxs)(W,{direction:`column`,style:{height:`100vh`,width:`100%`,overflow:`hidden`,backgroundColor:`var(--gray-1)`},children:[(0,r.jsx)(LS,{onSave:n,templates:a,setIsTemplatesOpen:p,onFinish:()=>{S(3),b(!0)},onToggleSidebar:()=>d(!u)}),(0,r.jsxs)(W,{direction:`row`,style:{flexGrow:1,overflow:`hidden`},children:[m&&u&&(0,r.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,backgroundColor:`rgba(0,0,0,0.5)`,zIndex:90},onClick:()=>d(!1)}),u&&(0,r.jsxs)(W,{id:`sidebar-area`,direction:`column`,width:m?`100%`:`300px`,style:{borderRight:`1px solid var(--gray-5)`,backgroundColor:`var(--gray-1)`,flexShrink:0,height:`100%`,boxShadow:`1px 0 0 var(--gray-4)`,overflow:`hidden`,position:m?`absolute`:`relative`,zIndex:m?100:`auto`,top:0,left:0},children:[m&&(0,r.jsx)(W,{justify:`end`,p:`2`,children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>d(!1),children:(0,r.jsx)(Ee,{})})}),(0,r.jsx)(rR,{onClose:()=>{m&&d(!1)}})]}),(0,r.jsxs)(W,{direction:`column`,style:{flex:1,height:`100%`,overflow:`hidden`},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,px:`3`,py:`2`,style:{borderBottom:`1px solid var(--gray-6)`,backgroundColor:`var(--gray-1)`,flexShrink:0,zIndex:10},children:[(0,r.jsx)(W,{gap:`3`,align:`center`,children:(0,r.jsx)(J,{size:`2`,variant:`ghost`,color:`gray`,onClick:()=>d(!u),title:u?`Ocultar Barra Lateral`:`Mostrar Barra Lateral`,style:{cursor:`pointer`},children:m?(0,r.jsx)(Qe,{}):u?(0,r.jsx)(Me,{}):(0,r.jsx)(Pe,{})})}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsx)(DP,{}),(0,r.jsx)(J,{size:`2`,variant:`ghost`,color:c?`blue`:`gray`,onClick:()=>l(!c),title:c?`Ocultar Preview`:`Mostrar Preview`,style:{cursor:`pointer`},children:c?(0,r.jsx)(He,{}):(0,r.jsx)(Be,{})})]})]}),(0,r.jsx)(U,{style:{flex:1,position:`relative`,overflow:`hidden`},children:(0,r.jsxs)(Kx,{orientation:`horizontal`,style:{height:`100%`,width:`100%`},children:[(!m||!c)&&(0,r.jsx)(Xx,{defaultSize:50,minSize:20,children:(0,r.jsxs)(K,{columns:`20px 1fr`,rows:`20px 1fr`,style:{height:`100%`,width:`100%`,backgroundColor:`var(--color-background)`},children:[(0,r.jsx)(U,{style:{backgroundColor:`var(--gray-2)`,borderRight:`1px solid var(--gray-6)`,borderBottom:`1px solid var(--gray-6)`,zIndex:30}}),(0,r.jsx)(U,{style:{backgroundColor:`var(--gray-2)`,borderBottom:`1px solid var(--gray-6)`,overflow:`hidden`,zIndex:30},children:(0,r.jsx)(TP,{orientation:`horizontal`})}),(0,r.jsx)(U,{style:{backgroundColor:`var(--gray-2)`,borderRight:`1px solid var(--gray-6)`,overflow:`hidden`,zIndex:30},children:(0,r.jsx)(TP,{orientation:`vertical`})}),(0,r.jsxs)(U,{style:{position:`relative`,overflow:`hidden`,width:`100%`,height:`100%`},id:`canvas-area`,children:[(0,r.jsx)(U,{style:{position:`absolute`,top:16,left:`50%`,transform:`translateX(-50%)`,zIndex:20},children:(0,r.jsx)(iS,{})}),(0,r.jsx)(U,{style:{position:`absolute`,bottom:16,right:16,zIndex:20},children:(0,r.jsx)(aR,{})}),(0,r.jsx)(IS,{}),(0,r.jsx)(RS,{})]})]})}),!m&&c&&(0,r.jsx)(Qy,{style:{width:`4px`,backgroundColor:`var(--gray-6)`,cursor:`col-resize`,transition:`background-color 0.2s`}}),c&&(0,r.jsx)(Xx,{defaultSize:50,minSize:20,children:(0,r.jsx)(U,{id:`preview-area`,style:{height:`100%`,width:`100%`,backgroundColor:`var(--gray-3)`,borderLeft:`1px solid var(--gray-5)`},children:(0,r.jsx)(gN,{})})})]})})]})]}),(0,r.jsx)(ny,{open:f,onOpenChange:p,children:(0,r.jsxs)(iy,{style:{maxWidth:450},children:[(0,r.jsx)(ay,{children:`Galeria de Templates`}),(0,r.jsx)(oy,{size:`2`,mb:`4`,children:`Escolha um layout pré-definido para começar.`}),a&&a.length>0?(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,as:`div`,mb:`2`,children:`Selecione o Template`}),(0,r.jsx)(W,{direction:`column`,gap:`2`,children:a.map(e=>(0,r.jsx)(G,{variant:g===e.id?`solid`:`soft`,color:g===e.id?`blue`:`gray`,size:`2`,style:{width:`100%`,justifyContent:`flex-start`,border:g===e.id?`2px solid var(--accent-9)`:void 0},onClick:()=>_(e.id),children:e.name},e.id))})]}),g&&a.find(e=>e.id===g)?.description&&(0,r.jsx)(U,{p:`3`,style:{backgroundColor:`var(--gray-2)`,borderRadius:8},children:(0,r.jsx)(H,{size:`2`,color:`gray`,children:a.find(e=>e.id===g)?.description})}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(sy,{children:(0,r.jsx)(G,{variant:`soft`,color:`gray`,children:`Cancelar`})}),(0,r.jsx)(sy,{children:(0,r.jsx)(G,{onClick:()=>{if(!g)return;if(s){s(g);return}let e=a.find(e=>e.id===g);e&&(I(e.state),v.current=g)},children:`Aplicar`})})]})]}):(0,r.jsx)(H,{children:`Nenhum template disponível.`})]})}),(0,r.jsx)(oR,{isOpen:y,onClose:()=>b(!1),templates:a||[],onSelectTemplate:e=>{e&&I(e.state)},onStartTour:()=>w(!0),initialStep:x,onFinishWizard:()=>{ee(),alert(`Layout finalizado e exportado com sucesso!`)}}),(0,r.jsx)(BS,{isOpen:C,onClose:()=>w(!1)}),(0,r.jsx)(xP,{})]})})};let lR=e=>(0,r.jsx)(nS,{isList:e.layout.isList,availableProps:e.layout.props,theme:e.theme,children:(0,r.jsx)(cR,{...e})});var uR=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,`$1-$2`).toLowerCase(),dR=e=>{let t=/^#([0-9a-fA-F]{8})$/.exec(e);if(!t)return e;let n=t[1];return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${parseInt(n.slice(6,8),16)/255})`},fR=e=>{if(!e)return``;let t=[`width`,`height`,`top`,`left`,`right`,`bottom`,`fontSize`,`borderRadius`,`padding`,`margin`,`borderWidth`,`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`,`minHeight`,`maxHeight`,`minWidth`,`maxWidth`];return Object.entries(e).map(([e,n])=>{if(n==null)return``;let r=uR(e),i=typeof n==`number`&&t.includes(e)?n+`px`:n;return typeof i==`string`&&/^#([0-9a-fA-F]{8})$/.test(i)&&(i=dR(i)),`${r}: ${i}`}).filter(Boolean).join(`; `)},pR=(e,t)=>{let n=/(rgba?\([^)]+\)|#(?:[0-9a-fA-F]{3,8})|[a-zA-Z]+)\s*$/;return!e||e===`none`?`0 4px 12px 0 ${t}`:n.test(e)?e.replace(n,t):`${e} ${t}`},mR=(e,t,n,r,i=1.2)=>{if(!e)return 0;try{let a=document.createElement(`canvas`).getContext(`2d`);if(!a)return 0;a.font=`${r}px ${n}`;let o=String(e).split(`
|
|
62
|
-
`),s=0;for(let e of o){let n=e.split(` `),r=``;if(n.length===1&&n[0]===``){s++;continue}for(let e=0;e<n.length;e++){let i=n[e],o=a.measureText(i).width;if(o>t){r.trim().length>0&&(s++,r=``),s+=Math.ceil(o/t);continue}let c=r+i+` `;a.measureText(c).width>t&&r.trim().length>0?(s++,r=i+` `):r=c}r.length>0&&s++}return Math.ceil(s*r*i)}catch{return 0}},
|
|
63
|
-
`)},
|
|
61
|
+
`},pF={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function mF(e){let{announcements:r=pF,container:i,hiddenTextDescribedById:a,screenReaderInstructions:o=fF}=e,{announce:s,announcement:c}=cF(),l=JP(`DndLiveRegion`),[u,d]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{d(!0)},[]),uF((0,t.useMemo)(()=>({onDragStart(e){let{active:t}=e;s(r.onDragStart({active:t}))},onDragMove(e){let{active:t,over:n}=e;r.onDragMove&&s(r.onDragMove({active:t,over:n}))},onDragOver(e){let{active:t,over:n}=e;s(r.onDragOver({active:t,over:n}))},onDragEnd(e){let{active:t,over:n}=e;s(r.onDragEnd({active:t,over:n}))},onDragCancel(e){let{active:t,over:n}=e;s(r.onDragCancel({active:t,over:n}))}}),[s,r])),!u)return null;let f=t.default.createElement(t.default.Fragment,null,t.default.createElement(oF,{id:a,value:o.draggable}),t.default.createElement(sF,{id:l,announcement:c}));return i?(0,n.createPortal)(f,i):f}var hF;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(hF||={});function gF(){}function _F(e,n){return(0,t.useMemo)(()=>({sensor:e,options:n??{}}),[e,n])}function vF(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return(0,t.useMemo)(()=>[...n].filter(e=>e!=null),[...n])}var yF=Object.freeze({x:0,y:0});function bF(e,t){let n=tF(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function xF(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function SF(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function CF(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var wF=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=CF(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(xF)};function TF(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function EF(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:yF}function DF(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var OF=DF(1);function kF(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function AF(e,t,n){let r=kF(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var jF={ignoreTransform:!1};function MF(e,t){t===void 0&&(t=jF);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=FP(e).getComputedStyle(e);t&&(n=AF(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function NF(e){return MF(e,{ignoreTransform:!0})}function PF(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function FF(e,t){return t===void 0&&(t=FP(e).getComputedStyle(e)),t.position===`fixed`}function IF(e,t){t===void 0&&(t=FP(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function LF(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(IP(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!LP(i)||RP(i)||n.includes(i))return n;let a=FP(e).getComputedStyle(i);return i!==e&&IF(i,a)&&n.push(i),FF(i,a)?n:r(i.parentNode)}return e?r(e):n}function RF(e){let[t]=LF(e,1);return t??null}function zF(e){return!MP||!e?null:NP(e)?e:PP(e)?IP(e)||e===zP(e).scrollingElement?window:LP(e)?e:null:null}function BF(e){return NP(e)?e.scrollX:e.scrollLeft}function VF(e){return NP(e)?e.scrollY:e.scrollTop}function HF(e){return{x:BF(e),y:VF(e)}}var UF;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(UF||={});function WF(e){return!MP||!e?!1:e===document.scrollingElement}function GF(e){let t={x:0,y:0},n=WF(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var KF={x:.2,y:.2};function qF(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=KF);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=GF(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=UF.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=UF.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=UF.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=UF.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function JF(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function YF(e){return e.reduce((e,t)=>XP(e,HF(t)),yF)}function XF(e){return e.reduce((e,t)=>e+BF(t),0)}function ZF(e){return e.reduce((e,t)=>e+VF(t),0)}function QF(e,t){if(t===void 0&&(t=MF),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);RF(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var $F=[[`x`,[`left`,`right`],XF],[`y`,[`top`,`bottom`],ZF]],eI=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=LF(t),r=YF(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of $F)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},tI=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function nI(e){let{EventTarget:t}=FP(e);return e instanceof t?e:zP(e)}function rI(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var iI;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(iI||={});function aI(e){e.preventDefault()}function oI(e){e.stopPropagation()}var $;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})($||={});var sI={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},cI=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},lI=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new tI(zP(t)),this.windowListeners=new tI(FP(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(iI.Resize,this.handleCancel),this.windowListeners.add(iI.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(iI.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&QF(n),t(yF)}handleKeyDown(e){if($P(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=sI,coordinateGetter:a=cI,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:yF;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=ZP(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=GF(n),p=JF(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===$.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,XP(ZP(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};lI.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=sI,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function uI(e){return!!(e&&`distance`in e)}function dI(e){return!!(e&&`delay`in e)}var fI=class{constructor(e,t,n){n===void 0&&(n=nI(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=zP(i),this.documentListeners=new tI(this.document),this.listeners=new tI(n),this.windowListeners=new tI(FP(i)),this.initialCoordinates=tF(r)??yF,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(iI.Resize,this.handleCancel),this.windowListeners.add(iI.DragStart,aI),this.windowListeners.add(iI.VisibilityChange,this.handleCancel),this.windowListeners.add(iI.ContextMenu,aI),this.documentListeners.add(iI.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(dI(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(uI(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(iI.Click,oI,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(iI.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=tF(e)??yF,s=ZP(n,o);if(!t&&a){if(uI(a)){if(a.tolerance!=null&&rI(s,a.tolerance))return this.handleCancel();if(rI(s,a.distance))return this.handleStart()}if(dI(a)&&rI(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},pI={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},mI=class extends fI{constructor(e){let{event:t}=e,n=zP(t.target);super(e,pI,n)}};mI.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var hI={move:{name:`mousemove`},end:{name:`mouseup`}},gI;(function(e){e[e.RightClick=2]=`RightClick`})(gI||={});var _I=class extends fI{constructor(e){super(e,hI,zP(e.event.target))}};_I.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===gI.RightClick?!1:(r?.({event:n}),!0)}}];var vI={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},yI=class extends fI{constructor(e){super(e,vI)}static setup(){return window.addEventListener(vI.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(vI.move.name,e)};function e(){}}};yI.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var bI;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(bI||={});var xI;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(xI||={});function SI(e){let{acceleration:n,activator:r=bI.Pointer,canScroll:i,draggingRect:a,enabled:o,interval:s=5,order:c=xI.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:p}=e,m=wI({delta:f,disabled:!o}),[h,g]=HP(),_=(0,t.useRef)({x:0,y:0}),v=(0,t.useRef)({x:0,y:0}),y=(0,t.useMemo)(()=>{switch(r){case bI.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case bI.DraggableRect:return a}},[r,a,l]),b=(0,t.useRef)(null),x=(0,t.useCallback)(()=>{let e=b.current;if(!e)return;let t=_.current.x*v.current.x,n=_.current.y*v.current.y;e.scrollBy(t,n)},[]),S=(0,t.useMemo)(()=>c===xI.TreeOrder?[...u].reverse():u,[c,u]);(0,t.useEffect)(()=>{if(!o||!u.length||!y){g();return}for(let e of S){if(i?.(e)===!1)continue;let t=d[u.indexOf(e)];if(!t)continue;let{direction:r,speed:a}=qF(e,t,y,n,p);for(let e of[`x`,`y`])m[e][r[e]]||(a[e]=0,r[e]=0);if(a.x>0||a.y>0){g(),b.current=e,h(x,s),_.current=a,v.current=r;return}}_.current={x:0,y:0},v.current={x:0,y:0},g()},[n,x,i,g,o,s,JSON.stringify(y),JSON.stringify(m),h,u,S,d,JSON.stringify(p)])}var CI={x:{[UF.Backward]:!1,[UF.Forward]:!1},y:{[UF.Backward]:!1,[UF.Forward]:!1}};function wI(e){let{delta:t,disabled:n}=e,r=KP(t);return WP(e=>{if(n||!r||!e)return CI;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[UF.Backward]:e.x[UF.Backward]||i.x===-1,[UF.Forward]:e.x[UF.Forward]||i.x===1},y:{[UF.Backward]:e.y[UF.Backward]||i.y===-1,[UF.Forward]:e.y[UF.Forward]||i.y===1}}},[n,t,r])}function TI(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return WP(e=>t==null?null:r??e??null,[r,t])}function EI(e,n){return(0,t.useMemo)(()=>e.reduce((e,t)=>{let{sensor:r}=t,i=r.activators.map(e=>({eventName:e.eventName,handler:n(e.handler,t)}));return[...e,...i]},[]),[e,n])}var DI;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(DI||={});var OI;(function(e){e.Optimized=`optimized`})(OI||={});var kI=new Map;function AI(e,n){let{dragging:r,dependencies:i,config:a}=n,[o,s]=(0,t.useState)(null),{frequency:c,measure:l,strategy:u}=a,d=(0,t.useRef)(e),f=_(),p=UP(f),m=(0,t.useCallback)(function(e){e===void 0&&(e=[]),!p.current&&s(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),h=(0,t.useRef)(null),g=WP(t=>{if(f&&!r)return kI;if(!t||t===kI||d.current!==e||o!=null){let t=new Map;for(let n of e){if(!n)continue;if(o&&o.length>0&&!o.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new eI(l(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,o,r,f,l]);return(0,t.useEffect)(()=>{d.current=e},[e]),(0,t.useEffect)(()=>{f||m()},[r,f]),(0,t.useEffect)(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),(0,t.useEffect)(()=>{f||typeof c!=`number`||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},c))},[c,f,m,...i]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:o!=null};function _(){switch(u){case DI.Always:return!1;case DI.BeforeDragging:return r;default:return!r}}}function jI(e,t){return WP(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function MI(e,t){return jI(e,t)}function NI(e){let{callback:n,disabled:r}=e,i=VP(n),a=(0,t.useMemo)(()=>{if(r||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(i)},[i,r]);return(0,t.useEffect)(()=>()=>a?.disconnect(),[a]),a}function PI(e){let{callback:n,disabled:r}=e,i=VP(n),a=(0,t.useMemo)(()=>{if(r||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(i)},[r]);return(0,t.useEffect)(()=>()=>a?.disconnect(),[a]),a}function FI(e){return new eI(MF(e),e)}function II(e,n,r){n===void 0&&(n=FI);let[i,a]=(0,t.useState)(null);function o(){a(t=>{if(!e)return null;if(e.isConnected===!1)return t??r??null;let i=n(e);return JSON.stringify(t)===JSON.stringify(i)?t:i})}let s=NI({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),c=PI({callback:o});return BP(()=>{o(),e?(c?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),s?.disconnect())},[e]),i}function LI(e){return EF(e,jI(e))}var RI=[];function zI(e){let n=(0,t.useRef)(e),r=WP(t=>e?t&&t!==RI&&e&&n.current&&e.parentNode===n.current.parentNode?t:LF(e):RI,[e]);return(0,t.useEffect)(()=>{n.current=e},[e]),r}function BI(e){let[n,r]=(0,t.useState)(null),i=(0,t.useRef)(e),a=(0,t.useCallback)(e=>{let t=zF(e.target);t&&r(e=>e?(e.set(t,HF(t)),new Map(e)):null)},[]);return(0,t.useEffect)(()=>{let t=i.current;if(e!==t){n(t);let o=e.map(e=>{let t=zF(e);return t?(t.addEventListener(`scroll`,a,{passive:!0}),[t,HF(t)]):null}).filter(e=>e!=null);r(o.length?new Map(o):null),i.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{zF(e)?.removeEventListener(`scroll`,a)})}},[a,e]),(0,t.useMemo)(()=>e.length?n?Array.from(n.values()).reduce((e,t)=>XP(e,t),yF):YF(e):yF,[e,n])}function VI(e,n){n===void 0&&(n=[]);let r=(0,t.useRef)(null);return(0,t.useEffect)(()=>{r.current=null},n),(0,t.useEffect)(()=>{let t=e!==yF;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)},[e]),r.current?ZP(e,r.current):yF}function HI(e){(0,t.useEffect)(()=>{if(!MP)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function UI(e,n){return(0,t.useMemo)(()=>e.reduce((e,t)=>{let{eventName:r,handler:i}=t;return e[r]=e=>{i(e,n)},e},{}),[e,n])}function WI(e){return(0,t.useMemo)(()=>e?PF(e):null,[e])}var GI=[];function KI(e,n){n===void 0&&(n=MF);let[r]=e,i=WI(r?FP(r):null),[a,o]=(0,t.useState)(GI);function s(){o(()=>e.length?e.map(e=>WF(e)?i:new eI(n(e),e)):GI)}let c=PI({callback:s});return BP(()=>{c?.disconnect(),s(),e.forEach(e=>c?.observe(e))},[e]),a}function qI(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return LP(t)?t:e}function JI(e){let{measure:n}=e,[r,i]=(0,t.useState)(null),a=PI({callback:(0,t.useCallback)(e=>{for(let{target:t}of e)if(LP(t)){i(e=>{let r=n(t);return e?{...e,width:r.width,height:r.height}:r});break}},[n])}),[o,s]=GP((0,t.useCallback)(e=>{let t=qI(e);a?.disconnect(),t&&a?.observe(t),i(t?n(t):null)},[n,a]));return(0,t.useMemo)(()=>({nodeRef:o,rect:r,setRef:s}),[r,o,s])}var YI=[{sensor:mI,options:{}},{sensor:lI,options:{}}],XI={current:{}},ZI={draggable:{measure:NF},droppable:{measure:NF,strategy:DI.WhileDragging,frequency:OI.Optimized},dragOverlay:{measure:MF}},QI=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},$I={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new QI,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:gF},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ZI,measureDroppableContainers:gF,windowRect:null,measuringScheduled:!1},eL={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:gF,draggableNodes:new Map,over:null,measureDroppableContainers:gF},tL=(0,t.createContext)(eL),nL=(0,t.createContext)($I);function rL(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new QI}}}function iL(e,t){switch(t.type){case hF.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case hF.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case hF.DragEnd:case hF.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case hF.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new QI(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case hF.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new QI(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case hF.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new QI(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function aL(e){let{disabled:n}=e,{active:r,activatorEvent:i,draggableNodes:a}=(0,t.useContext)(tL),o=KP(i),s=KP(r?.id);return(0,t.useEffect)(()=>{if(!n&&!i&&o&&s!=null){if(!$P(o)||document.activeElement===o.target)return;let e=a.get(s);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=iF(e);if(t){t.focus();break}}})}},[i,n,a,s,o]),null}function oL(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function sL(e){return(0,t.useMemo)(()=>({draggable:{...ZI.draggable,...e?.draggable},droppable:{...ZI.droppable,...e?.droppable},dragOverlay:{...ZI.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function cL(e){let{activeNode:n,measure:r,initialRect:i,config:a=!0}=e,o=(0,t.useRef)(!1),{x:s,y:c}=typeof a==`boolean`?{x:a,y:a}:a;BP(()=>{if(!s&&!c||!n){o.current=!1;return}if(o.current||!i)return;let e=n?.node.current;if(!e||e.isConnected===!1)return;let t=EF(r(e),i);if(s||(t.x=0),c||(t.y=0),o.current=!0,Math.abs(t.x)>0||Math.abs(t.y)>0){let n=RF(e);n&&n.scrollBy({top:t.y,left:t.x})}},[n,s,c,i,r])}var lL=(0,t.createContext)({...yF,scaleX:1,scaleY:1}),uL;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(uL||={});var dL=(0,t.memo)(function(e){let{id:r,accessibility:i,autoScroll:a=!0,children:o,sensors:s=YI,collisionDetection:c=wF,measuring:l,modifiers:u,...d}=e,[f,p]=(0,t.useReducer)(iL,void 0,rL),[m,h]=dF(),[g,_]=(0,t.useState)(uL.Uninitialized),v=g===uL.Initialized,{draggable:{active:y,nodes:b,translate:x},droppable:{containers:S}}=f,C=y==null?null:b.get(y),w=(0,t.useRef)({initial:null,translated:null}),T=(0,t.useMemo)(()=>y==null?null:{id:y,data:C?.data??XI,rect:w},[y,C]),E=(0,t.useRef)(null),[D,O]=(0,t.useState)(null),[k,A]=(0,t.useState)(null),j=UP(d,Object.values(d)),M=JP(`DndDescribedBy`,r),N=(0,t.useMemo)(()=>S.getEnabled(),[S]),P=sL(l),{droppableRects:ee,measureDroppableContainers:F,measuringScheduled:te}=AI(N,{dragging:v,dependencies:[x.x,x.y],config:P.droppable}),I=TI(b,y),ne=(0,t.useMemo)(()=>k?tF(k):null,[k]),re=Pe(),ie=MI(I,P.draggable.measure);cL({activeNode:y==null?null:b.get(y),config:re.layoutShiftCompensation,initialRect:ie,measure:P.draggable.measure});let ae=II(I,P.draggable.measure,ie),oe=II(I?I.parentElement:null),se=(0,t.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=S.getNodeFor(se.current.over?.id),le=JI({measure:P.dragOverlay.measure}),ue=le.nodeRef.current??I,de=v?le.rect??ae:null,fe=!!(le.nodeRef.current&&le.rect),pe=LI(fe?null:ae),me=WI(ue?FP(ue):null),he=zI(v?ce??I:null),ge=KI(he),_e=oL(u,{transform:{x:x.x-pe.x,y:x.y-pe.y,scaleX:1,scaleY:1},activatorEvent:k,active:T,activeNodeRect:ae,containerNodeRect:oe,draggingNodeRect:de,over:se.current.over,overlayNodeRect:le.rect,scrollableAncestors:he,scrollableAncestorRects:ge,windowRect:me}),ve=ne?XP(ne,x):null,ye=BI(he),be=VI(ye),xe=VI(ye,[ae]),Se=XP(_e,be),Ce=de?OF(de,_e):null,we=T&&Ce?c({active:T,collisionRect:Ce,droppableRects:ee,droppableContainers:N,pointerCoordinates:ve}):null,Te=SF(we,`id`),[Ee,De]=(0,t.useState)(null),Oe=TF(fe?_e:XP(_e,xe),Ee?.rect??null,ae),ke=(0,t.useRef)(null),Ae=(0,t.useCallback)((e,t)=>{let{sensor:r,options:i}=t;if(E.current==null)return;let a=b.get(E.current);if(!a)return;let o=e.nativeEvent;ke.current=new r({active:E.current,activeNode:a,event:o,options:i,context:se,onAbort(e){if(!b.get(e))return;let{onDragAbort:t}=j.current,n={id:e};t?.(n),m({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!b.get(e))return;let{onDragPending:i}=j.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),m({type:`onDragPending`,event:a})},onStart(e){let t=E.current;if(t==null)return;let r=b.get(t);if(!r)return;let{onDragStart:i}=j.current,a={activatorEvent:o,active:{id:t,data:r.data,rect:w}};(0,n.unstable_batchedUpdates)(()=>{i?.(a),_(uL.Initializing),p({type:hF.DragStart,initialCoordinates:e,active:t}),m({type:`onDragStart`,event:a}),O(ke.current),A(o)})},onMove(e){p({type:hF.DragMove,coordinates:e})},onEnd:s(hF.DragEnd),onCancel:s(hF.DragCancel)});function s(e){return async function(){let{active:t,collisions:r,over:i,scrollAdjustedTranslate:a}=se.current,s=null;if(t&&a){let{cancelDrop:n}=j.current;s={activatorEvent:o,active:t,collisions:r,delta:a,over:i},e===hF.DragEnd&&typeof n==`function`&&await Promise.resolve(n(s))&&(e=hF.DragCancel)}E.current=null,(0,n.unstable_batchedUpdates)(()=>{p({type:e}),_(uL.Uninitialized),De(null),O(null),A(null),ke.current=null;let t=e===hF.DragEnd?`onDragEnd`:`onDragCancel`;if(s){let e=j.current[t];e?.(s),m({type:t,event:s})}})}}},[b]),je=EI(s,(0,t.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=b.get(r);if(E.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},E.current=r,Ae(n,t))},[b,Ae]));HI(s),BP(()=>{ae&&g===uL.Initializing&&_(uL.Initialized)},[ae,g]),(0,t.useEffect)(()=>{let{onDragMove:e}=j.current,{active:t,activatorEvent:r,collisions:i,over:a}=se.current;if(!t||!r)return;let o={active:t,activatorEvent:r,collisions:i,delta:{x:Se.x,y:Se.y},over:a};(0,n.unstable_batchedUpdates)(()=>{e?.(o),m({type:`onDragMove`,event:o})})},[Se.x,Se.y]),(0,t.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:r,droppableContainers:i,scrollAdjustedTranslate:a}=se.current;if(!e||E.current==null||!t||!a)return;let{onDragOver:o}=j.current,s=i.get(Te),c=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,l={active:e,activatorEvent:t,collisions:r,delta:{x:a.x,y:a.y},over:c};(0,n.unstable_batchedUpdates)(()=>{De(c),o?.(l),m({type:`onDragOver`,event:l})})},[Te]),BP(()=>{se.current={activatorEvent:k,active:T,activeNode:I,collisionRect:Ce,collisions:we,droppableRects:ee,draggableNodes:b,draggingNode:ue,draggingNodeRect:de,droppableContainers:S,over:Ee,scrollableAncestors:he,scrollAdjustedTranslate:Se},w.current={initial:de,translated:Ce}},[T,I,we,Ce,b,ue,de,ee,S,Ee,he,Se]),SI({...re,delta:x,draggingRect:Ce,pointerCoordinates:ve,scrollableAncestors:he,scrollableAncestorRects:ge});let Me=(0,t.useMemo)(()=>({active:T,activeNode:I,activeNodeRect:ae,activatorEvent:k,collisions:we,containerNodeRect:oe,dragOverlay:le,draggableNodes:b,droppableContainers:S,droppableRects:ee,over:Ee,measureDroppableContainers:F,scrollableAncestors:he,scrollableAncestorRects:ge,measuringConfiguration:P,measuringScheduled:te,windowRect:me}),[T,I,ae,k,we,oe,le,b,S,ee,Ee,F,he,ge,P,te,me]),Ne=(0,t.useMemo)(()=>({activatorEvent:k,activators:je,active:T,activeNodeRect:ae,ariaDescribedById:{draggable:M},dispatch:p,draggableNodes:b,over:Ee,measureDroppableContainers:F}),[k,je,T,ae,p,M,b,Ee,F]);return t.default.createElement(lF.Provider,{value:h},t.default.createElement(tL.Provider,{value:Ne},t.default.createElement(nL.Provider,{value:Me},t.default.createElement(lL.Provider,{value:Oe},o)),t.default.createElement(aL,{disabled:i?.restoreFocus===!1})),t.default.createElement(mF,{...i,hiddenTextDescribedById:M}));function Pe(){let e=D?.autoScrollEnabled===!1,t=typeof a==`object`?a.enabled===!1:a===!1,n=v&&!e&&!t;return typeof a==`object`?{...a,enabled:n}:{enabled:n}}}),fL=(0,t.createContext)(null),pL=`button`,mL=`Draggable`;function hL(e){let{id:n,data:r,disabled:i=!1,attributes:a}=e,o=JP(mL),{activators:s,activatorEvent:c,active:l,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:p}=(0,t.useContext)(tL),{role:m=pL,roleDescription:h=`draggable`,tabIndex:g=0}=a??{},_=l?.id===n,v=(0,t.useContext)(_?lL:fL),[y,b]=GP(),[x,S]=GP(),C=UI(s,n),w=UP(r);return BP(()=>(f.set(n,{id:n,key:o,node:y,activatorNode:x,data:w}),()=>{let e=f.get(n);e&&e.key===o&&f.delete(n)}),[f,n]),{active:l,activatorEvent:c,activeNodeRect:u,attributes:(0,t.useMemo)(()=>({role:m,tabIndex:g,"aria-disabled":i,"aria-pressed":_&&m===pL?!0:void 0,"aria-roledescription":h,"aria-describedby":d.draggable}),[i,m,g,_,h,d.draggable]),isDragging:_,listeners:i?void 0:C,node:y,over:p,setNodeRef:b,setActivatorNodeRef:S,transform:v}}function gL(){return(0,t.useContext)(nL)}var _L=`Droppable`,vL={timeout:25};function yL(e){let{data:n,disabled:r=!1,id:i,resizeObserverConfig:a}=e,o=JP(_L),{active:s,dispatch:c,over:l,measureDroppableContainers:u}=(0,t.useContext)(tL),d=(0,t.useRef)({disabled:r}),f=(0,t.useRef)(!1),p=(0,t.useRef)(null),m=(0,t.useRef)(null),{disabled:h,updateMeasurementsFor:g,timeout:_}={...vL,...a},v=UP(g??i),y=PI({callback:(0,t.useCallback)(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),m.current=null},_)},[_]),disabled:h||!s}),[b,x]=GP((0,t.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),f.current=!1),e&&y.observe(e))},[y])),S=UP(n);return(0,t.useEffect)(()=>{!y||!b.current||(y.disconnect(),f.current=!1,y.observe(b.current))},[b,y]),(0,t.useEffect)(()=>(c({type:hF.RegisterDroppable,element:{id:i,key:o,disabled:r,node:b,rect:p,data:S}}),()=>c({type:hF.UnregisterDroppable,key:o,id:i})),[i]),(0,t.useEffect)(()=>{r!==d.current.disabled&&(c({type:hF.SetDroppableDisabled,id:i,key:o,disabled:r}),d.current.disabled=r)},[i,o,r,c]),{active:s,rect:p,isOver:l?.id===i,node:b,over:l,setNodeRef:x}}function bL(e){let{animation:n,children:r}=e,[i,a]=(0,t.useState)(null),[o,s]=(0,t.useState)(null),c=KP(r);return!r&&!i&&c&&a(c),BP(()=>{if(!o)return;let e=i?.key,t=i?.props.id;if(e==null||t==null){a(null);return}Promise.resolve(n(t,o)).then(()=>{a(null)})},[n,i,o]),t.default.createElement(t.default.Fragment,null,r,i?(0,t.cloneElement)(i,{ref:s}):null)}var xL={x:0,y:0,scaleX:1,scaleY:1};function SL(e){let{children:n}=e;return t.default.createElement(tL.Provider,{value:eL},t.default.createElement(lL.Provider,{value:xL},n))}var CL={position:`fixed`,touchAction:`none`},wL=e=>$P(e)?`transform 250ms ease`:void 0,TL=(0,t.forwardRef)((e,n)=>{let{as:r,activatorEvent:i,adjustScale:a,children:o,className:s,rect:c,style:l,transform:u,transition:d=wL}=e;if(!c)return null;let f=a?u:{...u,scaleX:1,scaleY:1},p={...CL,width:c.width,height:c.height,top:c.top,left:c.left,transform:nF.Transform.toString(f),transformOrigin:a&&i?bF(i,c):void 0,transition:typeof d==`function`?d(i):d,...l};return t.default.createElement(r,{className:s,style:p,ref:n},o)}),EL={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:nF.Transform.toString(t)},{transform:nF.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function DL(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return VP((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=qI(a);if(!c)return;let{transform:l}=FP(a).getComputedStyle(a),u=kF(l);if(!u)return;let d=typeof t==`function`?t:OL(t);return QF(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function OL(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...EL,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var kL=0;function AL(e){return(0,t.useMemo)(()=>{if(e!=null)return kL++,kL},[e])}var jL=t.default.memo(e=>{let{adjustScale:n=!1,children:r,dropAnimation:i,style:a,transition:o,modifiers:s,wrapperElement:c=`div`,className:l,zIndex:u=999}=e,{activatorEvent:d,active:f,activeNodeRect:p,containerNodeRect:m,draggableNodes:h,droppableContainers:g,dragOverlay:_,over:v,measuringConfiguration:y,scrollableAncestors:b,scrollableAncestorRects:x,windowRect:S}=gL(),C=(0,t.useContext)(lL),w=AL(f?.id),T=oL(s,{activatorEvent:d,active:f,activeNodeRect:p,containerNodeRect:m,draggingNodeRect:_.rect,over:v,overlayNodeRect:_.rect,scrollableAncestors:b,scrollableAncestorRects:x,transform:C,windowRect:S}),E=jI(p),D=DL({config:i,draggableNodes:h,droppableContainers:g,measuringConfiguration:y}),O=E?_.setRef:void 0;return t.default.createElement(SL,null,t.default.createElement(bL,{animation:D},f&&w?t.default.createElement(TL,{key:w,id:f.id,ref:O,as:c,activatorEvent:d,adjustScale:n,className:l,transition:o,rect:E,style:{zIndex:u,...a},transform:T},r):null))});function ML(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function NL(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function PL(e){return e!==null&&e>=0}function FL(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function IL(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var LL=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=ML(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},RL={scaleX:1,scaleY:1},zL=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...RL}:null}let s=BL(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...RL}:r<t&&r>=a?{x:0,y:o.height+s,...RL}:{x:0,y:0,...RL}};function BL(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var VL=`Sortable`,HL=t.default.createContext({activeIndex:-1,containerId:VL,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:LL,disabled:{draggable:!1,droppable:!1}});function UL(e){let{children:n,id:r,items:i,strategy:a=LL,disabled:o=!1}=e,{active:s,dragOverlay:c,droppableRects:l,over:u,measureDroppableContainers:d}=gL(),f=JP(VL,r),p=c.rect!==null,m=(0,t.useMemo)(()=>i.map(e=>typeof e==`object`&&`id`in e?e.id:e),[i]),h=s!=null,g=s?m.indexOf(s.id):-1,_=u?m.indexOf(u.id):-1,v=(0,t.useRef)(m),y=!FL(m,v.current),b=_!==-1&&g===-1||y,x=IL(o);BP(()=>{y&&h&&d(m)},[y,m,h,d]),(0,t.useEffect)(()=>{v.current=m},[m]);let S=(0,t.useMemo)(()=>({activeIndex:g,containerId:f,disabled:x,disableTransforms:b,items:m,overIndex:_,useDragOverlay:p,sortedRects:NL(m,l),strategy:a}),[g,f,x.draggable,x.droppable,b,m,_,l,p,a]);return t.default.createElement(HL.Provider,{value:S},n)}var WL=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return ML(n,r,i).indexOf(t)},GL=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},KL={duration:200,easing:`ease`},qL=`transform`,JL=nF.Transition.toString({property:qL,duration:0,easing:`linear`}),YL={roleDescription:`sortable`};function XL(e){let{disabled:n,index:r,node:i,rect:a}=e,[o,s]=(0,t.useState)(null),c=(0,t.useRef)(r);return BP(()=>{if(!n&&r!==c.current&&i.current){let e=a.current;if(e){let t=MF(i.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&s(n)}}r!==c.current&&(c.current=r)},[n,r,i,a]),(0,t.useEffect)(()=>{o&&s(null)},[o]),o}function ZL(e){let{animateLayoutChanges:n=GL,attributes:r,disabled:i,data:a,getNewIndex:o=WL,id:s,strategy:c,resizeObserverConfig:l,transition:u=KL}=e,{items:d,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:_,useDragOverlay:v,strategy:y}=(0,t.useContext)(HL),b=QL(i,m),x=d.indexOf(s),S=(0,t.useMemo)(()=>({sortable:{containerId:f,index:x,items:d},...a}),[f,a,x,d]),C=(0,t.useMemo)(()=>d.slice(d.indexOf(s)),[d,s]),{rect:w,node:T,isOver:E,setNodeRef:D}=yL({id:s,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...l}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:ee,setActivatorNodeRef:F,transform:te}=hL({id:s,data:S,attributes:{...YL,...r},disabled:b.draggable}),I=jP(D,M),ne=!!O,re=ne&&!h&&PL(p)&&PL(_),ie=!v&&P,ae=re?(ie&&re?te:null)??(c??y)({rects:g,activeNodeRect:A,activeIndex:p,overIndex:_,index:x}):null,oe=PL(p)&&PL(_)?o({id:s,items:d,activeIndex:p,overIndex:_}):x,se=O?.id,ce=(0,t.useRef)({activeId:se,items:d,newIndex:oe,containerId:f}),le=d!==ce.current.items,ue=n({active:O,containerId:f,isDragging:P,isSorting:ne,id:s,index:x,items:d,newIndex:ce.current.newIndex,previousItems:ce.current.items,previousContainerId:ce.current.containerId,transition:u,wasDragging:ce.current.activeId!=null}),de=XL({disabled:!ue,index:x,node:T,rect:w});return(0,t.useEffect)(()=>{ne&&ce.current.newIndex!==oe&&(ce.current.newIndex=oe),f!==ce.current.containerId&&(ce.current.containerId=f),d!==ce.current.items&&(ce.current.items=d)},[ne,oe,f,d]),(0,t.useEffect)(()=>{if(se===ce.current.activeId)return;if(se!=null&&ce.current.activeId==null){ce.current.activeId=se;return}let e=setTimeout(()=>{ce.current.activeId=se},50);return()=>clearTimeout(e)},[se]),{active:O,activeIndex:p,attributes:j,data:S,rect:w,index:x,newIndex:oe,items:d,isOver:E,isSorting:ne,isDragging:P,listeners:N,node:T,overIndex:_,over:ee,setNodeRef:I,setActivatorNodeRef:F,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:de??ae,transition:fe()};function fe(){if(de||le&&ce.current.newIndex===x)return JL;if(!(ie&&!$P(k)||!u)&&(ne||ue))return nF.Transition.toString({...u,property:qL})}}function QL(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}$.Down,$.Right,$.Up,$.Left;var $L={text:`Texto`,image:`Imagem`,box:`Grupo / Cartão`,"text-container":`Texto em Caixa`,group:`Grupo`,checkbox:`Caixa de Seleção`},eR=({element:e,isSelected:t,onSelect:n,onToggleLock:i,onToggleHide:a})=>{let{attributes:o,listeners:s,setNodeRef:c,transform:l,transition:u,isDragging:d}=ZL({id:e.id});return(0,r.jsx)(U,{ref:c,style:{transform:nF.Transform.toString(l),transition:u,opacity:d?.5:1,touchAction:`none`},children:(0,r.jsxs)(W,{align:`center`,style:{padding:`8px 12px`,backgroundColor:t?`var(--accent-a3)`:`var(--gray-2)`,borderRadius:6,cursor:`pointer`,marginBottom:4,border:t?`1px solid var(--accent-9)`:`1px solid transparent`},onClick:e=>n(e.shiftKey),children:[(0,r.jsx)(U,{...o,...s,style:{cursor:`grab`,color:`var(--gray-8)`,marginRight:8},children:(0,r.jsx)(Re,{})}),(0,r.jsxs)(U,{style:{color:`var(--gray-10)`,marginRight:8},children:[e.type===`text`&&(0,r.jsx)(Rt,{}),e.type===`image`&&(0,r.jsx)(Xe,{}),(e.type===`box`||e.type===`group`)&&(0,r.jsx)(ue,{})]}),(0,r.jsx)(H,{size:`2`,weight:t?`bold`:`regular`,style:{flex:1},truncate:!0,children:e.name||$L[e.type]||e.type}),(0,r.jsxs)(W,{gap:`1`,onClick:e=>e.stopPropagation(),children:[(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:e.locked?`orange`:`gray`,onClick:i,title:e.locked?`Desbloquear`:`Bloquear`,children:e.locked?(0,r.jsx)(et,{}):(0,r.jsx)(nt,{})}),(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:e.hidden?`red`:`gray`,onClick:a,title:e.hidden?`Mostrar`:`Ocultar`,children:e.hidden?(0,r.jsx)(Be,{}):(0,r.jsx)(He,{})})]})]})})};let tR=()=>{let{state:e,selectElement:n,moveElement:i,updateElement:a}=rS(),{elements:o,selectedElementIds:s}=e,c=(0,t.useMemo)(()=>[...o].reverse(),[o]),[l,u]=(0,t.useState)(null),d=vF(_F(mI,{activationConstraint:{distance:5}}));return(0,r.jsx)(U,{children:(0,r.jsxs)(dL,{sensors:d,onDragStart:e=>{u(e.active.id)},onDragEnd:e=>{let{active:t,over:n}=e;if(u(null),n&&t.id!==n.id){let e=c.findIndex(e=>e.id===t.id),r=c.findIndex(e=>e.id===n.id);i(o.length-1-e,o.length-1-r)}},children:[(0,r.jsx)(UL,{items:c.map(e=>e.id),strategy:zL,children:(0,r.jsxs)(W,{direction:`column`,children:[c.map(e=>(0,r.jsx)(eR,{element:e,isSelected:s.includes(e.id),onSelect:t=>n(e.id,t),onToggleLock:()=>a(e.id,{locked:!e.locked}),onToggleHide:()=>a(e.id,{hidden:!e.hidden})},e.id)),c.length===0&&(0,r.jsx)(H,{size:`2`,color:`gray`,align:`center`,style:{padding:20},children:`Adicione itens para ver a lista aqui.`})]})}),(0,r.jsx)(jL,{children:l?(0,r.jsx)(U,{style:{padding:`8px 12px`,backgroundColor:`var(--gray-4)`,borderRadius:6,boxShadow:`0 4px 12px rgba(0,0,0,0.1)`},children:(0,r.jsx)(H,{children:`Movendo...`})}):null})]})})},nR=()=>{let{state:e,updateElement:n,removeSelected:i,copy:a}=rS(),[o,s]=(0,t.useState)(!1),c=e.selectedElementIds[0],l=e.elements.find(e=>e.id===c);if(!l)return null;let u=e=>{n(l.id,e)},d=e=>{u({style:{...l.style,...e}})},f=l.style?.textAlign||`left`,p=parseInt(l.style?.fontSize||`14`,10),m=parseInt(l.style?.borderWidth||`0`,10),h=parseInt(l.style?.padding||`0`,10),g=parseInt(l.style?.borderRadius||`0`,10),_=Math.round((parseFloat(String(l.style?.opacity??`1`))||1)*100),v=l.style?.fontFamily||`Arial`,y=kS(l.style?.fontWeight,DS),b=AS(v,e.availableFonts||[`Arial`,`Helvetica`,`Times New Roman`,`Courier New`,`Verdana`,`Georgia`,`Tahoma`,`Trebuchet MS`]);return(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsx)(H,{size:`3`,weight:`bold`,children:rR(l.type)}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsx)(J,{variant:`soft`,color:l.locked?`orange`:`gray`,onClick:()=>u({locked:!l.locked}),title:l.locked?`Desbloquear`:`Bloquear`,children:l.locked?(0,r.jsx)(et,{}):(0,r.jsx)(nt,{})}),(0,r.jsx)(J,{variant:`soft`,color:l.hidden?`blue`:`gray`,onClick:()=>u({hidden:!l.hidden}),title:l.hidden?`Mostrar`:`Ocultar`,children:l.hidden?(0,r.jsx)(Be,{}):(0,r.jsx)(He,{})}),(0,r.jsx)(Qy,{orientation:`vertical`}),(0,r.jsx)(J,{variant:`soft`,color:`gray`,onClick:a,title:`Copiar`,children:(0,r.jsx)(we,{})}),(0,r.jsx)(J,{variant:`soft`,color:`red`,onClick:i,title:`Excluir`,children:(0,r.jsx)(Xt,{})})]})]}),(0,r.jsx)(Qy,{size:`4`}),(l.type===`text`||l.type===`text-container`)&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Conteúdo`}),(0,r.jsx)(pb,{value:l.content,onChange:e=>u({content:e.target.value}),rows:3,placeholder:`Digite o texto aqui...`})]}),l.type===`image`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Imagem`}),(0,r.jsxs)(U,{mb:`2`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Vínculo de Propriedade`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[l.dataBinding?e.availableProps.find(e=>e.dataName===l.dataBinding)?.name||l.dataBinding:`Nenhum (URL fixa)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>u({dataBinding:void 0}),children:`Nenhum (URL fixa)`}),e.availableProps.map(e=>(0,r.jsx)(q,{onSelect:()=>u({dataBinding:e.dataName,content:`{{${e.dataName}}}`}),children:e.name},e.dataName)),e.availableProps.length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhuma variável disponível`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`URL ou {{variável}}`}),(0,r.jsx)(X,{value:l.content,onChange:e=>u({content:e.target.value}),placeholder:`https://... ou {{profilePicture}}`}),(0,r.jsx)(H,{size:`1`,color:`gray`,mt:`1`,as:`div`,children:`Se o valor vinculado for um link/URL válido, a imagem será exibida.`})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Aparência`}),(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(l.type===`text`||l.type===`text-container`)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Fonte`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(0,r.jsx)(`span`,{style:{fontFamily:v},children:v}),(0,r.jsx)(ve,{})]})}),(0,r.jsx)(fy,{style:{zIndex:1e5},children:b.map(e=>(0,r.jsx)(q,{onSelect:()=>d({fontFamily:e}),style:{fontFamily:e},children:e},e))})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Peso`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[y===`normal`?`Normal`:y===`bold`?`Negrito`:y===`100`?`Fina`:y===`300`?`Leve`:`Pesada`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({fontWeight:`normal`}),children:`Normal`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`bold`})},children:`Negrito`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`100`})},children:`Fina`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`300`})},children:`Leve`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`900`})},children:`Pesada`})]})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Tamanho do Texto`}),(0,r.jsxs)(H,{size:`1`,children:[p,`px`]})]}),(0,r.jsx)(tb,{min:8,max:72,value:[p],onValueChange:e=>d({fontSize:`${e[0]}px`})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Alinhamento`}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsx)(J,{variant:f===`left`?`solid`:`soft`,color:`gray`,onClick:()=>d({textAlign:`left`}),children:(0,r.jsx)(Wt,{})}),(0,r.jsx)(J,{variant:f===`center`?`solid`:`soft`,color:`gray`,onClick:()=>d({textAlign:`center`}),children:(0,r.jsx)(Bt,{})}),(0,r.jsx)(J,{variant:f===`right`?`solid`:`soft`,color:`gray`,onClick:()=>d({textAlign:`right`}),children:(0,r.jsx)(Kt,{})})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Estilo`}),(0,r.jsxs)(W,{gap:`1`,children:[(0,r.jsx)(J,{variant:l.style?.fontStyle===`italic`?`solid`:`soft`,color:`gray`,onClick:e=>{e.stopPropagation(),d({fontStyle:l.style?.fontStyle===`italic`?`normal`:`italic`})},title:`Itálico`,children:(0,r.jsx)(Ke,{})}),(0,r.jsx)(J,{variant:l.style?.textDecoration===`underline`?`solid`:`soft`,color:`gray`,onClick:e=>{e.stopPropagation(),d({textDecoration:l.style?.textDecoration===`underline`?`none`:`underline`})},title:`Sublinhado`,children:(0,r.jsx)(Qt,{})}),(0,r.jsx)(J,{variant:l.style?.textDecoration===`line-through`?`solid`:`soft`,color:`gray`,onClick:e=>{e.stopPropagation(),d({textDecoration:l.style?.textDecoration===`line-through`?`none`:`line-through`})},title:`Tachado`,children:(0,r.jsx)(Pt,{})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Transformação`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(l.style?.textTransform||`none`)===`none`?`Nenhum`:l.style?.textTransform===`uppercase`?`MAIÚSCULA`:l.style?.textTransform===`lowercase`?`minúscula`:`Capitalizada`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({textTransform:`none`}),children:`Nenhum`}),(0,r.jsx)(q,{onSelect:()=>d({textTransform:`uppercase`}),children:`MAIÚSCULA`}),(0,r.jsx)(q,{onSelect:()=>d({textTransform:`lowercase`}),children:`minúscula`}),(0,r.jsx)(q,{onSelect:()=>d({textTransform:`capitalize`}),children:`Capitalizada`})]})]})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Altura da Linha`}),(0,r.jsx)(X,{placeholder:`Normal`,value:l.style?.lineHeight||``,onChange:e=>d({lineHeight:e.target.value||`normal`})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Espaçamento`}),(0,r.jsx)(X,{placeholder:`Normal`,value:l.style?.letterSpacing||``,onChange:e=>d({letterSpacing:e.target.value||`normal`})})]})]}),l.type===`text-container`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Alinhamento Vertical`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(l.style?.alignItems||`flex-start`)===`flex-start`?`Topo`:l.style?.alignItems===`center`?`Centro`:`Base`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({alignItems:`flex-start`}),children:`Topo`}),(0,r.jsx)(q,{onSelect:()=>d({alignItems:`center`}),children:`Centro`}),(0,r.jsx)(q,{onSelect:()=>d({alignItems:`flex-end`}),children:`Base`})]})]})]})]}),l.type===`image`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Ajuste da Imagem`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(l.style?.objectFit||`cover`)===`cover`?`Cobrir (Cover)`:l.style?.objectFit===`contain`?`Conter (Contain)`:`Esticar (Fill)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({objectFit:`cover`}),children:`Cobrir (Cover)`}),(0,r.jsx)(q,{onSelect:()=>d({objectFit:`contain`}),children:`Conter (Contain)`}),(0,r.jsx)(q,{onSelect:()=>d({objectFit:`fill`}),children:`Esticar (Fill)`})]})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor de Fundo`}),(0,r.jsx)(nP,{color:l.style?.backgroundColor||`transparent`,onChange:e=>d({backgroundColor:e})})]}),(l.type===`text`||l.type===`text-container`)&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor do Texto`}),(0,r.jsx)(nP,{color:l.style?.color||`#000000`,onChange:e=>d({color:e})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Borda (Espessura)`}),(0,r.jsxs)(H,{size:`1`,children:[m,`px`]})]}),(0,r.jsx)(tb,{min:0,max:10,value:[m],onValueChange:e=>d({borderWidth:`${e[0]}px`,borderStyle:e[0]>0?`solid`:`none`,borderColor:l.style?.borderColor||`#000000`})})]}),m>0&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor da Borda`}),(0,r.jsx)(nP,{color:l.style?.borderColor||`#000000`,onChange:e=>d({borderColor:e})})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Cantos Arredondados`}),(0,r.jsxs)(H,{size:`1`,children:[g,`px`]})]}),(0,r.jsx)(tb,{min:0,max:50,value:[g],onValueChange:e=>d({borderRadius:`${e[0]}px`})})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Opacidade`}),(0,r.jsxs)(H,{size:`1`,children:[_,`%`]})]}),(0,r.jsx)(tb,{min:0,max:100,value:[_],onValueChange:e=>d({opacity:e[0]/100})})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Espaçamento Interno (Padding)`}),(0,r.jsxs)(H,{size:`1`,children:[h,`px`]})]}),(0,r.jsx)(tb,{min:0,max:40,value:[h],onValueChange:e=>d({padding:`${e[0]}px`})})]})]})]}),(0,r.jsxs)(U,{mt:`2`,pt:`2`,style:{borderTop:`1px solid var(--gray-5)`},children:[(0,r.jsxs)(G,{variant:`ghost`,onClick:()=>s(!o),style:{width:`100%`,justifyContent:`space-between`,color:`var(--gray-11)`,cursor:`pointer`},children:[(0,r.jsx)(W,{align:`center`,gap:`2`,children:(0,r.jsx)(H,{size:`2`,children:`Mais opções`})}),o?(0,r.jsx)(ve,{}):(0,r.jsx)(be,{})]}),o&&(0,r.jsx)(U,{mt:`3`,className:`advanced-properties-content`,children:(0,r.jsx)(rP,{elementId:l.id})})]})]},c)};var rR=e=>{switch(e){case`text`:return`Texto`;case`image`:return`Imagem`;case`box`:return`Caixa / Grupo`;case`text-container`:return`Texto em Caixa`;default:return`Elemento`}};let iR=({onClose:e})=>{let{state:t,addElement:n,groupElements:i}=rS(),a=t.selectedElementIds.length>0,o=t=>{let r={id:`el-${new Date().toISOString()}`,x:20,y:20,width:150,height:40,style:{}};switch(t){case`text`:n({...r,type:`text`,content:`Novo Texto`,width:120,height:30});break;case`image`:n({...r,type:`image`,content:`https://via.placeholder.com/150`,width:150,height:150});break;case`box`:n({...r,type:`box`,content:``,width:200,height:100,style:{border:`1px solid #ccc`}});break;case`text-container`:n({...r,type:`text-container`,content:`Texto em Caixa`,width:150,height:50,style:{backgroundColor:`#f0f0f0`,padding:`10px`}});break;case`separator`:n({...r,type:`box`,content:``,width:300,height:2,style:{backgroundColor:`#000000`}});break;case`timestamp`:n({...r,type:`text`,content:`{{timestamp}}`,width:150,height:30,formatting:{type:`date`,dateFormat:`dd/MM/yyyy HH:mm`}});break;case`badge`:n({...r,type:`text-container`,content:`Badge`,width:80,height:30,style:{backgroundColor:`#007bff`,color:`white`,borderRadius:`15px`,textAlign:`center`,lineHeight:`30px`}});break;case`list-item`:let e=crypto.randomUUID(),t=crypto.randomUUID(),a=crypto.randomUUID(),o=crypto.randomUUID();n({id:e,type:`box`,x:20,y:20,width:300,height:120,style:{backgroundColor:`#ffffff`,border:`1px solid #e0e0e0`,borderRadius:`8px`,boxShadow:`0 2px 4px rgba(0,0,0,0.05)`}}),n({id:t,type:`image`,content:`https://via.placeholder.com/80`,x:35,y:35,width:80,height:80,style:{borderRadius:`4px`}}),n({id:a,type:`text`,content:`Título do Item`,x:130,y:35,width:170,height:24,style:{fontSize:`18px`,fontWeight:`bold`,color:`#333`}}),n({id:o,type:`text`,content:`Descrição curta do item. Adicione detalhes aqui.`,x:130,y:65,width:170,height:40,style:{fontSize:`14px`,color:`#666`}}),setTimeout(()=>{i([e,t,a,o])},100);break}e&&e()};return(0,r.jsxs)(W,{direction:`column`,style:{height:`100%`},children:[(0,r.jsx)(U,{p:`4`,style:{borderBottom:`1px solid var(--gray-5)`,minHeight:`180px`,flexShrink:0,maxHeight:`calc(100vh - 150px)`,overflowY:`auto`},children:a?(0,r.jsx)(nR,{}):(0,r.jsxs)(W,{direction:`column`,align:`center`,justify:`center`,style:{height:`100%`,minHeight:`100px`},gap:`3`,children:[(0,r.jsxs)(H,{size:`2`,color:`gray`,align:`center`,children:[`Selecione um item no desenho`,(0,r.jsx)(`br`,{}),`para editar suas propriedades`]}),(0,r.jsx)(z_,{color:`blue`,variant:`soft`,children:`Dica: Clique no desenho`})]})}),(0,r.jsxs)(sb,{defaultValue:`blocks`,style:{display:`flex`,flexDirection:`column`,flex:1,overflow:`hidden`},children:[(0,r.jsx)(U,{px:`4`,pt:`4`,style:{flexShrink:0},children:(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`blocks`,children:`Blocos`}),(0,r.jsx)(lb,{value:`layers`,children:`Conteúdo`}),(0,r.jsx)(lb,{value:`history`,children:`Histórico`})]})}),(0,r.jsx)(Xv,{type:`auto`,scrollbars:`vertical`,style:{flex:1},children:(0,r.jsxs)(U,{p:`4`,children:[(0,r.jsxs)(ub,{value:`blocks`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Adicionar Elemento`}),(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`3`,as:`div`,children:`Clique para adicionar ao desenho`}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,children:[(0,r.jsx)(aR,{icon:(0,r.jsx)(We,{width:`20`,height:`20`}),label:`Texto`,onClick:()=>o(`text`)}),(0,r.jsx)(aR,{icon:(0,r.jsx)(Xe,{width:`20`,height:`20`}),label:`Imagem`,onClick:()=>o(`image`)}),(0,r.jsx)(aR,{icon:(0,r.jsx)(Ot,{width:`20`,height:`20`}),label:`Caixa / Grupo`,onClick:()=>o(`box`)}),(0,r.jsx)(aR,{icon:(0,r.jsx)(nn,{width:`20`,height:`20`}),label:`Texto em Caixa`,onClick:()=>o(`text-container`)}),(0,r.jsx)(aR,{icon:(0,r.jsx)(Ae,{width:`20`,height:`20`}),label:`Separador`,onClick:()=>o(`separator`)}),(0,r.jsx)(aR,{icon:(0,r.jsx)(Jt,{width:`20`,height:`20`}),label:`Data/Hora`,onClick:()=>o(`timestamp`)}),(0,r.jsx)(aR,{icon:(0,r.jsx)(At,{width:`20`,height:`20`}),label:`Badge / Etiqueta`,onClick:()=>o(`badge`)})]}),(0,r.jsx)(U,{mt:`4`,children:(0,r.jsx)(kP,{})})]}),(0,r.jsx)(ub,{value:`layers`,children:(0,r.jsx)(tR,{})}),(0,r.jsx)(ub,{value:`history`,children:(0,r.jsx)(AP,{onClose:e})})]})})]})]})};var aR=({icon:e,label:t,onClick:n})=>(0,r.jsx)(Ev,{style:{cursor:`pointer`,transition:`all 0.2s`},onClick:n,children:(0,r.jsxs)(W,{direction:`column`,align:`center`,gap:`2`,p:`2`,children:[(0,r.jsx)(U,{style:{color:`var(--accent-9)`},children:e}),(0,r.jsx)(H,{size:`1`,weight:`medium`,align:`center`,children:t})]})});let oR=()=>{let{state:e,setZoom:t,setPan:n}=rS(),{zoom:i,elements:a}=e;return(0,r.jsxs)(W,{align:`center`,gap:`2`,style:{backgroundColor:`var(--color-panel-solid)`,padding:`4px 8px`,borderRadius:`8px`,boxShadow:`0 2px 10px rgba(0,0,0,0.1)`,border:`1px solid var(--gray-6)`},children:[(0,r.jsx)(bb,{content:`Diminuir Zoom (-)`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>t(Math.max(.1,i-.1)),children:(0,r.jsx)(ct,{})})}),(0,r.jsxs)(H,{size:`1`,style:{width:40,textAlign:`center`,fontVariantNumeric:`tabular-nums`},children:[Math.round(i*100),`%`]}),(0,r.jsx)(bb,{content:`Aumentar Zoom (+)`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>t(Math.min(5,i+.1)),children:(0,r.jsx)(mt,{})})}),(0,r.jsx)(Qy,{orientation:`vertical`,style:{height:16}}),(0,r.jsx)(bb,{content:`Resetar (100%)`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>t(1),children:(0,r.jsx)(St,{})})}),(0,r.jsx)(bb,{content:`Ajustar à Tela`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>{if(a.length===0)return;let e=1/0,r=1/0,i=-1/0,o=-1/0;a.forEach(t=>{e=Math.min(e,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x+t.width),o=Math.max(o,t.y+t.height)});let s=i-e+100,c=o-r+100,l=window.innerWidth<768?0:300,u=window.innerWidth-l,d=window.innerHeight-100,f=u/s,p=d/c,m=Math.min(f,p);m=Math.min(Math.max(m,.1),5),t(m);let h=(e+i)/2,g=(r+o)/2,_=u/2,v=d/2;n({x:_-h*m,y:v-g*m})},children:(0,r.jsx)(N,{})})})]})},sR=({isOpen:e,onClose:n,templates:i,onSelectTemplate:a,initialStep:o=1,onFinishWizard:s,onStartTour:c})=>{let[l,u]=(0,t.useState)(o),[d,f]=(0,t.useState)(null);t.default.useEffect(()=>{e&&o&&u(o)},[e,o]);let p=()=>{l===1&&d?(a(i.find(e=>e.id===d)||null),u(2)):l===2?(n(),c&&c()):l===3&&(s&&s(),n())};return(0,r.jsx)(ny,{open:e,onOpenChange:n,children:(0,r.jsx)(iy,{style:{maxWidth:800},children:(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsx)(ay,{children:(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(it,{}),` Assistente de Criação`]})}),(0,r.jsx)(W,{gap:`2`,children:(0,r.jsx)(cR,{current:l,total:3})})]}),(0,r.jsxs)(U,{children:[l===1&&(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsx)(m_,{size:`4`,children:`Passo 1: Escolha um Modelo (Template)`}),(0,r.jsx)(H,{color:`gray`,size:`2`,children:`Comece com um layout pronto e personalize conforme sua necessidade.`}),(0,r.jsxs)(K,{columns:`3`,gap:`3`,children:[i.map(e=>(0,r.jsx)(Ev,{variant:d===e.id?`surface`:`classic`,style:{cursor:`pointer`,border:d===e.id?`2px solid var(--accent-9)`:void 0,backgroundColor:d===e.id?`var(--accent-2)`:void 0},onClick:()=>f(e.id),children:(0,r.jsxs)(W,{direction:`column`,gap:`2`,align:`center`,p:`2`,children:[(0,r.jsx)(U,{style:{width:`100%`,height:100,backgroundColor:`var(--gray-3)`,borderRadius:4,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(We,{width:32,height:32,color:`var(--gray-8)`})}),(0,r.jsx)(H,{weight:`bold`,size:`2`,children:e.name}),(0,r.jsx)(H,{size:`1`,color:`gray`,align:`center`,children:e.description})]})},e.id)),(0,r.jsx)(Ev,{variant:d===`blank`?`surface`:`classic`,style:{cursor:`pointer`,border:d===`blank`?`2px solid var(--accent-9)`:void 0,backgroundColor:d===`blank`?`var(--accent-2)`:void 0},onClick:()=>f(`blank`),children:(0,r.jsxs)(W,{direction:`column`,gap:`2`,align:`center`,p:`2`,children:[(0,r.jsx)(U,{style:{width:`100%`,height:100,backgroundColor:`var(--gray-3)`,borderRadius:4,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(U,{style:{width:40,height:40,border:`2px dashed var(--gray-8)`,borderRadius:4}})}),(0,r.jsx)(H,{weight:`bold`,size:`2`,children:`Começar do Zero`}),(0,r.jsx)(H,{size:`1`,color:`gray`,align:`center`,children:`Tela em branco`})]})})]}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(G,{variant:`soft`,color:`gray`,onClick:n,children:`Pular Assistente`}),(0,r.jsxs)(G,{onClick:p,disabled:!d,children:[`Continuar `,(0,r.jsx)(j,{})]})]})]}),l===2&&(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsx)(m_,{size:`4`,children:`Passo 2: Personalizar Visual`}),(0,r.jsx)(H,{color:`gray`,size:`2`,children:`Agora é sua vez de ajustar o layout. Use as ferramentas disponíveis.`}),(0,r.jsxs)(K,{columns:`2`,gap:`4`,children:[(0,r.jsx)(Ev,{variant:`surface`,children:(0,r.jsxs)(W,{gap:`3`,align:`start`,children:[(0,r.jsx)(U,{style:{padding:8,backgroundColor:`var(--accent-3)`,borderRadius:4},children:(0,r.jsx)(We,{width:20,height:20,color:`var(--accent-9)`})}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{weight:`bold`,size:`2`,as:`div`,children:`Edite Conteúdo`}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Clique duas vezes em qualquer texto ou imagem para editar suas propriedades.`})]})]})}),(0,r.jsx)(Ev,{variant:`surface`,children:(0,r.jsxs)(W,{gap:`3`,align:`start`,children:[(0,r.jsx)(U,{style:{padding:8,backgroundColor:`var(--green-3)`,borderRadius:4},children:(0,r.jsx)(it,{width:20,height:20,color:`var(--green-9)`})}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{weight:`bold`,size:`2`,as:`div`,children:`Adicione Blocos`}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Use a barra lateral esquerda para arrastar novos elementos.`})]})]})})]}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsxs)(G,{variant:`soft`,color:`gray`,onClick:()=>u(1),children:[(0,r.jsx)(j,{style:{transform:`rotate(180deg)`}}),` Voltar`]}),(0,r.jsxs)(G,{onClick:p,children:[`Começar a Editar `,(0,r.jsx)(j,{})]})]})]}),l===3&&(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsx)(m_,{size:`4`,children:`Passo 3: Testar e Exportar`}),(0,r.jsx)(H,{color:`gray`,size:`2`,children:`Seu layout está pronto? Teste com dados diferentes e exporte o resultado.`}),(0,r.jsx)(Ev,{variant:`surface`,style:{padding:20},children:(0,r.jsxs)(W,{direction:`column`,gap:`3`,align:`center`,children:[(0,r.jsx)(ge,{width:48,height:48,color:`var(--green-9)`}),(0,r.jsx)(m_,{size:`3`,children:`Tudo pronto!`}),(0,r.jsx)(H,{align:`center`,children:`Você completou a criação do layout. Agora você pode salvar, exportar ou continuar editando.`})]})}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(G,{variant:`soft`,color:`gray`,onClick:n,children:`Voltar a Editar`}),(0,r.jsxs)(G,{onClick:p,color:`green`,children:[(0,r.jsx)(ge,{}),` Concluir e Exportar`]})]})]})]})]})})})};var cR=({current:e,total:t})=>(0,r.jsx)(W,{gap:`2`,children:[1,2,3].map(n=>(0,r.jsxs)(W,{align:`center`,gap:`1`,children:[(0,r.jsx)(U,{style:{width:24,height:24,borderRadius:`50%`,backgroundColor:n<=e?`var(--accent-9)`:`var(--gray-4)`,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:12,fontWeight:`bold`},children:n<e?(0,r.jsx)(ge,{}):n}),n<t&&(0,r.jsx)(U,{style:{width:20,height:2,backgroundColor:`var(--gray-4)`}})]},n))}),lR=({initialState:e,onSave:n,theme:i=`light`,templates:a,activeTemplateId:o,onTemplateChange:s})=>{let[c,l]=(0,t.useState)(!0),[u,d]=(0,t.useState)(!0),[f,p]=(0,t.useState)(!1),[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(a&&a.length>0?a[0].id:null),v=t.default.useRef(null),[y,b]=(0,t.useState)(!1),[x,S]=(0,t.useState)(1),[C,w]=(0,t.useState)(!1),{addElement:T,loadState:E,state:D,undo:O,redo:k,copy:A,paste:j,removeSelected:M,updateElements:N}=rS(),P=t.default.useRef(!1);t.default.useEffect(()=>{let e=()=>{let e=window.innerWidth<768;h(e),e&&(d(!1),l(!1))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let ee=()=>{let e={elements:D.elements,isList:D.isList,mockData:D.mockData,singleMockData:D.singleMockData,listSettings:D.listSettings,canvasHeight:D.canvasHeight,gridSize:D.gridSize},t=JSON.stringify(e,null,2),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`layout-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)};t.default.useEffect(()=>{let e=e=>{if(document.activeElement?.tagName===`INPUT`||document.activeElement?.tagName===`TEXTAREA`||document.activeElement?.isContentEditable)return;let t=e.clipboardData?.items;if(t){for(let n=0;n<t.length;n++)if(t[n].type.indexOf(`image`)!==-1){e.preventDefault();let r=t[n].getAsFile();if(r){let e=new FileReader;e.onload=e=>{let t=e.target?.result;T({type:`image`,content:t,width:200,height:200})},e.readAsDataURL(r)}}}};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[T]),t.default.useEffect(()=>{let e=e=>{if(!(document.activeElement?.tagName===`INPUT`||document.activeElement?.tagName===`TEXTAREA`||document.activeElement?.isContentEditable)){if((e.ctrlKey||e.metaKey)&&e.key===`z`)e.shiftKey?(e.preventDefault(),k()):(e.preventDefault(),O());else if((e.ctrlKey||e.metaKey)&&e.key===`y`)e.preventDefault(),k();else if((e.ctrlKey||e.metaKey)&&e.key===`c`)e.preventDefault(),A();else if((e.ctrlKey||e.metaKey)&&e.key===`v`)e.preventDefault(),j();else if(e.key===`Delete`||e.key===`Backspace`)D.selectedElementIds.length>0&&(e.preventDefault(),M());else if([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`].includes(e.key)&&D.selectedElementIds.length>0){e.preventDefault();let t=e.shiftKey?10:1,n=[];D.selectedElementIds.forEach(r=>{let i=D.elements.find(e=>e.id===r);if(i){let a={};e.key===`ArrowUp`&&(a.y=i.y-t),e.key===`ArrowDown`&&(a.y=i.y+t),e.key===`ArrowLeft`&&(a.x=i.x-t),e.key===`ArrowRight`&&(a.x=i.x+t),n.push({id:r,changes:a})}}),n.length>0&&N(n)}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[O,k,A,j,M,D.selectedElementIds,D.elements,N]);let[F,te]=(0,t.useState)(!1);t.default.useEffect(()=>{if(e)try{let t=typeof e==`string`?JSON.parse(e):e;Array.isArray(t)?E({elements:t}):t.elements&&E(t)}catch(e){console.error(`Failed to load initial state`,e)}te(!0)},[e,E]),t.default.useEffect(()=>{F&&(P.current||D.elements.length===0&&(P.current=!0,S(1),b(!0)))},[F,D.elements]),t.default.useEffect(()=>{!a||a.length===0||f&&_(o||a[0].id)},[o,f,a]);let I=t.default.useCallback(e=>{if(e)try{let t=typeof e==`string`?JSON.parse(e):e;if(Array.isArray(t)){E({elements:t});return}if(t&&typeof t==`object`&&`elements`in t){E(t);return}}catch(e){console.error(`Failed to apply template`,e)}},[E]);return t.default.useEffect(()=>{if(!a||a.length===0||!o||v.current===o)return;let e=a.find(e=>e.id===o);e&&(I(e.state),v.current=o)},[o,I,a]),(0,r.jsx)(A_,{appearance:i,accentColor:`blue`,grayColor:`slate`,radius:`large`,scaling:`105%`,children:(0,r.jsxs)(W,{direction:`column`,style:{height:`100vh`,width:`100%`,overflow:`hidden`,backgroundColor:`var(--gray-1)`},children:[(0,r.jsx)(LS,{onSave:n,templates:a,setIsTemplatesOpen:p,onFinish:()=>{S(3),b(!0)},onToggleSidebar:()=>d(!u)}),(0,r.jsxs)(W,{direction:`row`,style:{flexGrow:1,overflow:`hidden`},children:[m&&u&&(0,r.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,backgroundColor:`rgba(0,0,0,0.5)`,zIndex:90},onClick:()=>d(!1)}),u&&(0,r.jsxs)(W,{id:`sidebar-area`,direction:`column`,width:m?`100%`:`300px`,style:{borderRight:`1px solid var(--gray-5)`,backgroundColor:`var(--gray-1)`,flexShrink:0,height:`100%`,boxShadow:`1px 0 0 var(--gray-4)`,overflow:`hidden`,position:m?`absolute`:`relative`,zIndex:m?100:`auto`,top:0,left:0},children:[m&&(0,r.jsx)(W,{justify:`end`,p:`2`,children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>d(!1),children:(0,r.jsx)(Ee,{})})}),(0,r.jsx)(iR,{onClose:()=>{m&&d(!1)}})]}),(0,r.jsxs)(W,{direction:`column`,style:{flex:1,height:`100%`,overflow:`hidden`},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,px:`3`,py:`2`,style:{borderBottom:`1px solid var(--gray-6)`,backgroundColor:`var(--gray-1)`,flexShrink:0,zIndex:10},children:[(0,r.jsx)(W,{gap:`3`,align:`center`,children:(0,r.jsx)(J,{size:`2`,variant:`ghost`,color:`gray`,onClick:()=>d(!u),title:u?`Ocultar Barra Lateral`:`Mostrar Barra Lateral`,style:{cursor:`pointer`},children:m?(0,r.jsx)(Qe,{}):u?(0,r.jsx)(Me,{}):(0,r.jsx)(Pe,{})})}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsx)(OP,{}),(0,r.jsx)(J,{size:`2`,variant:`ghost`,color:c?`blue`:`gray`,onClick:()=>l(!c),title:c?`Ocultar Preview`:`Mostrar Preview`,style:{cursor:`pointer`},children:c?(0,r.jsx)(He,{}):(0,r.jsx)(Be,{})})]})]}),(0,r.jsx)(U,{style:{flex:1,position:`relative`,overflow:`hidden`},children:(0,r.jsxs)(Kx,{orientation:`horizontal`,style:{height:`100%`,width:`100%`},children:[(!m||!c)&&(0,r.jsx)(Xx,{defaultSize:50,minSize:20,children:(0,r.jsxs)(K,{columns:`20px 1fr`,rows:`20px 1fr`,style:{height:`100%`,width:`100%`,backgroundColor:`var(--color-background)`},children:[(0,r.jsx)(U,{style:{backgroundColor:`var(--gray-2)`,borderRight:`1px solid var(--gray-6)`,borderBottom:`1px solid var(--gray-6)`,zIndex:30}}),(0,r.jsx)(U,{style:{backgroundColor:`var(--gray-2)`,borderBottom:`1px solid var(--gray-6)`,overflow:`hidden`,zIndex:30},children:(0,r.jsx)(EP,{orientation:`horizontal`})}),(0,r.jsx)(U,{style:{backgroundColor:`var(--gray-2)`,borderRight:`1px solid var(--gray-6)`,overflow:`hidden`,zIndex:30},children:(0,r.jsx)(EP,{orientation:`vertical`})}),(0,r.jsxs)(U,{style:{position:`relative`,overflow:`hidden`,width:`100%`,height:`100%`},id:`canvas-area`,children:[(0,r.jsx)(U,{style:{position:`absolute`,top:16,left:`50%`,transform:`translateX(-50%)`,zIndex:20},children:(0,r.jsx)(iS,{})}),(0,r.jsx)(U,{style:{position:`absolute`,bottom:16,right:16,zIndex:20},children:(0,r.jsx)(oR,{})}),(0,r.jsx)(IS,{}),(0,r.jsx)(RS,{})]})]})}),!m&&c&&(0,r.jsx)(Qy,{style:{width:`4px`,backgroundColor:`var(--gray-6)`,cursor:`col-resize`,transition:`background-color 0.2s`}}),c&&(0,r.jsx)(Xx,{defaultSize:50,minSize:20,children:(0,r.jsx)(U,{id:`preview-area`,style:{height:`100%`,width:`100%`,backgroundColor:`var(--gray-3)`,borderLeft:`1px solid var(--gray-5)`},children:(0,r.jsx)(gN,{})})})]})})]})]}),(0,r.jsx)(ny,{open:f,onOpenChange:p,children:(0,r.jsxs)(iy,{style:{maxWidth:450},children:[(0,r.jsx)(ay,{children:`Galeria de Templates`}),(0,r.jsx)(oy,{size:`2`,mb:`4`,children:`Escolha um layout pré-definido para começar.`}),a&&a.length>0?(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,as:`div`,mb:`2`,children:`Selecione o Template`}),(0,r.jsx)(W,{direction:`column`,gap:`2`,children:a.map(e=>(0,r.jsx)(G,{variant:g===e.id?`solid`:`soft`,color:g===e.id?`blue`:`gray`,size:`2`,style:{width:`100%`,justifyContent:`flex-start`,border:g===e.id?`2px solid var(--accent-9)`:void 0},onClick:()=>_(e.id),children:e.name},e.id))})]}),g&&a.find(e=>e.id===g)?.description&&(0,r.jsx)(U,{p:`3`,style:{backgroundColor:`var(--gray-2)`,borderRadius:8},children:(0,r.jsx)(H,{size:`2`,color:`gray`,children:a.find(e=>e.id===g)?.description})}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(sy,{children:(0,r.jsx)(G,{variant:`soft`,color:`gray`,children:`Cancelar`})}),(0,r.jsx)(sy,{children:(0,r.jsx)(G,{onClick:()=>{if(!g)return;if(s){s(g);return}let e=a.find(e=>e.id===g);e&&(I(e.state),v.current=g)},children:`Aplicar`})})]})]}):(0,r.jsx)(H,{children:`Nenhum template disponível.`})]})}),(0,r.jsx)(sR,{isOpen:y,onClose:()=>b(!1),templates:a||[],onSelectTemplate:e=>{e&&I(e.state)},onStartTour:()=>w(!0),initialStep:x,onFinishWizard:()=>{ee(),alert(`Layout finalizado e exportado com sucesso!`)}}),(0,r.jsx)(BS,{isOpen:C,onClose:()=>w(!1)}),(0,r.jsx)(SP,{})]})})};let uR=e=>(0,r.jsx)(nS,{isList:e.layout.isList,availableProps:e.layout.props,theme:e.theme,children:(0,r.jsx)(lR,{...e})});var dR=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,`$1-$2`).toLowerCase(),fR=e=>{let t=/^#([0-9a-fA-F]{8})$/.exec(e);if(!t)return e;let n=t[1];return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${parseInt(n.slice(6,8),16)/255})`},pR=e=>{if(!e)return``;let t=[`width`,`height`,`top`,`left`,`right`,`bottom`,`fontSize`,`borderRadius`,`padding`,`margin`,`borderWidth`,`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`,`minHeight`,`maxHeight`,`minWidth`,`maxWidth`];return Object.entries(e).map(([e,n])=>{if(n==null)return``;let r=dR(e),i=typeof n==`number`&&t.includes(e)?n+`px`:n;return typeof i==`string`&&/^#([0-9a-fA-F]{8})$/.test(i)&&(i=fR(i)),`${r}: ${i}`}).filter(Boolean).join(`; `)},mR=(e,t)=>{let n=/(rgba?\([^)]+\)|#(?:[0-9a-fA-F]{3,8})|[a-zA-Z]+)\s*$/;return!e||e===`none`?`0 4px 12px 0 ${t}`:n.test(e)?e.replace(n,t):`${e} ${t}`},hR=(e,t,n,r,i=1.2)=>{if(!e)return 0;try{let a=document.createElement(`canvas`).getContext(`2d`);if(!a)return 0;a.font=`${r}px ${n}`;let o=String(e).split(`
|
|
62
|
+
`),s=0;for(let e of o){let n=e.split(` `),r=``;if(n.length===1&&n[0]===``){s++;continue}for(let e=0;e<n.length;e++){let i=n[e],o=a.measureText(i).width;if(o>t){r.trim().length>0&&(s++,r=``),s+=Math.ceil(o/t);continue}let c=r+i+` `;a.measureText(c).width>t&&r.trim().length>0?(s++,r=i+` `):r=c}r.length>0&&s++}return Math.ceil(s*r*i)}catch{return 0}},gR=(e,t,n)=>{let r=String(e).toLowerCase(),i=String(n).toLowerCase();switch(t){case`equals`:return r===i;case`notEquals`:return r!==i;case`contains`:return r.includes(i);case`greaterThan`:return parseFloat(r)>parseFloat(i);case`lessThan`:return parseFloat(r)<parseFloat(i);case`truthy`:return!!e;case`falsy`:return!e;default:return!1}},_R=(e,t)=>{if(!t||t.type===`text`)return e==null?``:String(e);if(e==null)return``;if(t.type===`boolean`)return String(e)===`true`||e===!0||typeof e==`number`&&e>0?t.trueLabel||`Sim`:t.falseLabel||`Não`;if(t.type===`date`)try{let n=new Date(e);if(isNaN(n.getTime()))return String(e);if(t.dateFormat){let e=n.getDate().toString().padStart(2,`0`),r=(n.getMonth()+1).toString().padStart(2,`0`),i=n.getFullYear(),a=n.getHours().toString().padStart(2,`0`),o=n.getMinutes().toString().padStart(2,`0`),s=n.getSeconds().toString().padStart(2,`0`);return t.dateFormat.replace(`DD`,e).replace(`MM`,r).replace(`YYYY`,String(i)).replace(`HH`,a).replace(`mm`,o).replace(`ss`,s)}return n.toLocaleDateString()}catch{return String(e)}if(t.type===`number`){let n=parseFloat(e);return isNaN(n)?String(e):t.numberFormat===`currency`?(t.currencySymbol||`R$`)+` `+n.toFixed(t.decimalPlaces||2):t.numberFormat===`percent`?n.toFixed(t.decimalPlaces||0)+`%`:n.toFixed(t.decimalPlaces||0)}return String(e)},vR=e=>{switch(e){case`linear`:return`linear`;case`ease-in`:return`ease-in`;case`ease-out`:return`ease-out`;case`ease-in-out`:return`ease-in-out`;case`bounce`:return`cubic-bezier(0.175, 0.885, 0.32, 1.275)`;default:return`ease-out`}},yR=e=>{if(!e||e.type===`none`)return{};let t=(e.duration||.4)+`s`,n=(e.delay||0)+`s`,r=vR(e.timingFunction),i=e.iterationCount===`infinite`?`infinite`:typeof e.iterationCount==`number`?Math.max(1,e.iterationCount):1;return{animation:`${e.type} ${t} ${r} ${n}`,animationIterationCount:i,animationFillMode:`both`}},bR=(e,t)=>{let n=JSON.parse(JSON.stringify(e)),r=new Map(n.map(e=>[e.id,{...e}])),i=[],a=(e,t)=>{if(e.id===t.id)return!1;let n=.1;return e.x>=t.x-n&&e.x+e.width<=t.x+t.width+n&&e.y>=t.y-n&&e.y+e.height<=t.y+t.height+n};n.forEach(e=>{let o=e.type===`text`,s=e.type===`text-container`;if((o||s)&&e.autoGrow){let o=e.content;o=o.replace(/\{\{(.*?)\}\}/g,(n,r)=>{let i=t[r.trim()];return i==null?n:e.formatting?_R(i,e.formatting):String(i)});let c=parseInt(String(e.style&&e.style.fontSize||16)),l=String(e.style&&e.style.fontFamily||`Arial`);if(s&&e.containerExpansion===`horizontal`)try{let t=document.createElement(`canvas`).getContext(`2d`);if(t){t.font=`${c}px ${l}`;let n=t.measureText(o),r=parseInt(String(e.style&&e.style.padding||0))*2,i=Math.ceil(n.width+r);Math.abs(i-e.width)>1&&(e.width=i,e.content=o)}}catch{}else{let t=0,s=parseInt(String(e.style&&e.style.padding||0)),u=Math.max(1,e.width-s*2),d=/<([a-z]+)([^>]*?)>/i.exec(o);if(d){let e=d[2],n=/height=["']?(\d+)["']?/i.exec(e),r=/height:\s*(\d+)px/i.exec(e);t=n?parseInt(n[1]):r?parseInt(r[1]):hR(o,u,l,c)}else t=hR(o,u,l,c);let f=t+s*2;(!d||d&&!t)&&(f+=4);let p=parseInt(String(e.style&&e.style.minHeight||0)),m=Math.max(f,p),h=e.height,g=m-h;if(Math.abs(g)>1){e.height=m,e.content=o;let t=[],s=r.get(e.id);s&&n.forEach(n=>{if(n.id===e.id)return;let i=r.get(n.id);i&&a(s,i)&&t.push(n)});let c=new Set([e.id]);t.forEach(e=>{e.height+=g,c.add(e.id)}),i.push({triggerY:e.y+h,delta:g,ignoreIds:c})}}}}),n.forEach(e=>{let t=r.get(e.id);if(!t)return;let n=0;i.forEach(r=>{r.ignoreIds.has(e.id)||t.y>=r.triggerY-.1&&(n+=r.delta)}),e.y+=n});let o=0;return n.forEach(e=>{let t=e.y+e.height;t>o&&(o=t)}),{layoutElements:n,maxY:o}},xR=(e,t,n)=>{let{maxY:r}=bR(e,t);return n?Math.max(r,n):r},SR=(e,t,n=0,r=0)=>{let{layoutElements:i}=bR(e,t),a=i,o=e=>{let n=e.content,r=``;if(e.type===`text`||e.type===`text-container`)n=n.replace(/\{\{(.*?)\}\}/g,(n,r)=>{let i=t[r.trim()];return i==null?n:e.formatting?_R(i,e.formatting):String(i)});else if(e.type===`image`)if(e.dataBinding){let i=t[e.dataBinding];r=i==null?n:String(i)}else r=n.replace(/\{\{(.*?)\}\}/g,(e,n)=>{let r=t[n.trim()];return r==null?e:String(r)});let i={};e.conditions&&e.conditions.forEach(e=>{let n=t[e.property];gR(n,e.operator,e.value)&&(i={...i,...e.style})});let a={};e.styleBindings&&Object.entries(e.styleBindings).forEach(([n,r])=>{let o=t[r];o!=null&&(n===`boxShadowColor`?a.boxShadow=mR(i.boxShadow||e.style?.boxShadow,String(o)):a[n]=String(o))});let o={width:e.width,height:e.autoGrow?`auto`:e.height,transform:e.rotation?`rotate(${e.rotation}deg)`:void 0,overflow:e.autoGrow?`visible`:`hidden`,whiteSpace:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`nowrap`:e.autoGrow?`pre-wrap`:void 0,wordBreak:e.autoGrow?`break-word`:void 0,...e.type===`text-container`?{display:`flex`,alignItems:e.style?.alignItems||`flex-start`,justifyContent:e.style?.justifyContent||`flex-start`}:{},...e.style,...i,...a,...yR(e.animation),...e.hidden?{display:`none`}:{}};return{content:n,imgSrc:r,baseStyle:o}},s=(e,n,r,i)=>{if(e.type===`text`||e.type===`text-container`)return`<div style="${n}">${r}</div>`;if(e.type===`image`){let t=pR({width:`100%`,height:`100%`,objectFit:e.style?.objectFit||`cover`,display:`block`});return`<div style="${n}"><img src="${(MS(i)?i:`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`).replace(/"/g,`"`)}" alt="Element" style="${t}" /></div>`}else if(e.type===`box`)return`<div style="${n}"></div>`;else if(e.type===`checkbox`){let r=!1;if(e.dataBinding){let n=t[e.dataBinding];r=n===!0||String(n)===`true`}return`<div style="${n}; display: flex; align-items: center; justify-content: center;"><input type="checkbox" ${r?`checked`:``} disabled style="width:100%;height:100%;margin:0;" /></div>`}return``};return a.map(e=>{let{content:t,imgSrc:n,baseStyle:i}=o(e);return s(e,pR({...i,position:`absolute`,left:e.x,top:e.y+r}),t,n)}).join(`
|
|
63
|
+
`)},CR=({element:e,itemData:t})=>{let n=e.content,i=``;if(e.type===`text`||e.type===`text-container`)n=n.replace(/\{\{(.*?)\}\}/g,(n,r)=>{let i=t[r.trim()];return i==null?n:e.formatting?_R(i,e.formatting):String(i)});else if(e.type===`image`)if(e.dataBinding){let r=t[e.dataBinding];i=r==null?n:String(r)}else i=n.replace(/\{\{(.*?)\}\}/g,(e,n)=>{let r=t[n.trim()];return r==null?e:String(r)});let a={};e.conditions&&e.conditions.forEach(e=>{let n=t[e.property];gR(n,e.operator,e.value)&&(a={...a,...e.style})});let o={};e.styleBindings&&Object.entries(e.styleBindings).forEach(([n,r])=>{let i=t[r];i!=null&&(n===`boxShadowColor`?o.boxShadow=mR(a.boxShadow||e.style?.boxShadow,String(i)):o[n]=String(i))});let s={position:`absolute`,left:e.x,top:e.y,width:e.width,height:e.autoGrow?`auto`:e.height,transform:e.rotation?`rotate(${e.rotation}deg)`:void 0,overflow:e.autoGrow?`visible`:`hidden`,whiteSpace:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`nowrap`:e.autoGrow?`pre-wrap`:void 0,wordBreak:e.autoGrow?`break-word`:void 0,...e.type===`text-container`?{display:`flex`,alignItems:e.style?.alignItems||`flex-start`,justifyContent:e.style?.justifyContent||`flex-start`}:{},...e.style,...a,...o,...yR(e.animation),...e.hidden?{display:`none`}:{}};if(e.type===`text`||e.type===`text-container`)return/<[a-z][\s\S]*>/i.test(n)?(0,r.jsx)(`div`,{style:s,dangerouslySetInnerHTML:{__html:n}}):(0,r.jsx)(`div`,{style:s,children:n});if(e.type===`image`){let t={width:`100%`,height:`100%`,objectFit:e.style?.objectFit||`cover`,display:`block`};return(0,r.jsx)(`div`,{style:s,children:(0,r.jsx)(`img`,{src:MS(i)?i:`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`,alt:`Element`,style:t})})}else if(e.type===`box`)return(0,r.jsx)(`div`,{style:s});else if(e.type===`checkbox`){let n=!1;if(e.dataBinding){let r=t[e.dataBinding];n=r===!0||String(r)===`true`}return(0,r.jsx)(`div`,{style:{...s,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(`input`,{type:`checkbox`,checked:n,disabled:!0,style:{width:`100%`,height:`100%`,margin:0}})})}return null},wR=({elements:e,data:t,options:n})=>{let{isList:i,listSettings:a}=n,o=`
|
|
64
64
|
@keyframes slideIn {
|
|
65
65
|
from { opacity: 0; transform: translateY(20px); }
|
|
66
66
|
to { opacity: 1; transform: translateY(0); }
|
|
@@ -125,7 +125,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${n.do
|
|
|
125
125
|
}
|
|
126
126
|
.list-wrapper::-webkit-scrollbar { width: 6px; }
|
|
127
127
|
.list-wrapper::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,0.2); border-radius: 3px; }
|
|
128
|
-
`;if(i&&Array.isArray(t)){let i=[...t];if(a?.sortProp){let e=a.sortProp,t=a.sortOrder===`asc`?1:-1;i.sort((n,r)=>(n[e]<r[e]?-1:1)*t)}a?.newestPosition===`top`&&i.reverse();let s=a?.newestPosition===`top`?`flex-start`:`flex-end`,c=a?.entryAnimation||{type:`slideIn`,duration:.3,delay:0},l=c.type===`none`?`none`:c.type,u=(c.duration??.3)+`s`,d=(c.delay??0)+`s`,f=
|
|
128
|
+
`;if(i&&Array.isArray(t)){let i=[...t];if(a?.sortProp){let e=a.sortProp,t=a.sortOrder===`asc`?1:-1;i.sort((n,r)=>(n[e]<r[e]?-1:1)*t)}a?.newestPosition===`top`&&i.reverse();let s=a?.newestPosition===`top`?`flex-start`:`flex-end`,c=a?.entryAnimation||{type:`slideIn`,duration:.3,delay:0},l=c.type===`none`?`none`:c.type,u=(c.duration??.3)+`s`,d=(c.delay??0)+`s`,f=vR(c.timingFunction),p={display:`flex`,flexDirection:`column`,justifyContent:s,height:a?.containerHeight?a.containerHeight+`px`:`100%`,width:`100%`,overflowY:`auto`,overflowX:`hidden`,boxSizing:`border-box`,padding:`10px`};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`style`,{dangerouslySetInnerHTML:{__html:o}}),(0,r.jsx)(`div`,{className:`list-wrapper`,style:p,children:i.map((t,i)=>(0,r.jsx)(`div`,{className:`list-item`,style:{position:`relative`,minHeight:xR(e,t,n.canvasHeight||0),width:`100%`,flexShrink:0,animation:l===`none`?void 0:`${l} ${u} ${f} ${d}`,animationFillMode:l===`none`?void 0:`both`,marginBottom:`10px`},children:(()=>{let{layoutElements:n}=bR(e,t);return(0,r.jsx)(r.Fragment,{children:n.map(e=>(0,r.jsx)(CR,{element:e,itemData:t},e.id))})})()},i))}),a?.scrollDirection===`up`&&(0,r.jsx)(`script`,{dangerouslySetInnerHTML:{__html:`document.addEventListener('DOMContentLoaded', () => { const w = document.querySelector('.list-wrapper'); if(w) w.scrollTop = w.scrollHeight; });`}})]})}let{layoutElements:s}=bR(e,t);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`style`,{dangerouslySetInnerHTML:{__html:o}}),(0,r.jsx)(`div`,{style:{position:`relative`,width:`100%`,height:`100%`,overflow:`hidden`},children:s.map(e=>(0,r.jsx)(CR,{element:e,itemData:t},e.id))})]})};let TR=(e,t,n={})=>(0,i.renderToStaticMarkup)((0,r.jsx)(wR,{elements:e,data:t,options:n}))+(n.isList?ER(e,n):``);var ER=(e,t)=>`
|
|
129
129
|
<script>
|
|
130
130
|
(function() {
|
|
131
131
|
try {
|
|
@@ -133,18 +133,18 @@ For more information, see https://radix-ui.com/primitives/docs/components/${n.do
|
|
|
133
133
|
|
|
134
134
|
// Helper functions definitions
|
|
135
135
|
const isValidImageUrl = ${MS.toString()};
|
|
136
|
-
const camelToKebab = ${
|
|
137
|
-
const hex8ToRgba = ${
|
|
138
|
-
const styleObjectToString = ${
|
|
139
|
-
const applyShadowColor = ${
|
|
140
|
-
const getElementAnimationStyle = ${
|
|
141
|
-
const measureTextHeight = ${
|
|
142
|
-
const checkCondition = ${
|
|
143
|
-
const formatValue = ${
|
|
144
|
-
const getSafeTimingFunction = ${
|
|
145
|
-
const computeLayout = ${
|
|
146
|
-
const computeItemHeight = ${
|
|
147
|
-
const renderItem = ${
|
|
136
|
+
const camelToKebab = ${dR.toString()};
|
|
137
|
+
const hex8ToRgba = ${fR.toString()};
|
|
138
|
+
const styleObjectToString = ${pR.toString()};
|
|
139
|
+
const applyShadowColor = ${mR.toString()};
|
|
140
|
+
const getElementAnimationStyle = ${yR.toString()};
|
|
141
|
+
const measureTextHeight = ${hR.toString()};
|
|
142
|
+
const checkCondition = ${gR.toString()};
|
|
143
|
+
const formatValue = ${_R.toString()};
|
|
144
|
+
const getSafeTimingFunction = ${vR.toString()};
|
|
145
|
+
const computeLayout = ${bR.toString()};
|
|
146
|
+
const computeItemHeight = ${xR.toString()};
|
|
147
|
+
const renderItem = ${SR.toString()};
|
|
148
148
|
|
|
149
149
|
const itemHeightFallback = ${t.canvasHeight||0};
|
|
150
150
|
const newestPosition = "${t.listSettings&&t.listSettings.newestPosition||`bottom`}";
|
|
@@ -189,4 +189,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${n.do
|
|
|
189
189
|
} catch(e) { console.error("Smart List Init Error", e); }
|
|
190
190
|
})();
|
|
191
191
|
<\/script>
|
|
192
|
-
`;e.EditorContent=
|
|
192
|
+
`;e.EditorContent=uR,e.generateHTML=TR});
|