backflow-ui-renderer 0.1.65 → 0.1.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -115,11 +115,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
115
115
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Oct(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,s,a=[],c=!0,h=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(c=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(u){h=!0,i=u}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(h)throw i}}return a}}function Mct(e){if(Array.isArray(e))return e}function HE(e,t){if(e==null)return{};var n=kct(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kct(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function $ct(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ict(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,S2(r.key),r)}}function Rct(e,t,n){return t&&Ict(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Nct(e,t,n){return t=Zp(t),Lct(e,w2()?Reflect.construct(t,n||[],Zp(e).constructor):t.apply(e,n))}function Lct(e,t){if(t&&(Lc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jct(e)}function jct(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function w2(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(w2=function(){return!!e})()}function Zp(e){return Zp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Zp(e)}function Dct(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&zb(e,t)}function zb(e,t){return zb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},zb(e,t)}function jc(e){return Fct(e)||zct(e)||_2(e)||Bct()}function Bct(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
116
116
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _2(e,t){if(e){if(typeof e=="string")return Fb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fb(e,t)}}function zct(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Fct(e){if(Array.isArray(e))return Fb(e)}function Fb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function pt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qE(Object(n),!0).forEach(function(r){ee(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qE(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ee(e,t,n){return t=S2(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S2(e){var t=Wct(e,"string");return Lc(t)=="symbol"?t:t+""}function Wct(e,t){if(Lc(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Lc(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Vct={xAxis:["bottom","top"],yAxis:["left","right"]},Uct={width:"100%",height:"100%"},P2={x:0,y:0};function yd(e){return e}var Hct=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},qct=function(t,n,r,i){var o=n.find(function(u){return u&&u.index===r});if(o){if(t==="horizontal")return{x:o.coordinate,y:i.y};if(t==="vertical")return{x:i.x,y:o.coordinate};if(t==="centric"){var s=o.coordinate,a=i.radius;return pt(pt(pt({},i),on(i.cx,i.cy,a,s)),{},{angle:s,radius:a})}var c=o.coordinate,h=i.angle;return pt(pt(pt({},i),on(i.cx,i.cy,c,h)),{},{angle:h,radius:c})}return P2},tg=function(t,n){var r=n.graphicalItems,i=n.dataStartIndex,o=n.dataEndIndex,s=(r??[]).reduce(function(a,c){var h=c.props.data;return h&&h.length?[].concat(jc(a),jc(h)):a},[]);return s.length>0?s:t&&t.length&&At(i)&&At(o)?t.slice(i,o+1):[]};function A2(e){return e==="number"?[0,"auto"]:void 0}var Wb=function(t,n,r,i){var o=t.graphicalItems,s=t.tooltipAxis,a=tg(n,t);return r<0||!o||!o.length||r>=a.length?null:o.reduce(function(c,h){var u,f=(u=h.props.data)!==null&&u!==void 0?u:n;f&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(f=f.slice(t.dataStartIndex,t.dataEndIndex+1));var p;if(s.dataKey&&!s.allowDuplicatedCategory){var g=f===void 0?a:f;p=Fd(g,s.dataKey,i)}else p=f&&f[r]||a[r];return p?[].concat(jc(c),[o$(h,p)]):c},[])},GE=function(t,n,r,i){var o=i||{x:t.chartX,y:t.chartY},s=Hct(o,r),a=t.orderedTooltipTicks,c=t.tooltipAxis,h=t.tooltipTicks,u=FQ(s,a,h,c);if(u>=0&&h){var f=h[u]&&h[u].value,p=Wb(t,n,u,f),g=qct(r,a,u,o);return{activeTooltipIndex:u,activeLabel:f,activePayload:p,activeCoordinate:g}}return null},Gct=function(t,n){var r=n.axes,i=n.graphicalItems,o=n.axisType,s=n.axisIdKey,a=n.stackGroups,c=n.dataStartIndex,h=n.dataEndIndex,u=t.layout,f=t.children,p=t.stackOffset,g=Qk(u,o);return r.reduce(function(x,m){var b,_=m.type.defaultProps!==void 0?pt(pt({},m.type.defaultProps),m.props):m.props,S=_.type,A=_.dataKey,C=_.allowDataOverflow,w=_.allowDuplicatedCategory,E=_.scale,k=_.ticks,I=_.includeHidden,R=_[s];if(x[R])return x;var z=tg(t.data,{graphicalItems:i.filter(function(ot){var ct,mt=s in ot.props?ot.props[s]:(ct=ot.type.defaultProps)===null||ct===void 0?void 0:ct[s];return mt===R}),dataStartIndex:c,dataEndIndex:h}),j=z.length,N,U,W;bct(_.domain,C,S)&&(N=tb(_.domain,null,C),g&&(S==="number"||E!=="auto")&&(W=nh(z,A,"category")));var F=A2(S);if(!N||N.length===0){var q,G=(q=_.domain)!==null&&q!==void 0?q:F;if(A){if(N=nh(z,A,S),S==="category"&&g){var et=T4(N);w&&et?(U=N,N=$p(0,j)):w||(N=oA(G,N,m).reduce(function(ot,ct){return ot.indexOf(ct)>=0?ot:[].concat(jc(ot),[ct])},[]))}else if(S==="category")w?N=N.filter(function(ot){return ot!==""&&!ie(ot)}):N=oA(G,N,m).reduce(function(ot,ct){return ot.indexOf(ct)>=0||ct===""||ie(ct)?ot:[].concat(jc(ot),[ct])},[]);else if(S==="number"){var st=qQ(z,i.filter(function(ot){var ct,mt,vt=s in ot.props?ot.props[s]:(ct=ot.type.defaultProps)===null||ct===void 0?void 0:ct[s],yt="hide"in ot.props?ot.props.hide:(mt=ot.type.defaultProps)===null||mt===void 0?void 0:mt.hide;return vt===R&&(I||!yt)}),A,o,u);st&&(N=st)}g&&(S==="number"||E!=="auto")&&(W=nh(z,A,"category"))}else g?N=$p(0,j):a&&a[R]&&a[R].hasStack&&S==="number"?N=p==="expand"?[0,1]:i$(a[R].stackGroups,c,h):N=Jk(z,i.filter(function(ot){var ct=s in ot.props?ot.props[s]:ot.type.defaultProps[s],mt="hide"in ot.props?ot.props.hide:ot.type.defaultProps.hide;return ct===R&&(I||!mt)}),S,u,!0);if(S==="number")N=Bb(f,N,R,o,k),G&&(N=tb(G,N,C));else if(S==="category"&&G){var H=G,J=N.every(function(ot){return H.indexOf(ot)>=0});J&&(N=H)}}return pt(pt({},x),{},ee({},R,pt(pt({},_),{},{axisType:o,domain:N,categoricalDomain:W,duplicateDomain:U,originalDomain:(b=_.domain)!==null&&b!==void 0?b:F,isCategorical:g,layout:u})))},{})},Zct=function(t,n){var r=n.graphicalItems,i=n.Axis,o=n.axisType,s=n.axisIdKey,a=n.stackGroups,c=n.dataStartIndex,h=n.dataEndIndex,u=t.layout,f=t.children,p=tg(t.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:h}),g=p.length,x=Qk(u,o),m=-1;return r.reduce(function(b,_){var S=_.type.defaultProps!==void 0?pt(pt({},_.type.defaultProps),_.props):_.props,A=S[s],C=A2("number");if(!b[A]){m++;var w;return x?w=$p(0,g):a&&a[A]&&a[A].hasStack?(w=i$(a[A].stackGroups,c,h),w=Bb(f,w,A,o)):(w=tb(C,Jk(p,r.filter(function(E){var k,I,R=s in E.props?E.props[s]:(k=E.type.defaultProps)===null||k===void 0?void 0:k[s],z="hide"in E.props?E.props.hide:(I=E.type.defaultProps)===null||I===void 0?void 0:I.hide;return R===A&&!z}),"number",u),i.defaultProps.allowDataOverflow),w=Bb(f,w,A,o)),pt(pt({},b),{},ee({},A,pt(pt({axisType:o},i.defaultProps),{},{hide:!0,orientation:Xr(Vct,"".concat(o,".").concat(m%2),null),domain:w,originalDomain:C,isCategorical:x,layout:u})))}return b},{})},Yct=function(t,n){var r=n.axisType,i=r===void 0?"xAxis":r,o=n.AxisComp,s=n.graphicalItems,a=n.stackGroups,c=n.dataStartIndex,h=n.dataEndIndex,u=t.children,f="".concat(i,"Id"),p=Lr(u,o),g={};return p&&p.length?g=Gct(t,{axes:p,graphicalItems:s,axisType:i,axisIdKey:f,stackGroups:a,dataStartIndex:c,dataEndIndex:h}):s&&s.length&&(g=Zct(t,{Axis:o,graphicalItems:s,axisType:i,axisIdKey:f,stackGroups:a,dataStartIndex:c,dataEndIndex:h})),g},Kct=function(t){var n=ws(t),r=Io(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:bx(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:yp(n,r)}},ZE=function(t){var n=t.children,r=t.defaultShowTooltip,i=Gr(n,Pc),o=0,s=0;return t.data&&t.data.length!==0&&(s=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(s=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!r}},Xct=function(t){return!t||!t.length?!1:t.some(function(n){var r=No(n&&n.type);return r&&r.indexOf("Bar")>=0})},YE=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Jct=function(t,n){var r=t.props,i=t.graphicalItems,o=t.xAxisMap,s=o===void 0?{}:o,a=t.yAxisMap,c=a===void 0?{}:a,h=r.width,u=r.height,f=r.children,p=r.margin||{},g=Gr(f,Pc),x=Gr(f,Ra),m=Object.keys(c).reduce(function(w,E){var k=c[E],I=k.orientation;return!k.mirror&&!k.hide?pt(pt({},w),{},ee({},I,w[I]+k.width)):w},{left:p.left||0,right:p.right||0}),b=Object.keys(s).reduce(function(w,E){var k=s[E],I=k.orientation;return!k.mirror&&!k.hide?pt(pt({},w),{},ee({},I,Xr(w,"".concat(I))+k.height)):w},{top:p.top||0,bottom:p.bottom||0}),_=pt(pt({},b),m),S=_.bottom;g&&(_.bottom+=g.props.height||Pc.defaultProps.height),x&&n&&(_=UQ(_,i,r,n));var A=h-_.left-_.right,C=u-_.top-_.bottom;return pt(pt({brushBottom:S},_),{},{width:Math.max(A,0),height:Math.max(C,0)})},Qct=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},eg=function(t){var n=t.chartName,r=t.GraphicalChild,i=t.defaultTooltipEventType,o=i===void 0?"axis":i,s=t.validateTooltipEventTypes,a=s===void 0?["axis"]:s,c=t.axisComponents,h=t.legendContent,u=t.formatAxisMap,f=t.defaultProps,p=function(_,S){var A=S.graphicalItems,C=S.stackGroups,w=S.offset,E=S.updateId,k=S.dataStartIndex,I=S.dataEndIndex,R=_.barSize,z=_.layout,j=_.barGap,N=_.barCategoryGap,U=_.maxBarSize,W=YE(z),F=W.numericAxisName,q=W.cateAxisName,G=Xct(A),et=[];return A.forEach(function(st,H){var J=tg(_.data,{graphicalItems:[st],dataStartIndex:k,dataEndIndex:I}),ot=st.type.defaultProps!==void 0?pt(pt({},st.type.defaultProps),st.props):st.props,ct=ot.dataKey,mt=ot.maxBarSize,vt=ot["".concat(F,"Id")],yt=ot["".concat(q,"Id")],$t={},Ct=c.reduce(function(Pn,Je){var Qe,fr,dr=S["".concat(Je.axisType,"Map")],nr=ot["".concat(Je.axisType,"Id")];dr&&dr[nr]||Je.axisType==="zAxis"||(process.env.NODE_ENV!=="production"?Rr(!1,"Specifying a(n) ".concat(Je.axisType,"Id requires a corresponding ").concat(Je.axisType,"Id on the targeted graphical component ").concat((Qe=st==null||(fr=st.type)===null||fr===void 0?void 0:fr.displayName)!==null&&Qe!==void 0?Qe:"")):Rr());var Ue=dr[nr];return pt(pt({},Pn),{},ee(ee({},Je.axisType,Ue),"".concat(Je.axisType,"Ticks"),Io(Ue)))},$t),ut=Ct[q],ft=Ct["".concat(q,"Ticks")],Rt=C&&C[vt]&&C[vt].hasStack&&ett(st,C[vt].stackGroups),nt=No(st.type).indexOf("Bar")>=0,St=yp(ut,ft),dt=[],Jt=G&&WQ({barSize:R,stackGroups:C,totalSize:Qct(Ct,q)});if(nt){var pe,Me,ae=ie(mt)?U:mt,sn=(pe=(Me=yp(ut,ft,!0))!==null&&Me!==void 0?Me:ae)!==null&&pe!==void 0?pe:0;dt=VQ({barGap:j,barCategoryGap:N,bandSize:sn!==St?sn:St,sizeList:Jt[yt],maxBarSize:ae}),sn!==St&&(dt=dt.map(function(Pn){return pt(pt({},Pn),{},{position:pt(pt({},Pn.position),{},{offset:Pn.position.offset-sn/2})})}))}var Ve=st&&st.type&&st.type.getComposedData;Ve&&et.push({props:pt(pt({},Ve(pt(pt({},Ct),{},{displayedData:J,props:_,dataKey:ct,item:st,bandSize:St,barPosition:dt,offset:w,stackedData:Rt,layout:z,dataStartIndex:k,dataEndIndex:I}))),{},ee(ee(ee({key:st.key||"item-".concat(H)},F,Ct[F]),q,Ct[q]),"animationId",E)),childIndex:W4(st,_.children),item:st})}),et},g=function(_,S){var A=_.props,C=_.dataStartIndex,w=_.dataEndIndex,E=_.updateId;if(!Q1({props:A}))return null;var k=A.children,I=A.layout,R=A.stackOffset,z=A.data,j=A.reverseStackOrder,N=YE(I),U=N.numericAxisName,W=N.cateAxisName,F=Lr(k,r),q=QQ(z,F,"".concat(U,"Id"),"".concat(W,"Id"),R,j),G=c.reduce(function(ot,ct){var mt="".concat(ct.axisType,"Map");return pt(pt({},ot),{},ee({},mt,Yct(A,pt(pt({},ct),{},{graphicalItems:F,stackGroups:ct.axisType===U&&q,dataStartIndex:C,dataEndIndex:w}))))},{}),et=Jct(pt(pt({},G),{},{props:A,graphicalItems:F}),S==null?void 0:S.legendBBox);Object.keys(G).forEach(function(ot){G[ot]=u(A,G[ot],et,ot.replace("Map",""),n)});var st=G["".concat(W,"Map")],H=Kct(st),J=p(A,pt(pt({},G),{},{dataStartIndex:C,dataEndIndex:w,updateId:E,graphicalItems:F,stackGroups:q,offset:et}));return pt(pt({formattedGraphicalItems:J,graphicalItems:F,offset:et,stackGroups:q},H),G)},x=function(b){function _(S){var A,C,w;return $ct(this,_),w=Nct(this,_,[S]),ee(w,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ee(w,"accessibilityManager",new vct),ee(w,"handleLegendBBoxUpdate",function(E){if(E){var k=w.state,I=k.dataStartIndex,R=k.dataEndIndex,z=k.updateId;w.setState(pt({legendBBox:E},g({props:w.props,dataStartIndex:I,dataEndIndex:R,updateId:z},pt(pt({},w.state),{},{legendBBox:E}))))}}),ee(w,"handleReceiveSyncEvent",function(E,k,I){if(w.props.syncId===E){if(I===w.eventEmitterSymbol&&typeof w.props.syncMethod!="function")return;w.applySyncEvent(k)}}),ee(w,"handleBrushChange",function(E){var k=E.startIndex,I=E.endIndex;if(k!==w.state.dataStartIndex||I!==w.state.dataEndIndex){var R=w.state.updateId;w.setState(function(){return pt({dataStartIndex:k,dataEndIndex:I},g({props:w.props,dataStartIndex:k,dataEndIndex:I,updateId:R},w.state))}),w.triggerSyncEvent({dataStartIndex:k,dataEndIndex:I})}}),ee(w,"handleMouseEnter",function(E){var k=w.getMouseInfo(E);if(k){var I=pt(pt({},k),{},{isTooltipActive:!0});w.setState(I),w.triggerSyncEvent(I);var R=w.props.onMouseEnter;re(R)&&R(I,E)}}),ee(w,"triggeredAfterMouseMove",function(E){var k=w.getMouseInfo(E),I=k?pt(pt({},k),{},{isTooltipActive:!0}):{isTooltipActive:!1};w.setState(I),w.triggerSyncEvent(I);var R=w.props.onMouseMove;re(R)&&R(I,E)}),ee(w,"handleItemMouseEnter",function(E){w.setState(function(){return{isTooltipActive:!0,activeItem:E,activePayload:E.tooltipPayload,activeCoordinate:E.tooltipPosition||{x:E.cx,y:E.cy}}})}),ee(w,"handleItemMouseLeave",function(){w.setState(function(){return{isTooltipActive:!1}})}),ee(w,"handleMouseMove",function(E){E.persist(),w.throttleTriggeredAfterMouseMove(E)}),ee(w,"handleMouseLeave",function(E){w.throttleTriggeredAfterMouseMove.cancel();var k={isTooltipActive:!1};w.setState(k),w.triggerSyncEvent(k);var I=w.props.onMouseLeave;re(I)&&I(k,E)}),ee(w,"handleOuterEvent",function(E){var k=F4(E),I=Xr(w.props,"".concat(k));if(k&&re(I)){var R,z;/.*touch.*/i.test(k)?z=w.getMouseInfo(E.changedTouches[0]):z=w.getMouseInfo(E),I((R=z)!==null&&R!==void 0?R:{},E)}}),ee(w,"handleClick",function(E){var k=w.getMouseInfo(E);if(k){var I=pt(pt({},k),{},{isTooltipActive:!0});w.setState(I),w.triggerSyncEvent(I);var R=w.props.onClick;re(R)&&R(I,E)}}),ee(w,"handleMouseDown",function(E){var k=w.props.onMouseDown;if(re(k)){var I=w.getMouseInfo(E);k(I,E)}}),ee(w,"handleMouseUp",function(E){var k=w.props.onMouseUp;if(re(k)){var I=w.getMouseInfo(E);k(I,E)}}),ee(w,"handleTouchMove",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&w.throttleTriggeredAfterMouseMove(E.changedTouches[0])}),ee(w,"handleTouchStart",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&w.handleMouseDown(E.changedTouches[0])}),ee(w,"handleTouchEnd",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&w.handleMouseUp(E.changedTouches[0])}),ee(w,"handleDoubleClick",function(E){var k=w.props.onDoubleClick;if(re(k)){var I=w.getMouseInfo(E);k(I,E)}}),ee(w,"handleContextMenu",function(E){var k=w.props.onContextMenu;if(re(k)){var I=w.getMouseInfo(E);k(I,E)}}),ee(w,"triggerSyncEvent",function(E){w.props.syncId!==void 0&&My.emit(ky,w.props.syncId,E,w.eventEmitterSymbol)}),ee(w,"applySyncEvent",function(E){var k=w.props,I=k.layout,R=k.syncMethod,z=w.state.updateId,j=E.dataStartIndex,N=E.dataEndIndex;if(E.dataStartIndex!==void 0||E.dataEndIndex!==void 0)w.setState(pt({dataStartIndex:j,dataEndIndex:N},g({props:w.props,dataStartIndex:j,dataEndIndex:N,updateId:z},w.state)));else if(E.activeTooltipIndex!==void 0){var U=E.chartX,W=E.chartY,F=E.activeTooltipIndex,q=w.state,G=q.offset,et=q.tooltipTicks;if(!G)return;if(typeof R=="function")F=R(et,E);else if(R==="value"){F=-1;for(var st=0;st<et.length;st++)if(et[st].value===E.activeLabel){F=st;break}}var H=pt(pt({},G),{},{x:G.left,y:G.top}),J=Math.min(U,H.x+H.width),ot=Math.min(W,H.y+H.height),ct=et[F]&&et[F].value,mt=Wb(w.state,w.props.data,F),vt=et[F]?{x:I==="horizontal"?et[F].coordinate:J,y:I==="horizontal"?ot:et[F].coordinate}:P2;w.setState(pt(pt({},E),{},{activeLabel:ct,activeCoordinate:vt,activePayload:mt,activeTooltipIndex:F}))}else w.setState(E)}),ee(w,"renderCursor",function(E){var k,I=w.state,R=I.isTooltipActive,z=I.activeCoordinate,j=I.activePayload,N=I.offset,U=I.activeTooltipIndex,W=I.tooltipAxisBandSize,F=w.getTooltipEventType(),q=(k=E.props.active)!==null&&k!==void 0?k:R,G=w.props.layout,et=E.key||"_recharts-cursor";return y.createElement(Act,{key:et,activeCoordinate:z,activePayload:j,activeTooltipIndex:U,chartName:n,element:E,isActive:q,layout:G,offset:N,tooltipAxisBandSize:W,tooltipEventType:F})}),ee(w,"renderPolarAxis",function(E,k,I){var R=Xr(E,"type.axisType"),z=Xr(w.state,"".concat(R,"Map")),j=E.type.defaultProps,N=j!==void 0?pt(pt({},j),E.props):E.props,U=z&&z[N["".concat(R,"Id")]];return y.cloneElement(E,pt(pt({},U),{},{className:ge(R,U.className),key:E.key||"".concat(k,"-").concat(I),ticks:Io(U,!0)}))}),ee(w,"renderPolarGrid",function(E){var k=E.props,I=k.radialLines,R=k.polarAngles,z=k.polarRadius,j=w.state,N=j.radiusAxisMap,U=j.angleAxisMap,W=ws(N),F=ws(U),q=F.cx,G=F.cy,et=F.innerRadius,st=F.outerRadius;return y.cloneElement(E,{polarAngles:Array.isArray(R)?R:Io(F,!0).map(function(H){return H.coordinate}),polarRadius:Array.isArray(z)?z:Io(W,!0).map(function(H){return H.coordinate}),cx:q,cy:G,innerRadius:et,outerRadius:st,key:E.key||"polar-grid",radialLines:I})}),ee(w,"renderLegend",function(){var E=w.state.formattedGraphicalItems,k=w.props,I=k.children,R=k.width,z=k.height,j=w.props.margin||{},N=R-(j.left||0)-(j.right||0),U=Kk({children:I,formattedGraphicalItems:E,legendWidth:N,legendContent:h});if(!U)return null;var W=U.item,F=HE(U,Ect);return y.cloneElement(W,pt(pt({},F),{},{chartWidth:R,chartHeight:z,margin:j,onBBoxUpdate:w.handleLegendBBoxUpdate}))}),ee(w,"renderTooltip",function(){var E,k=w.props,I=k.children,R=k.accessibilityLayer,z=Gr(I,Zr);if(!z)return null;var j=w.state,N=j.isTooltipActive,U=j.activeCoordinate,W=j.activePayload,F=j.activeLabel,q=j.offset,G=(E=z.props.active)!==null&&E!==void 0?E:N;return y.cloneElement(z,{viewBox:pt(pt({},q),{},{x:q.left,y:q.top}),active:G,label:F,payload:G?W:[],coordinate:U,accessibilityLayer:R})}),ee(w,"renderBrush",function(E){var k=w.props,I=k.margin,R=k.data,z=w.state,j=z.offset,N=z.dataStartIndex,U=z.dataEndIndex,W=z.updateId;return y.cloneElement(E,{key:E.key||"_recharts-brush",onChange:fd(w.handleBrushChange,E.props.onChange),data:R,x:At(E.props.x)?E.props.x:j.left,y:At(E.props.y)?E.props.y:j.top+j.height+j.brushBottom-(I.bottom||0),width:At(E.props.width)?E.props.width:j.width,startIndex:N,endIndex:U,updateId:"brush-".concat(W)})}),ee(w,"renderReferenceElement",function(E,k,I){if(!E)return null;var R=w,z=R.clipPathId,j=w.state,N=j.xAxisMap,U=j.yAxisMap,W=j.offset,F=E.type.defaultProps||{},q=E.props,G=q.xAxisId,et=G===void 0?F.xAxisId:G,st=q.yAxisId,H=st===void 0?F.yAxisId:st;return y.cloneElement(E,{key:E.key||"".concat(k,"-").concat(I),xAxis:N[et],yAxis:U[H],viewBox:{x:W.left,y:W.top,width:W.width,height:W.height},clipPathId:z})}),ee(w,"renderActivePoints",function(E){var k=E.item,I=E.activePoint,R=E.basePoint,z=E.childIndex,j=E.isRange,N=[],U=k.props.key,W=k.item.type.defaultProps!==void 0?pt(pt({},k.item.type.defaultProps),k.item.props):k.item.props,F=W.activeDot,q=W.dataKey,G=pt(pt({index:z,dataKey:q,cx:I.x,cy:I.y,r:4,fill:Hx(k.item),strokeWidth:2,stroke:"#fff",payload:I.payload,value:I.value},Gt(F,!1)),Wd(F));return N.push(_.renderActiveDot(F,G,"".concat(U,"-activePoint-").concat(z))),R?N.push(_.renderActiveDot(F,pt(pt({},G),{},{cx:R.x,cy:R.y}),"".concat(U,"-basePoint-").concat(z))):j&&N.push(null),N}),ee(w,"renderGraphicChild",function(E,k,I){var R=w.filterFormatItem(E,k,I);if(!R)return null;var z=w.getTooltipEventType(),j=w.state,N=j.isTooltipActive,U=j.tooltipAxis,W=j.activeTooltipIndex,F=j.activeLabel,q=w.props.children,G=Gr(q,Zr),et=R.props,st=et.points,H=et.isRange,J=et.baseLine,ot=R.item.type.defaultProps!==void 0?pt(pt({},R.item.type.defaultProps),R.item.props):R.item.props,ct=ot.activeDot,mt=ot.hide,vt=ot.activeBar,yt=ot.activeShape,$t=!!(!mt&&N&&G&&(ct||vt||yt)),Ct={};z!=="axis"&&G&&G.props.trigger==="click"?Ct={onClick:fd(w.handleItemMouseEnter,E.props.onClick)}:z!=="axis"&&(Ct={onMouseLeave:fd(w.handleItemMouseLeave,E.props.onMouseLeave),onMouseEnter:fd(w.handleItemMouseEnter,E.props.onMouseEnter)});var ut=y.cloneElement(E,pt(pt({},R.props),Ct));function ft(Je){return typeof U.dataKey=="function"?U.dataKey(Je.payload):null}if($t)if(W>=0){var Rt,nt;if(U.dataKey&&!U.allowDuplicatedCategory){var St=typeof U.dataKey=="function"?ft:"payload.".concat(U.dataKey.toString());Rt=Fd(st,St,F),nt=H&&J&&Fd(J,St,F)}else Rt=st==null?void 0:st[W],nt=H&&J&&J[W];if(yt||vt){var dt=E.props.activeIndex!==void 0?E.props.activeIndex:W;return[y.cloneElement(E,pt(pt(pt({},R.props),Ct),{},{activeIndex:dt})),null,null]}if(!ie(Rt))return[ut].concat(jc(w.renderActivePoints({item:R,activePoint:Rt,basePoint:nt,childIndex:W,isRange:H})))}else{var Jt,pe=(Jt=w.getItemByXY(w.state.activeCoordinate))!==null&&Jt!==void 0?Jt:{graphicalItem:ut},Me=pe.graphicalItem,ae=Me.item,sn=ae===void 0?E:ae,Ve=Me.childIndex,Pn=pt(pt(pt({},R.props),Ct),{},{activeIndex:Ve});return[y.cloneElement(sn,Pn),null,null]}return H?[ut,null,null]:[ut,null]}),ee(w,"renderCustomized",function(E,k,I){return y.cloneElement(E,pt(pt({key:"recharts-customized-".concat(I)},w.props),w.state))}),ee(w,"renderMap",{CartesianGrid:{handler:yd,once:!0},ReferenceArea:{handler:w.renderReferenceElement},ReferenceLine:{handler:yd},ReferenceDot:{handler:w.renderReferenceElement},XAxis:{handler:yd},YAxis:{handler:yd},Brush:{handler:w.renderBrush,once:!0},Bar:{handler:w.renderGraphicChild},Line:{handler:w.renderGraphicChild},Area:{handler:w.renderGraphicChild},Radar:{handler:w.renderGraphicChild},RadialBar:{handler:w.renderGraphicChild},Scatter:{handler:w.renderGraphicChild},Pie:{handler:w.renderGraphicChild},Funnel:{handler:w.renderGraphicChild},Tooltip:{handler:w.renderCursor,once:!0},PolarGrid:{handler:w.renderPolarGrid,once:!0},PolarAngleAxis:{handler:w.renderPolarAxis},PolarRadiusAxis:{handler:w.renderPolarAxis},Customized:{handler:w.renderCustomized}}),w.clipPathId="".concat((A=S.id)!==null&&A!==void 0?A:Qa("recharts"),"-clip"),w.throttleTriggeredAfterMouseMove=KM(w.triggeredAfterMouseMove,(C=S.throttleDelay)!==null&&C!==void 0?C:1e3/60),w.state={},w}return Dct(_,b),Rct(_,[{key:"componentDidMount",value:function(){var A,C;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var A=this.props,C=A.children,w=A.data,E=A.height,k=A.layout,I=Gr(C,Zr);if(I){var R=I.props.defaultIndex;if(!(typeof R!="number"||R<0||R>this.state.tooltipTicks.length-1)){var z=this.state.tooltipTicks[R]&&this.state.tooltipTicks[R].value,j=Wb(this.state,w,R,z),N=this.state.tooltipTicks[R].coordinate,U=(this.state.offset.top+E)/2,W=k==="horizontal",F=W?{x:N,y:U}:{y:N,x:U},q=this.state.formattedGraphicalItems.find(function(et){var st=et.item;return st.type.name==="Scatter"});q&&(F=pt(pt({},F),q.props.points[R].tooltipPosition),j=q.props.points[R].tooltipPayload);var G={activeTooltipIndex:R,isTooltipActive:!0,activeLabel:z,activePayload:j,activeCoordinate:F};this.setState(G),this.renderCursor(I),this.accessibilityManager.setIndex(R)}}}},{key:"getSnapshotBeforeUpdate",value:function(A,C){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==C.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==A.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==A.margin){var w,E;this.accessibilityManager.setDetails({offset:{left:(w=this.props.margin.left)!==null&&w!==void 0?w:0,top:(E=this.props.margin.top)!==null&&E!==void 0?E:0}})}return null}},{key:"componentDidUpdate",value:function(A){mv([Gr(A.children,Zr)],[Gr(this.props.children,Zr)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var A=Gr(this.props.children,Zr);if(A&&typeof A.props.shared=="boolean"){var C=A.props.shared?"axis":"item";return a.indexOf(C)>=0?C:o}return o}},{key:"getMouseInfo",value:function(A){if(!this.container)return null;var C=this.container,w=C.getBoundingClientRect(),E=mY(w),k={chartX:Math.round(A.pageX-E.left),chartY:Math.round(A.pageY-E.top)},I=w.width/C.offsetWidth||1,R=this.inRange(k.chartX,k.chartY,I);if(!R)return null;var z=this.state,j=z.xAxisMap,N=z.yAxisMap,U=this.getTooltipEventType(),W=GE(this.state,this.props.data,this.props.layout,R);if(U!=="axis"&&j&&N){var F=ws(j).scale,q=ws(N).scale,G=F&&F.invert?F.invert(k.chartX):null,et=q&&q.invert?q.invert(k.chartY):null;return pt(pt({},k),{},{xValue:G,yValue:et},W)}return W?pt(pt({},k),W):null}},{key:"inRange",value:function(A,C){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,E=this.props.layout,k=A/w,I=C/w;if(E==="horizontal"||E==="vertical"){var R=this.state.offset,z=k>=R.left&&k<=R.left+R.width&&I>=R.top&&I<=R.top+R.height;return z?{x:k,y:I}:null}var j=this.state,N=j.angleAxisMap,U=j.radiusAxisMap;if(N&&U){var W=ws(N);return lA({x:k,y:I},W)}return null}},{key:"parseEventsOfWrapper",value:function(){var A=this.props.children,C=this.getTooltipEventType(),w=Gr(A,Zr),E={};w&&C==="axis"&&(w.props.trigger==="click"?E={onClick:this.handleClick}:E={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var k=Wd(this.props,this.handleOuterEvent);return pt(pt({},k),E)}},{key:"addListener",value:function(){My.on(ky,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){My.removeListener(ky,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(A,C,w){for(var E=this.state.formattedGraphicalItems,k=0,I=E.length;k<I;k++){var R=E[k];if(R.item===A||R.props.key===A.key||C===No(R.item.type)&&w===R.childIndex)return R}return null}},{key:"renderClipPath",value:function(){var A=this.clipPathId,C=this.state.offset,w=C.left,E=C.top,k=C.height,I=C.width;return y.createElement("defs",null,y.createElement("clipPath",{id:A},y.createElement("rect",{x:w,y:E,height:k,width:I})))}},{key:"getXScales",value:function(){var A=this.state.xAxisMap;return A?Object.entries(A).reduce(function(C,w){var E=UE(w,2),k=E[0],I=E[1];return pt(pt({},C),{},ee({},k,I.scale))},{}):null}},{key:"getYScales",value:function(){var A=this.state.yAxisMap;return A?Object.entries(A).reduce(function(C,w){var E=UE(w,2),k=E[0],I=E[1];return pt(pt({},C),{},ee({},k,I.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(A){var C;return(C=this.state.xAxisMap)===null||C===void 0||(C=C[A])===null||C===void 0?void 0:C.scale}},{key:"getYScaleByAxisId",value:function(A){var C;return(C=this.state.yAxisMap)===null||C===void 0||(C=C[A])===null||C===void 0?void 0:C.scale}},{key:"getItemByXY",value:function(A){var C=this.state,w=C.formattedGraphicalItems,E=C.activeItem;if(w&&w.length)for(var k=0,I=w.length;k<I;k++){var R=w[k],z=R.props,j=R.item,N=j.type.defaultProps!==void 0?pt(pt({},j.type.defaultProps),j.props):j.props,U=No(j.type);if(U==="Bar"){var W=(z.data||[]).find(function(et){return lrt(A,et)});if(W)return{graphicalItem:R,payload:W}}else if(U==="RadialBar"){var F=(z.data||[]).find(function(et){return lA(A,et)});if(F)return{graphicalItem:R,payload:F}}else if(qm(R,E)||Gm(R,E)||Gh(R,E)){var q=Kit({graphicalItem:R,activeTooltipItem:E,itemData:N.data}),G=N.activeIndex===void 0?q:N.activeIndex;return{graphicalItem:pt(pt({},R),{},{childIndex:G}),payload:Gh(R,E)?N.data[q]:R.props.data[q]}}}return null}},{key:"render",value:function(){var A=this;if(!Q1(this))return null;var C=this.props,w=C.children,E=C.className,k=C.width,I=C.height,R=C.style,z=C.compact,j=C.title,N=C.desc,U=HE(C,Cct),W=Gt(U,!1);if(z)return y.createElement(AE,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},y.createElement(yv,Zl({},W,{width:k,height:I,title:j,desc:N}),this.renderClipPath(),eS(w,this.renderMap)));if(this.props.accessibilityLayer){var F,q;W.tabIndex=(F=this.props.tabIndex)!==null&&F!==void 0?F:0,W.role=(q=this.props.role)!==null&&q!==void 0?q:"application",W.onKeyDown=function(et){A.accessibilityManager.keyboardEvent(et)},W.onFocus=function(){A.accessibilityManager.focus()}}var G=this.parseEventsOfWrapper();return y.createElement(AE,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},y.createElement("div",Zl({className:ge("recharts-wrapper",E),style:pt({position:"relative",cursor:"default",width:k,height:I},R)},G,{ref:function(st){A.container=st}}),y.createElement(yv,Zl({},W,{width:k,height:I,title:j,desc:N,style:Uct}),this.renderClipPath(),eS(w,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(y.Component);ee(x,"displayName",n),ee(x,"defaultProps",pt({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),ee(x,"getDerivedStateFromProps",function(b,_){var S=b.dataKey,A=b.data,C=b.children,w=b.width,E=b.height,k=b.layout,I=b.stackOffset,R=b.margin,z=_.dataStartIndex,j=_.dataEndIndex;if(_.updateId===void 0){var N=ZE(b);return pt(pt(pt({},N),{},{updateId:0},g(pt(pt({props:b},N),{},{updateId:0}),_)),{},{prevDataKey:S,prevData:A,prevWidth:w,prevHeight:E,prevLayout:k,prevStackOffset:I,prevMargin:R,prevChildren:C})}if(S!==_.prevDataKey||A!==_.prevData||w!==_.prevWidth||E!==_.prevHeight||k!==_.prevLayout||I!==_.prevStackOffset||!Ql(R,_.prevMargin)){var U=ZE(b),W={chartX:_.chartX,chartY:_.chartY,isTooltipActive:_.isTooltipActive},F=pt(pt({},GE(_,A,k)),{},{updateId:_.updateId+1}),q=pt(pt(pt({},U),W),F);return pt(pt(pt({},q),g(pt({props:b},q),_)),{},{prevDataKey:S,prevData:A,prevWidth:w,prevHeight:E,prevLayout:k,prevStackOffset:I,prevMargin:R,prevChildren:C})}if(!mv(C,_.prevChildren)){var G,et,st,H,J=Gr(C,Pc),ot=J&&(G=(et=J.props)===null||et===void 0?void 0:et.startIndex)!==null&&G!==void 0?G:z,ct=J&&(st=(H=J.props)===null||H===void 0?void 0:H.endIndex)!==null&&st!==void 0?st:j,mt=ot!==z||ct!==j,vt=!ie(A),yt=vt&&!mt?_.updateId:_.updateId+1;return pt(pt({updateId:yt},g(pt(pt({props:b},_),{},{updateId:yt,dataStartIndex:ot,dataEndIndex:ct}),_)),{},{prevChildren:C,dataStartIndex:ot,dataEndIndex:ct})}return null}),ee(x,"renderActiveDot",function(b,_,S){var A;return y.isValidElement(b)?A=y.cloneElement(b,_):re(b)?A=b(_):A=y.createElement(Fm,_),y.createElement(Ae,{className:"recharts-active-dot",key:S},A)});var m=y.forwardRef(function(_,S){return y.createElement(x,Zl({},_,{ref:S}))});return m.displayName=x.displayName,m},tut=eg({chartName:"BarChart",GraphicalChild:rl,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Us},{axisType:"yAxis",AxisComp:Hs}],formatAxisMap:Zx}),eut=eg({chartName:"PieChart",GraphicalChild:Go,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:Hm},{axisType:"radiusAxis",AxisComp:Vm}],formatAxisMap:htt,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),nut=eg({chartName:"ScatterChart",GraphicalChild:gf,defaultTooltipEventType:"item",validateTooltipEventTypes:["item"],axisComponents:[{axisType:"xAxis",AxisComp:Us},{axisType:"yAxis",AxisComp:Hs},{axisType:"zAxis",AxisComp:mf}],formatAxisMap:Zx}),rut=eg({chartName:"AreaChart",GraphicalChild:Vs,axisComponents:[{axisType:"xAxis",AxisComp:Us},{axisType:"yAxis",AxisComp:Hs}],formatAxisMap:Zx});function E2(e){const{channel:t,enabled:n,apiBaseUrl:r,getAuthToken:i,createWebSocket:o,parseClassName:s,brandColor:a="#8b5cf6",style:c={},preview:h,previewForm:u,instanceKey:f,onResolved:p}=e,[g,x]=y.useState(h?{approvalId:"preview",form:u||{title:"Which account should I use?",description:"The signup page offers multiple providers — pick one and give me the promo code if you have it.",sections:[{title:"Sign-in provider",fields:[{type:"radio",key:"provider",label:"Provider",options:["Google","GitHub","Email"]},{type:"checkbox",key:"scopes",label:"Optional scopes",options:["Read profile","Send email"]}]},{title:"Details",fields:[{type:"text",key:"promo",label:"Promo code",placeholder:"e.g. LAUNCH20"}]}]}}:null),[m,b]=y.useState({}),[_,S]=y.useState(!1),[A,C]=y.useState(!1),[w,E]=y.useState(null);y.useEffect(()=>{const j=g==null?void 0:g.expiresAt;if(!j){E(null);return}const N=()=>{const W=Math.max(0,Math.floor((new Date(j).getTime()-Date.now())/1e3));E(W),W<=0&&x(null)};N();const U=setInterval(N,1e3);return()=>clearInterval(U)},[g]);const k=j=>r&&/^(https?:)?\/\//i.test(r)?new URL(j,r).toString():`/api${j}`;y.useEffect(()=>{if(!n||!t)return;let j=!1,N=null;const U=()=>{j||(N=o(t),rm(N)&&(N.addEventListener("open",async()=>{try{const F=await fetch(k("/agent/tools/approvals"),{headers:{Authorization:`Bearer ${(i==null?void 0:i())||localStorage.getItem("token")||""}`}});if(!F.ok||j)return;const{approvals:q}=await F.json(),G=(q||[]).find(st=>{var H;return st.status==="pending"&&((H=st.toolInput)==null?void 0:H.sections)});G&&(!G.expiresAt||new Date(G.expiresAt).getTime()>Date.now())&&(b({}),x({approvalId:G.id,form:G.toolInput,expiresAt:G.expiresAt}))}catch{}}),N.onmessage=W=>{var q,G;let F=W==null?void 0:W.data;if(typeof F=="string")try{F=JSON.parse(F)}catch{return}(F==null?void 0:F.type)==="step_paused"&&((q=F.pauseMetadata)!=null&&q.form)&&((G=F.pauseMetadata)!=null&&G.approvalId)&&(b({}),x({approvalId:F.pauseMetadata.approvalId,form:F.pauseMetadata.form,expiresAt:F.pauseMetadata.expiresAt}))},N.onclose=()=>{j||setTimeout(U,3e3)},N.onerror=()=>{var W;(W=N==null?void 0:N.close)==null||W.call(N)}))};return U(),()=>{var W;j=!0,(W=N==null?void 0:N.close)==null||W.call(N)}},[n,t,f]);const I=async j=>{if(!g||_)return;const N=g.approvalId;if(N==="preview"){x(null),p==null||p(j,N);return}S(!0);const U=`/agent/tools/approvals/${encodeURIComponent(N)}/${j?"approve":"deny"}`;try{await fetch(k(U),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(i==null?void 0:i())||localStorage.getItem("token")||""}`},body:j?JSON.stringify({formValues:m,dontAskAgain:A}):"{}"})}catch{}S(!1),x(null),p==null||p(j,N)},R=j=>{const N=m[j.key],U=W=>b(F=>({...F,[j.key]:W}));if(j.type==="radio"||j.type==="checkbox"){const W=j.type==="checkbox",F=W?Array.isArray(N)?N:[]:[N].filter(Boolean);return y.createElement("div",{key:j.key,style:{display:"flex",flexWrap:"wrap",gap:8}},(j.options||[]).map(q=>y.createElement("button",{key:q,type:"button",onClick:()=>U(W?F.includes(q)?F.filter(G=>G!==q):[...F,q]:q),style:{padding:"6px 12px",borderRadius:999,fontSize:12,border:"none",cursor:"pointer",fontWeight:F.includes(q)?600:500,backgroundColor:F.includes(q)?"#ffffff":"rgba(255,255,255,0.1)",color:F.includes(q)?"#000000":"#ffffff"}},q)))}return y.createElement("input",{key:j.key,type:j.secure===!0?"password":"text",placeholder:j.placeholder||"",value:N||"",onChange:W=>U(W.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:8,border:"none",outline:"none",fontSize:14,backgroundColor:"rgba(255,255,255,0.1)",color:"#ffffff"}})},z=c.variant==="drawer";return g?Za.createPortal(y.createElement("div",{key:"approval",onClick:j=>j.stopPropagation(),className:c.className?s==null?void 0:s(c.className):void 0,style:{position:"fixed",inset:0,zIndex:1100,display:"flex",alignItems:z?"stretch":"center",justifyContent:z?"flex-end":"center",backgroundColor:"rgba(0,0,0,0.7)",padding:z?0:16}},y.createElement("div",{style:{position:"relative",overflow:"hidden",borderRadius:z?0:17,padding:1,width:"100%",maxWidth:z?"24rem":"40rem",maxHeight:"100%",display:"flex",backgroundColor:"rgba(255,255,255,0.08)"}},y.createElement("div",{style:{position:"absolute",inset:"-150%",background:`conic-gradient(from 0deg, transparent 0%, ${a}99 14%, transparent 30%)`,animation:"bf-spin 6s linear infinite"}}),y.createElement("div",{className:c.panelClassName?s==null?void 0:s(c.panelClassName):void 0,style:{position:"relative",zIndex:1,width:"100%",maxHeight:"100%",overflowY:"auto",borderRadius:z?0:16,backgroundColor:"#12121a",color:"#f8fafc",padding:20,display:"flex",flexDirection:"column",gap:16,...c.style||{}}},w!=null?y.createElement("span",{style:{position:"absolute",top:12,right:16,fontSize:12,fontVariantNumeric:"tabular-nums",color:w<=15?"#f87171":"rgba(255,255,255,0.5)"}},`${Math.floor(w/60)}:${String(w%60).padStart(2,"0")}`):null,y.createElement("p",{style:{fontSize:20,fontWeight:600,color:"#ffffff"}},g.form.title||"Input needed"),g.form.description?y.createElement("p",{style:{fontSize:16,color:"rgba(255,255,255,0.6)"}},g.form.description):null,...(g.form.sections||[]).map((j,N)=>y.createElement("div",{key:j.title||N,style:{display:"flex",flexDirection:"column",gap:8}},j.title?y.createElement("p",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"rgba(255,255,255,0.5)"}},j.title):null,...(j.fields||[]).map(U=>y.createElement("label",{key:U.key,style:{display:"flex",flexDirection:"column",gap:6}},y.createElement("span",{style:{fontSize:14,color:"rgba(255,255,255,0.8)"}},U.label||U.key),R(U))))),y.createElement("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"rgba(255,255,255,0.6)",cursor:"pointer"}},y.createElement("input",{type:"checkbox",checked:A,onChange:j=>C(j.target.checked),style:{accentColor:a}}),"Don't ask again this session"),y.createElement("div",{style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",gap:8,paddingTop:4}},y.createElement("button",{type:"button",disabled:_,onClick:()=>void I(!1),style:{padding:"8px 16px",borderRadius:999,fontSize:14,fontWeight:500,border:"none",cursor:"pointer",backgroundColor:"rgba(255,255,255,0.1)",color:"#ffffff",opacity:_?.4:1}},"Cancel"),y.createElement("button",{type:"button",disabled:_,onClick:()=>void I(!0),style:{padding:"8px 16px",borderRadius:999,fontSize:14,fontWeight:600,border:"none",cursor:"pointer",backgroundColor:"#ffffff",color:"#000000",opacity:_?.4:1}},"Submit"))))),document.body):null}const iut=(e,t,n)=>Math.min(n,Math.max(t,e));function out(e){const t=e.map(o=>{const s=o.size??o.width,a=typeof s=="number"?s:/%\s*$/.test(String(s??""))?parseFloat(s):NaN;return Number.isFinite(a)?a:NaN}),n=t.filter(o=>!Number.isNaN(o)),r=Math.max(0,100-n.reduce((o,s)=>o+s,0)),i=Math.max(1,t.length-n.length);return t.map(o=>Number.isNaN(o)?r/i:o)}const sut=y.forwardRef(function({api:t,config:n,componentKey:r},i){const o=Array.isArray(n.panes)?n.panes:[],s=n.orientation==="vertical",[a,c]=y.useState(()=>out(o)),[h,u]=y.useState(!1),f=y.useRef(null),p=(S,A)=>{var E,k;const C=Number(((E=o[S])==null?void 0:E.minSize)??10),w=Number(((k=o[S+1])==null?void 0:k.minSize)??10);c(I=>{const R=I[S]+I[S+1],z=iut(A,C,R-w);return I.map((j,N)=>N===S?z:N===S+1?R-z:j)})},g=S=>A=>{const C=f.current;if(!C||A.button!==0)return;A.preventDefault();const w=C.ownerDocument,E=C.getBoundingClientRect(),k=s?E.height:E.width,I=s?A.clientY:A.clientX,R=a[S];u(!0);const z=N=>{const U=((s?N.clientY:N.clientX)-I)/k*100;p(S,R+U)},j=()=>{w.removeEventListener("pointermove",z),w.removeEventListener("pointerup",j),w.removeEventListener("pointercancel",j),u(!1)};w.addEventListener("pointermove",z),w.addEventListener("pointerup",j),w.addEventListener("pointercancel",j)},x=S=>A=>{const C=s?"ArrowUp":"ArrowLeft",w=s?"ArrowDown":"ArrowRight";A.key!==C&&A.key!==w||(A.preventDefault(),p(S,a[S]+(A.key===w?2:-2)))},m={display:"flex",flexDirection:s?"column":"row",alignItems:"stretch",...n.className?t.parseClassName(n.className):{width:"100%",flex:1,minHeight:0}},b=[];o.forEach((S,A)=>{b.push(V("div",{key:`${r}-split-${A}`,style:{flex:`${a[A]} 1 0px`,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden",pointerEvents:h?"none":void 0}},S.component?t.renderComponent(S.component,A,`${r}-split`):null)),A!==o.length-1&&b.push(V("div",{key:`${r}-split-handle-${A}`,role:"separator",tabIndex:0,"aria-orientation":s?"horizontal":"vertical","aria-valuenow":Math.round(a[A]),"aria-label":"Resize",onPointerDown:g(A),onKeyDown:x(A),style:{flex:"0 0 auto",[s?"height":"width"]:8,cursor:s?"row-resize":"col-resize",touchAction:"none",userSelect:"none",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1}},V("div",{style:{[s?"height":"width"]:1,[s?"width":"height"]:"100%",background:t.cfg.colors.border}})))});const _=t.getCommonProps(r,m,n);return V("div",{key:r,..._,ref:S=>{f.current=S,typeof i=="function"?i(S):i&&(i.current=S)}},...b)}),aut=()=>{try{if(typeof window<"u")return window.localStorage.getItem("backflow_dev_diagnostics")==="1"}catch{}return!1},Yp=(...e)=>{aut()&&console.warn(...e)};function lut(e,t,n){var s,a;const r=t.expression?((s=e.evaluateExpression)==null?void 0:s.call(e,t.expression,t.expressionUrl,n,t.expressionKey))??e.interpolateText(t.expression):e.interpolateText(t.text||"");if(t.className){const c=((a=e.parseClassNameResponsive)==null?void 0:a.call(e,t.className,n))??e.parseClassName(t.className);if(e.renderMode!=="css-driven"){const u=U0(t.className);if(u.size>0){const p=Qt(u,e.containerWidth,"1rem");c.fontSize=p}const f=Hc(t.className);f.size>0&&(c.display=Qt(f,e.containerWidth,"block"))}const h=e.getCommonProps(n,c,t);return V("p",{key:n,className:t.className,...h},r)}const i={};t.fontSize!==void 0&&(i.fontSize=`${t.fontSize}px`),t.fontWeight!==void 0&&(i.fontWeight=t.fontWeight),t.color!==void 0&&(i.color=t.color),t.textAlign!==void 0&&(i.textAlign=t.textAlign);const o=e.getCommonProps(n,i,t);return V("p",{key:n,...o},r)}function cut(e){return e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<iframe[\s\S]*?<\/iframe>/gi,"").replace(/\son\w+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,"")}function uut(e,t,n){const r=String(e.apiUrl||"").replace(/\/$/,""),i=e.interpolateText(t.text||t.html||"").replace(/(src|href)=("|')\/(?!\/)/g,r?`$1=$2${r}/`:"$1=$2/"),o=e.getCommonProps(n,{color:e.cfg.colors.text},t);return V("div",{key:n,className:t.className,...o,dangerouslySetInnerHTML:{__html:cut(i)}})}function hut(e,t,n){var a,c,h,u,f;const r=()=>{t.onClick?e.handleButtonClick(t.onClick,{onSuccess:t.onSuccess,onError:t.onError},{optimistic:t.optimistic,feedback:t.feedback}):t.href&&(t.href.startsWith("http")||e.previewMode?window.open(t.href,"_blank","noopener,noreferrer"):window.location.href=t.href)},i=()=>{var p;if(!e.interactionDisabled){if((p=t.confirmation)!=null&&p.enabled){(e.setOverlayModal||e.setActiveModal)({id:"__confirm",definition:{title:t.confirmation.title||"Confirm Action",size:"sm",components:[{type:"text",text:t.confirmation.message||"Are you sure you want to proceed?",color:e.cfg.colorMode==="light"?"rgba(0,0,0,0.65)":"rgba(255,255,255,0.6)",fontSize:14}],actions:[{label:"Cancel",variant:"ghost",dismiss:!0},{label:"Confirm",variant:"primary",dismiss:!0}]},legacyOnConfirm:()=>{r()}});return}r()}};if(t.className){const p=((a=e.parseClassNameResponsive)==null?void 0:a.call(e,t.className,n))??e.parseClassName(t.className);if(e.renderMode!=="css-driven"){const x=Hc(t.className);x.size>0&&(p.display=Qt(x,e.containerWidth,"inline"));const m=U0(t.className);if(m.size>0){const b=Qt(m,e.containerWidth,"1rem");p.fontSize=b}}t.icon&&(p.display="inline-flex",p.alignItems="center",p.gap=6);const g=e.getCommonProps(n,p,t);return V("a",{key:n,className:t.className,...g,onClick:e.interactionDisabled?void 0:i,href:e.interactionDisabled?void 0:t.href&&!t.onClick?t.href:void 0,target:(c=t.href)!=null&&c.startsWith("http")?"_blank":void 0,rel:(h=t.href)!=null&&h.startsWith("http")?"noopener noreferrer":void 0},t.icon?e.renderIcon(t.icon,16):null,e.interpolateText(t.text||t.label||""))}const o={cursor:"pointer",textDecoration:"none",transition:"all 0.2s",display:"inline-flex",alignItems:"center",gap:6},s=e.getCommonProps(n,o,t);return V("a",{key:n,...s,onClick:e.interactionDisabled?void 0:i,href:e.interactionDisabled?void 0:t.href&&!t.onClick?t.href:void 0,target:(u=t.href)!=null&&u.startsWith("http")?"_blank":void 0,rel:(f=t.href)!=null&&f.startsWith("http")?"noopener noreferrer":void 0},t.icon?e.renderIcon(t.icon,16):null,e.interpolateText(t.text||t.label||""))}function fut(e,t,n){var x,m,b,_,S;let r=!1;if(t.activeWhen){if(t.activeWhen===e.currentSceneId)r=!0;else if(typeof t.activeWhen=="string"){const A=t.activeWhen.split("=",2);A.length===2&&(r=String(((x=e.sceneData)==null?void 0:x[A[0]])??"")===A[1])}}const i=r?{onClick:t.activeOnClick||t.onClick,onSuccess:t.activeOnSuccess||t.onSuccess,onError:t.activeOnError||t.onError,icon:t.activeIcon||t.icon,text:t.activeText||t.text,label:t.activeText||t.label}:{onClick:t.onClick,onSuccess:t.onSuccess,onError:t.onError,icon:t.icon,text:t.text,label:t.label},o=t.disabled?((m=e.evaluateCondition)==null?void 0:m.call(e,t.disabled))??!1:!1,s=A=>{const C=()=>e.handleButtonClick(i.onClick||"",{onSuccess:i.onSuccess,onError:i.onError},{optimistic:t.optimistic,feedback:t.feedback,payload:t.payload,refetchScope:t.refetchScope,mergeResponse:t.mergeResponse,anchorElement:A==null?void 0:A.currentTarget,openUrl:t.openUrl});(t.pageLoader===!1?C():e.withLoading?e.withLoading(n,C):C()).catch(E=>{var I,R;const k=((I=t.onError)==null?void 0:I.message)||(E==null?void 0:E.message)||"An error occurred";(R=e.showToast)==null||R.call(e,k,"error")})},a=A=>{var C;if((C=t.confirmation)!=null&&C.enabled){(e.setOverlayModal||e.setActiveModal)({id:"__confirm",definition:{title:t.confirmation.title||"Confirm Action",size:"sm",components:[{type:"text",text:t.confirmation.message||"Are you sure you want to proceed?",color:e.cfg.colorMode==="light"?"rgba(0,0,0,0.65)":"rgba(255,255,255,0.6)",fontSize:16}],actions:[{label:t.confirmation.cancelLabel||"Cancel",variant:"ghost",dismiss:!0},{label:t.confirmation.confirmLabel||"Confirm",variant:"primary",dismiss:!0,confirm:!0}]},legacyOnConfirm:()=>{s(A)}});return}s(A)},c=(b=e.buttonLoading)==null?void 0:b[n];if(t.className){let A=((_=e.parseClassNameResponsive)==null?void 0:_.call(e,t.className,n))??e.parseClassName(t.className);if(e.renderMode!=="css-driven"){const j=Hc(t.className);j.size>0&&(A.display=Qt(j,e.containerWidth,"inline-flex"));const N=U0(t.className);N.size>0&&(A.fontSize=Qt(N,e.containerWidth,"1rem"))}let C=t.className;if(r&&t.activeClass){const j=((S=e.parseClassNameResponsive)==null?void 0:S.call(e,t.activeClass,n))??e.parseClassName(t.activeClass);A={...A,...j},C=`${t.className} ${t.activeClass}`}const w={display:"inline-flex",alignItems:"center",justifyContent:A.textAlign==="left"?"flex-start":A.textAlign==="right"?"flex-end":"center",gap:"6px",...A,...t.color&&{color:t.color},...t.background&&{background:t.background},...t.borderRadius!==void 0&&{borderRadius:typeof t.borderRadius=="number"?`${t.borderRadius}px`:t.borderRadius},...t.borderColor&&{borderColor:t.borderColor},...c&&{opacity:.6,pointerEvents:"none"}},E={},k=(t.className||"").split(/\s+/).filter(Boolean);for(const j of k)if(j.startsWith("hover:")){const N=j.replace("hover:","");if(N.startsWith("bg-")||N.startsWith("text-")||N.startsWith("border-")){const U=e.parseClassName(N);Object.assign(E,U)}}const I=e.getCommonProps(n,w,t),R=[];i.icon&&!c&&R.push(V("span",{key:"icon",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...i.text?{marginRight:"6px"}:{}}},e.renderIcon(i.icon,t.iconSize||16))),c&&R.unshift(V("div",{key:"spinner",className:"bf-btn-spinner",style:{width:"14px",height:"14px",border:"2px solid currentColor",borderTopColor:"transparent",borderRadius:"50%",flexShrink:0}})),Array.isArray(t.children)&&t.children.length>0?t.children.forEach((j,N)=>{R.push(e.renderComponent(j,N,n))}):R.push(i.label||i.text||(i.icon?"":"Button"));const z={};return Object.keys(E).length>0&&(z.onMouseEnter=j=>{E.backgroundColor&&(j.currentTarget.style.backgroundColor=E.backgroundColor),E.color&&(j.currentTarget.style.color=E.color),E.borderColor&&(j.currentTarget.style.borderColor=E.borderColor)},z.onMouseLeave=j=>{E.backgroundColor&&(j.currentTarget.style.backgroundColor=w.backgroundColor||""),E.color&&(j.currentTarget.style.color=w.color||""),E.borderColor&&(j.currentTarget.style.borderColor=w.borderColor||"")}),V("button",{key:n,className:C,"aria-label":t.ariaLabel?e.interpolateText(t.ariaLabel):void 0,title:e.interpolateText(t.tooltip||t.ariaLabel||i.label||i.text||"Button"),...I,...z,onClick:e.interactionDisabled?void 0:a,disabled:c||o||void 0},...R)}const h=e.cfg.colors.primary,u=e.cfg.colors.accent,f={display:"inline-flex",alignItems:"center",gap:"6px",padding:"0.75rem 1.5rem",borderRadius:"0.75rem",fontWeight:600,transition:e.cfg.effects.transition,color:e.cfg.colorMode==="light"?"#ffffff":e.cfg.colors.text,background:r?e.cfg.colors.primary:`linear-gradient(to right, ${h}, ${u})`,boxShadow:r?"none":`0 10px 15px -3px ${h}40`,...c&&{opacity:.6,pointerEvents:"none"}},p=e.getCommonProps(n,f,t),g=[];return c&&g.push(V("div",{key:"spinner",className:"bf-btn-spinner",style:{width:"14px",height:"14px",border:"2px solid currentColor",borderTopColor:"transparent",borderRadius:"50%",flexShrink:0}})),i.icon&&!c&&g.push(V("span",{key:"icon",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,marginRight:"6px"}},e.renderIcon(i.icon,t.iconSize||16))),g.push(i.label||i.text||(i.icon?"":"Button")),V("button",{key:n,"aria-label":t.ariaLabel?e.interpolateText(t.ariaLabel):void 0,title:e.interpolateText(t.tooltip||t.ariaLabel||i.label||i.text||"Button"),...p,onClick:e.interactionDisabled?void 0:a,disabled:c||o||void 0},...g)}function dut({api:e,c:t,componentKey:n}){var u;const r=e.interpolateText(t.src||""),i=y.useRef(null),[o,s]=y.useState(0),a=typeof t.parallax=="number"?t.parallax:typeof t.parallaxStrength=="number"?t.parallaxStrength:32,c=t.height||t.h||260,h=t.className?((u=e.parseClassNameResponsive)==null?void 0:u.call(e,t.className,n))??e.parseClassName(t.className):{};return y.useEffect(()=>{const f=i.current;if(!f)return;const p=()=>{const g=f.getBoundingClientRect(),x=window.innerHeight||800,m=Math.min(1,Math.max(0,(x-g.top)/(x+g.height)));s((.5-m)*2*a)};return window.addEventListener("scroll",p,{capture:!0,passive:!0}),window.addEventListener("resize",p),p(),()=>{window.removeEventListener("scroll",p,{capture:!0}),window.removeEventListener("resize",p)}},[a]),t.skipEmpty&&(!r||r==="placeholder")?null:y.createElement("div",{ref:i,key:n,className:t.className,"data-component-key":n,style:{position:"relative",overflow:"hidden",...h,height:h.height||c}},y.createElement("img",{src:r,alt:t.alt||"",style:{position:"absolute",left:0,top:"-15%",width:"100%",height:"130%",objectFit:"cover",transform:`translateY(${o}px)`,willChange:"transform"},onError:()=>e.setImageErrors(f=>({...f,[n]:!0}))}))}function put(e,t,n){var h;if(t.parallax)return y.createElement(dut,{api:e,c:t,componentKey:n});const r=e.interpolateText(t.src||""),i=!r||r==="placeholder",o=e.imageErrors[n];if(t.skipEmpty&&i)return null;const s={border:`1px dashed ${e.cfg.colors.borderSubtle}`,display:"flex",alignItems:"center",justifyContent:"center",padding:10,height:"200px",borderRadius:"0.75rem"};if(i){const u=e.getCommonProps(n,s,t);return V("div",{key:n,...u},V("span",{style:{color:e.cfg.colors.textPlaceholder,fontSize:"0.875rem"}},"Image"))}if(o)return null;if(t.className){const u=((h=e.parseClassNameResponsive)==null?void 0:h.call(e,t.className,n))??e.parseClassName(t.className),f=e.getCommonProps(n,u,t),p={key:`${n}-${r}`,src:r,alt:t.alt||"",className:t.className,...f,onError:()=>e.setImageErrors(g=>({...g,[n]:!0}))};return t.onClick&&!e.interactionDisabled&&(p.onClick=()=>e.handleButtonClick(t.onClick)),V("img",p)}const a={width:t.w||t.width||"100%",height:t.h||t.height||"auto",objectFit:"cover",borderRadius:"0.75rem"};t.onClick&&(a.cursor="pointer");const c={key:`${n}-${r}`,src:r,alt:t.alt||"",...e.getCommonProps(n,a,t),onError:()=>e.setImageErrors(u=>({...u,[n]:!0}))};return t.onClick&&!e.interactionDisabled&&(c.onClick=()=>e.handleButtonClick(t.onClick)),V("img",c)}function mut(e,t,n){var o;if(t.className){const s=((o=e.parseClassNameResponsive)==null?void 0:o.call(e,t.className,n))??e.parseClassName(t.className),a=e.getCommonProps(n,s,t);return V("input",{key:n,className:t.className,...a,name:t.name,placeholder:t.placeholder,type:t.inputType||"text",...t.step!==void 0?{step:t.step}:{},...t.min!==void 0?{min:t.min}:{},...t.max!==void 0?{max:t.max}:{},...t.inputMode?{inputMode:t.inputMode}:{},value:e.sceneData[t.name||""]??"",style:{...(a==null?void 0:a.style)||{},colorScheme:e.cfg.colorMode==="light"?"light":"dark"},onClick:t.openPickerOnClick?c=>{var h,u;return(u=(h=c.currentTarget).showPicker)==null?void 0:u.call(h)}:void 0,onChange:c=>e.setSceneData(h=>({...h,[t.name||""]:c.target.value})),onKeyDown:t.onKeyDown?c=>{if(c.key==="Enter"){if(c.preventDefault(),t.payload&&typeof t.payload=="object"&&!Object.values(t.payload).some(u=>typeof u=="string"?String(e.interpolateText(u)??"").trim()!=="":!0))return;e.handleButtonClick(t.onKeyDown,void 0,{payload:t.payload})}}:void 0})}const r={width:"100%",padding:"8px 8px",borderRadius:e.cfg.components.inputRadius||void 0,backgroundColor:e.cfg.colors.surface,color:e.cfg.colors.text,border:`1px solid ${e.cfg.colorMode==="light"?e.cfg.colors.border:"transparent"}`,outline:"none",transition:e.cfg.effects.transition},i=e.getCommonProps(n,r,t);if(t.label){const s=e.getCommonProps(n,{width:"100%"},t);return V("div",{key:n,...s},V("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:500,color:e.cfg.colors.textSecondary,marginBottom:"0.75rem"}},t.label),V("input",{...i,name:t.name,placeholder:t.placeholder,type:t.inputType||"text",...t.step!==void 0?{step:t.step}:{},...t.min!==void 0?{min:t.min}:{},...t.max!==void 0?{max:t.max}:{},...t.inputMode?{inputMode:t.inputMode}:{},value:e.sceneData[t.name||""]??"",onChange:a=>e.setSceneData(c=>({...c,[t.name||""]:a.target.value}))}))}return V("input",{key:n,...i,name:t.name,placeholder:t.placeholder,type:t.inputType||"text",...t.step!==void 0?{step:t.step}:{},...t.min!==void 0?{min:t.min}:{},...t.max!==void 0?{max:t.max}:{},...t.inputMode?{inputMode:t.inputMode}:{},value:e.sceneData[t.name||""]??"",onChange:s=>e.setSceneData(a=>({...a,[t.name||""]:s.target.value}))})}function gut(e,t,n){const r=t.value?e.interpolateText(String(t.value)):e.sceneData[t.name||""]??"";return V("input",{key:n,type:"hidden",name:t.name,value:r})}function yut(e,t,n){var c;const r={backgroundColor:e.cfg.colors.surface,color:e.cfg.colors.text},i=e.cfg.colorMode==="light"?"light":"dark",o=()=>{var h;return[t.placeholder&&V("option",{key:"__placeholder",value:"",style:r},t.placeholder),...((h=t.options)==null?void 0:h.map(u=>V("option",{key:u.value,value:u.value,style:r},u.label)))||[]]};if(t.className){const h={...((c=e.parseClassNameResponsive)==null?void 0:c.call(e,t.className,n))??e.parseClassName(t.className),colorScheme:i},u=e.getCommonProps(n,h,t);return V("select",{key:n,className:t.className,...u,name:t.name,value:e.sceneData[t.name||""]??"",onChange:f=>e.setSceneData(p=>({...p,[t.name||""]:f.target.value}))},...o())}const s={width:"100%",padding:"8px 8px",borderRadius:e.cfg.components.inputRadius||void 0,backgroundColor:e.cfg.colors.surface,color:e.cfg.colors.text,border:`1px solid ${e.cfg.colorMode==="light"?e.cfg.colors.border:"transparent"}`,outline:"none",transition:e.cfg.effects.transition,cursor:"pointer",appearance:"none",colorScheme:i},a=e.getCommonProps(n,s,t);if(t.label){const h=e.getCommonProps(n,{width:"100%"},t);return V("div",{key:n,...h},V("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:500,color:e.cfg.colors.textSecondary,marginBottom:"0.75rem"}},t.label),V("select",{...a,name:t.name,value:e.sceneData[t.name||""]??"",onChange:u=>e.setSceneData(f=>({...f,[t.name||""]:u.target.value}))},...o()))}return V("select",{key:n,...a,name:t.name,value:e.sceneData[t.name||""]??"",onChange:h=>e.setSceneData(u=>({...u,[t.name||""]:h.target.value}))},...o())}function vut(e,t,n){var a;const r=t.className||"flex items-center gap-3 cursor-pointer text-white",i=e.parseClassName(r),o={...e.parseClassName("w-5 h-5 rounded shrink-0"),appearance:"auto",WebkitAppearance:"auto",accentColor:e.cfg.colors.primary,colorScheme:e.cfg.colorMode==="light"?"light":"dark",width:18,height:18,flexShrink:0,cursor:"pointer"},s=e.getCommonProps(n,i,t);return V("label",{key:n,className:r,...s},V("input",{type:"checkbox",className:"w-5 h-5 rounded shrink-0",style:o,checked:e.sceneData[t.name||""]===!0||e.sceneData[t.name||""]==="true","aria-label":t.ariaLabel||t.label,disabled:e.interactionDisabled||(t.disabled?((a=e.evaluateCondition)==null?void 0:a.call(e,t.disabled))??!0:!1),onChange:c=>{var f;const h=c.target.checked,u=async()=>{try{t.onChange&&await e.handleButtonClick(t.onChange),e.setSceneData(p=>({...p,[t.name||""]:h}))}catch(p){e.showToast(p instanceof Error?p.message:"Setting could not be saved","error")}};if(h&&((f=t.confirmation)!=null&&f.enabled)){(e.setOverlayModal||e.setActiveModal)({id:"__confirm",definition:{title:t.confirmation.title||"Confirm",size:"sm",components:[{type:"text",text:t.confirmation.message}],actions:[{label:"Cancel",variant:"ghost",dismiss:!0},{label:"Confirm",variant:"primary",dismiss:!0}]},legacyOnConfirm:()=>{u()}});return}u()}}),V("span",{},t.label||""))}function but(e,t,n){const r={green:{bg:"#065f4620",color:"#22c55e",border:"#22c55e40"},blue:{bg:"#1e40af20",color:"#3b82f6",border:"#3b82f640"},red:{bg:"#7f1d1d20",color:"#ef4444",border:"#ef444440"},yellow:{bg:"#71370220",color:"#eab308",border:"#eab30840"},purple:{bg:"#581c8720",color:"#a855f7",border:"#a855f740"},orange:{bg:"#7c2d1220",color:"#f97316",border:"#f9731640"},gray:{bg:"#37415120",color:"#9ca3af",border:"#9ca3af40"},cyan:{bg:"#0e727020",color:"#06b6d4",border:"#06b6d440"},pink:{bg:"#83184420",color:"#ec4899",border:"#ec489940"}};let o=t.colorScheme||"gray";if(t.colorBy&&typeof t.colorBy=="object"){const u=(e.interpolateText(t.text||t.label||"")||"").trim().toLowerCase();t.colorBy[u]&&(o=t.colorBy[u])}const s=r[o]||r.gray,a=t.variant||"subtle";let c={display:"inline-flex",alignItems:"center",padding:"2px 8px",borderRadius:"4px",fontSize:"11px",fontWeight:600,letterSpacing:"0.025em",textTransform:"uppercase",whiteSpace:"nowrap"};a==="solid"?(c.backgroundColor=s.color,c.color="#fff"):a==="outline"?(c.backgroundColor="transparent",c.color=s.color,c.border=`1px solid ${s.border||s.color}`):(c.backgroundColor=s.bg,c.color=s.color,t.bordered&&(c.border=`1px solid ${s.border||s.color}`)),t.pill&&(c.borderRadius="9999px"),t.className&&(c={...c,...e.parseClassName(t.className)});const h=e.getCommonProps(n,c,t);return V("span",{key:n,...h},e.interpolateText(t.text||t.label||""))}function xut(e,t,n){const r={display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"9999px",fontSize:"12px",fontWeight:500,backgroundColor:t.bg||e.cfg.colors.surfaceHover,color:t.color||e.cfg.colors.textSecondary,...t.className?e.parseClassName(t.className):{}},i=e.getCommonProps(n,r,t);return V("span",{key:n,...i},e.interpolateText(t.text||t.label||""))}function wut(e,t,n){const i={sm:32,md:40,lg:48,xl:64}[t.size||"md"]||40,o=i*.4;if(t.src){const h={width:`${i}px`,height:`${i}px`,borderRadius:"50%",objectFit:"cover",...t.className?e.parseClassName(t.className):{}},u=e.getCommonProps(n,h,t);return V("img",{key:n,src:t.src,alt:t.alt||t.label||"",...u})}const s=t.initials||(t.label||t.text||"").split(" ").map(h=>h[0]).join("").slice(0,2).toUpperCase()||"?",a={width:`${i}px`,height:`${i}px`,borderRadius:"50%",backgroundColor:t.bg||e.cfg.colors.primary,color:t.color||e.cfg.colors.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${o}px`,fontWeight:600,flexShrink:0,...t.className?e.parseClassName(t.className):{}},c=e.getCommonProps(n,a,t);return V("div",{key:n,...c},s)}function _ut(e,t,n){const r=t.progressValue??t.value??0,i=t.progressMax??100,o=(g,x)=>{if(typeof g=="string")return Number(e.interpolateText(g))||x;const m=Number(g);return Number.isFinite(m)?m:x},s=o(r,0),a=o(i,100),c=Math.min(100,Math.max(0,s/a*100)),u=s>a?e.cfg.colors.danger:t.color||e.cfg.colors.primary,f={width:"100%",display:"flex",flexDirection:"column",gap:"4px",...t.className?e.parseClassName(t.className):{}},p=e.getCommonProps(n,f,t);return V("div",{key:n,...p},(t.progressLabel||t.label)&&y.createElement("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"12px",color:e.cfg.colors.textMuted}},V("span",null,e.interpolateText(t.progressLabel||t.label||"")),V("span",null,`${s}/${a}`)),y.createElement("div",{style:{width:"100%",height:"8px",backgroundColor:e.cfg.colors.surfaceHover,borderRadius:"4px",overflow:"hidden"}},V("div",{style:{width:`${Math.min(c,100)}%`,height:"100%",backgroundColor:u,borderRadius:"4px",transition:"width 0.3s ease"}})))}function Sut(e,t,n){const r={position:"relative",width:"100%",...t.className?e.parseClassName(t.className):{}},i=e.getCommonProps(n,r,t);return V("div",{key:n,...i},V("span",{style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:e.cfg.colors.primary,fontSize:"14px",pointerEvents:"none",display:"flex",alignItems:"center"}},e.renderIcon("search",16)),V("input",{type:"text",name:t.name||"search",className:t.inputClassName,placeholder:t.placeholder||"Search...",value:e.sceneData[t.name||"search"]??"",onChange:o=>{e.setSceneData(s=>({...s,[t.name||"search"]:o.target.value}))},onKeyDown:t.onKeyDown?o=>{o.key==="Enter"&&(o.preventDefault(),e.handleButtonClick(e.interpolateText(t.onKeyDown)))}:void 0,style:{width:"100%",padding:"12px 16px 12px 40px",borderRadius:"9999px",backgroundColor:e.cfg.colorMode==="dark"?"#1f2937":"#ffffff",color:e.cfg.colorMode==="dark"?"#ffffff":e.cfg.colors.text,border:`1px solid ${e.cfg.colorMode==="dark"?"transparent":"#e5e5e5"}`,outline:"none",fontSize:e.cfg.typography.baseFontSize,transition:e.cfg.effects.transition,...t.inputClassName?e.parseClassName(t.inputClassName):{},...t.inputStyle||{}}}))}function Put(e,t,n){const r=Array.isArray(t.breadcrumbItems)?t.breadcrumbItems:[],i={display:"flex",alignItems:"center",gap:"4px",fontSize:"14px",...t.className?e.parseClassName(t.className):{}},o=e.getCommonProps(n,i,t);return V("nav",{key:n,...o,"aria-label":"Breadcrumb"},r.map((s,a)=>{const c=a===r.length-1,h=e.interpolateText(s.label);return y.createElement(y.Fragment,{key:`${n}-bc-${a}`},y.createElement(c?"span":"a",{style:{color:c?e.cfg.colors.textSecondary:e.cfg.colors.textMuted,fontWeight:c?600:400,cursor:c?"default":"pointer",textDecoration:"none",transition:e.cfg.effects.transition},...!c&&s.href?{href:s.href}:{},...!c&&s.onClick?{onClick:()=>e.handleButtonClick(s.onClick,{})}:{}},h),!c&&V("span",{style:{color:e.cfg.colors.border,margin:"0 2px"}},"/"))}))}function Aut(e,t,n){const r=Array.isArray(t.items)?t.items:[],[i,o]=y.useState(0),s=t.autoplay!==!1&&r.length>1,a=t.interval||4e3,c=t.effect==="fade"?"fade":"slide";y.useEffect(()=>{if(!s||r.length<2)return;const S=setInterval(()=>o(A=>(A+1)%r.length),a);return()=>clearInterval(S)},[s,a,r.length]);const h=S=>o((S%r.length+r.length)%r.length),u=t.showArrows!==!1&&r.length>1,f=t.showDots!==!1&&r.length>1,p={position:"relative",overflow:"hidden",...t.className?e.parseClassName(t.className):{}};t.aspectRatio&&(p.aspectRatio=t.aspectRatio),!t.aspectRatio&&!t.height&&(p.height="320px");const g=e.getCommonProps(n,p,t),x=S=>typeof S=="string"?{type:"text",text:S}:S&&S.image?{type:"image",src:S.image,alt:S.alt||"",title:S.title}:S,m=r.map((S,A)=>{const C=e.renderComponent({...x(S),key:void 0},A,`${n}-slide`),w={width:"100%",height:"100%",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"};return c==="fade"?(w.position="absolute",w.inset="0",w.opacity=A===i?1:0,w.transition="opacity .5s ease",w.pointerEvents=A===i?"auto":"none"):w.flexShrink=0,V("div",{key:`${n}-item-${A}`,style:w},C)}),b=c==="fade"?{position:"relative",width:"100%",height:"100%"}:{display:"flex",height:"100%",transition:"transform .5s ease",transform:`translateX(-${i*100}%)`},_={position:"absolute",top:"50%",transform:"translateY(-50%)",zIndex:2,width:"36px",height:"36px",borderRadius:"50%",border:"none",background:"rgba(0,0,0,0.45)",color:"#fff",fontSize:"18px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"};return V("div",{key:n,...g},V("div",{style:b},m),u&&V("div",{style:{..._,left:"8px"}},V("button",{style:{background:"transparent",border:"none",color:"inherit",fontSize:"18px",cursor:"pointer"},onClick:()=>h(i-1),"aria-label":"Previous slide"},"<")),u&&V("div",{style:{..._,right:"8px"}},V("button",{style:{background:"transparent",border:"none",color:"inherit",fontSize:"18px",cursor:"pointer"},onClick:()=>h(i+1),"aria-label":"Next slide"},">")),f&&V("div",{style:{position:"absolute",bottom:"10px",left:"50%",transform:"translateX(-50%)",display:"flex",gap:"6px",zIndex:2}},r.map((S,A)=>V("button",{key:`${n}-dot-${A}`,"aria-label":`Slide ${A+1}`,onClick:()=>h(A),style:{width:"10px",height:"10px",borderRadius:"50%",border:"none",cursor:"pointer",padding:0,background:A===i?"rgba(255,255,255,0.95)":"rgba(255,255,255,0.4)",transition:"background .3s ease"}}))))}function Eut(e,t,n){const r=Array.isArray(t.items)?t.items:[],i=t.speed||20,o={overflow:"hidden",width:"100%",...t.className?e.parseClassName(t.className):{}},s=e.getCommonProps(n,o,t),a=c=>V("div",{key:c,style:{display:"inline-flex",alignItems:"center",gap:t.gap||"24px",paddingRight:t.gap||"24px",animation:`bf-marquee ${i}s linear infinite`,willChange:"transform",flexShrink:0}},r.map((h,u)=>{const f=typeof h=="string"?{type:"text",text:h}:h&&h.image?{type:"image",src:h.image,alt:h.alt||"",height:t.itemHeight||"48px"}:h;return e.renderComponent(f,u,`${c}-${n}-marq`)}));return V("div",{key:n,...s},V("div",{style:{display:"flex",width:"max-content"}},a("a"),a("b")))}function Cut(e,t,n){const r=y.useRef(null),i=y.useRef(null),o=y.useRef(null),[s,a]=y.useState("idle"),[c,h]=y.useState(""),[u,f]=y.useState(!1),p=t.fieldName||"capture",g=t.captureMode==="qr",x=e.apiUrl||window.location.origin,m=t.uploadPath||"/api/files/upload",b=()=>{var z;(z=i.current)==null||z.getTracks().forEach(j=>j.stop()),i.current=null},_=async z=>{var W,F,q;const j=new FormData;j.append("file",z,`${p}-${Date.now()}.jpg`);const N=await fetch(new URL(m,x).toString(),{method:"POST",headers:{Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:j});if(!N.ok)throw new Error("Upload failed");const U=await N.json();return((W=U==null?void 0:U.file)==null?void 0:W.url)||((F=U==null?void 0:U.file)==null?void 0:F.publicUrl)||((q=U==null?void 0:U.file)==null?void 0:q.path)||(U==null?void 0:U.url)||(U==null?void 0:U.path)||""},S=async(z,j)=>{var N,U;if(s!=="done"){b();try{f(!0);const W=j||await _(z);e.setSceneData(F=>({...F,[p]:W})),h(W),a("done"),(N=e.showToast)==null||N.call(e,t.successMessage||(j?"Scanned!":"Captured & uploaded"),"success")}catch{a("error"),(U=e.showToast)==null||U.call(e,"Capture failed","error")}finally{f(!1)}}},A=()=>{var N;const z=r.current;if(!z||!z.videoWidth)return;const j=document.createElement("canvas");j.width=z.videoWidth,j.height=z.videoHeight,(N=j.getContext("2d"))==null||N.drawImage(z,0,0),j.toBlob(U=>U&&S(U),"image/jpeg",t.quality||.85)},C=async()=>{var z,j;try{const N=await navigator.mediaDevices.getUserMedia({video:{facingMode:t.facingMode||"user",...t.aspectRatio?{aspectRatio:Number(t.aspectRatio)}:{}},audio:!1});if(i.current=N,r.current&&(r.current.srcObject=N,await r.current.play().catch(()=>{})),a("running"),g){const W=window.BarcodeDetector;if(!W){a("error"),(z=e.showToast)==null||z.call(e,"QR scanning not supported in this browser","error");return}const F=new W;o.current=window.setInterval(async()=>{const q=r.current;if(!(!q||!q.videoWidth||s==="done"))try{const G=await F.detect(q);G!=null&&G.length&&S(new Blob,G[0].rawValue)}catch{}},400)}}catch{a("error"),(j=e.showToast)==null||j.call(e,"Camera access denied","error")}};y.useEffect(()=>(C(),()=>{o.current&&window.clearInterval(o.current),b()}),[]);const w={display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",width:"100%",...t.className?e.parseClassName(t.className):{}},E=e.getCommonProps(n,w,t),k=V("video",{key:"cam-video",ref:r,autoPlay:!0,playsInline:!0,muted:!0,style:{width:"100%",maxWidth:t.maxWidth||"480px",borderRadius:"12px",aspectRatio:t.aspectRatio||"4 / 3",objectFit:"cover",background:"#0f172a",display:g||s!=="done"?void 0:"none"}}),I=c?V("img",{key:"cam-result",src:c,alt:"captured",style:{width:"100%",maxWidth:t.maxWidth||"480px",borderRadius:"12px",aspectRatio:t.aspectRatio||"4 / 3",objectFit:"cover",background:"#0f172a"}}):null,R=V("div",{key:"cam-actions",style:{display:"flex",gap:"10px",flexWrap:"wrap",justifyContent:"center"}},s!=="done"?V("button",{key:"cam-capture",onClick:A,disabled:u||s!=="running",style:{padding:"10px 22px",borderRadius:"9999px",border:"none",cursor:u?"wait":"pointer",background:"#3B82F6",color:"#fff",fontWeight:600}},u?"Uploading...":g?t.captureLabel||"Scan QR":t.captureLabel||"Capture"):V("button",{key:"cam-retake",onClick:()=>{h(""),a("idle"),C()},style:{padding:"10px 22px",borderRadius:"9999px",border:"1px solid #94a3b8",cursor:"pointer",background:"transparent"}},"Retake"));return V("div",{key:n,...E},k,I,t.captureLabel===!1?null:R,s==="error"?V("p",{key:"cam-err",style:{color:"#EF4444",fontSize:"13px"}},"Camera unavailable — check permissions"):null)}function Tut(e,t,n){var i;if(t.className){const o=((i=e.parseClassNameResponsive)==null?void 0:i.call(e,t.className,n))??e.parseClassName(t.className),s=e.getCommonProps(n,o,t);return V("div",{key:n,className:t.className,...s})}const r=e.getCommonProps(n,{height:t.h||t.height||"24px"},t);return V("div",{key:n,...r})}function Out(e,t,n){const r=t.className||"border-gray-700 my-4",i=e.parseClassName(r),o=e.getCommonProps(n,i,t);return V("hr",{key:n,className:r,...o})}function Mut(e,t,n){var u;const r=t.loaderVariant||"spinner",i=t.rows||3,o=t.className?((u=e.parseClassNameResponsive)==null?void 0:u.call(e,t.className,n))??e.parseClassName(t.className):{};t.rawStyle&&Object.assign(o,t.rawStyle);const s=e.getCommonProps(n,o,t),a=`${e.scopeId}-${n}`,c=e.renderMode==="css-driven"?{"data-bf-r":a}:{};if(r==="skeleton"){const f=[];for(let p=0;p<i;p++){const g=t.width||(p===i-1?"60%":"100%");f.push(V("div",{key:p,className:"bf-loader-skeleton",style:{height:t.height||"16px",width:g,borderRadius:"6px",marginBottom:p<i-1?"12px":"0"}}))}return V("div",{key:n,className:t.className,style:o,...s,...c},...f)}if(r==="shimmer"){const f=[];for(let p=0;p<i;p++){const g=t.width||(p===i-1?"60%":"100%");f.push(V("div",{key:p,className:"bf-loader-shimmer",style:{height:t.height||"16px",width:g,borderRadius:"6px",marginBottom:p<i-1?"12px":"0"}}))}return V("div",{key:n,className:t.className,style:o,...s,...c},...f)}if(r==="dots"){const f=t.color||"currentColor";return V("div",{key:n,className:t.className,style:{display:"flex",alignItems:"center",gap:"6px",...o},...s,...c},[0,1,2].map(p=>V("div",{key:p,className:"bf-loader-dot",style:{width:t.size||"8px",height:t.size||"8px",borderRadius:"50%",backgroundColor:f,animationDelay:`${p*.16}s`}})))}if(r==="pulse")return V("div",{key:n,className:t.className,style:{display:"flex",alignItems:"center",justifyContent:"center",...o},...s,...c},V("div",{className:"bf-loader-pulse",style:{width:t.size||"32px",height:t.size||"32px",borderRadius:"50%",border:`3px solid ${t.color||"currentColor"}`}}));if(r==="progress")return V("div",{key:n,className:t.className,style:{width:"100%",...o},...s,...c},V("div",{style:{height:t.height||"4px",width:"100%",backgroundColor:"rgba(128,128,128,0.2)",borderRadius:"4px",overflow:"hidden"}},V("div",{className:"bf-loader-progress-bar",style:{height:"100%",width:"30%",backgroundColor:t.color||"currentColor",borderRadius:"4px"}})));const h=t.size||"24px";return V("div",{key:n,className:t.className,style:{display:"flex",alignItems:"center",justifyContent:"center",...o},...s,...c},V("div",{className:"bf-loader-spinner",style:{width:h,height:h,border:`3px solid ${t.color?t.color+"33":"rgba(128,128,128,0.2)"}`,borderTopColor:t.color||"currentColor",borderRadius:"50%"}}))}function kut(e,t,n){const r=t.rows||4;if(t.className){const s=e.parseClassName(t.className),a=e.getCommonProps(n,s,t);return V("textarea",{key:n,className:t.className,...a,name:t.name,placeholder:t.placeholder,rows:r})}const i={width:"100%",padding:"0.75rem 1rem",borderRadius:e.cfg.components.inputRadius,backgroundColor:e.cfg.colors.surface,color:e.cfg.colors.text,border:`1px solid ${e.cfg.colorMode==="light"?e.cfg.colors.border:"transparent"}`,outline:"none",transition:e.cfg.effects.transition,resize:"vertical",fontFamily:"inherit"},o=e.getCommonProps(n,i,t);if(t.label){const s=e.getCommonProps(n,{width:"100%"},t);return V("div",{key:n,...s},V("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:500,color:e.cfg.colors.textSecondary,marginBottom:"0.75rem"}},t.label),V("textarea",{...o,name:t.name,placeholder:t.placeholder,rows:r}))}return V("textarea",{key:n,...o,name:t.name,placeholder:t.placeholder,rows:r})}function $ut(e,t,n){const r=t.icon||t.name||"",i=t.size||24,o=e.renderIcon(r,i),s=t.tooltip?e.interpolateText(t.tooltip):void 0;if(t.className){const a=e.parseClassName(t.className),c=e.getCommonProps(n,a,t);return V("span",{key:n,className:t.className,title:s,...c},o)}return s?V("span",{key:n,title:s},o):y.cloneElement(o,{key:n})}function Iut(e,t,n){const r=t.metricSize||"md",i=r==="sm"?"1.25rem":r==="lg"?"2.5rem":"1.75rem",o=r==="sm"?"0.75rem":r==="lg"?"1rem":"0.875rem",s=t.color||e.cfg.colors.primary,a=t.trend==="up"?"↑":t.trend==="down"?"↓":"",c=t.trendColor||(t.trend==="up"?e.cfg.colors.success:t.trend==="down"?e.cfg.colors.danger:e.cfg.colors.textMuted),h={display:"flex",flexDirection:"column",gap:"2px",padding:t.padding!==void 0?`${t.padding}px`:"0.75rem",backgroundColor:e.cfg.colors.surface,borderRadius:e.cfg.layout.borderRadiusLg,border:`1px solid ${e.cfg.colors.borderSubtle}`,...t.className?e.parseClassName(t.className):{}},u=e.getCommonProps(n,h,t);return V("div",{key:n,...u},t.label&&V("span",{style:{fontSize:o,color:e.cfg.colors.textSecondary,fontWeight:500}},e.interpolateText(t.label)),y.createElement("div",{style:{display:"flex",alignItems:"baseline",gap:"6px",marginTop:"4px"}},t.prefix&&V("span",{style:{fontSize:i,fontWeight:700,color:s}},t.prefix),V("span",{style:{fontSize:i,fontWeight:700,color:e.cfg.colors.text}},typeof t.value=="number"?t.value.toLocaleString():e.interpolateText(String(t.value??""))),t.suffix&&V("span",{style:{fontSize:i,fontWeight:700,color:s}},t.suffix),t.delta&&V("span",{style:{fontSize:"0.75rem",fontWeight:600,color:c,marginLeft:"4px"}},`${a} ${t.delta}`)))}function Rut(e,t,n){const r=t.values??t.data??t.points;let i=[];if(Array.isArray(r))i=r.map(Number);else if(typeof r=="string"&&r.trim()){const f=r.trim();if(f.startsWith("["))try{i=JSON.parse(f).map(Number)}catch{}else i=f.split(",").map(p=>Number(String(p).trim()))}if(i=i.filter(f=>Number.isFinite(f)),i.length===0)return null;const o=t.labels??t.label;let s=[];Array.isArray(o)?s=o.map(f=>String(f)):typeof o=="string"&&o.trim()&&(s=o.split(",").map(f=>f.trim()));const a=Number(t.height)||28,c=t.color||e.cfg.colors.primary,h=Math.max(...i)||1,u=t.className||"";if(t.variant==="hbars"){const f=Number(t.barHeight)||12,p=Number(t.gap)||7,g=Math.max(1,Number(t.columns)||1);return V("div",{key:n,className:u,style:{display:g>1?"grid":"flex",flexDirection:g>1?void 0:"column",gridTemplateColumns:g>1?`repeat(${g}, minmax(0, 1fr))`:void 0,gap:p,width:"100%",...u?e.parseClassName(u):{}}},...i.map((x,m)=>V("div",{key:m,style:{display:"flex",alignItems:"center",gap:"8px",width:"100%"}},V("span",{style:{flex:"0 0 auto",minWidth:(Number(t.labelWidth)||84)+"px",fontSize:"11px",color:e.cfg.colors.textMuted,textTransform:"capitalize"}},s[m]||""),V("div",{style:{flex:"1 1 auto",height:f,background:e.cfg.colors.surfaceHover||e.cfg.colors.borderSubtle||"rgba(0,0,0,0.06)",borderRadius:"6px",overflow:"hidden"}},V("div",{style:{width:Math.max(2,Math.round(x/h*100))+"%",height:"100%",background:c,borderRadius:"6px"}})),V("span",{style:{flex:"0 0 auto",minWidth:"36px",textAlign:"right",fontSize:"11px",fontWeight:600,color:e.cfg.colors.text}},String(x)))))}if(t.variant==="line"){const p=i.map((g,x)=>{const m=i.length>1?x/(i.length-1)*100:0,b=a-g/h*a;return`${m.toFixed(2)},${b.toFixed(2)}`}).join(" ");return V("svg",{key:n,viewBox:`0 0 100 ${a}`,preserveAspectRatio:"none",className:u,style:{width:"100%",height:a,display:"block",...u?e.parseClassName(u):{}}},V("polyline",{points:p,fill:"none",stroke:c,strokeWidth:2,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round"}))}return V("div",{key:n,className:u,style:{display:"flex",alignItems:"flex-end",gap:"2px",height:a,width:"100%",...u?e.parseClassName(u):{}}},...i.map((f,p)=>V("div",{key:p,style:{flex:"1 1 0",minWidth:"2px",maxWidth:Number(t.maxBarWidth)||18,height:Math.max(2,Math.round(f/h*a)),background:c,borderRadius:"2px",opacity:t.dimZero&&f===0?.25:1}})))}function Nut(e,t,n){const r=t.chartData||t.data||[];if(!Array.isArray(r)||r.length===0)return null;const i=Number(t.height)||200,o=t.barColor||e.cfg.colors.primary,s=t.horizontal===!0,a={width:"100%",padding:t.padding!==void 0?`${t.padding}px`:"0.75rem",backgroundColor:e.cfg.colors.surface,borderRadius:e.cfg.layout.borderRadiusLg,border:`1px solid ${e.cfg.colors.borderSubtle}`,...t.className?e.parseClassName(t.className):{}},c=s?{type:"number",axisLine:!1,tickLine:!1}:{dataKey:"label",axisLine:!1,tickLine:!1,tick:{fill:e.cfg.colors.textMuted,fontSize:12}},h=s?{dataKey:"label",type:"category",axisLine:!1,tickLine:!1,width:88,tick:{fill:e.cfg.colors.textMuted,fontSize:12}}:{axisLine:!1,tickLine:!1,width:36},u=y.createElement(Mm,{width:"100%",height:i},y.createElement(tut,{data:r,layout:s?"vertical":"horizontal"},y.createElement(Qm,{vertical:!s,stroke:e.cfg.colors.borderSubtle,strokeDasharray:"3 3"}),y.createElement(Us,c),y.createElement(Hs,h),y.createElement(Zr,{cursor:{fill:t.cursorColor||e.cfg.colors.surfaceHover,fillOpacity:t.cursorOpacity??.5},content:y.createElement(C2,{prefix:t.tooltipPrefix,labelText:t.tooltipLabel,lineColor:o,backgroundColor:e.cfg.colors.surface,textColor:e.cfg.colors.text,borderColor:e.cfg.colors.borderSubtle})}),y.createElement(rl,{dataKey:"value",fill:o,radius:s?[0,4,4,0]:[4,4,0,0],isAnimationActive:t.chartAnimation!==!1,animationDuration:Number(t.animationDuration)||750})));return V("div",{key:n,style:e.getCommonProps(n,a,t)},t.title&&V("div",{style:{marginBottom:"0.75rem"}},t.title),u)}function KE(e,t,n,r=!1){const i=t.chartData||t.data||[];if(!Array.isArray(i)||i.length===0)return null;const o=Number(t.height)||240,s=Array.isArray(t.colors)&&t.colors.length?t.colors:[e.cfg.colors.primary,e.cfg.colors.accent,"#317150","#d95020","#638173"],a={width:"100%",padding:t.padding!==void 0?`${t.padding}px`:"0.75rem",backgroundColor:e.cfg.colors.surface,borderRadius:e.cfg.layout.borderRadiusLg,border:`1px solid ${e.cfg.colors.borderSubtle}`,...t.className?e.parseClassName(t.className):{}};return V("div",{key:n,style:e.getCommonProps(n,a,t)},t.title&&V("div",{style:{marginBottom:"0.75rem"}},t.title),y.createElement(Mm,{width:"100%",height:o},y.createElement(eut,null,y.createElement(Zr,{contentStyle:{borderRadius:6,border:`1px solid ${e.cfg.colors.borderSubtle}`}}),t.showLegend!==!1&&y.createElement(Ra,{iconType:"circle",wrapperStyle:{fontSize:12}}),y.createElement(Go,{data:i,dataKey:"value",nameKey:"label",cx:"50%",cy:"50%",innerRadius:r?"55%":0,outerRadius:"80%",paddingAngle:2,isAnimationActive:t.chartAnimation!==!1,animationDuration:Number(t.animationDuration)||750},...i.map((c,h)=>y.createElement(cf,{key:`${c.label||h}-${h}`,fill:c.color||s[h%s.length]}))))))}function Lut(e,t,n){const r=t.chartData||t.data||[];if(!Array.isArray(r)||r.length===0)return null;const i=Number(t.height)||260,o=t.xKey||"x",s=t.yKey||"y",a=t.zKey||"size",c={width:"100%",padding:t.padding!==void 0?`${t.padding}px`:"0.75rem",backgroundColor:e.cfg.colors.surface,borderRadius:e.cfg.layout.borderRadiusLg,border:`1px solid ${e.cfg.colors.borderSubtle}`,...t.className?e.parseClassName(t.className):{}};return V("div",{key:n,style:e.getCommonProps(n,c,t)},t.title&&V("div",{style:{marginBottom:"0.75rem"}},t.title),y.createElement(Mm,{width:"100%",height:i},y.createElement(nut,{margin:{top:16,right:12,bottom:8,left:0}},y.createElement(Qm,{stroke:e.cfg.colors.borderSubtle,strokeDasharray:"3 3"}),y.createElement(Us,{dataKey:o,type:"number",axisLine:!1,tickLine:!1}),y.createElement(Hs,{dataKey:s,type:"number",axisLine:!1,tickLine:!1}),y.createElement(mf,{dataKey:a,range:t.zRange||[50,360]}),y.createElement(Zr,{contentStyle:{borderRadius:6,border:`1px solid ${e.cfg.colors.borderSubtle}`}}),y.createElement(gf,{data:r,fill:t.color||e.cfg.colors.primary,isAnimationActive:t.chartAnimation!==!1,animationDuration:Number(t.animationDuration)||750}))))}function C2({active:e,payload:t,label:n,prefix:r,labelText:i,lineColor:o,backgroundColor:s,textColor:a,borderColor:c}){var u;const h=Number((u=t==null?void 0:t[0])==null?void 0:u.value);return!e||!Number.isFinite(h)?null:y.createElement("div",{style:{padding:10,border:`1px solid ${c}`,borderRadius:6,backgroundColor:s,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.16)",color:a}},y.createElement("p",{style:{margin:0,fontSize:14}},n),y.createElement("p",{style:{margin:"8px 0 0",color:o,fontSize:14}},`${i||"Indicative price / kg"}: ${r||""}${h.toLocaleString()}`))}function jut({api:e,c:t,data:n,height:r,lineColor:i,fillColor:o,filled:s}){return y.createElement(Mm,{width:"100%",height:r},y.createElement(rut,{data:n,margin:{top:16,right:8,left:0,bottom:0}},t.showGrid!==!1&&y.createElement(Qm,{vertical:!1,stroke:"#dce4dc",strokeDasharray:"3 3"}),y.createElement(Us,{dataKey:"label",axisLine:!1,tickLine:!1,height:30,tick:{fill:"#638173",fontSize:12}}),y.createElement(Hs,{axisLine:!1,tickLine:!1,width:40,tickCount:5,domain:[0,"auto"],tick:{fill:"#638173",fontSize:12},tickFormatter:a=>`${t.tooltipPrefix||""}${Number(a/1e3).toFixed(1).replace(".0","")}k`}),y.createElement(Zr,{cursor:{stroke:"#638173",strokeDasharray:"3 3"},content:y.createElement(C2,{prefix:t.tooltipPrefix,labelText:t.tooltipLabel,lineColor:i,backgroundColor:e.cfg.colors.surface,textColor:e.cfg.colors.text,borderColor:e.cfg.colors.borderSubtle})}),y.createElement(Vs,{type:"monotone",dataKey:"value",stroke:i,fill:s?o:"transparent",strokeWidth:3,dot:!1,activeDot:{r:6,fill:i,stroke:e.cfg.colors.surface,strokeWidth:3},isAnimationActive:t.chartAnimation!==!1,animationDuration:Number(t.animationDuration)||750})))}function Iy(e,t,n,r=!1,i=!1){const o=Array.isArray(t.chartData)?t.chartData:[];if(o.length===0)return null;const s=o.flatMap(b=>i?[b.low,b.high]:[b.value]).map(Number).filter(Number.isFinite);if(s.length===0)return null;const a=Math.min(...s),h=Math.max(...s)-a||1,u=Number(t.height)||220,f=b=>u-(b-a)/h*u,p=t.lineColor||e.cfg.colors.accent,g=t.fillColor||`${p}33`,x={width:"100%",padding:"0.75rem",backgroundColor:e.cfg.colors.surface,borderRadius:e.cfg.layout.borderRadiusLg,border:`1px solid ${e.cfg.colors.borderSubtle}`,...t.className?e.parseClassName(t.className):{}},m=i?o.map((b,_)=>{const S=Number(b.open),A=Number(b.close),C=Number(b.high),w=Number(b.low),E=A>=S;return V("div",{key:_,style:{flex:1,height:"100%",position:"relative"}},V("div",{style:{position:"absolute",left:"50%",top:`${f(C)}px`,height:`${Math.max(1,f(w)-f(C))}px`,borderLeft:`1px solid ${E?"#22c55e":"#ef4444"}`}}),V("div",{style:{position:"absolute",left:"25%",right:"25%",top:`${f(Math.max(S,A))}px`,height:`${Math.max(3,Math.abs(f(A)-f(S)))}px`,background:E?"#22c55e":"#ef4444",borderRadius:"2px"}}))}):y.createElement(jut,{api:e,c:t,data:o,height:u,lineColor:p,fillColor:g,filled:r});return V("div",{key:n,style:e.getCommonProps(n,x,t)},t.title&&V("div",{style:{color:e.cfg.colors.textSecondary,fontWeight:600,marginBottom:"0.75rem"}},t.title),V("div",{style:{display:"flex",alignItems:"stretch",gap:i?"4px":void 0,height:u}},m),i&&V("div",{style:{display:"flex",justifyContent:"space-between",color:e.cfg.colors.textMuted,fontSize:"0.7rem",marginTop:"4px"}},...o.map((b,_)=>V("span",{key:_},b.label||""))))}function Dut(e,t,n){const r=Array.isArray(t.chartData)?t.chartData[0]||{}:{},i=t.ticker||r.ticker||r.symbol||"EUR/USD",o=t.bid??r.bid??r.price,s=t.ask??r.ask,a=t.change??r.change,c=Number(a),h=Number.isFinite(c)&&c>=0,u=e.getCommonProps(n,{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem",width:"100%",padding:"0.9rem 1rem",backgroundColor:e.cfg.colors.surface,border:`1px solid ${e.cfg.colors.borderSubtle}`,borderRadius:e.cfg.layout.borderRadiusLg,...t.className?e.parseClassName(t.className):{}},t);return V("div",{key:n,...u},V("div",{},V("div",{style:{color:e.cfg.colors.text,fontWeight:700}},i),t.label&&V("div",{style:{color:e.cfg.colors.textMuted,fontSize:"0.75rem"}},t.label)),V("div",{style:{display:"flex",gap:"1rem",alignItems:"baseline",fontVariantNumeric:"tabular-nums"}},o!=null&&V("span",{style:{color:e.cfg.colors.text,fontWeight:700}},String(o)),s!=null&&V("span",{style:{color:e.cfg.colors.textSecondary}},String(s)),a!=null&&V("span",{style:{color:h?"#22c55e":"#ef4444",fontSize:"0.8rem",fontWeight:600}},`${h?"+":""}${a}`)))}function But({api:e,c:t,componentKey:n}){var b,_,S,A;const r=y.useRef(null),i=y.useRef(null),o=y.useRef(null),[s,a]=y.useState(null),c=y.useRef(null),[h,u]=y.useState(()=>Array.isArray(t.chartData)?t.chartData:[]);y.useEffect(()=>{Array.isArray(t.chartData)&&u(t.chartData)},[t.chartData]);const f=e.interpolateText(((b=t.realtime)==null?void 0:b.channel)||""),p=e.interpolateText(((_=t.timeRange)==null?void 0:_.from)||""),g=e.interpolateText(((S=t.timeRange)==null?void 0:S.to)||""),x=Array.isArray(t.timeframes)?t.timeframes:[];y.useEffect(()=>{var k,I;const C=e.sdk;if(!(((k=t.realtime)==null?void 0:k.mode)==="ws"&&e.isAuthenticated&&f&&((I=C==null?void 0:C.client)==null?void 0:I.createWebSocket)))return;const E=C.client.createWebSocket(f);return E.onmessage=R=>{var z;try{const j=typeof R.data=="string"?JSON.parse(R.data):R.data,N=(j==null?void 0:j.tick)||((z=j==null?void 0:j.data)==null?void 0:z.tick)||(j==null?void 0:j.data)||j,U=Number((N==null?void 0:N.quote)??(N==null?void 0:N.price)??(N==null?void 0:N.close));if(!Number.isFinite(U))return;const W=Number((N==null?void 0:N.epoch)??(N==null?void 0:N.timestamp)??Date.now()/1e3),F=Math.floor(W/60)*60;u(q=>{const G=q[q.length-1];if((G==null?void 0:G.time)===F)return[...q.slice(0,-1),{...G,high:Math.max(Number(G.high),U),low:Math.min(Number(G.low),U),close:U}];const et=Number((G==null?void 0:G.close)??U);return[...q.slice(-99),{time:F,open:et,high:U,low:U,close:U}]})}catch{}},()=>{var R;return(R=E.close)==null?void 0:R.call(E)}},[e.isAuthenticated,(A=t.realtime)==null?void 0:A.mode,f]);const m=y.useMemo(()=>h.map((C,w)=>{const E=C.time||C.timestamp;return{time:typeof E=="string"&&E.includes("T")?Math.floor(new Date(E).getTime()/1e3):E||`2024-01-${String(w+1).padStart(2,"0")}`,...t.chartType==="candlestick"?{open:Number(C.open),high:Number(C.high),low:Number(C.low),close:Number(C.close)}:{value:Number(C.value??C.close)}}}),[t.chartType,h]);return c.current=m[m.length-1],y.useEffect(()=>{const C=r.current;if(!C)return;const w=M5(C,{autoSize:!0,height:Number(t.height)||280,layout:{background:{color:"transparent"},textColor:e.cfg.colors.textSecondary},grid:{vertLines:{color:e.cfg.colors.borderSubtle},horzLines:{color:e.cfg.colors.borderSubtle}},rightPriceScale:{borderColor:e.cfg.colors.borderSubtle},timeScale:{borderColor:e.cfg.colors.borderSubtle,timeVisible:!0}}),E=t.chartType||"candlestick",k=E==="line"?w.addSeries(j5,{color:t.lineColor||e.cfg.colors.accent}):E==="area"?w.addSeries(H5,{lineColor:t.lineColor||e.cfg.colors.accent,topColor:t.fillColor||`${e.cfg.colors.accent}66`,bottomColor:"transparent"}):w.addSeries(Y5,{upColor:"#22c55e",downColor:"#ef4444",borderVisible:!1,wickUpColor:"#22c55e",wickDownColor:"#ef4444"});return o.current=w,i.current=k,()=>{i.current=null,o.current=null,w.remove()}},[e.cfg.colors.accent,e.cfg.colors.borderSubtle,e.cfg.colors.textSecondary,t.chartType,t.height,t.lineColor,t.fillColor]),y.useEffect(()=>{var C,w;!i.current||m.length===0||(i.current.setData(m),p&&g?(C=o.current)==null||C.timeScale().setVisibleRange({from:p,to:g}):(w=o.current)!=null&&w.timeScale().getVisibleLogicalRange()||o.current.timeScale().fitContent())},[m,p,g]),y.useEffect(()=>{if(!s||!o.current||!c.current)return;const C={"1H":3600,"4H":14400,"1D":86400,"1W":604800}[s],w=Number(c.current.time);C&&Number.isFinite(w)&&o.current.timeScale().setVisibleRange({from:w-C,to:w})},[s]),V("div",{key:n,style:{width:"100%",padding:"0.75rem",backgroundColor:e.cfg.colors.surface,borderRadius:e.cfg.layout.borderRadiusLg,border:`1px solid ${e.cfg.colors.borderSubtle}`,...t.className?e.parseClassName(t.className):{}}},x.length>0&&V("div",{style:{display:"flex",gap:"0.35rem",marginBottom:"0.5rem"}},...x.map(C=>V("button",{key:C,type:"button",onClick:()=>a(C),style:{padding:"0.3rem 0.6rem",border:`1px solid ${e.cfg.colors.borderSubtle}`,borderRadius:4,color:e.cfg.colors.text,background:s===C?e.cfg.colors.surfaceHover:"transparent",cursor:"pointer"}},C))),V("div",{ref:r,style:{width:"100%",height:Number(t.height)||280}}))}function zut(e,t,n){return y.createElement(But,{api:e,c:t,componentKey:n})}function Fut(e,t,n){const r=t.json||t.data||t.diagram||{},i=e.getCommonProps(n,{display:"flex",flexDirection:"column",minHeight:"300px"},t);return V("div",{key:n,className:t.className,...i},y.createElement("pre",{style:{fontSize:"12px",whiteSpace:"pre-wrap",margin:0}},typeof r=="string"?r:JSON.stringify(r,null,2)))}function Wut({api:e,c:t,componentKey:n}){const r=t.data||t.json||t.diagram||{},{_config:i,...o}=r||{},s=Object.keys(o).length?o:r,{nodes:a,edges:c}=y.useMemo(()=>fw.createFlowDiagram(s),[s]),[h,u]=y.useState("LR"),f=e.cfg.fullscreen===!0,p=t.height||(f?"100%":320),g=e.getCommonProps(n,{width:"100%",height:p,...f?{minHeight:0}:{}},t);return V("div",{key:n,className:t.className,...g},y.createElement(fw.FlowDiagram,{nodes:a,edges:c,config:{direction:h,layout:(i==null?void 0:i.layout)||"dagre",colorMode:(i==null?void 0:i.colorMode)||(e.cfg.colorMode==="dark"?"dark":"light"),backgroundPattern:(i==null?void 0:i.backgroundPattern)||"dot"},callbacks:{onDirectionChange:x=>u(x)},showBottomBar:(i==null?void 0:i.showBottomBar)||!1,style:{width:"100%",height:"100%"}}))}function Vut(e,t,n){return y.createElement(Wut,{api:e,c:t,componentKey:n})}function Uut(e,t,n){var r;if(t.className){const i=((r=e.parseClassNameResponsive)==null?void 0:r.call(e,t.className,n))??e.parseClassName(t.className);i.display==null&&(i.display="flex"),i.flexDirection==null&&(i.flexDirection=/(^|\s)flex(\s|$)/.test(t.className||"")||t.layout==="row"?"row":"column");const o=e.getCommonProps(n,i,t);return y.createElement("div",{key:n,className:t.className,...o},(Array.isArray(t.children)?t.children:[]).map((s,a)=>e.renderComponent(s,a,n)))}return null}const Hut=y.memo(({api:e,field:t,fieldName:n,value:r,onChange:i})=>{y.useEffect(()=>{r!==void 0&&r!==""&&i&&i(r)},[]);const o=y.useRef(null),[s,a]=y.useState(!1),c=y.useRef(null),h=y.useRef(null),[u,f]=y.useState(!1),[p,g]=y.useState(""),[x,m]=y.useState(!1),b=t.html!==!1,_=S=>b?S:S.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/\n/g,"<br>");return y.useEffect(()=>{o.current&&!o.current.innerHTML&&(o.current.innerHTML=_(r))},[]),y.useEffect(()=>{o.current&&document.activeElement!==o.current&&o.current.innerHTML!==r&&(o.current.innerHTML=_(r))},[r]),y.createElement("div",{style:{width:"100%",marginBottom:"1rem"}},t.label?V("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:500,color:e.cfg.colors.textSecondary,marginBottom:"0.75rem"}},t.label):null,y.createElement("div",{style:{border:`1px solid ${s?e.cfg.colors.primary:e.cfg.colors.border}`,borderRadius:e.cfg.components.inputRadius,overflow:"hidden",transition:"border-color 0.2s",position:"relative"}},y.createElement("div",{style:{display:"flex",gap:"4px",padding:"6px 8px",borderBottom:`1px solid ${e.cfg.colors.border}`,backgroundColor:e.cfg.colors.surface}},...[{cmd:"bold",label:"B"},{cmd:"italic",label:"I"},{cmd:"underline",label:"U"}].map(S=>V("button",{key:S.cmd,type:"button",onMouseDown:A=>{var C;A.preventDefault(),document.execCommand(S.cmd,!1),(C=o.current)==null||C.focus()},style:{padding:"2px 8px",borderRadius:"4px",border:"1px solid transparent",cursor:"pointer",backgroundColor:"transparent",color:e.cfg.colors.text,fontWeight:600,fontSize:"13px"},onMouseEnter:A=>A.target.style.borderColor=e.cfg.colors.border,onMouseLeave:A=>A.target.style.borderColor="transparent"},S.label)),V("span",{key:"spacer",style:{flex:1}}),V("button",{key:"list-btn",type:"button",onMouseDown:S=>{var A;S.preventDefault(),document.execCommand("insertUnorderedList",!1),(A=o.current)==null||A.focus()},style:{padding:"2px 8px",borderRadius:"4px",border:"1px solid transparent",cursor:"pointer",backgroundColor:"transparent",color:e.cfg.colors.text,fontSize:"13px"},onMouseEnter:S=>S.target.style.borderColor=e.cfg.colors.border,onMouseLeave:S=>S.target.style.borderColor="transparent"},"☰"),V("span",{key:"divider",style:{width:"1px",height:"16px",backgroundColor:e.cfg.colors.border,margin:"0 4px",alignSelf:"center"}}),V("button",{key:"img-btn",type:"button",onMouseDown:S=>{var A;S.preventDefault(),(A=c.current)==null||A.click()},style:{padding:"2px 6px",borderRadius:"4px",border:"1px solid transparent",cursor:"pointer",backgroundColor:"transparent",color:e.cfg.colors.text,fontSize:"13px",display:"inline-flex",alignItems:"center",justifyContent:"center"},onMouseEnter:S=>S.target.style.borderColor=e.cfg.colors.border,onMouseLeave:S=>S.target.style.borderColor="transparent"},e.renderIcon("image",14)),V("button",{key:"att-btn",type:"button",onMouseDown:S=>{var A;S.preventDefault(),(A=h.current)==null||A.click()},style:{padding:"2px 6px",borderRadius:"4px",border:"1px solid transparent",cursor:"pointer",backgroundColor:"transparent",color:e.cfg.colors.text,fontSize:"13px",display:"inline-flex",alignItems:"center",justifyContent:"center"},onMouseEnter:S=>S.target.style.borderColor=e.cfg.colors.border,onMouseLeave:S=>S.target.style.borderColor="transparent"},e.renderIcon("paperclip",14)),V("button",{key:"ai-btn",type:"button",onMouseDown:S=>{S.preventDefault(),f(!u)},style:{padding:"2px 6px",borderRadius:"4px",border:"1px solid transparent",cursor:"pointer",backgroundColor:u?e.cfg.colors.border:"transparent",color:e.cfg.colors.text,fontSize:"13px",display:"inline-flex",alignItems:"center",justifyContent:"center"},onMouseEnter:S=>S.target.style.borderColor=e.cfg.colors.border,onMouseLeave:S=>S.target.style.borderColor="transparent"},e.renderIcon("sparkles",14))),V("div",{ref:o,contentEditable:!0,suppressContentEditableWarning:!0,onInput:S=>i(S.currentTarget.innerHTML),onFocus:()=>a(!0),onBlur:()=>a(!1),style:{minHeight:(t.rows||10)*20+"px",padding:"0.75rem 1rem",backgroundColor:e.cfg.colors.surface,color:e.cfg.colors.text,outline:"none",fontSize:"0.875rem",lineHeight:"1.6"}}),t.expandAction?y.createElement("button",{type:"button",key:"expand",style:{position:"absolute",bottom:"6px",left:"6px",background:"rgba(0,0,0,0.55)",border:`1px solid ${e.cfg.colorMode==="light"?e.cfg.colors.border:"transparent"}`,borderRadius:"4px",cursor:"pointer",color:e.cfg.colors.textMuted,padding:"3px 5px",display:"flex",alignItems:"center",justifyContent:"center",opacity:.5,transition:"opacity 0.2s",zIndex:1},onMouseEnter:S=>{S.currentTarget.style.opacity="0.85"},onMouseLeave:S=>{S.currentTarget.style.opacity="0.5"},onClick:S=>{S.preventDefault(),S.stopPropagation(),e.handleButtonClick(t.expandAction,{})}},e.renderIcon("maximize-2",13)):null,V("input",{key:"img-input",ref:c,type:"file",accept:"image/*",style:{display:"none"},onChange:async S=>{var C,w,E,k,I,R;const A=(C=S.target.files)==null?void 0:C[0];if(A){try{const z=(w=e.showToast)==null?void 0:w.call(e,"Uploading image (0%)…","success",0),j=e.uploadFile?await e.uploadFile(A,t.upload,N=>{var U;return(U=z==null?void 0:z.update)==null?void 0:U.call(z,`Uploading image (${N}%)`)}):"";if((E=z==null?void 0:z.dismiss)==null||E.call(z),!j)throw Error();(k=o.current)==null||k.focus(),document.execCommand("insertImage",!1,j),i(((I=o.current)==null?void 0:I.innerHTML)||"")}catch{(R=e.showToast)==null||R.call(e,"Failed to upload image","error")}S.target.value=""}}}),V("input",{key:"att-input",ref:h,type:"file",multiple:!0,style:{display:"none"},onChange:async S=>{var k,I,R,z,j;const A=Array.from(S.target.files||[]);S.target.value="";const C=[];let w=0;const E=(k=e.showToast)==null?void 0:k.call(e,`Uploading 0/${A.length}…`,"success",0);for(const N of A){try{const U=e.uploadFile?await e.uploadFile(N,t.upload,W=>{var F;return(F=E==null?void 0:E.update)==null?void 0:F.call(E,`Uploading ${N.name} (${W}%)`)}):"";if(!U)throw Error();C.push(`<a href="${U}">${N.name}</a>`)}catch{(I=e.showToast)==null||I.call(e,`Failed to upload ${N.name}`,"error")}w++,(R=E==null?void 0:E.update)==null||R.call(E,`Uploading ${w}/${A.length}…`)}if((z=E==null?void 0:E.dismiss)==null||z.call(E),C.length>0&&o.current){o.current.focus();const N=window.getSelection();if(N){N.removeAllRanges();const U=document.createRange();U.selectNodeContents(o.current),U.collapse(!1),N.addRange(U)}document.execCommand("insertHTML",!1,`<br><br>${C.join(", ")}`),i(((j=o.current)==null?void 0:j.innerHTML)||"")}}}),u?V("div",{key:"ai-popup",style:{position:"absolute",bottom:"100%",left:"8px",right:"8px",backgroundColor:e.cfg.colors.surfaceHover,border:`1px solid ${e.cfg.colors.borderSubtle}`,borderRadius:"8px",padding:"12px",zIndex:10,boxShadow:"0 -4px 24px rgba(0,0,0,0.4)"}},V("textarea",{value:p,onChange:S=>g(S.target.value),placeholder:"Ask AI to draft a reply...",rows:3,style:{width:"100%",padding:"8px 12px",borderRadius:"4px",border:`1px solid ${e.cfg.colors.borderSubtle}`,backgroundColor:e.cfg.colors.surface,color:e.cfg.colors.text,fontSize:"13px",outline:"none",fontFamily:"inherit",resize:"none",boxSizing:"border-box"}}),V("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",marginTop:"8px"}},V("button",{type:"button",onClick:()=>{f(!1),g("")},style:{padding:"6px 14px",borderRadius:"6px",border:`1px solid ${e.cfg.colors.borderSubtle}`,cursor:"pointer",backgroundColor:"transparent",color:e.cfg.colors.textMuted,fontSize:"12px",fontFamily:"inherit"}},"Cancel"),V("button",{type:"button",disabled:x||!p.trim(),onClick:async()=>{var S,A,C,w;if(!(!p.trim()||x)){m(!0);try{const E=((S=o.current)==null?void 0:S.innerHTML)||"",k=await fetch("/api/tenant/email/ai/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:p,context:E})});if(!k.ok)throw Error();const I=await k.json(),R=I.response||I.text||I.content||"";(A=o.current)==null||A.focus(),document.execCommand("insertText",!1,R),i(((C=o.current)==null?void 0:C.innerHTML)||""),f(!1),g("")}catch{(w=e.showToast)==null||w.call(e,"AI request failed","error")}m(!1)}},style:{padding:"6px 14px",borderRadius:"6px",border:"none",cursor:x||!p.trim()?"not-allowed":"pointer",backgroundColor:x||!p.trim()?e.cfg.colors.surfaceHover:e.cfg.colors.background,color:x||!p.trim()?e.cfg.colors.textSecondary:e.cfg.colors.text,fontSize:"12px",fontWeight:600,fontFamily:"inherit"}},x?"Thinking...":"Generate"))):null))}),qut=y.memo(({api:e,c:t,componentKey:n})=>{const[r,i]=y.useState(!1),o=y.useRef(null),[s,a]=y.useState([]),c=t.name?`bf_persist_${t.name}`:null;y.useEffect(()=>{t.dataSource&&(async()=>{var f;try{const p=e.interpolateText(t.dataSource),g=(f=e.selectDynamicOptions)==null?void 0:f[p];if(g&&g.length>0){a(g);return}Cs[p]||(Cs[p]=(async()=>{var m;try{const b=await fetch(p,{headers:{Authorization:`Bearer ${localStorage.getItem("token")||""}`}});if(!b.ok)return[];const _=await b.json(),S=t.dataField||"configs",A=t.optionLabel||"label",C=t.optionValue||"value",w=_[S]||_.data||_,E=Array.isArray(w)?w.map(k=>({label:k[A]||k.name||k.label,value:k[C]||k.id||k.name||k.label})):[];return(m=e.setSelectDynamicOptions)==null||m.call(e,k=>({...k,[p]:E})),E}catch{return delete Cs[p],[]}})());const x=await Cs[p];x.length>0&&a(x)}catch{}})()},[t.dataSource]),y.useEffect(()=>{if(c&&t.name&&!e.sceneData[t.name]){const p=localStorage.getItem(c);p&&e.setSceneData(g=>({...g,[t.name]:p}))}},[c,t.name,e.sceneData[t.name]]),y.useEffect(()=>{if(!r)return;const f=g=>{o.current&&!o.current.contains(g.target)&&i(!1)},p=setTimeout(()=>{document.addEventListener("mousedown",f)},0);return()=>{clearTimeout(p),document.removeEventListener("mousedown",f)}},[r]);const h=t.variant==="selector",u=Array.isArray(t.items)?t.items:s;if(h){const f=t.name&&(e.sceneData[t.name||""]||c&&localStorage.getItem(c))||"",p=f||t.placeholder||"Select...";return V("div",{ref:o,style:{position:"relative",display:"inline-flex"}},y.createElement("button",{type:"button",style:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",cursor:"pointer",fontFamily:"inherit",fontSize:t.fontSize||"1rem",fontWeight:t.fontWeight||600,color:t.color||e.cfg.colors.text,padding:"2px 0",outline:"none",lineHeight:"1.5"},onClick:g=>{g.preventDefault(),i(!r)}},V("span",{key:"text"},p),V("span",{key:"caret",style:{display:"flex",alignItems:"center",opacity:.6,marginLeft:"2px"}},e.renderIcon("chevron-down",14))),r?y.createElement("div",{style:{position:"absolute",top:"100%",left:"0",marginTop:"4px",backgroundColor:e.cfg.colors.surfaceHover,border:`1px solid ${e.cfg.colors.borderSubtle}`,borderRadius:"8px",boxShadow:"0 8px 24px rgba(0,0,0,0.4)",zIndex:9999,overflow:"hidden",minWidth:"200px"}},...u.map((g,x)=>y.createElement("button",{key:x,type:"button",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"10px 16px",backgroundColor:"transparent",color:e.cfg.colors.text,border:"none",cursor:"pointer",fontSize:"14px",textAlign:"left",fontFamily:"inherit",transition:"background-color 0.15s ease",outline:"none",whiteSpace:"nowrap"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=e.cfg.colors.borderSubtle},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent"},onClick:m=>{m.preventDefault(),m.stopPropagation(),i(!1),t.name&&g.value!==f&&e.setSceneData(b=>({...b,[t.name]:g.value}))}},g.label||""))):null)}return y.createElement("div",{ref:o,style:{position:"relative",display:"flex",width:"100%"}},(()=>{var g;const f=!!((g=e.buttonLoading)!=null&&g[n]),p=[];return f?p.push(V("span",{key:"spinner",className:"bf-btn-spinner",style:{width:"14px",height:"14px",border:"2px solid currentColor",borderTopColor:"transparent",borderRadius:"50%",flexShrink:0}})):t.icon&&p.push(V("span",{key:"icon",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,marginRight:"6px"}},e.renderIcon(t.icon,t.iconSize||16))),p.push(V("span",{key:"text",style:{lineHeight:"1"}},t.text||"Button")),y.createElement("button",{type:"button",style:{flex:1,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"0.75rem 1.5rem",backgroundColor:e.cfg.colorMode==="light"?e.cfg.colors.primary:"transparent",color:e.cfg.colorMode==="light"?"#ffffff":e.cfg.colors.textSecondary,border:`1px solid ${e.cfg.colorMode==="light"?e.cfg.colors.border:"transparent"}`,cursor:"pointer",fontSize:"0.875rem",fontWeight:600,fontFamily:"inherit",lineHeight:"1.25rem",transition:"all 0.15s ease",outline:"none"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=e.cfg.colors.border,x.currentTarget.style.color=e.cfg.colorMode==="light"?"#111827":e.cfg.colors.text},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=e.cfg.colorMode==="light"?e.cfg.colors.primary:"transparent",x.currentTarget.style.color=e.cfg.colorMode==="light"?"#ffffff":e.cfg.colors.textSecondary},onClick:x=>{if(x.preventDefault(),u.length>0&&u[0].onClick){const m=()=>e.handleButtonClick(u[0].onClick,{onSuccess:u[0].onSuccess,onError:u[0].onError},{feedback:u[0].feedback,optimistic:u[0].optimistic,payload:u[0].payload});(e.withLoading?e.withLoading(n,m):m()).catch(()=>{})}}},...p)})(),u.length>0?y.createElement("button",{type:"button",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0.75rem 0.5rem",backgroundColor:"transparent",color:e.cfg.colors.textSecondary,border:`1px solid ${e.cfg.colorMode==="light"?e.cfg.colors.border:"transparent"}`,borderLeft:`1px solid ${e.cfg.colors.border}`,cursor:"pointer",fontFamily:"inherit",transition:"all 0.15s ease",outline:"none"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor=e.cfg.colors.border,f.currentTarget.style.color=e.cfg.colors.text},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent",f.currentTarget.style.color=e.cfg.colors.textSecondary},onClick:f=>{f.preventDefault(),f.stopPropagation(),i(!r)}},e.renderIcon("chevron-down",16)):null,r?y.createElement("div",{style:{position:"absolute",bottom:"100%",left:"0",right:"0",marginBottom:"4px",backgroundColor:e.cfg.colors.surfaceHover,border:`1px solid ${e.cfg.colors.borderSubtle}`,borderRadius:"8px",boxShadow:"0 -8px 24px rgba(0,0,0,0.4)",zIndex:9999,overflow:"hidden"}},...u.map((f,p)=>{var b;const g=`${n}-item-${p}`,x=!!((b=e.buttonLoading)!=null&&b[g]),m=[];return x?m.push(V("span",{key:"spinner",className:"bf-btn-spinner",style:{width:"12px",height:"12px",border:"2px solid currentColor",borderTopColor:"transparent",borderRadius:"50%",flexShrink:0}})):f.icon&&m.push(V("span",{key:"icon",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,marginRight:"8px"}},e.renderIcon(f.icon,14))),m.push(f.label||""),y.createElement("button",{key:p,type:"button",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"10px 16px",backgroundColor:"transparent",color:e.cfg.colors.text,border:"none",cursor:"pointer",fontSize:"14px",textAlign:"left",fontFamily:"inherit",transition:"background-color 0.15s ease",outline:"none"},onMouseEnter:_=>{_.currentTarget.style.backgroundColor=e.cfg.colors.borderSubtle},onMouseLeave:_=>{_.currentTarget.style.backgroundColor="transparent"},onClick:_=>{if(_.preventDefault(),_.stopPropagation(),!f.onClick)return;const S=f.loading==="self"?g:n;f.loading==="self"?i(!0):i(!1);const A=()=>e.handleButtonClick(f.onClick,{onSuccess:f.onSuccess,onError:f.onError},{feedback:f.feedback,optimistic:f.optimistic,payload:f.payload});(e.withLoading?e.withLoading(S,A):A()).finally(()=>{f.loading==="self"&&i(!1)}).catch(()=>{})}},...m)})):null)});function Gut(e,t,n){return y.createElement(qut,{key:n,api:e,c:t,componentKey:n})}function Zut(e,t,n){var c,h;const r=t.widgetId;if(!r)return null;const o=(e.widgets||[]).find(u=>u.id===r);if(!o||!Array.isArray(o.components))return Yp(`[renderer] widget "${r}" not found`),null;if(e.widgetStack&&e.widgetStack.includes(r))return Yp(`[renderer] circular widget reference "${r}"`),null;(c=e.widgetStack)==null||c.push(r);const s=t.props||{},a=Vb(o.components,s).map((u,f)=>e.renderComponent(u,f,`${n}-${r}`));return(h=e.widgetStack)==null||h.pop(),y.createElement(y.Fragment,null,...a)}function Vb(e,t){if(!t||Object.keys(t).length===0)return e;if(Array.isArray(e))return e.map(n=>Vb(n,t));if(e&&typeof e=="object"){const n={};for(const[r,i]of Object.entries(e))typeof i=="string"&&i.includes("{{")?n[r]=i.replace(/\{\{\s*(?:props\.)?([\w.]+)(?:\|(\w+))?\s*(?:\|\|\s*(.+?))?\s*\}\}/g,(o,s,a,c)=>{let h=t;for(const p of s.split("."))h=h==null?void 0:h[p];if(h==null)return c!==void 0?c.replace(/^["']|["']$/g,""):o;if(a==="names"||a==="join")return Array.isArray(h)?h.map(p=>p&&typeof p=="object"?p.name??p.title:p).filter(Boolean).join(", "):String(h);if(a==="money"||a==="currency"){const p=Number(h);return Number.isFinite(p)?p.toFixed(2):String(h??"")}const u=h&&typeof h=="object"&&"_seconds"in h?h._seconds*1e3:h&&typeof h=="object"&&"seconds"in h?h.seconds*1e3:h,f=a?new Date(u):null;if(a&&Number.isNaN(f==null?void 0:f.getTime()))return"";if(a==="datetime")return f.toLocaleString();if(a==="timeago"){const p=Math.floor((Date.now()-f.getTime())/6e4);if(p<1)return"just now";if(p<60)return`${p}m ago`;const g=Math.floor(p/60);return g<24?`${g}h ago`:`${Math.floor(g/24)}d ago`}return typeof h=="object"?JSON.stringify(h):String(h)}):n[r]=Vb(i,t);return e.condition&&(n.__conditionBase=t),n}return e}const T2=y.memo(({api:e,c:t,componentKey:n})=>{var j;const[r,i]=y.useState(!1),[o,s]=y.useState(""),a=y.useRef(null),c=y.useRef(null),[h,u]=y.useState(null),f=t.dataSource?String(e.interpolateText(t.dataSource)):"";y.useEffect(()=>{if(!f||!e.fetchListData)return;const N=Number(t.pageSize)||Number(t.limit)||5;e.fetchListData(f,n,0,N).catch(()=>{})},[f,n,t.pageSize,t.limit]);const p=f?((j=e.listData)==null?void 0:j[n])||[]:null,g=y.useMemo(()=>{if(p){const U=t.optionLabel||"name",W=t.optionValue||"id",F=(q,G)=>G.split(".").reduce((et,st)=>et==null?void 0:et[st],q);return p.map(q=>{if(typeof q=="string")return{label:q.replace(/^tenant_/i,"").replace(/_/g," ").replace(/\b\w/g,H=>H.toUpperCase()),value:q};const G=F(q,U),et=G!=null&&G!==""?G:(q==null?void 0:q.name)??(q==null?void 0:q.title)??(q==null?void 0:q.label)??(q==null?void 0:q.email)??F(q,W)??"";return{label:String(et),value:String(F(q,W)??(q==null?void 0:q.id)??(q==null?void 0:q.value)??"")}})}return(Array.isArray(t.options)?t.options:[]).map(U=>typeof U=="string"?{label:U,value:U}:{label:U.label??U.value,value:U.value??U.label})},[t.options,p,t.optionLabel,t.optionValue]),x=t.multiple===!0||t.multiple==="true",m=e.sceneData[t.name||""],b=t.defaultFirst===!0||t.defaultFirst==="true";y.useEffect(()=>{if(!b||x)return;const N=t.name||"";if(!N)return;const U=e.sceneData[N];(U==null||U==="")&&g.length&&e.setSceneData(W=>({...W,[N]:g[0].value}))},[b,x,t.name,g.length]);const _=x?Array.isArray(m)?m.map(N=>String(N)):String(m??"").split(",").map(N=>N.trim()).filter(Boolean):[],S=e.sceneData[t.name||""]??"",A=g.find(N=>N.value===S),C=N=>x?_.includes(N):N===S,w=x?_.length?_.map(N=>{var U;return((U=g.find(W=>W.value===N))==null?void 0:U.label)||N}).join(", "):t.placeholder||"Select...":A?A.label:S||t.placeholder||"Select...",E=t.className?e.parseClassName(t.className):{},k=y.useMemo(()=>{if(!o)return g;const N=o.toLowerCase();return g.filter(U=>U.label.toLowerCase().includes(N))},[g,o]),I=t.custom&&o&&!g.find(N=>N.value===o||N.label===o);y.useEffect(()=>{if(!r){s(""),u(null);return}const N=()=>{const U=a.current;if(!U)return;const W=U.getBoundingClientRect(),F=window.innerHeight||0,q=8,G=F-W.bottom-q,et=W.top-q,st=G<200&&et>G;u({left:W.left,width:W.width,...st?{bottom:Math.round(F-W.top+4)}:{top:Math.round(W.bottom+4)},maxHeight:Math.max(120,Math.min(260,st?et:G))})};return N(),window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),()=>{window.removeEventListener("resize",N),window.removeEventListener("scroll",N,!0)}},[r]),y.useEffect(()=>{if(!r){s("");return}const N=U=>{var F,q;const W=U.target;(F=a.current)!=null&&F.contains(W)||(q=c.current)!=null&&q.contains(W)||i(!1)};return setTimeout(()=>document.addEventListener("mousedown",N),0),()=>document.removeEventListener("mousedown",N)},[r]);const R=N=>{e.setSceneData(U=>({...U,[t.name||""]:N})),i(!1)},z=N=>{if(!x){R(N);return}const U=_.includes(N)?_.filter(W=>W!==N):[..._,N];e.setSceneData(W=>({...W,[t.name||""]:U.join(", ")}))};return V("div",{key:n,ref:a,style:{position:"relative",width:"100%",...E}},t.label&&V("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:500,color:e.cfg.colors.textSecondary,marginBottom:"0.75rem"}},t.label),V("button",{style:{width:"100%",minWidth:0,display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderRadius:"9999px",border:"1px solid",borderColor:e.cfg.colorMode==="dark"?"#374151":e.cfg.colors.border,background:e.cfg.colorMode==="dark"?"#1f2937":"#ffffff",color:e.cfg.colorMode==="dark"?"#ffffff":e.cfg.colors.text,cursor:"pointer",fontSize:"14px",textAlign:"left",gap:"8px",...t.triggerClassName?e.parseClassName(t.triggerClassName):{}},onClick:()=>i(!r)},V("span",{style:{minWidth:0,flex:"1 1 auto",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},w),V("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{flexShrink:0}},V("path",{d:"m6 9 6 6 6-6"}))),r&&h&&Za.createPortal(V("div",{ref:c,style:{position:"fixed",left:h.left,width:h.width,...h.top!==void 0?{top:h.top}:{bottom:h.bottom},zIndex:2e3,borderRadius:"16px",border:"1px solid",borderColor:e.cfg.colorMode==="dark"?"#374151":e.cfg.colors.border,background:e.cfg.colorMode==="dark"?"#1f2937":"#ffffff",overflow:"hidden",maxHeight:h.maxHeight,display:"flex",flexDirection:"column"}},t.searchable!==!1&&V("input",{style:{width:"100%",padding:"8px",border:"none",borderBottom:"1px solid",borderColor:e.cfg.colors.borderSubtle,background:"transparent",color:e.cfg.colors.text,outline:"none",fontSize:"13px"},placeholder:"Search...",value:o,onChange:N=>{s(N.target.value),N.stopPropagation()},onClick:N=>N.stopPropagation()}),V("div",{style:{overflow:"auto",flex:1}},k.map(N=>V("button",{key:N.value,style:{width:"100%",display:"block",textAlign:"left",padding:"8px",border:"none",background:C(N.value)?"rgba(149,57,5,0.12)":"transparent",color:C(N.value)?e.cfg.colors.primary:e.cfg.colors.text,cursor:"pointer",fontSize:"14px"},onMouseEnter:U=>{U.currentTarget.style.background=e.cfg.colors.surfaceHover},onMouseLeave:U=>{U.currentTarget.style.background=C(N.value)?"rgba(149,57,5,0.12)":"transparent"},onClick:()=>z(N.value)},(C(N.value)?"✓ ":"")+N.label)),I&&V("button",{style:{width:"100%",display:"block",textAlign:"left",padding:"8px",border:"none",borderTop:"1px solid",borderColor:e.cfg.colors.borderSubtle,background:"transparent",color:e.cfg.colors.primary,cursor:"pointer",fontSize:"13px",fontStyle:"italic"},onClick:()=>z(o)},`+ Add "${o}"`))),document.body))});function Yut(e,t,n){return y.createElement(T2,{api:e,c:t,componentKey:n})}const Cs={},Kut=y.memo(({api:e,field:t,fieldName:n,fieldKey:r,fieldStyle:i,fieldWrapperStyle:o})=>{const[s,a]=y.useState([]);y.useEffect(()=>{t.dataSource&&(async()=>{var u;try{const f=e.interpolateText(t.dataSource),p=(u=e.selectDynamicOptions)==null?void 0:u[f];if(p&&p.length>0){a(p);return}Cs[f]||(Cs[f]=(async()=>{var x;try{const m=await fetch(f,{headers:{Authorization:`Bearer ${localStorage.getItem("token")||""}`}});if(!m.ok)return[];const b=await m.json(),_=t.dataField||"configs",S=t.optionLabel||"label",A=t.optionValue||"value",C=b[_]||b.data||b,w=Array.isArray(C)?C.map(E=>({label:E[S]||E.name||E.label,value:E[A]||E.id||E.name||E.label})):[];return(x=e.setSelectDynamicOptions)==null||x.call(e,E=>({...E,[f]:w})),w}catch{return delete Cs[f],[]}})());const g=await Cs[f];g.length>0&&a(g)}catch{}})()},[t.dataSource]);const c=s.length>0?s:Array.isArray(t.options)?t.options:[],h=t.placeholder||t.label||"Select...";return y.createElement("div",{key:r,style:o||{width:"100%"}},t.label?V("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:500,color:e.cfg.colors.textSecondary,marginBottom:"0.75rem"}},t.label):null,V("select",{name:n,value:e.sceneData[n]??"",required:t.required,className:t.className,style:{...i,fontSize:"0.875rem"},size:"md",onChange:u=>e.setSceneData(f=>({...f,[n]:u.target.value}))},V("option",{key:"__placeholder",value:"",disabled:!0,hidden:!0},h),c.map((u,f)=>V("option",{key:f,value:typeof u=="string"?u:u.value},typeof u=="string"?u:u.label))))});function Xut(e,t,n){var c;const r=t.className||"",i=((c=e.parseClassNameResponsive)==null?void 0:c.call(e,r,n))??e.parseClassName(r),o=e.getCommonProps(n,i,t),s=Array.isArray(t.fields)?t.fields:[],a=t.submitButton;return t.collection&&e.fetchEntitySchema?y.createElement(Jut,{api:e,c:t,componentKey:n,formClassName:r,parsedStyle:i,formProps:o,fields:s,submitBtn:a}):O2(e,t,n,r,i,o,s,a)}function Jut({api:e,c:t,componentKey:n,formClassName:r,parsedStyle:i,formProps:o,fields:s,submitBtn:a}){const[c,h]=y.useState(s),[u,f]=y.useState(!0);return y.useEffect(()=>{if(!e.fetchEntitySchema){f(!1);return}e.fetchEntitySchema(t.collection).then(p=>{if(!Array.isArray(p==null?void 0:p.fields)){f(!1);return}const g=new Map(p.fields.map(m=>[m.name,m])),x=s.map(m=>{var _;const b=g.get(m.name||((_=m.label)==null?void 0:_.toLowerCase()));return b?{...m,required:m.required??b.required,validation:m.validation??(b.validation?{...b.validation}:void 0),placeholder:m.placeholder??b.placeholder}:m});h(x),f(!1)}).catch(()=>f(!1))},[t.collection]),u?V("div",{key:n,style:{padding:"1rem",textAlign:"center",color:e.cfg.colors.textMuted,fontSize:"0.8rem"}},"Loading fields..."):O2(e,t,n,r,i,o,c,a)}const Qut=y.memo(function({name:t,value:n,onChange:r,placeholder:i,required:o,inputType:s,label:a,fieldStyle:c,onKeyDown:h,openPickerOnClick:u}){y.useEffect(()=>{n!==void 0&&n!==""&&r&&r(n)},[]);const f=y.useRef(r);f.current=r;const p=y.useRef(c);p.current=c;const g=y.useCallback(m=>{f.current(m.target.value)},[]),x=y.createElement("input",{name:t,placeholder:i,required:o,type:s||"text",value:n??"",onChange:g,onClick:u?m=>{var b,_;return(_=(b=m.currentTarget).showPicker)==null?void 0:_.call(b)}:void 0,onKeyDown:h?m=>{m.key==="Enter"&&h()}:void 0,style:p.current});return a?y.createElement("div",{style:{width:"100%",marginBottom:"1rem"}},y.createElement("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:500,color:c.color,marginBottom:"0.75rem"}},a),x):x}),tht=y.memo(function({api:t,field:n,fieldName:r,label:i,fieldStyle:o}){const s=y.useRef(null),[a,c]=y.useState(!1),h=t.sceneData[r]||"",u=t.sceneData[r+"_name"]||"",f=/^data:image\//i.test(h)||/\.(png|jpe?g|gif|webp|svg|avif)(\?|#|$)/i.test(h)||/\/[^/]+\/image(\?|#|$)/i.test(h),p=async g=>{var m,b,_,S;const x=(m=g.target.files)==null?void 0:m[0];if(g.target.value="",!!x){c(!0);try{const A=(b=t.showToast)==null?void 0:b.call(t,"Uploading…","success",0),C=t.uploadFile?await t.uploadFile(x,n.upload,w=>{var E;return(E=A==null?void 0:A.update)==null?void 0:E.call(A,`Uploading ${x.name} (${w}%)`)}):"";if((_=A==null?void 0:A.dismiss)==null||_.call(A),!C)throw new Error;t.setSceneData(w=>({...w,[r]:C,[r+"_name"]:x.name})),n.refetchScope&&t.refetchScope&&t.refetchScope(n.refetchScope)}catch{(S=t.showToast)==null||S.call(t,"Upload failed","error")}finally{c(!1)}}};return y.createElement("div",{style:{width:"100%"}},i&&V("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:500,color:t.cfg.colors.textSecondary,marginBottom:"0.75rem"}},i),h?y.createElement("div",{style:{...o,display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"}},V("div",{style:{display:"flex",alignItems:"center",gap:"10px",minWidth:0}},f?V("img",{src:h,alt:"",style:{width:"40px",height:"40px",objectFit:"cover",borderRadius:"8px",flexShrink:0}}):V("span",{style:{display:"flex",alignItems:"center",flexShrink:0}},t.renderIcon("paperclip",16)),V("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},u||"Uploaded file")),V("button",{type:"button","aria-label":"Remove",title:"Remove",style:{background:"none",border:"none",cursor:"pointer",color:t.cfg.colors.danger,display:"flex",alignItems:"center",flexShrink:0,padding:"4px"},onClick:()=>t.setSceneData(g=>{const x={...g};return delete x[r],delete x[r+"_name"],x})},t.renderIcon("trash-2",16))):y.createElement("button",{type:"button",onClick:()=>{var g;return(g=s.current)==null?void 0:g.click()},style:{...o,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",cursor:"pointer",color:t.cfg.colors.textMuted,fontSize:"14px"}},a?"Uploading…":"⬆ Upload file"),V("input",{key:"file-input",ref:s,type:"file",accept:n.accept||".pdf,.docx,.txt,.md,.csv,.json",style:{display:"none"},onChange:p}))}),eht=y.memo(function({api:t,c:n,componentKey:r}){const i=n.name||"image",o=t.sceneData[i]||"",[s,a]=y.useState(!1),c=y.useRef(null),h=y.useRef(null),[u,f]=y.useState(""),[p,g]=y.useState(null),x=`${r}-images`,m=n.dataSource||"/admin/assets?entityType=media";y.useEffect(()=>{!s||!t.fetchListData||t.fetchListData(m,x,0,Number(n.pageSize)||100).catch(()=>{})},[s,m,x]),y.useEffect(()=>{if(!s){g(null),f("");return}const R=()=>{const z=c.current;if(!z)return;const j=z.getBoundingClientRect(),N=window.innerHeight||0,U=N-j.bottom-8,W=j.top-8,F=U<300&&W>U;g({left:j.left,width:j.width,...F?{bottom:Math.round(N-j.top+6)}:{top:Math.round(j.bottom+6)}})};return R(),window.addEventListener("resize",R),window.addEventListener("scroll",R,!0),()=>{window.removeEventListener("resize",R),window.removeEventListener("scroll",R,!0)}},[s]),y.useEffect(()=>{if(!s)return;const R=j=>{var U,W;const N=j.target;(U=c.current)!=null&&U.contains(N)||(W=h.current)!=null&&W.contains(N)||a(!1)},z=setTimeout(()=>document.addEventListener("mousedown",R),0);return()=>{clearTimeout(z),document.removeEventListener("mousedown",R)}},[s]);const b=R=>{if(!R)return"";if(typeof R=="object")return R.url||R.asset_url||"";const z=String(R);if(/^https?:\/\//i.test(z)||z.startsWith("/"))return z;const j=S.find(N=>String((N==null?void 0:N.asset_id)||(N==null?void 0:N.id))===z||String(N==null?void 0:N.id)===z);return j&&(j.url||j.asset_url)||""},_=R=>b(R),S=t.listData&&t.listData[x]||[],A=u.trim().toLowerCase(),C=A?S.filter(R=>String((R==null?void 0:R.label)||(R==null?void 0:R.path)||(R==null?void 0:R.id)||"").toLowerCase().includes(A)):S,w=R=>{const z=R.asset_id||R.id;t.setSceneData(j=>({...j,[i]:z,[`${i}_label`]:R.label||""})),a(!1)},E=()=>t.setSceneData(R=>{const z={...R};return delete z[i],delete z[`${i}_label`],z}),k=b(o),I={width:"40px",height:"40px",aspectRatio:"1 / 1",objectFit:"cover",borderRadius:"8px",flexShrink:0,display:"block"};return V("div",{key:r,ref:c,style:{position:"relative",width:"100%",display:"flex",alignItems:"center",gap:"8px"}},V("button",{type:"button","aria-label":t.interpolateText(n.ariaLabel||n.placeholder||"Select image"),onClick:()=>a(!s),style:{flex:"1 1 auto",minWidth:0,display:"flex",alignItems:"center",gap:"10px",padding:"10px 12px",borderRadius:"12px",border:"1px solid",borderColor:t.cfg.colorMode==="dark"?"#374151":t.cfg.colors.border,background:t.cfg.colorMode==="dark"?"#1f2937":"#ffffff",color:t.cfg.colors.text,cursor:"pointer",fontSize:"14px"}},k?V("img",{src:k,alt:"",style:I}):null,V("span",{style:{flex:"1 1 auto",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"left"}},o?t.sceneData[`${i}_label`]||"Selected image":n.placeholder||"Select image…"),t.renderIcon("chevron-down",14)),o?V("button",{type:"button","aria-label":"Remove",title:"Remove",onClick:E,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"40px",height:"40px",flexShrink:0,borderRadius:"12px",border:"none",background:"transparent",color:t.cfg.colors.danger,cursor:"pointer"}},t.renderIcon("trash-2",16)):null,s&&p?Za.createPortal(V("div",{ref:h,style:{position:"fixed",left:p.left,width:p.width,...p.top!==void 0?{top:p.top}:{bottom:p.bottom},zIndex:2e3,borderRadius:"16px",border:"1px solid",borderColor:t.cfg.colorMode==="dark"?"#374151":t.cfg.colors.border,background:t.cfg.colorMode==="dark"?"#1f2937":"#ffffff",maxHeight:"320px",display:"flex",flexDirection:"column",overflow:"hidden"}},V("input",{placeholder:"Search images...",value:u,onChange:R=>f(R.target.value),onClick:R=>R.stopPropagation(),style:{width:"100%",padding:"8px",border:"none",borderBottom:"1px solid",borderColor:t.cfg.colors.borderSubtle,background:"transparent",color:t.cfg.colors.text,outline:"none",fontSize:"13px"}}),V("div",{style:{overflow:"auto",padding:"8px",display:"flex",flexWrap:"wrap",gap:"8px",alignContent:"flex-start"}},C.length?C.map(R=>V("div",{key:R.id,role:"button",tabIndex:0,title:R.label||R.id,onClick:()=>w(R),style:{width:"112px",height:"112px",flex:"0 0 auto",padding:0,border:String(R.id)===String(o)?`2px solid ${t.cfg.colors.primary}`:"1px solid transparent",background:"transparent",borderRadius:"12px",cursor:"pointer",overflow:"hidden"}},V("img",{src:_(R),alt:R.label||"",style:{width:"100%",height:"100%",objectFit:"cover",display:"block",background:t.cfg.colorMode==="dark"?"#374151":"#f5f5f5"}}))):V("div",{style:{gridColumn:"1 / -1",padding:"12px",color:t.cfg.colors.textMuted,fontSize:"13px"}},"No images found"))),document.body):null)}),nht=y.memo(function({api:t,c:n,componentKey:r}){const i=y.useRef(null),[o,s]=y.useState(!1),a=n.className?t.parseClassName(n.className):{},c=o?n.uploadingText||"Uploading…":t.interpolateText(n.text||n.label||"Upload"),h=async u=>{var p,g,x;const f=u.target.files?Array.from(u.target.files):[];if(u.target.value="",f.length!==0){s(!0);try{const m=[];for(const S of f){const A=await((p=t.uploadFile)==null?void 0:p.call(t,S,n.upload||{},void 0));A&&m.push(A)}if(m.length===0)throw new Error("upload failed");const b=n.dataKey||n.name||"uploadedAsset",_=n.multiple?m:m[m.length-1];t.setSceneData(S=>({...S,[b]:_,[b+"_name"]:f.map(A=>A.name).join(", ")})),n.refetchScope&&typeof t.refetchScope=="function"&&t.refetchScope(n.refetchScope),(g=t.showToast)==null||g.call(t,n.successMessage||(n.multiple?`${m.length} uploaded`:"Uploaded"),"success")}catch{(x=t.showToast)==null||x.call(t,n.errorMessage||"Upload failed","error")}finally{s(!1)}}};return V("div",{key:r,style:{display:"inline-flex",...n.wrapperStyle||{}}},y.createElement("button",{type:"button",className:n.className,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"8px",cursor:o?"wait":"pointer",border:"none",fontFamily:"inherit",...a},disabled:o||t.interactionDisabled||void 0,"aria-label":t.interpolateText(n.ariaLabel||c),onClick:()=>{var u;return(u=i.current)==null?void 0:u.click()}},n.icon?t.renderIcon(n.icon,n.iconSize||16):null,V("span",null,c)),y.createElement("input",{key:"upload-input",ref:i,type:"file",accept:n.accept||"image/*",multiple:!!n.multiple,style:{display:"none"},onChange:h}))}),rht=y.memo(function({name:t,value:n,onChange:r,placeholder:i,required:o,options:s,label:a,fieldStyle:c}){y.useEffect(()=>{n!==void 0&&n!==""&&r&&r(n)},[]);const h=y.useRef(r);h.current=r;const u=y.useRef(c);u.current=c;const f=y.useCallback(g=>{h.current(g.target.value)},[]),p=y.createElement("select",{name:t,required:o,value:n??"",onChange:f,style:{...u.current,cursor:"pointer",appearance:"none"}},i?y.createElement("option",{key:"__placeholder",value:""},i):null,...s.map((g,x)=>y.createElement("option",{key:x,value:typeof g=="string"?g:g.value},typeof g=="string"?g:g.label)));return a?y.createElement("div",{style:{width:"100%",marginBottom:"1rem"}},y.createElement("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:500,marginBottom:"0.75rem"}},a),p):p}),iht=y.memo(function({name:t,value:n,onChange:r,placeholder:i,required:o,rows:s,label:a,fieldStyle:c}){y.useEffect(()=>{n!==void 0&&n!==""&&r&&r(n)},[]);const h=y.useRef(r);h.current=r;const u=y.useRef(c);u.current=c;const f=y.useCallback(g=>{h.current(g.target.value)},[]),p=y.createElement("textarea",{name:t,placeholder:i,required:o,rows:s||4,value:n??"",onChange:f,style:{...u.current,resize:"vertical",fontFamily:"inherit"}});return a?y.createElement("div",{style:{width:"100%",marginBottom:"1rem"}},y.createElement("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:500,marginBottom:"0.75rem"}},a),p):p}),oht=y.memo(function({api:t,field:n,fieldName:r}){const i=Array.isArray(n.fields)?n.fields:[],o=m=>{let b=[];if(Array.isArray(m))b=m;else if(typeof m=="string"&&m)try{const _=JSON.parse(m);b=Array.isArray(_)?_:_&&Array.isArray(_.rules)?_.rules:[]}catch{}else m&&typeof m=="object"&&(b=Array.isArray(m.rules)?m.rules:[]);return b.map(_=>{if(!_||typeof _!="object")return null;const S={};let A=!1;for(const C of i)_[C.name]!==void 0&&(S[C.name]=_[C.name],A=!0);if(!A&&i.some(C=>C.name==="metric"))if(_.metric!==void 0||_.op!==void 0||_.value!==void 0)S.metric=_.metric==null?"":String(_.metric),S.op=_.op==null||_.op===""?"gte":String(_.op),S.value=_.value==null?"":_.value,A=!0;else{const C=/^min_(.+)$/.exec(String(_.type||""));C&&(S.metric=C[1],S.op="gte",S.value=_.value==null?"":_.value,A=!0)}return A?S:null}).filter(Boolean)},[s,a]=y.useState(()=>o(t.sceneData[r])),c=t.sceneData[r];y.useEffect(()=>{a(o(c))},[c]);const h=m=>{a(m),t.setSceneData(b=>({...b,[r]:JSON.stringify(m)}))},u=i.filter(m=>m.type==="select"&&m.dataSource),f=u.map(m=>`${r}:${m.dataSource}`).join("|");y.useEffect(()=>{t.fetchListData&&u.forEach(m=>{t.fetchListData(t.interpolateText(String(m.dataSource)),`${r}-ds-${m.name}`,0,Number(m.limit)||300).catch(()=>{})})},[f,r]);const p=m=>{if(!m.dataSource)return Array.isArray(m.options)?m.options:[];const b=t.listData&&t.listData[`${r}-ds-${m.name}`]||[],_=m.optionLabel||"name",S=m.optionValue||"name",A=(C,w)=>String(w).split(".").reduce((E,k)=>E==null?E:E[k],C);return b.map(C=>({label:String(A(C,_)??C.name??C.id??""),value:String(A(C,S)??C.name??C.id??"")}))},g=()=>{const m={};return i.forEach(b=>{m[b.name]=b.default!==void 0?b.default:""}),m},x={flex:1,minWidth:0,padding:"8px 10px",borderRadius:"10px",border:`1px solid ${t.cfg.colors.border}`,background:t.cfg.colors.surface,color:t.cfg.colors.text,outline:"none",fontSize:"14px",colorScheme:t.cfg.colorMode==="light"?"light":"dark"};return V("div",{style:{width:"100%",marginBottom:"1rem"}},n.label?V("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:500,color:t.cfg.colors.textSecondary,marginBottom:"0.5rem"}},n.label):null,...s.map((m,b)=>V("div",{key:`${r}-row-${b}`,style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",marginBottom:"8px"}},...i.map(_=>{const S=`${r}-${b}-${_.name}`;return _.type==="select"?y.createElement("select",{key:S,value:m[_.name]??"",onChange:A=>h(s.map((C,w)=>w===b?{...C,[_.name]:A.target.value}:C)),style:{...x,flex:_.flex||1}},y.createElement("option",{value:"",key:"__blank"},_.placeholder||_.label||"Select…"),...p(_).map((A,C)=>y.createElement("option",{value:A.value??A.label,key:C},A.label??A.value))):y.createElement("input",{key:S,type:_.type==="number"?"number":"text",value:m[_.name]??"",placeholder:_.placeholder||_.label||"",min:_.min,step:_.step,onChange:A=>h(s.map((C,w)=>w===b?{...C,[_.name]:A.target.value}:C)),style:{...x,flex:_.flex||1}})}),V("button",{key:`${r}-rm-${b}`,type:"button","aria-label":"Remove",title:"Remove",onClick:()=>h(s.filter((_,S)=>S!==b)),style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",width:36,height:36,borderRadius:10,border:"none",cursor:"pointer",background:"transparent",color:t.cfg.colors.danger}},t.renderIcon("trash-2",16)))),V("button",{type:"button",onClick:()=>h([...s,g()]),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 12px",borderRadius:10,border:`1px dashed ${t.cfg.colors.borderSubtle}`,background:"transparent",color:t.cfg.colors.textSecondary,cursor:"pointer",fontSize:"14px",fontWeight:500}},t.renderIcon("plus",16),n.addLabel||"Add"))});function O2(e,t,n,r,i,o,s,a){var g,x;const c=[],h=Math.max(1,Math.floor(Number(t.columns)||1)),u=typeof window>"u"?1/0:window.innerWidth,p=Math.min(e.containerWidth||1/0,u)<640?1:h;if(s.forEach((m,b)=>{var k,I;const _=`${n}-field-${b}`,S=m.name||((k=m.label)==null?void 0:k.toLowerCase())||"",A=m.className?((I=e.parseClassNameResponsive)==null?void 0:I.call(e,m.className,_))??e.parseClassName(m.className):{},C={width:"100%",padding:"8px 8px",borderRadius:e.cfg.components.inputRadius||void 0,backgroundColor:m.borderless?m.backgroundColor||"transparent":e.cfg.colors.surface,color:m.textColor||e.cfg.colors.text,colorScheme:e.cfg.colorMode==="light"?"light":"dark",border:m.borderless?"none":`1px solid ${e.cfg.colors.border}`,outline:"none",transition:e.cfg.effects.transition,...A},w={width:"100%",marginBottom:"1rem"},E=R=>R.value?e.interpolateText(String(R.value)):"";if(m.type==="richtext")c.push(y.createElement(Hut,{key:_,api:e,field:m,fieldName:S,value:e.sceneData[S]??E(m),onChange:R=>e.setSceneData(z=>({...z,[S]:R}))}));else if(m.type==="textarea"){const R=m.rows||4;c.push(y.createElement(iht,{key:_,name:S,value:e.sceneData[S]??E(m),onChange:z=>e.setSceneData(j=>({...j,[S]:z})),placeholder:m.placeholder||m.label,required:m.required,rows:R,label:m.label,fieldStyle:C}))}else if(m.type==="select")if(m.dataSource)c.push(y.createElement(Kut,{key:_,api:e,field:m,fieldName:S,fieldKey:_,fieldStyle:C,fieldWrapperStyle:w}));else{const R=Array.isArray(m.options)?m.options:[];c.push(y.createElement(rht,{key:_,name:S,value:e.sceneData[S]??E(m),onChange:z=>e.setSceneData(j=>({...j,[S]:z})),placeholder:m.placeholder||m.label||"Select...",required:m.required,options:R,label:m.label,fieldStyle:C}))}else if(m.type==="advanced-select")c.push(y.createElement("div",{key:`${_}-wrap`,style:w},y.createElement(T2,{key:_,api:e,c:{...m,name:S,options:m.options},componentKey:_})));else if(m.type==="file")c.push(y.createElement("div",{key:`${_}-wrap`,style:w},y.createElement(tht,{key:_,api:e,field:m,fieldName:S,label:m.label,fieldStyle:C})));else if(m.type==="repeater")c.push(y.createElement(oht,{key:_,api:e,field:m,fieldName:S}));else if(m.tags)c.push(y.createElement(sht,{key:_,api:e,field:m,value:e.sceneData[S]??E(m),onChange:R=>e.setSceneData(z=>({...z,[S]:R}))}));else{const R=m.type==="email"?"email":m.type==="password"?"password":m.type==="number"?"number":m.type==="date"?"date":m.type==="datetime-local"?"datetime-local":"text";c.push(y.createElement(Qut,{key:_,name:S,value:e.sceneData[S]??E(m),onChange:z=>e.setSceneData(j=>({...j,[S]:z})),placeholder:m.placeholder||m.label,required:m.required,inputType:R,label:m.label,fieldStyle:C,openPickerOnClick:m.openPickerOnClick,onKeyDown:m.onKeyDown?()=>e.handleButtonClick(m.onKeyDown):void 0}))}}),h>1){const m=c.splice(0);c.push(...m.map((b,_)=>{var A;const S=Math.min(p,Math.max(1,Number((A=s[_])==null?void 0:A.fieldSpan)||1));return V("div",{key:`${n}-field-grid-${_}`,style:{gridColumn:`span ${S} / span ${S}`,minWidth:0}},b)}))}if(a){const m={padding:"0.75rem 1.5rem",borderRadius:e.cfg.components.inputRadius,cursor:"pointer",fontWeight:600,width:t.secondaryButton?"auto":"100%",marginTop:t.secondaryButton?0:"1rem",...h>1?{gridColumn:"1 / -1",marginTop:0}:{}},b=a.className?((g=e.parseClassNameResponsive)==null?void 0:g.call(e,a.className,`${n}-submit`))??e.parseClassName(a.className):{},_=!!a.className&&/(^|\s)bg-[^\s]+/.test(a.className),S=!!a.className&&/(^|\s)text-[^\s]+/.test(a.className),A={...m,...b,...!_&&{backgroundColor:e.cfg.colors.primary},...!S&&{color:"#fff",border:"none"}},C=`${n}-submit`,w=!!((x=e.buttonLoading)!=null&&x[C]),E=()=>{var U,W,F,q,G;const j=[],N=e.sceneData||{};for(const et of s){const st=et.name||((U=et.label)==null?void 0:U.toLowerCase()),H=N[st],J=et.label||st;if(et.required&&(H==null||String(H).trim()==="")){j.push(`${J} is required`);continue}H==null||String(H).trim()===""||((W=et.validation)!=null&&W.pattern&&!new RegExp(et.validation.pattern).test(String(H))&&j.push(`${J} is invalid`),((F=et.validation)==null?void 0:F.min)!==void 0&&Number(H)<Number(et.validation.min)&&j.push(`${J} must be at least ${et.validation.min}`),((q=et.validation)==null?void 0:q.max)!==void 0&&Number(H)>Number(et.validation.max)&&j.push(`${J} must be at most ${et.validation.max}`),((G=et.validation)==null?void 0:G.minLength)!==void 0&&String(H).length<Number(et.validation.minLength)&&j.push(`${J} must be at least ${et.validation.minLength} characters`))}return j},k=()=>{var W,F;const j=E();if(j.length){(W=e.showToast)==null||W.call(e,j,"error");return}const N=()=>a.onClick?e.handleButtonClick(a.onClick,{onSuccess:a.onSuccess,onError:a.onError},{optimistic:a.optimistic,feedback:a.feedback,payload:a.payload}):Promise.resolve(),U=e.withLoading?e.withLoading(C,N):N();(F=U==null?void 0:U.catch)==null||F.call(U,()=>{})},I=a.onClick?()=>k():void 0,R=[];w?R.push(V("span",{key:"spinner",className:"bf-btn-spinner",style:{display:"inline-flex",width:"14px",height:"14px",marginRight:"6px",border:"2px solid currentColor",borderTopColor:"transparent",borderRadius:"50%",flexShrink:0}})):a.icon&&R.push(V("span",{key:"icon",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,marginRight:"6px"}},e.renderIcon(a.icon,a.iconSize||16))),R.push(V("span",{key:"text"},a.text||"Submit"));const z=V("button",{key:C,type:a.type||"submit",className:a.className,...e.getCommonProps(C,A,a),disabled:w||void 0,onClick:I},...R);c.push(t.secondaryButton?V("div",{key:`${n}-actions`,style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"12px",gridColumn:"1 / -1",borderTop:`1px solid ${e.cfg.colors.borderSubtle}`,paddingTop:"16px",marginTop:"8px"}},e.renderComponent({...t.secondaryButton,type:"button"},0,`${n}-actions`),z):z)}return V("form",{key:n,className:r,...o,style:{...o.style||{},...h>1?{display:"grid",gridTemplateColumns:`repeat(${p}, minmax(0, 1fr))`,columnGap:"1rem",rowGap:"1.25rem"}:{}},onSubmit:m=>m.preventDefault()},...c)}const sht=y.memo(({api:e,field:t,value:n,onChange:r})=>{y.useEffect(()=>{n!==void 0&&n!==""&&r&&r(n)},[]);const i=y.useRef(null),o=(n||"").split(",").filter(Boolean).map(g=>g.trim()),[s,a]=y.useState(""),[c,h]=y.useState(!1),u=g=>{const x=g.target.value;if(x.includes(",")||x.includes(";")){const m=x.split(/[,;]+/).map(b=>b.trim()).filter(Boolean);if(m.length>0){const b=[...new Set([...o,...m])].join(", ");r(b)}a("")}else a(x)},f=g=>{if(g.key==="Enter"||g.key===","||g.key===";"){g.preventDefault();const x=s.trim();x&&(r([...new Set([...o,x])].join(", ")),a(""))}else g.key==="Backspace"&&!s&&o.length>0&&r(o.slice(0,-1).join(", "))},p=()=>{const g=s.trim();g&&(r([...new Set([...o,g])].join(", ")),a(""))};return V("div",{key:"tags",style:{width:"100%",marginBottom:"1rem"}},t.label?V("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:500,color:e.cfg.colors.textSecondary,marginBottom:"0.75rem"}},t.label):null,V("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",padding:"0.5rem 0.75rem",borderRadius:e.cfg.components.inputRadius||"8px",backgroundColor:e.cfg.colors.surface,border:`1px solid ${c?e.cfg.colors.primary:e.cfg.colors.border}`,cursor:"text",outline:"none",transition:"border-color 0.2s"},onClick:()=>{var g;return(g=i.current)==null?void 0:g.focus()}},...o.map((g,x)=>V("span",{key:x,style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"4px",backgroundColor:e.cfg.colors.background,border:`1px solid ${e.cfg.colors.borderSubtle}`,color:e.cfg.colors.text,fontSize:"13px",lineHeight:"1.4"}},V("span",null,g),V("button",{type:"button",onMouseDown:m=>{m.preventDefault(),m.stopPropagation(),r(o.filter((b,_)=>_!==x).join(", "))},style:{background:"none",border:"none",cursor:"pointer",color:e.cfg.colors.textMuted,padding:"0",fontSize:"14px",lineHeight:"1",display:"flex",alignItems:"center",fontFamily:"inherit"}},"×"))),V("input",{ref:i,type:"text",value:s,onChange:u,onKeyDown:f,onFocus:()=>h(!0),onBlur:()=>{h(!1),p()},placeholder:t.placeholder||(o.length>0?"":"Add email..."),style:{flex:1,minWidth:"100px",border:"none",outline:"none",backgroundColor:"transparent",color:e.cfg.colors.text,fontSize:"14px",fontFamily:"inherit",padding:"2px 0"}})))});function aht(e,t,n){let r=e.interpolateText(t.text||t.content||"");if(!r)return null;!r.includes(`
117
117
  `)&&r.includes("\\n")&&(r=r.replace(/\\n/g,`
118
- `)),r=r.replace(/\(image:\s*([^)\s]+)\)/gi,`
118
+ `)),r=r.replace(/\(\s*image:\s*([^)]+?)\s*\)/gi,(b,_)=>`
119
119
 
120
- ![]($1)
120
+ ![](${String(_).replace(/\s+/g,"%20")})
121
121
 
122
- `),r=r.replace(/(^|[\s(])(https?:\/\/[^\s)]+\.(?:png|jpe?g|gif|webp|avif))(?=$|[\s)])/gim,"$1![]($2)"),r=r.replace(/(^|[\s(])(\/assets\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/[^\s)]+)(?=$|[\s)])/gim,"$1![]($2)");const i=b=>{const _=[],S=/(\*\*(.+?)\*\*)|(\*(.+?)\*)|(`(.+?)`)|(\[(.+?)\]\((.+?)\))|(~~(.+?)~~)/g;let A=0,C;for(;(C=S.exec(b))!==null;)C.index>A&&_.push(b.slice(A,C.index)),C[2]?_.push(V("strong",{key:_.length},C[2])):C[4]?_.push(V("em",{key:_.length},C[4])):C[6]?_.push(V("code",{key:_.length},C[6])):C[8]?_.push(V("a",{key:_.length,href:C[9],target:"_blank",rel:"noopener noreferrer"},C[8])):C[11]&&_.push(V("del",{key:_.length},C[11])),A=C.index+C[0].length;return A<b.length&&_.push(b.slice(A)),_},o=b=>{const _=[],S=/!\[(.*?)\]\(([^)\s]+)\)/g;let A=0,C;for(;(C=S.exec(b))!==null;){C.index>A&&_.push(...i(b.slice(A,C.index)));const w=C[2];_.push(V("img",{key:`mdimg-${_.length}`,src:w,alt:C[1]||"",style:{display:"block",margin:"6px 0",maxWidth:"100%",maxHeight:"180px",borderRadius:"12px",objectFit:"cover",cursor:"zoom-in"},onClick:()=>e.handleButtonClick(`set_data:_previewImage=${w};show_modal:image-preview`)})),A=C.index+C[0].length}return A<b.length&&_.push(...i(b.slice(A))),_},s=r.split(`
122
+ `),r=r.replace(/(^|\s)(https?:\/\/[^\s)]+\.(?:png|jpe?g|gif|webp|avif))(?=$|\s)/gim,"$1![]($2)"),r=r.replace(/(^|\s)(\/assets\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/[^\s)]+)(?=$|\s)/gim,"$1![]($2)");const i=b=>{const _=[],S=/(\*\*(.+?)\*\*)|(\*(.+?)\*)|(`(.+?)`)|(\[(.+?)\]\((.+?)\))|(~~(.+?)~~)/g;let A=0,C;for(;(C=S.exec(b))!==null;)C.index>A&&_.push(b.slice(A,C.index)),C[2]?_.push(V("strong",{key:_.length},C[2])):C[4]?_.push(V("em",{key:_.length},C[4])):C[6]?_.push(V("code",{key:_.length},C[6])):C[8]?_.push(V("a",{key:_.length,href:C[9],target:"_blank",rel:"noopener noreferrer"},C[8])):C[11]&&_.push(V("del",{key:_.length},C[11])),A=C.index+C[0].length;return A<b.length&&_.push(b.slice(A)),_},o=b=>{const _=[],S=/!\[(.*?)\]\(([^)\s]+)\)/g;let A=0,C;for(;(C=S.exec(b))!==null;){C.index>A&&_.push(...i(b.slice(A,C.index)));const w=C[2];_.push(V("img",{key:`mdimg-${_.length}`,src:w,alt:C[1]||"",style:{display:"block",margin:"6px 0",maxWidth:"100%",maxHeight:"180px",borderRadius:"12px",objectFit:"cover",cursor:"zoom-in"},onClick:()=>e.handleButtonClick(`set_data:_previewImage=${w};show_modal:image-preview`)})),A=C.index+C[0].length}return A<b.length&&_.push(...i(b.slice(A))),_},s=r.split(`
123
123
  `),a=[];let c=null,h=!1,u=[];const f=b=>{c&&(a.push(y.createElement(c.type,{key:b,style:{paddingLeft:"1.5rem",margin:"0.5rem 0",listStyleType:c.type==="ul"?"disc":"decimal"}},c.items.map((_,S)=>V("li",{key:`${b}-${S}`},_)))),c=null)},p=b=>{if(u.length===0)return;const _=u.join(`
124
124
  `);a.push(V("div",{key:b,style:{position:"relative",background:"#1e1e2e",borderRadius:"8px",margin:"0.5rem 0"}},V("button",{style:{position:"absolute",top:"8px",right:"8px",background:"transparent",border:"none",color:"#666",cursor:"pointer",padding:"4px",borderRadius:"4px",lineHeight:"1",zIndex:1,display:"inline-flex",alignItems:"center",fontSize:"14px"},onClick:S=>{S.preventDefault(),S.stopPropagation(),(C=>{navigator.clipboard.writeText(C).catch(()=>{const w=document.createElement("textarea");w.value=C,w.style.position="fixed",w.style.opacity="0",document.body.appendChild(w),w.select(),document.execCommand("copy"),document.body.removeChild(w)})})(_)}},V("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},V("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),V("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"}))),V("pre",{style:{padding:"16px 12px",margin:0,overflow:"auto",fontSize:"13px",lineHeight:"1.5",color:"#e2e8f0"}},V("code",null,_)))),u=[]};for(let b=0;b<s.length;b++){const _=s[b],S=_.trim();if(S.startsWith("```")){h?(p(`code-${b}`),h=!1):(f(`list-${b}`),h=!0,u=[]);continue}if(h){u.push(_);continue}if(!S){f(`list-${b}`);continue}const A=S.match(/^(#{1,3})\s+(.+)/);if(A){f(`list-${b}`);const w=A[1].length,E=`h${w}`,k={1:"1.5em",2:"1.25em",3:"1.1em"}[w];a.push(y.createElement(E,{key:b,style:{margin:"0.75rem 0 0.25rem",fontSize:k,fontWeight:700}},...o(A[2])));continue}if(S.startsWith("- ")||S.startsWith("* ")){const w=S.slice(2);c?c.type!=="ul"&&(f(`list-${b}`),c={type:"ul",items:[]}):c={type:"ul",items:[]},c.items.push(y.createElement(y.Fragment,{},...o(w)));continue}const C=S.match(/^\d+\.\s+(.+)/);if(C){c?c.type!=="ol"&&(f(`list-${b}`),c={type:"ol",items:[]}):c={type:"ol",items:[]},c.items.push(y.createElement(y.Fragment,{},...o(C[1])));continue}f(`list-${b}`),a.push(V("p",{key:b,style:{margin:"0.25rem 0"}},...o(S)))}h&&p("code-end"),f("list-end");const g={};t.fontSize!==void 0&&(g.fontSize=`${t.fontSize}px`),t.fontWeight!==void 0&&(g.fontWeight=t.fontWeight),t.color!==void 0&&(g.color=t.color),t.textAlign!==void 0&&(g.textAlign=t.textAlign);const x=t.className?{...g,...e.parseClassName(t.className)}:g,m=e.getCommonProps(n,x,t);return V("div",{key:n,...m},...a)}function lht(e,t,n){const r=e.cfg.colors,i={position:"relative",marginTop:"auto",bottom:0,left:0,right:0,zIndex:40,display:"flex",justifyContent:"space-around",alignItems:"stretch",backgroundColor:r.surfaceHover,borderTop:`1px solid ${r.border}`,padding:"6px 0",boxShadow:"0 -2px 8px rgba(0,0,0,0.08)"},s=(Array.isArray(t.items)?t.items:[]).map((c,h)=>{const u=c.active||!1,f=()=>{const p=()=>e.handleButtonClick(c.onClick||"");(e.withLoading?e.withLoading(`${n}-bn-${h}`,p):p()).catch(()=>{})};return V("button",{key:`${n}-bn-${h}`,onClick:f,style:{background:"none",border:"none",cursor:"pointer",flex:1,display:"flex",flexDirection:"column",alignItems:"center",gap:2,padding:"6px 0",color:u?r.primary:r.textMuted,fontSize:11,fontFamily:"inherit"},"aria-label":c.label||c.icon||"nav item"},c.icon?e.renderIcon(c.icon,20):null,c.label?V("span",{},c.label):null)}),a=e.getCommonProps(n,i,t);return V("div",{key:n,...a},...s)}function cht(e,t,n){if(t.resizable)return y.createElement(sut,{api:e,config:t,componentKey:n,key:n});const r=Array.isArray(t.panes)?t.panes:[],i=t.orientation==="vertical",o=t.className?{display:"flex",flexDirection:i?"column":"row",alignItems:"stretch",...e.parseClassName(t.className)}:{display:"flex",flexDirection:i?"column":"row",alignItems:"stretch",width:"100%",flex:1,minHeight:0},s=r.map((c,h)=>{const u=c.width!==void 0?c.width:h===r.length-1?"1fr":"50%",f={[i?"height":"width"]:u,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},p=`${n}-split-${h}`;return V("div",{key:p,style:f},c.component?e.renderComponent(c.component,h,`${n}-split`):null)}),a=e.getCommonProps(n,o,t);return V("div",{key:n,...a},...s)}function uht(e,t,n){var c;const r=e.cfg.colorMode!=="light",i=()=>{var h;return(h=e.setColorMode)==null?void 0:h.call(e,r?"light":"dark")},o=t.className?e.parseClassName(t.className):{background:"none",border:`1px solid ${e.cfg.colorMode==="light"?e.cfg.colors.border:"transparent"}`,borderRadius:8,cursor:"pointer",display:"flex",alignItems:"center",gap:6,padding:"6px 10px",color:e.cfg.colors.text,fontSize:14,fontFamily:"inherit"},s=e.getCommonProps(n,o,t),a=((c=e.renderIcon)==null?void 0:c.call(e,r?"sun":"moon",16))??V("span",{},r?"☀️":"🌙");return V("button",{key:n,...s,onClick:i,"aria-label":r?"Switch to light mode":"Switch to dark mode"},V("span",{style:{display:"inline-flex"}},a),t.text?V("span",{},t.text):null)}const hht=y.memo(function({api:t,c:n,componentKey:r}){var m;const i=n.activeKey||"_locating",o=n.latitudeKey||"latitude",s=n.longitudeKey||"longitude",[a,c]=y.useState(!1),h=!!((m=t.sceneData)!=null&&m[i])||a,u=b=>{b&&t.handleButtonClick(t.interpolateText(b),void 0,{payload:n.payload}).catch(()=>{})},f=()=>{var b;if(!a){if(typeof navigator>"u"||!navigator.geolocation){(b=t.showToast)==null||b.call(t,"Location is not available on this device","error");return}c(!0),navigator.geolocation.getCurrentPosition(_=>{c(!1),t.setSceneData(S=>({...S,[i]:!0,[o]:_.coords.latitude,[s]:_.coords.longitude,_locationError:""})),u(n.onLocation)},_=>{var S;c(!1),t.setSceneData(A=>({...A,[i]:!1,_locationError:String((_==null?void 0:_.message)||"Location denied")})),(S=t.showToast)==null||S.call(t,n.errorText||"Could not get your location","error")},{enableHighAccuracy:!0,timeout:Number(n.timeout)||8e3,maximumAge:0})}},p=()=>{t.setSceneData(b=>({...b,[i]:!1,[o]:"",[s]:""})),u(n.offAction)},g=n.className?t.parseClassName(n.className):{display:"inline-flex",alignItems:"center",gap:"10px",cursor:"pointer",background:"none",border:"none",color:t.cfg.colors.text,font:"inherit",padding:0},x=t.getCommonProps(r,g,n);return V("button",{key:r,type:"button",...x,"aria-pressed":h,onClick:h?p:f},V("span",{style:{position:"relative",width:"38px",height:"22px",borderRadius:"9999px",flexShrink:0,background:h?t.cfg.colors.primary:"color-mix(in srgb, currentColor 25%, transparent)",transition:"background 0.15s ease"}},V("span",{style:{position:"absolute",top:"3px",left:h?"19px":"3px",width:"16px",height:"16px",borderRadius:"50%",background:"#fff",transition:"left 0.15s ease"}})),V("span",{},a?n.locatingText||"Locating…":h?n.activeText||n.label||"Location on":n.label||"Use my location"))});function fht(e,t,n){return y.createElement(hht,{api:e,c:t,componentKey:n,key:n})}const dht=y.memo(function({api:t,c:n,componentKey:r}){const i=t.interpolateText(String(n.until||"")),o=i?Date.parse(String(i)):NaN,s=Number.isFinite(o)?o:NaN,[a,c]=y.useState(()=>Date.now()),h=y.useRef(!1);y.useEffect(()=>{if(!Number.isFinite(s))return;const b=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(b)},[s]),y.useEffect(()=>{h.current=!1},[s]);const u=Number.isFinite(s)?Math.max(0,Math.ceil((s-a)/1e3)):0,f=Number.isFinite(s)&&u<=0;if(y.useEffect(()=>{f&&!h.current&&(h.current=!0,n.onExpire&&t.handleButtonClick(t.interpolateText(n.onExpire),void 0,{payload:n.payload}).catch(()=>{}))},[f]),!Number.isFinite(s))return null;const p=Math.floor(u/60),g=String(u%60).padStart(2,"0"),x={fontVariantNumeric:"tabular-nums",...n.className?t.parseClassName(n.className):{}},m=t.getCommonProps(r,x,n);return V("span",{key:r,...m},f?n.expiredText||"Expired":`${p}:${g}`)});function pht(e,t,n){return y.createElement(dht,{api:e,c:t,componentKey:n,key:n})}function mht(e){var o;const{api:t,config:n}=e,r=t.interpolateText(n.channel||""),i=t.interpolateText(n.entityId||"");return y.useEffect(()=>{var b;const s=t.sdk;if(!t.isAuthenticated||!((b=s==null?void 0:s.client)!=null&&b.createWebSocket)||!r)return;let a=null,c=null,h=[],u=!1,f=null;const p=()=>{const _=t.interpolateText(n.resolution||"")||"",S=String(_).match(/(\d+)\s*x\s*(\d+)/);return S?{width:Number(S[1]),height:Number(S[2])}:{width:Number(t.interpolateText(n.width))||1280,height:Number(t.interpolateText(n.height))||720}},g=Number(t.interpolateText(n.fps))||10,x=async()=>{var S;if(u)return;u=!0,c&&c.state!=="inactive"&&await new Promise(A=>{c.onstop=()=>A(),c.stop()}),(S=a==null?void 0:a.close)==null||S.call(a);const _=new Blob(h,{type:"video/webm"});if(h=[],_.size!==0)try{const A=t.interpolateText(n.entityId||"")||"cast",C=t.interpolateText(n.fileName||"")||`${n.entityType||"video"}-${A}.webm`,w=new File([_],C,{type:"video/webm"}),E=await s.files.upload(w,{bucket:n.bucket||"backflow-storage",entityType:n.entityType||"video",entityId:A});t.setSceneData(k=>({...k,sessionId:A,[n.assetField||"asset_id"]:E==null?void 0:E.id,_recorded:E})),n.onRecorded&&t.handleButtonClick(String(n.onRecorded),{})}catch(A){Yp("[recorder] upload failed:",A)}},m=()=>{if(c)return;const{width:_,height:S}=p(),A=document.createElement("canvas");A.width=_,A.height=S;const C=A.getContext("2d");if(C){f=w=>{const E=new Image;E.onload=()=>C.drawImage(E,0,0,_,S),E.src=w};try{const w=A.captureStream(g);c=new MediaRecorder(w,{mimeType:"video/webm",videoBitsPerSecond:5e6}),c.ondataavailable=E=>{E.data.size&&h.push(E.data)},c.start(500)}catch(w){Yp("[recorder] start failed:",w),c=null}}};return a=s.client.createWebSocket(r),a.onmessage=_=>{let S=_==null?void 0:_.data;if(typeof S=="string")try{S=JSON.parse(S)}catch{return}(S==null?void 0:S.type)==="screencast_frame"&&S.frame?(m(),f==null||f(S.frame)):((S==null?void 0:S.status)==="completed"||(S==null?void 0:S.status)==="failed"||(S==null?void 0:S.type)==="workflow_completed"||(S==null?void 0:S.type)==="workflow_failed")&&x()},a.onclose=()=>x(),a.onerror=()=>x(),()=>{var _,S;u=!0,(_=c==null?void 0:c.stop)==null||_.call(c),(S=a==null?void 0:a.close)==null||S.call(a)}},[t.isAuthenticated,r,i,(o=e.config)==null?void 0:o.channel]),null}function ght(e){var p,g,x,m,b;const{api:t,config:n,componentKey:r}=e,i=t.interpolateText(n.channel||""),o=y.useRef(null),s=y.useRef(null),[a,c]=y.useState(!1);y.useEffect(()=>{const _=()=>c(document.fullscreenElement===o.current);return document.addEventListener("fullscreenchange",_),()=>document.removeEventListener("fullscreenchange",_)},[]);const h=async()=>{var _;try{document.fullscreenElement?await document.exitFullscreen():await((_=o.current)==null?void 0:_.requestFullscreen())}catch{}},u=t.sdk,f=y.createElement(E2,{channel:i,enabled:t.isAuthenticated&&!!((p=u==null?void 0:u.client)!=null&&p.createWebSocket),createWebSocket:_=>u.client.createWebSocket(_),parseClassName:_=>t.parseClassName(_),brandColor:(x=(g=t.cfg)==null?void 0:g.colors)==null?void 0:x.primary,style:n.approval||{},preview:!!((m=n.approval)!=null&&m.preview),previewForm:(b=n.approval)==null?void 0:b.previewForm});return y.createElement("div",{key:r,ref:o,className:"relative w-full h-full bg-black group",style:{width:"100%",height:"100%",...n.clickToFullscreen===!0?{cursor:"pointer"}:{}},...n.clickToFullscreen===!0?{onClick:h}:{}},y.createElement("canvas",{ref:s,className:t.parseClassName(n.className||"w-full h-full object-contain bg-black [aspect-ratio:16/9]"),style:{width:"100%",height:"100%",objectFit:"contain"}}),n.fullscreen===!1?null:y.createElement("button",{type:"button",onClick:h,title:a?"Exit fullscreen":"Open fullscreen","aria-label":a?"Exit fullscreen":"Open fullscreen",className:"absolute top-2 right-2 z-20 inline-flex h-8 w-8 items-center justify-center rounded-full bg-black/55 text-white transition-opacity hover:bg-black/75"},t.renderIcon(a?"minimize-2":"maximize-2",16)),f)}function yht(e){var n;const t=e.apiUrl||((n=e.sdk)==null?void 0:n.endpoint)||window.location.origin;return`${String(t).replace(/\/+$/,"")}/diagnostics-chat`}function vht({api:e,config:t,componentKey:n}){var S;const[r,i]=y.useState([]),[o,s]=y.useState(""),[a,c]=y.useState(""),[h,u]=y.useState(!1),f=String(e.sceneData.remoteSessionId||"").trim(),p=async A=>{A.preventDefault();const C=o.trim();if(!(!C||h||!f)){i(w=>[...w,{role:"user",content:C},{role:"assistant",content:""}]),s(""),u(!0),c("Inspecting the active UI");try{const w=await fetch(yht(e),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({message:C,remoteSessionId:f})});if(!w.ok){const k=await w.json().catch(()=>null);throw new Error((k==null?void 0:k.error)||"Could not reach the diagnostic agent")}const E=await w.json();if(typeof(E==null?void 0:E.message)!="string")throw new Error("The diagnostic agent returned an invalid response");i(k=>{const I=[...k];return I[I.length-1]={role:"assistant",content:E.message},I})}catch(w){i(E=>{const k=[...E],I=k.length-1;return k[I]={role:"assistant",content:w.message},k})}finally{u(!1),c("")}}},g=t.className?((S=e.parseClassNameResponsive)==null?void 0:S.call(e,t.className,n))||e.parseClassName(t.className):{},x=e.getCommonProps(n,g,t),m=e.cfg.colors.surface,b=e.cfg.colors.text,_=e.cfg.colors.textMuted;return y.createElement("section",{...x,style:{...x.style,...g,display:"flex",flexDirection:"column",gap:"12px"}},y.createElement("div",{style:{minHeight:"180px",maxHeight:"380px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"10px"}},r.length===0?y.createElement("span",{style:{color:_,fontSize:"13px"}},"Ask about a UI error, render issue, or unexpected request."):r.map((A,C)=>y.createElement("div",{key:`${A.role}-${C}`,style:{alignSelf:A.role==="user"?"flex-end":"stretch",maxWidth:A.role==="user"?"84%":"100%",padding:"10px 12px",borderRadius:"8px",background:A.role==="user"?e.cfg.colors.primary:m,color:b,whiteSpace:"pre-wrap",fontSize:"13px",lineHeight:1.5}},A.content||a||"Working..."))),f?null:y.createElement("span",{style:{color:e.cfg.colors.warning,fontSize:"12px"}},"A live remote UI session is required."),y.createElement("form",{onSubmit:p,style:{display:"flex",gap:"8px",alignItems:"flex-end"}},y.createElement("textarea",{value:o,disabled:h||!f,onChange:A=>s(A.target.value),placeholder:t.placeholder||"Ask the diagnostic agent",rows:3,style:{flex:1,resize:"vertical",minHeight:"72px",padding:"10px 12px",borderRadius:"8px",border:`1px solid ${e.cfg.colors.borderSubtle}`,background:m,color:b}}),y.createElement("button",{type:"submit",disabled:h||!o.trim()||!f,"aria-label":"Send diagnostic question",style:{width:"40px",height:"40px",border:"none",borderRadius:"8px",background:e.cfg.colors.primary,color:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.renderIcon("send",16))))}function M2(e,t){const n=y.useRef(t);y.useEffect(function(){t!==n.current&&e.attributionControl!=null&&(n.current!=null&&e.attributionControl.removeAttribution(n.current),t!=null&&e.attributionControl.addAttribution(t)),n.current=t},[e,t])}function k2(e,t,n){t.center!==n.center&&e.setLatLng(t.center),t.radius!=null&&t.radius!==n.radius&&e.setRadius(t.radius)}const bht=1;function xht(e){return Object.freeze({__version:bht,map:e})}function ng(e,t){return Object.freeze({...e,...t})}const $2=y.createContext(null),I2=$2.Provider;function rg(){const e=y.useContext($2);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return e}function wht(e){function t(n,r){const{instance:i,context:o}=e(n).current;return y.useImperativeHandle(r,()=>i),n.children==null?null:y.createElement(I2,{value:o},n.children)}return y.forwardRef(t)}function _ht(e){function t(n,r){const[i,o]=y.useState(!1),{instance:s}=e(n,o).current;y.useImperativeHandle(r,()=>s),y.useEffect(function(){i&&s.update()},[s,i,n.children]);const a=s._contentNode;return a?Za.createPortal(n.children,a):null}return y.forwardRef(t)}function Sht(e){function t(n,r){const{instance:i}=e(n).current;return y.useImperativeHandle(r,()=>i),null}return y.forwardRef(t)}function iw(e,t){const n=y.useRef();y.useEffect(function(){return t!=null&&e.instance.on(t),n.current=t,function(){n.current!=null&&e.instance.off(n.current),n.current=null}},[e,t])}function ig(e,t){const n=e.pane??t.pane;return n?{...e,pane:n}:e}function Pht(e,t){return function(r,i){const o=rg(),s=e(ig(r,o),o);return M2(o.map,r.attribution),iw(s.current,r.eventHandlers),t(s.current,o,r,i),s}}var Ub={exports:{}};/* @preserve
125
125
  * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
package/dist/index.js CHANGED
@@ -40711,15 +40711,18 @@ function Ift(e, t, n) {
40711
40711
  if (!r) return null;
40712
40712
  !r.includes(`
40713
40713
  `) && r.includes("\\n") && (r = r.replace(/\\n/g, `
40714
- `)), r = r.replace(/\(image:\s*([^)\s]+)\)/gi, `
40714
+ `)), r = r.replace(
40715
+ /\(\s*image:\s*([^)]+?)\s*\)/gi,
40716
+ (v, _) => `
40715
40717
 
40716
- ![]($1)
40718
+ ![](${String(_).replace(/\s+/g, "%20")})
40717
40719
 
40718
- `), r = r.replace(
40719
- /(^|[\s(])(https?:\/\/[^\s)]+\.(?:png|jpe?g|gif|webp|avif))(?=$|[\s)])/gim,
40720
+ `
40721
+ ), r = r.replace(
40722
+ /(^|\s)(https?:\/\/[^\s)]+\.(?:png|jpe?g|gif|webp|avif))(?=$|\s)/gim,
40720
40723
  "$1![]($2)"
40721
40724
  ), r = r.replace(
40722
- /(^|[\s(])(\/assets\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/[^\s)]+)(?=$|[\s)])/gim,
40725
+ /(^|\s)(\/assets\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/[^\s)]+)(?=$|\s)/gim,
40723
40726
  "$1![]($2)"
40724
40727
  );
40725
40728
  const i = (v) => {
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/renderer/components.tsx"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/renderer/components.tsx"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backflow-ui-renderer",
3
- "version": "0.1.65",
3
+ "version": "0.1.66",
4
4
  "description": "Standalone React workflow renderer for Backflow",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",