IA-Logseq-Publish/static/js/tldraw.js

1628 lines
637 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(function(){
shadow$provide[596]=function(ya,ba,Ta,I){function v(u,z,A){var B,J={},g=null,h=null;void 0!==A&&(g=""+A);void 0!==z.key&&(g=""+z.key);void 0!==z.ref&&(h=z.ref);for(B in z)n.call(z,B)&&!b.hasOwnProperty(B)&&(J[B]=z[B]);if(u&&u.defaultProps)for(B in z=u.defaultProps,z)void 0===J[B]&&(J[B]=z[B]);return{$$typeof:Y,type:u,key:g,ref:h,props:J,_owner:y.current}}ba(19);ya=ba(22);var Y=60103;I.Fragment=60107;"function"===typeof Symbol&&Symbol.for&&(ba=Symbol.for,Y=ba("react.element"),I.Fragment=ba("react.fragment"));
var y=ya.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,b={key:!0,ref:!0,__self:!0,__source:!0};I.jsx=v;I.jsxs=v};
shadow$provide[598]=function(ya,ba,Ta,I){Ta.exports=ba(596)};
shadow$provide[599]=function(ya,ba,Ta,I){function v(Ab){for(var vc="https://reactjs.org/docs/error-decoder.html?invariant\x3d"+Ab,Fc=1;Fc<arguments.length;Fc++)vc+="\x26args[]\x3d"+encodeURIComponent(arguments[Fc]);return"Minified React error #"+Ab+"; visit "+vc+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Y(Ab){if(null==Ab)return null;if("function"===typeof Ab)return Ab.displayName||Ab.name||null;if("string"===typeof Ab)return Ab;
switch(Ab){case T:return"Fragment";case V:return"Portal";case D:return"Profiler";case K:return"StrictMode";case la:return"Suspense";case R:return"SuspenseList"}if("object"===typeof Ab)switch(Ab.$$typeof){case Q:return(Ab.displayName||"Context")+".Consumer";case L:return(Ab._context.displayName||"Context")+".Provider";case N:var vc=Ab.render;vc=vc.displayName||vc.name||"";return Ab.displayName||(""!==vc?"ForwardRef("+vc+")":"ForwardRef");case Z:return Y(Ab.type);case S:return Y(Ab._render);case X:vc=
Ab._payload;Ab=Ab._init;try{return Y(Ab(vc))}catch(Fc){}}return null}function y(Ab,vc){for(var Fc=Ab._threadCount|0;Fc<=vc;Fc++)Ab[Fc]=Ab._currentValue2,Ab._threadCount=Fc+1}function n(Ab,vc,Fc,tc){if(tc&&(tc=Ab.contextType,"object"===typeof tc&&null!==tc))return y(tc,Fc),tc[Fc];if(Ab=Ab.contextTypes){Fc={};for(var Oc in Ab)Fc[Oc]=vc[Oc];vc=Fc}else vc=va;return vc}function b(Ab){if(Ka.call(Va,Ab))return!0;if(Ka.call(Oa,Ab))return!1;if(Ba.test(Ab))return Va[Ab]=!0;Oa[Ab]=!0;return!1}function u(Ab,
vc,Fc,tc){if(null!==Fc&&0===Fc.type)return!1;switch(typeof vc){case "function":case "symbol":return!0;case "boolean":if(tc)return!1;if(null!==Fc)return!Fc.acceptsBooleans;Ab=Ab.toLowerCase().slice(0,5);return"data-"!==Ab&&"aria-"!==Ab;default:return!1}}function z(Ab,vc,Fc,tc){if(null===vc||"undefined"===typeof vc||u(Ab,vc,Fc,tc))return!0;if(tc)return!1;if(null!==Fc)switch(Fc.type){case 3:return!vc;case 4:return!1===vc;case 5:return isNaN(vc);case 6:return isNaN(vc)||1>vc}return!1}function A(Ab,vc,
Fc,tc,Oc,dd,Vc){this.acceptsBooleans=2===vc||3===vc||4===vc;this.attributeName=tc;this.attributeNamespace=Oc;this.mustUseProperty=Fc;this.propertyName=Ab;this.type=vc;this.sanitizeURL=dd;this.removeEmptyString=Vc}function B(Ab){return Ab[1].toUpperCase()}function J(Ab){if("boolean"===typeof Ab||"number"===typeof Ab)return""+Ab;Ab=""+Ab;var vc=La.exec(Ab);if(vc){var Fc="",tc,Oc=0;for(tc=vc.index;tc<Ab.length;tc++){switch(Ab.charCodeAt(tc)){case 34:vc="\x26quot;";break;case 38:vc="\x26amp;";break;case 39:vc=
"\x26#x27;";break;case 60:vc="\x26lt;";break;case 62:vc="\x26gt;";break;default:continue}Oc!==tc&&(Fc+=Ab.substring(Oc,tc));Oc=tc+1;Fc+=vc}Ab=Oc!==tc?Fc+Ab.substring(Oc,tc):Fc}return Ab}function g(Ab,vc){var Fc=Ya.hasOwnProperty(Ab)?Ya[Ab]:null,tc;if(tc="style"!==Ab)tc=null!==Fc?0===Fc.type:!(2<Ab.length)||"o"!==Ab[0]&&"O"!==Ab[0]||"n"!==Ab[1]&&"N"!==Ab[1]?!1:!0;if(tc||z(Ab,vc,Fc,!1))return"";if(null!==Fc){Ab=Fc.attributeName;tc=Fc.type;if(3===tc||4===tc&&!0===vc)return Ab+'\x3d""';Fc.sanitizeURL&&
(vc=""+vc);return Ab+'\x3d"'+(J(vc)+'"')}return b(Ab)?Ab+'\x3d"'+(J(vc)+'"'):""}function h(Ab,vc){return Ab===vc&&(0!==Ab||1/Ab===1/vc)||Ab!==Ab&&vc!==vc}function c(){if(null===ja)throw Error(v(321));return ja}function p(){if(0<Xa)throw Error(v(312));return{memoizedState:null,queue:null,next:null}}function m(){null===ia?null===oa?(sa=!1,oa=ia=p()):(sa=!0,ia=oa):null===ia.next?(sa=!1,ia=ia.next=p()):(sa=!0,ia=ia.next);return ia}function q(Ab,vc,Fc,tc){for(;Ea;)Ea=!1,Xa+=1,ia=null,Fc=Ab(vc,tc);E();
return Fc}function E(){ja=null;Ea=!1;oa=null;Xa=0;ia=Qa=null}function w(Ab,vc){return"function"===typeof vc?vc(Ab):vc}function t(Ab,vc,Fc){ja=c();ia=m();if(sa){var tc=ia.queue;vc=tc.dispatch;if(null!==Qa&&(Fc=Qa.get(tc),void 0!==Fc)){Qa.delete(tc);tc=ia.memoizedState;do tc=Ab(tc,Fc.action),Fc=Fc.next;while(null!==Fc);ia.memoizedState=tc;return[tc,vc]}return[ia.memoizedState,vc]}Ab=Ab===w?"function"===typeof vc?vc():vc:void 0!==Fc?Fc(vc):vc;ia.memoizedState=Ab;Ab=ia.queue={last:null,dispatch:null};
Ab=Ab.dispatch=f.bind(null,ja,Ab);return[ia.memoizedState,Ab]}function r(Ab,vc){ja=c();ia=m();vc=void 0===vc?null:vc;if(null!==ia){var Fc=ia.memoizedState;if(null!==Fc&&null!==vc){var tc=Fc[1];a:if(null===tc)tc=!1;else{for(var Oc=0;Oc<tc.length&&Oc<vc.length;Oc++)if(!ma(vc[Oc],tc[Oc])){tc=!1;break a}tc=!0}if(tc)return Fc[0]}}Ab=Ab();ia.memoizedState=[Ab,vc];return Ab}function f(Ab,vc,Fc){if(!(25>Xa))throw Error(v(301));if(Ab===ja)if(Ea=!0,Ab={action:Fc,next:null},null===Qa&&(Qa=new Map),Fc=Qa.get(vc),
void 0===Fc)Qa.set(vc,Ab);else{for(vc=Fc;null!==vc.next;)vc=vc.next;vc.next=Ab}}function F(){}function C(Ab){switch(Ab){case "svg":return"http://www.w3.org/2000/svg";case "math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function M(Ab){if(void 0===Ab||null===Ab)return Ab;var vc="";P.Children.forEach(Ab,function(Fc){null!=Fc&&(vc+=Fc)});return vc}function aa(Ab,vc){if(void 0===Ab)throw Error(v(152,Y(vc)||"Component"));}function O(Ab,vc,Fc){function tc(Vc,
jd){var Cb=jd.prototype&&jd.prototype.isReactComponent,$b=n(jd,vc,Fc,Cb),Wb=[],jb=!1,sb={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===Wb)return null},enqueueReplaceState:function(Qd,Ge){jb=!0;Wb=[Ge]},enqueueSetState:function(Qd,Ge){if(null===Wb)return null;Wb.push(Ge)}};if(Cb){if(Cb=new jd(Vc.props,$b,sb),"function"===typeof jd.getDerivedStateFromProps){var ac=jd.getDerivedStateFromProps.call(null,Vc.props,Cb.state);null!=ac&&(Cb.state=U({},Cb.state,ac))}}else if(ja={},
Cb=jd(Vc.props,$b,sb),Cb=q(jd,Vc.props,Cb,$b),null==Cb||null==Cb.render){Ab=Cb;aa(Ab,jd);return}Cb.props=Vc.props;Cb.context=$b;Cb.updater=sb;sb=Cb.state;void 0===sb&&(Cb.state=sb=null);if("function"===typeof Cb.UNSAFE_componentWillMount||"function"===typeof Cb.componentWillMount)if("function"===typeof Cb.componentWillMount&&"function"!==typeof jd.getDerivedStateFromProps&&Cb.componentWillMount(),"function"===typeof Cb.UNSAFE_componentWillMount&&"function"!==typeof jd.getDerivedStateFromProps&&Cb.UNSAFE_componentWillMount(),
Wb.length){sb=Wb;var Ac=jb;Wb=null;jb=!1;if(Ac&&1===sb.length)Cb.state=sb[0];else{ac=Ac?sb[0]:Cb.state;var fd=!0;for(Ac=Ac?1:0;Ac<sb.length;Ac++){var kd=sb[Ac];kd="function"===typeof kd?kd.call(Cb,ac,Vc.props,$b):kd;null!=kd&&(fd?(fd=!1,ac=U({},ac,kd)):U(ac,kd))}Cb.state=ac}}else Wb=null;Ab=Cb.render();aa(Ab,jd);if("function"===typeof Cb.getChildContext&&(Vc=jd.childContextTypes,"object"===typeof Vc)){var wd=Cb.getChildContext(),Wd;for(Wd in wd)if(!(Wd in Vc))throw Error(v(108,Y(jd)||"Unknown",Wd));
}wd&&(vc=U({},vc,wd))}for(;P.isValidElement(Ab);){var Oc=Ab,dd=Oc.type;if("function"!==typeof dd)break;tc(Oc,dd)}return{child:Ab,context:vc}}var U=ba(19),P=ba(22),V=60106,T=60107,K=60108,D=60114,L=60109,Q=60110,N=60112,la=60113,R=60120,Z=60115,X=60116,S=60121,ha=60117,W=60119,ra=60129,wa=60131;"function"===typeof Symbol&&Symbol.for&&(ya=Symbol.for,V=ya("react.portal"),T=ya("react.fragment"),K=ya("react.strict_mode"),D=ya("react.profiler"),L=ya("react.provider"),Q=ya("react.context"),N=ya("react.forward_ref"),
la=ya("react.suspense"),R=ya("react.suspense_list"),Z=ya("react.memo"),X=ya("react.lazy"),S=ya("react.block"),ha=ya("react.fundamental"),W=ya("react.scope"),ra=ya("react.debug_trace_mode"),wa=ya("react.legacy_hidden"));ya=P.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;var va={},Fa=new Uint16Array(16);for(ba=0;15>ba;ba++)Fa[ba]=ba+1;Fa[15]=0;var Ba=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,
Ka=Object.prototype.hasOwnProperty,Oa={},Va={},Ya={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(Ab){Ya[Ab]=new A(Ab,0,!1,Ab,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(Ab){var vc=Ab[0];Ya[vc]=new A(vc,1,!1,Ab[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(Ab){Ya[Ab]=
new A(Ab,2,!1,Ab.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(Ab){Ya[Ab]=new A(Ab,2,!1,Ab,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(Ab){Ya[Ab]=new A(Ab,3,!1,Ab.toLowerCase(),null,!1,!1)});["checked",
"multiple","muted","selected"].forEach(function(Ab){Ya[Ab]=new A(Ab,3,!0,Ab,null,!1,!1)});["capture","download"].forEach(function(Ab){Ya[Ab]=new A(Ab,4,!1,Ab,null,!1,!1)});["cols","rows","size","span"].forEach(function(Ab){Ya[Ab]=new A(Ab,6,!1,Ab,null,!1,!1)});["rowSpan","start"].forEach(function(Ab){Ya[Ab]=new A(Ab,5,!1,Ab.toLowerCase(),null,!1,!1)});var Ua=/[\-:]([a-z])/g;"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(Ab){var vc=
Ab.replace(Ua,B);Ya[vc]=new A(vc,1,!1,Ab,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(Ab){var vc=Ab.replace(Ua,B);Ya[vc]=new A(vc,1,!1,Ab,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(Ab){var vc=Ab.replace(Ua,B);Ya[vc]=new A(vc,1,!1,Ab,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(Ab){Ya[Ab]=new A(Ab,1,!1,Ab.toLowerCase(),null,!1,!1)});
Ya.xlinkHref=new A("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(Ab){Ya[Ab]=new A(Ab,1,!1,Ab.toLowerCase(),null,!0,!0)});var La=/["'&<>]/,ma="function"===typeof Object.is?Object.is:h,ja=null,oa=null,ia=null,sa=!1,Ea=!1,Qa=null,Xa=0,Pa=null,cb={readContext:function(Ab){var vc=Pa.threadID;y(Ab,vc);return Ab[vc]},useContext:function(Ab){c();var vc=Pa.threadID;y(Ab,vc);return Ab[vc]},useMemo:r,useReducer:t,useRef:function(Ab){ja=
c();ia=m();var vc=ia.memoizedState;return null===vc?(Ab={current:Ab},ia.memoizedState=Ab):vc},useState:function(Ab){return t(w,Ab)},useLayoutEffect:function(){},useCallback:function(Ab,vc){return r(function(){return Ab},vc)},useImperativeHandle:F,useEffect:F,useDebugValue:F,useDeferredValue:function(Ab){c();return Ab},useTransition:function(){c();return[function(Ab){Ab()},!1]},useOpaqueIdentifier:function(){return(Pa.identifierPrefix||"")+"R:"+(Pa.uniqueID++).toString(36)},useMutableSource:function(Ab,
vc){c();return vc(Ab._source)}},tb={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Mb=U({menuitem:!0},tb),yb={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,
gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ob=["Webkit","ms","Moz","O"];Object.keys(yb).forEach(function(Ab){ob.forEach(function(vc){vc=vc+Ab.charAt(0).toUpperCase()+Ab.substring(1);yb[vc]=yb[Ab]})});var Ja=/([A-Z])/g,bb=/^ms-/,hb=P.Children.toArray,
Qb=ya.ReactCurrentDispatcher,ub={listing:!0,pre:!0,textarea:!0},Yb=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,dc={},uc={},xc=Object.prototype.hasOwnProperty,Gb={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null},lc=function(){function Ab(Fc,tc,Oc){P.isValidElement(Fc)?Fc.type!==T?Fc=[Fc]:(Fc=Fc.props.children,Fc=P.isValidElement(Fc)?[Fc]:hb(Fc)):Fc=hb(Fc);Fc={type:null,domNamespace:"http://www.w3.org/1999/xhtml",children:Fc,childIndex:0,context:va,footer:""};
var dd=Fa[0];if(0===dd){var Vc=Fa;dd=Vc.length;var jd=2*dd;if(!(65536>=jd))throw Error(v(304));var Cb=new Uint16Array(jd);Cb.set(Vc);Fa=Cb;Fa[0]=dd+1;for(Vc=dd;Vc<jd-1;Vc++)Fa[Vc]=Vc+1;Fa[jd-1]=0}else Fa[0]=Fa[dd];this.threadID=dd;this.stack=[Fc];this.exhausted=!1;this.currentSelectValue=null;this.previousWasTextNode=!1;this.makeStaticMarkup=tc;this.suspenseDepth=0;this.contextIndex=-1;this.contextStack=[];this.contextValueStack=[];this.uniqueID=0;this.identifierPrefix=Oc&&Oc.identifierPrefix||""}
var vc=Ab.prototype;vc.destroy=function(){if(!this.exhausted){this.exhausted=!0;this.clearProviders();var Fc=this.threadID;Fa[Fc]=Fa[0];Fa[0]=Fc}};vc.pushProvider=function(Fc){var tc=++this.contextIndex,Oc=Fc.type._context,dd=this.threadID;y(Oc,dd);var Vc=Oc[dd];this.contextStack[tc]=Oc;this.contextValueStack[tc]=Vc;Oc[dd]=Fc.props.value};vc.popProvider=function(){var Fc=this.contextIndex,tc=this.contextStack[Fc],Oc=this.contextValueStack[Fc];this.contextStack[Fc]=null;this.contextValueStack[Fc]=
null;this.contextIndex--;tc[this.threadID]=Oc};vc.clearProviders=function(){for(var Fc=this.contextIndex;0<=Fc;Fc--)this.contextStack[Fc][this.threadID]=this.contextValueStack[Fc]};vc.read=function(Fc){if(this.exhausted)return null;var tc=Pa;Pa=this;var Oc=Qb.current;Qb.current=cb;try{for(var dd=[""],Vc=!1;dd[0].length<Fc;){if(0===this.stack.length){this.exhausted=!0;var jd=this.threadID;Fa[jd]=Fa[0];Fa[0]=jd;break}var Cb=this.stack[this.stack.length-1];if(Vc||Cb.childIndex>=Cb.children.length){var $b=
Cb.footer;""!==$b&&(this.previousWasTextNode=!1);this.stack.pop();if("select"===Cb.type)this.currentSelectValue=null;else if(null!=Cb.type&&null!=Cb.type.type&&Cb.type.type.$$typeof===L)this.popProvider(Cb.type);else if(Cb.type===la){this.suspenseDepth--;var Wb=dd.pop();if(Vc){Vc=!1;var jb=Cb.fallbackFrame;if(!jb)throw Error(v(303));this.stack.push(jb);dd[this.suspenseDepth]+="\x3c!--$!--\x3e";continue}else dd[this.suspenseDepth]+=Wb}dd[this.suspenseDepth]+=$b}else{var sb=Cb.children[Cb.childIndex++],
ac="";try{ac+=this.render(sb,Cb.context,Cb.domNamespace)}catch(Ac){if(null!=Ac&&"function"===typeof Ac.then)throw Error(v(294));throw Ac;}finally{}dd.length<=this.suspenseDepth&&dd.push("");dd[this.suspenseDepth]+=ac}}return dd[0]}finally{Qb.current=Oc,Pa=tc,E()}};vc.render=function(Fc,tc,Oc){if("string"===typeof Fc||"number"===typeof Fc){Oc=""+Fc;if(""===Oc)return"";if(this.makeStaticMarkup)return J(Oc);if(this.previousWasTextNode)return"\x3c!-- --\x3e"+J(Oc);this.previousWasTextNode=!0;return J(Oc)}tc=
O(Fc,tc,this.threadID);Fc=tc.child;tc=tc.context;if(null===Fc||!1===Fc)return"";if(!P.isValidElement(Fc)){if(null!=Fc&&null!=Fc.$$typeof){Oc=Fc.$$typeof;if(Oc===V)throw Error(v(257));throw Error(v(258,Oc.toString()));}Fc=hb(Fc);this.stack.push({type:null,domNamespace:Oc,children:Fc,childIndex:0,context:tc,footer:""});return""}var dd=Fc.type;if("string"===typeof dd)return this.renderDOM(Fc,tc,Oc);switch(dd){case wa:case ra:case K:case D:case R:case T:return Fc=hb(Fc.props.children),this.stack.push({type:null,
domNamespace:Oc,children:Fc,childIndex:0,context:tc,footer:""}),"";case la:throw Error(v(294));case W:throw Error(v(343));}if("object"===typeof dd&&null!==dd)switch(dd.$$typeof){case N:ja={};var Vc=dd.render(Fc.props,Fc.ref);Vc=q(dd.render,Fc.props,Vc,Fc.ref);Vc=hb(Vc);this.stack.push({type:null,domNamespace:Oc,children:Vc,childIndex:0,context:tc,footer:""});return"";case Z:return Fc=[P.createElement(dd.type,U({ref:Fc.ref},Fc.props))],this.stack.push({type:null,domNamespace:Oc,children:Fc,childIndex:0,
context:tc,footer:""}),"";case L:return dd=hb(Fc.props.children),Oc={type:Fc,domNamespace:Oc,children:dd,childIndex:0,context:tc,footer:""},this.pushProvider(Fc),this.stack.push(Oc),"";case Q:dd=Fc.type;Vc=Fc.props;var jd=this.threadID;y(dd,jd);dd=hb(Vc.children(dd[jd]));this.stack.push({type:Fc,domNamespace:Oc,children:dd,childIndex:0,context:tc,footer:""});return"";case ha:throw Error(v(338));case X:return dd=Fc.type,Vc=dd._init,dd=Vc(dd._payload),Fc=[P.createElement(dd,U({ref:Fc.ref},Fc.props))],
this.stack.push({type:null,domNamespace:Oc,children:Fc,childIndex:0,context:tc,footer:""}),""}throw Error(v(130,null==dd?dd:typeof dd,""));};vc.renderDOM=function(Fc,tc,Oc){var dd=Fc.type.toLowerCase();"http://www.w3.org/1999/xhtml"===Oc&&C(dd);if(!dc.hasOwnProperty(dd)){if(!Yb.test(dd))throw Error(v(65,dd));dc[dd]=!0}var Vc=Fc.props;if("input"===dd)Vc=U({type:void 0},Vc,{defaultChecked:void 0,defaultValue:void 0,value:null!=Vc.value?Vc.value:Vc.defaultValue,checked:null!=Vc.checked?Vc.checked:Vc.defaultChecked});
else if("textarea"===dd){var jd=Vc.value;if(null==jd){jd=Vc.defaultValue;var Cb=Vc.children;if(null!=Cb){if(null!=jd)throw Error(v(92));if(Array.isArray(Cb)){if(!(1>=Cb.length))throw Error(v(93));Cb=Cb[0]}jd=""+Cb}null==jd&&(jd="")}Vc=U({},Vc,{value:void 0,children:""+jd})}else if("select"===dd)this.currentSelectValue=null!=Vc.value?Vc.value:Vc.defaultValue,Vc=U({},Vc,{value:void 0});else if("option"===dd){Cb=this.currentSelectValue;var $b=M(Vc.children);if(null!=Cb){var Wb=null!=Vc.value?Vc.value+
"":$b;jd=!1;if(Array.isArray(Cb))for(var jb=0;jb<Cb.length;jb++){if(""+Cb[jb]===Wb){jd=!0;break}}else jd=""+Cb===Wb;Vc=U({selected:void 0,children:void 0},Vc,{selected:jd,children:$b})}}if(jd=Vc){if(Mb[dd]&&(null!=jd.children||null!=jd.dangerouslySetInnerHTML))throw Error(v(137,dd));if(null!=jd.dangerouslySetInnerHTML){if(null!=jd.children)throw Error(v(60));if(!("object"===typeof jd.dangerouslySetInnerHTML&&"__html"in jd.dangerouslySetInnerHTML))throw Error(v(61));}if(null!=jd.style&&"object"!==
typeof jd.style)throw Error(v(62));}jd=Vc;Cb=this.makeStaticMarkup;$b=1===this.stack.length;Wb="\x3c"+Fc.type;a:if(-1===dd.indexOf("-"))jb="string"===typeof jd.is;else switch(dd){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":jb=!1;break a;default:jb=!0}for(Ge in jd)if(xc.call(jd,Ge)){var sb=jd[Ge];if(null!=sb){if("style"===Ge){var ac=void 0,Ac="",fd="";for(ac in sb)if(sb.hasOwnProperty(ac)){var kd=
0===ac.indexOf("--"),wd=sb[ac];if(null!=wd){if(kd)var Wd=ac;else if(Wd=ac,uc.hasOwnProperty(Wd))Wd=uc[Wd];else{var Qd=Wd.replace(Ja,"-$1").toLowerCase().replace(bb,"-ms-");Wd=uc[Wd]=Qd}Ac+=fd+Wd+":";fd=ac;kd=null==wd||"boolean"===typeof wd||""===wd?"":kd||"number"!==typeof wd||0===wd||yb.hasOwnProperty(fd)&&yb[fd]?(""+wd).trim():wd+"px";Ac+=kd;fd=";"}}sb=Ac||null}ac=null;jb?Gb.hasOwnProperty(Ge)||(ac=Ge,ac=b(ac)&&null!=sb?ac+'\x3d"'+(J(sb)+'"'):""):ac=g(Ge,sb);ac&&(Wb+=" "+ac)}}Cb||$b&&(Wb+=' data-reactroot\x3d""');
var Ge=Wb;jd="";tb.hasOwnProperty(dd)?Ge+="/\x3e":(Ge+="\x3e",jd="\x3c/"+Fc.type+"\x3e");a:{Cb=Vc.dangerouslySetInnerHTML;if(null!=Cb){if(null!=Cb.__html){Cb=Cb.__html;break a}}else if(Cb=Vc.children,"string"===typeof Cb||"number"===typeof Cb){Cb=J(Cb);break a}Cb=null}null!=Cb?(Vc=[],ub.hasOwnProperty(dd)&&"\n"===Cb.charAt(0)&&(Ge+="\n"),Ge+=Cb):Vc=hb(Vc.children);Fc=Fc.type;Oc=null==Oc||"http://www.w3.org/1999/xhtml"===Oc?C(Fc):"http://www.w3.org/2000/svg"===Oc&&"foreignObject"===Fc?"http://www.w3.org/1999/xhtml":
Oc;this.stack.push({domNamespace:Oc,type:dd,children:Vc,childIndex:0,context:tc,footer:jd});this.previousWasTextNode=!1;return Ge};return Ab}();I.renderToNodeStream=function(){throw Error(v(207));};I.renderToStaticMarkup=function(Ab,vc){Ab=new lc(Ab,!0,vc);try{return Ab.read(Infinity)}finally{Ab.destroy()}};I.renderToStaticNodeStream=function(){throw Error(v(208));};I.renderToString=function(Ab,vc){Ab=new lc(Ab,!1,vc);try{return Ab.read(Infinity)}finally{Ab.destroy()}};I.version="17.0.2"};
shadow$provide[601]=function(ya,ba,Ta,I){Ta.exports=ba(599)};
shadow$provide[602]=function(ya,ba,Ta,I){function v(){if(!mr&&(mr="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!mr))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return mr(yu)}function Y(a,d=0){return(dl[a[d+0]]+dl[a[d+1]]+dl[a[d+2]]+dl[a[d+3]]+"-"+dl[a[d+4]]+dl[a[d+5]]+"-"+dl[a[d+6]]+dl[a[d+7]]+"-"+dl[a[d+8]]+dl[a[d+9]]+"-"+dl[a[d+10]]+dl[a[d+11]]+dl[a[d+12]]+dl[a[d+13]]+dl[a[d+14]]+
dl[a[d+15]]).toLowerCase()}function y(a){let d=0;var k=0;for(var G of a)d+=G.w*G.h,k=Math.max(k,G.w);a.sort((ta,Ha)=>Ha.h-ta.h);k=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(d/.95)),k),h:Infinity}];let fa=G=0;for(const ta of a)for(a=k.length-1;0<=a;a--){var na=k[a];if(!(ta.w>na.w||ta.h>na.h)){ta.x=na.x;ta.y=na.y;fa=Math.max(fa,ta.y+ta.h);G=Math.max(G,ta.x+ta.w);ta.w===na.w&&ta.h===na.h?(na=k.pop(),a<k.length&&(k[a]=na)):ta.h===na.h?(na.x+=ta.w,na.w-=ta.w):(ta.w!==na.w&&k.push({x:na.x+ta.w,y:na.y,w:na.w-
ta.w,h:ta.h}),na.y+=ta.h,na.h-=ta.h);break}}return{w:G,h:fa,fill:d/(G*fa)||0}}function n(a,...d){return{didIntersect:0<d.length,message:a,points:d}}function b(a,d,k=0){const G=[a[0]+d[0]/2,a[1]+d[1]/2],fa=qd.rotWith(a,G,k),na=qd.rotWith(qd.add(a,[d[0],0]),G,k),ta=qd.rotWith(qd.add(a,d),G,k);a=qd.rotWith(qd.add(a,[0,d[1]]),G,k);return[["top",[fa,na]],["right",[na,ta]],["bottom",[ta,a]],["left",[a,fa]]]}function u(a,d,k,G){const [fa,na]=a,[ta,Ha]=d,[Sa,Za]=k,[fb,ib]=G;return Ha/ta!==(ib-Za)/(fb-Sa)&&
(d=ta*(ib-Za)-Ha*(fb-Sa),0!==d&&(a=((na-Za)*(fb-Sa)-(fa-Sa)*(ib-Za))/d,d=((na-Za)*ta-(fa-Sa)*Ha)/d,0<=a&&0<=d&&1>=d))?n("intersection",[fa+a*ta,na+a*Ha]):n("no intersection")}function z(a,d,k,G,fa=0){return c(k,G,fa,a,d)}function A(a,d,k,G=0){const {minX:fa,minY:na,width:ta,height:Ha}=k;return z(a,d,[fa,na],[ta,Ha],G)}function B(a,d,k,G){var fa=qd.sub(a,k);k=qd.sub(G,k);d=qd.sub(d,a);G=k[0]*fa[1]-k[1]*fa[0];fa=d[0]*fa[1]-d[1]*fa[0];k=k[1]*d[0]-k[0]*d[1];return 0===G||0===fa?n("coincident"):0===k?
n("parallel"):0!==k&&(G/=k,fa/=k,0<=G&&1>=G&&0<=fa&&1>=fa)?n("intersection",qd.add(a,qd.mul(d,G))):n("no intersection")}function J(a,d,k,G){var fa=(d[0]-a[0])*(d[0]-a[0])+(d[1]-a[1])*(d[1]-a[1]),na=2*((d[0]-a[0])*(a[0]-k[0])+(d[1]-a[1])*(a[1]-k[1]));k=na*na-4*fa*(k[0]*k[0]+k[1]*k[1]+a[0]*a[0]+a[1]*a[1]-2*(k[0]*a[0]+k[1]*a[1])-G*G);if(0>k)return n("outside");if(0===k)return n("tangent");G=Math.sqrt(k);k=(-na+G)/(2*fa);fa=(-na-G)/(2*fa);if((0>k||1<k)&&(0>fa||1<fa))return 0>k&&0>fa||1<k&&1<fa?n("outside"):
n("inside");na=[];0<=k&&1>=k&&na.push(qd.lrp(a,d,k));0<=fa&&1>=fa&&na.push(qd.lrp(a,d,fa));return n("intersection",...na)}function g(a,d,k,G,fa,na=0){if(0===G||0===fa||qd.isEqual(a,d))return n("no intersection");G=0>G?G:-G;fa=0>fa?fa:-fa;a=qd.sub(qd.rotWith(a,k,-na),k);d=qd.sub(qd.rotWith(d,k,-na),k);var ta=qd.sub(d,a),Ha=ta[0]*ta[0]/G/G+ta[1]*ta[1]/fa/fa;ta=2*a[0]*ta[0]/G/G+2*a[1]*ta[1]/fa/fa;const Sa=[];G=ta*ta-4*Ha*(a[0]*a[0]/G/G+a[1]*a[1]/fa/fa-1);0===G?Sa.push(-ta/2/Ha):0<G&&(G=Math.sqrt(G),
Sa.push((-ta+G)/2/Ha),Sa.push((-ta-G)/2/Ha));Ha=Sa.filter(Za=>0<=Za&&1>=Za).map(Za=>qd.add(k,qd.add(a,qd.mul(qd.sub(d,a),Za)))).map(Za=>qd.rotWith(Za,k,na));return n("intersection",...Ha)}function h(a,d,k){const G=[];for(let fa=1;fa<k.length;fa++){const na=B(a,d,k[fa-1],k[fa]);na&&G.push(...na.points)}return 0===G.length?n("no intersection"):n("intersection",...k)}function c(a,d,k,G,fa){return b(a,d,k).reduce((na,[ta,[Ha,Sa]])=>{(Ha=u(G,fa,Ha,Sa))&&na.push(n(ta,...Ha.points));return na},[]).filter(na=>
na.didIntersect)}function p(a,d,k,G){return b(a,d).reduce((fa,[na,[ta,Ha]])=>{(ta=B(k,G,ta,Ha))&&fa.push(n(na,...ta.points));return fa},[]).filter(fa=>fa.didIntersect)}function m(a,d,k,G){return b(a,d).reduce((fa,[na,[ta,Ha]])=>{(ta=J(ta,Ha,k,G))&&fa.push(Re(Ud({},ta),{message:na}));return fa},[]).filter(fa=>fa.didIntersect)}function q(a,d,k,G,fa,na=0){return b(a,d).reduce((ta,[Ha,[Sa,Za]])=>{(Sa=g(Sa,Za,k,G,fa,na))&&ta.push(Re(Ud({},Sa),{message:Ha}));return ta},[]).filter(ta=>ta.didIntersect)}function E(a,
d,k){return b(a,d).reduce((G,[fa,[na,ta]])=>{na=h(na,ta,k);na.didIntersect&&G.push(n(fa,...na.points));return G},[]).filter(G=>G.didIntersect)}function w(a,d,k){return b(a,d).reduce((G,[fa,[na,ta]])=>{{const Ha=[];for(let Sa=1;Sa<k.length+1;Sa++){const Za=B(na,ta,k[Sa-1],k[Sa%k.length]);Za&&Ha.push(...Za.points)}na=0===Ha.length?n("no intersection"):n("intersection",...k)}na.didIntersect&&G.push(n(fa,...na.points));return G},[]).filter(G=>G.didIntersect)}function t(a,d,k,G=0,fa,na){return d===k?m(fa,
na,a,d):q(fa,na,a,d,k,G)}function r(a,d,k){const {minX:G,minY:fa,width:na,height:ta}=a;return p([G,fa],[na,ta],d,k)}function f(a){for(var d=arguments.length,k=Array(1<d?d-1:0),G=1;G<d;G++)k[G-1]=arguments[G];throw Error("number"===typeof a?"[MobX] minified error nr: "+a+(k.length?" "+k.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+a);}function F(){return"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?
window:"undefined"!==typeof ya?ya:"undefined"!==typeof self?self:px}function C(){Ga||f("Proxy not available")}function M(a){var d=!1;return function(){if(!d)return d=!0,a.apply(this,arguments)}}function aa(a){return"function"===typeof a}function O(a){switch(typeof a){case "string":case "symbol":case "number":return!0}return!1}function U(a){return null!==a&&"object"===typeof a}function P(a){if(!U(a))return!1;a=Object.getPrototypeOf(a);if(null==a)return!0;a=Object.hasOwnProperty.call(a,"constructor")&&
a.constructor;return"function"===typeof a&&a.toString()===eb}function V(a){return(a=null==a?void 0:a.constructor)?"GeneratorFunction"===a.name||"GeneratorFunction"===a.displayName?!0:!1:!1}function T(a,d,k){yp(a,d,{enumerable:!1,writable:!0,configurable:!0,value:k})}function K(a,d,k){yp(a,d,{enumerable:!1,writable:!1,configurable:!0,value:k})}function D(a,d){var k="isMobX"+a;d.prototype[k]=!0;return function(G){return U(G)&&!0===G[k]}}function L(a){return a instanceof Map}function Q(a){return a instanceof
Set}function N(a){var d=Object.keys(a);if(!gc)return d;var k=Object.getOwnPropertySymbols(a);return k.length?[].concat(d,k.filter(function(G){return cq.propertyIsEnumerable.call(a,G)})):d}function la(a){return null===a?null:"object"===typeof a?""+a:a}function R(a,d){return cq.hasOwnProperty.call(a,d)}function Z(a,d){for(var k=0;k<d.length;k++){var G=d[k];G.enumerable=G.enumerable||!1;G.configurable=!0;"value"in G&&(G.writable=!0);Object.defineProperty(a,G.key,G)}}function X(a,d,k){d&&Z(a.prototype,
d);k&&Z(a,k);Object.defineProperty(a,"prototype",{writable:!1});return a}function S(){S=Object.assign||function(a){for(var d=1;d<arguments.length;d++){var k=arguments[d],G;for(G in k)Object.prototype.hasOwnProperty.call(k,G)&&(a[G]=k[G])}return a};return S.apply(this,arguments)}function ha(a,d){a.prototype=Object.create(d.prototype);a.prototype.constructor=a;W(a,d)}function W(a,d){W=Object.setPrototypeOf||function(k,G){k.__proto__=G;return k};return W(a,d)}function ra(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return a}function wa(a,d){if(a){if("string"===typeof a)return va(a,d);var k=Object.prototype.toString.call(a).slice(8,-1);"Object"===k&&a.constructor&&(k=a.constructor.name);if("Map"===k||"Set"===k)return Array.from(a);if("Arguments"===k||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(k))return va(a,d)}}function va(a,d){if(null==d||d>a.length)d=a.length;for(var k=0,G=Array(d);k<d;k++)G[k]=a[k];return G}function Fa(a,d){var k="undefined"!==typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(k)return(k=
k.call(a)).next.bind(k);if(Array.isArray(a)||(k=wa(a))||d&&a&&"number"===typeof a.length){k&&(a=k);var G=0;return function(){return G>=a.length?{done:!0}:{done:!1,value:a[G++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function Ba(a){return Object.assign(function(d,k){Ka(d,k,a)},a)}function Ka(a,d,k){R(a,vd)||T(a,vd,S({},a[vd]));k.annotationType_!==Ag&&(a[vd][d]=k)}function Oa(a){R(a,
vd)||T(a,vd,S({},a[vd]));return a[vd]}function Va(a,d,k){void 0===d&&(d=wb);void 0===k&&(k=wb);a=new cg(a);d!==wb&&$c(fE,a,d,void 0);k!==wb&&de(a,k);return a}function Ya(a,d,k){return re(a)?a:Array.isArray(a)?ze.array(a,{name:k}):P(a)?ze.object(a,void 0,{name:k}):L(a)?ze.map(a,{name:k}):Q(a)?ze.set(a,{name:k}):"function"!==typeof a||kd(a)||Yf(a)?a:V(a)?Hu(a):Gu(k,a)}function Ua(a){return a}function La(a,d){return{annotationType_:a,options_:d,make_:ma,extend_:ja}}function ma(a,d,k,G){var fa;if(null!=
(fa=this.options_)&&fa.bound)return null===this.extend_(a,d,k,!1)?0:1;if(G===a.target_)return null===this.extend_(a,d,k,!1)?0:2;if(kd(k.value))return 1;a=oa(a,this,d,k,!1);yp(G,d,a);return 2}function ja(a,d,k,G){k=oa(a,this,d,k);return a.defineProperty_(d,k,G)}function oa(a,d,k,G,fa){var na,ta,Ha,Sa,Za,fb,ib;void 0===fa&&(fa=sf.safeDescriptors);G=G.value;if(null!=(na=d.options_)&&na.bound){var Bb;G=G.bind(null!=(Bb=a.proxy_)?Bb:a.target_)}return{value:ub(null!=(ta=null==(Ha=d.options_)?void 0:Ha.name)?
ta:k.toString(),G,null!=(Sa=null==(Za=d.options_)?void 0:Za.autoAction)?Sa:!1,null!=(fb=d.options_)&&fb.bound?null!=(ib=a.proxy_)?ib:a.target_:void 0),configurable:fa?a.isPlainObject_:!0,enumerable:!1,writable:fa?!1:!0}}function ia(a,d){return{annotationType_:a,options_:d,make_:sa,extend_:Ea}}function sa(a,d,k,G){var fa;if(G===a.target_)return null===this.extend_(a,d,k,!1)?0:2;if(null!=(fa=this.options_)&&fa.bound&&(!R(a.target_,d)||!Yf(a.target_[d]))&&null===this.extend_(a,d,k,!1))return 0;if(Yf(k.value))return 1;
a=Qa(a,this,d,k,!1,!1);yp(G,d,a);return 2}function Ea(a,d,k,G){var fa;k=Qa(a,this,d,k,null==(fa=this.options_)?void 0:fa.bound);return a.defineProperty_(d,k,G)}function Qa(a,d,k,G,fa,na){void 0===na&&(na=sf.safeDescriptors);d=G.value;Yf(d)||(d=Hu(d));if(fa){var ta;d=d.bind(null!=(ta=a.proxy_)?ta:a.target_);d.isMobXFlow=!0}return{value:d,configurable:na?a.isPlainObject_:!0,enumerable:!1,writable:na?!1:!0}}function Xa(a,d){return{annotationType_:a,options_:d,make_:Pa,extend_:cb}}function Pa(a,d,k){return null===
this.extend_(a,d,k,!1)?0:1}function cb(a,d,k,G){return a.defineComputedProperty_(d,S({},this.options_,{get:k.get,set:k.set}),G)}function tb(a,d){return{annotationType_:a,options_:d,make_:Mb,extend_:yb}}function Mb(a,d,k){return null===this.extend_(a,d,k,!1)?0:1}function yb(a,d,k,G){var fa,na;return a.defineObservableProperty_(d,k.value,null!=(fa=null==(na=this.options_)?void 0:na.enhancer)?fa:Ya,G)}function ob(a){return{annotationType_:"true",options_:a,make_:Ja,extend_:bb}}function Ja(a,d,k,G){var fa,
na;if(k.get)return kf.make_(a,d,k,G);if(k.set){k=ub(d.toString(),k.set);if(G===a.target_)return null===a.defineProperty_(d,{configurable:sf.safeDescriptors?a.isPlainObject_:!0,set:k})?0:2;yp(G,d,{configurable:!0,set:k});return 2}if(G!==a.target_&&"function"===typeof k.value){var ta;if(V(k.value)){var Ha;return(null!=(Ha=this.options_)&&Ha.autoBind?Hu.bound:Hu).make_(a,d,k,G)}return(null!=(ta=this.options_)&&ta.autoBind?Gu.bound:Gu).make_(a,d,k,G)}ta=!1===(null==(fa=this.options_)?void 0:fa.deep)?
ze.ref:ze;if("function"===typeof k.value&&null!=(na=this.options_)&&na.autoBind){var Sa;k.value=k.value.bind(null!=(Sa=a.proxy_)?Sa:a.target_)}return ta.make_(a,d,k,G)}function bb(a,d,k,G){var fa,na;if(k.get)return kf.extend_(a,d,k,G);if(k.set)return a.defineProperty_(d,{configurable:sf.safeDescriptors?a.isPlainObject_:!0,set:ub(d.toString(),k.set)},G);if("function"===typeof k.value&&null!=(fa=this.options_)&&fa.autoBind){var ta;k.value=k.value.bind(null!=(ta=a.proxy_)?ta:a.target_)}return(!1===(null==
(na=this.options_)?void 0:na.deep)?ze.ref:ze).extend_(a,d,k,G)}function hb(a){if(!0===a.deep)var d=Ya;else{if(!1===a.deep)a=Ua;else{a=a.defaultDecorator;var k;a=a?null!=(d=null==(k=a.options_)?void 0:k.enhancer)?d:Ya:Ya}d=a}return d}function Qb(a,d,k){if(O(d))Ka(a,d,ae);else return re(a)?a:P(a)?ze.object(a,d,k):Array.isArray(a)?ze.array(a,d):L(a)?ze.map(a,d):Q(a)?ze.set(a,d):"object"===typeof a&&null!==a?a:ze.box(a,d)}function ub(a,d,k,G){function fa(){a:{var na=G||this,ta=arguments,Ha=sf.trackingDerivation,
Sa=!k||!Ha;Vc();var Za=sf.allowStateChanges;Sa&&(Ab(),Za=dc(!0));var fb=vc(!0),ib=XD++,Bb=Qv;Qv=ib;try{var Ob=d.apply(na,ta);break a}catch(cc){var Fb=cc;throw cc;}finally{Qv!==ib&&f(30),Qv=Bb,void 0!==Fb&&(sf.suppressReactionErrors=!0),sf.allowStateChanges=Za,sf.allowStateReads=fb,jd(),Sa&&(sf.trackingDerivation=Ha),sf.suppressReactionErrors=!1}Ob=void 0}return Ob}void 0===k&&(k=!1);fa.isMobxAction=!0;YD&&(Az.value=a,Object.defineProperty(fa,"name",Az));return fa}function Yb(a,d){a=dc(a);try{return d()}finally{sf.allowStateChanges=
a}}function dc(a){var d=sf.allowStateChanges;sf.allowStateChanges=a;return d}function uc(a){switch(a.dependenciesState_){case aj.UP_TO_DATE_:return!1;case aj.NOT_TRACKING_:case aj.STALE_:return!0;case aj.POSSIBLY_STALE_:for(var d=vc(!0),k=Ab(),G=a.observing_,fa=G.length,na=0;na<fa;na++){var ta=G[na];if(Fu(ta)){if(sf.disableErrorBoundaries)ta.get();else try{ta.get()}catch(Ha){return sf.trackingDerivation=k,sf.allowStateReads=d,!0}if(a.dependenciesState_===aj.STALE_)return sf.trackingDerivation=k,sf.allowStateReads=
d,!0}}Fc(a);sf.trackingDerivation=k;sf.allowStateReads=d;return!1}}function xc(a,d,k){var G=vc(!0);Fc(a);a.newObserving_=Array(a.observing_.length+100);a.unboundDepsCount_=0;a.runId_=++sf.runId;var fa=sf.trackingDerivation;sf.trackingDerivation=a;sf.inBatch++;if(!0===sf.disableErrorBoundaries)var na=d.call(k);else try{na=d.call(k)}catch(fb){na=new Gs(fb)}sf.inBatch--;sf.trackingDerivation=fa;var ta=a.observing_;d=a.observing_=a.newObserving_;k=aj.UP_TO_DATE_;fa=0;for(var Ha=a.unboundDepsCount_,Sa=
0;Sa<Ha;Sa++){var Za=d[Sa];0===Za.diffValue_&&(Za.diffValue_=1,fa!==Sa&&(d[fa]=Za),fa++);Za.dependenciesState_>k&&(k=Za.dependenciesState_)}d.length=fa;a.newObserving_=null;for(Ha=ta.length;Ha--;)Sa=ta[Ha],0===Sa.diffValue_&&Oc(Sa,a),Sa.diffValue_=0;for(;fa--;)ta=d[fa],1===ta.diffValue_&&(ta.diffValue_=0,Ha=a,ta.observers_.add(Ha),ta.lowestObserverState_>Ha.dependenciesState_&&(ta.lowestObserverState_=Ha.dependenciesState_));k!==aj.UP_TO_DATE_&&(a.dependenciesState_=k,a.onBecomeStale_());sf.allowStateReads=
G;return na}function Gb(a){var d=a.observing_;a.observing_=[];for(var k=d.length;k--;)Oc(d[k],a);a.dependenciesState_=aj.NOT_TRACKING_}function lc(a){var d=Ab();try{return a()}finally{sf.trackingDerivation=d}}function Ab(){var a=sf.trackingDerivation;sf.trackingDerivation=null;return a}function vc(a){var d=sf.allowStateReads;sf.allowStateReads=a;return d}function Fc(a){if(a.dependenciesState_!==aj.UP_TO_DATE_){a.dependenciesState_=aj.UP_TO_DATE_;a=a.observing_;for(var d=a.length;d--;)a[d].lowestObserverState_=
aj.UP_TO_DATE_}}function tc(){(sf.pendingReactions.length||sf.inBatch||sf.isRunningReactions)&&f(36);Bz=!0;if(Sv){var a=F();0===--a.__mobxInstanceCount&&(a.__mobxGlobals=void 0);sf=new Rv}}function Oc(a,d){a.observers_["delete"](d);0===a.observers_.size&&dd(a)}function dd(a){!1===a.isPendingUnobservation_&&(a.isPendingUnobservation_=!0,sf.pendingUnobservations.push(a))}function Vc(){sf.inBatch++}function jd(){if(0===--sf.inBatch){0<sf.inBatch||sf.isRunningReactions||Tv(sb);for(var a=sf.pendingUnobservations,
d=0;d<a.length;d++){var k=a[d];k.isPendingUnobservation_=!1;0===k.observers_.size&&(k.isBeingObserved_&&(k.isBeingObserved_=!1,k.onBUO()),k instanceof Eu&&k.suspend_())}sf.pendingUnobservations=[]}}function Cb(a){var d=sf.trackingDerivation;if(null!==d)return d.runId_!==a.lastAccessedBy_&&(a.lastAccessedBy_=d.runId_,d.newObserving_[d.unboundDepsCount_++]=a,!a.isBeingObserved_&&sf.trackingContext&&(a.isBeingObserved_=!0,a.onBO())),a.isBeingObserved_;0===a.observers_.size&&0<sf.inBatch&&dd(a);return!1}
function $b(a){a.lowestObserverState_!==aj.STALE_&&(a.lowestObserverState_=aj.STALE_,a.observers_.forEach(function(d){if(d.dependenciesState_===aj.UP_TO_DATE_)d.onBecomeStale_();d.dependenciesState_=aj.STALE_}))}function Wb(a){a.lowestObserverState_!==aj.STALE_&&(a.lowestObserverState_=aj.STALE_,a.observers_.forEach(function(d){d.dependenciesState_===aj.POSSIBLY_STALE_?d.dependenciesState_=aj.STALE_:d.dependenciesState_===aj.UP_TO_DATE_&&(a.lowestObserverState_=aj.UP_TO_DATE_)}))}function jb(a){a.lowestObserverState_===
aj.UP_TO_DATE_&&(a.lowestObserverState_=aj.POSSIBLY_STALE_,a.observers_.forEach(function(d){d.dependenciesState_===aj.UP_TO_DATE_&&(d.dependenciesState_=aj.POSSIBLY_STALE_,d.onBecomeStale_())}))}function sb(){sf.isRunningReactions=!0;for(var a=sf.pendingReactions,d=0;0<a.length;){++d===bE&&(console.error("[mobx] cycle in reaction: "+a[0]),a.splice(0));for(var k=a.splice(0),G=0,fa=k.length;G<fa;G++)k[G].runReaction_()}sf.isRunningReactions=!1}function ac(a){var d=Tv;Tv=function(k){return a(function(){return d(k)})}}
function Ac(a){console.warn("[mobx.spy] Is a no-op in production builds");return function(){}}function fd(a){return function(d,k){if(aa(d))return ub(d.name||"\x3cunnamed action\x3e",d,a);if(aa(k))return ub(d,k,a);if(O(k))return Ka(d,k,a?Ez:Dz);if(O(d))return Ba(La(a?"autoAction":Cz,{name:d,autoAction:a}))}}function kd(a){return aa(a)&&!0===a.isMobxAction}function wd(a,d){function k(){a(Sa)}var G,fa;void 0===d&&(d=pa);var na=null!=(G=null==(fa=d)?void 0:fa.name)?G:"Autorun";if(d.scheduler||d.delay){var ta=
Wd(d),Ha=!1;var Sa=new At(na,function(){Ha||(Ha=!0,ta(function(){Ha=!1;Sa.isDisposed_||Sa.track(k)}))},d.onError,d.requiresObservable)}else Sa=new At(na,function(){this.track(k)},d.onError,d.requiresObservable);Sa.schedule_();return Sa.getDisposer_()}function Wd(a){return a.scheduler?a.scheduler:a.delay?function(d){return setTimeout(d,a.delay)}:eE}function Qd(a,d,k){function G(){fb=!1;if(!Fb.isDisposed_){var cc=!1;Fb.track(function(){var oc=Yb(!1,function(){return a(Fb)});cc=Za||!Ob(ib,oc);Bb=ib;
ib=oc});Za&&k.fireImmediately?ta(ib,Bb,Fb):!Za&&cc&&ta(ib,Bb,Fb);Za=!1}}var fa;void 0===k&&(k=pa);var na=null!=(fa=k.name)?fa:"Reaction",ta=hg(na,k.onError?Ge(k.onError,d):d),Ha=!k.scheduler&&!k.delay,Sa=Wd(k),Za=!0,fb=!1,ib,Bb,Ob=k.compareStructural?Ue.structural:k.equals||Ue["default"],Fb=new At(na,function(){Za||Ha?G():fb||(fb=!0,Sa(G))},k.onError,k.requiresObservable);Fb.schedule_();return Fb.getDisposer_()}function Ge(a,d){return function(){try{return d.apply(this,arguments)}catch(k){a.call(this,
k)}}}function de(a,d,k){return $c(gE,a,d,k)}function $c(a,d,k,G){var fa="function"===typeof G?pg(d,k):pg(d),na=aa(G)?G:k,ta=a+"L";fa[ta]?fa[ta].add(na):fa[ta]=new Set([na]);return function(){var Ha=fa[ta];Ha&&(Ha["delete"](na),0===Ha.size&&delete fa[ta])}}function Kc(a){!0===a.isolateGlobalState&&tc();var d=a.useProxies,k=a.enforceActions;void 0!==d&&(sf.useProxies="always"===d?!0:"never"===d?!1:"undefined"!==typeof Proxy);"ifavailable"===d&&(sf.verifyProxies=!0);void 0!==k&&(d="always"===k?"always":
"observed"===k,sf.enforceActions=d,sf.allowStateChanges=!0===d||"always"===d?!1:!0);["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(G){G in a&&(sf[G]=!!a[G])});sf.allowStateReads=!sf.observableRequiresReaction;a.reactionScheduler&&ac(a.reactionScheduler)}function Ce(a,d,k,G){var fa=Rc(d),na=ud(a,G)[Md];Vc();try{Dc(fa).forEach(function(ta){na.extend_(ta,fa[ta],k?ta in k?k[ta]:!0:!0)})}finally{jd()}return a}
function mh(a){var d={name:a.name_};a.observing_&&0<a.observing_.length&&(d.dependencies=Array.from(new Set(a.observing_)).map(mh));return d}function fg(){this.message="FLOW_CANCELLED"}function Yf(a){return!0===(null==a?void 0:a.isMobXFlow)}function re(a,d){return a?void 0!==d?ke(a)?a[Md].values_.has(d):!1:ke(a)||!!a[Md]||rh(a)||Uv(a)||Fu(a):!1}function xf(a){if(ke(a))return a[Md].ownKeys_();f(38)}function Dh(a,d,k){a.set(d,k);return k}function Tg(a,d){if(null==a||"object"!==typeof a||a instanceof
Date||!re(a))return a;if($D(a)||Fu(a))return Tg(a.get(),d);if(d.has(a))return d.get(a);if(Yc(a)){var k=Dh(d,a,Array(a.length));a.forEach(function(ta,Ha){k[Ha]=Tg(ta,d)});return k}if(Hs(a)){var G=Dh(d,a,new Set);a.forEach(function(ta){G.add(Tg(ta,d))});return G}if(zr(a)){var fa=Dh(d,a,new Map);a.forEach(function(ta,Ha){fa.set(Ha,Tg(ta,d))});return fa}var na=Dh(d,a,{});xf(a).forEach(function(ta){cq.propertyIsEnumerable.call(a,ta)&&(na[ta]=Tg(a[ta],d))});return na}function yc(a,d){return Tg(a,new Map)}
function Nf(){f("trace() is not available in production builds");for(var a=!1,d=arguments.length,k=Array(d),G=0;G<d;G++)k[G]=arguments[G];"boolean"===typeof k[k.length-1]&&(a=k.pop());a:{switch(k.length){case 0:d=sf.trackingDerivation;break a;case 1:d=pg(k[0]);break a;case 2:d=pg(k[0],k[1]);break a}d=void 0}if(!d)return f("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");d.isTracing_===zt.NONE&&console.log("[mobx.trace] '"+
d.name_+"' tracing enabled");d.isTracing_=a?zt.BREAK:zt.LOG}function ed(a,d){void 0===d&&(d=void 0);Vc();try{return a.apply(d)}finally{jd()}}function Hb(a){return void 0!==a.interceptors_&&0<a.interceptors_.length}function Sb(a,d){var k=a.interceptors_||(a.interceptors_=[]);k.push(d);return M(function(){var G=k.indexOf(d);-1!==G&&k.splice(G,1)})}function Ib(a,d){var k=Ab();try{var G=[].concat(a.interceptors_||[]);a=0;for(var fa=G.length;a<fa&&((d=G[a](d))&&!d.type&&f(14),d);a++);return d}finally{sf.trackingDerivation=
k}}function Ad(a){return void 0!==a.changeListeners_&&0<a.changeListeners_.length}function be(a,d){var k=a.changeListeners_||(a.changeListeners_=[]);k.push(d);return M(function(){var G=k.indexOf(d);-1!==G&&k.splice(G,1)})}function Od(a,d){var k=Ab();if(a=a.changeListeners_){a=a.slice();for(var G=0,fa=a.length;G<fa;G++)a[G](d);sf.trackingDerivation=k}}function Hf(a,d,k){var G=ud(a,k)[Md];Vc();try{var fa;null!=(fa=d)?fa:d=Oa(a);Dc(d).forEach(function(na){return G.make_(na,d[na])})}finally{jd()}return a}
function kb(a,d,k,G){void 0===k&&(k="ObservableArray");void 0===G&&(G=!1);C();d=new tx(k,d,G,!1);K(d.values_,Md,d);k=new Proxy(d.values_,kE);d.proxy_=k;a&&a.length&&(G=dc(!0),d.spliceWithArray_(0,0,a),sf.allowStateChanges=G);return k}function rb(a,d){"function"===typeof Array.prototype[a]&&(Vv[a]=d(a))}function nb(a){return function(){var d=this[Md];d.atom_.reportObserved();d=d.dehanceValues_(d.values_);return d[a].apply(d,arguments)}}function Ub(a){return function(d,k){var G=this,fa=this[Md];fa.atom_.reportObserved();
return fa.dehanceValues_(fa.values_)[a](function(na,ta){return d.call(k,na,ta,G)})}}function Kb(a){return function(){var d=this,k=this[Md];k.atom_.reportObserved();k=k.dehanceValues_(k.values_);var G=arguments[0];arguments[0]=function(fa,na,ta){return G(fa,na,ta,d)};return k[a].apply(k,arguments)}}function Yc(a){return U(a)&&lE(a[Md])}function Wc(a){if(L(a)||zr(a))return a;if(Array.isArray(a))return new Map(a);if(P(a)){var d=new Map,k;for(k in a)d.set(k,a[k]);return d}return f(21,a)}function ud(a,
d){var k;if(R(a,Md))return a;var G=null!=(k=null==d?void 0:d.name)?k:"ObservableObject";k=Jz;var fa=new Map;G=String(G);var na;var ta=d?null!=(na=d.defaultDecorator)?na:ob(d):void 0;d=new k(a,fa,G,ta);T(a,Md,d);return a}function fe(a){return Iz[a]||(Iz[a]={get:function(){return this[Md].getObservablePropValue_(a)},set:function(d){return this[Md].setObservablePropValue_(a,d)}})}function ke(a){return U(a)?sE(a[Md]):!1}function bf(a){return{enumerable:!1,configurable:!0,get:function(){return this[Md].get_(a)},
set:function(d){this[Md].set_(a,d)}}}function ie(a){if(a>ux){for(var d=ux;d<a+100;d++)yp(vx.prototype,""+d,bf(d));ux=a}}function tf(a,d,k){return new vx(a,d,k)}function pg(a,d){if("object"===typeof a&&null!==a){if(Yc(a))return void 0!==d&&f(23),a[Md].atom_;if(Hs(a))return a[Md];if(zr(a)){if(void 0===d)return a.keysAtom_;var k=a.data_.get(d)||a.hasMap_.get(d);k||f(25,d,qb(a));return k}if(ke(a)){if(!d)return f(26);(k=a[Md].values_.get(d))||f(27,d,qb(a));return k}if(rh(a)||Fu(a)||Uv(a))return a}else if(aa(a)&&
Uv(a[Md]))return a[Md];f(28)}function Eg(a,d){a||f(29);if(void 0!==d)return Eg(pg(a,d));if(rh(a)||Fu(a)||Uv(a)||zr(a)||Hs(a))return a;if(a[Md])return a[Md];f(24,a)}function qb(a,d){if(void 0!==d)a=pg(a,d);else{if(kd(a))return a.name;a=ke(a)||zr(a)||Hs(a)?Eg(a):pg(a)}return a.name_}function za(a,d,k){void 0===k&&(k=-1);return ea(a,d,k)}function ea(a,d,k,G,fa){if(a===d)return 0!==a||1/a===1/d;if(null==a||null==d)return!1;if(a!==a)return d!==d;var na=typeof a;if("function"!==na&&"object"!==na&&"object"!=
typeof d)return!1;na=Lz.call(a);if(na!==Lz.call(d))return!1;switch(na){case "[object RegExp]":case "[object String]":return""+a===""+d;case "[object Number]":return+a!==+a?+d!==+d:0===+a?1/+a===1/d:+a===+d;case "[object Date]":case "[object Boolean]":return+a===+d;case "[object Symbol]":return"undefined"!==typeof Symbol&&Symbol.valueOf.call(a)===Symbol.valueOf.call(d);case "[object Map]":case "[object Set]":0<=k&&k++}a=ua(a);d=ua(d);na="[object Array]"===na;if(!na){if("object"!=typeof a||"object"!=
typeof d)return!1;var ta=a.constructor,Ha=d.constructor;if(ta!==Ha&&!(aa(ta)&&ta instanceof ta&&aa(Ha)&&Ha instanceof Ha)&&"constructor"in a&&"constructor"in d)return!1}if(0===k)return!1;0>k&&(k=-1);G=G||[];fa=fa||[];for(ta=G.length;ta--;)if(G[ta]===a)return fa[ta]===d;G.push(a);fa.push(d);if(na){ta=a.length;if(ta!==d.length)return!1;for(;ta--;)if(!ea(a[ta],d[ta],k-1,G,fa))return!1}else{na=Object.keys(a);ta=na.length;if(Object.keys(d).length!==ta)return!1;for(;ta--;)if(Ha=na[ta],!R(d,Ha)||!ea(a[Ha],
d[Ha],k-1,G,fa))return!1}G.pop();fa.pop();return!0}function ua(a){return Yc(a)?a.slice():L(a)||zr(a)||Q(a)||Hs(a)?Array.from(a.entries()):a}function Na(a){a[Symbol.iterator]=ab;return a}function ab(){return this}function Db(a,d){const k=new Set(d),G=Object.values(a),fa=new Set(G.filter(na=>k.has(na.toId)||k.has(na.fromId)));a=fa.size;for(d=-1;0!==d;)fa.forEach(na=>{na=na.fromId;for(const ta of G)ta.fromId===na&&fa.add(ta),ta.toId===na&&fa.add(ta)}),d=fa.size-a,a=fa.size;return Array.from(fa.values())}
function ic(a,d,k,G,fa,na,ta,Ha){if(fa=d.getBindingPoint(fa,na,ta,Ha))return{id:G,type:"line",fromId:a.id,toId:d.id,handleId:k,point:Pd.toFixed(fa.point),distance:fa.distance}}function Gc(a,d){const k=a.getCenter(),G=d.getCenter();var fa=Ij();fa=Re(Ud({},Iu.defaultProps),{id:fa,type:Iu.id,parentId:a.props.parentId,point:k});a=ic(fa,a,"start",Ij(),k,k,Pd.uni(Pd.sub(G,k)),!1);d=ic(fa,d,"end",Ij(),G,G,Pd.uni(Pd.sub(k,G)),!1);return a&&d?(fa.handles.start.point=[0,0],fa.handles.end.point=Pd.sub(G,k),
fa.handles.start.bindingId=a.id,fa.handles.end.bindingId=d.id,[fa,[a,d]]):null}function Pc(){return new BE}function Rd(){return new WeakMap}function zd(a){if(!a)return Dx(null);var d=a.constructor;if(d===Object)return a===Object.prototype?{}:Dx(a);if(~zE.call(d).indexOf("[native code]"))try{return new d}catch(k){}return Dx(a)}function Ie(a){var d="";a.global&&(d+="g");a.ignoreCase&&(d+="i");a.multiline&&(d+="m");a.unicode&&(d+="u");a.sticky&&(d+="y");return d}function Oe(a){return a.flags}function Ye(a){a=
AE.call(a);return a.substring(8,a.length-1)}function Me(a){return a[Symbol.toStringTag]||Ye(a)}function Ff(a){return xA(a).concat(Ex(a))}function If(a,d,k){for(var G=IE(a),fa=0,na=G.length,ta,Ha;fa<na;++fa)if(ta=G[fa],"callee"!==ta&&"caller"!==ta)if(Ha=GE(a,ta)){Ha.get||Ha.set||(Ha.value=k.copier(Ha.value,k));try{FE(d,ta,Ha)}catch(Sa){d[ta]=Ha.value}}else d[ta]=k.copier(a[ta],k);return d}function jg(a,d){var k=new d.Constructor;d.cache.set(a,k);a.forEach(function(G,fa){k.set(fa,d.copier(G,d))});return k}
function Jf(a,d){var k=zd(d.prototype);d.cache.set(a,k);for(var G in a)zA.call(a,G)&&(k[G]=d.copier(a[G],d));return k}function tg(a,d){var k=zd(d.prototype);d.cache.set(a,k);for(var G in a)zA.call(a,G)&&(k[G]=d.copier(a[G],d));G=Ex(a);for(var fa=0,na=G.length,ta;fa<na;++fa)ta=G[fa],HE.call(a,ta)&&(k[ta]=d.copier(a[ta],d));return k}function Zh(a,d){return new d.Constructor(a.valueOf())}function Og(a,d){return a}function pi(a,d){var k=new d.Constructor;d.cache.set(a,k);a.forEach(function(G){k.add(d.copier(G,
d))});return k}function ji(a){function d(na,ta){ta.prototype=ta.Constructor=void 0;if(!na||"object"!==typeof na)return na;if(ta.cache.has(na))return ta.cache.get(na);ta.prototype=na.__proto__||KE(na);ta.Constructor=ta.prototype&&ta.prototype.constructor;if(!ta.Constructor||ta.Constructor===Object)return fa(na,ta);if(JE(na))return G(na,ta);var Ha=k[EE(na)];return Ha?Ha(na,ta):"function"===typeof na.then?na:fa(na,ta)}a=Fx({},BA,a);var k={Arguments:a.object,Array:a.array,ArrayBuffer:a.arrayBuffer,Blob:a.blob,
Boolean:Zh,DataView:a.dataView,Date:a.date,Error:a.error,Float32Array:a.arrayBuffer,Float64Array:a.arrayBuffer,Int8Array:a.arrayBuffer,Int16Array:a.arrayBuffer,Int32Array:a.arrayBuffer,Map:a.map,Number:Zh,Object:a.object,Promise:Og,RegExp:a.regExp,Set:a.set,String:Zh,WeakMap:Og,WeakSet:Og,Uint8Array:a.arrayBuffer,Uint8ClampedArray:a.arrayBuffer,Uint16Array:a.arrayBuffer,Uint32Array:a.arrayBuffer,Uint64Array:a.arrayBuffer},G=k.Array,fa=k.Object;return function(na){return d(na,{Constructor:void 0,cache:CE(),
copier:d,prototype:void 0})}}function xj(a,d){return(0,OE.default)(a,d,{arrayMerge:(k,G,fa)=>G})}function Oj(a,d,k,G=!1){const [fa,na]=d,[ta,Ha]=k;a=ta+(a-fa)/(na-fa)*(Ha-ta);return G?ta<Ha?Math.max(Math.min(a,Ha),ta):Math.max(Math.min(a,ta),Ha):a}function rj(a,d){return new Promise((k,G)=>{if("video"===d){const fa=document.createElement("video");fa.addEventListener("loadedmetadata",function(){k([this.videoWidth,this.videoHeight])},!1);fa.src=a}else if("image"===d){const fa=new Image;fa.onload=()=>
k([fa.width,fa.height]);fa.src=a;fa.onerror=na=>G(na)}else"pdf"===d&&k([595,842])})}function Oi(a){return Object.values(is).includes(a)}function th(a,d){return Oi(a)||null==a?`var(--ls-wb-${d}-color-${a?a:"default"})`:a}function Bk(){var a;null==(a=document.getElementById("__textLabelMeasure"))?void 0:a.remove();a=document.createElement("pre");a.id="__textLabelMeasure";Object.assign(a.style,{whiteSpace:"pre",width:"auto",borderLeft:"2px solid transparent",borderRight:"1px solid transparent",borderBottom:"2px solid transparent",
padding:"0px",margin:"0px",opacity:"0",position:"absolute",top:"-500px",left:"0px",zIndex:"9999",userSelect:"none",pointerEvents:"none",font:"var(--ls-font-family)"});a.tabIndex=-1;document.body.appendChild(a);return a}function yj(a,d,k=0){var G,fa,na;if(!a)return[16,32];let ta;ta="string"===typeof d?d:`${null!=(G=d.fontStyle)?G:"normal"} ${null!=(fa=d.fontVariant)?fa:"normal"} ${null!=(na=d.fontWeight)?na:"normal"} ${d.fontSize}px/${d.fontSize*d.lineHeight}px ${d.fontFamily}`;if(!Gx.has(`${a}-${ta}-${k}`)){if(!Dr)return[10,
10];Dr.parentNode||document.body.appendChild(Dr);Dr.innerHTML=`${a}&#8203;`;Dr.style.font=ta;Dr.style.padding=k+"px";d=Dr.getBoundingClientRect();Gx.set(`${a}-${ta}-${k}`,[Math.ceil(d.width||1),Math.ceil(d.height||1)])}return Gx.get(`${a}-${ta}-${k}`)}function Hl(a){try{if("string"!==typeof a||!og.test(a))throw TypeError("Invalid UUID");let d;const k=new Uint8Array(16);k[0]=(d=parseInt(a.slice(0,8),16))>>>24;k[1]=d>>>16&255;k[2]=d>>>8&255;k[3]=d&255;k[4]=(d=parseInt(a.slice(9,13),16))>>>8;k[5]=d&
255;k[6]=(d=parseInt(a.slice(14,18),16))>>>8;k[7]=d&255;k[8]=(d=parseInt(a.slice(19,23),16))>>>8;k[9]=d&255;k[10]=(d=parseInt(a.slice(24,36),16))/1099511627776&255;k[11]=d/4294967296&255;k[12]=d>>>24&255;k[13]=d>>>16&255;k[14]=d>>>8&255;k[15]=d&255;return!0}catch(d){return!1}}function ul(a,d=0,k){let G;return function(...fa){null==k?void 0:k(...fa);clearTimeout(G);G=setTimeout(()=>a.apply(fa),d)}}function ih(){return/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)}function wf(){var a,d,k;return(null==
(k=null==(d=null==(a=null==window?void 0:window.logseq)?void 0:a.api)?void 0:d.get_state_from_store)?void 0:k.call(d,"ui/developer-mode?"))||!1}function Zf(a){return!!a}function vl(a=0){return new Promise(d=>setTimeout(d,a))}function Il(a="noid"){Hx[a]||(Hx[a]=EA.createContext({}));return Hx[a]}function Pe(a="noid"){return EA.useContext(Il(a))}function ek(a){const {callbacks:d}=Pe(),k=DA.useRef(-1);return DA.useMemo(()=>{const G=fa=>{var na,ta;const {order:Ha=0}=fa;if(!Ha){var Sa=fa.target;Sa.removeEventListener("pointerup",
G);Sa.releasePointerCapture(fa.pointerId);null==(na=d.onPointerUp)?void 0:na.call(d,{type:"selection",handle:a,order:Ha},fa);na=Date.now();Sa=na-k.current;300<Sa?k.current=na:300>=Sa&&(null==(ta=d.onDoubleClick)?void 0:ta.call(d,{type:"selection",handle:a,order:Ha},fa),k.current=-1);fa.order=Ha+1}};return{onPointerDown:fa=>{var na;const {order:ta=0}=fa;if(!ta){var Ha=pn(fa.currentTarget);Ha.setPointerCapture(fa.pointerId);Ha.addEventListener("pointerup",G);null==(na=d.onPointerDown)?void 0:na.call(d,
{type:"selection",handle:a,order:ta},fa);fa.order=ta+1}},onPointerMove:fa=>{var na;const {order:ta=0}=fa;ta||(null==(na=d.onPointerMove)?void 0:na.call(d,{type:"selection",handle:a,order:ta},fa),fa.order=ta+1)},onPointerEnter:fa=>{var na;const {order:ta=0}=fa;ta||(null==(na=d.onPointerEnter)?void 0:na.call(d,{type:"selection",handle:a,order:ta},fa),fa.order=ta+1)},onPointerLeave:fa=>{var na;const {order:ta=0}=fa;ta||(null==(na=d.onPointerLeave)?void 0:na.call(d,{type:"selection",handle:a,order:ta},
fa),fa.order=ta+1)},onKeyDown:fa=>{var na;null==(na=d.onKeyDown)?void 0:na.call(d,{type:"selection",handle:a,order:-1},fa)},onKeyUp:fa=>{var na;null==(na=d.onKeyUp)?void 0:na.call(d,{type:"selection",handle:a,order:-1},fa)}}},[d])}function pn(a){var d;if(null==(d=a.namespaceURI)?0:d.endsWith("svg")){if(a.parentElement)return pn(a.parentElement);throw Error("Could not find a parent element of an HTML type!");}return a}function fk(a,d,k){const G=Ku.useRef(!1),fa=Ku.useCallback(()=>{var na;if(G.current){const ta=
null==(na=a.current)?void 0:na.getBoundingClientRect();ta&&(na={minX:ta.left,maxX:ta.left+ta.width,minY:ta.top,maxY:ta.top+ta.height,width:ta.width,height:ta.height},d.updateBounds(na),null==k?void 0:k(na))}else G.current=!0},[a,k]);Ku.useEffect(()=>{const na=a.current?RE(a.current):document,ta=ul(fa,100);na.addEventListener("scroll",ta);window.addEventListener("resize",ta);return()=>{na.removeEventListener("scroll",ta);window.removeEventListener("resize",ta)}},[]);Ku.useLayoutEffect(()=>{const na=
new ResizeObserver(ta=>{ta[0].contentRect&&fa()});a.current&&na.observe(a.current);return()=>{na.disconnect()}},[a]);Ku.useEffect(()=>{fa();setTimeout(()=>{var na,ta;null==(ta=null==(na=a.current)?void 0:na.querySelector(".tl-canvas"))?void 0:ta.focus()})},[a])}function sm(a,d){return Object.keys(d).reduce((k,G)=>{const fa=d[G];return fa?k+`${`--${a}-${G}`}: ${fa};
`:k},"")}function Eh(a,d,k=".logseq-tldraw"){Ix.useLayoutEffect(()=>{const G=document.createElement("style"),fa=sm(a,d);G.setAttribute("id",`${a}-theme`);G.setAttribute("data-selector",k);G.innerHTML=`
${k} {
${fa}
}
`;document.head.appendChild(G);return()=>{G&&document.head.contains(G)&&document.head.removeChild(G)}},[a,d,k])}function gk(a,d){Ix.useLayoutEffect(()=>{if(Jx.get(a))return()=>{};const k=document.createElement("style");k.innerHTML=d;k.setAttribute("id",a);document.head.appendChild(k);Jx.set(a,k);return()=>{k&&document.head.contains(k)&&(document.head.removeChild(k),Jx.delete(a))}},[a,d])}function Jl(a,d){const k=Ix.useMemo(()=>Ud(Ud({},SE),a),[a]);Eh("tl",k,d);gk("tl-canvas",TE)}function Kk(a=
"noid"){Kx[a]||(Kx[a]=GA.createContext({}));return Kx[a]}function kg(a="noid"){return GA.useContext(Kk(a))}function rg(){const a=kg(),{callbacks:d}=Pe(),k=FA.useRef(-1);return FA.useMemo(()=>({onPointerDown:G=>{var fa,na,ta;if(!a.settings.penMode||"pen"===G.pointerType&&G.isPrimary){var {order:Ha=0}=G;Ha||(null==(fa=G.currentTarget)?void 0:fa.setPointerCapture(G.pointerId));G.isPrimary&&(null==(na=d.onPointerDown)?void 0:na.call(d,{type:"canvas",order:Ha},G),fa=Date.now(),na=fa-k.current,300<na?k.current=
fa:300>=na&&(null==(ta=d.onDoubleClick)?void 0:ta.call(d,{type:"canvas",order:Ha},G),k.current=-1))}},onPointerMove:G=>{var fa;if(!a.settings.penMode||"pen"===G.pointerType&&G.isPrimary){var {order:na=0}=G;null==(fa=d.onPointerMove)?void 0:fa.call(d,{type:"canvas",order:na},G)}},onPointerUp:G=>{var fa,na;if(!a.settings.penMode||"pen"===G.pointerType&&G.isPrimary){var {order:ta=0}=G;ta||(null==(fa=G.currentTarget)?void 0:fa.releasePointerCapture(G.pointerId));null==(na=d.onPointerUp)?void 0:na.call(d,
{type:"canvas",order:ta},G)}},onPointerEnter:G=>{var fa;if(!a.settings.penMode||"pen"===G.pointerType&&G.isPrimary){var {order:na=0}=G;null==(fa=d.onPointerEnter)?void 0:fa.call(d,{type:"canvas",order:na},G)}},onPointerLeave:G=>{var fa;if(!a.settings.penMode||"pen"===G.pointerType&&G.isPrimary){var {order:na=0}=G;null==(fa=d.onPointerLeave)?void 0:fa.call(d,{type:"canvas",order:na},G)}},onDrop:G=>Nh(this,null,function*(){G.preventDefault();"clientX"in G&&a.drop(G.dataTransfer,[G.clientX,G.clientY])}),
onDragOver:G=>{G.preventDefault()},onTouchEnd:G=>{let fa=a.selectedTool.id;"pencil"!==fa&&"highlighter"!==fa||G.preventDefault()}}),[d])}function ki(a,d,k){return 0===d||Infinity===Math.abs(d)?Math.pow(a,5*k):a*d*k/(d+k*a)}function Ri(a,d,k,G=.15){return 0===G?Math.max(d,Math.min(a,k)):a<d?-ki(d-a,k-d,G)+d:a>k?+ki(a-k,k-d,G)+k:a}function oh(a,[d,k],[G,fa]){const [[na,ta],[Ha,Sa]]=a;return[Ri(d,na,ta,G),Ri(k,Ha,Sa,fa)]}function li(a,d,k){d in a?Object.defineProperty(a,d,{value:k,enumerable:!0,configurable:!0,
writable:!0}):a[d]=k;return a}function ej(a,d){var k=Object.keys(a);if(Object.getOwnPropertySymbols){var G=Object.getOwnPropertySymbols(a);d&&(G=G.filter(function(fa){return Object.getOwnPropertyDescriptor(a,fa).enumerable}));k.push.apply(k,G)}return k}function Pg(a){for(var d=1;d<arguments.length;d++){var k=null!=arguments[d]?arguments[d]:{};d%2?ej(Object(k),!0).forEach(function(G){li(a,G,k[G])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(k)):ej(Object(k)).forEach(function(G){Object.defineProperty(a,
G,Object.getOwnPropertyDescriptor(k,G))})}return a}function Mh(a){return a?a[0].toUpperCase()+a.slice(1):""}function qi(a=!1,d){return a&&!UE.includes(d)}function Nm(a,d="",k=!1){const G=HA[a];d=G?G[d]||d:d;return"on"+Mh(a)+Mh(d)+(qi(k,d)?"Capture":"")}function zf(a){a=a.substring(2).toLowerCase();const d=!!~a.indexOf("passive");d&&(a=a.replace("passive",""));var k=VE.includes(a)?"capturecapture":"capture";(k=!!~a.indexOf(k))&&(a=a.replace("capture",""));return{device:a,capture:k,passive:d}}function fj(a,
d=""){const k=HA[a];return a+(k?k[d]||d:d)}function xh(a){return"touches"in a?"touch":"pointerType"in a?a.pointerType:"mouse"}function $k(a){return Array.from(a.touches).filter(d=>{var k,G;return d.target===a.currentTarget||(null===(k=a.currentTarget)||void 0===k?void 0:null===(G=k.contains)||void 0===G?void 0:G.call(k,d.target))})}function zj(a){return"touches"in a?("touchend"===a.type||"touchcancel"===a.type?a.changedTouches:a.targetTouches)[0]:a}function Om(a,d){const k=d.clientX-a.clientX,G=d.clientY-
a.clientY;return{angle:-(180*Math.atan2(k,G))/Math.PI,distance:Math.hypot(k,G),origin:[(d.clientX+a.clientX)/2,(d.clientY+a.clientY)/2]}}function al(a){return $k(a).map(d=>d.identifier)}function Zi(a,d){const [k,G]=Array.from(a.touches).filter(fa=>d.includes(fa.identifier));return Om(k,G)}function Zl(a){const d=zj(a);return"touches"in a?d.identifier:d.pointerId}function Ck(a){a=zj(a);return[a.clientX,a.clientY]}function Qj(a){let {deltaX:d,deltaY:k,deltaMode:G}=a;1===G?(d*=40,k*=40):2===G&&(d*=800,
k*=800);return[d,k]}function Jg(a,...d){return"function"===typeof a?a(...d):a}function $h(){}function mi(...a){return 0===a.length?$h:1===a.length?a[0]:function(){let d;for(const k of a)d=k.apply(this,arguments)||d;return d}}function $l([a,d],k){a=Math.abs(a);d=Math.abs(d);if(a>d&&a>k)return"x";if(d>a&&d>k)return"y"}function Pm(a){const [d,k]=a.overflow,[G,fa]=a._delta,[na,ta]=a._direction;if(0>d&&0<G&&0>na||0<d&&0>G&&0<na)a._movement[0]=a._movementBound[0];if(0>k&&0<fa&&0>ta||0<k&&0>fa&&0<ta)a._movement[1]=
a._movementBound[1]}function yh(a){Lx.set(a.key,a.engine);Mx.set(a.key,a.resolver)}function wl(a={},d){const k={};for(const [G,fa]of Object.entries(d))switch(typeof fa){case "function":k[G]=fa.call(k,a[G],G,a);break;case "object":k[G]=wl(a[G],fa);break;case "boolean":fa&&(k[G]=a[G])}return k}function sj(a,d,k={}){const {target:G,eventOptions:fa,window:na,enabled:ta,transform:Ha}=a;var Sa=rF;if(null==a)a={};else{if(null==a)var Za={};else{Za={};var fb=Object.keys(a),ib;for(ib=0;ib<fb.length;ib++){var Bb=
fb[ib];0<=Sa.indexOf(Bb)||(Za[Bb]=a[Bb])}}if(Object.getOwnPropertySymbols)for(ib=Object.getOwnPropertySymbols(a),Bb=0;Bb<ib.length;Bb++)fb=ib[Bb],0<=Sa.indexOf(fb)||Object.prototype.propertyIsEnumerable.call(a,fb)&&(Za[fb]=a[fb]);a=Za}k.shared=wl({target:G,eventOptions:fa,window:na,enabled:ta,transform:Ha},qF);if(d){var Ob=Mx.get(d);k[d]=wl(Pg({shared:k.shared},a),Ob)}else for(Ob in a)(d=Mx.get(Ob))&&(k[Ob]=wl(Pg({shared:k.shared},a[Ob]),d));return k}function hj(a,d){a.gestures.add(d);a.gestureEventStores[d]=
new PA(a,d);a.gestureTimeoutStores[d]=new sF}function Ti(a,d,k,G,fa,na){if(a.has(k)&&Lx.has(G)){var ta=k+"Start",Ha=k+"End";fa[G]=Sa=>{let Za=void 0;if(Sa.first&&ta in d)d[ta](Sa);k in d&&(Za=d[k](Sa));if(Sa.last&&Ha in d)d[Ha](Sa);return Za};na[G]=na[G]||{}}}function jj(a,d={},k,G){const fa=Nx.default.useMemo(()=>new tF(a),[]);fa.applyHandlers(a,G);fa.applyConfig(d,k);Nx.default.useEffect(fa.effect.bind(fa));Nx.default.useEffect(()=>fa.clean.bind(fa),[]);if(void 0===d.target)return fa.bind.bind(fa)}
function Rh(a){a.forEach(yh);return function(d,k){k=k||{};const G={},fa={},na=new Set;for(let Bb in d)uF.test(Bb)?(na.add(RegExp.lastMatch),fa[Bb]=d[Bb]):G[Bb]=d[Bb];const [ta,Ha,Sa]=[fa,G,na];d={};Ti(Sa,ta,"onDrag","drag",d,k);Ti(Sa,ta,"onWheel","wheel",d,k);Ti(Sa,ta,"onScroll","scroll",d,k);Ti(Sa,ta,"onPinch","pinch",d,k);Ti(Sa,ta,"onMove","move",d,k);Ti(Sa,ta,"onHover","hover",d,k);const {handlers:Za,nativeHandlers:fb,config:ib}={handlers:d,config:k,nativeHandlers:Ha};return jj(Za,ib,void 0,fb)}}
function kj(a,d){return Rh([kF,nF,oF,pF,mF,lF])(a,d||{})}function Aj(a){const {viewport:d,inputs:k,callbacks:G}=Pe(),fa=$v.useRef(void 0),na=$v.useRef([0,0]),ta=$v.useRef(0),Ha=$v.useMemo(()=>({onWheel:Sa=>{var Za;({event:Sa}=Sa);Sa.preventDefault();const {deltaY:fb,deltaX:ib}=Sa;var Bb=0;if(Sa.ctrlKey||Sa.metaKey){Bb=Math.sign(Sa.deltaY);let oc=fb;10<Math.abs(Sa.deltaY)&&(oc=10*Bb);Bb=oc}const [Ob,Fb,cc]=[ib,fb,Bb];"pinching"===k.state||ta.current>=Sa.timeStamp||(ta.current=Sa.timeStamp,(Sa.altKey||
Sa.ctrlKey||Sa.metaKey)&&0===Sa.buttons?(Bb=d.bounds,Sa=null!=(Za=k.currentScreenPoint)?Za:[Bb.width/2,Bb.height/2],Za=d.camera.zoom,d.onZoom(Sa,Za-cc/100*Za)):(Za=Pd.mul(Sa.shiftKey&&!ih()?[Fb,0]:[Ob,Fb],.8),Pd.isEqual(Za,[0,0])||d.panCamera(Za)))},onPinchStart:({event:Sa,delta:Za,offset:fb,origin:ib})=>{var Bb;const Ob=a.current;Sa instanceof WheelEvent||!(Sa.target===Ob||null!=Ob&&Ob.contains(Sa.target))||(null==(Bb=G.onPinchStart)?void 0:Bb.call(G,{type:"canvas",order:0,delta:[...Za,fb[0]],offset:fb,
point:Pd.sub(ib,k.containerOffset)},Sa),fa.current=ib,na.current=[0,0])},onPinchEnd:({event:Sa,offset:Za,origin:fb})=>{var ib;const Bb=a.current;Sa instanceof WheelEvent||!(Sa.target===Bb||null!=Bb&&Bb.contains(Sa.target))||"pinching"!==k.state||(null==(ib=G.onPinchEnd)?void 0:ib.call(G,{type:"canvas",order:0,delta:[0,0,Za[0]],offset:Za,point:Pd.sub(fb,k.containerOffset)},Sa),na.current=[0,0])},onPinch:({event:Sa,offset:Za,origin:fb})=>{var ib,Bb=a.current;if(!(Sa instanceof WheelEvent)&&(Sa.target===
Bb||null!=Bb&&Bb.contains(Sa.target))){fa.current||(fa.current=fb);Bb=Pd.sub(fa.current,fb);var Ob=Pd.sub(Bb,na.current);null==(ib=G.onPinch)?void 0:ib.call(G,{type:"canvas",order:0,delta:[...Ob,Za[0]],offset:Za,point:Pd.sub(fb,k.containerOffset)},Sa);na.current=Bb}}}),[G]);kj(Ha,{target:a,eventOptions:{passive:!1},pinch:{from:[d.camera.zoom,d.camera.zoom],scaleBounds:()=>({from:d.camera.zoom,max:ep.maxZoom,min:ep.minZoom})}})}function ik(a,d,k,G){Ox.useLayoutEffect(()=>{a.current.style.transform=
`translate(
calc(${d.minX}px - var(--tl-padding)),
calc(${d.minY}px - var(--tl-padding)))
scale(var(--tl-scale))`},[d.minX,d.minY,k,d.rotation]);Ox.useLayoutEffect(()=>{const fa=a.current;fa.style.width=`calc(${Math.floor(d.width)}px + (var(--tl-padding) * 2))`;fa.style.height=`calc(${Math.floor(d.height)}px + (var(--tl-padding) * 2))`},[d.width,d.height]);Ox.useLayoutEffect(()=>{const fa=a.current;void 0!==G&&(fa.style.zIndex=G.toString())},[G])}function uo(a,d){const {onPersist:k,onError:G,onMount:fa,onCreateAssets:na,onCreateShapes:ta,onDeleteAssets:Ha,onDeleteShapes:Sa,onDrop:Za,
onPaste:fb,onCopy:ib,onCanvasDBClick:Bb}=d;RA.useLayoutEffect(()=>{const Ob=[];if(a)return window.tlapps=window.tlapps||{},window.tlapps[a.uuid]=a,fa&&fa(a,null),()=>{Ob.forEach(Fb=>Fb());window.tlapps&&delete window.tlapps[a.uuid]}},[a]);RA.useLayoutEffect(()=>{const Ob=[];k&&Ob.push(a.subscribe("persist",k));G&&Ob.push(a.subscribe("error",G));ta&&Ob.push(a.subscribe("create-shapes",ta));na&&Ob.push(a.subscribe("create-assets",na));Sa&&Ob.push(a.subscribe("delete-shapes",Sa));Ha&&Ob.push(a.subscribe("delete-assets",
Ha));Za&&Ob.push(a.subscribe("drop",Za));fb&&Ob.push(a.subscribe("paste",fb));ib&&Ob.push(a.subscribe("copy",ib));Bb&&Ob.push(a.subscribe("canvas-dbclick",Bb));return()=>Ob.forEach(Fb=>Fb())},[a,k,G])}function Yn(a){if("app"in a)return a.app;const [d]=SA.useState(()=>new PE(a.model,a.Shapes,a.Tools,a.readOnly));SA.useLayoutEffect(()=>()=>{d.dispose()},[d]);return d}function Lk(a,d){vF.useEffect(()=>{"model"in d&&d.model&&a.loadDocumentModel(d.model)},[d.model])}function Qm(a){const d=Pe(),{viewport:{bounds:k}}=
d;wF.useEffect(()=>{const G=ta=>{ta.preventDefault()},fa=ta=>{if(0!==ta.touches.length){var Ha=ta.touches[0].pageX,Sa=ta.touches[0].radiusX||0;(10>Ha-Sa||Ha+Sa>k.width-10)&&ta.preventDefault()}},na=a.current;if(!na)return()=>{};na.addEventListener("touchstart",G,{passive:!0});na.addEventListener("gestureend",G,{passive:!0});na.addEventListener("gesturechange",G,{passive:!0});na.addEventListener("gesturestart",G,{passive:!0});na.addEventListener("touchstart",fa,{passive:!0});return()=>{na&&(na.removeEventListener("touchstart",
G),na.removeEventListener("gestureend",G),na.removeEventListener("gesturechange",G),na.removeEventListener("gesturestart",G),na.removeEventListener("touchstart",fa))}},[a,k.width])}function up(a,d){const {inputs:k,callbacks:G}=Pe();return xF.useMemo(()=>({onPointerDown:fa=>{var na,ta;const {order:Ha=0}=fa;Ha||(null==(na=fa.currentTarget)?void 0:na.setPointerCapture(fa.pointerId));na=a.props.handles[d];null==(ta=G.onPointerDown)?void 0:ta.call(G,{type:"handle",shape:a,handle:na,id:d,order:Ha},fa);
fa.order=Ha+1},onPointerMove:fa=>{var na;const {order:ta=0}=fa,Ha=a.props.handles[d];null==(na=G.onPointerMove)?void 0:na.call(G,{type:"handle",shape:a,handle:Ha,id:d,order:ta},fa);fa.order=ta+1},onPointerUp:fa=>{var na,ta;const {order:Ha=0}=fa;Ha||(null==(na=fa.currentTarget)?void 0:na.releasePointerCapture(fa.pointerId));na=a.props.handles[d];null==(ta=G.onPointerUp)?void 0:ta.call(G,{type:"handle",shape:a,handle:na,id:d,order:Ha},fa);fa.order=Ha+1},onPointerEnter:fa=>{var na;const {order:ta=0}=
fa,Ha=a.props.handles[d];null==(na=G.onPointerEnter)?void 0:na.call(G,{type:"handle",shape:a,handle:Ha,id:d,order:ta},fa);fa.order=ta+1},onPointerLeave:fa=>{var na;const {order:ta=0}=fa,Ha=a.props.handles[d];null==(na=G.onPointerLeave)?void 0:na.call(G,{type:"handle",shape:a,handle:Ha,id:d,order:ta},fa);fa.order=ta+1},onKeyUp:fa=>{var na;const ta=a.props.handles[d];null==(na=G.onKeyUp)?void 0:na.call(G,{type:"handle",shape:a,handle:ta,id:d,order:-1},fa)},onKeyDown:fa=>{var na;const ta=a.props.handles[d];
null==(na=G.onKeyDown)?void 0:na.call(G,{type:"handle",shape:a,handle:ta,id:d,order:-1},fa)}}),[a.id,k,G])}function Sj(a,d,k=!1){return`url("data:image/svg+xml,<svg height='32' width='32' viewBox='0 0 35 35' xmlns='http://www.w3.org/2000/svg'><g fill='none' style='transform-origin:center center' transform='rotate(${d})${k?" scale(-1,-1) translate(0, -32)":""}'>`+a.replaceAll('"',"'")+'\x3c/g\x3e\x3c/svg\x3e") 16 16, pointer'}function xl(a,d,k=0){yF.useEffect(()=>{const G=a.current;G&&(G.style.cursor=
zF[d](Wl.radiansToDegrees(k)))},[d,k])}function Ek(a){const {viewport:d}=Pe(),k=kg();AF.useLayoutEffect(()=>wd(()=>{const G=ul(()=>{var fa;null==(fa=a.current)?void 0:fa.style.setProperty("--tl-zoom",d.camera.zoom.toString())},200);"pinching"!==k.inputs.state&&null!=d.camera.zoom&&G()}),[])}function En(a,d=0){const [k,G]=(0,TA.useState)(a);(0,TA.useEffect)(()=>{let fa=!1;const na=setTimeout(()=>{fa||G(a)},d);return()=>{fa=!0;clearTimeout(na)}},[a,d]);return k}function am(){const a=kg();UA.useEffect(()=>
{Qd(()=>Ud({},a.viewport.camera),()=>{window.sessionStorage.setItem("logseq.tldraw.camera:"+a.currentPageId,JSON.stringify(a.viewport.camera))})},[a.viewport.camera]);UA.useEffect(()=>{var d;const k=JSON.parse(null!=(d=window.sessionStorage.getItem("logseq.tldraw.camera:"+a.currentPageId))?d:"null");k?a.viewport.update(k):a.selectedIds.size?a.api.zoomToSelection():a.api.zoomToFit()},[a])}function Rm(a){a()}function hk(a){return mh(pg(a,void 0))}function Sm(a){return{reaction:a,mounted:!1,changedBeforeMount:!1,
cleanAt:Date.now()+CF}}function Rg(a){var d=new Map,k=1,G=new a(function(fa){var na=d.get(fa);na&&(na.reaction.dispose(),d.delete(fa))});return{addReactionToTrack:function(fa,na,ta){var Ha=k++;G.register(ta,Ha,fa);fa.current=Sm(na);fa.current.finalizationRegistryCleanupToken=Ha;d.set(Ha,fa.current);return fa.current},recordReactionAsCommitted:function(fa){G.unregister(fa);fa.current&&fa.current.finalizationRegistryCleanupToken&&d.delete(fa.current.finalizationRegistryCleanupToken)},forceCleanupTimerToRunNowForTests:function(){},
resetCleanupScheduleForTests:function(){}}}function um(){function a(){void 0===G&&(G=setTimeout(d,1E4))}function d(){G=void 0;var fa=Date.now();k.forEach(function(na){var ta=na.current;ta&&fa>=ta.cleanAt&&(ta.reaction.dispose(),na.current=null,k.delete(na))});0<k.size&&a()}var k=new Set,G;return{addReactionToTrack:function(fa,na,ta){fa.current=Sm(na);k.add(fa);a();return fa.current},recordReactionAsCommitted:function(fa){k.delete(fa)},forceCleanupTimerToRunNowForTests:function(){G&&(clearTimeout(G),
d())},resetCleanupScheduleForTests:function(){var fa;if(0<k.size){try{for(var na=DF(k),ta=na.next();!ta.done;ta=na.next()){var Ha=ta.value,Sa=Ha.current;Sa&&(Sa.reaction.dispose(),Ha.current=null)}}catch(fb){var Za={error:fb}}finally{try{ta&&!ta.done&&(fa=na.return)&&fa.call(na)}finally{if(Za)throw Za.error;}}k.clear()}G&&(clearTimeout(G),G=void 0)}}}function vh(){return new GF}function tj(a,d){void 0===d&&(d="observed");var k=XA(Nu.default.useState(vh),1)[0],G=XA(Nu.default.useState(),2)[1],fa=Nu.default.useRef(null);
if(!fa.current)var na=new At("observer".concat(d),function(){ta.mounted?G([]):ta.changedBeforeMount=!0}),ta=EF(fa,na,k);k=fa.current.reaction;Nu.default.useDebugValue(k,hk);Nu.default.useEffect(function(){FF(fa);fa.current?(fa.current.mounted=!0,fa.current.changedBeforeMount&&(fa.current.changedBeforeMount=!1,G([]))):(fa.current={reaction:new At("observer".concat(d),function(){G([])}),mounted:!0,changedBeforeMount:!1,cleanAt:Infinity},G([]));return function(){fa.current.reaction.dispose();fa.current=
null}},[]);var Ha,Sa;k.track(function(){try{Ha=a()}catch(Za){Sa=Za}});if(Sa)throw Sa;return Ha}function Ze(a,d){var k;if($A&&a.$$typeof===$A)throw Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");d=null!==(k=null===d||void 0===d?void 0:d.forwardRef)&&void 0!==k?k:!1;var G=a,fa=a.displayName||a.name;if(ZA&&a.$$typeof===ZA&&(d=!0,G=a.render,"function"!==typeof G))throw Error("[mobx-react-lite] `render` property of ForwardRef was not a function");
k=function(na,ta){return tj(function(){return G(na,ta)},fa)};""!==fa&&(k.displayName=fa);a.contextTypes&&(k.contextTypes=a.contextTypes);d&&(k=(0,Jt.forwardRef)(k));k=(0,Jt.memo)(k);Si(a,k);return k}function Si(a,d){Object.keys(a).forEach(function(k){HF[k]||Object.defineProperty(d,k,Object.getOwnPropertyDescriptor(a,k))})}function Bj(a){var d=a.render;a=a.children||d;return"function"!==typeof a?null:tj(a)}function Fn(a){const d=kg(),{callbacks:k}=Pe(),G=aB.useRef(!1);aB.useEffect(()=>{const fa=Sa=>
{var Za,fb;if(null==(Za=a.current)?0:Za.contains(document.activeElement))null==(fb=k.onKeyDown)?void 0:fb.call(k,{type:"canvas",order:-1},Sa),G.current=Sa.shiftKey},na=Sa=>{var Za,fb;if(null==(Za=a.current)?0:Za.contains(document.activeElement))null==(fb=k.onKeyUp)?void 0:fb.call(k,{type:"canvas",order:-1},Sa),G.current=Sa.shiftKey},ta=Sa=>{var Za,fb,ib;!d.editingShape&&(null==(Za=a.current)?0:Za.contains(document.activeElement))&&!["INPUT","TEXTAREA"].includes(null!=(ib=null==(fb=document.activeElement)?
void 0:fb.tagName)?ib:"")&&(Sa.preventDefault(),d.paste(Sa,G.current))},Ha=Sa=>{var Za,fb,ib;!d.editingShape&&0<d.selectedShapes.size&&(null==(Za=a.current)?0:Za.contains(document.activeElement))&&!["INPUT","TEXTAREA"].includes(null!=(ib=null==(fb=document.activeElement)?void 0:fb.tagName)?ib:"")&&(Sa.preventDefault(),d.copy())};window.addEventListener("keydown",fa);window.addEventListener("keyup",na);document.addEventListener("paste",ta);document.addEventListener("copy",Ha);return()=>{window.removeEventListener("keydown",
fa);window.removeEventListener("keyup",na);document.removeEventListener("paste",ta);document.removeEventListener("copy",Ha)}},[])}function yl(a){const d=kg(),{inputs:k,callbacks:G}=Pe(),fa=fB.useRef(-1);return fB.useMemo(()=>({onPointerDown:na=>{var ta,Ha;if(!d.settings.penMode||"pen"===na.pointerType&&na.isPrimary){var {order:Sa=0}=na;Sa||(null==(ta=na.currentTarget)?void 0:ta.setPointerCapture(na.pointerId));null==(Ha=G.onPointerDown)?void 0:Ha.call(G,{type:"shape",shape:a,order:Sa},na);na.order=
Sa+1}},onPointerMove:na=>{var ta;if(!d.settings.penMode||"pen"===na.pointerType&&na.isPrimary){var {order:Ha=0}=na;null==(ta=G.onPointerMove)?void 0:ta.call(G,{type:"shape",shape:a,order:Ha},na);na.order=Ha+1}},onPointerUp:na=>{var ta,Ha,Sa;if(!d.settings.penMode||"pen"===na.pointerType&&na.isPrimary){var {order:Za=0}=na;Za||(null==(ta=na.currentTarget)?void 0:ta.releasePointerCapture(na.pointerId));null==(Ha=G.onPointerUp)?void 0:Ha.call(G,{type:"shape",shape:a,order:Za},na);ta=Date.now();Ha=ta-
fa.current;300<Ha?fa.current=ta:300>=Ha&&(null==(Sa=G.onDoubleClick)?void 0:Sa.call(G,{type:"shape",shape:a,order:Za},na),fa.current=-1);na.order=Za+1}},onPointerEnter:na=>{var ta;if(!d.settings.penMode||"pen"===na.pointerType&&na.isPrimary){var {order:Ha=0}=na;null==(ta=G.onPointerEnter)?void 0:ta.call(G,{type:"shape",shape:a,order:Ha},na);na.order=Ha+1}},onPointerLeave:na=>{var ta;if(!d.settings.penMode||"pen"===na.pointerType&&na.isPrimary){var {order:Ha=0}=na;null==(ta=G.onPointerLeave)?void 0:
ta.call(G,{type:"shape",shape:a,order:Ha},na);na.order=Ha+1}},onKeyUp:na=>{var ta;null==(ta=G.onKeyUp)?void 0:ta.call(G,{type:"shape",shape:a,order:-1},na)},onKeyDown:na=>{var ta;null==(ta=G.onKeyDown)?void 0:ta.call(G,{type:"shape",shape:a,order:-1},na)}}),[a.id,k,G])}function sn(a){var {viewport:d,inputs:k,callbacks:G,components:fa}=a;a=nf(a,["viewport","inputs","callbacks","components"]);return(0,xB.jsx)(aG,{id:a.id,viewport:d,inputs:k,callbacks:G,components:fa,meta:a.meta,children:(0,xB.jsx)(XF,
Ud({},a))})}function He(){He=Object.assign?Object.assign.bind():function(a){for(var d=1;d<arguments.length;d++){var k=arguments[d],G;for(G in k)Object.prototype.hasOwnProperty.call(k,G)&&(a[G]=k[G])}return a};return He.apply(this,arguments)}function Lf(a,d,{checkForDefaultPrevented:k=!0}={}){return function(G){null===a||void 0===a||a(G);if(!1===k||!G.defaultPrevented)return null===d||void 0===d?void 0:d(G)}}function xg(...a){return d=>a.forEach(k=>{"function"===typeof k?k(d):null!==k&&void 0!==k&&
(k.current=d)})}function eh(...a){return(0,fG.useCallback)(xg(...a),a)}function Ji(a,d=[]){let k=[];const G=()=>{const fa=k.map(na=>(0,Ms.createContext)(na));return function(na){const ta=(null===na||void 0===na?void 0:na[a])||fa;return(0,Ms.useMemo)(()=>({[`__scope${a}`]:Re(Ud({},na),{[a]:ta})}),[na,ta])}};G.scopeName=a;return[function(fa,na){function ta(Za){const {scope:fb,children:ib}=Za,Bb=nf(Za,["scope","children"]);Za=(null===fb||void 0===fb?void 0:fb[a][Sa])||Ha;const Ob=(0,Ms.useMemo)(()=>
Bb,Object.values(Bb));return(0,Ms.createElement)(Za.Provider,{value:Ob},ib)}const Ha=(0,Ms.createContext)(na),Sa=k.length;k=[...k,na];ta.displayName=fa+"Provider";return[ta,function(Za,fb){if(fb=(0,Ms.useContext)((null===fb||void 0===fb?void 0:fb[a][Sa])||Ha))return fb;if(void 0!==na)return na;throw Error(`\`${Za}\` must be used within \`${fa}\``);}]},el(G,...d)]}function el(...a){const d=a[0];if(1===a.length)return d;const k=()=>{const G=a.map(fa=>({useScope:fa(),scopeName:fa.scopeName}));return function(fa){const na=
G.reduce((ta,{useScope:Ha,scopeName:Sa})=>{Ha=Ha(fa)[`__scope${Sa}`];return Ud(Ud({},ta),Ha)},{});return(0,Ms.useMemo)(()=>({[`__scope${d.scopeName}`]:na}),[na])}};k.scopeName=d.scopeName;return k}function lg(a){return(0,an.isValidElement)(a)&&a.type===yB}function fl(a,d){const k=Ud({},d);for(const G in d){const fa=a[G],na=d[G];/^on[A-Z]/.test(G)?fa&&na?k[G]=(...ta)=>{na(...ta);fa(...ta)}:fa&&(k[G]=fa):"style"===G?k[G]=Ud(Ud({},fa),na):"className"===G&&(k[G]=[fa,na].filter(Boolean).join(" "))}return Ud(Ud({},
a),k)}function Mk(a,d){a&&(0,gG.flushSync)(()=>a.dispatchEvent(d))}function Ei(a){const d=(0,Zx.useRef)(a);(0,Zx.useEffect)(()=>{d.current=a});return(0,Zx.useMemo)(()=>(...k)=>{var G;return null===(G=d.current)||void 0===G?void 0:G.call(d,...k)},[])}function Fk(a,d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const k=Ei(a);(0,hG.useEffect)(()=>{const G=fa=>{"Escape"===fa.key&&k(fa)};d.addEventListener("keydown",G);return()=>d.removeEventListener("keydown",G)},[k,d])}function ij(a,
d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const k=Ei(a),G=(0,$n.useRef)(!1),fa=(0,$n.useRef)(()=>{});(0,$n.useEffect)(()=>{const na=Ha=>{if(Ha.target&&!G.current){let Sa=function(){Nk("dismissableLayer.pointerDownOutside",k,Za,{discrete:!0})};const Za={originalEvent:Ha};"touch"===Ha.pointerType?(d.removeEventListener("click",fa.current),fa.current=Sa,d.addEventListener("click",fa.current,{once:!0})):Sa()}G.current=!1},ta=window.setTimeout(()=>{d.addEventListener("pointerdown",
na)},0);return()=>{window.clearTimeout(ta);d.removeEventListener("pointerdown",na);d.removeEventListener("click",fa.current)}},[d,k]);return{onPointerDownCapture:()=>G.current=!0}}function gj(a,d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const k=Ei(a),G=(0,$n.useRef)(!1);(0,$n.useEffect)(()=>{const fa=na=>{na.target&&!G.current&&Nk("dismissableLayer.focusOutside",k,{originalEvent:na},{discrete:!1})};d.addEventListener("focusin",fa);return()=>d.removeEventListener("focusin",
fa)},[d,k]);return{onFocusCapture:()=>G.current=!0,onBlurCapture:()=>G.current=!1}}function bl(){const a=new CustomEvent("dismissableLayer.update");document.dispatchEvent(a)}function Nk(a,d,k,{discrete:G}){const fa=k.originalEvent.target;k=new CustomEvent(a,{bubbles:!1,cancelable:!0,detail:k});d&&fa.addEventListener(a,d,{once:!0});G?Mk(fa,k):fa.dispatchEvent(k)}function Sh(a){const [d,k]=AB.useState(kG());Bm(()=>{a||k(G=>null!==G&&void 0!==G?G:String(lG++))},[a]);return a||(d?`radix-${d}`:"")}function wi(a){return a.split("-")[0]}
function cl(a){return["top","bottom"].includes(wi(a))?"x":"y"}function Ok(a){return"y"===a?"height":"width"}function Ui(a,d,k){let {reference:G,floating:fa}=a;var na=G.x+G.width/2-fa.width/2;const ta=G.y+G.height/2-fa.height/2;a=cl(d);var Ha=Ok(a);Ha=G[Ha]/2-fa[Ha]/2;const Sa="x"===a;switch(wi(d)){case "top":na={x:na,y:G.y-fa.height};break;case "bottom":na={x:na,y:G.y+G.height};break;case "right":na={x:G.x+G.width,y:ta};break;case "left":na={x:G.x-fa.width,y:ta};break;default:na={x:G.x,y:G.y}}switch(d.split("-")[1]){case "start":na[a]-=
Ha*(k&&Sa?-1:1);break;case "end":na[a]+=Ha*(k&&Sa?-1:1)}return na}function dm(a){return"number"!=typeof a?Ud({top:0,right:0,bottom:0,left:0},a):{top:a,right:a,bottom:a,left:a}}function vm(a){return Re(Ud({},a),{top:a.y,left:a.x,right:a.x+a.width,bottom:a.y+a.height})}function Dk(a,d){return Nh(this,null,function*(){var k;void 0===d&&(d={});const {x:G,y:fa,platform:na,rects:ta,elements:Ha,strategy:Sa}=a,{boundary:Za="clippingAncestors",rootBoundary:fb="viewport",elementContext:ib="floating",altBoundary:Bb=
!1,padding:Ob=0}=d,Fb=dm(Ob),cc=Ha[Bb?"floating"===ib?"reference":"floating":ib],oc=vm(yield na.getClippingRect({element:null==(k=yield null==na.isElement?void 0:na.isElement(cc))||k?cc:cc.contextElement||(yield null==na.getDocumentElement?void 0:na.getDocumentElement(Ha.floating)),boundary:Za,rootBoundary:fb,strategy:Sa}));k=vm(na.convertOffsetParentRelativeRectToViewportRelativeRect?yield na.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===ib?Re(Ud({},ta.floating),{x:G,y:fa}):
ta.reference,offsetParent:yield null==na.getOffsetParent?void 0:na.getOffsetParent(Ha.floating),strategy:Sa}):ta[ib]);return{top:oc.top-k.top+Fb.top,bottom:k.bottom-oc.bottom+Fb.bottom,left:oc.left-k.left+Fb.left,right:k.right-oc.right+Fb.right}})}function Tm(a){return a.replace(/left|right|bottom|top/g,d=>nG[d])}function Hn(a,d,k){void 0===k&&(k=!1);const G=a.split("-")[1],fa=cl(a);a=Ok(fa);k="x"===fa?G===(k?"end":"start")?"right":"left":"start"===G?"bottom":"top";return d.reference[a]>d.floating[a]&&
(k=Tm(k)),{main:k,cross:Tm(k)}}function cm(a){return a.replace(/start|end/g,d=>oG[d])}function Rb(a,d){return{top:a.top-d.height,right:a.right-d.width,bottom:a.bottom-d.height,left:a.left-d.width}}function Ra(a){return CB.some(d=>0<=a[d])}function rc(a){return null==a?window:a&&a.document&&a.location&&a.alert&&a.setInterval?a:(a=a.ownerDocument)&&a.defaultView||window}function qc(a){return rc(a).getComputedStyle(a)}function Tb(a){return a&&a.document&&a.location&&a.alert&&a.setInterval?"":a?(a.nodeName||
"").toLowerCase():""}function nc(){const a=navigator.userAgentData;return null!=a&&a.brands?a.brands.map(d=>d.brand+"/"+d.version).join(" "):navigator.userAgent}function jc(a){return a instanceof rc(a).HTMLElement}function Lb(a){return a instanceof rc(a).Element}function Jb(a){return"undefined"==typeof ShadowRoot?!1:a instanceof rc(a).ShadowRoot||a instanceof ShadowRoot}function fc(a){const {overflow:d,overflowX:k,overflowY:G}=qc(a);return/auto|scroll|overlay|hidden/.test(d+G+k)}function Hc(a){const d=
/firefox/i.test(nc());a=qc(a);return"none"!==a.transform||"none"!==a.perspective||"paint"===a.contain||["transform","perspective"].includes(a.willChange)||d&&"filter"===a.willChange||d&&!!a.filter&&"none"!==a.filter}function Nc(){return!/^((?!chrome|android).)*safari/i.test(nc())}function Sc(a,d,k){var G,fa,na,ta;void 0===d&&(d=!1);void 0===k&&(k=!1);var Ha=a.getBoundingClientRect();let Sa=1,Za=1;d&&jc(a)&&(Sa=0<a.offsetWidth&&hw(Ha.width)/a.offsetWidth||1,Za=0<a.offsetHeight&&hw(Ha.height)/a.offsetHeight||
1);a=Lb(a)?rc(a):window;d=!Nc()&&k;k=(Ha.left+(d&&null!=(G=null==(fa=a.visualViewport)?void 0:fa.offsetLeft)?G:0))/Sa;G=(Ha.top+(d&&null!=(na=null==(ta=a.visualViewport)?void 0:ta.offsetTop)?na:0))/Za;na=Ha.width/Sa;Ha=Ha.height/Za;return{width:na,height:Ha,top:G,right:k+na,bottom:G+Ha,left:k,x:k,y:G}}function hd(a){return(d=a,(d instanceof rc(d).Node?a.ownerDocument:a.document)||window.document).documentElement;var d}function Ld(a){return Lb(a)?{scrollLeft:a.scrollLeft,scrollTop:a.scrollTop}:{scrollLeft:a.pageXOffset,
scrollTop:a.pageYOffset}}function pe(a){return Sc(hd(a)).left+Ld(a).scrollLeft}function Zd(a){return"html"===Tb(a)?a:a.assignedSlot||a.parentNode||(Jb(a)?a.host:null)||hd(a)}function je(a){return jc(a)&&"fixed"!==getComputedStyle(a).position?a.offsetParent:null}function af(a){for(var d=rc(a),k=je(a);k&&["table","td","th"].includes(Tb(k))&&"static"===getComputedStyle(k).position;)k=je(k);if(!k||"html"!==Tb(k)&&("body"!==Tb(k)||"static"!==getComputedStyle(k).position||Hc(k))){if(!k)a:{a=Zd(a);for(Jb(a)&&
(a=a.host);jc(a)&&!["html","body"].includes(Tb(a));){if(Hc(a)){k=a;break a}a=a.parentNode}k=null}d=k||d}return d}function jf(a){if(jc(a))return{width:a.offsetWidth,height:a.offsetHeight};a=Sc(a);return{width:a.width,height:a.height}}function le(a){const d=Zd(a);return["html","body","#document"].includes(Tb(d))?a.ownerDocument.body:jc(d)&&fc(d)?d:le(d)}function qg(a,d){var k;void 0===d&&(d=[]);var G=le(a);a=G===(null==(k=a.ownerDocument)?void 0:k.body);k=rc(G);G=a?[k].concat(k.visualViewport||[],fc(G)?
G:[]):G;d=d.concat(G);return a?d:d.concat(qg(G))}function Qg(a,d,k){return"viewport"===d?vm(function(G,fa){var na=rc(G),ta=hd(G);na=na.visualViewport;G=ta.clientWidth;ta=ta.clientHeight;let Ha=0,Sa=0;if(na){G=na.width;ta=na.height;const Za=Nc();(Za||!Za&&"fixed"===fa)&&(Ha=na.offsetLeft,Sa=na.offsetTop)}return{width:G,height:ta,x:Ha,y:Sa}}(a,k)):Lb(d)?function(G,fa){var na=Sc(G,!1,"fixed"===fa);fa=na.top+G.clientTop;na=na.left+G.clientLeft;return{top:fa,left:na,x:na,y:fa,right:na+G.clientWidth,bottom:fa+
G.clientHeight,width:G.clientWidth,height:G.clientHeight}}(d,k):vm(function(G){var fa;const na=hd(G);var ta=Ld(G);const Ha=null==(fa=G.ownerDocument)?void 0:fa.body;fa=Pu(na.scrollWidth,na.clientWidth,Ha?Ha.scrollWidth:0,Ha?Ha.clientWidth:0);const Sa=Pu(na.scrollHeight,na.clientHeight,Ha?Ha.scrollHeight:0,Ha?Ha.clientHeight:0);G=-ta.scrollLeft+pe(G);ta=-ta.scrollTop;return"rtl"===qc(Ha||na).direction&&(G+=Pu(na.clientWidth,Ha?Ha.clientWidth:0)-fa),{width:fa,height:Sa,x:G,y:ta}}(hd(a)))}function Pf(a){const d=
qg(a),k=["absolute","fixed"].includes(qc(a).position)&&jc(a)?af(a):a;return Lb(k)?d.filter(G=>{var fa;if(fa=Lb(G))a:if(fa=null==k.getRootNode?void 0:k.getRootNode(),G.contains(k))fa=!0;else{if(fa&&Jb(fa)){fa=k;do{if(fa&&G===fa){fa=!0;break a}fa=fa.parentNode||fa.host}while(fa)}fa=!1}return fa&&"body"!==Tb(G)}):[]}function Qf(a,d,k,G){void 0===G&&(G={});const {ancestorScroll:fa=!0,ancestorResize:na=!0,elementResize:ta=!0,animationFrame:Ha=!1}=G,Sa=fa&&!Ha,Za=na&&!Ha,fb=Sa||Za?[...(Lb(a)?qg(a):[]),
...qg(d)]:[];fb.forEach(Fb=>{Sa&&Fb.addEventListener("scroll",k,{passive:!0});Za&&Fb.addEventListener("resize",k)});let ib,Bb=null;if(ta){let Fb=!0;Bb=new ResizeObserver(()=>{Fb||k();Fb=!1});Lb(a)&&!Ha&&Bb.observe(a);Bb.observe(d)}let Ob=Ha?Sc(a):null;return Ha&&function cc(){const oc=Sc(a);!Ob||oc.x===Ob.x&&oc.y===Ob.y&&oc.width===Ob.width&&oc.height===Ob.height||k();Ob=oc;ib=requestAnimationFrame(cc)}(),k(),()=>{var cc;fb.forEach(oc=>{Sa&&oc.removeEventListener("scroll",k);Za&&oc.removeEventListener("resize",
k)});null==(cc=Bb)||cc.disconnect();Bb=null;Ha&&cancelAnimationFrame(ib)}}function Gg(a,d){if(a===d)return!0;if(typeof a!==typeof d)return!1;if("function"===typeof a&&a.toString()===d.toString())return!0;let k,G;if(a&&d&&"object"==typeof a){if(Array.isArray(a)){var fa=a.length;if(fa!=d.length)return!1;for(k=fa;0!==k--;)if(!Gg(a[k],d[k]))return!1;return!0}G=Object.keys(a);fa=G.length;if(fa!==Object.keys(d).length)return!1;for(k=fa;0!==k--;)if(!Object.prototype.hasOwnProperty.call(d,G[k]))return!1;
for(k=fa;0!==k--;)if(fa=G[k],!("_owner"===fa&&a.$$typeof||Gg(a[fa],d[fa])))return!1;return!0}return a!==a&&d!==d}function Vg(a){const d=Fo.useRef(a);by(()=>{d.current=a});return d}function Sf(a){let {middleware:d,placement:k="bottom",strategy:G="absolute",whileElementsMounted:fa}=void 0===a?{}:a;const na=Fo.useRef(null),ta=Fo.useRef(null),Ha=Vg(fa),Sa=Fo.useRef(null),[Za,fb]=Fo.useState({x:null,y:null,strategy:G,placement:k,middlewareData:{}}),[ib,Bb]=Fo.useState(d);Gg(null==ib?void 0:ib.map(ec=>
{({options:ec}=ec);return ec}),null==d?void 0:d.map(ec=>{({options:ec}=ec);return ec}))||Bb(d);const Ob=Fo.useCallback(()=>{na.current&&ta.current&&rG(na.current,ta.current,{middleware:ib,placement:k,strategy:G}).then(ec=>{Fb.current&&sG.flushSync(()=>{fb(ec)})})},[ib,k,G]);by(()=>{Fb.current&&Ob()},[Ob]);const Fb=Fo.useRef(!1);by(()=>{Fb.current=!0;return()=>{Fb.current=!1}},[]);const cc=Fo.useCallback(()=>{"function"===typeof Sa.current&&(Sa.current(),Sa.current=null);if(na.current&&ta.current)if(Ha.current){const ec=
Ha.current(na.current,ta.current,Ob);Sa.current=ec}else Ob()},[Ob,Ha]),oc=Fo.useCallback(ec=>{na.current=ec;cc()},[cc]),Xb=Fo.useCallback(ec=>{ta.current=ec;cc()},[cc]),hc=Fo.useMemo(()=>({reference:na,floating:ta}),[]);return Fo.useMemo(()=>Re(Ud({},Za),{update:Ob,refs:hc,reference:oc,floating:Xb}),[Za,Ob,hc,oc,Xb])}function Oh(a){const [d,k]=(0,uG.useState)(void 0);Bm(()=>{if(a){k({width:a.offsetWidth,height:a.offsetHeight});const G=new ResizeObserver(fa=>{if(Array.isArray(fa)&&fa.length){fa=fa[0];
if("borderBoxSize"in fa){fa=fa.borderBoxSize;var na=Array.isArray(fa)?fa[0]:fa;fa=na.inlineSize;na=na.blockSize}else fa=a.offsetWidth,na=a.offsetHeight;k({width:fa,height:na})}});G.observe(a,{box:"border-box"});return()=>G.unobserve(a)}k(void 0)},[a]);return d}function Jj(a){return void 0!==a}function $f(a){return null!==a}function xi(a){const [d,k="center"]=a.split("-");return[d,k]}function em(a,d){return(0,Qq.useReducer)((k,G)=>{G=d[k][G];return null!==G&&void 0!==G?G:k},a)}function yg(a){const [d,
k]=(0,Qq.useState)(),G=(0,Qq.useRef)({}),fa=(0,Qq.useRef)(a),na=(0,Qq.useRef)("none"),[ta,Ha]=em(a?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});(0,Qq.useEffect)(()=>{const Sa=Ki(G.current);na.current="mounted"===ta?Sa:"none"},[ta]);Bm(()=>{const Sa=G.current,Za=fa.current;if(Za!==a){const fb=na.current,ib=Ki(Sa);a?Ha("MOUNT"):"none"===ib||"none"===(null===Sa||void 0===
Sa?void 0:Sa.display)?Ha("UNMOUNT"):Za&&fb!==ib?Ha("ANIMATION_OUT"):Ha("UNMOUNT");fa.current=a}},[a,Ha]);Bm(()=>{if(d){const Sa=fb=>{const ib=Ki(G.current).includes(fb.animationName);fb.target===d&&ib&&(0,EG.flushSync)(()=>Ha("ANIMATION_END"))},Za=fb=>{fb.target===d&&(na.current=Ki(G.current))};d.addEventListener("animationstart",Za);d.addEventListener("animationcancel",Sa);d.addEventListener("animationend",Sa);return()=>{d.removeEventListener("animationstart",Za);d.removeEventListener("animationcancel",
Sa);d.removeEventListener("animationend",Sa)}}Ha("ANIMATION_END")},[d,Ha]);return{isPresent:["mounted","unmountSuspended"].includes(ta),ref:(0,Qq.useCallback)(Sa=>{Sa&&(G.current=getComputedStyle(Sa));k(Sa)},[])}}function Ki(a){return(null===a||void 0===a?void 0:a.animationName)||"none"}function Fh({prop:a,defaultProp:d,onChange:k=()=>{}}){const [G,fa]=zl({defaultProp:d,onChange:k}),na=void 0!==a;d=na?a:G;const ta=Ei(k);k=(0,iw.useCallback)(Ha=>{na?(Ha="function"===typeof Ha?Ha(a):Ha,Ha!==a&&ta(Ha)):
fa(Ha)},[na,a,fa,ta]);return[d,k]}function zl({defaultProp:a,onChange:d}){a=(0,iw.useState)(a);const [k]=a,G=(0,iw.useRef)(k),fa=Ei(d);(0,iw.useEffect)(()=>{G.current!==k&&(fa(k),G.current=k)},[k,G,fa]);return a}function nm(a,d){const k=Math.abs(d.top-a.y),G=Math.abs(d.bottom-a.y),fa=Math.abs(d.right-a.x);a=Math.abs(d.left-a.x);switch(Math.min(k,G,fa,a)){case a:return"left";case fa:return"right";case k:return"top";case G:return"bottom";default:return null}}function hh(a){a=a.slice();a.sort((d,k)=>
d.x<k.x?-1:d.x>k.x?1:d.y<k.y?-1:d.y>k.y?1:0);return Hj(a)}function Hj(a){if(1>=a.length)return a.slice();const d=[];for(var k=0;k<a.length;k++){for(var G=a[k];2<=d.length;){var fa=d[d.length-1],na=d[d.length-2];if((fa.x-na.x)*(G.y-na.y)>=(fa.y-na.y)*(G.x-na.x))d.pop();else break}d.push(G)}d.pop();k=[];for(G=a.length-1;0<=G;G--){for(fa=a[G];2<=k.length;){na=k[k.length-1];const ta=k[k.length-2];if((na.x-ta.x)*(fa.y-ta.y)>=(na.y-ta.y)*(fa.x-ta.x))k.pop();else break}k.push(fa)}k.pop();return 1===d.length&&
1===k.length&&d[0].x===k[0].x&&d[0].y===k[0].y?d:d.concat(k)}function Gj(a){var {side:d,content:k,sideOffset:G=10}=a;a=nf(a,["side","content","sideOffset"]);return k?(0,Gr.jsx)(QG,{delayDuration:300,children:(0,Gr.jsxs)(RG,{children:[(0,Gr.jsx)(SG,{asChild:!0,children:a.children}),(0,Gr.jsx)(TG,{children:(0,Gr.jsxs)(UG,Re(Ud({className:"tl-tooltip-content",sideOffset:G,side:d},a),{children:[k,(0,Gr.jsx)(VG,{className:"tl-tooltip-arrow"})]}))})]})}):(0,Gr.jsx)(Gr.Fragment,{children:a.children})}function ig(a){var {className:d,
tooltip:k,tooltipSide:G}=a;a=nf(a,["className","tooltip","tooltipSide"]);return(0,QB.jsx)(Gj,{content:k,side:G,children:(0,QB.jsx)("button",Ud({className:"tl-button "+(null!=d?d:"")},a))})}function yi(a){var {toggle:d=!0,pressed:k,onPressedChange:G,className:fa,tooltip:na}=a;a=nf(a,["toggle","pressed","onPressedChange","className","tooltip"]);return(0,jy.jsx)(Gj,{content:na,children:(0,jy.jsx)("div",{className:"inline-block",children:(0,jy.jsx)(XG,Re(Ud({},a),{"data-toggle":d,className:"tl-toggle-input"+
(fa?" "+fa:""),pressed:k,onPressedChange:G}))})})}function Tk(a){var d=a+"CollectionProvider";const [k,G]=Ji(d),[fa,na]=k(d,{collectionRef:{current:null},itemMap:new Map}),ta=fb=>{const {scope:ib,children:Bb}=fb;fb=mq.default.useRef(null);const Ob=mq.default.useRef(new Map).current;return mq.default.createElement(fa,{scope:ib,itemMap:Ob,collectionRef:fb},Bb)};Object.assign(ta,{displayName:d});const Ha=a+"CollectionSlot";d=mq.default.forwardRef((fb,ib)=>{const {scope:Bb,children:Ob}=fb;fb=na(Ha,Bb);
ib=eh(ib,fb.collectionRef);return mq.default.createElement(lq,{ref:ib},Ob)});Object.assign(d,{displayName:Ha});const Sa=a+"CollectionItemSlot",Za=mq.default.forwardRef((fb,ib)=>{const {scope:Bb,children:Ob}=fb,Fb=nf(fb,["scope","children"]),cc=mq.default.useRef(null);fb=eh(ib,cc);const oc=na(Sa,Bb);mq.default.useEffect(()=>{oc.itemMap.set(cc,Ud({ref:cc},Fb));return()=>void oc.itemMap.delete(cc)});return mq.default.createElement(lq,{["data-radix-collection-item"]:"",ref:fb},Ob)});Object.assign(Za,
{displayName:Sa});return[{Provider:ta,Slot:d,ItemSlot:Za},function(fb){const ib=na(a+"CollectionConsumer",fb);return mq.default.useCallback(()=>{const Bb=ib.collectionRef.current;if(!Bb)return[];const Ob=Array.from(Bb.querySelectorAll("[data-radix-collection-item]"));return Array.from(ib.itemMap.values()).sort((Fb,cc)=>Ob.indexOf(Fb.ref.current)-Ob.indexOf(cc.ref.current))},[ib.collectionRef,ib.itemMap])},G]}function Vn(a){const d=(0,TB.useContext)(YG);return a||d||"ltr"}function hi(){(0,ZG.useEffect)(()=>
{var a,d;const k=document.querySelectorAll("[data-radix-focus-guard]");document.body.insertAdjacentElement("afterbegin",null!==(a=k[0])&&void 0!==a?a:hn());document.body.insertAdjacentElement("beforeend",null!==(d=k[1])&&void 0!==d?d:hn());ky++;return()=>{1===ky&&document.querySelectorAll("[data-radix-focus-guard]").forEach(G=>G.remove());ky--}},[])}function hn(){const a=document.createElement("span");a.setAttribute("data-radix-focus-guard","");a.tabIndex=0;a.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none";
return a}function ck(a,{select:d=!1}={}){const k=document.activeElement;for(const G of a)if(dk(G,{select:d}),document.activeElement!==k)break}function lj(a){const d=[];for(a=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,{acceptNode:k=>{const G="INPUT"===k.tagName&&"hidden"===k.type;return k.disabled||k.hidden||G?NodeFilter.FILTER_SKIP:0<=k.tabIndex?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});a.nextNode();)d.push(a.currentNode);return d}function Kj(a,d){for(const k of a)if(!Pj(k,{upTo:d}))return k}
function Pj(a,{upTo:d}){if("hidden"===getComputedStyle(a).visibility)return!0;for(;a&&(void 0===d||a!==d);){if("none"===getComputedStyle(a).display)return!0;a=a.parentElement}return!1}function dk(a,{select:d=!1}={}){if(a&&a.focus){const k=document.activeElement;a.focus({preventScroll:!0});a!==k&&a instanceof HTMLInputElement&&"select"in a&&d&&a.select()}}function xk(a,d){a=[...a];d=a.indexOf(d);-1!==d&&a.splice(d,1);return a}function rp(a){return a.filter(d=>"A"!==d.tagName)}function ko(a,d,k){a=
a.key;k="rtl"!==k?a:"ArrowLeft"===a?"ArrowRight":"ArrowRight"===a?"ArrowLeft":a;if("vertical"!==d||!["ArrowLeft","ArrowRight"].includes(k))if("horizontal"!==d||!["ArrowUp","ArrowDown"].includes(k))return fH[k]}function zn(a){const d=document.activeElement;for(const k of a){if(k===d)break;k.focus();if(document.activeElement!==d)break}}function Sg(a,d){return a.map((k,G)=>a[(d+G)%a.length])}function ui(a,d){var k=(0,jH.useState)(function(){return{value:a,callback:d,facade:{get current(){return k.value},
set current(G){var fa=k.value;fa!==G&&(k.value=G,k.callback(G,fa))}}}})[0];k.callback=d;return k.facade}function vj(a,d){return ui(d||null,function(k){return a.forEach(function(G){"function"===typeof G?G(k):G&&(G.current=k);return G})})}function So(a){return a}function mm(a,d){void 0===d&&(d=So);var k=[],G=!1;return{read:function(){if(G)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return k.length?k[k.length-1]:a},useMedium:function(fa){var na=
d(fa,G);k.push(na);return function(){k=k.filter(function(ta){return ta!==na})}},assignSyncMedium:function(fa){for(G=!0;k.length;){var na=k;k=[];na.forEach(fa)}k={push:function(ta){return fa(ta)},filter:function(){return k}}},assignMedium:function(fa){G=!0;var na=[];if(k.length){var ta=k;k=[];ta.forEach(fa);na=k}var Ha=function(){var Sa=na;na=[];Sa.forEach(fa)};Promise.resolve().then(Ha);k={push:function(Sa){na.push(Sa);Promise.resolve().then(Ha)},filter:function(Sa){na=na.filter(Sa);return k}}}}}
function To(a){const d=document.activeElement;for(const k of a){if(k===d)break;k.focus();if(document.activeElement!==d)break}}function rl(a,d){return a.map((k,G)=>a[(d+G)%a.length])}function dj(a,d,k){const G=1<d.length&&Array.from(d).every(na=>na===d[0])?d[0]:d,fa=k?a.indexOf(k):-1;a=rl(a,Math.max(fa,0));1===G.length&&(a=a.filter(na=>na!==k));a=a.find(na=>na.toLowerCase().startsWith(G.toLowerCase()));return a!==k?a:void 0}function xo(a){return d=>"mouse"===d.pointerType?a(d):void 0}function yo(a,
[d,k]){return Math.min(k,Math.max(d,a))}function In(a){const d=(0,By.useRef)({value:a,previous:a});return(0,By.useMemo)(()=>{d.current.value!==a&&(d.current.previous=d.current.value,d.current.value=a);return d.current.previous},[a])}function Vi(a=[],d,k){a=[...a];a[k]=d;return a.sort((G,fa)=>G-fa)}function ti(a,d,k){return 100/(k-d)*(a-d)}function Uk(a,d){if(2<d)return`Value ${a+1} of ${d}`;if(2===d)return["Minimum","Maximum"][a]}function zq(a,d){if(1===a.length)return 0;a=a.map(G=>Math.abs(G-d));
const k=Math.min(...a);return a.indexOf(k)}function Ll(a,d,k){a/=2;const G=rn([0,50],[0,a]);return(a-G(d)*k)*k}function xm(a){return a.slice(0,-1).map((d,k)=>a[k+1]-d)}function rn(a,d){return k=>a[0]===a[1]||d[0]===d[1]?d[0]:d[0]+(d[1]-d[0])/(a[1]-a[0])*(k-a[0])}function jn(a,d){d=Math.pow(10,d);return Math.round(a*d)/d}function Wm(a){function d(Za){return Za?(0,tk.jsx)("div",{className:"tl-color-bg",style:{backgroundColor:Za},children:(0,tk.jsx)("div",{className:`w-full h-full bg-${Za}-500`})}):
(0,tk.jsx)("div",{className:"tl-color-bg",children:(0,tk.jsx)(gh,{name:"color-swatch"})})}var {color:k,opacity:G,popoverSide:fa,setColor:na,setOpacity:ta}=a;a=nf(a,["color","opacity","popoverSide","setColor","setOpacity"]);const {handlers:{t:Ha}}=ve.default.useContext(Gi),Sa=ve.default.useMemo(()=>{let Za="";return ul(fb=>{na(Za)},100,fb=>{Za=fb.target.value})},[]);return(0,tk.jsx)(Kn,Re(Ud({},a),{border:!0,arrow:!0,side:fa,label:(0,tk.jsx)(Gj,{content:Ha("whiteboard/color"),side:fa,sideOffset:14,
children:d(k)}),children:(0,tk.jsxs)("div",{className:"p-1",children:[(0,tk.jsx)("div",{className:"tl-color-palette",children:Object.values(is).map(Za=>(0,tk.jsx)("button",{className:`tl-color-drip m-1${Za===k?" active":""}`,onClick:()=>na(Za),children:d(Za)},Za))}),(0,tk.jsxs)("div",{className:"flex items-center tl-custom-color",children:[(0,tk.jsx)("div",{className:`tl-color-drip m-1 mr-3 ${Oi(k)?"":"active"}`,children:(0,tk.jsx)("div",{className:"color-input-wrapper tl-color-bg",children:(0,tk.jsx)("input",
Ud({className:"color-input cursor-pointer",id:"tl-custom-color-input",type:"color",value:/^#(?:[0-9a-f]{3}){1,2}$/i.test(k)?k:"#000000",onChange:Sa,style:{opacity:Oi(k)?0:1}},a))})}),(0,tk.jsx)("label",{htmlFor:"tl-custom-color-input",className:"cursor-pointer",children:Ha("whiteboard/select-custom-color")})]}),ta&&(0,tk.jsx)("div",{className:"mx-1 my-2",children:(0,tk.jsxs)(kl,{defaultValue:[null!=G?G:0],onValueCommit:Za=>ta(Za[0]),max:1,step:.1,"aria-label":Ha("whiteboard/opacity"),className:"tl-slider-root",
children:[(0,tk.jsx)(bv,{className:"tl-slider-track",children:(0,tk.jsx)(Vj,{className:"tl-slider-range"})}),(0,tk.jsx)(pq,{className:"tl-slider-thumb"})]})})]})}))}function ii(a,d){a&&(0,Ln.flushSync)(()=>a.dispatchEvent(d))}function lo(a,d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const k=Ei(a),G=(0,Bl.useRef)(!1),fa=(0,Bl.useRef)(()=>{});(0,Bl.useEffect)(()=>{const na=Ha=>{if(Ha.target&&!G.current){let Sa=function(){om("dismissableLayer.pointerDownOutside",k,Za,{discrete:!0})};
const Za={originalEvent:Ha};"touch"===Ha.pointerType?(d.removeEventListener("click",fa.current),fa.current=Sa,d.addEventListener("click",fa.current,{once:!0})):Sa()}G.current=!1},ta=window.setTimeout(()=>{d.addEventListener("pointerdown",na)},0);return()=>{window.clearTimeout(ta);d.removeEventListener("pointerdown",na);d.removeEventListener("click",fa.current)}},[d,k]);return{onPointerDownCapture:()=>G.current=!0}}function Dl(a,d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const k=
Ei(a),G=(0,Bl.useRef)(!1);(0,Bl.useEffect)(()=>{const fa=na=>{na.target&&!G.current&&om("dismissableLayer.focusOutside",k,{originalEvent:na},{discrete:!1})};d.addEventListener("focusin",fa);return()=>d.removeEventListener("focusin",fa)},[d,k]);return{onFocusCapture:()=>G.current=!0,onBlurCapture:()=>G.current=!1}}function Vl(){const a=new CustomEvent("dismissableLayer.update");document.dispatchEvent(a)}function om(a,d,k,{discrete:G}){const fa=k.originalEvent.target;k=new CustomEvent(a,{bubbles:!1,
cancelable:!0,detail:k});d&&fa.addEventListener(a,d,{once:!0});G?ii(fa,k):fa.dispatchEvent(k)}function An(a,{select:d=!1}={}){const k=document.activeElement;for(const G of a)if(El(G,{select:d}),document.activeElement!==k)break}function Wn(a){const d=[];for(a=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,{acceptNode:k=>{const G="INPUT"===k.tagName&&"hidden"===k.type;return k.disabled||k.hidden||G?NodeFilter.FILTER_SKIP:0<=k.tabIndex?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});a.nextNode();)d.push(a.currentNode);
return d}function mn(a,d){for(const k of a)if(!ym(k,{upTo:d}))return k}function ym(a,{upTo:d}){if("hidden"===getComputedStyle(a).visibility)return!0;for(;a&&(void 0===d||a!==d);){if("none"===getComputedStyle(a).display)return!0;a=a.parentElement}return!1}function El(a,{select:d=!1}={}){if(a&&a.focus){const k=document.activeElement;a.focus({preventScroll:!0});a!==k&&a instanceof HTMLInputElement&&"select"in a&&d&&a.select()}}function kn(a,d){a=[...a];d=a.indexOf(d);-1!==d&&a.splice(d,1);return a}function mo(a){return a.filter(d=>
"A"!==d.tagName)}function no(a){return void 0!==a}function Dg(a){return null!==a}function oo(a){const [d,k="center"]=a.split("-");return[d,k]}function Fl(a){const d=Ei(a),k=(0,ff.useRef)(""),G=(0,ff.useRef)(0);a=(0,ff.useCallback)(na=>{na=k.current+na;d(na);(function Sa(Ha){k.current=Ha;window.clearTimeout(G.current);""!==Ha&&(G.current=window.setTimeout(()=>Sa(""),1E3))})(na)},[d]);const fa=(0,ff.useCallback)(()=>{k.current="";window.clearTimeout(G.current)},[]);(0,ff.useEffect)(()=>()=>window.clearTimeout(G.current),
[]);return[k,a,fa]}function sl(a,d,k){const G=1<d.length&&Array.from(d).every(na=>na===d[0])?d[0]:d,fa=k?a.indexOf(k):-1;a=Vk(a,Math.max(fa,0));1===G.length&&(a=a.filter(na=>na!==k));a=a.find(na=>na.textValue.toLowerCase().startsWith(G.toLowerCase()));return a!==k?a:void 0}function Vk(a,d){return a.map((k,G)=>a[(d+G)%a.length])}function Jm(a){var {options:d,tooltip:k,popoverSide:G,chevron:fa=!0,value:na,onValueChange:ta}=a;a=nf(a,"options tooltip popoverSide chevron value onValueChange".split(" "));
const [Ha,Sa]=oC.useState(!1);return(0,Mg.jsx)("div",Re(Ud({},a),{className:"tl-select-input",children:(0,Mg.jsxs)(Sr,{open:Ha,onOpenChange:Sa,value:na,onValueChange:ta,children:[(0,Mg.jsx)(Gj,{content:k,side:G,children:(0,Mg.jsxs)(yC,{className:"tl-select-input-trigger",children:[(0,Mg.jsx)("div",{className:"tl-select-input-trigger-value",children:(0,Mg.jsx)(AC,{})}),fa&&(0,Mg.jsx)(BC,{style:{lineHeight:1},className:"ml-1 md:ml-3",children:(0,Mg.jsx)(gh,{name:Ha?"chevron-up":"chevron-down"})})]})}),
(0,Mg.jsx)(Cm,{className:"tl-select-input-portal",children:(0,Mg.jsxs)(Ny,{className:"tl-select-input-content",side:G,position:"popper",sideOffset:14,align:"center",onKeyDown:Za=>Za.stopPropagation(),children:[(0,Mg.jsx)(CC,{}),(0,Mg.jsx)(zC,{className:"tl-select-input-viewport",children:d.map(Za=>(0,Mg.jsx)(ao,{className:"tl-select-input-select-item",value:Za.value,children:(0,Mg.jsx)(sd,{children:Za.label})},Za.value))}),(0,Mg.jsx)(Kh,{})]})})]})}))}function Uo(a){var {scaleLevel:d,compact:k,popoverSide:G}=
a;nf(a,["scaleLevel","compact","popoverSide"]);const fa=kg();({handlers:{t:a}}=DC.default.useContext(Gi));const na=[{label:k?"XS":a("whiteboard/extra-small"),value:"xs"},{label:k?"SM":a("whiteboard/small"),value:"sm"},{label:k?"MD":a("whiteboard/medium"),value:"md"},{label:k?"LG":a("whiteboard/large"),value:"lg"},{label:k?"XL":a("whiteboard/extra-large"),value:"xl"},{label:k?"XXL":a("whiteboard/huge"),value:"xxl"}];return(0,iv.jsx)(Jm,{tooltip:a("whiteboard/scale-level"),options:na,value:d,popoverSide:G,
chevron:!k,onValueChange:ta=>{fa.api.setScaleLevel(ta)}})}function Km(a,d){return function(k){return a(d(k))}}function po(a,d){return d(a)}function Lm(a,d){return function(k){return a(d,k)}}function tl(a,d){return function(){return a(d)}}function Mi(a,d){d(a);return a}function Ni(){for(var a=arguments.length,d=Array(a),k=0;k<a;k++)d[k]=arguments[k];return d}function rm(a){a()}function Pp(a){return function(){return a}}function Aq(){for(var a=arguments.length,d=Array(a),k=0;k<a;k++)d[k]=arguments[k];
return function(){d.map(rm)}}function ei(){}function ch(a,d){return a(1,d)}function Op(a,d){a(0,d)}function ks(a){a(2)}function zo(a){return a(4)}function Gf(a,d){return ch(a,Lm(d,0))}function Jk(a,d){var k=a(1,function(G){k();d(G)});return k}function vg(){var a=[];return function(d,k){switch(d){case 2:a.splice(0,a.length);break;case 1:return a.push(k),function(){var G=a.indexOf(k);-1<G&&a.splice(G,1)};case 0:a.slice().forEach(function(G){G(k)});break;default:throw Error("unrecognized action "+d);
}}}function Ef(a){var d=a,k=vg();return function(G,fa){switch(G){case 1:fa(d);break;case 0:d=fa;break;case 4:return d}return k(G,fa)}}function ln(a){var d,k;return function(G,fa){switch(G){case 1:if(fa){if(k===fa)break;d&&d();k=fa;return d=a(1,fa)}d&&d();return ei;case 2:d&&d();k=null;break;default:throw Error("unrecognized action "+G);}}}function yk(a){return Mi(vg(),function(d){return Gf(a,d)})}function pj(a,d){return Mi(Ef(d),function(k){return Gf(a,k)})}function Gl(){for(var a=arguments.length,
d=Array(a),k=0;k<a;k++)d[k]=arguments[k];return function(G){return d.reduceRight(po,G)}}function mf(a){for(var d=arguments.length,k=Array(1<d?d-1:0),G=1;G<d;G++)k[G-1]=arguments[G];var fa=Gl.apply(void 0,k);return function(na,ta){switch(na){case 1:return ch(a,fa(ta));case 2:a(2);break;default:throw Error("unrecognized action "+na);}}}function Xl(a,d){return a===d}function Gh(a){void 0===a&&(a=Xl);var d;return function(k){return function(G){a(d,G)||(d=G,k(G))}}}function Xf(a){return function(d){return function(k){a(k)&&
d(k)}}}function ag(a){return function(d){return Km(d,a)}}function Bn(a){return function(d){return function(){return d(a)}}}function Lj(a,d){return function(k){return function(G){return k(d=a(d,G))}}}function Nl(a){return function(d){return function(k){0<a?a--:d(k)}}}function Xm(a){var d,k;return function(G){return function(fa){d=fa;k||=setTimeout(function(){k=void 0;G(d)},a)}}}function mj(a){var d,k;return function(G){return function(fa){d=fa;k&&clearTimeout(k);k=setTimeout(function(){G(d)},a)}}}
function sh(){for(var a=arguments.length,d=Array(a),k=0;k<a;k++)d[k]=arguments[k];var G=Array(d.length),fa=0,na=null,ta=Math.pow(2,d.length)-1;d.forEach(function(Ha,Sa){var Za=Math.pow(2,Sa);ch(Ha,function(fb){var ib=fa;fa|=Za;G[Sa]=fb;ib!==ta&&fa===ta&&na&&(na(),na=null)})});return function(Ha){return function(Sa){var Za=function(){return Ha([Sa].concat(G))};fa===ta?Za():na=Za}}}function Zp(){for(var a=arguments.length,d=Array(a),k=0;k<a;k++)d[k]=arguments[k];return function(G,fa){switch(G){case 1:return Aq.apply(void 0,
d.map(function(na){return na(1,fa)}));case 2:break;default:throw Error("unrecognized action "+G);}}}function nh(a,d){void 0===d&&(d=Xl);return mf(a,Gh(d))}function Cj(){for(var a=vg(),d=arguments.length,k=Array(d),G=0;G<d;G++)k[G]=arguments[G];var fa=Array(k.length),na=0,ta=Math.pow(2,k.length)-1;k.forEach(function(Ha,Sa){var Za=Math.pow(2,Sa);ch(Ha,function(fb){fa[Sa]=fb;na|=Za;na===ta&&a(0,fa)})});return function(Ha,Sa){switch(Ha){case 1:return na===ta&&Sa(fa),a(1,Sa);case 2:a(2);break;default:throw Error("unrecognized action "+
Ha);}}}function Vh(a,d,k){void 0===d&&(d=[]);k=(void 0===k?{singleton:!0}:k).singleton;return{id:Symbol(),constructor:a,dependencies:d,singleton:k}}function wp(a){var d=new Map;return function fa(G){var na=G.id,ta=G.constructor,Ha=G.dependencies;if((G=G.singleton)&&d.has(na))return d.get(na);ta=ta(Ha.map(function(Sa){return fa(Sa)}));G&&d.set(na,ta);return ta}(a)}function Vo(a,d){if(null==a)return{};var k={},G=Object.keys(a),fa;for(fa=0;fa<G.length;fa++){var na=G[fa];0<=d.indexOf(na)||(k[na]=a[na])}return k}
function xp(a,d){if(a){if("string"===typeof a)return Qp(a,d);var k=Object.prototype.toString.call(a).slice(8,-1);"Object"===k&&a.constructor&&(k=a.constructor.name);if("Map"===k||"Set"===k)return Array.from(a);if("Arguments"===k||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(k))return Qp(a,d)}}function Qp(a,d){if(null==d||d>a.length)d=a.length;for(var k=0,G=Array(d);k<d;k++)G[k]=a[k];return G}function Ao(a,d){var k="undefined"!==typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(k)return(k=k.call(a)).next.bind(k);
if(Array.isArray(a)||(k=xp(a))||d&&a&&"number"===typeof a.length){k&&(a=k);var G=0;return function(){return G>=a.length?{done:!0}:{done:!1,value:a[G++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function sp(a,d){for(var k={},G={},fa=0,na=a.length;fa<na;)G[a[fa]]=1,fa+=1;for(var ta in d)G.hasOwnProperty(ta)||(k[ta]=d[ta]);return k}function Dj(a,d,k){function G(ib,Bb){ib.propsReady&&
(0,ib.propsReady)(0,!1);for(var Ob=Ao(ta),Fb;!(Fb=Ob()).done;)Fb=Fb.value,(0,ib[d.required[Fb]])(0,Bb[Fb]);for(Ob=Ao(Ha);!(Fb=Ob()).done;)if(Fb=Fb.value,Fb in Bb)(0,ib[d.optional[Fb]])(0,Bb[Fb]);ib.propsReady&&(0,ib.propsReady)(0,!0)}function fa(ib){return Sa.reduce(function(Bb,Ob){Bb[Ob]=function(Fb){(0,ib[d.methods[Ob]])(0,Fb)};return Bb},{})}function na(ib){return Za.reduce(function(Bb,Ob){Bb[Ob]=ln(ib[d.events[Ob]]);return Bb},{})}var ta=Object.keys(d.required||{}),Ha=Object.keys(d.optional||
{}),Sa=Object.keys(d.methods||{}),Za=Object.keys(d.events||{}),fb=(0,Mn.createContext)({});return{Component:(0,Mn.forwardRef)(function(ib,Bb){var Ob=ib.children,Fb=Vo(ib,HC),cc=(0,Mn.useState)(function(){return Mi(wp(a),function(Xb){return G(Xb,Fb)})})[0],oc=(0,Mn.useState)(tl(na,cc))[0];au(function(){for(var Xb=Ao(Za),hc;!(hc=Xb()).done;)if(hc=hc.value,hc in Fb)(0,oc[hc])(1,Fb[hc]);return function(){Object.values(oc).map(ks)}},[Fb,oc,cc]);au(function(){G(cc,Fb)});(0,Mn.useImperativeHandle)(Bb,Pp(fa(cc)));
return(0,Mn.createElement)(fb.Provider,{value:cc},k?(0,Mn.createElement)(k,sp([].concat(ta,Ha,Za),Fb),Ob):Ob)}),usePublisher:function(ib){return(0,Mn.useCallback)(Lm(Op,(0,Mn.useContext)(fb)[ib]),[ib])},useEmitterValue:function(ib){var Bb=(0,Mn.useContext)(fb)[ib];ib=(0,Mn.useState)(tl(zo,Bb));var Ob=ib[0],Fb=ib[1];au(function(){return ch(Bb,function(cc){cc!==Ob&&Fb(Pp(cc))})},[Bb,Ob]);return Ob},useEmitter:function(ib,Bb){var Ob=(0,Mn.useContext)(fb)[ib];au(function(){return Ob(1,Bb)},[Bb,Ob])}}}
function Yg(){return Yg=Object.assign||function(a){for(var d=1;d<arguments.length;d++){var k=arguments[d],G;for(G in k)Object.prototype.hasOwnProperty.call(k,G)&&(a[G]=k[G])}return a},Yg.apply(this,arguments)}function pm(a,d){if(null==a)return{};var k,G,fa={},na=Object.keys(a);for(G=0;G<na.length;G++)0<=d.indexOf(k=na[G])||(fa[k]=a[k]);return fa}function Bo(a,d){(null==d||d>a.length)&&(d=a.length);for(var k=0,G=Array(d);k<d;k++)G[k]=a[k];return G}function qm(a,d){var k="undefined"!=typeof Symbol&&
a[Symbol.iterator]||a["@@iterator"];if(k)return(k=k.call(a)).next.bind(k);if(Array.isArray(a)||(k=function(fa,na){if(fa){if("string"==typeof fa)return Bo(fa,na);var ta=Object.prototype.toString.call(fa).slice(8,-1);return"Object"===ta&&fa.constructor&&(ta=fa.constructor.name),"Map"===ta||"Set"===ta?Array.from(fa):"Arguments"===ta||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ta)?Bo(fa,na):void 0}}(a))||d&&a&&"number"==typeof a.length){k&&(a=k);var G=0;return function(){return G>=a.length?{done:!0}:
{done:!1,value:a[G++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function Zo(a,d){void 0===d&&(d=!0);var k=(0,Bh.useRef)(null),G=function(na){};if("undefined"!=typeof ResizeObserver){var fa=new ResizeObserver(function(na){na=na[0].target;null!==na.offsetParent&&a(na)});G=function(na){na&&d?(fa.observe(na),k.current=na):(k.current&&fa.unobserve(k.current),k.current=null)}}return{ref:k,
callbackRef:G}}function cj(a,d){return void 0===d&&(d=!0),Zo(a,d).callbackRef}function zi(a,d,k,G,fa,na,ta){return Zo(function(Ha){for(var Sa=function(ib,Bb,Ob,Fb){Ob=ib.length;if(0===Ob)return null;for(var cc=[],oc=0;oc<Ob;oc++){var Xb=ib.item(oc);if(Xb&&void 0!==Xb.dataset.index){var hc=parseInt(Xb.dataset.index),ec=parseFloat(Xb.dataset.knownSize),Ec=Bb(Xb,"offsetHeight");if(0===Ec&&Fb("Zero-sized element, this should not happen",{child:Xb},Cl.ERROR),Ec!==ec)Xb=cc[cc.length-1],0===cc.length||Xb.size!==
Ec||Xb.endIndex!==hc-1?cc.push({startIndex:hc,endIndex:hc,size:Ec}):cc[cc.length-1].endIndex++}}return cc}(Ha.children,d,0,fa),Za=Ha.parentElement;!Za.dataset.virtuosoScroller;)Za=Za.parentElement;var fb="window"===Za.firstElementChild.dataset.viewportType;G({scrollTop:Math.max(ta?ta.scrollTop:fb?window.pageYOffset||document.documentElement.scrollTop:Za.scrollTop,0),scrollHeight:ta?ta.scrollHeight:fb?document.documentElement.scrollHeight:Za.scrollHeight,viewportHeight:ta?ta.offsetHeight:fb?window.innerHeight:
Za.offsetHeight});null==na||na(function(ib,Bb,Ob){return"normal"===Bb||null!=Bb&&Bb.endsWith("px")||Ob("row-gap was not resolved to pixel value correctly",Bb,Cl.WARN),"normal"===Bb?0:parseInt(null!=Bb?Bb:"0",10)}(0,getComputedStyle(Ha).rowGap,fa));null!==Sa&&a(Sa)},k)}function oi(a,d){return Math.round(a.getBoundingClientRect()[d])}function pr(a,d,k,G,fa){void 0===G&&(G=ei);var na=(0,Bh.useRef)(null),ta=(0,Bh.useRef)(null),Ha=(0,Bh.useRef)(null),Sa=(0,Bh.useRef)(!1),Za=(0,Bh.useCallback)(function(fb){fb=
fb.target;var ib=fb===window||fb===document,Bb=ib?window.pageYOffset||document.documentElement.scrollTop:fb.scrollTop,Ob=ib?document.documentElement.scrollHeight:fb.scrollHeight,Fb=ib?window.innerHeight:fb.offsetHeight;fb=function(){a({scrollTop:Math.max(Bb,0),scrollHeight:Ob,viewportHeight:Fb})};Sa.current?(0,IC.flushSync)(fb):fb();Sa.current=!1;null!==ta.current&&(Bb===ta.current||0>=Bb||Bb===Ob-Fb)&&(ta.current=null,d(!0),Ha.current&&(clearTimeout(Ha.current),Ha.current=null))},[a,d]);return(0,Bh.useEffect)(function(){var fb=
fa||na.current;return G(fa||na.current),Za({target:fb}),fb.addEventListener("scroll",Za,{passive:!0}),function(){G(null);fb.removeEventListener("scroll",Za)}},[na,Za,k,G,fa]),{scrollerRef:na,scrollByCallback:function(fb){Sa.current=!0;na.current.scrollBy(fb)},scrollToCallback:function(fb){var ib=na.current;if(ib&&!("offsetHeight"in ib&&0===ib.offsetHeight)){var Bb,Ob,Fb,cc="smooth"===fb.behavior;if(ib===window?(Ob=Math.max(oi(document.documentElement,"height"),document.documentElement.scrollHeight),
Bb=window.innerHeight,Fb=document.documentElement.scrollTop):(Ob=ib.scrollHeight,Bb=oi(ib,"height"),Fb=ib.scrollTop),fb.top=Math.ceil(Math.max(Math.min(Ob-Bb,fb.top),0)),1.01>Math.abs(Bb-Ob)||fb.top===Fb)return a({scrollTop:Fb,scrollHeight:Ob,viewportHeight:Bb}),void(cc&&d(!0));cc?(ta.current=fb.top,Ha.current&&clearTimeout(Ha.current),Ha.current=setTimeout(function(){Ha.current=null;ta.current=null;d(!0)},1E3)):ta.current=null;ib.scrollTo(fb)}}}}function Wo(a,d,k,G,fa){return void 0===G&&(G=Ci),
void 0===fa&&(fa=Ci),{k:a,v:d,lvl:k,l:G,r:fa}}function x(a,d){if(a===Ci)return Ci;var k=a.k,G=a.l,fa=a.r;if(d===k){if(G===Ci)return fa;if(fa===Ci)return G;d=$a(G);return wc(pb(a,{k:d[0],v:d[1],l:lb(G)}))}return wc(pb(a,d<k?{l:x(G,d)}:{r:x(fa,d)}))}function ca(a,d,k){return(void 0===k&&(k="k"),a===Ci)?[-Infinity,void 0]:a[k]===d?[a.k,a.v]:a[k]<d?(d=ca(a.r,d,k),-Infinity===d[0]?[a.k,a.v]:d):ca(a.l,d,k)}function Aa(a,d,k){return a===Ci?Wo(d,k,1):d===a.k?pb(a,{k:d,v:k}):rd(xd(pb(a,d<a.k?{l:Aa(a.l,d,k)}:
{r:Aa(a.r,d,k)})))}function xa(a,d,k){if(a===Ci)return[];var G=a.k,fa=a.v,na=a.r,ta=[];return G>d&&(ta=ta.concat(xa(a.l,d,k))),G>=d&&G<=k&&ta.push({k:G,v:fa}),G<=k&&(ta=ta.concat(xa(na,d,k))),ta}function Ia(a){return a===Ci?[]:[].concat(Ia(a.l),[{k:a.k,v:a.v}],Ia(a.r))}function $a(a){return a.r===Ci?[a.k,a.v]:$a(a.r)}function lb(a){return a.r===Ci?a.l:wc(pb(a,{r:lb(a.r)}))}function pb(a,d){return Wo(void 0!==d.k?d.k:a.k,void 0!==d.v?d.v:a.v,void 0!==d.lvl?d.lvl:a.lvl,void 0!==d.l?d.l:a.l,void 0!==
d.r?d.r:a.r)}function Vb(a){return a===Ci||a.lvl>a.r.lvl}function wc(a){var d=a.l,k=a.r,G=a.lvl;if(k.lvl>=G-1&&d.lvl>=G-1)return a;if(G>k.lvl+1){if(Vb(d))return xd(pb(a,{lvl:G-1}));if(d===Ci||d.r===Ci)throw Error("Unexpected empty nodes");return pb(d.r,{l:pb(d,{r:d.r.l}),r:pb(a,{l:d.r.r,lvl:G-1}),lvl:G})}if(Vb(a))return rd(pb(a,{lvl:G-1}));if(k===Ci||k.l===Ci)throw Error("Unexpected empty nodes");d=k.l;var fa=Vb(d)?k.lvl-1:k.lvl;return pb(d,{l:pb(a,{r:d.l,lvl:G-1}),r:rd(pb(k,{l:d.r,lvl:fa})),lvl:d.lvl+
1})}function Lc(a,d,k){return a===Ci?[]:od(xa(a,ca(a,d)[0],k),function(G){return{index:G.k,value:G.v}})}function od(a,d){var k=a.length;if(0===k)return[];var G=d(a[0]),fa=G.index;G=G.value;for(var na=[],ta=1;ta<k;ta++){var Ha=d(a[ta]),Sa=Ha.index;Ha=Ha.value;na.push({start:fa,end:Sa-1,value:G});fa=Sa;G=Ha}return na.push({start:fa,end:Infinity,value:G}),na}function rd(a){var d=a.r,k=a.lvl;return d===Ci||d.r===Ci||d.lvl!==k||d.r.lvl!==k?a:pb(d,{l:pb(a,{r:d.l}),lvl:k+1})}function xd(a){var d=a.l;return d===
Ci||d.lvl!==a.lvl?a:pb(d,{r:pb(a,{l:d.r})})}function oe(a,d,k,G){void 0===G&&(G=0);for(var fa=a.length-1;G<=fa;){var na=Math.floor((G+fa)/2),ta=k(a[na],d);if(0===ta)return na;if(-1===ta){if(2>fa-G)return na-1;fa=na-1}else{if(fa===G)return na;G=na+1}}throw Error("Failed binary finding record in array - "+a.join(",")+", searched for "+d);}function Af(a){var d=a.size,k=a.startIndex,G=a.endIndex;return function(fa){return fa.start===k&&(fa.end===G||Infinity===fa.end)&&fa.value===d}}function Bg(a,d){a=
a.index;return d===a?0:d<a?-1:1}function vi(a,d){a=a.offset;return d===a?0:d<a?-1:1}function sg(a){return{index:a.index,value:a}}function Di(a,d,k,G){var fa=0,na=0,ta=0,Ha;0!==d?(ta=a[Ha=oe(a,d-1,Bg)].offset,na=ca(k,d-1),fa=na[0],na=na[1],a.length&&a[Ha].size===ca(k,d)[1]&&--Ha,a=a.slice(0,Ha+1)):a=[];for(d=qm(Lc(k,d,Infinity));!(k=d()).done;)Ha=k.value,k=Ha.start,Ha=Ha.value,fa=k-fa,ta=fa*na+ta+fa*G,a.push({offset:ta,size:Ha,index:k}),fa=k,na=Ha;return{offsetTree:a,lastIndex:fa,lastOffset:ta,lastSize:na}}
function Uh(a,d){var k=d[0],G=d[1],fa=d[3];0<k.length&&(0,d[2])("received item sizes",k,Cl.DEBUG);var na=a.sizeTree;d=na;var ta=0;if(0<G.length&&na===Ci&&2===k.length){var Ha=k[0].size,Sa=k[1].size;d=G.reduce(function(fb,ib){return Aa(Aa(fb,ib,Ha),ib+1,Sa)},d)}else k=function(fb,ib){var Bb,Ob=fb===Ci?0:Infinity;for(ib=qm(ib);!(Bb=ib()).done;){var Fb=Bb.value;Bb=Fb.size;var cc=Fb.startIndex,oc=Fb.endIndex;if(Ob=Math.min(Ob,cc),fb===Ci)fb=Aa(fb,0,Bb);else{var Xb=Lc(fb,cc-1,oc+1);if(!Xb.some(Af(Fb))){var hc,
ec=Fb=!1;for(Xb=qm(Xb);!(hc=Xb()).done;){var Ec=hc.value;hc=Ec.start;var Ic=Ec.end;Ec=Ec.value;Fb?(oc>=hc||Bb===Ec)&&(fb=x(fb,hc)):(ec=Ec!==Bb,Fb=!0);Ic>oc&&oc>=hc&&Ec!==Bb&&(fb=Aa(fb,oc+1,Ec))}ec&&(fb=Aa(fb,cc,Bb))}}}return[fb,Ob]}(d,k),d=k[0],ta=k[1];if(d===na)return a;a=Di(a.offsetTree,ta,d,fa);var Za=a.offsetTree;return{sizeTree:d,offsetTree:Za,lastIndex:a.lastIndex,lastOffset:a.lastOffset,lastSize:a.lastSize,groupOffsetTree:G.reduce(function(fb,ib){return Aa(fb,ib,Qh(ib,Za,fa))},Ci),groupIndices:G}}
function Qh(a,d,k){if(0===d.length)return 0;d=d[oe(d,a,Bg)];a-=d.index;a=d.size*a+(a-1)*k+d.offset;return 0<a?a+k:a}function di(a,d,k){if(void 0!==a.groupIndex)return d.groupIndices[a.groupIndex]+1;a=qh("LAST"===a.index?k:a.index,d);return Math.max(0,a,Math.min(k,a))}function qh(a,d){if(d.groupOffsetTree===Ci)return a;for(var k=0;d.groupIndices[k]<=a+k;)k++;return a+k}function Wh(a){a="number"==typeof a?{index:a}:a;return a.align||(a.align="start"),a.behavior&&yH||(a.behavior="auto"),a.offset||(a.offset=
0),a}function Xh(a){return!!a&&("smooth"===a?"smooth":"auto")}function bi(a){return a.reduce(function(d,k){return d.groupIndices.push(d.totalCount),d.totalCount+=k+1,d},{totalCount:0,groupIndices:[]})}function qj(a,d){return!(!a||a[0]!==d[0]||a[1]!==d[1])}function zk(a,d){return!(!a||a.startIndex!==d.startIndex||a.endIndex!==d.endIndex)}function hl(a,d,k){return"number"==typeof a?"up"===k&&"top"===d||"down"===k&&"bottom"===d?a:0:"up"===k?"top"===d?a.main:a.reverse:"bottom"===d?a.main:a.reverse}function un(a,
d,k){if(0===a.length)return[];if(d.groupOffsetTree===Ci)return a.map(function(Sa){return Yg({},Sa,{index:Sa.index+k,originalIndex:Sa.index})});var G,fa=[],na=Lc(d.groupOffsetTree,a[0].index,a[a.length-1].index),ta=void 0,Ha=0;for(a=qm(a);!(G=a()).done;)G=G.value,(!ta||ta.end<G.index)&&(ta=na.shift(),Ha=d.groupIndices.indexOf(ta.start)),fa.push(Yg({},G.index===ta.start?{type:"group",index:Ha}:{index:G.index-(Ha+1)+k,groupIndex:Ha},{size:G.size,offset:G.offset,originalIndex:G.index,data:G.data}));return fa}
function Vm(a,d,k,G,fa,na){var ta=0,Ha=0;0<a.length&&(ta=a[0].offset,Ha=a[a.length-1],Ha=Ha.offset+Ha.size);var Sa=k-fa.lastIndex,Za=ta;G=fa.lastOffset+Sa*fa.lastSize+(Sa-1)*G-Ha;return{items:un(a,fa,na),topItems:un(d,fa,na),topListHeight:d.reduce(function(fb,ib){return ib.size+fb},0),offsetTop:ta,offsetBottom:G,top:Za,bottom:Ha,totalCount:k,firstItemIndex:na}}function tn(a){var d,k=!1;return function(){return k||(k=!0,d=a()),d}}function kh(a,d){var k=(0,Bh.useRef)(null),G=(0,Bh.useCallback)(function(Sa){if(null!==
Sa&&Sa.offsetParent){var Za=Sa.getBoundingClientRect();Sa=Za.width;if(d){var fb=d.getBoundingClientRect();Za=Za.top-fb.top;fb=fb.height-Math.max(0,Za);Za+=d.scrollTop}else fb=window.innerHeight-Math.max(0,Za.top),Za=Za.top+window.pageYOffset;k.current={offsetTop:Za,visibleHeight:fb,visibleWidth:Sa};a(k.current)}},[a,d]),fa=Zo(G),na=fa.callbackRef,ta=fa.ref,Ha=(0,Bh.useCallback)(function(){G(ta.current)},[G,ta]);return(0,Bh.useEffect)(function(){if(d){d.addEventListener("scroll",Ha);var Sa=new ResizeObserver(Ha);
return Sa.observe(d),function(){d.removeEventListener("scroll",Ha);Sa.unobserve(d)}}return window.addEventListener("scroll",Ha),window.addEventListener("resize",Ha),function(){window.removeEventListener("scroll",Ha);window.removeEventListener("resize",Ha)}},[Ha,d]),na}function $p(a){return a}function Ak(a,d){var k=vg();return ch(k,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+d,"color: red;","color: inherit;","color: blue;")}),Gf(k,a),k}function wj(a,d){if("string"!=
typeof a)return{context:d}}function qo(a){var d=a.usePublisher,k=a.useEmitter,G=a.useEmitterValue;return bh.memo(function(fa){var na=fa.style,ta=fa.children;fa=pm(fa,Yy);var Ha=d("scrollContainerState"),Sa=G("ScrollerComponent"),Za=d("smoothScrollTargetReached"),fb=G("scrollerRef"),ib=G("context");Ha=pr(Ha,Za,Sa,fb);Za=Ha.scrollerRef;fb=Ha.scrollByCallback;return k("scrollTo",Ha.scrollToCallback),k("scrollBy",fb),(0,Bh.createElement)(Sa,Yg({ref:Za,style:Yg({},CH,na),"data-test-id":"virtuoso-scroller",
"data-virtuoso-scroller":!0,tabIndex:0},fa,wj(Sa,ib)),ta)})}function Rp(a){var d=a.usePublisher,k=a.useEmitter,G=a.useEmitterValue;return bh.memo(function(fa){var na=fa.style,ta=fa.children;fa=pm(fa,QC);var Ha=d("windowScrollContainerState"),Sa=G("ScrollerComponent"),Za=d("smoothScrollTargetReached"),fb=G("totalListHeight"),ib=G("deviation"),Bb=G("customScrollParent"),Ob=G("context");Za=pr(Ha,Za,Sa,ei,Bb);var Fb=Za.scrollerRef;Ha=Za.scrollByCallback;Za=Za.scrollToCallback;return wH(function(){return Fb.current=
Bb||window,function(){Fb.current=null}},[Fb,Bb]),k("windowScrollTo",Za),k("scrollBy",Ha),(0,Bh.createElement)(Sa,Yg({style:Yg({position:"relative"},na,0!==fb?{height:fb+ib}:{}),"data-virtuoso-scroller":!0},fa,wj(Sa,Ob)),ta)})}function Sp(a,d,k){return Array.from({length:d-a+1}).map(function(G,fa){return{index:fa+a,data:null==k?void 0:k[fa+a]}})}function Cn(a,d){return a&&a.column===d.column&&a.row===d.row}function ro(a,d,k,G){var fa=k.height;return void 0===fa||0===G.length?{top:0,bottom:0}:{top:Wk(a,
d,k,G[0].index),bottom:Wk(a,d,k,G[G.length-1].index)+fa}}function Wk(a,d,k,G){var fa=d.column;a=Hi(1,qv((a.width+fa)/(k.width+fa)));G=qv(G/a);k=G*k.height+Hi(0,G-1)*d.row;return 0<k?k+d.row:k}function Yl(a,d,k){return"normal"===d||null!=d&&d.endsWith("px")||k(a+" was not resolved to pixel value correctly",d,Cl.WARN),"normal"===d?0:parseInt(null!=d?d:"0",10)}function nn(a,d){nn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(k,G){k.__proto__=G;return k};return nn(a,d)}function Yp(a,d){a.prototype=
Object.create(d.prototype);a.prototype.constructor=a;nn(a,d)}function wo(a){wo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(d){return d.__proto__||Object.getPrototypeOf(d)};return wo(a)}function xu(){if("undefined"===typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function Bq(a,d,k){Bq=xu()?Reflect.construct.bind():function(G,
fa,na){var ta=[null];ta.push.apply(ta,fa);G=new (Function.bind.apply(G,ta));na&&nn(G,na.prototype);return G};return Bq.apply(null,arguments)}function Dq(a){var d="function"===typeof Map?new Map:void 0;Dq=function(k){function G(){return Bq(k,arguments,wo(this).constructor)}if(null===k||-1===Function.toString.call(k).indexOf("[native code]"))return k;if("function"!==typeof k)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof d){if(d.has(k))return d.get(k);
d.set(k,G)}G.prototype=Object.create(k.prototype,{constructor:{value:G,enumerable:!1,writable:!0,configurable:!0}});return nn(G,k)};return Dq(a)}function zu(a,d,k){return Math.round(255*a)+","+Math.round(255*d)+","+Math.round(255*k)}function aq(a,d,k,G){void 0===G&&(G=zu);if(0===d)return G(k,k,k);a=(a%360+360)%360/60;var fa=(1-Math.abs(2*k-1))*d,na=fa*(1-Math.abs(a%2-1)),ta=d=0,Ha=0;0<=a&&1>a?(d=fa,ta=na):1<=a&&2>a?(d=na,ta=fa):2<=a&&3>a?(ta=fa,Ha=na):3<=a&&4>a?(ta=na,Ha=fa):4<=a&&5>a?(d=na,Ha=fa):
5<=a&&6>a&&(d=fa,Ha=na);k-=fa/2;return G(d+k,ta+k,Ha+k)}function ls(a){if("string"!==typeof a)throw new en(3);if("string"===typeof a){var d=a.toLowerCase();a=Qw[d]?"#"+Qw[d]:a}if(a.match(bD))return{red:parseInt(""+a[1]+a[2],16),green:parseInt(""+a[3]+a[4],16),blue:parseInt(""+a[5]+a[6],16)};if(a.match(cD))return d=parseFloat((parseInt(""+a[7]+a[8],16)/255).toFixed(2)),{red:parseInt(""+a[1]+a[2],16),green:parseInt(""+a[3]+a[4],16),blue:parseInt(""+a[5]+a[6],16),alpha:d};if(a.match(cz))return{red:parseInt(""+
a[1]+a[1],16),green:parseInt(""+a[2]+a[2],16),blue:parseInt(""+a[3]+a[3],16)};if(a.match(No))return d=parseFloat((parseInt(""+a[4]+a[4],16)/255).toFixed(2)),{red:parseInt(""+a[1]+a[1],16),green:parseInt(""+a[2]+a[2],16),blue:parseInt(""+a[3]+a[3],16),alpha:d};if(d=Xs.exec(a))return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10)};if(d=km.exec(a.substring(0,50)))return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10),alpha:1<parseFloat(""+
d[4])?parseFloat(""+d[4])/100:parseFloat(""+d[4])};var k=Rw.exec(a);if(k){d=parseInt(""+k[1],10);var G=parseInt(""+k[2],10)/100;k=parseInt(""+k[3],10)/100;d="rgb("+aq(d,G,k)+")";G=Xs.exec(d);if(!G)throw new en(4,a,d);return{red:parseInt(""+G[1],10),green:parseInt(""+G[2],10),blue:parseInt(""+G[3],10)}}if(d=tv.exec(a.substring(0,50))){G=parseInt(""+d[1],10);k=parseInt(""+d[2],10)/100;var fa=parseInt(""+d[3],10)/100;G="rgb("+aq(G,k,fa)+")";k=Xs.exec(G);if(!k)throw new en(4,a,G);return{red:parseInt(""+
k[1],10),green:parseInt(""+k[2],10),blue:parseInt(""+k[3],10),alpha:1<parseFloat(""+d[4])?parseFloat(""+d[4])/100:parseFloat(""+d[4])}}throw new en(5);}function so(a){a=a.toString(16);return 1===a.length?"0"+a:a}function Tp(a,d,k){return fo("#"+so(Math.round(255*a))+so(Math.round(255*d))+so(Math.round(255*k)))}function fs(a,d,k){if("number"===typeof a&&"number"===typeof d&&"number"===typeof k)return fo("#"+so(a)+so(d)+so(k));if("object"===typeof a&&void 0===d&&void 0===k)return fo("#"+so(a.red)+so(a.green)+
so(a.blue));throw new en(6);}function ht(a){if("object"!==typeof a)throw new en(8);if("number"===typeof a.red&&"number"===typeof a.green&&"number"===typeof a.blue&&"number"===typeof a.alpha){if("object"===typeof a)a=1<=a.alpha?fs(a.red,a.green,a.blue):"rgba("+a.red+","+a.green+","+a.blue+","+a.alpha+")";else throw new en(7);return a}if("number"===typeof a.red&&"number"===typeof a.green&&"number"===typeof a.blue&&("number"!==typeof a.alpha||"undefined"===typeof a.alpha))return fs(a);if("number"===
typeof a.hue&&"number"===typeof a.saturation&&"number"===typeof a.lightness&&"number"===typeof a.alpha){if("object"===typeof a)a=1<=a.alpha?aq(a.hue,a.saturation,a.lightness,Tp):"rgba("+aq(a.hue,a.saturation,a.lightness)+","+a.alpha+")";else throw new en(2);return a}if("number"===typeof a.hue&&"number"===typeof a.saturation&&"number"===typeof a.lightness&&("number"!==typeof a.alpha||"undefined"===typeof a.alpha)){if("object"===typeof a)a=aq(a.hue,a.saturation,a.lightness,Tp);else throw new en(1);
return a}throw new en(8);}function jr(a,d,k){return function(){var G=k.concat(Array.prototype.slice.call(arguments));return G.length>=d?a.apply(this,G):jr(a,d,G)}}function kr(a,d){if("transparent"===d)return d;d=ls(d);var k=d.red/255,G=d.green/255,fa=d.blue/255,na=Math.max(k,G,fa),ta=Math.min(k,G,fa),Ha=(na+ta)/2;if(na===ta)d=void 0!==d.alpha?{hue:0,saturation:0,lightness:Ha,alpha:d.alpha}:{hue:0,saturation:0,lightness:Ha};else{var Sa=na-ta;ta=.5<Ha?Sa/(2-na-ta):Sa/(na+ta);switch(na){case k:k=(G-
fa)/Sa+(G<fa?6:0);break;case G:k=(fa-k)/Sa+2;break;default:k=(k-G)/Sa+4}k*=60;d=void 0!==d.alpha?{hue:k,saturation:ta,lightness:Ha,alpha:d.alpha}:{hue:k,saturation:ta,lightness:Ha}}Ha=He;a=d.lightness-parseFloat(a);return ht(Ha({},d,{lightness:Math.max(0,Math.min(1,a))}))}function Um(a,d){var k;void 0!==d.strokeWidth&&(d.strokeWidth=Math.max(d.strokeWidth,1));void 0!==d.opacity&&(d.opacity=Math.min(1,Math.max(d.opacity,0)));let G=null!=(k=d.fill)?k:a.props.fill;void 0===G||Oi(G)||"var(--ls-secondary-background-color)"===
G||d.noFill||!LH.includes(a.props.type)||(a=bj(.3,G),d.stroke=a);return d}function js({strokeWidth:a,size:d,mode:k}){return"svg"===k?(0,ku.jsx)("rect",{className:"tl-binding-indicator",x:a,y:a,rx:2,ry:2,width:Math.max(0,d[0]-2*a),height:Math.max(0,d[1]-2*a),strokeWidth:4*a}):(0,ku.jsx)("div",{className:"tl-binding-indicator",style:{position:"absolute",left:0,top:0,right:0,bottom:0,boxShadow:"0 0 0 4px var(--tl-binding)",borderRadius:4}})}function on(){const a=kg();return"panning"===a.inputs.state||
"pinching"===a.inputs.state}function Cq({left:a,middle:d,right:k,stroke:G,strokeWidth:fa}){return(0,Vw.jsxs)("g",{children:[(0,Vw.jsx)("path",{className:"tl-stroke-hitarea",d:`M ${a} L ${d} ${k}`}),(0,Vw.jsx)("path",{d:`M ${a} L ${d} ${k}`,fill:"none",stroke:G,strokeWidth:fa,strokeLinecap:"round",strokeLinejoin:"round",pointerEvents:"none"})]})}function Eq(a,d,k){d=J(a,d,a,k).points;if(!d)return console.warn("Could not find an intersection for the arrow head."),{left:a,right:a};d=(k=d[0])?Pd.rotWith(k,
a,Math.PI/6):a;a=k?Pd.rotWith(k,a,-Math.PI/6):a;return{left:d,right:a}}function ms(a,d,k){const {left:G,right:fa}=Eq(a,d,k);return`M ${G} L ${a} ${fa}`}function Ml(a,d,k,G,fa){a=a.strokeWidth;var na=Pd.dist(d,k);a=Math.min(na/3,16*a);na=[];na.push(`M ${d} L ${k}`);G&&na.push(ms(d,k,a));fa&&na.push(ms(k,d,a));return na.join(" ")}function hs({id:a,bounds:d,labelSize:k,offset:G,scale:fa=1}){return(0,xv.jsx)("defs",{children:(0,xv.jsxs)("mask",{id:a+"_clip",children:[(0,xv.jsx)("rect",{x:-100,y:-100,
width:d.width+200,height:d.height+200,fill:"white"}),(0,xv.jsx)("rect",{x:d.width/2-k[0]/2*fa+((null==G?void 0:G[0])||0),y:d.height/2-k[1]/2*fa+((null==G?void 0:G[1])||0),width:k[0]*fa,height:k[1]*fa,rx:4*fa,ry:4*fa,fill:"black"})]})})}function Up(a,d,k,G=fa=>fa){return a*G(.5-d*(.5-k))}function Vp(a){return[-a[0],-a[1]]}function Yk(a,d){return[a[0]+d[0],a[1]+d[1]]}function Xk(a,d){return[a[0]-d[0],a[1]-d[1]]}function Zk(a,d){return[a[0]*d,a[1]*d]}function Wp(a){return[a[1],-a[0]]}function lr(a,d){return a[0]===
d[0]&&a[1]===d[1]}function Fq(a){return a[0]*a[0]+a[1]*a[1]}function Hq(a){var d=Math.hypot(a[0],a[1]);return[a[0]/d,a[1]/d]}function it(a,d){return Math.hypot(a[1]-d[1],a[0]-d[0])}function to(a,d,k){let G=Math.sin(k);k=Math.cos(k);let fa=a[0]-d[0];a=a[1]-d[1];return[fa*k-a*G+d[0],fa*G+a*k+d[1]]}function qn(a,d,k){return Yk(a,Zk(Xk(d,a),k))}function Xp(a,d,k){return Yk(a,Zk(d,k))}function Gq(a,d={}){let {size:k=16,smoothing:G=.5,thinning:fa=.5,simulatePressure:na=!0,easing:ta=Gd=>Gd,start:Ha={},end:Sa=
{},last:Za=!1}=d,{cap:fb=!0,easing:ib=Gd=>Gd*(2-Gd)}=Ha,{cap:Bb=!0,easing:Ob=Gd=>--Gd*Gd*Gd+1}=Sa;if(0===a.length||0>=k)return[];var Fb=a[a.length-1].runningLength;let cc=!1===Ha.taper?0:!0===Ha.taper?Math.max(k,Fb):Ha.taper,oc=!1===Sa.taper?0:!0===Sa.taper?Math.max(k,Fb):Sa.taper;var Xb=Math.pow(k*G,2);d=[];let hc=[];var ec=a.slice(0,10).reduce((Gd,Zc)=>{var td=Zc.pressure;na&&(Zc=Gp(1,Zc.distance/k),td=Gp(1,1-Zc),td=Gp(1,Gd+.275*(td-Gd)*Zc));return(Gd+td)/2},a[0].pressure),Ec=Up(k,fa,a[a.length-
1].pressure,ta),Ic;let nd=a[0].vector;var Bd=a[0].point;let Ee=Bd;var Vd=Bd;let te=Ee;var gf=!1;for(var Be=0;Be<a.length;Be++){var {pressure:Fe}=a[Be];let {point:Gd,vector:Zc,distance:td,runningLength:we}=a[Be];if(Be<a.length-1&&3>Fb-we)continue;fa?(na&&(Ec=Gp(1,td/k),Fe=Gp(1,1-Ec),Fe=Gp(1,ec+.275*(Fe-ec)*Ec)),Ec=Up(k,fa,Fe,ta)):Ec=k/2;void 0===Ic&&(Ic=Ec);var Fd=we<cc?ib(we/cc):1,bd=Fb-we<oc?Ob((Fb-we)/oc):1;Ec=Math.max(.01,Ec*Math.min(Fd,bd));bd=(Be<a.length-1?a[Be+1]:a[Be]).vector;let Te=Be<a.length-
1?Zc[0]*bd[0]+Zc[1]*bd[1]:1;Fd=null!==Te&&0>Te;if(0>Zc[0]*nd[0]+Zc[1]*nd[1]&&!gf||Fd){Bd=Zk(Wp(nd),Ec);for(let vf=1/13,hf=0;1>=hf;hf+=vf)Vd=to(Xk(Gd,Bd),Gd,ar*hf),d.push(Vd),te=to(Yk(Gd,Bd),Gd,ar*-hf),hc.push(te);Bd=Vd;Ee=te;Fd&&(gf=!0)}else(gf=!1,Be===a.length-1)?(Fe=Zk(Wp(Zc),Ec),d.push(Xk(Gd,Fe)),hc.push(Yk(Gd,Fe))):(ec=Zk(Wp(qn(bd,Zc,Te)),Ec),Vd=Xk(Gd,ec),(1>=Be||Fq(Xk(Bd,Vd))>Xb)&&(d.push(Vd),Bd=Vd),te=Yk(Gd,ec),(1>=Be||Fq(Xk(Ee,te))>Xb)&&(hc.push(te),Ee=te),ec=Fe,nd=Zc)}Fb=a[0].point.slice(0,
2);Xb=1<a.length?a[a.length-1].point.slice(0,2):Yk(a[0].point,[1,1]);Vd=[];gf=[];if(1===a.length){if(!cc&&!oc||Za){a=Xp(Fb,Hq(Wp(Xk(Fb,Xb))),-(Ic||Ec));d=[];for(let Gd=1/13,Zc=Gd;1>=Zc;Zc+=Gd)d.push(to(a,Fb,2*ar*Zc));return d}}else{if(!(cc||oc&&1===a.length))if(fb)for(let Gd=1/13,Zc=Gd;1>=Zc;Zc+=Gd)Ic=to(hc[0],Fb,ar*Zc),Vd.push(Ic);else Be=Xk(d[0],hc[0]),Ic=Zk(Be,.5),Be=Zk(Be,.51),Vd.push(Xk(Fb,Ic),Xk(Fb,Be),Yk(Fb,Be),Yk(Fb,Ic));Ic=Wp(Vp(a[a.length-1].vector));if(oc||cc&&1===a.length)gf.push(Xb);
else if(Bb){a=Xp(Xb,Ic,Ec);for(let Gd=1/29,Zc=Gd;1>Zc;Zc+=Gd)gf.push(to(a,Xb,3*ar*Zc))}else gf.push(Yk(Xb,Zk(Ic,Ec)),Yk(Xb,Zk(Ic,.99*Ec)),Xk(Xb,Zk(Ic,.99*Ec)),Xk(Xb,Zk(Ic,Ec)))}return d.concat(gf,hc.reverse(),Vd)}function Rj(a,d={}){var k;let {streamline:G=.5,size:fa=16,last:na=!1}=d;if(0===a.length)return[];d=.15+.85*(1-G);a=Array.isArray(a[0])?a:a.map(({x:ib,y:Bb,pressure:Ob=.5})=>[ib,Bb,Ob]);if(2===a.length){var ta=a[1];a=a.slice(0,-1);for(var Ha=1;5>Ha;Ha++)a.push(qn(a[0],ta,Ha/4))}1===a.length&&
(a=[...a,[...Yk(a[0],[1,1]),...a[0].slice(2)]]);ta=[{point:[a[0][0],a[0][1]],pressure:0<=a[0][2]?a[0][2]:.25,vector:[1,1],distance:0,runningLength:0}];Ha=!1;let Sa=0,Za=ta[0],fb=a.length-1;for(let ib=1;ib<a.length;ib++){let Bb=na&&ib===fb?a[ib].slice(0,2):qn(Za.point,a[ib],d);if(lr(Za.point,Bb))continue;let Ob=it(Bb,Za.point);if(Sa+=Ob,ib<fb&&!Ha){if(Sa<fa)continue;Ha=!0}Za={point:Bb,pressure:0<=a[ib][2]?a[ib][2]:.5,vector:Hq(Xk(Za.point,Bb)),distance:Ob,runningLength:Sa};ta.push(Za)}return ta[0].vector=
(null==(k=ta[1])?void 0:k.vector)||[0,0],ta}function Dn(a,d=4/3){return(new zh(a)).exportAsSVG(d)}function Xn(a,d=4/3){return(new zh(a)).generatePreviewJsx(void 0,d)}function Mm({id:a,type:d,onRemove:k,showContent:G}){const fa=kg(),{handlers:na}=Py.default.useContext(Gi),ta=na.t;return(0,si.jsxs)("div",{className:"tl-shape-links-panel-item color-level relative",children:[(0,si.jsx)("div",{className:"whitespace-pre break-all overflow-hidden text-ellipsis inline-flex",children:(0,si.jsx)(Qy,{id:a,showReferenceContent:G})}),
(0,si.jsx)("div",{className:"flex-1"}),na.getBlockPageName(a)!==fa.currentPage.name&&(0,si.jsx)(ig,{tooltip:ta("whiteboard/open-page"),type:"button",onClick:()=>null==na?void 0:na.redirectToPage(a),children:(0,si.jsx)(gh,{name:"open-as-page"})}),(0,si.jsx)(ig,{tooltip:ta("whiteboard/open-page-in-sidebar"),type:"button",onClick:()=>null==na?void 0:na.sidebarAddBlock(a,"B"===d?"block":"page"),children:(0,si.jsx)(gh,{name:"move-to-sidebar-right"})}),k&&(0,si.jsx)(ig,{className:"tl-shape-links-panel-item-remove-button",
tooltip:ta("whiteboard/remove-link"),type:"button",onClick:k,children:(0,si.jsx)(gh,{name:"x",className:"!translate-y-0"})})]})}function ka({options:a,value:d,onValueChange:k}){return(0,er.jsx)(oD,{className:"tl-toggle-group-input",type:"single",value:d,onValueChange:k,children:a.map(G=>(0,er.jsx)(Gj,{content:G.tooltip,children:(0,er.jsx)("div",{className:"inline-block",children:(0,er.jsx)(pD,{className:"tl-toggle-group-input-button",value:G.value,disabled:G.value===d,children:(0,er.jsx)(gh,{name:G.icon})})})},
G.value))})}function Ca({options:a,value:d,onValueChange:k}){return(0,er.jsx)(oD,{className:"tl-toggle-group-input",type:"multiple",value:d,onValueChange:k,children:a.map(G=>(0,er.jsx)(pD,{className:"tl-toggle-group-input-button",value:G.value,children:(0,er.jsx)(gh,{name:G.icon})},G.value))})}function Wa(a){return kg().selectedShapesArray.filter(d=>!d.props.isLocked).filter(d=>{var k;return null==(k=mz[d.props.type])?void 0:k.includes(a)})}function Pb(a){return d=>"mouse"!==d.pointerType?a(d):void 0}
function mc(a){var d;a=a.match(/\.[0-9a-z]+$/i);if(!a)return"unknown";const k=a[0].toLowerCase();[a]=null!=(d=Object.entries(gr).find(([,G])=>G.includes(k)))?d:["unknown",null];return a}function Bc(...a){return(...d)=>Nh(this,null,function*(){for(const k of a){const G=yield k(...d);if(G&&0<G.length)return G}return null})}function id(a,d){return Nh(this,null,function*(){return a.types.includes(d)?a instanceof DataTransfer?a.getData(d):yield(yield a.getType(d)).text():null})}function Cd(){const {handlers:a}=
wD.useContext(Gi);return wD.useCallback((d,k)=>Nh(this,null,function*(){if(k.shiftKey&&1===d.selectedShapesArray.length){var G=yield navigator.clipboard.read();let fa;0<G.length&&(G=(yield(yield G[0].getType("text/plain")).text()).trim())&&(/^\(\(.*\)\)$/.test(G)&&40===G.length?(G=G.slice(2,-2),Hl(G)&&(fa=G)):/^\[\[.*\]\]$/.test(G)&&(fa=G.slice(2,-2)));if(fa){d.selectedShapesArray[0].update({refs:[fa]});d.persist();return}}xD(d,k,a)}),[])}function Td(){const a=Cd();return aI.useCallback((d,k)=>Nh(this,
[d,k],function*(G,{dataTransfer:fa,point:na}){a(G,{point:na,shiftKey:!1,dataTransfer:fa,fromDrop:!0})}),[])}function me(){const {handlers:a}=dx.useContext(Gi);return dx.useCallback((d,{text:k,html:G})=>{a.copyToClipboard(k,G)},[])}function Je(){return ex.default.useCallback(a=>Nh(this,null,function*(){setTimeout(()=>{a.transition("logseq-portal").selectedTool.transition("creating")},100)}),[])}var Cf=Object.create,Rf=Object.defineProperty,uh=Object.defineProperties,Xg=Object.getOwnPropertyDescriptor,
jk=Object.getOwnPropertyDescriptors,vo=Object.getOwnPropertyNames,Kl=Object.getOwnPropertySymbols,ai=Object.getPrototypeOf,kk=Object.prototype.hasOwnProperty,wm=Object.prototype.propertyIsEnumerable,Xo=(a,d,k)=>d in a?Rf(a,d,{enumerable:!0,configurable:!0,writable:!0,value:k}):a[d]=k,Ud=(a,d)=>{for(var k in d||={})kk.call(d,k)&&Xo(a,k,d[k]);if(Kl)for(k of Kl(d))wm.call(d,k)&&Xo(a,k,d[k]);return a},Re=(a,d)=>uh(a,jk(d)),nf=(a,d)=>{var k={},G;for(G in a)kk.call(a,G)&&0>d.indexOf(G)&&(k[G]=a[G]);if(null!=
a&&Kl)for(G of Kl(a))0>d.indexOf(G)&&wm.call(a,G)&&(k[G]=a[G]);return k},jh=(a,d)=>function(){return d||(0,a[vo(a)[0]])((d={exports:{}}).exports,d),d.exports},tm=(a,d,k,G)=>{if(d&&"object"===typeof d||"function"===typeof d)for(let fa of vo(d))kk.call(a,fa)||fa===k||Rf(a,fa,{get:()=>d[fa],enumerable:!(G=Xg(d,fa))||G.enumerable});return a},$e=(a,d,k)=>(k=null!=a?Cf(ai(a)):{},tm(!d&&a&&a.__esModule?k:Rf(k,"default",{value:a,enumerable:!0}),a)),Nd=(a,d,k,G)=>{for(var fa=1<G?void 0:G?Xg(d,k):d,na=a.length-
1,ta;0<=na;na--)if(ta=a[na])fa=(G?ta(d,k,fa):ta(fa))||fa;G&&fa&&Rf(d,k,fa);return fa},gb=(a,d,k)=>{Xo(a,"symbol"!==typeof d?d+"":d,k);return k},Nh=(a,d,k)=>new Promise((G,fa)=>{var na=Sa=>{try{Ha(k.next(Sa))}catch(Za){fa(Za)}},ta=Sa=>{try{Ha(k.throw(Sa))}catch(Za){fa(Za)}},Ha=Sa=>Sa.done?G(Sa.value):Promise.resolve(Sa.value).then(na,ta);Ha((k=k.apply(a,d)).next())}),bm=jh({["../../node_modules/rbush/rbush.min.js"](a,d){!function(k,G){"object"==typeof a&&"undefined"!=typeof d?d.exports=G():"function"==
typeof define&&define.amd?define(G):(k=k||self).RBush=G()}(a,function(){function k(Xb,hc,ec,Ec,Ic){!function Be(Bd,Ee,Vd,te,gf){for(;te>Vd;){if(600<te-Vd){var Fe=te-Vd+1,Fd=Ee-Vd+1,bd=Math.log(Fe),Gd=.5*Math.exp(2*bd/3);bd=.5*Math.sqrt(bd*Gd*(Fe-Gd)/Fe)*(0>Fd-Fe/2?-1:1);Be(Bd,Ee,Math.max(Vd,Math.floor(Ee-Fd*Gd/Fe+bd)),Math.min(te,Math.floor(Ee+(Fe-Fd)*Gd/Fe+bd)),gf)}Fe=Bd[Ee];Fd=Vd;Gd=te;G(Bd,Vd,Ee);for(0<gf(Bd[te],Fe)&&G(Bd,Vd,te);Fd<Gd;){G(Bd,Fd,Gd);Fd++;for(Gd--;0>gf(Bd[Fd],Fe);)Fd++;for(;0<gf(Bd[Gd],
Fe);)Gd--}0===gf(Bd[Vd],Fe)?G(Bd,Vd,Gd):G(Bd,++Gd,te);Gd<=Ee&&(Vd=Gd+1);Ee<=Gd&&(te=Gd-1)}}(Xb,hc,ec||0,Ec||Xb.length-1,Ic||fa)}function G(Xb,hc,ec){var Ec=Xb[hc];Xb[hc]=Xb[ec];Xb[ec]=Ec}function fa(Xb,hc){return Xb<hc?-1:Xb>hc?1:0}function na(Xb,hc){ta(Xb,0,Xb.children.length,hc,Xb)}function ta(Xb,hc,ec,Ec,Ic){Ic||=Fb(null);Ic.minX=1/0;Ic.minY=1/0;Ic.maxX=-1/0;for(Ic.maxY=-1/0;hc<ec;hc++){var nd=Xb.children[hc];Ha(Ic,Xb.leaf?Ec(nd):nd)}return Ic}function Ha(Xb,hc){return Xb.minX=Math.min(Xb.minX,
hc.minX),Xb.minY=Math.min(Xb.minY,hc.minY),Xb.maxX=Math.max(Xb.maxX,hc.maxX),Xb.maxY=Math.max(Xb.maxY,hc.maxY),Xb}function Sa(Xb,hc){return Xb.minX-hc.minX}function Za(Xb,hc){return Xb.minY-hc.minY}function fb(Xb){return(Xb.maxX-Xb.minX)*(Xb.maxY-Xb.minY)}function ib(Xb){return Xb.maxX-Xb.minX+(Xb.maxY-Xb.minY)}function Bb(Xb,hc){return Xb.minX<=hc.minX&&Xb.minY<=hc.minY&&hc.maxX<=Xb.maxX&&hc.maxY<=Xb.maxY}function Ob(Xb,hc){return hc.minX<=Xb.maxX&&hc.minY<=Xb.maxY&&hc.maxX>=Xb.minX&&hc.maxY>=Xb.minY}
function Fb(Xb){return{children:Xb,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function cc(Xb,hc,ec,Ec,Ic){for(var nd=[hc,ec];nd.length;)if(!((ec=nd.pop())-(hc=nd.pop())<=Ec)){var Bd=hc+Math.ceil((ec-hc)/Ec/2)*Ec;k(Xb,Bd,hc,ec,Ic);nd.push(hc,Bd,Bd,ec)}}var oc=function(Xb){void 0===Xb&&(Xb=9);this._maxEntries=Math.max(4,Xb);this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries));this.clear()};return oc.prototype.all=function(){return this._all(this.data,[])},oc.prototype.search=function(Xb){var hc=
this.data,ec=[];if(!Ob(Xb,hc))return ec;for(var Ec=this.toBBox,Ic=[];hc;){for(var nd=0;nd<hc.children.length;nd++){var Bd=hc.children[nd],Ee=hc.leaf?Ec(Bd):Bd;Ob(Xb,Ee)&&(hc.leaf?ec.push(Bd):Bb(Xb,Ee)?this._all(Bd,ec):Ic.push(Bd))}hc=Ic.pop()}return ec},oc.prototype.collides=function(Xb){var hc=this.data;if(!Ob(Xb,hc))return!1;for(var ec=[];hc;){for(var Ec=0;Ec<hc.children.length;Ec++){var Ic=hc.children[Ec],nd=hc.leaf?this.toBBox(Ic):Ic;if(Ob(Xb,nd)){if(hc.leaf||Bb(Xb,nd))return!0;ec.push(Ic)}}hc=
ec.pop()}return!1},oc.prototype.load=function(Xb){if(!Xb||!Xb.length)return this;if(Xb.length<this._minEntries){for(var hc=0;hc<Xb.length;hc++)this.insert(Xb[hc]);return this}Xb=this._build(Xb.slice(),0,Xb.length-1,0);this.data.children.length?this.data.height===Xb.height?this._splitRoot(this.data,Xb):(this.data.height<Xb.height&&(hc=this.data,this.data=Xb,Xb=hc),this._insert(Xb,this.data.height-Xb.height-1,!0)):this.data=Xb;return this},oc.prototype.insert=function(Xb){return Xb&&this._insert(Xb,
this.data.height-1),this},oc.prototype.clear=function(){return this.data=Fb([]),this},oc.prototype.remove=function(Xb,hc){if(!Xb)return this;for(var ec,Ec,Ic,nd=this.data,Bd=this.toBBox(Xb),Ee=[],Vd=[];nd||Ee.length;){if(nd||(nd=Ee.pop(),Ec=Ee[Ee.length-1],ec=Vd.pop(),Ic=!0),nd.leaf){a:{var te=Xb;var gf=nd.children,Be=hc;if(Be){for(var Fe=0;Fe<gf.length;Fe++)if(Be(te,gf[Fe])){te=Fe;break a}te=-1}else te=gf.indexOf(te)}if(-1!==te)return nd.children.splice(te,1),Ee.push(nd),this._condense(Ee),this}Ic||
nd.leaf||!Bb(nd,Bd)?Ec?(ec++,nd=Ec.children[ec],Ic=!1):nd=null:(Ee.push(nd),Vd.push(ec),ec=0,Ec=nd,nd=nd.children[0])}return this},oc.prototype.toBBox=function(Xb){return Xb},oc.prototype.compareMinX=function(Xb,hc){return Xb.minX-hc.minX},oc.prototype.compareMinY=function(Xb,hc){return Xb.minY-hc.minY},oc.prototype.toJSON=function(){return this.data},oc.prototype.fromJSON=function(Xb){return this.data=Xb,this},oc.prototype._all=function(Xb,hc){for(var ec=[];Xb;)Xb.leaf?hc.push.apply(hc,Xb.children):
ec.push.apply(ec,Xb.children),Xb=ec.pop();return hc},oc.prototype._build=function(Xb,hc,ec,Ec){var Ic,nd=ec-hc+1,Bd=this._maxEntries;if(nd<=Bd)return na(Ic=Fb(Xb.slice(hc,ec+1)),this.toBBox),Ic;Ec||(Ec=Math.ceil(Math.log(nd)/Math.log(Bd)),Bd=Math.ceil(nd/Math.pow(Bd,Ec-1)));(Ic=Fb([])).leaf=!1;Ic.height=Ec;nd=Math.ceil(nd/Bd);Bd=nd*Math.ceil(Math.sqrt(Bd));for(cc(Xb,hc,ec,Bd,this.compareMinX);hc<=ec;hc+=Bd){var Ee=Math.min(hc+Bd-1,ec);cc(Xb,hc,Ee,nd,this.compareMinY);for(var Vd=hc;Vd<=Ee;Vd+=nd)Ic.children.push(this._build(Xb,
Vd,Math.min(Vd+nd-1,Ee),Ec-1))}return na(Ic,this.toBBox),Ic},oc.prototype._chooseSubtree=function(Xb,hc,ec,Ec){for(;Ec.push(hc),!hc.leaf&&Ec.length-1!==ec;){for(var Ic=1/0,nd=1/0,Bd=void 0,Ee=0;Ee<hc.children.length;Ee++){var Vd=hc.children[Ee],te=fb(Vd),gf=(Be=Xb,Fe=Vd,(Math.max(Fe.maxX,Be.maxX)-Math.min(Fe.minX,Be.minX))*(Math.max(Fe.maxY,Be.maxY)-Math.min(Fe.minY,Be.minY))-te);gf<nd?(nd=gf,Ic=te<Ic?te:Ic,Bd=Vd):gf===nd&&te<Ic&&(Ic=te,Bd=Vd)}hc=Bd||hc.children[0]}var Be,Fe;return hc},oc.prototype._insert=
function(Xb,hc,ec){ec=ec?Xb:this.toBBox(Xb);var Ec=[],Ic=this._chooseSubtree(ec,this.data,hc,Ec);Ic.children.push(Xb);for(Ha(Ic,ec);0<=hc&&Ec[hc].children.length>this._maxEntries;)this._split(Ec,hc),hc--;this._adjustParentBBoxes(ec,Ec,hc)},oc.prototype._split=function(Xb,hc){var ec=Xb[hc],Ec=ec.children.length,Ic=this._minEntries;this._chooseSplitAxis(ec,Ic,Ec);Ec=this._chooseSplitIndex(ec,Ic,Ec);Ec=Fb(ec.children.splice(Ec,ec.children.length-Ec));Ec.height=ec.height;Ec.leaf=ec.leaf;na(ec,this.toBBox);
na(Ec,this.toBBox);hc?Xb[hc-1].children.push(Ec):this._splitRoot(ec,Ec)},oc.prototype._splitRoot=function(Xb,hc){this.data=Fb([Xb,hc]);this.data.height=Xb.height+1;this.data.leaf=!1;na(this.data,this.toBBox)},oc.prototype._chooseSplitIndex=function(Xb,hc,ec){for(var Ec,Ic,nd,Bd,Ee,Vd,te,gf=1/0,Be=1/0,Fe=hc;Fe<=ec-hc;Fe++){var Fd=ta(Xb,0,Fe,this.toBBox),bd=ta(Xb,Fe,ec,this.toBBox),Gd=(Ic=Fd,nd=bd,Bd=void 0,Ee=void 0,Vd=void 0,te=void 0,Bd=Math.max(Ic.minX,nd.minX),Ee=Math.max(Ic.minY,nd.minY),Vd=Math.min(Ic.maxX,
nd.maxX),te=Math.min(Ic.maxY,nd.maxY),Math.max(0,Vd-Bd)*Math.max(0,te-Ee));Fd=fb(Fd)+fb(bd);Gd<gf?(gf=Gd,Ec=Fe,Be=Fd<Be?Fd:Be):Gd===gf&&Fd<Be&&(Be=Fd,Ec=Fe)}return Ec||ec-hc},oc.prototype._chooseSplitAxis=function(Xb,hc,ec){var Ec=Xb.leaf?this.compareMinX:Sa,Ic=Xb.leaf?this.compareMinY:Za;this._allDistMargin(Xb,hc,ec,Ec)<this._allDistMargin(Xb,hc,ec,Ic)&&Xb.children.sort(Ec)},oc.prototype._allDistMargin=function(Xb,hc,ec,Ec){Xb.children.sort(Ec);Ec=this.toBBox;for(var Ic=ta(Xb,0,hc,Ec),nd=ta(Xb,ec-
hc,ec,Ec),Bd=ib(Ic)+ib(nd),Ee=hc;Ee<ec-hc;Ee++){var Vd=Xb.children[Ee];Ha(Ic,Xb.leaf?Ec(Vd):Vd);Bd+=ib(Ic)}for(ec=ec-hc-1;ec>=hc;ec--)Ic=Xb.children[ec],Ha(nd,Xb.leaf?Ec(Ic):Ic),Bd+=ib(nd);return Bd},oc.prototype._adjustParentBBoxes=function(Xb,hc,ec){for(;0<=ec;ec--)Ha(hc[ec],Xb)},oc.prototype._condense=function(Xb){for(var hc=Xb.length-1,ec=void 0;0<=hc;hc--)0===Xb[hc].children.length?0<hc?(ec=Xb[hc-1].children).splice(ec.indexOf(Xb[hc]),1):this.clear():na(Xb[hc],this.toBBox)},oc})}}),kt=jh({["../../node_modules/fast-deep-equal/index.js"](a,
d){d.exports=function na(G,fa){if(G===fa)return!0;if(G&&fa&&"object"==typeof G&&"object"==typeof fa){if(G.constructor!==fa.constructor)return!1;var ta;if(Array.isArray(G)){var Ha=G.length;if(Ha!=fa.length)return!1;for(ta=Ha;0!==ta--;)if(!na(G[ta],fa[ta]))return!1;return!0}if(G.constructor===RegExp)return G.source===fa.source&&G.flags===fa.flags;if(G.valueOf!==Object.prototype.valueOf)return G.valueOf()===fa.valueOf();if(G.toString!==Object.prototype.toString)return G.toString()===fa.toString();var Sa=
Object.keys(G);Ha=Sa.length;if(Ha!==Object.keys(fa).length)return!1;for(ta=Ha;0!==ta--;)if(!Object.prototype.hasOwnProperty.call(fa,Sa[ta]))return!1;for(ta=Ha;0!==ta--;)if(Ha=Sa[ta],!na(G[Ha],fa[Ha]))return!1;return!0}return G!==G&&fa!==fa}}}),nr=jh({["../../../node_modules/deepmerge/dist/cjs.js"](a,d){function k(ib,Bb){return!1!==Bb.clone&&Bb.isMergeableObject(ib)?Sa(Array.isArray(ib)?[]:{},ib,Bb):ib}function G(ib,Bb,Ob){return ib.concat(Bb).map(function(Fb){return k(Fb,Ob)})}function fa(ib){return Object.getOwnPropertySymbols?
Object.getOwnPropertySymbols(ib).filter(function(Bb){return Object.propertyIsEnumerable.call(ib,Bb)}):[]}function na(ib){return Object.keys(ib).concat(fa(ib))}function ta(ib,Bb){try{return Bb in ib}catch(Ob){return!1}}function Ha(ib,Bb,Ob){var Fb={};Ob.isMergeableObject(ib)&&na(ib).forEach(function(cc){Fb[cc]=k(ib[cc],Ob)});na(Bb).forEach(function(cc){if(!ta(ib,cc)||Object.hasOwnProperty.call(ib,cc)&&Object.propertyIsEnumerable.call(ib,cc))if(ta(ib,cc)&&Ob.isMergeableObject(Bb[cc])){if(Ob.customMerge){var oc=
Ob.customMerge(cc);oc="function"===typeof oc?oc:Sa}else oc=Sa;Fb[cc]=oc(ib[cc],Bb[cc],Ob)}else Fb[cc]=k(Bb[cc],Ob)});return Fb}function Sa(ib,Bb,Ob){Ob=Ob||{};Ob.arrayMerge=Ob.arrayMerge||G;Ob.isMergeableObject=Ob.isMergeableObject||Za;Ob.cloneUnlessOtherwiseSpecified=k;var Fb=Array.isArray(Bb),cc=Array.isArray(ib);return Fb!==cc?k(Bb,Ob):Fb?Ob.arrayMerge(ib,Bb,Ob):Ha(ib,Bb,Ob)}var Za=function(ib){var Bb;if(Bb=!!ib&&"object"===typeof ib)Bb=Object.prototype.toString.call(ib),Bb=!("[object RegExp]"===
Bb||"[object Date]"===Bb||ib.$$typeof===fb);return Bb},fb="function"===typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;Sa.all=function(ib,Bb){if(!Array.isArray(ib))throw Error("first argument should be an array");return ib.reduce(function(Ob,Fb){return Sa(Ob,Fb,Bb)},{})};d.exports=Sa}}),gs=jh({["../../node_modules/tslib/tslib.js"](a,d){var k,G,fa,na,ta,Ha,Sa,Za,fb,ib,Bb,Ob,Fb,cc,oc,Xb,hc,ec,Ec,Ic,nd,Bd,Ee,Vd,te;(function(gf){function Be(Fd,bd){Fd!==Fe&&("function"===typeof Object.create?
Object.defineProperty(Fd,"__esModule",{value:!0}):Fd.__esModule=!0);return function(Gd,Zc){return Fd[Gd]=bd?bd(Gd,Zc):Zc}}var Fe="object"===typeof ya?ya:"object"===typeof self?self:"object"===typeof this?this:{};"function"===typeof define&&define.amd?define("tslib",["exports"],function(Fd){gf(Be(Fe,Be(Fd)))}):"object"===typeof d&&"object"===typeof d.exports?gf(Be(Fe,Be(d.exports))):gf(Be(Fe))})(function(gf){var Be=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Fd,bd){Fd.__proto__=
bd}||function(Fd,bd){for(var Gd in bd)Object.prototype.hasOwnProperty.call(bd,Gd)&&(Fd[Gd]=bd[Gd])};k=function(Fd,bd){function Gd(){this.constructor=Fd}if("function"!==typeof bd&&null!==bd)throw new TypeError("Class extends value "+String(bd)+" is not a constructor or null");Be(Fd,bd);Fd.prototype=null===bd?Object.create(bd):(Gd.prototype=bd.prototype,new Gd)};G=Object.assign||function(Fd){for(var bd,Gd=1,Zc=arguments.length;Gd<Zc;Gd++){bd=arguments[Gd];for(var td in bd)Object.prototype.hasOwnProperty.call(bd,
td)&&(Fd[td]=bd[td])}return Fd};fa=function(Fd,bd){var Gd={},Zc;for(Zc in Fd)Object.prototype.hasOwnProperty.call(Fd,Zc)&&0>bd.indexOf(Zc)&&(Gd[Zc]=Fd[Zc]);if(null!=Fd&&"function"===typeof Object.getOwnPropertySymbols){var td=0;for(Zc=Object.getOwnPropertySymbols(Fd);td<Zc.length;td++)0>bd.indexOf(Zc[td])&&Object.prototype.propertyIsEnumerable.call(Fd,Zc[td])&&(Gd[Zc[td]]=Fd[Zc[td]])}return Gd};na=function(Fd,bd,Gd,Zc){var td=arguments.length,we=3>td?bd:null===Zc?Zc=Object.getOwnPropertyDescriptor(bd,
Gd):Zc,Te;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)we=Reflect.decorate(Fd,bd,Gd,Zc);else for(var vf=Fd.length-1;0<=vf;vf--)if(Te=Fd[vf])we=(3>td?Te(we):3<td?Te(bd,Gd,we):Te(bd,Gd))||we;return 3<td&&we&&Object.defineProperty(bd,Gd,we),we};ta=function(Fd,bd){return function(Gd,Zc){bd(Gd,Zc,Fd)}};Ha=function(Fd,bd){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(Fd,bd)};Sa=function(Fd,bd,Gd,Zc){function td(we){return we instanceof Gd?
we:new Gd(function(Te){Te(we)})}return new (Gd||=Promise)(function(we,Te){function vf(Ig){try{Mf(Zc.next(Ig))}catch(qf){Te(qf)}}function hf(Ig){try{Mf(Zc["throw"](Ig))}catch(qf){Te(qf)}}function Mf(Ig){Ig.done?we(Ig.value):td(Ig.value).then(vf,hf)}Mf((Zc=Zc.apply(Fd,bd||[])).next())})};Za=function(Fd,bd){function Gd(Mf){return function(Ig){return Zc([Mf,Ig])}}function Zc(Mf){if(we)throw new TypeError("Generator is already executing.");for(;td;)try{if(we=1,Te&&(vf=Mf[0]&2?Te["return"]:Mf[0]?Te["throw"]||
((vf=Te["return"])&&vf.call(Te),0):Te.next)&&!(vf=vf.call(Te,Mf[1])).done)return vf;if(Te=0,vf)Mf=[Mf[0]&2,vf.value];switch(Mf[0]){case 0:case 1:vf=Mf;break;case 4:return td.label++,{value:Mf[1],done:!1};case 5:td.label++;Te=Mf[1];Mf=[0];continue;case 7:Mf=td.ops.pop();td.trys.pop();continue;default:if(!(vf=td.trys,vf=0<vf.length&&vf[vf.length-1])&&(6===Mf[0]||2===Mf[0])){td=0;continue}if(3===Mf[0]&&(!vf||Mf[1]>vf[0]&&Mf[1]<vf[3]))td.label=Mf[1];else if(6===Mf[0]&&td.label<vf[1])td.label=vf[1],vf=
Mf;else if(vf&&td.label<vf[2])td.label=vf[2],td.ops.push(Mf);else{vf[2]&&td.ops.pop();td.trys.pop();continue}}Mf=bd.call(Fd,td)}catch(Ig){Mf=[6,Ig],Te=0}finally{we=vf=0}if(Mf[0]&5)throw Mf[1];return{value:Mf[0]?Mf[1]:void 0,done:!0}}var td={label:0,sent:function(){if(vf[0]&1)throw vf[1];return vf[1]},trys:[],ops:[]},we,Te,vf,hf;return hf={next:Gd(0),"throw":Gd(1),"return":Gd(2)},"function"===typeof Symbol&&(hf[Symbol.iterator]=function(){return this}),hf};fb=function(Fd,bd){for(var Gd in Fd)"default"===
Gd||Object.prototype.hasOwnProperty.call(bd,Gd)||te(bd,Fd,Gd)};te=Object.create?function(Fd,bd,Gd,Zc){void 0===Zc&&(Zc=Gd);var td=Object.getOwnPropertyDescriptor(bd,Gd);if(!td||("get"in td?!bd.__esModule:td.writable||td.configurable))td={enumerable:!0,get:function(){return bd[Gd]}};Object.defineProperty(Fd,Zc,td)}:function(Fd,bd,Gd,Zc){void 0===Zc&&(Zc=Gd);Fd[Zc]=bd[Gd]};ib=function(Fd){var bd="function"===typeof Symbol&&Symbol.iterator,Gd=bd&&Fd[bd],Zc=0;if(Gd)return Gd.call(Fd);if(Fd&&"number"===
typeof Fd.length)return{next:function(){Fd&&Zc>=Fd.length&&(Fd=void 0);return{value:Fd&&Fd[Zc++],done:!Fd}}};throw new TypeError(bd?"Object is not iterable.":"Symbol.iterator is not defined.");};Bb=function(Fd,bd){var Gd="function"===typeof Symbol&&Fd[Symbol.iterator];if(!Gd)return Fd;Fd=Gd.call(Fd);var Zc,td=[];try{for(;(void 0===bd||0<bd--)&&!(Zc=Fd.next()).done;)td.push(Zc.value)}catch(Te){var we={error:Te}}finally{try{Zc&&!Zc.done&&(Gd=Fd["return"])&&Gd.call(Fd)}finally{if(we)throw we.error;}}return td};
Ob=function(){for(var Fd=[],bd=0;bd<arguments.length;bd++)Fd=Fd.concat(Bb(arguments[bd]));return Fd};Fb=function(){for(var Fd=0,bd=0,Gd=arguments.length;bd<Gd;bd++)Fd+=arguments[bd].length;Fd=Array(Fd);var Zc=0;for(bd=0;bd<Gd;bd++)for(var td=arguments[bd],we=0,Te=td.length;we<Te;we++,Zc++)Fd[Zc]=td[we];return Fd};cc=function(Fd,bd,Gd){if(Gd||2===arguments.length)for(var Zc=0,td=bd.length,we;Zc<td;Zc++)!we&&Zc in bd||(we||=Array.prototype.slice.call(bd,0,Zc),we[Zc]=bd[Zc]);return Fd.concat(we||Array.prototype.slice.call(bd))};
oc=function(Fd){return this instanceof oc?(this.v=Fd,this):new oc(Fd)};Xb=function(Fd,bd,Gd){function Zc(qf){hf[qf]&&(Mf[qf]=function(Cg){return new Promise(function(dh,Qi){1<Ig.push([qf,Cg,dh,Qi])||td(qf,Cg)})})}function td(qf,Cg){try{var dh=hf[qf](Cg);dh.value instanceof oc?Promise.resolve(dh.value.v).then(we,Te):vf(Ig[0][2],dh)}catch(Qi){vf(Ig[0][3],Qi)}}function we(qf){td("next",qf)}function Te(qf){td("throw",qf)}function vf(qf,Cg){(qf(Cg),Ig.shift(),Ig.length)&&td(Ig[0][0],Ig[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");
var hf=Gd.apply(Fd,bd||[]),Mf,Ig=[];return Mf={},Zc("next"),Zc("throw"),Zc("return"),Mf[Symbol.asyncIterator]=function(){return this},Mf};hc=function(Fd){function bd(td,we){Gd[td]=Fd[td]?function(Te){return(Zc=!Zc)?{value:oc(Fd[td](Te)),done:"return"===td}:we?we(Te):Te}:we}var Gd,Zc;return Gd={},bd("next"),bd("throw",function(td){throw td;}),bd("return"),Gd[Symbol.iterator]=function(){return this},Gd};ec=function(Fd){function bd(we){td[we]=Fd[we]&&function(Te){return new Promise(function(vf,hf){Te=
Fd[we](Te);Gd(vf,hf,Te.done,Te.value)})}}function Gd(we,Te,vf,hf){Promise.resolve(hf).then(function(Mf){we({value:Mf,done:vf})},Te)}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var Zc=Fd[Symbol.asyncIterator],td;return Zc?Zc.call(Fd):(Fd="function"===typeof ib?ib(Fd):Fd[Symbol.iterator](),td={},bd("next"),bd("throw"),bd("return"),td[Symbol.asyncIterator]=function(){return this},td)};Ec=function(Fd,bd){Object.defineProperty?Object.defineProperty(Fd,"raw",{value:bd}):
Fd.raw=bd;return Fd};var Fe=Object.create?function(Fd,bd){Object.defineProperty(Fd,"default",{enumerable:!0,value:bd})}:function(Fd,bd){Fd["default"]=bd};Ic=function(Fd){if(Fd&&Fd.__esModule)return Fd;var bd={};if(null!=Fd)for(var Gd in Fd)"default"!==Gd&&Object.prototype.hasOwnProperty.call(Fd,Gd)&&te(bd,Fd,Gd);Fe(bd,Fd);return bd};nd=function(Fd){return Fd&&Fd.__esModule?Fd:{"default":Fd}};Bd=function(Fd,bd,Gd,Zc){if("a"===Gd&&!Zc)throw new TypeError("Private accessor was defined without a getter");
if("function"===typeof bd?Fd!==bd||!Zc:!bd.has(Fd))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===Gd?Zc:"a"===Gd?Zc.call(Fd):Zc?Zc.value:bd.get(Fd)};Ee=function(Fd,bd,Gd,Zc,td){if("m"===Zc)throw new TypeError("Private method is not writable");if("a"===Zc&&!td)throw new TypeError("Private accessor was defined without a setter");if("function"===typeof bd?Fd!==bd||!td:!bd.has(Fd))throw new TypeError("Cannot write private member to an object whose class did not declare it");
return"a"===Zc?td.call(Fd,Gd):td?td.value=Gd:bd.set(Fd,Gd),Gd};Vd=function(Fd,bd){if(null===bd||"object"!==typeof bd&&"function"!==typeof bd)throw new TypeError("Cannot use 'in' operator on non-object");return"function"===typeof Fd?bd===Fd:Fd.has(bd)};gf("__extends",k);gf("__assign",G);gf("__rest",fa);gf("__decorate",na);gf("__param",ta);gf("__metadata",Ha);gf("__awaiter",Sa);gf("__generator",Za);gf("__exportStar",fb);gf("__createBinding",te);gf("__values",ib);gf("__read",Bb);gf("__spread",Ob);gf("__spreadArrays",
Fb);gf("__spreadArray",cc);gf("__await",oc);gf("__asyncGenerator",Xb);gf("__asyncDelegator",hc);gf("__asyncValues",ec);gf("__makeTemplateObject",Ec);gf("__importStar",Ic);gf("__importDefault",nd);gf("__classPrivateFieldGet",Bd);gf("__classPrivateFieldSet",Ee);gf("__classPrivateFieldIn",Vd)})}}),Iq={};((a,d)=>{for(var k in d)Rf(a,k,{get:d[k],enumerable:!0})})(Iq,{App:()=>CD,PreviewManager:()=>zh,generateJSXFromModel:()=>Xn,generateSVGFromModel:()=>Dn});Ta.exports=(a=>tm(Rf({},"__esModule",{value:!0}),
a))(Iq);var is=(a=>{a.Yellow="yellow";a.Red="red";a.Pink="pink";a.Green="green";a.Blue="blue";a.Purple="purple";a.Gray="gray";a.Default="";return a})(is||{}),or=(a=>{a.Box="box";a.Ellipse="ellipse";a.Polygon="polygon";return a})(or||{}),mr,yu=new Uint8Array(16),og=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,dl=[];for(let a=0;256>a;++a)dl.push((a+256).toString(16).slice(1));var jt,Zn,Yo=0,Jq=0,Ij=function(a,d,k){k=d&&k||0;const G=
d||Array(16);a=a||{};let fa=a.node||jt;var na=void 0!==a.clockseq?a.clockseq:Zn;if(null==fa||null==na){var ta=a.random||(a.rng||v)();null==fa&&(fa=jt=[ta[0]|1,ta[1],ta[2],ta[3],ta[4],ta[5]]);null==na&&(na=Zn=(ta[6]<<8|ta[7])&16383)}ta=void 0!==a.msecs?a.msecs:Date.now();let Ha=void 0!==a.nsecs?a.nsecs:Jq+1;const Sa=ta-Yo+(Ha-Jq)/1E4;0>Sa&&void 0===a.clockseq&&(na=na+1&16383);(0>Sa||ta>Yo)&&void 0===a.nsecs&&(Ha=0);if(1E4<=Ha)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");Yo=ta;Jq=
Ha;Zn=na;ta+=122192928E5;a=(1E4*(ta&268435455)+Ha)%4294967296;G[k++]=a>>>24&255;G[k++]=a>>>16&255;G[k++]=a>>>8&255;G[k++]=a&255;a=ta/4294967296*1E4&268435455;G[k++]=a>>>8&255;G[k++]=a&255;G[k++]=a>>>24&15|16;G[k++]=a>>>16&255;G[k++]=na>>>8|128;G[k++]=na&255;for(na=0;6>na;++na)G[k+na]=fa[na];return d||Y(G)},fh=class{static clamp(a,d,k){return Math.max(d,"undefined"!==typeof k?Math.min(a,k):a)}static clampV(a,d,k){return a.map(G=>k?fh.clamp(G,d,k):fh.clamp(G,d))}static cross(a,d,k){return(d[0]-a[0])*
(k[1]-a[1])-(k[0]-a[0])*(d[1]-a[1])}static snap(a,d=1){return[Math.round(a[0]/d)*d,Math.round(a[1]/d)*d]}},qd=fh;qd.neg=a=>[-a[0],-a[1]];qd.add=(a,d)=>[a[0]+d[0],a[1]+d[1]];qd.addScalar=(a,d)=>[a[0]+d,a[1]+d];qd.sub=(a,d)=>[a[0]-d[0],a[1]-d[1]];qd.subScalar=(a,d)=>[a[0]-d,a[1]-d];qd.vec=(a,d)=>[d[0]-a[0],d[1]-a[1]];qd.mul=(a,d)=>[a[0]*d,a[1]*d];qd.mulV=(a,d)=>[a[0]*d[0],a[1]*d[1]];qd.div=(a,d)=>[a[0]/d,a[1]/d];qd.divV=(a,d)=>[a[0]/d[0],a[1]/d[1]];qd.per=a=>[a[1],-a[0]];qd.dpr=(a,d)=>a[0]*d[0]+a[1]*
d[1];qd.cpr=(a,d)=>a[0]*d[1]-d[0]*a[1];qd.len2=a=>a[0]*a[0]+a[1]*a[1];qd.len=a=>Math.hypot(a[0],a[1]);qd.pry=(a,d)=>fh.dpr(a,d)/fh.len(d);qd.uni=a=>fh.div(a,fh.len(a));qd.normalize=a=>fh.uni(a);qd.tangent=(a,d)=>fh.uni(fh.sub(a,d));qd.dist2=(a,d)=>fh.len2(fh.sub(a,d));qd.dist=(a,d)=>Math.hypot(a[1]-d[1],a[0]-d[0]);qd.fastDist=(a,d)=>{a=[d[0]-a[0],d[1]-a[1]];d=[Math.abs(a[0]),Math.abs(a[1])];let k=1/Math.max(d[0],d[1]);k*=1.29289-(d[0]+d[1])*k*.29289;return[a[0]*k,a[1]*k]};qd.ang=(a,d)=>Math.atan2(fh.cpr(a,
d),fh.dpr(a,d));qd.angle=(a,d)=>Math.atan2(d[1]-a[1],d[0]-a[0]);qd.med=(a,d)=>fh.mul(fh.add(a,d),.5);qd.rot=(a,d=0)=>[a[0]*Math.cos(d)-a[1]*Math.sin(d),a[0]*Math.sin(d)+a[1]*Math.cos(d)];qd.rotWith=(a,d,k=0)=>{if(0===k)return a;const G=Math.sin(k);k=Math.cos(k);const fa=a[0]-d[0];a=a[1]-d[1];return[fa*k-a*G+d[0],fa*G+a*k+d[1]]};qd.isEqual=(a,d)=>a[0]===d[0]&&a[1]===d[1];qd.lrp=(a,d,k)=>fh.add(a,fh.mul(fh.sub(d,a),k));qd.int=(a,d,k,G,fa=1)=>{k=(fh.clamp(k,G)-k)/(G-k);return fh.add(fh.mul(a,1-k),fh.mul(d,
fa))};qd.ang3=(a,d,k)=>{a=fh.vec(d,a);d=fh.vec(d,k);return fh.ang(a,d)};qd.abs=a=>[Math.abs(a[0]),Math.abs(a[1])];qd.rescale=(a,d)=>{const k=fh.len(a);return[d*a[0]/k,d*a[1]/k]};qd.isLeft=(a,d,k)=>(d[0]-a[0])*(k[1]-a[1])-(k[0]-a[0])*(d[1]-a[1]);qd.clockwise=(a,d,k)=>0<fh.isLeft(a,d,k);qd.toFixed=a=>a.map(d=>Math.round(100*d)/100);qd.nearestPointOnLineThroughPoint=(a,d,k)=>fh.add(a,fh.mul(d,fh.pry(fh.sub(k,a),d)));qd.distanceToLineThroughPoint=(a,d,k)=>fh.dist(k,fh.nearestPointOnLineThroughPoint(a,
d,k));qd.nearestPointOnLineSegment=(a,d,k,G=!0)=>{const fa=fh.uni(fh.sub(d,a));k=fh.add(a,fh.mul(fa,fh.pry(fh.sub(k,a),fa)));if(G){if(k[0]<Math.min(a[0],d[0]))return a[0]<d[0]?a:d;if(k[0]>Math.max(a[0],d[0]))return a[0]>d[0]?a:d;if(k[1]<Math.min(a[1],d[1]))return a[1]<d[1]?a:d;if(k[1]>Math.max(a[1],d[1]))return a[1]>d[1]?a:d}return k};qd.distanceToLineSegment=(a,d,k,G=!0)=>fh.dist(k,fh.nearestPointOnLineSegment(a,d,k,G));qd.nudge=(a,d,k)=>fh.isEqual(a,d)?a:fh.add(a,fh.mul(fh.uni(fh.sub(d,a)),k));
qd.nudgeAtAngle=(a,d,k)=>[Math.cos(d)*k+a[0],Math.sin(d)*k+a[1]];qd.toPrecision=(a,d=4)=>[+a[0].toPrecision(d),+a[1].toPrecision(d)];qd.pointsBetween=(a,d,k=6)=>Array.from(Array(k)).map((G,fa)=>{G=fa/(k-1);fa=Math.min(1,.5+Math.abs(.5-G));return[...fh.lrp(a,d,G),fa]});qd.slope=(a,d)=>a[0]===d[0]?NaN:(a[1]-d[1])/(a[0]-d[0]);qd.toAngle=a=>{a=Math.atan2(a[1],a[0]);return 0>a?a+2*Math.PI:a};qd.max=(...a)=>[Math.max(...a.map(d=>d[0])),Math.max(...a.map(d=>d[1]))];qd.min=(...a)=>[Math.min(...a.map(d=>d[0])),
Math.min(...a.map(d=>d[1]))];var Pd=qd,cf=class{static getRectangleSides(a,d,k=0){const G=[a[0]+d[0]/2,a[1]+d[1]/2],fa=qd.rotWith(a,G,k),na=qd.rotWith(qd.add(a,[d[0],0]),G,k),ta=qd.rotWith(qd.add(a,d),G,k);a=qd.rotWith(qd.add(a,[0,d[1]]),G,k);return[["top",[fa,na]],["right",[na,ta]],["bottom",[ta,a]],["left",[a,fa]]]}static getBoundsSides(a){return cf.getRectangleSides([a.minX,a.minY],[a.width,a.height])}static expandBounds(a,d){return{minX:a.minX-d,minY:a.minY-d,maxX:a.maxX+d,maxY:a.maxY+d,width:a.width+
2*d,height:a.height+2*d}}static boundsCollide(a,d){return!(a.maxX<d.minX||a.minX>d.maxX||a.maxY<d.minY||a.minY>d.maxY)}static boundsContain(a,d){return Array.isArray(d)?a.minX<d[0]&&a.minY<d[1]&&a.maxY>d[1]&&a.maxX>d[0]:a.minX<d.minX&&a.minY<d.minY&&a.maxY>d.maxY&&a.maxX>d.maxX}static boundsContained(a,d){return cf.boundsContain(d,a)}static boundsAreEqual(a,d){return!(d.maxX!==a.maxX||d.minX!==a.minX||d.maxY!==a.maxY||d.minY!==a.minY)}static getBoundsFromPoints(a,d=0){let k=Infinity,G=Infinity,fa=
-Infinity,na=-Infinity;if(2>a.length)G=k=0,na=fa=1;else for(const ta of a)k=Math.min(ta[0],k),G=Math.min(ta[1],G),fa=Math.max(ta[0],fa),na=Math.max(ta[1],na);return 0!==d?cf.getBoundsFromPoints(a.map(ta=>qd.rotWith(ta,[(k+fa)/2,(G+na)/2],d))):{minX:k,minY:G,maxX:fa,maxY:na,width:Math.max(1,fa-k),height:Math.max(1,na-G)}}static centerBounds(a,d){const k=cf.getBoundsCenter(a);return cf.translateBounds(a,[d[0]-k[0],d[1]-k[1]])}static snapBoundsToGrid(a,d){const k=Math.round(a.minX/d)*d,G=Math.round(a.minY/
d)*d,fa=Math.round(a.maxX/d)*d;a=Math.round(a.maxY/d)*d;return{minX:k,minY:G,maxX:fa,maxY:a,width:Math.max(1,fa-k),height:Math.max(1,a-G)}}static translateBounds(a,d){return{minX:a.minX+d[0],minY:a.minY+d[1],maxX:a.maxX+d[0],maxY:a.maxY+d[1],width:a.width,height:a.height}}static multiplyBounds(a,d){const k=cf.getBoundsCenter(a);return cf.centerBounds({minX:a.minX*d,minY:a.minY*d,maxX:a.maxX*d,maxY:a.maxY*d,width:a.width*d,height:a.height*d},[k[0]*d,k[1]*d])}static divideBounds(a,d){const k=cf.getBoundsCenter(a);
return cf.centerBounds({minX:a.minX/d,minY:a.minY/d,maxX:a.maxX/d,maxY:a.maxY/d,width:a.width/d,height:a.height/d},[k[0]/d,k[1]/d])}static getRotatedBounds(a,d=0){a=cf.getRotatedCorners(a,d);let k=d=Infinity,G=-Infinity,fa=-Infinity;for(const na of a)d=Math.min(na[0],d),k=Math.min(na[1],k),G=Math.max(na[0],G),fa=Math.max(na[1],fa);return{minX:d,minY:k,maxX:G,maxY:fa,width:Math.max(1,G-d),height:Math.max(1,fa-k),rotation:0}}static getRotatedEllipseBounds(a,d,k,G,fa=0){var na=Math.cos(fa);const ta=
Math.sin(fa);fa=Math.hypot(k*na,G*ta);na=Math.hypot(k*ta,G*na);return{minX:a+k-fa,minY:d+G-na,maxX:a+k+fa,maxY:d+G+na,width:2*fa,height:2*na}}static getExpandedBounds(a,d){const k=Math.min(a.minX,d.minX),G=Math.min(a.minY,d.minY),fa=Math.max(a.maxX,d.maxX);a=Math.max(a.maxY,d.maxY);return{minX:k,minY:G,maxX:fa,maxY:a,width:Math.abs(fa-k),height:Math.abs(a-G)}}static getCommonBounds(a){if(2>a.length)return a[0];let d=a[0];for(let k=1;k<a.length;k++)d=cf.getExpandedBounds(d,a[k]);return d}static getRotatedCorners(a,
d=0){const k=[a.minX+a.width/2,a.minY+a.height/2];a=[[a.minX,a.minY],[a.maxX,a.minY],[a.maxX,a.maxY],[a.minX,a.maxY]];return d?a.map(G=>qd.rotWith(G,k,d)):a}static getTransformedBoundingBox(a,d,k,G=0,fa=!1){const [na,ta]=[a.minX,a.minY],[Ha,Sa]=[a.maxX,a.maxY];let [Za,fb]=[a.minX,a.minY],[ib,Bb]=[a.maxX,a.maxY];if("center"===d)return{minX:Za+k[0],minY:fb+k[1],maxX:ib+k[0],maxY:Bb+k[1],width:ib-Za,height:Bb-fb,scaleX:1,scaleY:1};const [Ob,Fb]=qd.rot(k,-G);switch(d){case "top_edge":case "top_left_corner":case "top_right_corner":fb+=
Fb;break;case "bottom_edge":case "bottom_left_corner":case "bottom_right_corner":Bb+=Fb}switch(d){case "left_edge":case "top_left_corner":case "bottom_left_corner":Za+=Ob;break;case "right_edge":case "top_right_corner":case "bottom_right_corner":ib+=Ob}var cc=Ha-na;const oc=Sa-ta;var Xb=(ib-Za)/cc,hc=(Bb-fb)/oc;a=0>Xb;k=0>hc;var ec=Math.abs(ib-Za),Ec=Math.abs(Bb-fb);if(fa)switch(fa=cc/oc,cc=fa<ec/Ec,hc=1/fa*(0>hc?1:-1)*ec,Xb=Ec*(0>Xb?1:-1)*fa,d){case "top_left_corner":cc?fb=Bb+hc:Za=ib+Xb;break;case "top_right_corner":cc?
fb=Bb+hc:ib=Za-Xb;break;case "bottom_right_corner":cc?Bb=fb-hc:ib=Za-Xb;break;case "bottom_left_corner":cc?Bb=fb-hc:Za=ib+Xb;break;case "bottom_edge":case "top_edge":ec=(Za+ib)/2;Ec*=fa;Za=ec-Ec/2;ib=ec+Ec/2;break;case "left_edge":case "right_edge":Ec=(fb+Bb)/2,ec/=fa,fb=Ec-ec/2,Bb=Ec+ec/2}if(0!==G%(2*Math.PI)){ec=[0,0];Ec=qd.med([na,ta],[Ha,Sa]);Xb=qd.med([Za,fb],[ib,Bb]);switch(d){case "top_left_corner":ec=qd.sub(qd.rotWith([ib,Bb],Xb,G),qd.rotWith([Ha,Sa],Ec,G));break;case "top_right_corner":ec=
qd.sub(qd.rotWith([Za,Bb],Xb,G),qd.rotWith([na,Sa],Ec,G));break;case "bottom_right_corner":ec=qd.sub(qd.rotWith([Za,fb],Xb,G),qd.rotWith([na,ta],Ec,G));break;case "bottom_left_corner":ec=qd.sub(qd.rotWith([ib,fb],Xb,G),qd.rotWith([Ha,ta],Ec,G));break;case "top_edge":ec=qd.sub(qd.rotWith(qd.med([Za,Bb],[ib,Bb]),Xb,G),qd.rotWith(qd.med([na,Sa],[Ha,Sa]),Ec,G));break;case "left_edge":ec=qd.sub(qd.rotWith(qd.med([ib,fb],[ib,Bb]),Xb,G),qd.rotWith(qd.med([Ha,ta],[Ha,Sa]),Ec,G));break;case "bottom_edge":ec=
qd.sub(qd.rotWith(qd.med([Za,fb],[ib,fb]),Xb,G),qd.rotWith(qd.med([na,ta],[Ha,ta]),Ec,G));break;case "right_edge":ec=qd.sub(qd.rotWith(qd.med([Za,fb],[Za,Bb]),Xb,G),qd.rotWith(qd.med([na,ta],[na,Sa]),Ec,G))}[Za,fb]=qd.sub([Za,fb],ec);[ib,Bb]=qd.sub([ib,Bb],ec)}ib<Za&&([ib,Za]=[Za,ib]);Bb<fb&&([Bb,fb]=[fb,Bb]);return{minX:Za,minY:fb,maxX:ib,maxY:Bb,width:ib-Za,height:Bb-fb,scaleX:(ib-Za)/(Ha-na||1)*(a?-1:1),scaleY:(Bb-fb)/(Sa-ta||1)*(k?-1:1)}}static getTransformAnchor(a,d,k){let G=a;switch(a){case "top_left_corner":G=
d&&k?"bottom_right_corner":d?"top_right_corner":k?"bottom_left_corner":"bottom_right_corner";break;case "top_right_corner":G=d&&k?"bottom_left_corner":d?"top_left_corner":k?"bottom_right_corner":"bottom_left_corner";break;case "bottom_right_corner":G=d&&k?"top_left_corner":d?"bottom_left_corner":k?"top_right_corner":"top_left_corner";break;case "bottom_left_corner":G=d&&k?"top_right_corner":d?"bottom_right_corner":k?"top_left_corner":"top_right_corner"}return G}static getRelativeTransformedBoundingBox(a,
d,k,G,fa){G=a.minX+(G?d.maxX-k.maxX:k.minX-d.minX)/d.width*a.width;fa=a.minY+(fa?d.maxY-k.maxY:k.minY-d.minY)/d.height*a.height;const na=k.width/d.width*a.width;a=k.height/d.height*a.height;return{minX:G,minY:fa,maxX:G+na,maxY:fa+a,width:na,height:a}}static getRotatedSize(a,d){const k=qd.div(a,2);a=[[0,0],[a[0],0],a,[0,a[1]]].map(G=>qd.rotWith(G,k,d));a=cf.getBoundsFromPoints(a);return[a.width,a.height]}static getBoundsCenter(a){return[a.minX+a.width/2,a.minY+a.height/2]}static getBoundsWithCenter(a){const d=
cf.getBoundsCenter(a);return Re(Ud({},a),{midX:d[0],midY:d[1]})}static getCommonTopLeft(a){const d=[Infinity,Infinity];a.forEach(k=>{d[0]=Math.min(d[0],k[0]);d[1]=Math.min(d[1],k[1])});return d}static getTLSnapPoints(a,d,k){const G=Ud({},a);a=[0,0];const fa=[],na={minX:{id:"minX",isSnapped:!1},midX:{id:"midX",isSnapped:!1},maxX:{id:"maxX",isSnapped:!1},minY:{id:"minY",isSnapped:!1},midY:{id:"midY",isSnapped:!1},maxY:{id:"maxY",isSnapped:!1}},ta=["midX","minX","maxX"],Ha=["midY","minY","maxY"];d=d.map(Bb=>
{const Ob=ta.flatMap((cc,oc)=>ta.map((Xb,hc)=>{const ec=G[cc]-Bb[Xb];return{f:cc,t:Xb,gap:ec,distance:Math.abs(ec),isCareful:0===oc||3===oc+hc}})),Fb=Ha.flatMap((cc,oc)=>Ha.map((Xb,hc)=>{const ec=G[cc]-Bb[Xb];return{f:cc,t:Xb,gap:ec,distance:Math.abs(ec),isCareful:0===oc||3===oc+hc}}));return[Bb,Ob,Fb]});let Sa=Infinity,Za=Infinity,fb=Infinity,ib=Infinity;d.forEach(([,Bb,Ob])=>{Bb.forEach(Fb=>{Fb.distance<k&&Fb.distance<fb&&(fb=Fb.distance,Sa=Fb.gap)});Ob.forEach(Fb=>{Fb.distance<k&&Fb.distance<ib&&
(ib=Fb.distance,Za=Fb.gap)})});d.forEach(([Bb,Ob,Fb])=>{Infinity!==Sa&&Ob.forEach(cc=>{2>Math.abs(cc.gap-Sa)&&(na[cc.f]=Re(Ud({},na[cc.f]),{isSnapped:!0,to:Bb[cc.t],B:Bb,distance:cc.distance}))});Infinity!==Za&&Fb.forEach(cc=>{2>Math.abs(cc.gap-Za)&&(na[cc.f]=Re(Ud({},na[cc.f]),{isSnapped:!0,to:Bb[cc.t],B:Bb,distance:cc.distance}))})});a[0]=Infinity===Sa?0:Sa;a[1]=Infinity===Za?0:Za;G.minX-=a[0];G.midX-=a[0];G.maxX-=a[0];G.minY-=a[1];G.midY-=a[1];G.maxY-=a[1];ta.forEach(Bb=>{Bb=na[Bb];if(Bb.isSnapped){var {id:Ob,
B:Fb}=Bb;Bb=G[Ob];fa.push("minX"===Ob?[[Bb,G.midY],[Bb,Fb.minY],[Bb,Fb.maxY]]:[[Bb,G.minY],[Bb,G.maxY],[Bb,Fb.minY],[Bb,Fb.maxY]])}});Ha.forEach(Bb=>{Bb=na[Bb];if(Bb.isSnapped){var {id:Ob,B:Fb}=Bb;Bb=G[Ob];fa.push("midY"===Ob?[[G.midX,Bb],[Fb.minX,Bb],[Fb.maxX,Bb]]:[[G.minX,Bb],[G.maxX,Bb],[Fb.minX,Bb],[Fb.maxX,Bb]])}});return{offset:a,snapLines:fa}}static ensureRatio(a,d){const {width:k,height:G}=a,fa=Ud({},a);k/G<d?(fa.width=G*d,fa.maxX+=k-a.width):(fa.height=k/d,fa.maxY+=G-a.height);return fa}static getDistributions(a,
d){var k=a.map(na=>{const ta=na.getBounds();return{id:na.id,point:[ta.minX,ta.minY],bounds:ta,center:na.getCenter()}});a=k.length;var G=cf.getCommonBounds(k.map(({bounds:na})=>na));const fa=[];switch(d){case "horizontal":d=k.reduce((na,ta)=>na+ta.bounds.width,0);if(d>G.width){const na=k.sort((Za,fb)=>Za.bounds.minX-fb.bounds.minX)[0],ta=k.sort((Za,fb)=>fb.bounds.maxX-Za.bounds.maxX)[0];G=k.filter(Za=>Za!==na&&Za!==ta).sort((Za,fb)=>Za.center[0]-fb.center[0]);const Ha=(ta.center[0]-na.center[0])/(a-
1),Sa=na.center[0]+Ha;G.forEach(({id:Za,point:fb,bounds:ib},Bb)=>{fa.push({id:Za,prev:fb,next:[Sa+Ha*Bb-ib.width/2,ib.minY]})})}else{k=k.sort((Ha,Sa)=>Ha.center[0]-Sa.center[0]);let na=G.minX;const ta=(G.width-d)/(a-1);k.forEach(({id:Ha,point:Sa,bounds:Za})=>{fa.push({id:Ha,prev:Sa,next:[na,Za.minY]});na+=Za.width+ta})}break;case "vertical":if(d=k.reduce((na,ta)=>na+ta.bounds.height,0),d>G.height){const na=k.sort((Za,fb)=>Za.bounds.minY-fb.bounds.minY)[0],ta=k.sort((Za,fb)=>fb.bounds.maxY-Za.bounds.maxY)[0];
G=k.filter(Za=>Za!==na&&Za!==ta).sort((Za,fb)=>Za.center[1]-fb.center[1]);const Ha=(ta.center[1]-na.center[1])/(a-1),Sa=na.center[1]+Ha;G.forEach(({id:Za,point:fb,bounds:ib},Bb)=>{fa.push({id:Za,prev:fb,next:[ib.minX,Sa+Ha*Bb-ib.height/2]})})}else{k=k.sort((Ha,Sa)=>Ha.center[1]-Sa.center[1]);let na=G.minY;const ta=(G.height-d)/(a-1);k.forEach(({id:Ha,point:Sa,bounds:Za})=>{fa.push({id:Ha,prev:Sa,next:[Za.minX,na]});na+=Za.height+ta})}}return fa}static getPackedDistributions(a){const d=cf.getCommonBounds(a.map(({bounds:fa})=>
fa)),k=[d.minX,d.minY],G=Object.fromEntries(a.map(fa=>[fa.id,[fa.bounds.minX,fa.bounds.minY]]));a=a.filter(fa=>{var na,ta,Ha,Sa;return!((null==(ta=null==(na=fa.props.handles)?void 0:na.start)?0:ta.bindingId)||(null==(Sa=null==(Ha=fa.props.handles)?void 0:Ha.end)?0:Sa.bindingId))}).map(fa=>{const na=fa.getBounds();return{id:fa.id,w:na.width+16,h:na.height+16,x:na.minX,y:na.minY}});y(a);return a.map(({id:fa,x:na,y:ta})=>({id:fa,prev:G[fa],next:[na+k[0],ta+k[1]]}))}},vp=class{static pointInCircle(a,
d,k){return qd.dist(a,d)<=k}static pointInEllipse(a,d,k,G,fa=0){fa=fa||0;var na=Math.cos(fa);fa=Math.sin(fa);d=qd.sub(a,d);a=na*d[0]+fa*d[1];na=fa*d[0]-na*d[1];return 1>=a*a/(k*k)+na*na/(G*G)}static pointInRect(a,d){return!(a[0]<d[0]||a[0]>a[0]+d[0]||a[1]<d[1]||a[1]>a[1]+d[1])}static pointInPolygon(a,d){let k=0;d.forEach((G,fa)=>{fa=d[(fa+1)%d.length];G[1]<=a[1]?fa[1]>a[1]&&0<qd.cross(G,fa,a)&&(k+=1):fa[1]<=a[1]&&0>qd.cross(G,fa,a)&&--k});return 0!==k}static pointInBounds(a,d){return!(a[0]<d.minX||
a[0]>d.maxX||a[1]<d.minY||a[1]>d.maxY)}static pointInPolyline(a,d,k=3){for(let G=1;G<d.length;G++)if(qd.distanceToLineSegment(d[G-1],d[G],a)<k)return!0;return!1}static _getSqSegDist(a,d,k){let G=d[0];d=d[1];let fa=k[0]-G,na=k[1]-d;if(0!==fa||0!==na){const ta=((a[0]-G)*fa+(a[1]-d)*na)/(fa*fa+na*na);1<ta?(G=k[0],d=k[1]):0<ta&&(G+=fa*ta,d+=na*ta)}fa=a[0]-G;na=a[1]-d;return fa*fa+na*na}static _simplifyStep(a,d,k,G,fa){let na=G,ta=-1;for(let Ha=d+1;Ha<k;Ha++){const Sa=vp._getSqSegDist(a[Ha],a[d],a[k]);
Sa>na&&(ta=Ha,na=Sa)}-1<ta&&na>G&&(1<ta-d&&vp._simplifyStep(a,d,ta,G,fa),fa.push(a[ta]),1<k-ta&&vp._simplifyStep(a,ta,k,G,fa))}static simplify2(a,d=1){if(2>=a.length)return a;d*=d;var k=a[0],G=a[1];const fa=[k];for(let na=1,ta=a.length;na<ta;na++)G=a[na],(G[0]-k[0])*(G[0]-k[0])+(G[1]-k[1])*(G[1]-k[1])>d&&(fa.push(G),k=G);k!==G&&fa.push(G);k=fa.length-1;G=[fa[0]];vp._simplifyStep(fa,0,k,d,G);G.push(fa[k],a[a.length-1]);return G}static pointNearToPolyline(a,d,k=8){const G=d.length;for(let fa=1;fa<G;fa++)if(qd.distanceToLineSegment(d[fa-
1],d[fa],a)<k)return!0;return!1}},Tj=vp;gb(Tj,"simplify",(a,d=1)=>{var k=a.length;const G=a[0],fa=a[k-1],[na,ta]=G,[Ha,Sa]=fa;if(2<k){let Za=0,fb=0;const ib=qd.len2([Sa-ta,Ha-na]);for(let Bb=1;Bb<k-1;Bb++){const [Ob,Fb]=a[Bb],cc=Math.pow(Ob*(Sa-ta)+na*(Fb-Sa)+Ha*(ta-Fb),2)/ib;Za>cc||(Za=cc,fb=Bb)}if(Za>d)return k=vp.simplify(a.slice(0,fb+1),d),a=vp.simplify(a.slice(fb+1),d),k.concat(a.slice(1))}return[G,fa]});var gl=Math.PI,Gn=gl/2,lk=2*gl,Kq={},lt={bottom_edge:"ns-resize",top_edge:"ns-resize",left_edge:"ew-resize",
right_edge:"ew-resize",bottom_left_corner:"nesw-resize",bottom_right_corner:"nwse-resize",top_left_corner:"nwse-resize",top_right_corner:"nesw-resize",bottom_left_resize_corner:"swne-rotate",bottom_right_resize_corner:"senw-rotate",top_left_resize_corner:"nwse-rotate",top_right_resize_corner:"nesw-rotate",rotate:"rotate",center:"grab",background:"grab"},Wl=class{static circleFromThreePoints(a,d,k){const [G,fa]=a,[na,ta]=d,[Ha,Sa]=k;d=G*(ta-Sa)-fa*(na-Ha)+na*Sa-Ha*ta;a=-((G*G+fa*fa)*(Sa-ta)+(na*na+
ta*ta)*(fa-Sa)+(Ha*Ha+Sa*Sa)*(ta-fa))/(2*d);d=-((G*G+fa*fa)*(na-Ha)+(na*na+ta*ta)*(Ha-G)+(Ha*Ha+Sa*Sa)*(G-na))/(2*d);return[a,d,Math.hypot(a-G,d-fa)]}static perimeterOfEllipse(a,d){const k=Math.pow(a-d,2)/Math.pow(a+d,2);return gl*(a+d)*(1+3*k/(10+Math.sqrt(4-3*k)))}static shortAngleDist(a,d){a=(d-a)%lk;return 2*a%lk-a}static longAngleDist(a,d){return lk-Wl.shortAngleDist(a,d)}static lerpAngles(a,d,k){return a+Wl.shortAngleDist(a,d)*k}static angleDelta(a,d){return Wl.shortAngleDist(a,d)}static getSweep(a,
d,k){return Wl.angleDelta(Pd.angle(a,d),Pd.angle(a,k))}static clampRadians(a){return(lk+a)%lk}static snapAngleToSegments(a,d){d=lk/d;a=Math.floor((Wl.clampRadians(a)+d/2)/d)*d%lk;a<gl&&(a+=lk);a>gl&&(a-=lk);return a}static isAngleBetween(a,d,k){if(k===a||k===d)return!0;d=(d-a+Gn)%Gn;return d<=gl!==(k-a+Gn)%Gn>d}static degreesToRadians(a){return a*gl/180}static radiansToDegrees(a){return 180*a/gl}static getArcLength(a,d,k,G){a=Wl.getSweep(a,k,G);return a/lk*lk*d}static getSweepFlag(a,d,k){k=Pd.angle(a,
k);return 0<(Pd.angle(a,d)-k+3*gl)%lk-gl?0:1}static getLargeArcFlag(a,d,k){a=Pd.angle(k,a);d=(Pd.angle(k,d)-a+3*gl)%lk-gl;return Math.abs(d)>Gn?0:1}static getArcDashOffset(a,d,k,G,fa){const na=Wl.getSweepFlag(a,k,G);d=Wl.getArcLength(a,d,k,G);return-(0>na?d:lk*a[2]-d)/2+fa}static getEllipseDashOffset(a,d){return-(lk*a[2])/2+-d}static radiansToCardinalDirection(a){return a<.25*Math.PI?"north":a<.75*Math.PI?"east":a<1.25*Math.PI?"south":a<1.75*Math.PI?"west":"north"}},Ik=class{static getPolygonCentroid(a){var d=
a.map(k=>k[0]);a=a.map(k=>k[1]);d=Math.min(...d)+Math.max(...d);a=Math.min(...a)+Math.max(...a);return[d?d/2:0,a?a/2:0]}};gb(Ik,"getEdges",a=>{const d=a.length;return a.map((k,G)=>[k,a[(G+1)%d]])});gb(Ik,"getEdgeOutwardNormal",(a,d)=>Pd.per(Pd.uni(Pd.sub(d,a))));gb(Ik,"getEdgeInwardNormal",(a,d)=>Pd.neg(Ik.getEdgeOutwardNormal(a,d)));gb(Ik,"getOffsetEdge",(a,d,k)=>{k=Pd.mul(Pd.per(Pd.uni(Pd.sub(d,a))),k);return[Pd.add(a,k),Pd.add(d,k)]});gb(Ik,"getOffsetEdges",(a,d)=>a.map(([k,G])=>Ik.getOffsetEdge(k,
G,d)));gb(Ik,"getOffsetPolygon",(a,d)=>{if(1>a.length)throw Error("Expected at least one point.");if(1===a.length)return a=a[0],[Pd.add(a,[-d,-d]),Pd.add(a,[d,-d]),Pd.add(a,[d,d]),Pd.add(a,[-d,d])];if(2===a.length){const [k,G]=a;return[...Ik.getOffsetEdge(k,G,d),...Ik.getOffsetEdge(G,k,d)]}return Ik.getOffsetEdges(Ik.getEdges(a),d).flatMap((k,G,fa)=>{{G=fa[(G+1)%fa.length];const na=qd.slope(k[0],k[1]);fa=qd.slope(G[0],G[1]);na!==fa?Number.isNaN(na)&&!Number.isNaN(fa)?k=[k[0][0],(k[0][0]-G[0][0])*
fa+G[0][1]]:Number.isNaN(fa)&&!Number.isNaN(na)?k=[G[0][0],(G[0][0]-k[0][0])*na+k[0][1]]:(k=(na*k[0][0]-fa*G[0][0]+G[0][1]-k[0][1])/(na-fa),k=[k,fa*(k-G[0][0])+G[0][1]]):k=void 0}if(void 0===k)throw Error("Expected an intersection");return k})});gb(Ik,"getPolygonVertices",(a,d,k=0,G=1)=>{a=Pd.div(a,2);const [fa,na]=[Math.max(1,a[0]-k),Math.max(1,a[1]-k)];k=[];for(let Za=0,fb=lk/d;Za<d;Za++){var ta=(-Gn+Za*fb)%lk,Ha=(-Gn+(Za+1)*fb)%lk;ta=Pd.add(a,[fa*Math.cos(ta),na*Math.sin(ta)]);Ha=Pd.add(a,[fa*
Math.cos(Ha),na*Math.sin(Ha)]);var Sa=Pd.med(ta,Ha);Sa=Pd.nudge(Sa,a,Pd.dist(a,Sa)*(1-G));k.push(ta,Sa,Ha)}return k});gb(Ik,"getTriangleVertices",(a,d=0,k=1)=>{const [G,fa]=a;var na=1-k;a=[G/2,d/2];k=[G-d,fa-d];d=[d/2,fa-d];const ta=Ik.getPolygonCentroid([a,k,d]),Ha=Pd.med(a,k),Sa=Pd.med(k,d),Za=Pd.med(d,a),fb=Pd.dist(Ha,ta)*na,ib=Pd.dist(Sa,ta)*na;na*=Pd.dist(Za,ta);return[a,fb?Pd.nudge(Ha,ta,fb):Ha,k,ib?Pd.nudge(Sa,ta,ib):Sa,d,na?Pd.nudge(Za,ta,na):Za]});gb(Ik,"getStarVertices",(a,d,k,G=1)=>{const fa=
Pd.div(d,2),na=Pd.mul(fa,G/2),ta=lk/k/2;return Array.from(Array(2*k)).map((Ha,Sa)=>{Ha=-Gn+Sa*ta;const [Za,fb]=Sa%2?na:fa;return Pd.add(a,[Za*Math.cos(Ha),fb*Math.sin(Ha)])})});var wu=class{static getCurvedPathForPolygon(a){if(3>a.length)return"M -4, 0\n a 4,4 0 1,0 8,0\n a 4,4 0 1,0 -8,0";const d=["M",...a[0].slice(0,2),"Q"],k=a.length;for(let G=1;G<k;G++){const [fa,na]=a[G],[ta,Ha]=a[(G+1)%k];d.push(fa,na,(fa+ta)/2,(na+Ha)/2)}d.push("Z");return d.join(" ")}static getCurvedPathForPoints(a){if(3>
a.length)return"M -4, 0\n a 4,4 0 1,0 8,0\n a 4,4 0 1,0 -8,0";const d=["M",...a[0].slice(0,2),"Q"],k=a.length;for(let G=1;G<k-1;G++){const [fa,na]=a[G],[ta,Ha]=a[G+1];d.push(fa,na,(fa+ta)/2,(na+Ha)/2)}return d.join(" ")}static getSvgPathFromStroke(a,d=!0){const k=a.length;if(4>k)return"";let G=a[0],fa=a[1];var na=a[2];na=`M${G[0].toFixed(2)},${G[1].toFixed(2)} Q${fa[0].toFixed(2)},${fa[1].toFixed(2)} ${((fa[0]+na[0])/2).toFixed(2)},${((fa[1]+na[1])/2).toFixed(2)} T`;for(let ta=2,Ha=k-1;ta<
Ha;ta++)G=a[ta],fa=a[ta+1],na+=`${((G[0]+fa[0])/2).toFixed(2)},${((G[1]+fa[1])/2).toFixed(2)} `;d&&(na+="Z");return na}static getSvgPathFromStrokePoints(a,d=!1){const k=a.length;if(4>k)return"";let G=a[0].point,fa=a[1].point;var na=a[2].point;na=`M${G[0].toFixed(2)},${G[1].toFixed(2)} Q${fa[0].toFixed(2)},${fa[1].toFixed(2)} ${((fa[0]+na[0])/2).toFixed(2)},${((fa[1]+na[1])/2).toFixed(2)} T`;for(let ta=2,Ha=k-1;ta<Ha;ta++)G=a[ta].point,fa=a[ta+1].point,na+=`${((G[0]+fa[0])/2).toFixed(2)},${((G[1]+
fa[1])/2).toFixed(2)} `;d&&(na+="Z");return na}};gb(wu,"TRIM_NUMBERS",/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g);var px={},qx=Object.assign,bq=Object.getOwnPropertyDescriptor,yp=Object.defineProperty,cq=Object.prototype,da=[];Object.freeze(da);var pa={};Object.freeze(pa);var Ga="undefined"!==typeof Proxy,eb=Object.toString(),wb=function(){},gc="undefined"!==typeof Object.getOwnPropertySymbols,Dc="undefined"!==typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:gc?function(a){return Object.getOwnPropertyNames(a).concat(Object.getOwnPropertySymbols(a))}:
Object.getOwnPropertyNames,Rc=Object.getOwnPropertyDescriptors||function(a){var d={};Dc(a).forEach(function(k){d[k]=bq(a,k)});return d},vd=Symbol("mobx-stored-annotations"),Md=Symbol("mobx administration"),cg=function(){function a(k){void 0===k&&(k="Atom");this.name_=void 0;this.isBeingObserved_=this.isPendingUnobservation_=!1;this.observers_=new Set;this.lastAccessedBy_=this.diffValue_=0;this.lowestObserverState_=aj.NOT_TRACKING_;this.onBUOL=this.onBOL=void 0;this.name_=k}var d=a.prototype;d.onBO=
function(){this.onBOL&&this.onBOL.forEach(function(k){return k()})};d.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(k){return k()})};d.reportObserved=function(){return Cb(this)};d.reportChanged=function(){Vc();$b(this);jd()};d.toString=function(){return this.name_};return a}(),rh=D("Atom",cg),Ue={identity:function(a,d){return a===d},structural:function(a,d){return za(a,d)},"default":function(a,d){return Object.is?Object.is(a,d):a===d?0!==a||1/a===1/d:a!==a&&d!==d},shallow:function(a,
d){return za(a,d,1)}},Ag="override",wh=ob(),Ug={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Ug);var ae=tb("observable"),Hd=tb("observable.ref",{enhancer:Ua}),Yd=tb("observable.shallow",{enhancer:function(a,d,k){if(void 0===a||null===a||ke(a)||Yc(a)||zr(a)||Hs(a))return a;if(Array.isArray(a))return ze.array(a,{name:k,deep:!1});if(P(a))return ze.object(a,void 0,{name:k,deep:!1});if(L(a))return ze.map(a,{name:k,deep:!1});if(Q(a))return ze.set(a,{name:k,deep:!1})}}),Ne=tb("observable.struct",
{enhancer:function(a,d){return za(a,d)?d:a}}),Xe=Ba(ae);Object.assign(Qb,Xe);var Ih={box:function(a,d){d=d||Ug;return new Fs(a,hb(d),d.name,!0,d.equals)},array:function(a,d){d=d||Ug;return(!1===sf.useProxies||!1===d.proxy?tf:kb)(a,hb(d),d.name)},map:function(a,d){d=d||Ug;return new Gz(a,hb(d),d.name)},set:function(a,d){d=d||Ug;return new Hz(a,hb(d),d.name)},object:function(a,d,k){if(!1===sf.useProxies||!1===(null==k?void 0:k.proxy))k=ud({},k);else{var G={},fa,na;C();G=ud(G,k);k=null!=(na=(fa=G[Md]).proxy_)?
na:fa.proxy_=new Proxy(G,jE)}return Ce(k,a,d)},ref:Ba(Hd),shallow:Ba(Yd),deep:Xe,struct:Ba(Ne)},ze=qx(Qb,Ih),Ah=Xa("computed"),fi=Xa("computed.struct",{equals:Ue.structural}),kf=function(a,d){if(O(d))return Ka(a,d,Ah);if(P(a))return Ba(Xa("computed",a));d=P(d)?d:{};d.get=a;d.name||(d.name=a.name||"");return new Eu(d)};Object.assign(kf,Ah);kf.struct=Ba(fi);var tp,Nv,Qv=0,XD=1,YD=null!=(tp=null==(Nv=bq(function(){},"name"))?void 0:Nv.configurable)?tp:!1,Az={value:"action",configurable:!0,writable:!1,
enumerable:!1};var ZD=Symbol.toPrimitive;var Fs=function(a){function d(G,fa,na,ta,Ha){void 0===na&&(na="ObservableValue");void 0===Ha&&(Ha=Ue["default"]);ta=a.call(this,na)||this;ta.enhancer=void 0;ta.hasUnreportedChange_=!1;ta.interceptors_=void 0;ta.changeListeners_=void 0;ta.value_=void 0;ta.dehancer=void 0;ta.enhancer=fa;ta.name_=na;ta.equals=Ha;ta.value_=fa(G,void 0,na);return ta}ha(d,a);var k=d.prototype;k.dehanceValue=function(G){return void 0!==this.dehancer?this.dehancer(G):G};k.set=function(G){G=
this.prepareNewValue_(G);G!==sf.UNCHANGED&&this.setNewValue_(G)};k.prepareNewValue_=function(G){if(Hb(this)){G=Ib(this,{object:this,type:kq,newValue:G});if(!G)return sf.UNCHANGED;G=G.newValue}G=this.enhancer(G,this.value_,this.name_);return this.equals(this.value_,G)?sf.UNCHANGED:G};k.setNewValue_=function(G){var fa=this.value_;this.value_=G;this.reportChanged();Ad(this)&&Od(this,{type:kq,object:this,newValue:G,oldValue:fa})};k.get=function(){this.reportObserved();return this.dehanceValue(this.value_)};
k.intercept_=function(G){return Sb(this,G)};k.observe_=function(G,fa){fa&&G({observableKind:"value",debugObjectName:this.name_,object:this,type:kq,newValue:this.value_,oldValue:void 0});return be(this,G)};k.raw=function(){return this.value_};k.toJSON=function(){return this.get()};k.toString=function(){return this.name_+"["+this.value_+"]"};k.valueOf=function(){return la(this.get())};k[ZD]=function(){return this.valueOf()};return d}(cg),$D=D("ObservableValue",Fs);var aE=Symbol.toPrimitive;var Eu=function(){function a(k){this.dependenciesState_=
aj.NOT_TRACKING_;this.observing_=[];this.newObserving_=null;this.isPendingUnobservation_=this.isBeingObserved_=!1;this.observers_=new Set;this.lastAccessedBy_=this.runId_=this.diffValue_=0;this.lowestObserverState_=aj.UP_TO_DATE_;this.unboundDepsCount_=0;this.value_=new Gs(null);this.triggeredBy_=this.name_=void 0;this.isRunningSetter_=this.isComputing_=!1;this.setter_=this.derivation=void 0;this.isTracing_=zt.NONE;this.onBUOL=this.onBOL=this.keepAlive_=this.requiresReaction_=this.equals_=this.scope_=
void 0;k.get||f(31);this.derivation=k.get;this.name_=k.name||"ComputedValue";k.set&&(this.setter_=ub("ComputedValue-setter",k.set));this.equals_=k.equals||(k.compareStructural||k.struct?Ue.structural:Ue["default"]);this.scope_=k.context;this.requiresReaction_=k.requiresReaction;this.keepAlive_=!!k.keepAlive}var d=a.prototype;d.onBecomeStale_=function(){jb(this)};d.onBO=function(){this.onBOL&&this.onBOL.forEach(function(k){return k()})};d.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(k){return k()})};
d.get=function(){this.isComputing_&&f(32,this.name_,this.derivation);if(0!==sf.inBatch||0!==this.observers_.size||this.keepAlive_){if(Cb(this),uc(this)){var k=sf.trackingContext;this.keepAlive_&&!k&&(sf.trackingContext=this);this.trackAndCompute()&&Wb(this);sf.trackingContext=k}}else uc(this)&&(this.warnAboutUntrackedRead_(),Vc(),this.value_=this.computeValue_(!1),jd());k=this.value_;if(k instanceof Gs)throw k.cause;return k};d.set=function(k){if(this.setter_){this.isRunningSetter_&&f(33,this.name_);
this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,k)}finally{this.isRunningSetter_=!1}}else f(34,this.name_)};d.trackAndCompute=function(){var k=this.value_,G=this.dependenciesState_===aj.NOT_TRACKING_,fa=this.computeValue_(!0);if(k=G||k instanceof Gs||fa instanceof Gs||!this.equals_(k,fa))this.value_=fa;return k};d.computeValue_=function(k){this.isComputing_=!0;var G=dc(!1);if(k)var fa=xc(this,this.derivation,this.scope_);else if(!0===sf.disableErrorBoundaries)fa=this.derivation.call(this.scope_);
else try{fa=this.derivation.call(this.scope_)}catch(na){fa=new Gs(na)}sf.allowStateChanges=G;this.isComputing_=!1;return fa};d.suspend_=function(){this.keepAlive_||(Gb(this),this.value_=void 0)};d.observe_=function(k,G){var fa=this,na=!0,ta=void 0;return wd(function(){var Ha=fa.get();if(!na||G){var Sa=Ab();k({observableKind:"computed",debugObjectName:fa.name_,type:kq,object:fa,newValue:Ha,oldValue:ta});sf.trackingDerivation=Sa}na=!1;ta=Ha})};d.warnAboutUntrackedRead_=function(){};d.toString=function(){return this.name_+
"["+this.derivation.toString()+"]"};d.valueOf=function(){return la(this.get())};d[aE]=function(){return this.valueOf()};return a}(),Fu=D("ComputedValue",Eu),aj;(function(a){a[a.NOT_TRACKING_=-1]="NOT_TRACKING_";a[a.UP_TO_DATE_=0]="UP_TO_DATE_";a[a.POSSIBLY_STALE_=1]="POSSIBLY_STALE_";a[a.STALE_=2]="STALE_"})(aj||={});var zt;(function(a){a[a.NONE=0]="NONE";a[a.LOG=1]="LOG";a[a.BREAK=2]="BREAK"})(zt||={});var Gs=function(a){this.cause=void 0;this.cause=a},Rv=function(){this.version=6;this.UNCHANGED=
{};this.trackingContext=this.trackingDerivation=null;this.inBatch=this.mobxGuid=this.runId=0;this.pendingUnobservations=[];this.pendingReactions=[];this.allowStateChanges=this.isRunningReactions=!1;this.enforceActions=this.allowStateReads=!0;this.spyListeners=[];this.globalReactionErrorHandlers=[];this.suppressReactionErrors=this.disableErrorBoundaries=this.observableRequiresReaction=this.reactionRequiresObservable=this.computedRequiresReaction=!1;this.useProxies=!0;this.verifyProxies=!1;this.safeDescriptors=
!0},Sv=!0,Bz=!1,sf=function(){var a=F();0<a.__mobxInstanceCount&&!a.__mobxGlobals&&(Sv=!1);a.__mobxGlobals&&a.__mobxGlobals.version!==(new Rv).version&&(Sv=!1);if(Sv){if(a.__mobxGlobals)return a.__mobxInstanceCount+=1,a.__mobxGlobals.UNCHANGED||(a.__mobxGlobals.UNCHANGED={}),a.__mobxGlobals;a.__mobxInstanceCount=1;return a.__mobxGlobals=new Rv}setTimeout(function(){Bz||f(35)},1);return new Rv}(),At=function(){function a(k,G,fa,na){void 0===k&&(k="Reaction");this.requiresObservable_=this.errorHandler_=
this.onInvalidate_=this.name_=void 0;this.observing_=[];this.newObserving_=[];this.dependenciesState_=aj.NOT_TRACKING_;this.unboundDepsCount_=this.runId_=this.diffValue_=0;this.isRunning_=this.isTrackPending_=this.isScheduled_=this.isDisposed_=!1;this.isTracing_=zt.NONE;this.name_=k;this.onInvalidate_=G;this.errorHandler_=fa;this.requiresObservable_=na}var d=a.prototype;d.onBecomeStale_=function(){this.schedule_()};d.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,sf.pendingReactions.push(this),
0<sf.inBatch||sf.isRunningReactions||Tv(sb))};d.isScheduled=function(){return this.isScheduled_};d.runReaction_=function(){if(!this.isDisposed_){Vc();this.isScheduled_=!1;var k=sf.trackingContext;sf.trackingContext=this;if(uc(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(G){this.reportExceptionInDerivation_(G)}}sf.trackingContext=k;jd()}};d.track=function(k){if(!this.isDisposed_){Vc();this.isRunning_=!0;var G=sf.trackingContext;sf.trackingContext=this;k=xc(this,k,void 0);sf.trackingContext=
G;this.isTrackPending_=this.isRunning_=!1;this.isDisposed_&&Gb(this);k instanceof Gs&&this.reportExceptionInDerivation_(k.cause);jd()}};d.reportExceptionInDerivation_=function(k){var G=this;if(this.errorHandler_)this.errorHandler_(k,this);else{if(sf.disableErrorBoundaries)throw k;sf.suppressReactionErrors||console.error("[mobx] uncaught error in '"+this+"'",k);sf.globalReactionErrorHandlers.forEach(function(fa){return fa(k,G)})}};d.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||
(Vc(),Gb(this),jd()))};d.getDisposer_=function(){var k=this.dispose.bind(this);k[Md]=this;return k};d.toString=function(){return"Reaction["+this.name_+"]"};d.trace=function(k){void 0===k&&(k=!1);Nf(this,k)};return a}(),bE=100,Tv=function(a){return a()},Uv=D("Reaction",At),Cz="action",Dz=La(Cz),cE=La("action.bound",{bound:!0}),Ez=La("autoAction",{autoAction:!0}),dE=La("autoAction.bound",{autoAction:!0,bound:!0}),hg=fd(!1);Object.assign(hg,Dz);var Gu=fd(!0);Object.assign(Gu,Ez);hg.bound=Ba(cE);Gu.bound=
Ba(dE);var eE=function(a){return a()},fE="onBO",gE="onBUO",hE=0;fg.prototype=Object.create(Error.prototype);var Fz=ia("flow"),iE=ia("flow.bound",{bound:!0}),Hu=Object.assign(function(a,d){if(O(d))return Ka(a,d,Fz);var k=a.name||"\x3cunnamed flow\x3e";d=function(){var G=arguments,fa=++hE,na=hg(k+" - runid: "+fa+" - init",a).apply(this,G),ta,Ha=void 0;G=new Promise(function(Sa,Za){function fb(Fb){Ha=void 0;try{var cc=hg(k+" - runid: "+fa+" - yield "+Ob++,na.next).call(na,Fb)}catch(oc){return Za(oc)}Bb(cc)}
function ib(Fb){Ha=void 0;try{var cc=hg(k+" - runid: "+fa+" - yield "+Ob++,na["throw"]).call(na,Fb)}catch(oc){return Za(oc)}Bb(cc)}function Bb(Fb){if(aa(null==Fb?void 0:Fb.then))Fb.then(Bb,Za);else{if(Fb.done)return Sa(Fb.value);Ha=Promise.resolve(Fb.value);return Ha.then(fb,ib)}}var Ob=0;ta=Za;fb(void 0)});G.cancel=hg(k+" - runid: "+fa+" - cancel",function(){try{if(Ha){var Sa=Ha;aa(Sa.cancel)&&Sa.cancel()}var Za=na["return"](void 0),fb=Promise.resolve(Za.value);fb.then(wb,wb);aa(fb.cancel)&&fb.cancel();
ta(new fg)}catch(ib){ta(ib)}});return G};d.isMobXFlow=!0;return d},Fz);Hu.bound=Ba(iE);var jE={has:function(a,d){return a[Md].has_(d)},get:function(a,d){return a[Md].get_(d)},set:function(a,d,k){var G;return O(d)?null!=(G=a[Md].set_(d,k,!0))?G:!0:!1},deleteProperty:function(a,d){var k;return O(d)?null!=(k=a[Md].delete_(d,!0))?k:!0:!1},defineProperty:function(a,d,k){var G;return null!=(G=a[Md].defineProperty_(d,k))?G:!0},ownKeys:function(a){return a[Md].ownKeys_()},preventExtensions:function(a){f(13)}},
kq="update",kE={get:function(a,d){var k=a[Md];return d===Md?k:"length"===d?k.getArrayLength_():"string"!==typeof d||isNaN(d)?R(Vv,d)?Vv[d]:a[d]:k.get_(parseInt(d))},set:function(a,d,k){var G=a[Md];"length"===d&&G.setArrayLength_(k);"symbol"===typeof d||isNaN(d)?a[d]=k:G.set_(parseInt(d),k);return!0},preventExtensions:function(){f(15)}},tx=function(){function a(k,G,fa,na){void 0===k&&(k="ObservableArray");this.atom_=this.legacyMode_=this.owned_=void 0;this.values_=[];this.proxy_=this.dehancer=this.enhancer_=
this.changeListeners_=this.interceptors_=void 0;this.lastKnownLength_=0;this.owned_=fa;this.legacyMode_=na;this.atom_=new cg(k);this.enhancer_=function(ta,Ha){return G(ta,Ha,"ObservableArray[..]")}}var d=a.prototype;d.dehanceValue_=function(k){return void 0!==this.dehancer?this.dehancer(k):k};d.dehanceValues_=function(k){return void 0!==this.dehancer&&0<k.length?k.map(this.dehancer):k};d.intercept_=function(k){return Sb(this,k)};d.observe_=function(k,G){void 0===G&&(G=!1);G&&k({observableKind:"array",
object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0});return be(this,k)};d.getArrayLength_=function(){this.atom_.reportObserved();return this.values_.length};d.setArrayLength_=function(k){("number"!==typeof k||isNaN(k)||0>k)&&f("Out of range: "+k);var G=this.values_.length;if(k!==G)if(k>G){for(var fa=Array(k-G),na=0;na<k-G;na++)fa[na]=void 0;this.spliceWithArray_(G,0,fa)}else this.spliceWithArray_(k,
G-k)};d.updateArrayLength_=function(k,G){k!==this.lastKnownLength_&&f(16);this.lastKnownLength_+=G;this.legacyMode_&&0<G&&ie(k+G+1)};d.spliceWithArray_=function(k,G,fa){var na=this,ta=this.values_.length;void 0===k?k=0:k>ta?k=ta:0>k&&(k=Math.max(0,ta+k));G=1===arguments.length?ta-k:void 0===G||null===G?0:Math.max(0,Math.min(G,ta-k));void 0===fa&&(fa=da);if(Hb(this)){var Ha=Ib(this,{object:this.proxy_,type:"splice",index:k,removedCount:G,added:fa});if(!Ha)return da;G=Ha.removedCount;fa=Ha.added}fa=
0===fa.length?fa:fa.map(function(Sa){return na.enhancer_(Sa,void 0)});this.legacyMode_&&this.updateArrayLength_(ta,fa.length-G);ta=this.spliceItemsIntoValues_(k,G,fa);0===G&&0===fa.length||this.notifyArraySplice_(k,fa,ta);return this.dehanceValues_(ta)};d.spliceItemsIntoValues_=function(k,G,fa){if(1E4>fa.length){var na;return(na=this.values_).splice.apply(na,[k,G].concat(fa))}na=this.values_.slice(k,k+G);var ta=this.values_.slice(k+G);this.values_.length+=fa.length-G;for(G=0;G<fa.length;G++)this.values_[k+
G]=fa[G];for(G=0;G<ta.length;G++)this.values_[k+fa.length+G]=ta[G];return na};d.notifyArrayChildUpdate_=function(k,G,fa){var na=!this.owned_&&!1,ta=Ad(this);k=ta||na?{observableKind:"array",object:this.proxy_,type:kq,debugObjectName:this.atom_.name_,index:k,newValue:G,oldValue:fa}:null;this.atom_.reportChanged();ta&&Od(this,k)};d.notifyArraySplice_=function(k,G,fa){var na=!this.owned_&&!1,ta=Ad(this);k=ta||na?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",
index:k,removed:fa,added:G,removedCount:fa.length,addedCount:G.length}:null;this.atom_.reportChanged();ta&&Od(this,k)};d.get_=function(k){if(this.legacyMode_&&k>=this.values_.length)console.warn("[mobx] Out of bounds read: "+k);else return this.atom_.reportObserved(),this.dehanceValue_(this.values_[k])};d.set_=function(k,G){var fa=this.values_;this.legacyMode_&&k>fa.length&&f(17,k,fa.length);if(k<fa.length){var na=fa[k];if(Hb(this)){G=Ib(this,{type:kq,object:this.proxy_,index:k,newValue:G});if(!G)return;
G=G.newValue}G=this.enhancer_(G,na);G!==na&&(fa[k]=G,this.notifyArrayChildUpdate_(k,G,na))}else{k=Array(k+1-fa.length);for(na=0;na<k.length-1;na++)k[na]=void 0;k[k.length-1]=G;this.spliceWithArray_(fa.length,0,k)}};return a}(),Vv={clear:function(){return this.splice(0)},replace:function(a){var d=this[Md];return d.spliceWithArray_(0,d.values_.length,a)},toJSON:function(){return this.slice()},splice:function(a,d){for(var k=arguments.length,G=Array(2<k?k-2:0),fa=2;fa<k;fa++)G[fa-2]=arguments[fa];k=this[Md];
switch(arguments.length){case 0:return[];case 1:return k.spliceWithArray_(a);case 2:return k.spliceWithArray_(a,d)}return k.spliceWithArray_(a,d,G)},spliceWithArray:function(a,d,k){return this[Md].spliceWithArray_(a,d,k)},push:function(){for(var a=this[Md],d=arguments.length,k=Array(d),G=0;G<d;G++)k[G]=arguments[G];a.spliceWithArray_(a.values_.length,0,k);return a.values_.length},pop:function(){return this.splice(Math.max(this[Md].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},
unshift:function(){for(var a=this[Md],d=arguments.length,k=Array(d),G=0;G<d;G++)k[G]=arguments[G];a.spliceWithArray_(0,0,k);return a.values_.length},reverse:function(){sf.trackingDerivation&&f(37,"reverse");this.replace(this.slice().reverse());return this},sort:function(){sf.trackingDerivation&&f(37,"sort");var a=this.slice();a.sort.apply(a,arguments);this.replace(a);return this},remove:function(a){var d=this[Md];a=d.dehanceValues_(d.values_).indexOf(a);return-1<a?(this.splice(a,1),!0):!1}};rb("concat",
nb);rb("flat",nb);rb("includes",nb);rb("indexOf",nb);rb("join",nb);rb("lastIndexOf",nb);rb("slice",nb);rb("toString",nb);rb("toLocaleString",nb);rb("every",Ub);rb("filter",Ub);rb("find",Ub);rb("findIndex",Ub);rb("flatMap",Ub);rb("forEach",Ub);rb("map",Ub);rb("some",Ub);rb("reduce",Kb);rb("reduceRight",Kb);var lE=D("ObservableArrayAdministration",tx),mE={};var nE=Symbol.iterator;var oE=Symbol.toStringTag;var Gz=function(){function a(k,G,fa){var na=this;void 0===G&&(G=Ya);void 0===fa&&(fa="ObservableMap");
this.name_=this.enhancer_=void 0;this[Md]=mE;this.dehancer=this.changeListeners_=this.interceptors_=this.keysAtom_=this.hasMap_=this.data_=void 0;this.enhancer_=G;this.name_=fa;aa(Map)||f(18);this.keysAtom_=Va("ObservableMap.keys()");this.data_=new Map;this.hasMap_=new Map;Yb(!0,function(){na.merge(k)})}var d=a.prototype;d.has_=function(k){return this.data_.has(k)};d.has=function(k){var G=this;if(!sf.trackingDerivation)return this.has_(k);var fa=this.hasMap_.get(k);if(!fa){var na=fa=new Fs(this.has_(k),
Ua,"ObservableMap.key?",!1);this.hasMap_.set(k,na);de(na,function(){return G.hasMap_["delete"](k)})}return fa.get()};d.set=function(k,G){var fa=this.has_(k);if(Hb(this)){G=Ib(this,{type:fa?kq:"add",object:this,newValue:G,name:k});if(!G)return this;G=G.newValue}fa?this.updateValue_(k,G):this.addValue_(k,G);return this};d["delete"]=function(k){var G=this;if(Hb(this)&&!Ib(this,{type:"delete",object:this,name:k}))return!1;if(this.has_(k)){var fa=Ad(this),na=fa?{observableKind:"map",debugObjectName:this.name_,
type:"delete",object:this,oldValue:this.data_.get(k).value_,name:k}:null;ed(function(){var ta;G.keysAtom_.reportChanged();null==(ta=G.hasMap_.get(k))?void 0:ta.setNewValue_(!1);G.data_.get(k).setNewValue_(void 0);G.data_["delete"](k)});fa&&Od(this,na);return!0}return!1};d.updateValue_=function(k,G){var fa=this.data_.get(k);G=fa.prepareNewValue_(G);if(G!==sf.UNCHANGED){var na=Ad(this);k=na?{observableKind:"map",debugObjectName:this.name_,type:kq,object:this,oldValue:fa.value_,name:k,newValue:G}:null;
fa.setNewValue_(G);na&&Od(this,k)}};d.addValue_=function(k,G){var fa=this;ed(function(){var Ha,Sa=new Fs(G,fa.enhancer_,"ObservableMap.key",!1);fa.data_.set(k,Sa);G=Sa.value_;null==(Ha=fa.hasMap_.get(k))?void 0:Ha.setNewValue_(!0);fa.keysAtom_.reportChanged()});var na=Ad(this),ta=na?{observableKind:"map",debugObjectName:this.name_,type:"add",object:this,name:k,newValue:G}:null;na&&Od(this,ta)};d.get=function(k){return this.has(k)?this.dehanceValue_(this.data_.get(k).get()):this.dehanceValue_(void 0)};
d.dehanceValue_=function(k){return void 0!==this.dehancer?this.dehancer(k):k};d.keys=function(){this.keysAtom_.reportObserved();return this.data_.keys()};d.values=function(){var k=this,G=this.keys();return Na({next:function(){var fa=G.next(),na=fa.done;fa=fa.value;return{done:na,value:na?void 0:k.get(fa)}}})};d.entries=function(){var k=this,G=this.keys();return Na({next:function(){var fa=G.next(),na=fa.done;fa=fa.value;return{done:na,value:na?void 0:[fa,k.get(fa)]}}})};d[nE]=function(){return this.entries()};
d.forEach=function(k,G){for(var fa=Fa(this),na;!(na=fa()).done;)na=na.value,k.call(G,na[1],na[0],this)};d.merge=function(k){var G=this;zr(k)&&(k=new Map(k));ed(function(){P(k)?N(k).forEach(function(fa){return G.set(fa,k[fa])}):Array.isArray(k)?k.forEach(function(fa){return G.set(fa[0],fa[1])}):L(k)?(k.constructor!==Map&&f(19,k),k.forEach(function(fa,na){return G.set(na,fa)})):null!==k&&void 0!==k&&f(20,k)});return this};d.clear=function(){var k=this;ed(function(){lc(function(){for(var G=Fa(k.keys()),
fa;!(fa=G()).done;)k["delete"](fa.value)})})};d.replace=function(k){var G=this;ed(function(){for(var fa=Wc(k),na=new Map,ta=!1,Ha=Fa(G.data_.keys()),Sa;!(Sa=Ha()).done;)if(Sa=Sa.value,!fa.has(Sa))if(G["delete"](Sa))ta=!0;else{var Za=G.data_.get(Sa);na.set(Sa,Za)}for(fa=Fa(fa.entries());!(Ha=fa()).done;)Sa=Ha.value,Ha=Sa[0],Za=Sa[1],Sa=G.data_.has(Ha),G.set(Ha,Za),G.data_.has(Ha)&&(Za=G.data_.get(Ha),na.set(Ha,Za),Sa||(ta=!0));if(!ta)if(G.data_.size!==na.size)G.keysAtom_.reportChanged();else for(ta=
G.data_.keys(),fa=na.keys(),Ha=ta.next(),Sa=fa.next();!Ha.done;){if(Ha.value!==Sa.value){G.keysAtom_.reportChanged();break}Ha=ta.next();Sa=fa.next()}G.data_=na});return this};d.toString=function(){return"[object ObservableMap]"};d.toJSON=function(){return Array.from(this)};d.observe_=function(k,G){return be(this,k)};d.intercept_=function(k){return Sb(this,k)};X(a,[{key:"size",get:function(){this.keysAtom_.reportObserved();return this.data_.size}},{key:oE,get:function(){return"Map"}}]);return a}(),
zr=D("ObservableMap",Gz),pE={};var qE=Symbol.iterator;var rE=Symbol.toStringTag;var Hz=function(){function a(k,G,fa){void 0===G&&(G=Ya);void 0===fa&&(fa="ObservableSet");this.name_=void 0;this[Md]=pE;this.data_=new Set;this.enhancer_=this.dehancer=this.interceptors_=this.changeListeners_=this.atom_=void 0;this.name_=fa;aa(Set)||f(22);this.atom_=Va(this.name_);this.enhancer_=function(na,ta){return G(na,ta,fa)};k&&this.replace(k)}var d=a.prototype;d.dehanceValue_=function(k){return void 0!==this.dehancer?
this.dehancer(k):k};d.clear=function(){var k=this;ed(function(){lc(function(){for(var G=Fa(k.data_.values()),fa;!(fa=G()).done;)k["delete"](fa.value)})})};d.forEach=function(k,G){for(var fa=Fa(this),na;!(na=fa()).done;)na=na.value,k.call(G,na,na,this)};d.add=function(k){var G=this;if(Hb(this)&&!Ib(this,{type:"add",object:this,newValue:k}))return this;if(!this.has(k)){ed(function(){G.data_.add(G.enhancer_(k,void 0));G.atom_.reportChanged()});var fa=Ad(this),na=fa?{observableKind:"set",debugObjectName:this.name_,
type:"add",object:this,newValue:k}:null;fa&&Od(this,na)}return this};d["delete"]=function(k){var G=this;if(Hb(this)&&!Ib(this,{type:"delete",object:this,oldValue:k}))return!1;if(this.has(k)){var fa=Ad(this),na=fa?{observableKind:"set",debugObjectName:this.name_,type:"delete",object:this,oldValue:k}:null;ed(function(){G.atom_.reportChanged();G.data_["delete"](k)});fa&&Od(this,na);return!0}return!1};d.has=function(k){this.atom_.reportObserved();return this.data_.has(this.dehanceValue_(k))};d.entries=
function(){var k=0,G=Array.from(this.keys()),fa=Array.from(this.values());return Na({next:function(){var na=k;k+=1;return na<fa.length?{value:[G[na],fa[na]],done:!1}:{done:!0}}})};d.keys=function(){return this.values()};d.values=function(){this.atom_.reportObserved();var k=this,G=0,fa=Array.from(this.data_.values());return Na({next:function(){return G<fa.length?{value:k.dehanceValue_(fa[G++]),done:!1}:{done:!0}}})};d.replace=function(k){var G=this;Hs(k)&&(k=new Set(k));ed(function(){Array.isArray(k)?
(G.clear(),k.forEach(function(fa){return G.add(fa)})):Q(k)?(G.clear(),k.forEach(function(fa){return G.add(fa)})):null!==k&&void 0!==k&&f("Cannot initialize set from "+k)});return this};d.observe_=function(k,G){return be(this,k)};d.intercept_=function(k){return Sb(this,k)};d.toJSON=function(){return Array.from(this)};d.toString=function(){return"[object ObservableSet]"};d[qE]=function(){return this.values()};X(a,[{key:"size",get:function(){this.atom_.reportObserved();return this.data_.size}},{key:rE,
get:function(){return"Set"}}]);return a}(),Hs=D("ObservableSet",Hz),Iz=Object.create(null),Jz=function(){function a(k,G,fa,na){void 0===G&&(G=new Map);void 0===na&&(na=wh);this.pendingKeys_=this.appliedAnnotations_=this.isPlainObject_=this.proxy_=this.interceptors_=this.changeListeners_=this.keysAtom_=this.defaultAnnotation_=this.values_=this.target_=void 0;this.target_=k;this.values_=G;this.name_=fa;this.defaultAnnotation_=na;this.keysAtom_=new cg("ObservableObject.keys");this.isPlainObject_=P(this.target_)}
var d=a.prototype;d.getObservablePropValue_=function(k){return this.values_.get(k).get()};d.setObservablePropValue_=function(k,G){var fa=this.values_.get(k);if(fa instanceof Eu)return fa.set(G),!0;if(Hb(this)){G=Ib(this,{type:kq,object:this.proxy_||this.target_,name:k,newValue:G});if(!G)return null;G=G.newValue}G=fa.prepareNewValue_(G);if(G!==sf.UNCHANGED){var na=Ad(this);k=na?{type:kq,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:fa.value_,name:k,newValue:G}:
null;fa.setNewValue_(G);na&&Od(this,k)}return!0};d.get_=function(k){sf.trackingDerivation&&!R(this.target_,k)&&this.has_(k);return this.target_[k]};d.set_=function(k,G,fa){void 0===fa&&(fa=!1);if(R(this.target_,k)){if(this.values_.has(k))return this.setObservablePropValue_(k,G);if(fa)return Reflect.set(this.target_,k,G);this.target_[k]=G;return!0}return this.extend_(k,{value:G,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,fa)};d.has_=function(k){if(!sf.trackingDerivation)return k in
this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var G=this.pendingKeys_.get(k);G||(G=new Fs(k in this.target_,Ua,"ObservableObject.key?",!1),this.pendingKeys_.set(k,G));return G.get()};d.make_=function(k,G){!0===G&&(G=this.defaultAnnotation_);if(!1!==G){if(!(k in this.target_)){var fa;if(null!=(fa=this.target_[vd])&&fa[k])return;f(1,G.annotationType_,this.name_+"."+k.toString())}for(fa=this.target_;fa&&fa!==cq;){var na=bq(fa,k);if(na){na=G.make_(this,k,na,fa);if(0===na)return;if(1===na)break}fa=
Object.getPrototypeOf(fa)}var ta;null==(ta=this.target_[vd])?!0:delete ta[k]}};d.extend_=function(k,G,fa,na){void 0===na&&(na=!1);!0===fa&&(fa=this.defaultAnnotation_);if(!1===fa)return this.defineProperty_(k,G,na);if(G=fa.extend_(this,k,G,na)){var ta;null==(ta=this.target_[vd])?!0:delete ta[k]}return G};d.defineProperty_=function(k,G,fa){void 0===fa&&(fa=!1);try{Vc();var na=this.delete_(k);if(!na)return na;if(Hb(this)){var ta=Ib(this,{object:this.proxy_||this.target_,name:k,type:"add",newValue:G.value});
if(!ta)return null;var Ha=ta.newValue;G.value!==Ha&&(G=S({},G,{value:Ha}))}if(fa){if(!Reflect.defineProperty(this.target_,k,G))return!1}else yp(this.target_,k,G);this.notifyPropertyAddition_(k,G.value)}finally{jd()}return!0};d.defineObservableProperty_=function(k,G,fa,na){void 0===na&&(na=!1);try{Vc();var ta=this.delete_(k);if(!ta)return ta;if(Hb(this)){var Ha=Ib(this,{object:this.proxy_||this.target_,name:k,type:"add",newValue:G});if(!Ha)return null;G=Ha.newValue}var Sa=fe(k),Za={configurable:sf.safeDescriptors?
this.isPlainObject_:!0,enumerable:!0,get:Sa.get,set:Sa.set};if(na){if(!Reflect.defineProperty(this.target_,k,Za))return!1}else yp(this.target_,k,Za);var fb=new Fs(G,fa,"ObservableObject.key",!1);this.values_.set(k,fb);this.notifyPropertyAddition_(k,fb.value_)}finally{jd()}return!0};d.defineComputedProperty_=function(k,G,fa){void 0===fa&&(fa=!1);try{Vc();var na=this.delete_(k);if(!na)return na;if(Hb(this)&&!Ib(this,{object:this.proxy_||this.target_,name:k,type:"add",newValue:void 0}))return null;G.name||
(G.name="ObservableObject.key");G.context=this.proxy_||this.target_;var ta=fe(k),Ha={configurable:sf.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:ta.get,set:ta.set};if(fa){if(!Reflect.defineProperty(this.target_,k,Ha))return!1}else yp(this.target_,k,Ha);this.values_.set(k,new Eu(G));this.notifyPropertyAddition_(k,void 0)}finally{jd()}return!0};d.delete_=function(k,G){void 0===G&&(G=!1);if(!R(this.target_,k))return!0;if(Hb(this)&&!Ib(this,{object:this.proxy_||this.target_,name:k,type:"remove"}))return null;
try{var fa,na;Vc();var ta=Ad(this),Ha=this.values_.get(k),Sa=void 0;if(!Ha&&ta){var Za;Sa=null==(Za=bq(this.target_,k))?void 0:Za.value}if(G){if(!Reflect.deleteProperty(this.target_,k))return!1}else delete this.target_[k];Ha&&(this.values_["delete"](k),Ha instanceof Fs&&(Sa=Ha.value_),$b(Ha));this.keysAtom_.reportChanged();null==(fa=this.pendingKeys_)?void 0:null==(na=fa.get(k))?void 0:na.set(k in this.target_);if(ta){var fb={type:"remove",observableKind:"object",object:this.proxy_||this.target_,
debugObjectName:this.name_,oldValue:Sa,name:k};ta&&Od(this,fb)}}finally{jd()}return!0};d.observe_=function(k,G){return be(this,k)};d.intercept_=function(k){return Sb(this,k)};d.notifyPropertyAddition_=function(k,G){var fa,na,ta=Ad(this);ta&&(G=ta?{type:"add",observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:k,newValue:G}:null,ta&&Od(this,G));null==(fa=this.pendingKeys_)?void 0:null==(na=fa.get(k))?void 0:na.set(!0);this.keysAtom_.reportChanged()};d.ownKeys_=
function(){this.keysAtom_.reportObserved();return Dc(this.target_)};d.keys_=function(){this.keysAtom_.reportObserved();return Object.keys(this.target_)};return a}(),sE=D("ObservableObjectAdministration",Jz),tE=bf(0),ux=0,Kz=function(){};(function(a,d){Object.setPrototypeOf?Object.setPrototypeOf(a.prototype,d):void 0!==a.prototype.__proto__?a.prototype.__proto__=d:a.prototype=d})(Kz,Array.prototype);var vx=function(a,d,k){function G(na,ta,Ha,Sa){void 0===Ha&&(Ha="ObservableArray");void 0===Sa&&(Sa=
!1);var Za=a.call(this)||this;ta=new tx(Ha,ta,Sa,!0);ta.proxy_=ra(Za);K(ra(Za),Md,ta);na&&na.length&&(ta=dc(!0),Za.spliceWithArray(0,0,na),sf.allowStateChanges=ta);Object.defineProperty(ra(Za),"0",tE);return Za}ha(G,a);var fa=G.prototype;fa.concat=function(){this[Md].atom_.reportObserved();for(var na=arguments.length,ta=Array(na),Ha=0;Ha<na;Ha++)ta[Ha]=arguments[Ha];return Array.prototype.concat.apply(this.slice(),ta.map(function(Sa){return Yc(Sa)?Sa.slice():Sa}))};fa[k]=function(){var na=this,ta=
0;return Na({next:function(){return ta<na.length?{value:na[ta++],done:!1}:{done:!0,value:void 0}}})};X(G,[{key:"length",get:function(){return this[Md].getArrayLength_()},set:function(na){this[Md].setArrayLength_(na)}},{key:d,get:function(){return"Array"}}]);return G}(Kz,Symbol.toStringTag,Symbol.iterator);Object.entries(Vv).forEach(function(a){var d=a[0];a=a[1];"concat"!==d&&T(vx.prototype,d,a)});ie(1E3);var Lz=cq.toString;["Symbol","Map","Set"].forEach(function(a){"undefined"===typeof F()[a]&&f("MobX requires global '"+
a+"' to be available or polyfilled")});"object"===typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:Ac,extras:{getDebugName:qb},$mobx:Md});var uE=ba(598),gm=class{constructor(a){gb(this,"props");gb(this,"aspectRatio");gb(this,"type");gb(this,"hideCloneHandles",!1);gb(this,"hideResizeHandles",!1);gb(this,"hideRotateHandle",!1);gb(this,"hideContextBar",!1);gb(this,"hideSelectionDetail",!1);gb(this,"hideSelection",!1);gb(this,"canChangeAspectRatio",!0);gb(this,"canUnmount",
!0);gb(this,"canResize",[!0,!0]);gb(this,"canScale",!0);gb(this,"canFlip",!0);gb(this,"canEdit",!1);gb(this,"canBind",!1);gb(this,"nonce");gb(this,"bindingDistance",4);gb(this,"isDirty",!1);gb(this,"lastSerialized");gb(this,"getCenter",()=>cf.getBoundsCenter(this.bounds));gb(this,"getRotatedBounds",()=>{const {bounds:na,props:{rotation:ta}}=this;return ta?cf.getBoundsFromPoints(cf.getRotatedCorners(na,ta)):na});gb(this,"hitTestPoint",na=>{var ta=this.rotatedBounds;if(!this.props.rotation)return Tj.pointInBounds(na,
ta);ta=cf.getRotatedCorners(ta,this.props.rotation);return Tj.pointInPolygon(na,ta)});gb(this,"hitTestLineSegment",(na,ta)=>{const Ha=cf.getBoundsFromPoints([na,ta]),{rotatedBounds:Sa,props:{rotation:Za=0}}=this;return cf.boundsContain(Sa,Ha)||Za?h(na,ta,cf.getRotatedCorners(this.bounds)).didIntersect:0<r(Sa,na,ta).length});gb(this,"hitTestBounds",na=>{const {rotatedBounds:ta,props:{rotation:Ha=0}}=this,Sa=cf.getRotatedCorners(this.bounds,Ha);return cf.boundsContain(na,ta)||0<w([na.minX,na.minY],
[na.width,na.height],Sa).length});gb(this,"getExpandedBounds",()=>cf.expandBounds(this.getBounds(),this.bindingDistance));gb(this,"getBindingPoint",(na,ta,Ha,Sa)=>{var Za=this.getBounds(),fb=this.getExpandedBounds();if(Tj.pointInBounds(na,fb)){var ib=A(ta,Ha,fb).filter(Bb=>Bb.didIntersect).map(Bb=>Bb.points[0]);if(ib.length)return Ha=this.getCenter(),ib=ib.sort((Bb,Ob)=>Pd.dist(Ob,ta)-Pd.dist(Bb,ta))[0],ib=Pd.med(na,ib),Sa?(Sa=2>Pd.dist(na,Ha)?Ha:na,Za=0):(Sa=2>Pd.distanceToLineSegment(na,ib,Ha)?
Ha:ib,Za=Tj.pointInBounds(na,Za)?this.bindingDistance:Math.max(this.bindingDistance,cf.getBoundsSides(Za).map(Bb=>Pd.distanceToLineSegment(Bb[1][0],Bb[1][1],na)).sort((Bb,Ob)=>Bb-Ob)[0])),fb=Pd.divV(Pd.sub(Sa,[fb.minX,fb.minY]),[fb.width,fb.height]),{point:Pd.clampV(fb,0,1),distance:Za}}});gb(this,"getSerialized",()=>yc(Re(Ud({},this.props),{type:this.type,nonce:this.nonce})));gb(this,"getCachedSerialized",()=>{!this.isDirty&&this.lastSerialized||ed(()=>{this.setIsDirty(!1);this.setLastSerialized(this.getSerialized())});
if(this.lastSerialized)return this.lastSerialized;throw Error("Should not get here for getCachedSerialized");});gb(this,"validateProps",na=>na);gb(this,"update",(na,ta=!1,Ha=!1)=>{ta||this.isDirty||this.setIsDirty(!0);ta||Ha||this.incNonce();Object.assign(this.props,this.validateProps(na));return this});gb(this,"clone",()=>new this.constructor(this.serialized));gb(this,"onResetBounds",na=>this);gb(this,"scale",[1,1]);gb(this,"onResizeStart",na=>{var ta;this.scale=[...(null!=(ta=this.props.scale)?
ta:[1,1])];return this});gb(this,"onResize",(na,ta)=>{const {bounds:Ha,rotation:Sa,scale:[Za,fb]}=ta;na=[...this.scale];0>Za&&(na[0]*=-1);0>fb&&(na[1]*=-1);this.update({point:[Ha.minX,Ha.minY],scale:na,rotation:Sa});return this});gb(this,"onHandleChange",(na,{id:ta,delta:Ha})=>{if(void 0!==na.handles){var Sa=Js(na.handles);Sa[ta]=Re(Ud({},Sa[ta]),{point:Pd.add(Ha,na.handles[ta].point)});var Za=cf.getCommonTopLeft(Object.values(Sa).map(fb=>fb.point));Object.values(Sa).forEach(fb=>{fb.point=Pd.sub(fb.point,
Za)});this.update({point:Pd.add(na.point,Za),handles:Sa})}});var d,k;const G=this.constructor.id,fa=null!=(d=this.constructor.defaultProps)?d:{};this.type=G;this.props=Ud(Ud({scale:[1,1]},fa),a);this.nonce=null!=(k=a.nonce)?k:Date.now();Hf(this)}get id(){return this.props.id}setNonce(a){this.nonce=a}incNonce(){this.nonce++}setIsDirty(a){this.isDirty=a}setLastSerialized(a){this.lastSerialized=a}get center(){return this.getCenter()}get bounds(){return this.getBounds()}get rotatedBounds(){return this.getRotatedBounds()}get serialized(){return this.getCachedSerialized()}getShapeSVGJsx(a){a=
this.getBounds();const {stroke:d,strokeWidth:k,strokeType:G,opacity:fa,fill:na,noFill:ta,borderRadius:Ha}=this.props;return(0,uE.jsx)("rect",{fill:ta?"none":th(na,"background"),stroke:th(d,"stroke"),strokeWidth:null!=k?k:2,strokeDasharray:"dashed"===G?"8 2":void 0,fillOpacity:null!=fa?fa:.2,width:a.width,height:a.height,rx:Ha,ry:Ha})}};gb(gm,"type");Nd([ze],gm.prototype,"props",2);Nd([ze],gm.prototype,"canResize",2);Nd([ze],gm.prototype,"nonce",2);Nd([ze],gm.prototype,"isDirty",2);Nd([ze],gm.prototype,
"lastSerialized",2);Nd([kf],gm.prototype,"id",1);Nd([hg],gm.prototype,"setNonce",1);Nd([hg],gm.prototype,"incNonce",1);Nd([hg],gm.prototype,"setIsDirty",1);Nd([hg],gm.prototype,"setLastSerialized",1);Nd([kf],gm.prototype,"center",1);Nd([kf],gm.prototype,"bounds",1);Nd([kf],gm.prototype,"rotatedBounds",1);Nd([kf],gm.prototype,"serialized",1);Nd([hg],gm.prototype,"update",2);var vn=class extends gm{constructor(a={}){super(a);gb(this,"canBind",!0);gb(this,"getBounds",()=>{const [d,k]=this.props.point,
[G,fa]=this.props.size;return{minX:d,minY:k,maxX:d+G,maxY:k+fa,width:G,height:fa}});gb(this,"getRotatedBounds",()=>cf.getBoundsFromPoints(cf.getRotatedCorners(this.bounds,this.props.rotation)));gb(this,"onResize",(d,k)=>{const {bounds:G,rotation:fa,scale:[na,ta]}=k;d=[...this.scale];0>na&&(d[0]*=-1);0>ta&&(d[1]*=-1);this.update({point:[G.minX,G.minY],scale:d,rotation:fa});return this.update({rotation:fa,point:[G.minX,G.minY],size:[Math.max(1,G.width),Math.max(1,G.height)],scale:d})});gb(this,"validateProps",
d=>{void 0!==d.size&&(d.size[0]=Math.max(d.size[0],1),d.size[1]=Math.max(d.size[1],1));return d});Hf(this)}};gb(vn,"id","box");gb(vn,"defaultProps",{id:"box",type:"box",parentId:"page",point:[0,0],size:[100,100]});var Bt=class extends gm{constructor(a={}){super(a);gb(this,"getBounds",()=>{const {pointBounds:d,props:{point:k}}=this;return cf.translateBounds(d,k)});gb(this,"getRotatedBounds",()=>{const {props:{rotation:d,point:k},bounds:G,rotatedPoints:fa}=this;return d?cf.translateBounds(cf.getBoundsFromPoints(fa),
k):G});gb(this,"normalizedPoints",[]);gb(this,"isResizeFlippedX",!1);gb(this,"isResizeFlippedY",!1);gb(this,"onResizeStart",()=>{var d;const {bounds:k,props:{points:G}}=this;this.scale=[...(null!=(d=this.props.scale)?d:[1,1])];const fa=[k.width,k.height];this.normalizedPoints=G.map(na=>qd.divV(na,fa));return this});gb(this,"onResize",(d,k)=>{const {bounds:G,scale:[fa,na]}=k,ta=[G.width,G.height];d=[...this.scale];0>fa&&(d[0]*=-1);0>na&&(d[1]*=-1);return this.update(fa||na?{point:[G.minX,G.minY],points:this.normalizedPoints.map(Ha=>
qd.mulV(Ha,ta).concat(Ha[2])),scale:d}:{point:[G.minX,G.minY],points:this.normalizedPoints.map(Ha=>qd.mulV(Ha,ta).concat(Ha[2]))})});gb(this,"hitTestPoint",d=>{const {props:{points:k,point:G}}=this;return Tj.pointNearToPolyline(qd.sub(d,G),k)});gb(this,"hitTestLineSegment",(d,k)=>{const {bounds:G,props:{points:fa,point:na}}=this;if(Tj.pointInBounds(d,G)||Tj.pointInBounds(k,G)||0<r(G,d,k).length){const ta=qd.sub(d,na),Ha=qd.sub(k,na);return h(ta,Ha,fa).didIntersect||!!fa.find(Sa=>5>qd.dist(ta,Sa)||
5>qd.dist(Ha,Sa))}return!1});gb(this,"hitTestBounds",d=>{const {rotatedBounds:k,props:{points:G,point:fa}}=this,na=cf.translateBounds(d,qd.neg(fa));return cf.boundsContain(d,k)||G.every(ta=>Tj.pointInBounds(ta,na))||cf.boundsCollide(d,k)&&0<E([na.minX,na.minY],[na.width,na.height],G).length});Hf(this)}get pointBounds(){const {props:{points:a}}=this;return cf.getBoundsFromPoints(a)}get rotatedPoints(){const {props:{point:a,points:d,rotation:k},center:G}=this;if(!k)return d;const fa=qd.sub(G,a);return d.map(na=>
qd.rotWith(na,fa,k))}};gb(Bt,"id","draw");gb(Bt,"defaultProps",{id:"draw",type:"draw",parentId:"page",point:[0,0],points:[],isComplete:!1});Nd([kf],Bt.prototype,"pointBounds",1);Nd([kf],Bt.prototype,"rotatedPoints",1);var wx=class extends vn{constructor(a={}){super(a);gb(this,"getBounds",()=>{const {props:{point:[d,k],size:[G,fa]}}=this;return cf.getRotatedEllipseBounds(d,k,G/2,fa/2,0)});gb(this,"getRotatedBounds",()=>{const {props:{point:[d,k],size:[G,fa],rotation:na}}=this;return cf.getRotatedEllipseBounds(d,
k,G/2,fa/2,na)});gb(this,"hitTestPoint",d=>{const {props:{size:k,rotation:G},center:fa}=this;return Tj.pointInEllipse(d,fa,k[0],k[1],G||0)});gb(this,"hitTestLineSegment",(d,k)=>{const {props:{size:[G,fa],rotation:na=0},center:ta}=this;return g(d,k,ta,G,fa,na).didIntersect});gb(this,"hitTestBounds",d=>{const {props:{size:[k,G],rotation:fa=0},rotatedBounds:na}=this;var ta;if(!(ta=cf.boundsContain(d,na))){const {minX:Ha,minY:Sa,width:Za,height:fb}=d;ta=0<t(this.center,k/2,G/2,fa,[Ha,Sa],[Za,fb]).length}return ta});
Hf(this)}};gb(wx,"id","ellipse");gb(wx,"defaultProps",{id:"ellipse",type:"ellipse",parentId:"page",point:[0,0],size:[100,100]});var xx=class extends vn{constructor(a={}){super(a);gb(this,"onResetBounds",d=>{const {clipping:k,size:G,point:fa}=this.props;if(k){const [na,ta,Ha,Sa]=Array.isArray(k)?k:[k,k,k,k];return this.update({clipping:0,point:[fa[0]-Sa,fa[1]-na],size:[G[0]+(Sa-ta),G[1]+(na-Ha)]})}if(d.asset){const {size:[na,ta]}=d.asset;this.update({clipping:0,point:[fa[0]+G[0]/2-na/2,fa[1]+G[1]/
2-ta/2],size:[na,ta]})}return this});gb(this,"onResize",(d,k)=>{const {bounds:G,clip:fa,scale:na}=k;({clipping:k}=this.props);const {clipping:ta}=d;if(fa){const {point:[Ha,Sa],size:[Za,fb]}=d,[ib,Bb,Ob,Fb]=ta?Array.isArray(ta)?ta:[ta,ta,ta,ta]:[0,0,0,0];k=[ib+(G.minY-Sa),Bb+(G.maxX-(Ha+Za)),Ob+(G.maxY-(Sa+fb)),Fb+(G.minX-Ha)]}else void 0!==ta&&(k=Array.isArray(ta)?ta:[ta,ta,ta,ta],k=[k[0]*na[1],k[1]*na[0],k[2]*na[1],k[3]*na[0]]);if(k&&Array.isArray(k)){const Ha=k;Ha.every((Sa,Za)=>0===Za||Sa===Ha[Za-
1])&&(k=Ha[0])}return this.update({point:[G.minX,G.minY],size:[Math.max(1,G.width),Math.max(1,G.height)],clipping:k})});Hf(this)}};gb(xx,"id","ellipse");gb(xx,"defaultProps",{id:"ellipse",type:"ellipse",parentId:"page",point:[0,0],size:[100,100],clipping:0,objectFit:"none",assetId:""});var Mz=class extends gm{constructor(a={}){super(a);gb(this,"getBounds",()=>{const {points:d,props:{point:k}}=this;return cf.translateBounds(cf.getBoundsFromPoints(d),k)});gb(this,"getRotatedBounds",()=>{const {rotatedPoints:d,
props:{point:k}}=this;return cf.translateBounds(cf.getBoundsFromPoints(d),k)});gb(this,"normalizedHandles",[]);gb(this,"onResizeStart",()=>{var d;const {props:{handles:k},bounds:G}=this;this.scale=[...(null!=(d=this.props.scale)?d:[1,1])];const fa=[G.width,G.height];this.normalizedHandles=Object.values(k).map(na=>qd.divV(na.point,fa));return this});gb(this,"onResize",(d,k)=>{const {bounds:G,scale:[fa,na]}=k,{props:{handles:ta},normalizedHandles:Ha}=this,Sa=[G.width,G.height];d=[...this.scale];0>fa&&
(d[0]*=-1);0>na&&(d[1]*=-1);return this.update({point:[G.minX,G.minY],handles:Object.values(ta).map((Za,fb)=>Re(Ud({},Za),{point:qd.mulV(Ha[fb],Sa)})),scale:d})});gb(this,"hitTestPoint",d=>{const {points:k}=this;return Tj.pointNearToPolyline(qd.sub(d,this.props.point),k)});gb(this,"hitTestLineSegment",(d,k)=>{const {bounds:G,points:fa,props:{point:na}}=this;if(Tj.pointInBounds(d,G)||Tj.pointInBounds(k,G)||0<r(G,d,k).length){const ta=qd.sub(d,na),Ha=qd.sub(k,na);return h(ta,Ha,fa).didIntersect||!!fa.find(Sa=>
5>qd.dist(ta,Sa)||5>qd.dist(Ha,Sa))}return!1});gb(this,"hitTestBounds",d=>{const {rotatedBounds:k,points:G,props:{point:fa}}=this,na=cf.translateBounds(d,qd.neg(fa));return cf.boundsContain(d,k)||G.every(ta=>Tj.pointInBounds(ta,na))||cf.boundsCollide(d,k)&&0<E([na.minX,na.minY],[na.width,na.height],G).length});gb(this,"validateProps",d=>{d.point&&(d.point=[0,0]);void 0!==d.handles&&1>Object.values(d.handles).length&&(d.handles=Mz.defaultProps.handles);return d});Hf(this)}get points(){return Object.values(this.props.handles).map(a=>
a.point)}get centroid(){const {points:a}=this;return Ik.getPolygonCentroid(a)}get rotatedPoints(){const {centroid:a,props:{handles:d,rotation:k}}=this;return k?Object.values(d).map(G=>qd.rotWith(G.point,a,k)):this.points}},Ct=Mz;gb(Ct,"id","polyline");gb(Ct,"defaultProps",{id:"polyline",type:"polyline",parentId:"page",point:[0,0],handles:{}});Nd([kf],Ct.prototype,"points",1);Nd([kf],Ct.prototype,"centroid",1);Nd([kf],Ct.prototype,"rotatedPoints",1);var Nz=class extends Ct{constructor(a={}){super(a);
gb(this,"hideResizeHandles",!0);gb(this,"hideRotateHandle",!0);gb(this,"validateProps",d=>{d.point&&(d.point=[0,0]);void 0!==d.handles&&1>Object.values(d.handles).length&&(d.handles=Nz.defaultProps.handles);return d});gb(this,"getHandlesChange",(d,k)=>{var G=xj(d.handles,k);G=xj(G,{start:{point:Pd.toFixed(G.start.point)},end:{point:Pd.toFixed(G.end.point)}});if(!Pd.isEqual(G.start.point,G.end.point)){k={point:d.point,handles:Js(G)};d=d.point;G=cf.translateBounds(cf.getBoundsFromPoints(Object.values(G).map(na=>
na.point)),k.point);var fa=Pd.sub([G.minX,G.minY],d);Pd.isEqual(fa,[0,0])||(Object.values(k.handles).forEach(na=>{na.point=Pd.toFixed(Pd.sub(na.point,fa))}),k.point=Pd.toFixed(Pd.add(k.point,fa)));return k}});Hf(this)}},Iu=Nz;gb(Iu,"id","line");gb(Iu,"defaultProps",{id:"line",type:"line",parentId:"page",point:[0,0],handles:{start:{id:"start",canBind:!0,point:[0,0]},end:{id:"end",canBind:!0,point:[1,1]}}});var Ar=class extends vn{constructor(a={}){super(a);gb(this,"getRotatedBounds",()=>{const {rotatedVertices:d,
props:{point:k},offset:G}=this;return cf.translateBounds(cf.getBoundsFromPoints(d),qd.add(k,G))});gb(this,"hitTestPoint",d=>{const {vertices:k}=this;return Tj.pointInPolygon(qd.add(d,this.props.point),k)});gb(this,"hitTestLineSegment",(d,k)=>{const {vertices:G,props:{point:fa}}=this;return h(qd.sub(d,fa),qd.sub(k,fa),G).didIntersect});gb(this,"hitTestBounds",d=>{const {rotatedBounds:k,offset:G,rotatedVertices:fa,props:{point:na}}=this,ta=cf.translateBounds(d,qd.neg(qd.add(na,G)));return cf.boundsContain(d,
k)||fa.every(Ha=>Tj.pointInBounds(Ha,ta))||0<w([ta.minX,ta.minY],[ta.width,ta.height],fa).length});gb(this,"validateProps",d=>{d.point&&(d.point=[0,0]);void 0!==d.sides&&3>d.sides&&(d.sides=3);return d});Hf(this)}get vertices(){return this.getVertices()}get pageVertices(){const {props:{point:a},vertices:d}=this;return d.map(k=>qd.add(k,a))}get centroid(){const {vertices:a}=this;return Ik.getPolygonCentroid(a)}get rotatedVertices(){const {vertices:a,centroid:d,props:{rotation:k}}=this;return k?a.map(G=>
qd.rotWith(G,d,k)):a}get offset(){const {props:{size:[a,d]}}=this,k=cf.getBoundsCenter(cf.getBoundsFromPoints(this.vertices));return qd.sub(qd.div([a,d],2),k)}getVertices(a=0){const {ratio:d,sides:k,size:G}=this.props;return 3===k?Ik.getTriangleVertices(G,a,d):Ik.getPolygonVertices(G,k,a,d)}};gb(Ar,"id","polygon");gb(Ar,"defaultProps",{id:"polygon",type:"polygon",parentId:"page",point:[0,0],size:[100,100],sides:5,ratio:1,isFlippedY:!1});Nd([kf],Ar.prototype,"vertices",1);Nd([kf],Ar.prototype,"pageVertices",
1);Nd([kf],Ar.prototype,"centroid",1);Nd([kf],Ar.prototype,"rotatedVertices",1);Nd([kf],Ar.prototype,"offset",1);var yx=class extends vn{constructor(a={}){super(a);gb(this,"canEdit",!0);gb(this,"canFlip",!1);Hf(this)}};gb(yx,"id","text");gb(yx,"defaultProps",{id:"text",type:"text",parentId:"page",isSizeLocked:!0,point:[0,0],size:[16,32],text:""});var Wv=class extends vn{constructor(a={}){super(a);gb(this,"canEdit",!1);gb(this,"canFlip",!1);gb(this,"getBounds",()=>0===this.shapes.length?(kg().deleteShapes([this.id]),
{minX:0,minY:0,maxX:0,maxY:0,width:0,height:0}):cf.getCommonBounds(this.shapes.map(d=>d.getBounds())));Hf(this);this.canResize=[!1,!1]}getShapes(){throw Error("will be implemented other places");}get shapes(){return this.getShapes()}};gb(Wv,"id","group");gb(Wv,"defaultProps",{id:"group",type:"group",parentId:"page",point:[0,0],size:[0,0],children:[]});Nd([kf],Wv.prototype,"shapes",1);var Dt=class{constructor(){gb(this,"_id");gb(this,"_initial");gb(this,"_states");gb(this,"_isActive",!1);gb(this,"cursor");
gb(this,"_disposables",[]);gb(this,"children",new Map([]));gb(this,"registerStates",k=>{k.forEach(G=>this.children.set(G.id,new G(this,this)));return this});gb(this,"deregisterStates",k=>{k.forEach(G=>{var fa;null==(fa=this.children.get(G.id))?void 0:fa.dispose();this.children.delete(G.id)});return this});gb(this,"currentState",{});gb(this,"transition",(k,G={})=>{if(0===this.children.size)throw Error(`Tool ${this.id} has no states, cannot transition to ${k}.`);const fa=this.children.get(k),na=this.currentState;
if(!fa)throw Error(`Could not find a state named ${k}.`);ed(()=>{this.currentState?(na._events.onExit(Re(Ud({},G),{toId:k})),na.dispose(),this.setCurrentState(fa),this._events.onTransition(Re(Ud({},G),{fromId:na.id,toId:k})),fa._events.onEnter(Re(Ud({},G),{fromId:na.id}))):(this.currentState=fa,fa._events.onEnter(Re(Ud({},G),{fromId:""})))});return this});gb(this,"isIn",k=>{k=k.split(".").reverse();let G=this;for(;0<k.length;){const fa=k.pop();if(!fa)return!0;if(G.currentState.id===fa){if(0===k.length)return!0;
G=G.currentState}else break}return!1});gb(this,"isInAny",(...k)=>k.some(this.isIn));gb(this,"forwardEvent",(k,...G)=>{var fa,na;(null==(na=null==(fa=this.currentState)?void 0:fa._events)?0:na[k])&&ed(()=>{var ta;return null==(ta=this.currentState._events)?void 0:ta[k](...G)})});gb(this,"_events",{onTransition:k=>{var G;null==(G=this.onTransition)?void 0:G.call(this,k)},onEnter:k=>{var G;this._isActive=!0;this.initial&&this.transition(this.initial,k);null==(G=this.onEnter)?void 0:G.call(this,k)},onExit:k=>
{var G,fa,na;this._isActive=!1;null==(fa=null==(G=this.currentState)?void 0:G.onExit)?void 0:fa.call(G,{toId:"parent"});null==(na=this.onExit)?void 0:na.call(this,k)},onPointerDown:(k,G)=>{var fa;null==(fa=this.onPointerDown)?void 0:fa.call(this,k,G);this.forwardEvent("onPointerDown",k,G)},onPointerUp:(k,G)=>{var fa;null==(fa=this.onPointerUp)?void 0:fa.call(this,k,G);this.forwardEvent("onPointerUp",k,G)},onPointerMove:(k,G)=>{var fa;null==(fa=this.onPointerMove)?void 0:fa.call(this,k,G);this.forwardEvent("onPointerMove",
k,G)},onPointerEnter:(k,G)=>{var fa;null==(fa=this.onPointerEnter)?void 0:fa.call(this,k,G);this.forwardEvent("onPointerEnter",k,G)},onPointerLeave:(k,G)=>{var fa;null==(fa=this.onPointerLeave)?void 0:fa.call(this,k,G);this.forwardEvent("onPointerLeave",k,G)},onDoubleClick:(k,G)=>{var fa;null==(fa=this.onDoubleClick)?void 0:fa.call(this,k,G);this.forwardEvent("onDoubleClick",k,G)},onKeyDown:(k,G)=>{var fa;this._events.onModifierKey(k,G);null==(fa=this.onKeyDown)?void 0:fa.call(this,k,G);this.forwardEvent("onKeyDown",
k,G)},onKeyUp:(k,G)=>{var fa;this._events.onModifierKey(k,G);null==(fa=this.onKeyUp)?void 0:fa.call(this,k,G);this.forwardEvent("onKeyUp",k,G)},onPinchStart:(k,G)=>{var fa;null==(fa=this.onPinchStart)?void 0:fa.call(this,k,G);this.forwardEvent("onPinchStart",k,G)},onPinch:(k,G)=>{var fa;null==(fa=this.onPinch)?void 0:fa.call(this,k,G);this.forwardEvent("onPinch",k,G)},onPinchEnd:(k,G)=>{var fa;null==(fa=this.onPinchEnd)?void 0:fa.call(this,k,G);this.forwardEvent("onPinchEnd",k,G)},onModifierKey:(k,
G)=>{switch(G.key){case "Shift":case "Alt":case "Ctrl":case "Meta":this._events.onPointerMove(k,G)}}});gb(this,"onEnter");gb(this,"onExit");gb(this,"onTransition");gb(this,"onPointerDown");gb(this,"onPointerUp");gb(this,"onPointerMove");gb(this,"onPointerEnter");gb(this,"onPointerLeave");gb(this,"onDoubleClick");gb(this,"onKeyDown");gb(this,"onKeyUp");gb(this,"onPinchStart");gb(this,"onPinch");gb(this,"onPinchEnd");const a=this.constructor.initial,d=this.constructor.states;this._id=this.constructor.id;
this._initial=a;this._states=d}dispose(){this._disposables.forEach(a=>a());this._disposables=[];return this}get initial(){return this._initial}get states(){return this._states}get id(){return this._id}get isActive(){return this._isActive}get ascendants(){return[this]}get descendants(){return Array.from(this.children.values()).flatMap(a=>[a,...a.descendants])}setCurrentState(a){this.currentState=a}};gb(Dt,"id");gb(Dt,"shortcuts");Nd([ze],Dt.prototype,"currentState",2);Nd([hg],Dt.prototype,"setCurrentState",
1);var zx=class extends Dt{constructor(a,d){var k,G;super();gb(this,"_root");gb(this,"_parent");gb(this,"children",new Map([]));gb(this,"registerStates",fa=>{fa.forEach(na=>this.children.set(na.id,new na(this,this._root)));return this});gb(this,"deregisterStates",fa=>{fa.forEach(na=>{var ta;null==(ta=this.children.get(na.id))?void 0:ta.dispose();this.children.delete(na.id)});return this});this._parent=a;this._root=d;this.states&&0<this.states.length&&(this.registerStates(this.states),a=null!=(k=this.initial)?
k:this.states[0].id,k=this.children.get(a))&&(this.setCurrentState(k),null==(G=this.currentState)?void 0:G._events.onEnter({fromId:"initial"}));Hf(this)}get root(){return this._root}get parent(){return this._parent}get ascendants(){return this.parent?"ascendants"in this.parent?[...this.parent.ascendants,this]:[this.parent,this]:[this]}};gb(zx,"cursor");var Br=class extends zx{constructor(){super(...arguments);gb(this,"isLocked",!1);gb(this,"previous");gb(this,"onEnter",({fromId:a})=>{this.previous=
a;this.cursor&&this.app.cursors.setCursor(this.cursor)});gb(this,"onTransition",a=>{({toId:a}=a);a=this.children.get(a);this.app.cursors.reset();a.cursor?this.app.cursors.setCursor(a.cursor):this.cursor&&this.app.cursors.setCursor(this.cursor)})}get app(){return this.root}},ri=class extends zx{get app(){return this.root}get tool(){return this.parent}},Oz=class extends ri{constructor(){super(...arguments);gb(this,"cursor","crosshair");gb(this,"creatingShape");gb(this,"aspectRatio");gb(this,"initialBounds",
{});gb(this,"onEnter",()=>{const {currentPage:a,inputs:{originPoint:d,currentPoint:k}}=this.app;var {Shape:G}=this.tool;G=new G({id:Ij(),type:G.id,parentId:a.id,point:[...d],fill:this.app.settings.color,stroke:this.app.settings.color,size:Pd.abs(Pd.sub(k,d))});this.initialBounds={minX:d[0],minY:d[1],maxX:d[0]+1,maxY:d[1]+1,width:1,height:1};G.canChangeAspectRatio||(G.aspectRatio?(this.aspectRatio=G.aspectRatio,this.initialBounds.height=this.aspectRatio):(this.aspectRatio=1,this.initialBounds.height=
1),this.initialBounds.width=1,this.initialBounds.maxY=this.initialBounds.minY+this.initialBounds.height);this.creatingShape=G;this.creatingShape.setScaleLevel(this.app.settings.scaleLevel);this.app.currentPage.addShapes(G);this.app.setSelectedShapes([G])});gb(this,"onPointerMove",a=>{if(!a.order){if(!this.creatingShape)throw Error("Expected a creating shape.");var {initialBounds:d}=this,{currentPoint:k,originPoint:G,shiftKey:fa}=this.app.inputs;a=fa||this.creatingShape.props.isAspectRatioLocked||
!this.creatingShape.canChangeAspectRatio;d=cf.getTransformedBoundingBox(d,"bottom_right_corner",Pd.sub(k,G),0,a);this.app.settings.snapToGrid&&!a&&(d=cf.snapBoundsToGrid(d,8));this.creatingShape.update({point:[d.minX,d.minY],size:[d.width,d.height]})}});gb(this,"onPointerUp",()=>{this.tool.transition("idle");this.creatingShape?(this.app.setSelectedShapes([this.creatingShape]),this.app.api.editShape(this.creatingShape)):this.app.transition("select");this.app.persist()});gb(this,"onKeyDown",(a,d)=>
{switch(d.key){case "Escape":if(!this.creatingShape)throw Error("Expected a creating shape.");this.app.deleteShapes([this.creatingShape]);this.tool.transition("idle")}})}};gb(Oz,"id","creating");var Pz=class extends ri{constructor(){super(...arguments);gb(this,"onPointerDown",(a,d)=>{a.order||this.tool.transition("pointing")});gb(this,"onPinchStart",(...a)=>{var d,k;this.app.transition("select",{returnTo:this.app.currentState.id});null==(k=(d=this.app._events).onPinchStart)?void 0:k.call(d,...a)});
gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}})}};gb(Pz,"id","idle");var Qz=class extends ri{constructor(){super(...arguments);gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<qd.dist(a,d)&&!this.app.readOnly&&(this.tool.transition("creating"),this.app.setSelectedShapes(this.app.currentPage.shapes))});gb(this,"onPointerUp",()=>{this.tool.transition("idle")})}};gb(Qz,"id","pointing");var Oq=class extends Br{constructor(){super(...arguments);
gb(this,"cursor","crosshair")}};gb(Oq,"id","box");gb(Oq,"states",[Pz,Qz,Oz]);gb(Oq,"initial","idle");var Rz=class extends ri{constructor(){super(...arguments);gb(this,"shape",{});gb(this,"points",[[0,0,.5]]);gb(this,"persistDebounced",ul(this.app.persist,200));gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});gb(this,"onEnter",()=>{var a;const {Shape:d,previousShape:k}=this.tool;var {originPoint:G}=this.app.inputs;this.app.history.pause();if(this.app.inputs.shiftKey&&
k){this.shape=k;var {shape:fa}=this;var na=fa.props.points[fa.props.points.length-1];const Ha=qd.sub(G,fa.props.point).concat(null!=(a=G[2])?a:.5);this.points=[...fa.props.points,na,na];const Sa=Math.ceil(qd.dist(na,G)/16);for(let Za=0,fb=Za/(Sa-1);Za<Sa;Za++){a=this.points;G=a.push;fa=qd.lrp(na,Ha,fb);var ta=na[2];G.call(a,fa.concat.call(fa,ta+(Ha[2]-ta)*fb))}this.addNextPoint(Ha)}else this.tool.previousShape=void 0,this.points=[[0,0,null!=(na=G[2])?na:.5]],this.shape=new d({id:Ij(),type:d.id,parentId:this.app.currentPage.id,
point:G.slice(0,2),points:this.points,isComplete:!1,fill:this.app.settings.color,stroke:this.app.settings.color}),this.shape.setScaleLevel(this.app.settings.scaleLevel),this.app.currentPage.addShapes(this.shape)});gb(this,"onPointerMove",()=>{const {shape:a}=this,{currentPoint:d,previousPoint:k}=this.app.inputs;qd.isEqual(k,d)||this.addNextPoint(qd.sub(d,a.props.point).concat(d[2]))});gb(this,"onPointerUp",()=>{if(!this.shape)throw Error("Expected a creating shape.");this.app.history.resume();this.shape.update({isComplete:!0,
points:this.tool.simplify?Tj.simplify2(this.points,this.tool.simplifyTolerance):this.shape.props.points});this.tool.previousShape=this.shape;this.tool.transition("idle");let a=this.app.selectedTool.id;"pencil"===a||"highlighter"===a?this.persistDebounced():this.app.persist()});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":if(!this.shape)throw Error("Expected a creating shape.");this.app.deleteShapes([this.shape]);this.tool.transition("idle")}})}addNextPoint(a){const {shape:d}=this,k=qd.min(a,
[0,0]);this.points.push(a);0>k[0]||0>k[1]?(this.points=this.points.map(G=>qd.sub(G,k).concat(G[2])),d.update({point:qd.add(d.props.point,k),points:this.points})):d.update({points:this.points})}};gb(Rz,"id","creating");var Sz=class extends ri{constructor(){super(...arguments);gb(this,"onPointerDown",(a,d)=>{a.order||this.app.readOnly||this.tool.transition("creating")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}})}};
gb(Sz,"id","idle");var Tz=class extends ri{constructor(){super(...arguments);gb(this,"origin",[0,0]);gb(this,"prevDelta",[0,0]);gb(this,"onEnter",a=>{this.prevDelta=a.info.delta;this.origin=a.info.point});gb(this,"onPinch",a=>{this.app.viewport.pinchZoom(a.point,a.delta,a.delta[2])});gb(this,"onPinchEnd",()=>{this.tool.transition("idle")})}};gb(Tz,"id","pinching");var Ju=class extends Br{constructor(){super(...arguments);gb(this,"cursor","crosshair");gb(this,"simplify",!0);gb(this,"simplifyTolerance",
1);gb(this,"previousShape");gb(this,"onPinchStart",(a,d)=>{this.transition("pinching",{info:a,event:d})})}};gb(Ju,"id","draw");gb(Ju,"states",[Sz,Rz,Tz]);gb(Ju,"initial","idle");var Uz=class extends ri{constructor(){super(...arguments);gb(this,"points",[[0,0,.5]]);gb(this,"hitShapes",new Set);gb(this,"onEnter",()=>{const {originPoint:a}=this.app.inputs;this.points=[a];this.hitShapes.clear()});gb(this,"onPointerMove",()=>{const {currentPoint:a,previousPoint:d}=this.app.inputs;qd.isEqual(d,a)||(this.points.push(a),
this.app.shapesInViewport.filter(k=>k.hitTestLineSegment(d,a)).forEach(k=>this.hitShapes.add(k)),this.app.setErasingShapes(Array.from(this.hitShapes.values())))});gb(this,"onPointerUp",()=>{this.app.deleteShapes(Array.from(this.hitShapes.values()));this.tool.transition("idle")});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.setErasingShapes([]),this.tool.transition("idle")}})}};gb(Uz,"id","erasing");var Vz=class extends ri{constructor(){super(...arguments);gb(this,"onPointerDown",
(a,d)=>{a.order||this.tool.transition("pointing")});gb(this,"onPinchStart",(...a)=>{var d,k;this.app.transition("select",{returnTo:this.app.currentState.id});null==(k=(d=this.app._events).onPinchStart)?void 0:k.call(d,...a)});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}})}};gb(Vz,"id","idle");var Wz=class extends ri{constructor(){super(...arguments);gb(this,"onEnter",()=>{const {currentPoint:a}=this.app.inputs;this.app.setErasingShapes(this.app.shapesInViewport.filter(d=>
d.hitTestPoint(a)))});gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<qd.dist(a,d)&&(this.tool.transition("erasing"),this.app.setSelectedShapes([]))});gb(this,"onPointerUp",()=>{const a=[...this.app.erasingShapes];this.app.setErasingShapes([]);this.app.deleteShapes(a);this.tool.transition("idle")})}};gb(Wz,"id","pointing");var Xv=class extends Br{constructor(){super(...arguments);gb(this,"cursor","crosshair")}};gb(Xv,"id","erase");gb(Xv,"states",[Vz,Wz,Uz]);gb(Xv,
"initial","idle");var Ax=class extends ri{constructor(){super(...arguments);gb(this,"handle",{});gb(this,"handleId","end");gb(this,"currentShape",{});gb(this,"initialShape",{});gb(this,"bindableShapeIds",[]);gb(this,"startBindingShapeId");gb(this,"newStartBindingId","");gb(this,"draggedBindingId","");gb(this,"onPointerMove",()=>{const {inputs:{shiftKey:a,previousPoint:d,originPoint:k,currentPoint:G,modKey:fa,altKey:na},settings:{snapToGrid:ta}}=this.app;var Ha=this.app.getShapeById(this.initialShape.id),
{handles:Sa}=this.initialShape,Za=this.handleId,fb="start"===this.handleId?"end":"start";if(!Pd.isEqual(d,G)){var ib=Pd.sub(G,k);if(a){var Bb=Sa[fb].point,Ob=Pd.add(Sa[Za].point,ib),Fb=Pd.angle(Bb,Ob);Bb=Pd.rotWith(Ob,Bb,Wl.snapAngleToSegments(Fb,24)-Fb);ib=Pd.add(ib,Pd.sub(Bb,Ob))}ib=Pd.add(Sa[Za].point,ib);Sa={[Za]:Re(Ud({},Sa[Za]),{point:ta?Pd.snap(ib,8):Pd.toFixed(ib),bindingId:void 0})};var cc=this.currentShape.getHandlesChange(this.initialShape,Sa);if(cc){Sa=xj(Ha.props,cc);var oc={},Xb;Za=
Sa.handles[Za];fb=Sa.handles[fb];if(this.startBindingShapeId){var hc;if(ib=this.app.getShapeById(this.startBindingShapeId)){Ob=ib.getCenter();Bb=Sa.handles.end;var ec=Pd.add(Sa.handles.start.point,Sa.point);Pd.isEqual(ec,Ob)&&ec[1]++;Fb=ib.hitTestPoint(G);ec=Pd.uni(Pd.sub(ec,Ob));const Ec=void 0!==this.app.currentPage.bindings[this.newStartBindingId];fa||ib.hitTestPoint(Pd.add(Sa.point,Bb.point))||(hc=ic(Ha.props,ib,"start",this.newStartBindingId,Ob,Ob,ec,Fb));hc&&!Ec?(oc[this.newStartBindingId]=
hc,Sa.handles.start.bindingId=hc.id):!hc&&Ec&&(console.log("removing start binding"),delete oc[this.newStartBindingId],Sa.handles.start.bindingId=void 0)}}if(!fa){hc=Pd.add(fb.point,Sa.point);fb=Pd.add(Za.point,Sa.point);Za=Pd.uni(Pd.sub(fb,hc));const Ec=Pd.add(Sa.point,Sa.handles.start.point),Ic=Pd.add(Sa.point,Sa.handles.end.point);ib=this.bindableShapeIds.map(nd=>this.app.getShapeById(nd)).sort((nd,Bd)=>Bd.nonce-nd.nonce).filter(nd=>![Ec,Ic].every(Bd=>nd.hitTestPoint(Bd)));for(const nd of ib)if(Xb=
ic(Ha.props,nd,this.handleId,this.draggedBindingId,fb,hc,Za,na))break}Xb?(oc[this.draggedBindingId]=Xb,Sa=xj(Sa,{handles:{[this.handleId]:{bindingId:this.draggedBindingId}}})):(Ha=Ha.props.handles[this.handleId].bindingId,void 0!==Ha&&(delete oc[Ha],Sa=xj(Sa,{handles:{[this.handleId]:{bindingId:void 0}}})));cc=this.currentShape.getHandlesChange(Sa,Sa.handles);ed(()=>{var Ec;if(cc){this.currentShape.update(cc);this.app.currentPage.updateBindings(oc);const Ic=Object.values(null!=(Ec=cc.handles)?Ec:
{}).map(nd=>nd.bindingId).map(nd=>this.app.currentPage.bindings[nd]).filter(Boolean).flatMap(nd=>[nd.toId,nd.fromId].filter(Boolean));this.app.setBindingShapes(Ic)}})}}});gb(this,"onPointerUp",()=>{this.tool.transition("idle");this.currentShape&&this.app.setSelectedShapes([this.currentShape]);this.app.transition("select");this.app.persist()});gb(this,"onExit",()=>{this.app.clearBindingShape();this.app.history.resume();this.app.persist()});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.deleteShapes([this.currentShape]),
this.tool.transition("idle")}})}};gb(Ax,"id","creating");var Xz=class extends Ax{constructor(){super(...arguments);gb(this,"onEnter",()=>{var a;this.app.history.pause();this.newStartBindingId=Ij();this.draggedBindingId=Ij();this.bindableShapeIds=this.app.currentPage.getBindableShapes();var {Shape:d}=this.tool;const {originPoint:k}=this.app.inputs;d=new d(Re(Ud({},d.defaultProps),{id:Ij(),type:d.id,parentId:this.app.currentPage.id,point:this.app.settings.snapToGrid?Pd.snap(k,8):k,fill:this.app.settings.color,
stroke:this.app.settings.color,scaleLevel:this.app.settings.scaleLevel}));this.initialShape=yc(d.props);this.currentShape=d;this.app.currentPage.addShapes(d);this.app.setSelectedShapes([d]);if(this.startBindingShapeId=null==(a=this.bindableShapeIds.map(G=>this.app.getShapeById(G)).filter(G=>Tj.pointInBounds(k,G.bounds))[0])?void 0:a.id)this.bindableShapeIds.splice(this.bindableShapeIds.indexOf(this.startBindingShapeId),1),this.app.setBindingShapes([this.startBindingShapeId])})}};gb(Xz,"id","creating");
var Yz=class extends ri{constructor(){super(...arguments);gb(this,"onPointerDown",(a,d)=>{a.order||this.tool.transition("pointing")});gb(this,"onPinchStart",(...a)=>{var d,k;this.app.transition("select",{returnTo:this.app.currentState.id});null==(k=(d=this.app._events).onPinchStart)?void 0:k.call(d,...a)});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}});gb(this,"onPointerEnter",a=>{if(!a.order)switch(a.type){case "shape":this.app.setHoveredShape(a.shape.id);
break;case "selection":"background"!==a.handle&&"center"!==a.handle&&this.tool.transition("hoveringSelectionHandle",a)}});gb(this,"onPointerLeave",a=>{a.order||"shape"===a.type&&this.app.hoveredId&&this.app.setHoveredShape(void 0)})}};gb(Yz,"id","idle");var Zz=class extends ri{constructor(){super(...arguments);gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<qd.dist(a,d)&&!this.app.readOnly&&(this.tool.transition("creating"),this.app.setSelectedShapes(this.app.currentPage.shapes))})}};
gb(Zz,"id","pointing");var Yv=class extends Br{constructor(){super(...arguments);gb(this,"cursor","crosshair")}};gb(Yv,"id","line");gb(Yv,"states",[Yz,Zz,Xz]);gb(Yv,"initial","idle");var $z=class extends ri{constructor(){super(...arguments);gb(this,"cursor","crosshair");gb(this,"creatingShape");gb(this,"aspectRatio");gb(this,"initialBounds",{});gb(this,"onEnter",()=>{const {currentPage:a,inputs:{originPoint:d}}=this.app,{Shape:k}=this.tool,G=new k({id:Ij(),type:k.id,parentId:a.id,point:[...d],text:"",
size:[16,32],isSizeLocked:!0,fill:this.app.settings.color,stroke:this.app.settings.color});this.creatingShape=G;this.creatingShape.setScaleLevel(this.app.settings.scaleLevel);ed(()=>{this.app.currentPage.addShapes(G);const fa=this.app.settings.snapToGrid?Pd.snap([...d],8):d,{bounds:na}=G;G.update({point:Pd.sub(fa,[na.width/2,na.height/2])});this.app.transition("select");this.app.setSelectedShapes([G]);this.app.currentState.transition("editingShape",{type:"shape",shape:this.creatingShape,order:0})})})}};
gb($z,"id","creating");var aA=class extends ri{constructor(){super(...arguments);gb(this,"onPointerDown",(a,d)=>{a.order||this.app.readOnly||this.tool.transition("creating")});gb(this,"onPinchStart",(...a)=>{var d,k;this.app.transition("select",{returnTo:this.app.currentState.id});null==(k=(d=this.app._events).onPinchStart)?void 0:k.call(d,...a)});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}})}};gb(aA,"id","idle");var Zv=class extends Br{constructor(){super(...arguments);
gb(this,"cursor","crosshair")}};gb(Zv,"id","box");gb(Zv,"states",[aA,$z]);gb(Zv,"initial","idle");var vE=$e(bm()),wE=class extends vE.default{constructor(){super(...arguments);gb(this,"toBBox",a=>a.rotatedBounds)}},bA=class extends ri{constructor(){super(...arguments);gb(this,"initialSelectedIds",[]);gb(this,"initialSelectedShapes",[]);gb(this,"tree",new wE);gb(this,"onEnter",()=>{const {selectedShapes:a,currentPage:d,selectedIds:k}=this.app;this.initialSelectedIds=Array.from(k.values());this.initialSelectedShapes=
Array.from(a.values());this.tree.load(d.shapes)});gb(this,"onExit",()=>{this.initialSelectedIds=[];this.tree.clear();this.app.setBrush(void 0)});gb(this,"onPointerMove",()=>{const {inputs:{shiftKey:a,ctrlKey:d,originPoint:k,currentPoint:G}}=this.app,fa=cf.getBoundsFromPoints([G,k],0);this.app.setBrush(fa);const na=[...(new Set(this.tree.search(fa).filter(ta=>d?cf.boundsContain(fa,ta.rotatedBounds):ta.hitTestBounds(fa)).filter(ta=>"group"!==ta.type).map(ta=>{var Ha;return null!=(Ha=this.app.getParentGroup(ta))?
Ha:ta})))];a?na.every(ta=>this.initialSelectedShapes.includes(ta))?this.app.setSelectedShapes(this.initialSelectedShapes.filter(ta=>!na.includes(ta))):this.app.setSelectedShapes([...(new Set([...this.initialSelectedShapes,...na]))]):this.app.setSelectedShapes(na);this.app.viewport.panToPointWhenNearBounds(G)});gb(this,"onPointerUp",()=>{this.app.setBrush(void 0);this.tool.transition("idle")});gb(this,"handleModifierKey",(a,d)=>{switch(d.key){case "Escape":this.app.setBrush(void 0),this.app.setSelectedShapes(this.initialSelectedIds),
this.tool.transition("idle")}})}};gb(bA,"id","brushing");var cA=class extends ri{constructor(){super(...arguments);gb(this,"onEnter",a=>{var d;const {selectedIds:k,inputs:{shiftKey:G}}=this.app;if("shape"===a.type&&!k.has(a.shape.id)){const fa=null!=(d=this.app.getParentGroup(a.shape))?d:a.shape;G?this.app.setSelectedShapes([...Array.from(k.values()),fa.id]):this.app.setSelectedShapes([fa])}});gb(this,"onPointerDown",()=>{this.tool.transition("idle")})}};gb(cA,"id","contextMenu");var dA=class extends ri{constructor(){super(...arguments);
gb(this,"onEnter",a=>{"pinching"===a.fromId&&this.parent.returnTo&&this.app.transition(this.parent.returnTo)});gb(this,"onExit",()=>{});gb(this,"onPointerEnter",a=>{if(!a.order)switch(a.type){case "shape":this.app.setHoveredShape(a.shape.id);break;case "selection":"background"!==a.handle&&"center"!==a.handle&&this.tool.transition("hoveringSelectionHandle",a);break;case "canvas":this.app.setHoveredShape(void 0)}});gb(this,"onPointerDown",(a,d)=>{const {selectedShapes:k,inputs:{ctrlKey:G}}=this.app;
if(2===d.button)this.tool.transition("contextMenu",a);else if(G)this.tool.transition("pointingCanvas");else switch(a.type){case "selection":switch(a.handle){case "center":break;case "background":this.tool.transition("pointingBoundsBackground");break;case "rotate":this.tool.transition("pointingRotateHandle");break;default:this.tool.transition("pointingResizeHandle",a)}break;case "shape":if(k.has(a.shape))this.tool.transition("pointingSelectedShape",a);else{const {selectionBounds:fa,inputs:na}=this.app;
fa&&Tj.pointInBounds(na.currentPoint,fa)?this.tool.transition("pointingShapeBehindBounds",a):this.tool.transition("pointingShape",a)}break;case "handle":this.tool.transition("pointingHandle",a);break;case "canvas":this.tool.transition("pointingCanvas");break;case "minimap":this.tool.transition("pointingMinimap",Ud(Ud({},d),a))}});gb(this,"onPointerLeave",a=>{a.order||"shape"===a.type&&this.app.hoveredId&&this.app.setHoveredShape(void 0)});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",
{info:a,event:d})});gb(this,"onDoubleClick",a=>{if(!a.order&&1===this.app.selectedShapesArray.length&&!this.app.readOnly){var d=this.app.selectedShapesArray[0];if(d.canEdit&&!d.props.isLocked)switch(a.type){case "shape":this.tool.transition("editingShape",a);break;case "selection":1===this.app.selectedShapesArray.length&&this.tool.transition("editingShape",{type:"shape",target:d})}}});gb(this,"onKeyDown",(a,d)=>{({selectedShapesArray:a}=this.app);switch(d.key){case "Enter":1===a.length&&a[0].canEdit&&
!this.app.readOnly&&this.tool.transition("editingShape",{type:"shape",shape:a[0],order:0});break;case "Escape":a.length&&this.app.setSelectedShapes([])}})}};gb(dA,"id","idle");var eA=class extends ri{constructor(){super(...arguments);gb(this,"onEnter",a=>{var d;const {selectedIds:k,inputs:{shiftKey:G}}=this.app,fa=null!=(d=this.app.getParentGroup(a.shape))?d:a.shape;G?this.app.setSelectedShapes([...Array.from(k.values()),fa.id]):this.app.setSelectedShapes([fa])});gb(this,"onPointerMove",()=>{const {currentPoint:a,
originPoint:d}=this.app.inputs;5<qd.dist(a,d)&&!this.app.readOnly&&this.tool.transition("translating")});gb(this,"onPointerUp",()=>{this.tool.transition("idle")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};gb(eA,"id","pointingShape");var fA=class extends ri{constructor(){super(...arguments);gb(this,"cursor","move");gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<qd.dist(a,d)&&!this.app.readOnly&&this.tool.transition("translating")});
gb(this,"onPointerUp",()=>{this.app.setSelectedShapes([]);this.tool.transition("idle")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};gb(fA,"id","pointingBoundsBackground");var gA=class extends ri{constructor(){super(...arguments);gb(this,"onEnter",()=>{var a;const {shiftKey:d}=this.app.inputs;d||(this.app.setSelectedShapes([]),this.app.setEditingShape(),null==(a=window.getSelection())?void 0:a.removeAllRanges())});gb(this,"onPointerMove",()=>{const {currentPoint:a,
originPoint:d}=this.app.inputs;5<qd.dist(a,d)&&this.tool.transition("brushing")});gb(this,"onPointerUp",()=>{this.app.inputs.shiftKey||this.app.setSelectedShapes([]);this.tool.transition("idle")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});gb(this,"onDoubleClick",()=>{this.app.notify("canvas-dbclick",{point:this.app.inputs.originPoint})})}};gb(gA,"id","pointingCanvas");var hA=class extends ri{constructor(){super(...arguments);gb(this,"cursor","move");gb(this,
"isCloning",!1);gb(this,"didClone",!1);gb(this,"initialPoints",{});gb(this,"initialShapePoints",{});gb(this,"initialClonePoints",{});gb(this,"clones",[]);gb(this,"onEnter",()=>{var a;this.app.history.pause();const {allSelectedShapesArray:d,inputs:k}=this.app;this.initialPoints=this.initialShapePoints=Object.fromEntries(d.map(({id:G,props:{point:fa}})=>[G,fa.slice()]));document.querySelectorAll("input,textarea").forEach(G=>G.blur());null==(a=document.getSelection())?void 0:a.empty();k.altKey?this.startCloning():
this.moveSelectedShapesToPointer()});gb(this,"onExit",()=>{this.app.history.resume();this.isCloning=this.didClone=!1;this.clones=[];this.initialPoints={};this.initialShapePoints={};this.initialClonePoints={}});gb(this,"onPointerMove",()=>{const {inputs:{currentPoint:a}}=this.app;this.moveSelectedShapesToPointer();this.app.viewport.panToPointWhenNearBounds(a)});gb(this,"onPointerDown",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});gb(this,"onPointerUp",()=>{this.app.history.resume();
this.app.persist();this.tool.transition("idle")});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Alt":this.startCloning();break;case "Escape":this.app.allSelectedShapes.forEach(k=>{k.update({point:this.initialPoints[k.id]})}),this.tool.transition("idle")}});gb(this,"onKeyUp",(a,d)=>{switch(d.key){case "Alt":if(!this.isCloning)throw Error("Expected to be cloning.");const {currentPage:k,allSelectedShapes:G}=this.app;k.removeShapes(...G);this.initialPoints=this.initialShapePoints;this.app.setSelectedShapes(Object.keys(this.initialPoints));
this.moveSelectedShapesToPointer();this.isCloning=!1}})}moveSelectedShapesToPointer(){const {inputs:{shiftKey:a,originPoint:d,currentPoint:k}}=this.app,{initialPoints:G}=this,fa=qd.sub(k,d);a&&(Math.abs(fa[0])<Math.abs(fa[1])?fa[0]=0:fa[1]=0);ed(()=>{this.app.allSelectedShapesArray.filter(na=>!na.props.isLocked).forEach(na=>{let ta=qd.add(G[na.id],fa);this.app.settings.snapToGrid&&(ta=qd.snap(ta,8));na.update({point:ta})})})}startCloning(){this.didClone||(this.clones=this.app.allSelectedShapesArray.map(a=>
{const d=this.app.getShapeClass(a.type);if(!d)throw Error("Could not find that shape class.");return new d(Re(Ud({},a.serialized),{id:Ij(),type:a.type,point:this.initialPoints[a.id],rotation:a.props.rotation,isLocked:!1}))}),this.initialClonePoints=Object.fromEntries(this.clones.map(({id:a,props:{point:d}})=>[a,d.slice()])),this.didClone=!0);this.app.allSelectedShapes.forEach(a=>{a.update({point:this.initialPoints[a.id]})});this.initialPoints=this.initialClonePoints;this.app.currentPage.addShapes(...this.clones);
this.app.setSelectedShapes(Object.keys(this.initialClonePoints));this.moveSelectedShapesToPointer();this.isCloning=!0}};gb(hA,"id","translating");var iA=class extends ri{constructor(){super(...arguments);gb(this,"pointedSelectedShape");gb(this,"onEnter",a=>{this.pointedSelectedShape=a.shape});gb(this,"onExit",()=>{this.pointedSelectedShape=void 0});gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<qd.dist(a,d)&&!this.app.readOnly&&this.tool.transition("translating")});
gb(this,"onPointerUp",()=>{const {shiftKey:a,currentPoint:d}=this.app.inputs;var {selectedShapesArray:k}=this.app;if(!this.pointedSelectedShape)throw Error("Expected a pointed selected shape");if(a)({selectedIds:k}=this.app),k=Array.from(k.values()),k.splice(k.indexOf(this.pointedSelectedShape.id),1),this.app.setSelectedShapes(k);else{if(1===k.length&&this.pointedSelectedShape.canEdit&&!this.app.readOnly&&!this.pointedSelectedShape.props.isLocked&&this.pointedSelectedShape instanceof vn&&Tj.pointInBounds(d,
this.pointedSelectedShape.bounds)){this.tool.transition("editingShape",{shape:this.pointedSelectedShape,order:0,type:"shape"});return}this.app.setSelectedShapes([this.pointedSelectedShape.id])}this.tool.transition("idle")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};gb(iA,"id","pointingSelectedShape");var jA=class extends ri{constructor(){super(...arguments);gb(this,"info",{});gb(this,"onEnter",a=>{this.info=a;this.updateCursor()});gb(this,"onExit",()=>{this.app.cursors.reset()});
gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<qd.dist(a,d)&&this.tool.transition("resizing",this.info)});gb(this,"onPointerUp",()=>{this.tool.transition("hoveringSelectionHandle",this.info)});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}updateCursor(){this.app.cursors.setCursor(lt[this.info.handle],this.app.selectionBounds.rotation)}};gb(jA,"id","pointingResizeHandle");var kA=class extends ri{constructor(){super(...arguments);
gb(this,"isSingle",!1);gb(this,"handle","bottom_right_corner");gb(this,"snapshots",{});gb(this,"initialCommonBounds",{});gb(this,"selectionRotation",0);gb(this,"resizeType","corner");gb(this,"onEnter",a=>{var d,k;const {history:G,selectedShapesArray:fa,selectionBounds:na}=this.app;if(!na)throw Error("Expected a selected bounds.");this.handle=a.handle;this.resizeType="left_edge"===a.handle||"right_edge"===a.handle?"horizontal-edge":"top_edge"===a.handle||"bottom_edge"===a.handle?"vertical-edge":"corner";
this.app.cursors.setCursor(kA.CURSORS[a.handle],null==(d=this.app.selectionBounds)?void 0:d.rotation);G.pause();const ta=cf.getBoundsFromPoints(fa.map(Ha=>cf.getBoundsCenter(Ha.bounds)));this.selectionRotation=(this.isSingle=1===fa.length)?null!=(k=fa[0].props.rotation)?k:0:0;this.initialCommonBounds=Ud({},na);this.snapshots=Object.fromEntries(fa.map(Ha=>{const Sa=Ud({},Ha.bounds),[Za,fb]=cf.getBoundsCenter(Sa);return[Ha.id,{props:Ha.serialized,bounds:Sa,transformOrigin:[(Za-this.initialCommonBounds.minX)/
this.initialCommonBounds.width,(fb-this.initialCommonBounds.minY)/this.initialCommonBounds.height],innerTransformOrigin:[(Za-ta.minX)/ta.width,(fb-ta.minY)/ta.height],isAspectRatioLocked:Ha.props.isAspectRatioLocked||!(Ha.canChangeAspectRatio&&!Ha.props.rotation)}]}));fa.forEach(Ha=>{var Sa;null==(Sa=Ha.onResizeStart)?void 0:Sa.call(Ha,{isSingle:this.isSingle})})});gb(this,"onExit",()=>{this.app.cursors.reset();this.snapshots={};this.initialCommonBounds={};this.selectionRotation=0;this.app.history.resume()});
gb(this,"onPointerMove",()=>{const {inputs:{altKey:a,shiftKey:d,ctrlKey:k,originPoint:G,currentPoint:fa}}=this.app,{handle:na,snapshots:ta,initialCommonBounds:Ha}=this;let Sa=qd.sub(fa,G);a&&(Sa=qd.mul(Sa,2));const Za=this.app.selectedShapes.values().next().value;let fb=cf.getTransformedBoundingBox(Ha,na,Sa,this.selectionRotation,d||this.isSingle&&(k?!("clipping"in Za.props):!Za.canChangeAspectRatio||Za.props.isAspectRatioLocked));a&&(fb=Ud(Ud({},fb),cf.centerBounds(fb,cf.getBoundsCenter(Ha))));const {scaleX:ib,
scaleY:Bb}=fb;this.app.selectedShapes.forEach(Ob=>{var Fb,cc;const {isAspectRatioLocked:oc,props:Xb,bounds:hc,transformOrigin:ec}=ta[Ob.id];let Ec=cf.getRelativeTransformedBoundingBox(fb,Ha,hc,0>ib,0>Bb);if(Ob.canResize.some(Bd=>Bd)||Ob.props.isSizeLocked||!this.isSingle){var Ic=[ib,Bb],nd=null!=(Fb=Xb.rotation)?Fb:0;Fb=cf.getBoundsCenter(Ec);Ob.canFlip||(Ic=qd.abs(Ic));Ob.canScale||(Ic=null!=(cc=Xb.scale)?cc:[1,1]);if(nd&&0>ib&&0<=Bb||0>Bb&&0<=ib)nd*=-1;this.app.settings.snapToGrid&&!oc&&(Ec=cf.snapBoundsToGrid(Ec,
8));Ob.onResize(Xb,{center:Fb,rotation:nd,scale:Ic,bounds:Ec,type:na,clip:k,transformOrigin:ec})}});this.updateCursor(ib,Bb);this.app.viewport.panToPointWhenNearBounds(fa)});gb(this,"onPointerUp",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.selectedShapes.forEach(k=>{k.update(Ud({},this.snapshots[k.id].props))}),this.tool.transition("idle")}})}updateCursor(a,d){var k,G,fa,na;const ta=0>a&&0<=d;a=0>
d&&0<=a;switch(this.handle){case "top_left_corner":case "bottom_right_corner":ta||a?"nwse-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nesw-resize",null==(k=this.app.selectionBounds)?void 0:k.rotation):"nesw-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nwse-resize",null==(G=this.app.selectionBounds)?void 0:G.rotation);break;case "top_right_corner":case "bottom_left_corner":ta||a?"nesw-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nwse-resize",null==
(fa=this.app.selectionBounds)?void 0:fa.rotation):"nwse-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nesw-resize",null==(na=this.app.selectionBounds)?void 0:na.rotation)}}},Bx=kA;gb(Bx,"id","resizing");gb(Bx,"CURSORS",{bottom_edge:"ns-resize",top_edge:"ns-resize",left_edge:"ew-resize",right_edge:"ew-resize",bottom_left_corner:"nesw-resize",bottom_right_corner:"nwse-resize",top_left_corner:"nwse-resize",top_right_corner:"nesw-resize"});var lA=class extends ri{constructor(){super(...arguments);
gb(this,"cursor","rotate");gb(this,"handle","");gb(this,"onEnter",a=>{this.app.history.pause();this.handle=a.handle;this.updateCursor()});gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<qd.dist(a,d)&&this.tool.transition("rotating",{handle:this.handle})});gb(this,"onPointerUp",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}updateCursor(){this.app.cursors.setCursor(lt[this.handle],
this.app.selectionRotation)}};gb(lA,"id","pointingRotateHandle");var mA=class extends ri{constructor(){super(...arguments);gb(this,"info",{});gb(this,"onEnter",a=>{this.info=a});gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<qd.dist(a,d)&&!this.app.readOnly&&this.tool.transition("translating")});gb(this,"onPointerUp",()=>{const {selectedIds:a,inputs:{shiftKey:d}}=this.app;d?this.app.setSelectedShapes([...Array.from(a.values()),this.info.shape.id]):this.app.setSelectedShapes([this.info.shape.id]);
this.tool.transition("idle")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};gb(mA,"id","pointingShapeBehindBounds");var Cx=class extends ri{constructor(){super(...arguments);gb(this,"cursor","rotate");gb(this,"snapshot",{});gb(this,"initialCommonCenter",[0,0]);gb(this,"initialCommonBounds",{});gb(this,"initialAngle",0);gb(this,"initialSelectionRotation",0);gb(this,"handle","");gb(this,"onEnter",a=>{const {history:d,selectedShapesArray:k,selectionBounds:G}=this.app;
if(!G)throw Error("Expected selected bounds.");d.pause();this.handle=a.handle;this.initialSelectionRotation=this.app.selectionRotation;this.initialCommonBounds=Ud({},G);this.initialCommonCenter=cf.getBoundsCenter(G);this.initialAngle=qd.angle(this.initialCommonCenter,this.app.inputs.currentPoint);this.snapshot=Object.fromEntries(k.map(fa=>[fa.id,{point:[...fa.props.point],center:[...fa.center],rotation:fa.props.rotation,handles:"handles"in fa?Js(fa.handles):void 0}]));this.updateCursor()});gb(this,
"onExit",()=>{this.app.history.resume();this.snapshot={}});gb(this,"onPointerMove",()=>{const {selectedShapes:a,inputs:{shiftKey:d,currentPoint:k}}=this.app,{snapshot:G,initialCommonCenter:fa,initialAngle:na,initialSelectionRotation:ta}=this;let Ha=qd.angle(fa,k)-na;d&&(Ha=Wl.snapAngleToSegments(Ha,24));a.forEach(Za=>{var fb=G[Za.id];let ib=0;if(d){var {rotation:Bb=0}=fb;ib=Wl.snapAngleToSegments(Bb,24)-Bb}const Ob=qd.sub(fb.center,fb.point);Bb=qd.rotWith(fb.center,fa,Ha);if("handles"in Za){fb=fb.handles;
const Fb=fb.map(oc=>qd.rotWith(oc.point,Ob,Ha)),cc=cf.getCommonTopLeft(Fb);Za.update({point:qd.add(cc,qd.sub(Bb,Ob)),handles:fb.map((oc,Xb)=>Re(Ud({},oc),{point:qd.sub(Fb[Xb],cc)}))})}else Za.update({point:qd.sub(Bb,Ob),rotation:Wl.clampRadians((fb.rotation||0)+Ha+ib)})});const Sa=Wl.clampRadians(ta+Ha);this.app.setSelectionRotation(d?Wl.snapAngleToSegments(Sa,24):Sa);this.updateCursor()});gb(this,"onPointerUp",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});gb(this,
"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.selectedShapes.forEach(k=>{k.update(this.snapshot[k.id])}),this.tool.transition("idle")}})}updateCursor(){this.app.cursors.setCursor(lt[this.handle],this.app.selectionRotation)}};gb(Cx,"id","rotating");var nA=class extends ri{constructor(){super(...arguments);gb(this,"onPinch",(a,d)=>{this.app.viewport.pinchZoom(a.point,a.delta,a.delta[2])});gb(this,"onPinchEnd",()=>{this.tool.transition("idle")});gb(this,"onPointerDown",()=>{this.tool.transition("idle")})}};
gb(nA,"id","pinching");var oA=class extends Ax{constructor(){super(...arguments);gb(this,"cursor","grabbing");gb(this,"onEnter",a=>{this.app.history.pause();this.newStartBindingId=Ij();this.draggedBindingId=Ij();this.bindableShapeIds=this.app.currentPage.getBindableShapes();this.handleId=a.id;this.currentShape=a.shape;this.initialShape=yc(this.currentShape.props);this.app.setSelectedShapes([this.currentShape])})}};gb(oA,"id","translatingHandle");var pA=class extends ri{constructor(){super(...arguments);
gb(this,"cursor","grabbing");gb(this,"info",{});gb(this,"onEnter",a=>{this.info=a});gb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<qd.dist(a,d)&&this.tool.transition("translatingHandle",this.info)});gb(this,"onPointerUp",()=>{this.tool.transition("idle")});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};gb(pA,"id","pointingHandle");var qA=class extends ri{constructor(){super(...arguments);gb(this,"handle");gb(this,"onEnter",
a=>{var d;this.app.cursors.setCursor(lt[a.handle],null!=(d=this.app.selectionBounds.rotation)?d:0);this.handle=a.handle});gb(this,"onExit",()=>{this.app.cursors.reset()});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});gb(this,"onPointerDown",a=>{switch(a.type){case "selection":switch(a.handle){case "center":break;case "background":break;case "top_left_resize_corner":case "top_right_resize_corner":case "bottom_right_resize_corner":case "bottom_left_resize_corner":this.tool.transition("pointingRotateHandle",
a);break;default:this.tool.transition("pointingResizeHandle",a)}}});gb(this,"onPointerLeave",()=>{this.tool.transition("idle")});gb(this,"onDoubleClick",a=>{var d;if(!a.order&&1===this.app.selectedShapes.size){var k=this.app.selectedShapes.values().next().value;if(!k.canEdit||this.app.readOnly||k.props.isLocked)k.onResetBounds({asset:k.props.assetId?this.app.assets[k.props.assetId]:void 0,zoom:this.app.viewport.camera.zoom}),this.tool.transition("idle");else switch(a.type){case "shape":this.tool.transition("editingShape",
a);break;case "selection":null==(d=k.onResetBounds)?void 0:d.call(k,{zoom:this.app.viewport.camera.zoom}),1===this.app.selectedShapesArray.length&&this.tool.transition("editingShape",{type:"shape",target:k})}}})}};gb(qA,"id","hoveringSelectionHandle");var rA=class extends ri{constructor(){super(...arguments);gb(this,"editingShape",{});gb(this,"onEnter",a=>{this.editingShape=a.shape;this.app.setEditingShape(a.shape)});gb(this,"onExit",()=>{var a;if(this.editingShape&&"text"in this.editingShape.props){const d=
this.editingShape.props.text.trim();""===d&&"text"===this.editingShape.props.type?this.app.deleteShapes([this.editingShape]):(this.editingShape.onResetBounds(),this.editingShape.update({text:d}))}this.app.persist();this.app.setEditingShape();null==(a=document.querySelector(".tl-canvas"))?void 0:a.focus()});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});gb(this,"onPointerDown",a=>{switch(a.type){case "shape":if(a.shape===this.editingShape)break;this.tool.transition("idle",
a);break;case "canvas":a.order||this.tool.transition("idle",a)}});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":ed(()=>{d.stopPropagation();this.app.setSelectedShapes([this.editingShape]);this.tool.transition("idle")})}})}};gb(rA,"id","editingShape");var sA=class extends ri{constructor(){super(...arguments);gb(this,"minimapZoom",1);gb(this,"minimapRect",{minX:0,minY:0,maxX:0,maxY:0,width:0,height:0});gb(this,"getCameraPoint",a=>{const d=document.querySelector(".tl-preview-minimap svg");
var k=document.querySelector(".tl-preview-minimap #minimap-camera-rect");if(d&&k){const G=d.getBoundingClientRect();this.minimapRect.height=G.height;this.minimapRect.width=G.width;this.minimapRect.minX=G.left;this.minimapRect.minY=G.top;this.minimapRect.maxX=G.right;this.minimapRect.maxY=G.bottom;this.minimapZoom=+d.dataset.commonBoundWidth/this.minimapRect.width;a=qd.sub(a,[this.minimapRect.minX,this.minimapRect.minY]);k=k.getBoundingClientRect();k=qd.mul(qd.sub(a,[k.left+k.width/2,k.top+k.height/
2]),this.minimapZoom);return qd.sub(this.app.viewport.camera.point,k)}});gb(this,"onEnter",a=>{(a=this.getCameraPoint([a.clientX,a.clientY]))?this.app.viewport.update({point:a}):this.tool.transition("idle")});gb(this,"onPointerMove",(a,d)=>{"clientX"in d&&(a=this.getCameraPoint([d.clientX,d.clientY]))&&this.app.viewport.update({point:a})});gb(this,"onPointerUp",()=>{this.tool.transition("idle")})}};gb(sA,"id","pointingMinimap");var Et=class extends Br{constructor(){super(...arguments);gb(this,"returnTo",
"");gb(this,"onEnter",a=>{this.returnTo=null==a?void 0:a.returnTo})}};gb(Et,"id","select");gb(Et,"initial","idle");gb(Et,"shortcut","whiteboard/select");gb(Et,"states",[dA,bA,cA,gA,eA,mA,iA,fA,qA,jA,lA,sA,pA,oA,hA,Bx,Cx,Cx,nA,rA]);var tA=class extends ri{constructor(){super(...arguments);gb(this,"cursor","grabbing");gb(this,"originalScreenPoint",[]);gb(this,"originalCameraPoint",[]);gb(this,"prevState","idle");gb(this,"onEnter",a=>{this.prevState=null==a?void 0:a.prevState;this.originalScreenPoint=
this.app.inputs.currentScreenPoint;this.originalCameraPoint=this.app.viewport.camera.point});gb(this,"onPointerMove",(a,d)=>{a=Pd.sub(this.originalScreenPoint,this.app.inputs.currentScreenPoint);this.app.viewport.update({point:Pd.sub(this.originalCameraPoint,Pd.div(a,this.app.viewport.camera.zoom))})});gb(this,"onPointerUp",()=>{var a;this.tool.transition(null!=(a=this.prevState)?a:"idle")})}};gb(tA,"id","panning");var uA=class extends ri{constructor(){super(...arguments);gb(this,"onEnter",a=>{this.parent.prevTool&&
a.exit&&(this.app.setCurrentState(this.parent.prevTool),setTimeout(()=>{this.app.cursors.reset();this.app.cursors.setCursor(this.parent.prevTool.cursor)}))});gb(this,"onPointerDown",(a,d)=>{a.order||this.tool.transition("panning")})}};gb(uA,"id","idle");var vA=class extends ri{constructor(){super(...arguments);gb(this,"onPointerDown",(a,d)=>{a.order||this.tool.transition("panning",{prevState:"idleHold"})});gb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};gb(vA,
"id","idleHold");var wA=class extends ri{constructor(){super(...arguments);gb(this,"origin",[0,0]);gb(this,"prevDelta",[0,0]);gb(this,"onEnter",a=>{this.prevDelta=a.info.delta;this.origin=a.info.point});gb(this,"onPinch",a=>{this.app.viewport.pinchZoom(a.point,a.delta,a.delta[2])});gb(this,"onPinchEnd",()=>{this.tool.transition("idle")})}};gb(wA,"id","pinching");var Ft=class extends Br{constructor(){super(...arguments);gb(this,"cursor","grab");gb(this,"prevTool",null);gb(this,"onEnter",a=>{this.prevTool=
null==a?void 0:a.prevTool});gb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}});gb(this,"onPinchStart",(a,d)=>{this.transition("pinching",{info:a,event:d})})}};gb(Ft,"id","move");gb(Ft,"shortcut","whiteboard/pan");gb(Ft,"states",[uA,vA,tA,wA]);gb(Ft,"initial","idle");var hm=class{constructor(a,d={}){gb(this,"lastShapesNounces",null);gb(this,"app");gb(this,"id");gb(this,"name");gb(this,"shapes",[]);gb(this,"bindings",{});gb(this,"nonce",0);gb(this,"bringForward",
Ha=>{const Sa=this.parseShapesArg(Ha);Sa.sort((Za,fb)=>this.shapes.indexOf(fb)-this.shapes.indexOf(Za)).map(Za=>this.shapes.indexOf(Za)).forEach(Za=>{if(Za!==this.shapes.length-1&&!Sa.includes(this.shapes[Za+1])){var fb=this.shapes[Za];this.shapes[Za]=this.shapes[Za+1];this.shapes[Za+1]=fb}});this.app.persist();return this});gb(this,"sendBackward",Ha=>{const Sa=this.parseShapesArg(Ha);Sa.sort((Za,fb)=>this.shapes.indexOf(Za)-this.shapes.indexOf(fb)).map(Za=>this.shapes.indexOf(Za)).forEach(Za=>{if(0!==
Za&&!Sa.includes(this.shapes[Za-1])){var fb=this.shapes[Za];this.shapes[Za]=this.shapes[Za-1];this.shapes[Za-1]=fb}});this.app.persist();return this});gb(this,"bringToFront",Ha=>{const Sa=this.parseShapesArg(Ha);this.shapes=this.shapes.filter(Za=>!Sa.includes(Za)).concat(Sa);this.app.persist();return this});gb(this,"sendToBack",Ha=>{const Sa=this.parseShapesArg(Ha);this.shapes=Sa.concat(this.shapes.filter(Za=>!Sa.includes(Za)));this.app.persist();return this});gb(this,"flip",(Ha,Sa)=>{Ha=this.parseShapesArg(Ha);
const Za=cf.getCommonBounds(Ha.map(fb=>fb.bounds));Ha.forEach(fb=>{var ib;const Bb=cf.getRelativeTransformedBoundingBox(Za,Za,fb.bounds,"horizontal"===Sa,"vertical"===Sa);if(fb.serialized)fb.onResize(fb.serialized,{bounds:Bb,center:cf.getBoundsCenter(Bb),rotation:null!=(ib=fb.props.rotation)?ib:-0,type:"top_left_corner",scale:fb.canFlip&&fb.props.scale?"horizontal"===Sa?[-fb.props.scale[0],1]:[1,-fb.props.scale[1]]:[1,1],clip:!1,transformOrigin:[.5,.5]})});this.app.persist();return this});gb(this,
"getShapeById",Ha=>this.shapes.find(Sa=>Sa.id===Ha));gb(this,"cleanup",Ha=>{Ha=Db(this.bindings,Ha);const Sa=new Set;let Za=!1,fb=!1;const ib=Js(this.bindings);Ha.forEach(Bb=>{var Ob;if(this.bindings[Bb.id]){var Fb=this.getShapeById(Bb.toId),cc=this.getShapeById(Bb.fromId);Fb&&cc?Sa.has(cc.id)||(Bb=this.updateArrowBindings(cc),Sa.add(cc.id),Bb&&(Fb=Ud(Ud({},cc.props),Bb),Za=!0,null==(Ob=this.getShapeById(Fb.id))?void 0:Ob.update(Fb,!1,(0,NE.default)(null==Bb?void 0:Bb.handles,null==cc?void 0:cc.props.handles)))):
(delete ib[Bb.id],fb=!0)}});Object.keys(ib).forEach(Bb=>{const Ob=this.bindings[Bb];0===this.shapes.filter(Fb=>Fb.id===Ob.fromId||Fb.id===Ob.toId).length&&(delete ib[Bb],fb=!0)});fb&&this.update({bindings:ib});(Za||fb)&&this.app.persist(!0)});gb(this,"updateArrowBindings",Ha=>{var Sa,Za,fb,ib={start:Js(Ha.props.handles.start),end:Js(Ha.props.handles.end)},Bb={isBound:!1,handle:Ha.props.handles.start,point:Pd.add(Ha.props.handles.start.point,Ha.props.point)},Ob={isBound:!1,handle:Ha.props.handles.end,
point:Pd.add(Ha.props.handles.end.point,Ha.props.point)};if(Ha.props.handles.start.bindingId){var Fb=void 0!==(null==(Sa=Ha.props.decorations)?void 0:Sa.start);Sa=Ha.props.handles.start;var cc=this.bindings[Ha.props.handles.start.bindingId],oc=this.getShapeById(null==cc?void 0:cc.toId);if(oc){Bb=oc.getBounds();var Xb=oc.getExpandedBounds(),hc=cf.expandBounds(Bb,Fb?cc.distance:1);const {minX:ec,minY:Ec,width:Ic,height:nd}=Xb,Bd=Pd.add([ec,Ec],Pd.mulV([Ic,nd],Pd.rotWith(cc.point,[.5,.5],oc.props.rotation||
0)));Bb={isBound:!0,hasDecoration:Fb,binding:cc,handle:Sa,point:Bd,target:oc,bounds:Bb,expandedBounds:Xb,intersectBounds:hc,center:oc.getCenter()}}}if(Ha.props.handles.end.bindingId&&(Fb=void 0!==(null==(Za=Ha.props.decorations)?void 0:Za.end),Za=Ha.props.handles.end,Sa=this.bindings[Ha.props.handles.end.bindingId],cc=this.getShapeById(null==Sa?void 0:Sa.toId))){Ob=cc.getBounds();oc=cc.getExpandedBounds();Xb=Fb?cf.expandBounds(Ob,Sa.distance):Ob;const {minX:ec,minY:Ec,width:Ic,height:nd}=oc;hc=Pd.add([ec,
Ec],Pd.mulV([Ic,nd],Pd.rotWith(Sa.point,[.5,.5],cc.props.rotation||0)));Ob={isBound:!0,hasDecoration:Fb,binding:Sa,handle:Za,point:hc,target:cc,bounds:Ob,expandedBounds:oc,intersectBounds:Xb,center:cc.getCenter()}}for(const ec of["end","start"]){Za="start"===ec?Bb:Ob;const Ec="start"===ec?Ob:Bb;if(Za.isBound)if(Za.binding.distance){if(Fb=Pd.uni(Pd.sub(Za.point,Ec.point)),Sa=A(Ec.point,Fb,Za.intersectBounds,Za.target.props.rotation).filter(Ic=>Ic.didIntersect).map(Ic=>Ic.points[0]).sort((Ic,nd)=>Pd.dist(Ic,
Ec.point)-Pd.dist(nd,Ec.point)),Sa[0])if(cc=void 0,Ec.isBound&&(cc=A(Ec.point,Fb,Ec.intersectBounds,Ec.target.props.rotation).filter(Ic=>Ic.didIntersect).map(Ic=>Ic.points[0]).sort((Ic,nd)=>Pd.dist(Ic,Ec.point)-Pd.dist(nd,Ec.point))[0]),Ec.isBound&&(2>Sa.length||cc&&Sa[0]&&10>Math.ceil(Pd.dist(Sa[0],cc))||cf.boundsContain(Za.expandedBounds,Ec.expandedBounds)||cf.boundsCollide(Za.expandedBounds,Ec.expandedBounds)))Fb=Pd.uni(Pd.sub(Ec.point,Za.point)),Sa=A(Za.point,Fb,Za.bounds,Za.target.props.rotation).filter(Ic=>
Ic.didIntersect).map(Ic=>Ic.points[0]),Sa[0]&&(ib[ec].point=Pd.toFixed(Pd.sub(Sa[0],Ha.props.point)),ib["start"===ec?"end":"start"].point=Pd.toFixed(Pd.add(Pd.sub(Sa[0],Ha.props.point),Pd.mul(Fb,Math.min(Pd.dist(Sa[0],Ec.point),10*(cf.boundsContain(Ec.bounds,Za.intersectBounds)?-1:1))))));else{if(!Ec.isBound&&(Sa[0]&&10>Pd.dist(Sa[0],Ec.point)||Tj.pointInBounds(Ec.point,Za.intersectBounds)))return ib=Pd.uni(Pd.sub(Za.center,Ec.point)),null==(fb=Ha.getHandlesChange)?void 0:fb.call(Ha,Ha.props,{[ec]:Re(Ud({},
Ha.props.handles[ec]),{point:Pd.toFixed(Pd.add(Pd.sub(Ec.point,Ha.props.point),Pd.mul(ib,10)))})});Sa[0]&&(ib[ec].point=Pd.toFixed(Pd.sub(Sa[0],Ha.props.point)))}}else ib[ec].point=Pd.sub(Za.point,Ha.props.point)}return Ha.getHandlesChange(Ha.props,ib)});const {id:k,name:G,shapes:fa=[],bindings:na={},nonce:ta}=d;this.id=k;this.name=G;this.bindings=Object.assign({},na);this.app=a;this.nonce=ta||0;this.addShapes(...fa);Hf(this);wd(()=>{const Ha=0<this.shapes.length?Object.fromEntries(this.shapes.map(Sa=>
[Sa.id,Sa.nonce])):null;if(this.lastShapesNounces&&Ha){const Sa=this.lastShapesNounces,Za=[...(new Set([...Object.keys(Ha),...Object.keys(Sa)]))].filter(fb=>Sa[fb]!==Ha[fb]);requestAnimationFrame(()=>{this.cleanup(Za)})}Ha&&(this.lastShapesNounces=Ha)})}get serialized(){return{id:this.id,name:this.name,shapes:this.shapes.map(a=>a.serialized).filter(a=>!!a).map(a=>yc(a)),bindings:Js(this.bindings),nonce:this.nonce}}get shapesById(){return Object.fromEntries(this.shapes.map(a=>[a.id,a]))}update(a){Object.assign(this,
a);return this}updateBindings(a){Object.assign(this.bindings,a);return this}updateShapesIndex(a){this.shapes.sort((d,k)=>a.indexOf(d.id)-a.indexOf(k.id));return this}addShapes(...a){if(0!==a.length)return a="getBounds"in a[0]?a:a.map(d=>new (this.app.getShapeClass(d.type))(d)),this.shapes.push(...a),a}parseShapesArg(a){return"string"===typeof a[0]?this.shapes.filter(d=>a.includes(d.id)):a}removeShapes(...a){const d=this.parseShapesArg(a);this.shapes=this.shapes.filter(k=>!d.includes(k));return d}getBindableShapes(){return this.shapes.filter(a=>
a.canBind).sort((a,d)=>d.nonce-a.nonce).map(a=>a.id)}};Nd([ze],hm.prototype,"id",2);Nd([ze],hm.prototype,"name",2);Nd([ze],hm.prototype,"shapes",2);Nd([ze],hm.prototype,"bindings",2);Nd([kf],hm.prototype,"serialized",1);Nd([kf],hm.prototype,"shapesById",1);Nd([ze],hm.prototype,"nonce",2);Nd([hg],hm.prototype,"update",1);Nd([hg],hm.prototype,"updateBindings",1);Nd([hg],hm.prototype,"updateShapesIndex",1);Nd([hg],hm.prototype,"addShapes",1);Nd([hg],hm.prototype,"removeShapes",1);Nd([hg],hm.prototype,
"bringForward",2);Nd([hg],hm.prototype,"sendBackward",2);Nd([hg],hm.prototype,"bringToFront",2);Nd([hg],hm.prototype,"sendToBack",2);Nd([hg],hm.prototype,"cleanup",2);var ok=class{constructor(){gb(this,"shiftKey",!1);gb(this,"ctrlKey",!1);gb(this,"modKey",!1);gb(this,"altKey",!1);gb(this,"spaceKey",!1);gb(this,"isPinching",!1);gb(this,"currentScreenPoint",[0,0]);gb(this,"currentPoint",[0,0]);gb(this,"previousScreenPoint",[0,0]);gb(this,"previousPoint",[0,0]);gb(this,"originScreenPoint",[0,0]);gb(this,
"originPoint",[0,0]);gb(this,"pointerIds",new Set);gb(this,"state","idle");gb(this,"containerOffset",[0,0]);gb(this,"onPointerDown",(a,d)=>{this.pointerIds.add(d.pointerId);this.updateModifiers(d);this.originScreenPoint=this.currentScreenPoint;this.originPoint=a;this.state="pointing"});gb(this,"onPointerMove",(a,d)=>{"pinching"!==this.state&&("panning"===this.state&&(this.state="idle"),this.updateModifiers(d),this.previousPoint=this.currentPoint,this.currentPoint=a)});gb(this,"onPointerUp",(a,d)=>
{this.pointerIds.clear();this.updateModifiers(d);this.state="idle"});gb(this,"onKeyDown",a=>{this.updateModifiers(a);switch(a.key){case " ":this.spaceKey=!0}});gb(this,"onKeyUp",a=>{this.updateModifiers(a);switch(a.key){case " ":this.spaceKey=!1}});gb(this,"onPinchStart",(a,d)=>{this.updateModifiers(d);this.state="pinching"});gb(this,"onPinch",(a,d)=>{"pinching"===this.state&&this.updateModifiers(d)});gb(this,"onPinchEnd",(a,d)=>{"pinching"===this.state&&(this.updateModifiers(d),this.state="idle")});
Hf(this)}updateContainerOffset(a){Object.assign(this.containerOffset,a)}updateModifiers(a){a.isPrimary&&("clientX"in a&&(this.previousScreenPoint=this.currentScreenPoint,this.currentScreenPoint=Pd.sub([a.clientX,a.clientY],this.containerOffset)),"shiftKey"in a&&(this.shiftKey=a.shiftKey,this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.modKey=ih()?a.metaKey:a.ctrlKey))}};Nd([ze],ok.prototype,"shiftKey",2);Nd([ze],ok.prototype,"ctrlKey",2);Nd([ze],ok.prototype,"modKey",2);Nd([ze],ok.prototype,"altKey",
2);Nd([ze],ok.prototype,"spaceKey",2);Nd([ze],ok.prototype,"isPinching",2);Nd([ze],ok.prototype,"currentScreenPoint",2);Nd([ze],ok.prototype,"currentPoint",2);Nd([ze],ok.prototype,"previousScreenPoint",2);Nd([ze],ok.prototype,"previousPoint",2);Nd([ze],ok.prototype,"originScreenPoint",2);Nd([ze],ok.prototype,"originPoint",2);Nd([ze],ok.prototype,"state",2);Nd([ze],ok.prototype,"containerOffset",2);Nd([hg],ok.prototype,"updateContainerOffset",1);Nd([hg],ok.prototype,"updateModifiers",1);Nd([hg],ok.prototype,
"onPointerDown",2);Nd([hg],ok.prototype,"onPointerMove",2);Nd([hg],ok.prototype,"onPointerUp",2);Nd([hg],ok.prototype,"onKeyDown",2);Nd([hg],ok.prototype,"onKeyUp",2);Nd([hg],ok.prototype,"onPinchStart",2);Nd([hg],ok.prototype,"onPinch",2);Nd([hg],ok.prototype,"onPinchEnd",2);var xE=(a,d=100)=>-(Math.cos(Math.PI*qd.clamp(a/d,0,1))-1)/2,Is=class{constructor(){gb(this,"bounds",{minX:0,minY:0,maxX:1080,maxY:720,width:1080,height:720});gb(this,"camera",{point:[0,0],zoom:1});gb(this,"updateBounds",a=>
{this.bounds=a;return this});gb(this,"panCamera",a=>this.update({point:qd.sub(this.camera.point,qd.div(a,this.camera.zoom))}));gb(this,"panToPointWhenNearBounds",a=>{const d=qd.div([Is.panThreshold,Is.panThreshold],this.camera.zoom),k=qd.sub([this.currentView.maxX,this.currentView.maxY],qd.add(a,d));a=qd.sub([this.currentView.minX,this.currentView.minY],qd.sub(a,d));this.panCamera(qd.mul([0>k[0]?k[0]:0<a[0]?a[0]:0,0>k[1]?k[1]:0<a[1]?a[1]:0],-Is.panMultiplier*this.camera.zoom))});gb(this,"update",
({point:a,zoom:d})=>{void 0===a||isNaN(a[0])||isNaN(a[1])||(this.camera.point=a);void 0===d||isNaN(d)||(this.camera.zoom=Math.min(4,Math.max(.1,d)));return this});gb(this,"getPagePoint",a=>{const {camera:d,bounds:k}=this;return qd.sub(qd.div(qd.sub(a,[k.minX,k.minY]),d.zoom),d.point)});gb(this,"getScreenPoint",a=>{const {camera:d}=this;return qd.mul(qd.add(a,d.point),d.zoom)});gb(this,"onZoom",(a,d,k=!1)=>this.pinchZoom(a,[0,0],d,k));gb(this,"pinchZoom",(a,d,k,G=!1)=>{var {camera:fa}=this;d=qd.sub(fa.point,
qd.div(d,fa.zoom));k=qd.clamp(k,Is.minZoom,Is.maxZoom);fa=qd.div(a,fa.zoom);a=qd.div(a,k);a=qd.toFixed(qd.add(d,qd.sub(a,fa)));G?this.animateCamera({point:a,zoom:k}):this.update({point:a,zoom:k});return this});gb(this,"setZoom",(a,d=!1)=>{const {bounds:k}=this;this.onZoom([k.width/2,k.height/2],a,d)});gb(this,"zoomIn",()=>{const {camera:a}=this;this.setZoom(a.zoom/.8,!0)});gb(this,"zoomOut",()=>{const {camera:a}=this;this.setZoom(.8*a.zoom,!0)});gb(this,"resetZoom",()=>{this.setZoom(1,!0);return this});
gb(this,"animateCamera",({point:a,zoom:d})=>this.animateToViewport({minX:-a[0],minY:-a[1],maxX:this.bounds.width/d-a[0],maxY:this.bounds.height/d-a[1],width:this.bounds.width/d,height:this.bounds.height/d}));gb(this,"animateToViewport",a=>{const d=performance.now(),k=Ud({},this.currentView),G=()=>{var fa=performance.now()-d;fa=xE(fa);var na=k.minX+(a.minX-k.minX)*fa;this.update({point:[-na,-(k.minY+(a.minY-k.minY)*fa)],zoom:this.bounds.width/(k.maxX+(a.maxX-k.maxX)*fa-na)});1>fa&&requestAnimationFrame(G)};
G()});gb(this,"zoomToBounds",({width:a,height:d,minX:k,minY:G})=>{const {bounds:fa,camera:na}=this;let ta=Math.min((fa.width-100)/a,(fa.height-100)/d);ta=Math.min(1,Math.max(Is.minZoom,na.zoom===ta||1>na.zoom?Math.min(1,ta):ta));a=qd.add([-k,-G],[(fa.width-a*ta)/2/ta,(fa.height-d*ta)/2/ta]);this.animateCamera({point:a,zoom:ta})});Hf(this)}get currentView(){const {bounds:a,camera:{point:d,zoom:k}}=this,G=a.width/k,fa=a.height/k;return{minX:-d[0],minY:-d[1],maxX:G-d[0],maxY:fa-d[1],width:G,height:fa}}},
ep=Is;gb(ep,"minZoom",.1);gb(ep,"maxZoom",4);gb(ep,"panMultiplier",.05);gb(ep,"panThreshold",100);Nd([ze],ep.prototype,"bounds",2);Nd([ze],ep.prototype,"camera",2);Nd([hg],ep.prototype,"updateBounds",2);Nd([hg],ep.prototype,"update",2);Nd([kf],ep.prototype,"currentView",1);var yE=class{constructor(a){gb(this,"app");gb(this,"editShape",d=>{(null==d?0:d.props.isLocked)||this.app.transition("select").selectedTool.transition("editingShape",{shape:d});return this});gb(this,"hoverShape",d=>{this.app.setHoveredShape(d);
return this});gb(this,"createShapes",(...d)=>{this.app.createShapes(d);return this});gb(this,"updateShapes",(...d)=>{this.app.updateShapes(d);return this});gb(this,"deleteShapes",(...d)=>{this.app.deleteShapes(d.length?d:this.app.selectedShapesArray);return this});gb(this,"selectShapes",(...d)=>{this.app.setSelectedShapes(d);return this});gb(this,"deselectShapes",(...d)=>{const k="string"===typeof d[0]?d:d.map(G=>G.id);this.app.setSelectedShapes(this.app.selectedShapesArray.filter(G=>!k.includes(G.id)));
return this});gb(this,"flipHorizontal",(...d)=>{this.app.flipHorizontal(d);return this});gb(this,"flipVertical",(...d)=>{this.app.flipVertical(d);return this});gb(this,"selectAll",()=>{this.app.setSelectedShapes(this.app.currentPage.shapes.filter(d=>!this.app.shapesInGroups().includes(d)));return this});gb(this,"deselectAll",()=>{this.app.setSelectedShapes([]);return this});gb(this,"zoomIn",()=>{this.app.viewport.zoomIn();return this});gb(this,"zoomOut",()=>{this.app.viewport.zoomOut();return this});
gb(this,"resetZoom",()=>{this.app.viewport.resetZoom();return this});gb(this,"zoomToFit",()=>{var {shapes:d}=this.app.currentPage;if(0===d.length)return this;d=cf.getCommonBounds(d.map(k=>k.bounds));this.app.viewport.zoomToBounds(d);return this});gb(this,"cameraToCenter",()=>{var {shapes:d}=this.app.currentPage;if(0===d.length)return this;d=cf.getCommonBounds(d.map(k=>k.bounds));this.app.viewport.update({point:Pd.add(Pd.neg(cf.getBoundsCenter(d)),[this.app.viewport.currentView.width/2,this.app.viewport.currentView.height/
2])});return this});gb(this,"zoomToSelection",()=>{const {selectionBounds:d}=this.app;if(!d)return this;this.app.viewport.zoomToBounds(d);return this});gb(this,"resetZoomToCursor",()=>{this.app.viewport.animateCamera({zoom:1,point:Pd.sub(this.app.inputs.originScreenPoint,this.app.inputs.originPoint)});return this});gb(this,"toggleGrid",()=>{const {settings:d}=this.app;d.update({showGrid:!d.showGrid});return this});gb(this,"toggleSnapToGrid",()=>{const {settings:d}=this.app;d.update({snapToGrid:!d.snapToGrid});
return this});gb(this,"togglePenMode",()=>{const {settings:d}=this.app;d.update({penMode:!d.penMode});return this});gb(this,"setColor",d=>{const {settings:k}=this.app;k.update({color:d});this.app.selectedShapesArray.forEach(G=>{G.props.isLocked||G.update({fill:d,stroke:d})});this.app.persist();return this});gb(this,"setScaleLevel",d=>{const {settings:k}=this.app;k.update({scaleLevel:d});this.app.selectedShapes.forEach(G=>{G.props.isLocked||G.setScaleLevel(d)});this.app.persist();return this});gb(this,
"undo",()=>{this.app.undo();return this});gb(this,"redo",()=>{this.app.redo();return this});gb(this,"persist",()=>{this.app.persist();return this});gb(this,"createNewLineBinding",(d,k)=>this.app.createNewLineBinding(d,k));gb(this,"cloneShapes",({shapes:d,assets:k,bindings:G,point:fa=[0,0]})=>{const na=cf.getCommonBounds(d.filter(Sa=>"group"!==Sa.type).map(Sa=>{var Za,fb,ib,Bb,Ob,Fb,cc,oc,Xb,hc,ec,Ec,Ic,nd,Bd,Ee;return{minX:null!=(fb=null==(Za=Sa.point)?void 0:Za[0])?fb:fa[0],minY:null!=(Bb=null==
(ib=Sa.point)?void 0:ib[1])?Bb:fa[1],width:null!=(Fb=null==(Ob=Sa.size)?void 0:Ob[0])?Fb:4,height:null!=(oc=null==(cc=Sa.size)?void 0:cc[1])?oc:4,maxX:(null!=(hc=null==(Xb=Sa.point)?void 0:Xb[0])?hc:fa[0])+(null!=(Ec=null==(ec=Sa.size)?void 0:ec[0])?Ec:4),maxY:(null!=(nd=null==(Ic=Sa.point)?void 0:Ic[1])?nd:fa[1])+(null!=(Ee=null==(Bd=Sa.size)?void 0:Bd[1])?Ee:4)}})),ta=d.map(Sa=>Re(Ud({},Sa),{id:Ij(),point:[fa[0]+Sa.point[0]-na.minX,fa[1]+Sa.point[1]-na.minY]}));ta.forEach(Sa=>{var Za;Sa.children&&
0<(null==(Za=Sa.children)?void 0:Za.length)&&(Sa.children=Sa.children.map(fb=>{var ib;return null==(ib=ta[d.findIndex(Bb=>Bb.id===fb)])?void 0:ib.id}).filter(Zf))});const Ha=[];ta.flatMap(Sa=>{var Za;return Object.values(null!=(Za=Sa.handles)?Za:{})}).forEach(Sa=>{if(Sa.bindingId){var Za=G[Sa.bindingId];if(Za){var fb=d.findIndex(Bb=>Bb.id===Za.fromId);const ib=d.findIndex(Bb=>Bb.id===Za.toId);Za&&-1!==fb&&-1!==ib?(fb=Re(Ud({},Za),{id:Ij(),fromId:ta[fb].id,toId:ta[ib].id}),Ha.push(fb),Sa.bindingId=
fb.id):Sa.bindingId=void 0}else console.warn("binding not found",Sa.bindingId)}});k=k.filter(Sa=>ta.some(Za=>Za.assetId===Sa.id));return{shapes:ta,assets:k,bindings:Ha}});gb(this,"getClonedShapesFromTldrString",(d,k)=>{try{{var G;const Za=null==(G=d.match(/<whiteboard-tldr>(.*)<\/whiteboard-tldr>/))?void 0:G[1];if(Za){try{var fa=JSON.parse(Za)}catch(fb){fa=null}var na=fa}else na=void 0}d=na;if(!d)return null;const {shapes:ta,bindings:Ha,assets:Sa}=d;return this.cloneShapes({shapes:ta,bindings:Ha,
assets:Sa,point:k})}catch(ta){console.log(ta)}return null});gb(this,"cloneShapesIntoCurrentPage",d=>{(d=this.cloneShapes(d))&&this.addClonedShapes(d);return this});gb(this,"addClonedShapes",d=>{const {shapes:k,assets:G,bindings:fa}=d;0<G.length&&this.app.createAssets(G);0<k.length&&this.app.createShapes(k);this.app.currentPage.updateBindings(Object.fromEntries(fa.map(na=>[na.id,na])));this.app.selectedTool.transition("idle");return this});gb(this,"addClonedShapesFromTldrString",(d,k)=>{(d=this.getClonedShapesFromTldrString(d,
k))&&this.addClonedShapes(d);return this});gb(this,"doGroup",(d=this.app.allSelectedShapesArray)=>{if(!this.app.readOnly){var k=[...d.filter(G=>"group"===G.type),...d.map(G=>this.app.getParentGroup(G))].filter(Zf);this.app.currentPage.removeShapes(...k);d=d.filter(G=>"group"!==G.type);1<d.length&&(k=this.app.getShapeClass("group"),k=new k({id:Ij(),type:k.id,parentId:this.app.currentPage.id,children:d.map(G=>G.id)}),this.app.currentPage.addShapes(k),this.app.setSelectedShapes([k]),this.app.bringForward(d));
this.app.persist()}});gb(this,"unGroup",(d=this.app.allSelectedShapesArray)=>{if(!this.app.readOnly){d=[...d.filter(G=>"group"===G.type),...d.map(G=>this.app.getParentGroup(G))].filter(Zf);var k=this.app.shapesInGroups(d);0<d.length&&(this.app.currentPage.removeShapes(...d),this.app.persist(),this.app.setSelectedShapes(k))}});gb(this,"convertShapes",(d,k=this.app.allSelectedShapesArray)=>{const G=this.app.getShapeClass(d);this.app.currentPage.removeShapes(...k);k=k.map(fa=>new G(Re(Ud({},fa.serialized),
{type:d,nonce:Date.now()})));this.app.currentPage.addShapes(...k);this.app.persist();this.app.setSelectedShapes(k)});gb(this,"setCollapsed",(d,k=this.app.allSelectedShapesArray)=>{k.forEach(G=>{"logseq-portal"===G.props.type&&G.setCollapsed(d)});this.app.persist()});this.app=a}},Gt=class{constructor(){gb(this,"cursor","default");gb(this,"rotation",0);gb(this,"reset",()=>{this.cursor="default"});gb(this,"setCursor",(a,d=0)=>{if(a!==this.cursor||d!==this.rotation)this.cursor=a,this.rotation=d});gb(this,
"setRotation",a=>{a!==this.rotation&&(this.rotation=a)});Hf(this)}};Nd([ze],Gt.prototype,"cursor",2);Nd([ze],Gt.prototype,"rotation",2);Nd([hg],Gt.prototype,"reset",2);Nd([hg],Gt.prototype,"setCursor",2);Nd([hg],Gt.prototype,"setRotation",2);var Ht=class{constructor(a){gb(this,"app");gb(this,"stack",[]);gb(this,"isPaused",!0);gb(this,"pause",()=>{this.isPaused||(this.isPaused=!0)});gb(this,"resume",()=>{this.isPaused&&(this.isPaused=!1)});gb(this,"persist",(d=!1)=>{this.isPaused||this.creating||this.app.notify("persist",
{replace:d})});gb(this,"undo",()=>{this.isPaused||"idle"===this.app.selectedTool.currentState.id&&this.app.appUndo&&this.app.appUndo()});gb(this,"redo",()=>{this.isPaused||"idle"===this.app.selectedTool.currentState.id&&this.app.appRedo&&this.app.appRedo()});gb(this,"instantiateShape",d=>new (this.app.getShapeClass(d.type))(d));gb(this,"deserialize",d=>{ed(()=>{var k,{pages:G}=d;const fa=this.isPaused;this.pause();const na=[...this.app.selectedIds];try{const ta=new Map(this.app.pages),Ha=[];for(const Sa of G){const Za=
ta.get(Sa.id);if(void 0!==Za){const fb=new Map(Za.shapes.map(ib=>[ib.props.id,ib]));G=[];for(const ib of Sa.shapes){const Bb=fb.get(ib.id);void 0!==Bb?(Bb.nonce!==ib.nonce&&(Bb.update(ib,!0),Bb.nonce=ib.nonce,Bb.setLastSerialized(ib)),fb.delete(ib.id)):G.push(this.instantiateShape(ib))}0<fb.size&&!this.app.selectedTool.isInAny("creating","editingShape")&&Za.removeShapes(...fb.values());0<G.length&&Za.addShapes(...G);ta.delete(Sa.id);Za.updateBindings(Sa.bindings);Za.nonce=null!=(k=Sa.nonce)?k:0}else{const {id:fb,
name:ib,shapes:Bb,bindings:Ob,nonce:Fb}=Sa;Ha.push(new hm(this.app,{id:fb,name:ib,nonce:Fb,bindings:Ob,shapes:Bb.map(cc=>this.instantiateShape(cc))}))}}0<Ha.length&&this.app.addPages(Ha);0<ta.size&&this.app.removePages(Array.from(ta.values()));this.app.setSelectedShapes(na).setErasingShapes([])}catch(ta){console.warn(ta)}fa||this.resume()})});this.app=a;Hf(this)}get creating(){return"creating"===this.app.selectedTool.currentState.id}};Nd([ze],Ht.prototype,"stack",2);Nd([hg],Ht.prototype,"persist",
2);Nd([hg],Ht.prototype,"undo",2);Nd([hg],Ht.prototype,"redo",2);Nd([hg],Ht.prototype,"deserialize",2);var Cr=class{constructor(){gb(this,"mode","light");gb(this,"showGrid",!0);gb(this,"snapToGrid",!0);gb(this,"penMode",!1);gb(this,"scaleLevel","md");gb(this,"color","");Hf(this)}update(a){Object.assign(this,a)}};Nd([ze],Cr.prototype,"mode",2);Nd([ze],Cr.prototype,"showGrid",2);Nd([ze],Cr.prototype,"snapToGrid",2);Nd([ze],Cr.prototype,"penMode",2);Nd([ze],Cr.prototype,"scaleLevel",2);Nd([ze],Cr.prototype,
"color",2);Nd([hg],Cr.prototype,"update",1);var $g=class extends Dt{constructor(a,d,k,G){var fa,na;super();gb(this,"uuid",Ij());gb(this,"readOnly");gb(this,"api");gb(this,"inputs",new ok);gb(this,"cursors",new Gt);gb(this,"viewport",new ep);gb(this,"settings",new Cr);gb(this,"Tools",[]);gb(this,"history",new Ht(this));gb(this,"persist",this.history.persist);gb(this,"undo",this.history.undo);gb(this,"redo",this.history.redo);gb(this,"saving",!1);gb(this,"saveState",()=>{this.history.isPaused||(this.saving=
!0,requestAnimationFrame(()=>{this.saving&&(this.persist(),this.saving=!1)}))});gb(this,"load",()=>{this.notify("load",null);return this});gb(this,"save",()=>{this.notify("save",null);return this});gb(this,"pages",new Map([["page",new hm(this,{id:"page",name:"page",shapes:[],bindings:{}})]]));gb(this,"getPageById",ta=>{const Ha=this.pages.get(ta);if(!Ha)throw Error(`Could not find a page named ${ta}.`);return Ha});gb(this,"getShapeById",(ta,Ha=this.currentPage.id)=>{var Sa;return null==(Sa=this.getPageById(Ha))?
void 0:Sa.shapesById[ta]});gb(this,"createShapes",ta=>{if(this.readOnly)return this;(ta=this.currentPage.addShapes(...ta))&&this.notify("create-shapes",ta);this.persist();return this});gb(this,"updateShapes",ta=>{if(this.readOnly)return this;ta.forEach(Ha=>{const Sa=this.getShapeById(Ha.id);null==Sa?void 0:Sa.update(Ha);Ha.type!==(null==Sa?void 0:Sa.type)&&this.api.convertShapes(Ha.type,[Sa])});this.persist();return this});gb(this,"deleteShapes",ta=>{if(0===ta.length||this.readOnly)return this;ta=
ta.map(fb=>"string"===typeof fb?this.getShapeById(fb):fb).filter(Zf).filter(fb=>!fb.props.isLocked);const Ha=this.shapesInGroups(ta);ta.forEach(fb=>{this.getParentGroup(fb)&&Ha.push(fb)});let Sa=new Set([...ta,...Ha].map(fb=>fb.id));Ha.forEach(fb=>{var ib;const Bb=this.getParentGroup(fb);if(Bb){const Ob=null==(ib=Bb.props.children)?void 0:ib.filter(Fb=>Fb!==fb.id);!Ob||1>=(null==Ob?void 0:Ob.length)?Sa.add(Bb.id):Bb.update({children:Ob})}});const Za=(fb,ib)=>{var Bb;[...Sa].includes(fb)&&"line"===
(null==(Bb=this.getShapeById(ib))?void 0:Bb.type)&&Sa.add(ib)};this.currentPage.shapes.filter(fb=>!fb.props.isLocked).flatMap(fb=>{var ib;return Object.values(null!=(ib=fb.props.handles)?ib:{})}).flatMap(fb=>fb.bindingId).filter(Zf).map(fb=>{var ib,Bb;const Ob=null==(ib=this.currentPage.bindings[fb])?void 0:ib.toId;fb=null==(Bb=this.currentPage.bindings[fb])?void 0:Bb.fromId;Ob&&fb&&(Za(Ob,fb),Za(fb,Ob))});ta=[...Sa].map(fb=>this.getShapeById(fb));this.setSelectedShapes(this.selectedShapesArray.filter(fb=>
!Sa.has(fb.id)));(ta=this.currentPage.removeShapes(...ta))&&this.notify("delete-shapes",ta);this.persist();return this});gb(this,"bringForward",(ta=this.selectedShapesArray)=>{0<ta.length&&!this.readOnly&&this.currentPage.bringForward(ta);return this});gb(this,"sendBackward",(ta=this.selectedShapesArray)=>{0<ta.length&&!this.readOnly&&this.currentPage.sendBackward(ta);return this});gb(this,"sendToBack",(ta=this.selectedShapesArray)=>{0<ta.length&&!this.readOnly&&this.currentPage.sendToBack(ta);return this});
gb(this,"bringToFront",(ta=this.selectedShapesArray)=>{0<ta.length&&!this.readOnly&&this.currentPage.bringToFront(ta);return this});gb(this,"flipHorizontal",(ta=this.selectedShapesArray)=>{this.currentPage.flip(ta,"horizontal");return this});gb(this,"flipVertical",(ta=this.selectedShapesArray)=>{this.currentPage.flip(ta,"vertical");return this});gb(this,"align",(ta,Ha=this.selectedShapesArray)=>{if(2>Ha.length||this.readOnly)return this;const Sa=Ha.map(Ob=>{const Fb=Ob.getBounds();return{id:Ob.id,
point:[Fb.minX,Fb.minY],bounds:Fb}}),Za=cf.getCommonBounds(Sa.map(({bounds:Ob})=>Ob)),fb=Za.minX+Za.width/2,ib=Za.minY+Za.height/2,Bb=Object.fromEntries(Sa.map(({id:Ob,point:Fb,bounds:cc})=>[Ob,{prev:Fb,next:{top:[Fb[0],Za.minY],centerVertical:[Fb[0],ib-cc.height/2],bottom:[Fb[0],Za.maxY-cc.height],left:[Za.minX,Fb[1]],centerHorizontal:[fb-cc.width/2,Fb[1]],right:[Za.maxX-cc.width,Fb[1]]}[ta]}]));Ha.forEach(Ob=>{Bb[Ob.id]&&Ob.update({point:Bb[Ob.id].next})});this.persist();return this});gb(this,"distribute",
(ta,Ha=this.selectedShapesArray)=>{if(2>Ha.length||this.readOnly)return this;const Sa=Object.fromEntries(cf.getDistributions(Ha,ta).map(Za=>[Za.id,Za]));Ha.forEach(Za=>{Sa[Za.id]&&Za.update({point:Sa[Za.id].next})});this.persist();return this});gb(this,"packIntoRectangle",(ta=this.selectedShapesArray)=>{if(2>ta.length||this.readOnly)return this;const Ha=Object.fromEntries(cf.getPackedDistributions(ta).map(Sa=>[Sa.id,Sa]));ta.forEach(Sa=>{Ha[Sa.id]&&Sa.update({point:Ha[Sa.id].next})});this.persist();
return this});gb(this,"setLocked",ta=>{if(0===this.selectedShapesArray.length||this.readOnly)return this;this.selectedShapesArray.forEach(Ha=>{Ha.update({isLocked:ta})});this.persist();return this});gb(this,"assets",{});gb(this,"removeUnusedAssets",()=>{const ta=this.getCleanUpAssets();Object.keys(this.assets).forEach(Ha=>{ta.some(Sa=>Sa.id===Ha)||delete this.assets[Ha]});this.persist();return this});gb(this,"copy",()=>{if(0<this.selectedShapesArray.length&&!this.editingShape){const Ha=this.allSelectedShapesArray;
var ta=JSON.stringify({shapes:Ha.map(Za=>Za.serialized),assets:this.getCleanUpAssets().filter(Za=>Ha.some(fb=>fb.props.assetId===Za.id)),bindings:yc(this.currentPage.bindings)});ta=encodeURIComponent(`<whiteboard-tldr>${ta}</whiteboard-tldr>`);const Sa=this.selectedShapesArray.map(Za=>`((${Za.props.id}))`).join(" ");this.notify("copy",{text:Sa,html:ta})}});gb(this,"paste",(ta,Ha)=>{var Sa;this.editingShape||this.readOnly||this.notify("paste",{point:this.inputs.currentPoint,shiftKey:!!Ha,dataTransfer:null!=
(Sa=null==ta?void 0:ta.clipboardData)?Sa:void 0})});gb(this,"cut",()=>{this.copy();this.api.deleteShapes()});gb(this,"drop",(ta,Ha)=>{this.notify("drop",{dataTransfer:ta,point:Ha?this.viewport.getPagePoint(Ha):cf.getBoundsCenter(this.viewport.currentView)})});gb(this,"selectTool",(ta,Ha={})=>{this.readOnly&&!["select","move"].includes(ta)||this.transition(ta,Ha)});gb(this,"editingId");gb(this,"setEditingShape",ta=>{this.editingId="string"===typeof ta?ta:null==ta?void 0:ta.id;return this});gb(this,
"clearEditingState",()=>{this.selectedTool.transition("idle");return this.setEditingShape()});gb(this,"hoveredId");gb(this,"setHoveredShape",ta=>{this.hoveredId="string"===typeof ta?ta:null==ta?void 0:ta.id;return this});gb(this,"selectedIds",new Set);gb(this,"selectedShapes",new Set);gb(this,"selectionRotation",0);gb(this,"setSelectedShapes",ta=>{var Ha;const {selectedIds:Sa,selectedShapes:Za}=this;Sa.clear();Za.clear();ta[0]&&"string"===typeof ta[0]?ta.forEach(ib=>Sa.add(ib)):ta.forEach(ib=>Sa.add(ib.id));
const fb=this.currentPage.shapes.filter(ib=>Sa.has(ib.id));fb.forEach(ib=>Za.add(ib));this.selectionRotation=1===fb.length?null!=(Ha=fb[0].props.rotation)?Ha:0:0;0===ta.length&&this.setEditingShape();return this});gb(this,"erasingIds",new Set);gb(this,"erasingShapes",new Set);gb(this,"setErasingShapes",ta=>{const {erasingIds:Ha,erasingShapes:Sa}=this;Ha.clear();Sa.clear();ta[0]&&"string"===typeof ta[0]?ta.forEach(Za=>Ha.add(Za)):ta.forEach(Za=>Ha.add(Za.id));this.currentPage.shapes.filter(Za=>Ha.has(Za.id)).forEach(Za=>
Sa.add(Za));return this});gb(this,"bindingIds");gb(this,"setBindingShapes",ta=>{this.bindingIds=ta;return this});gb(this,"clearBindingShape",()=>this.setBindingShapes());gb(this,"createNewLineBinding",(ta,Ha)=>{ta="string"===typeof ta?this.getShapeById(ta):ta;Ha="string"===typeof Ha?this.getShapeById(Ha):Ha;if((null==ta?0:ta.canBind)&&(null==Ha?0:Ha.canBind)&&(Ha=Gc(ta,Ha))){const [Sa,Za]=Ha;this.createShapes([Sa]);this.currentPage.updateBindings(Object.fromEntries(Za.map(fb=>[fb.id,fb])));this.persist();
return!0}return!1});gb(this,"brush");gb(this,"setBrush",ta=>{this.brush=ta;return this});gb(this,"setCamera",(ta,Ha)=>{this.viewport.update({point:ta,zoom:Ha});return this});gb(this,"getPagePoint",ta=>{const {camera:Ha}=this.viewport;return qd.sub(qd.div(ta,Ha.zoom),Ha.point)});gb(this,"getScreenPoint",ta=>{const {camera:Ha}=this.viewport;return qd.mul(qd.add(ta,Ha.point),Ha.zoom)});gb(this,"Shapes",new Map);gb(this,"registerShapes",ta=>{ta.forEach(Ha=>{if("group"===Ha.id){const Sa=this;Ha.prototype.getShapes=
function(){var Za,fb;return null!=(fb=null==(Za=this.props.children)?void 0:Za.map(ib=>Sa.getShapeById(ib)).filter(Boolean))?fb:[]}}return this.Shapes.set(Ha.id,Ha)})});gb(this,"deregisterShapes",ta=>{ta.forEach(Ha=>this.Shapes.delete(Ha.id))});gb(this,"getShapeClass",ta=>{if(!ta)throw Error("No shape type provided.");const Ha=this.Shapes.get(ta);if(!Ha)throw Error(`Could not find shape class for ${ta}`);return Ha});gb(this,"wrapUpdate",ta=>{ed(()=>{const Ha=!this.history.isPaused;Ha&&this.history.pause();
ta();Ha&&(this.history.resume(),this.persist())})});gb(this,"subscriptions",new Set([]));gb(this,"subscribe",(ta,Ha)=>{if(void 0===Ha)throw Error("Callback is required.");const Sa={event:ta,callback:Ha};this.subscriptions.add(Sa);return()=>this.unsubscribe(Sa)});gb(this,"unsubscribe",ta=>{this.subscriptions.delete(ta);return this});gb(this,"notify",(ta,Ha)=>{this.subscriptions.forEach(Sa=>{Sa.event===ta&&Sa.callback(this,Ha)});return this});gb(this,"onTransition",()=>{});gb(this,"onPointerDown",(ta,
Ha)=>{if(!this.editingShape&&1===Ha.button&&!this.isIn("move"))this.temporaryTransitionToMove(Ha);else if(2===Ha.button&&!this.editingShape)Ha.preventDefault(),this.transition("select");else if("clientX"in Ha)this.inputs.onPointerDown([...this.viewport.getPagePoint([Ha.clientX,Ha.clientY]),Ha.pressure],Ha)});gb(this,"onPointerUp",(ta,Ha)=>{if(!this.editingShape&&1===Ha.button&&this.isIn("move"))this.selectedTool.transition("idle",{exit:!0}),Ha.stopPropagation(),Ha.preventDefault();else if("clientX"in
Ha)this.inputs.onPointerUp([...this.viewport.getPagePoint([Ha.clientX,Ha.clientY]),Ha.pressure],Ha)});gb(this,"onPointerMove",(ta,Ha)=>{if("clientX"in Ha)this.inputs.onPointerMove([...this.viewport.getPagePoint([Ha.clientX,Ha.clientY]),Ha.pressure],Ha)});gb(this,"onKeyDown",(ta,Ha)=>{if(this.editingShape||" "!==Ha.key||this.isIn("move"))this.inputs.onKeyDown(Ha);else this.temporaryTransitionToMove(Ha)});gb(this,"onKeyUp",(ta,Ha)=>{if(!this.editingShape&&" "===Ha.key&&this.isIn("move"))this.selectedTool.transition("idle",
{exit:!0}),Ha.stopPropagation(),Ha.preventDefault();else this.inputs.onKeyUp(Ha)});gb(this,"onPinchStart",(ta,Ha)=>{this.inputs.onPinchStart([...this.viewport.getPagePoint(ta.point),.5],Ha)});gb(this,"onPinch",(ta,Ha)=>{this.inputs.onPinch([...this.viewport.getPagePoint(ta.point),.5],Ha)});gb(this,"onPinchEnd",(ta,Ha)=>{this.inputs.onPinchEnd([...this.viewport.getPagePoint(ta.point),.5],Ha)});this._states=[Et,Ft];this.readOnly=G;this.history.pause();this.states&&0<this.states.length&&(this.registerStates(this.states),
G=null!=(fa=this.initial)?fa:this.states[0].id,fa=this.children.get(G))&&(this.currentState=fa,null==(na=this.currentState)?void 0:na._events.onEnter({fromId:"initial"}));d&&this.registerShapes(d);k&&this.registerTools(k);this.history.resume();a&&this.history.deserialize(a);this.api=new yE(this);Hf(this);this.notify("mount",null)}loadDocumentModel(a){this.history.deserialize(a);a.assets&&0<a.assets.length&&this.addAssets(a.assets);return this}get serialized(){return{}}get currentPageId(){return this.pages.keys().next().value}get currentPage(){return this.getPageById(this.currentPageId)}addPages(a){a.forEach(d=>
this.pages.set(d.id,d));this.persist();return this}removePages(a){a.forEach(d=>this.pages.delete(d.id));this.persist();return this}shapesInGroups(a=this.shapes){return a.flatMap(d=>d.props.children).filter(Zf).map(d=>this.getShapeById(d)).filter(Zf)}getParentGroup(a){return this.shapes.find(d=>{var k;return null==(k=d.props.children)?void 0:k.includes(a.id)})}addAssets(a){a.forEach(d=>this.assets[d.id]=d);return this}removeAssets(a){"string"===typeof a[0]?a.forEach(d=>delete this.assets[d]):a.forEach(d=>
delete this.assets[d.id]);this.persist();return this}getCleanUpAssets(){const a=new Set;this.pages.forEach(d=>d.shapes.forEach(k=>{k.props.assetId&&this.assets[k.props.assetId]&&a.add(this.assets[k.props.assetId])}));return Array.from(a)}createAssets(a){this.addAssets(a);this.notify("create-assets",{assets:a});this.persist();return this}get selectedTool(){return this.currentState}registerTools(a){this.Tools=a;return this.registerStates(a)}get editingShape(){const {editingId:a,currentPage:d}=this;
return a?d.shapes.find(k=>k.id===a):void 0}get hoveredShape(){const {hoveredId:a,currentPage:d}=this;return a?d.shapes.find(k=>k.id===a):void 0}get hoveredGroup(){const {hoveredShape:a}=this;return a?this.shapes.find(d=>{var k;return"group"===d.type&&(null==(k=d.props.children)?void 0:k.includes(a.id))}):void 0}get selectedShapesArray(){const {selectedShapes:a,selectedTool:d}=this;return"select"!==d.id?[]:Array.from(a.values())}get allSelectedShapes(){return new Set(this.allSelectedShapesArray)}get allSelectedShapesArray(){const {selectedShapesArray:a}=
this;return[...(new Set([...a,...this.shapesInGroups(a)]))]}setSelectionRotation(a){this.selectionRotation=a}get erasingShapesArray(){return Array.from(this.erasingShapes.values())}get bindingShapes(){var a;const d=1===this.selectedShapesArray.length?this.selectedShapesArray.flatMap(G=>{var fa;return Object.values(null!=(fa=G.props.handles)?fa:{})}).flatMap(G=>G.bindingId).filter(Zf).flatMap(G=>{var fa,na;return[null==(fa=this.currentPage.bindings[G])?void 0:fa.fromId,null==(na=this.currentPage.bindings[G])?
void 0:na.toId]}).filter(Zf):[],k=[...(null!=(a=this.bindingIds)?a:[]),...d];return k?this.currentPage.shapes.filter(G=>null==k?void 0:k.includes(G.id)):void 0}get currentGrid(){const {zoom:a}=this.viewport.camera;return.15>a?128:1>a?32:8}get shapes(){const {currentPage:{shapes:a}}=this;return Array.from(a.values())}get shapesInViewport(){const {selectedShapes:a,currentPage:d,viewport:{currentView:k}}=this;return d.shapes.filter(G=>!G.canUnmount||a.has(G)||cf.boundsContain(k,G.rotatedBounds)||cf.boundsCollide(k,
G.rotatedBounds))}get selectionDirectionHint(){const {selectionBounds:a,viewport:{currentView:d}}=this;if(a&&!cf.boundsContain(d,a)&&!cf.boundsCollide(d,a)){var k=cf.getBoundsCenter(a);return qd.clampV([(k[0]-d.minX-d.width/2)/d.width,(k[1]-d.minY-d.height/2)/d.height],-1,1)}}get selectionBounds(){const {selectedShapesArray:a}=this;if(0!==a.length)return 1===a.length?Re(Ud({},a[0].bounds),{rotation:a[0].props.rotation}):cf.getCommonBounds(this.selectedShapesArray.map(d=>d.rotatedBounds))}get showSelection(){var a;
const {selectedShapesArray:d}=this;return this.isIn("select")&&!this.isInAny("select.translating","select.pinching","select.rotating")&&(1===d.length&&!(null==(a=d[0])?0:a.hideSelection)||1<d.length)}get showSelectionDetail(){return this.isIn("select")&&!this.isInAny("select.translating","select.pinching")&&0<this.selectedShapes.size&&!this.selectedShapesArray.every(a=>a.hideSelectionDetail)&&!1}get showSelectionRotation(){return this.showSelectionDetail&&this.isInAny("select.rotating","select.pointingRotateHandle")}get showContextBar(){const {selectedShapesArray:a}=
this;return this.isInAny("select.idle","select.hoveringSelectionHandle")&&!this.isIn("select.contextMenu")&&0<a.length&&!this.readOnly&&!a.every(d=>d.hideContextBar)}get showRotateHandles(){const {selectedShapesArray:a}=this;return this.isInAny("select.idle","select.hoveringSelectionHandle","select.pointingRotateHandle","select.pointingResizeHandle")&&0<a.length&&!this.readOnly&&!a.some(d=>d.hideRotateHandle)}get showResizeHandles(){const {selectedShapesArray:a}=this;return this.isInAny("select.idle",
"select.hoveringSelectionHandle","select.pointingShape","select.pointingSelectedShape","select.pointingRotateHandle","select.pointingResizeHandle")&&1===a.length&&!this.readOnly&&!a.every(d=>d.hideResizeHandles)}temporaryTransitionToMove(a){a.stopPropagation();a.preventDefault();this.transition("move",{prevTool:this.selectedTool});this.selectedTool.transition("idleHold")}};gb($g,"id","app");gb($g,"initial","select");Nd([kf],$g.prototype,"serialized",1);Nd([ze],$g.prototype,"pages",2);Nd([kf],$g.prototype,
"currentPageId",1);Nd([kf],$g.prototype,"currentPage",1);Nd([hg],$g.prototype,"addPages",1);Nd([hg],$g.prototype,"removePages",1);Nd([hg],$g.prototype,"createShapes",2);Nd([hg],$g.prototype,"updateShapes",2);Nd([hg],$g.prototype,"deleteShapes",2);Nd([ze],$g.prototype,"assets",2);Nd([hg],$g.prototype,"addAssets",1);Nd([hg],$g.prototype,"removeAssets",1);Nd([hg],$g.prototype,"removeUnusedAssets",2);Nd([kf],$g.prototype,"selectedTool",1);Nd([ze],$g.prototype,"editingId",2);Nd([kf],$g.prototype,"editingShape",
1);Nd([hg],$g.prototype,"setEditingShape",2);Nd([ze],$g.prototype,"hoveredId",2);Nd([kf],$g.prototype,"hoveredShape",1);Nd([kf],$g.prototype,"hoveredGroup",1);Nd([hg],$g.prototype,"setHoveredShape",2);Nd([ze],$g.prototype,"selectedIds",2);Nd([ze],$g.prototype,"selectedShapes",2);Nd([ze],$g.prototype,"selectionRotation",2);Nd([kf],$g.prototype,"selectedShapesArray",1);Nd([kf],$g.prototype,"allSelectedShapes",1);Nd([kf],$g.prototype,"allSelectedShapesArray",1);Nd([hg],$g.prototype,"setSelectedShapes",
2);Nd([hg],$g.prototype,"setSelectionRotation",1);Nd([ze],$g.prototype,"erasingIds",2);Nd([ze],$g.prototype,"erasingShapes",2);Nd([kf],$g.prototype,"erasingShapesArray",1);Nd([hg],$g.prototype,"setErasingShapes",2);Nd([ze],$g.prototype,"bindingIds",2);Nd([kf],$g.prototype,"bindingShapes",1);Nd([hg],$g.prototype,"setBindingShapes",2);Nd([hg],$g.prototype,"createNewLineBinding",2);Nd([ze],$g.prototype,"brush",2);Nd([hg],$g.prototype,"setBrush",2);Nd([hg],$g.prototype,"setCamera",2);Nd([kf],$g.prototype,
"currentGrid",1);Nd([kf],$g.prototype,"shapes",1);Nd([kf],$g.prototype,"shapesInViewport",1);Nd([kf],$g.prototype,"selectionDirectionHint",1);Nd([kf],$g.prototype,"selectionBounds",1);Nd([kf],$g.prototype,"showSelection",1);Nd([kf],$g.prototype,"showSelectionDetail",1);Nd([kf],$g.prototype,"showSelectionRotation",1);Nd([kf],$g.prototype,"showContextBar",1);Nd([kf],$g.prototype,"showRotateHandles",1);Nd([kf],$g.prototype,"showResizeHandles",1);var zE=Function.prototype.toString,Dx=Object.create,AE=
Object.prototype.toString,BE=function(){function a(){this._keys=[];this._values=[]}a.prototype.has=function(d){return!!~this._keys.indexOf(d)};a.prototype.get=function(d){return this._values[this._keys.indexOf(d)]};a.prototype.set=function(d,k){this._keys.push(d);this._values.push(k)};return a}(),CE="undefined"!==typeof WeakMap?Rd:Pc,DE="g"===/test/g.flags?Oe:Ie,EE="undefined"!==typeof Symbol?Me:Ye,FE=Object.defineProperty,GE=Object.getOwnPropertyDescriptor,xA=Object.getOwnPropertyNames,Ex=Object.getOwnPropertySymbols,
yA=Object.prototype,zA=yA.hasOwnProperty,HE=yA.propertyIsEnumerable,AA="function"===typeof Ex,IE=AA?Ff:xA,JE=Array.isArray,Fx=Object.assign,KE=Object.getPrototypeOf,BA={array:function(a,d){var k=new d.Constructor;d.cache.set(a,k);for(var G=0,fa=a.length;G<fa;++G)k[G]=d.copier(a[G],d);return k},arrayBuffer:function(a,d){return a.slice(0)},blob:function(a,d){return a.slice(0,a.size,a.type)},dataView:function(a,d){return new d.Constructor(a.buffer.slice(0))},date:function(a,d){return new d.Constructor(a.getTime())},
error:Og,map:jg,object:AA?tg:Jf,regExp:function(a,d){d=new d.Constructor(a.source,DE(a));d.lastIndex=a.lastIndex;return d},set:pi},LE=Fx({},BA,{array:function(a,d){var k=new d.Constructor;d.cache.set(a,k);return If(a,k,d)},map:function(a,d){return If(a,jg(a,d),d)},object:function(a,d){var k=zd(d.prototype);d.cache.set(a,k);return If(a,k,d)},set:function(a,d){return If(a,pi(a,d),d)}});ji(Fx({},LE,{}));var ME=ji({}),NE=$e(kt()),OE=$e(nr()),Js=ME,Do=class{static insertTextFirefox(a,d){a.setRangeText(d,
a.selectionStart||0,a.selectionEnd||0,"end");a.dispatchEvent(new InputEvent("input",{data:d,inputType:"insertText",isComposing:!1}))}static insert(a,d){const k=a.ownerDocument,G=k.activeElement;G!==a&&a.focus();k.execCommand("insertText",!1,d)||Do.insertTextFirefox(a,d);G===k.body?a.blur():G instanceof HTMLElement&&G!==a&&G.focus()}static set(a,d){a.select();Do.insert(a,d)}static getSelection(a){const {selectionStart:d,selectionEnd:k}=a;return a.value.slice(d?d:void 0,k?k:void 0)}static wrapSelection(a,
d,k){const {selectionStart:G,selectionEnd:fa}=a,na=Do.getSelection(a);Do.insert(a,d+na+(null!=k?k:d));a.selectionStart=(G||0)+d.length;a.selectionEnd=(fa||0)+d.length}static replace(a,d,k){let G=0;a.value.replace(d,(...fa)=>{const na=G+fa[fa.length-2],ta=fa[0].length;a.selectionStart=na;a.selectionEnd=na+ta;fa="string"===typeof k?k:k(...fa);Do.insert(a,fa);a.selectionStart=na;G+=fa.length-ta;return fa})}static findLineEnd(a,d){const k=a.lastIndexOf("\n",d-1)+1;return"\t"!==a.charAt(k)?d:k+1}static indent(a){var d;
const {selectionStart:k,selectionEnd:G,value:fa}=a;var na=fa.slice(k,G);if((na=null==(d=/\n/g.exec(na))?void 0:d.length)&&0<na){d=fa.lastIndexOf("\n",k-1)+1;var ta=a.value.slice(d,G-1);na=ta.replace(/^|\n/g,`$&${Do.INDENT}`);ta=na.length-ta.length;a.setSelectionRange(d,G-1);Do.insert(a,na);a.setSelectionRange(k+1,G+ta)}else Do.insert(a,Do.INDENT)}static unindent(a){const {selectionStart:d,selectionEnd:k,value:G}=a;var fa=G.lastIndexOf("\n",d-1)+1;const na=Do.findLineEnd(G,k);var ta=a.value.slice(fa,
na);const Ha=ta.replace(/(^|\n)(\t| {1,2})/g,"$1");ta=ta.length-Ha.length;a.setSelectionRange(fa,na);Do.insert(a,Ha);fa=(fa=/\t| {1,2}/.exec(G.slice(fa,d)))?fa[0].length:0;a.setSelectionRange(d-fa,Math.max(d-fa,k-ta))}static normalizeText(a){return a.replace(Do.fixNewLines,"\n")}},It=Do;gb(It,"fixNewLines",/\r?\n|\r/g);gb(It,"INDENT"," ");var Dr;"undefined"!==typeof window&&(Dr=Bk());var Gx=new Map,CA=ih()?"⌘":"ctrl",PE=class extends $g{},DA=$e(ba(22)),QE=()=>{};/^((?!chrome|android).)*safari/i.test(navigator.userAgent);
var EA=$e(ba(22)),Hx={},Ku=$e(ba(22)),RE=a=>{for(a=a.parentElement;a&&a!==document.body;){const {overflowY:d}=window.getComputedStyle(a);if(a.scrollHeight>a.clientHeight&&("auto"===d||"scroll"===d||"overlay"===d))return a;a=a.parentElement}return document},Ix=$e(ba(22)),Jx=new Map,SE={accent:"rgb(255, 0, 0)",brushFill:"var(--ls-scrollbar-background-color, rgba(0, 0, 0, .05))",brushStroke:"var(--ls-scrollbar-thumb-hover-color, rgba(0, 0, 0, .05))",selectStroke:"var(--color-selectedFill)",selectFill:"rgba(65, 132, 244, 0.05)",
binding:"rgba(65, 132, 244, 0.5)",background:"var(--ls-primary-background-color)",foreground:"var(--ls-primary-text-color)",grid:"var(--ls-quaternary-background-color)"},TE=((a,...d)=>a.reduce((k,G,fa)=>k+G+(fa<d.length?d[fa]:""),""))`
.tl-container {
--tl-zoom: 1;
--tl-scale: calc(1 / var(--tl-zoom));
--tl-padding: 64px;
--tl-shadow-color: 0deg 0% 0%;
--tl-binding-distance: ${4}px;
--tl-shadow-elevation-low: 0px 0.4px 0.5px hsl(var(--tl-shadow-color) / 0.04),
0px 0.6px 0.8px -0.7px hsl(var(--tl-shadow-color) / 0.06),
0.1px 1.2px 1.5px -1.4px hsl(var(--tl-shadow-color) / 0.08);
--tl-shadow-elevation-medium: 0px 0.4px 0.5px hsl(var(--tl-shadow-color) / 0.04),
0.1px 1.3px 1.7px -0.5px hsl(var(--tl-shadow-color) / 0.06),
0.1px 2.8px 3.6px -1px hsl(var(--tl-shadow-color) / 0.07),
0.3px 6.1px 7.8px -1.4px hsl(var(--tl-shadow-color) / 0.09);
--tl-shadow-elevation-high: 0px 0.4px 0.5px hsl(var(--tl-shadow-color) / 0.04),
0.1px 2.3px 3px -0.2px hsl(var(--tl-shadow-color) / 0.05),
0.2px 4.1px 5.3px -0.5px hsl(var(--tl-shadow-color) / 0.06),
0.4px 6.6px 8.5px -0.7px hsl(var(--tl-shadow-color) / 0.07),
0.6px 10.3px 13.2px -1px hsl(var(--tl-shadow-color) / 0.08),
0.9px 16px 20.6px -1.2px hsl(var(--tl-shadow-color) / 0.09),
1.3px 24.3px 31.2px -1.4px hsl(var(--tl-shadow-color) / 0.1);
box-sizing: border-box;
position: relative;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
max-width: 100%;
max-height: 100%;
box-sizing: border-box;
padding: 0px;
margin: 0px;
outline: none;
z-index: 100;
user-select: none;
touch-action: none;
overscroll-behavior: none;
background-color: var(--tl-background);
cursor: inherit;
box-sizing: border-box;
color: var(--tl-foreground);
-webkit-user-select: none;
-webkit-user-drag: none;
}
.tl-overlay {
background: none;
fill: transparent;
position: absolute;
width: 100%;
height: 100%;
touch-action: none;
pointer-events: none;
}
.tl-snap-line {
stroke: var(--tl-accent);
stroke-width: calc(1px * var(--tl-scale));
}
.tl-snap-point {
stroke: var(--tl-accent);
stroke-width: calc(1px * var(--tl-scale));
}
.tl-canvas {
position: absolute;
width: 100%;
height: 100%;
touch-action: none;
pointer-events: all;
overflow: clip;
outline: none;
}
.tl-layer {
position: absolute;
top: 0px;
left: 0px;
height: 0px;
width: 0px;
contain: layout style size;
}
.tl-absolute {
position: absolute;
top: 0px;
left: 0px;
transform-origin: center center;
contain: layout style size;
}
.tl-positioned {
position: absolute;
transform-origin: center center;
pointer-events: none;
display: flex;
align-items: center;
justify-content: center;
contain: layout style size;
}
.tl-positioned-svg {
width: 100%;
height: 100%;
overflow: hidden;
contain: layout style size;
pointer-events: none;
}
.tl-positioned-div {
position: relative;
width: 100%;
height: 100%;
padding: var(--tl-padding);
contain: layout style size;
}
.tl-positioned-inner {
position: relative;
width: 100%;
height: 100%;
}
.tl-counter-scaled {
transform: scale(var(--tl-scale));
}
.tl-dashed {
stroke-dasharray: calc(2px * var(--tl-scale)), calc(2px * var(--tl-scale));
}
.tl-transparent {
fill: transparent;
stroke: transparent;
}
.tl-corner-handle {
stroke: var(--tl-selectStroke);
fill: var(--tl-background);
stroke-width: calc(1.5px * var(--tl-scale));
}
.tl-rotate-handle {
stroke: var(--tl-selectStroke);
fill: var(--tl-background);
stroke-width: calc(1.5px * var(--tl-scale));
}
.tl-user {
left: -4px;
top: -4px;
height: 8px;
width: 8px;
border-radius: 100%;
pointer-events: none;
}
.tl-indicator {
fill: transparent;
stroke-width: calc(1.5px * var(--tl-scale));
pointer-events: none;
}
.tl-indicator-container {
transform-origin: 0 0;
fill: transparent;
stroke-width: calc(1.5px * var(--tl-scale));
pointer-events: none;
}
.tl-user-indicator-bounds {
border-style: solid;
border-width: calc(1px * var(--tl-scale));
}
.tl-selected {
stroke: var(--tl-selectStroke);
}
.tl-hovered {
stroke: var(--tl-selectStroke);
}
.tl-clone-target {
pointer-events: all;
}
.tl-clone-target:hover .tl-clone-button {
opacity: 1;
}
.tl-clone-button-target {
cursor: pointer;
pointer-events: all;
}
.tl-clone-button-target:hover .tl-clone-button {
fill: var(--tl-selectStroke);
}
.tl-clone-button {
opacity: 0;
r: calc(8px * var(--tl-scale));
stroke-width: calc(1.5px * var(--tl-scale));
stroke: var(--tl-selectStroke);
fill: var(--tl-background);
}
.tl-bounds {
pointer-events: none;
contain: layout style size;
}
.tl-bounds-bg {
stroke: none;
fill: var(--tl-selectFill);
pointer-events: all;
contain: layout style size;
}
.tl-bounds-fg {
fill: transparent;
stroke: var(--tl-selectStroke);
stroke-width: calc(1.5px * var(--tl-scale));
}
.tl-brush {
fill: var(--tl-brushFill);
stroke: var(--tl-brushStroke);
stroke-width: calc(1px * var(--tl-scale));
pointer-events: none;
}
.tl-dot {
fill: var(--tl-background);
stroke: var(--tl-foreground);
stroke-width: 2px;
}
.tl-handle {
fill: var(--tl-background);
stroke: var(--tl-selectStroke);
stroke-width: 1.5px;
pointer-events: none;
}
.tl-handle-bg {
fill: transparent;
stroke: none;
r: calc(16px / max(1, var(--tl-zoom)));
pointer-events: all;
cursor: grab;
}
.tl-handle-bg:active {
pointer-events: all;
fill: none;
}
.tl-handle-bg:hover {
cursor: grab;
fill: var(--tl-selectFill);
}
.tl-binding-indicator {
fill: transparent;
stroke: var(--tl-binding);
}
.tl-centered {
display: grid;
place-content: center;
place-items: center;
}
.tl-centered > * {
grid-column: 1;
grid-row: 1;
}
.tl-centered-g {
transform: translate(var(--tl-padding), var(--tl-padding));
}
.tl-current-parent > *[data-shy='true'] {
opacity: 1;
}
.tl-binding {
fill: none;
stroke: var(--tl-selectStroke);
stroke-width: calc(2px * var(--tl-scale));
}
.tl-counter-scaled-positioned {
position: absolute;
top: 0;
left: 0;
pointer-events: none;
padding: 0;
contain: layout style size;
}
.tl-fade-in {
opacity: 1;
transition-timing-function: ease-in-out;
transition-property: opacity;
transition-duration: 0.12s;
transition-delay: 0;
}
.tl-fade-out {
opacity: 0;
transition-timing-function: ease-out;
transition-property: opacity;
transition-duration: 0.12s;
transition-delay: 0;
}
.tl-counter-scaled-positioned > .tl-positioned-div {
user-select: none;
padding: 64px;
}
.tl-context-bar > * {
grid-column: 1;
grid-row: 1;
}
.tl-bounds-detail {
padding: 2px 3px;
border-radius: 1px;
white-space: nowrap;
width: fit-content;
text-align: center;
font-size: 12px;
font-weight: 500;
background-color: var(--tl-selectStroke);
color: var(--tl-background);
}
.tl-grid-canvas {
position: absolute;
touch-action: none;
pointer-events: none;
user-select: none;
}
.tl-grid {
position: absolute;
width: 100%;
height: 100%;
touch-action: none;
pointer-events: none;
user-select: none;
}
.tl-grid-dot {
fill: var(--tl-grid);
}
.tl-html-canvas {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
zindex: 20000;
pointer-events: none;
border: 2px solid red;
}
.tl-direction-indicator {
z-index: 100000;
position: absolute;
top: 0px;
left: 0px;
fill: var(--tl-selectStroke);
}
`,FA=$e(ba(22)),GA=$e(ba(22)),Kx={},pk={toVector(a,d){void 0===a&&(a=d);return Array.isArray(a)?a:[a,a]},add(a,d){return[a[0]+d[0],a[1]+d[1]]},sub(a,d){return[a[0]-d[0],a[1]-d[1]]},addTo(a,d){a[0]+=d[0];a[1]+=d[1]},subTo(a,d){a[0]-=d[0];a[1]-=d[1]}},HA={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}},UE=["enter","leave"],VE=["gotpointercapture","lostpointercapture"],
IA=class{constructor(a,d,k){this.ctrl=a;this.args=d;this.key=k;this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(a){this.ctrl.state[this.key]=a}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const {state:a,
shared:d,ingKey:k,args:G}=this;d[k]=a._active=a.active=a._blocked=a._force=!1;a._step=[!1,!1];a.intentional=!1;a._movement=[0,0];a._distance=[0,0];a._direction=[0,0];a._delta=[0,0];a._bounds=[[-Infinity,Infinity],[-Infinity,Infinity]];a.args=G;a.axis=void 0;a.memo=void 0;a.elapsedTime=0;a.direction=[0,0];a.distance=[0,0];a.overflow=[0,0];a._movementBound=[!1,!1];a.velocity=[0,0];a.movement=[0,0];a.delta=[0,0];a.timeStamp=0}start(a){const d=this.state,k=this.config;d._active||(this.reset(),this.computeInitial(),
d._active=!0,d.target=a.target,d.currentTarget=a.currentTarget,d.lastOffset=k.from?Jg(k.from,d):d.offset,d.offset=d.lastOffset);d.startTime=d.timeStamp=a.timeStamp}computeValues(a){const d=this.state;d._values=a;d.values=this.config.transform(a)}computeInitial(){const a=this.state;a._initial=a._values;a.initial=a.values}compute(a){const {state:d,config:k,shared:G}=this;d.args=this.args;var fa=0;if(a){d.event=a;k.preventDefault&&a.cancelable&&d.event.preventDefault();d.type=a.type;G.touches=this.ctrl.pointerIds.size||
this.ctrl.touchIds.size;G.locked=!!document.pointerLockElement;fa=Object;var na=fa.assign,ta={};"buttons"in a&&(ta.buttons=a.buttons);if("shiftKey"in a){const {shiftKey:Ec,altKey:Ic,metaKey:nd,ctrlKey:Bd}=a;Object.assign(ta,{shiftKey:Ec,altKey:Ic,metaKey:nd,ctrlKey:Bd})}na.call(fa,G,ta);G.down=G.pressed=1===G.buttons%2||0<G.touches;fa=a.timeStamp-d.timeStamp;d.timeStamp=a.timeStamp;d.elapsedTime=d.timeStamp-d.startTime}d._active&&(na=d._delta.map(Math.abs),pk.addTo(d._distance,na));this.axisIntent&&
this.axisIntent(a);const [Ha,Sa]=d._movement,[Za,fb]=k.threshold,{_step:ib,values:Bb}=d;k.hasCustomTransform?(!1===ib[0]&&(ib[0]=Math.abs(Ha)>=Za&&Bb[0]),!1===ib[1]&&(ib[1]=Math.abs(Sa)>=fb&&Bb[1])):(!1===ib[0]&&(ib[0]=Math.abs(Ha)>=Za&&Math.sign(Ha)*Za),!1===ib[1]&&(ib[1]=Math.abs(Sa)>=fb&&Math.sign(Sa)*fb));d.intentional=!1!==ib[0]||!1!==ib[1];if(d.intentional){na=[0,0];if(k.hasCustomTransform){const [Ec,Ic]=Bb;na[0]=!1!==ib[0]?Ec-ib[0]:0;na[1]=!1!==ib[1]?Ic-ib[1]:0}else na[0]=!1!==ib[0]?Ha-ib[0]:
0,na[1]=!1!==ib[1]?Sa-ib[1]:0;this.restrictToAxis&&!d._blocked&&this.restrictToAxis(na);ta=d.offset;var Ob=d._active&&!d._blocked||d.active;Ob&&(d.first=d._active&&!d.active,d.last=!d._active&&d.active,d.active=G[this.ingKey]=d._active,a&&(d.first&&("bounds"in k&&(d._bounds=Jg(k.bounds,d)),this.setup&&this.setup()),d.movement=na,this.computeOffset()));var [Fb,cc]=d.offset,[[oc,Xb],[hc,ec]]=d._bounds;d.overflow=[Fb<oc?-1:Fb>Xb?1:0,cc<hc?-1:cc>ec?1:0];d._movementBound[0]=d.overflow[0]?!1===d._movementBound[0]?
d._movement[0]:d._movementBound[0]:!1;d._movementBound[1]=d.overflow[1]?!1===d._movementBound[1]?d._movement[1]:d._movementBound[1]:!1;d.offset=oh(d._bounds,d.offset,d._active?k.rubberband||[0,0]:[0,0]);d.delta=pk.sub(d.offset,ta);this.computeMovement();Ob&&(!d.last||32<fa)&&(d.delta=pk.sub(d.offset,ta),a=d.delta.map(Math.abs),pk.addTo(d.distance,a),d.direction=d.delta.map(Math.sign),d._direction=d._delta.map(Math.sign),!d.first&&0<fa&&(d.velocity=[a[0]/fa,a[1]/fa]))}}emit(){const a=this.state;var d=
this.shared;const k=this.config;a._active||this.clean();if(!a._blocked&&a.intentional||a._force||k.triggerAllEvents)d=this.handler(Pg(Pg(Pg({},d),a),{},{[this.aliasKey]:a.values})),void 0!==d&&(a.memo=d)}clean(){this.eventStore.clean();this.timeoutStore.clean()}},Lu=class extends IA{constructor(...a){super(...a);li(this,"aliasKey","xy")}reset(){super.reset();this.state.axis=void 0}init(){this.state.offset=[0,0];this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=pk.add(this.state.lastOffset,
this.state.movement)}computeMovement(){this.state.movement=pk.sub(this.state.offset,this.state.lastOffset)}axisIntent(a){const d=this.state,k=this.config;!d.axis&&a&&(a="object"===typeof k.axisThreshold?k.axisThreshold[xh(a)]:k.axisThreshold,d.axis=$l(d._movement,a));d._blocked=(k.lockDirection||!!k.axis)&&!d.axis||!!k.axis&&k.axis!==d.axis}restrictToAxis(a){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case "x":a[1]=0;break;case "y":a[0]=0}}},WE=a=>a,JA={enabled(a=!0){return a},
eventOptions(a,d,k){return Pg(Pg({},k.shared.eventOptions),a)},preventDefault(a=!1){return a},triggerAllEvents(a=!1){return a},rubberband(a=0){switch(a){case !0:return[.15,.15];case !1:return[0,0];default:return pk.toVector(a)}},from(a){if("function"===typeof a)return a;if(null!=a)return pk.toVector(a)},transform(a,d,k){a=a||k.shared.transform;this.hasCustomTransform=!!a;return a||WE},threshold(a){return pk.toVector(a,0)}},Ks=Pg(Pg({},JA),{},{axis(a,d,{axis:k}){this.lockDirection="lock"===k;if(!this.lockDirection)return k},
axisThreshold(a=0){return a},bounds(a={}){if("function"===typeof a)return na=>Ks.bounds(a(na));if("current"in a)return()=>a.current;if("function"===typeof HTMLElement&&a instanceof HTMLElement)return a;const {left:d=-Infinity,right:k=Infinity,top:G=-Infinity,bottom:fa=Infinity}=a;return[[d,k],[G,fa]]}}),KA={ArrowRight:(a=1)=>[10*a,0],ArrowLeft:(a=1)=>[-10*a,0],ArrowUp:(a=1)=>[0,-10*a],ArrowDown:(a=1)=>[0,10*a]},XE=class extends Lu{constructor(...a){super(...a);li(this,"ingKey","dragging")}reset(){super.reset();
const a=this.state;a._pointerId=void 0;a._pointerActive=!1;a._keyboardActive=!1;a._preventScroll=!1;a._delayed=!1;a.swipe=[0,0];a.tap=!1;a.canceled=!1;a.cancel=this.cancel.bind(this)}setup(){const a=this.state;if(a._bounds instanceof HTMLElement){const d=a._bounds.getBoundingClientRect(),k=a.currentTarget.getBoundingClientRect();a._bounds=Ks.bounds({left:d.left-k.left+a.offset[0],right:d.right-k.right+a.offset[0],top:d.top-k.top+a.offset[1],bottom:d.bottom-k.bottom+a.offset[1]})}}cancel(){const a=
this.state;a.canceled||(a.canceled=!0,a._active=!1,setTimeout(()=>{this.compute();this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean();this.state._pointerActive=!1;this.state._keyboardActive=!1;super.clean()}pointerDown(a){const d=this.config,k=this.state;if(null==a.buttons||(Array.isArray(d.pointerButtons)?d.pointerButtons.includes(a.buttons):-1===d.pointerButtons||d.pointerButtons===a.buttons)){var G=this.ctrl.setEventIds(a);
d.pointerCapture&&a.target.setPointerCapture(a.pointerId);G&&1<G.size&&k._pointerActive||(this.start(a),this.setupPointer(a),k._pointerId=Zl(a),k._pointerActive=!0,this.computeValues(Ck(a)),this.computeInitial(),d.preventScrollAxis&&"mouse"!==xh(a)?(k._active=!1,this.setupScrollPrevention(a)):0<d.delay?(this.setupDelayTrigger(a),d.triggerAllEvents&&(this.compute(a),this.emit())):this.startPointerDrag(a))}}startPointerDrag(a){const d=this.state;d._active=!0;d._preventScroll=!0;d._delayed=!1;this.compute(a);
this.emit()}pointerMove(a){const d=this.state,k=this.config;if(d._pointerActive&&(d.type!==a.type||a.timeStamp!==d.timeStamp)){var G=Zl(a);if(void 0===d._pointerId||G===d._pointerId)G=Ck(a),document.pointerLockElement===a.target?d._delta=[a.movementX,a.movementY]:(d._delta=pk.sub(G,d._values),this.computeValues(G)),pk.addTo(d._movement,d._delta),this.compute(a),d._delayed&&d.intentional?(this.timeoutStore.remove("dragDelay"),d.active=!1,this.startPointerDrag(a)):k.preventScrollAxis&&!d._preventScroll?
d.axis&&(d.axis===k.preventScrollAxis||"xy"===k.preventScrollAxis?(d._active=!1,this.clean()):(this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(a))):this.emit()}}pointerUp(a){this.ctrl.setEventIds(a);try{this.config.pointerCapture&&a.target.hasPointerCapture(a.pointerId)&&a.target.releasePointerCapture(a.pointerId)}catch(ta){}const d=this.state,k=this.config;if(d._active&&d._pointerActive){var G=Zl(a);if(void 0===d._pointerId||G===d._pointerId){this.state._pointerActive=!1;this.setActive();
this.compute(a);var [fa,na]=d._distance;d.tap=fa<=k.tapsThreshold&&na<=k.tapsThreshold;if(d.tap&&k.filterTaps)d._force=!0;else{const [ta,Ha]=d.direction,[Sa,Za]=d.velocity,[fb,ib]=d.movement,[Bb,Ob]=k.swipe.velocity,[Fb,cc]=k.swipe.distance;d.elapsedTime<k.swipe.duration&&(Math.abs(Sa)>Bb&&Math.abs(fb)>Fb&&(d.swipe[0]=ta),Math.abs(Za)>Ob&&Math.abs(ib)>cc&&(d.swipe[1]=Ha))}this.emit()}}}pointerClick(a){!this.state.tap&&0<a.detail&&(a.preventDefault(),a.stopPropagation())}setupPointer(a){const d=this.config,
k=d.device;d.pointerLock&&a.currentTarget.requestPointerLock();d.pointerCapture||(this.eventStore.add(this.sharedConfig.window,k,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,k,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,k,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(a){this.state._preventScroll&&a.cancelable&&
a.preventDefault()}setupScrollPrevention(a){this.state._preventScroll=!1;"persist"in a&&"function"===typeof a.persist&&a.persist();const d=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",d);this.eventStore.add(this.sharedConfig.window,"touch","cancel",d);this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,a)}setupDelayTrigger(a){this.state._delayed=
!0;this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0];this.startPointerDrag(a)},this.config.delay)}keyDown(a){const d=KA[a.key];if(d){const k=this.state,G=a.shiftKey?10:a.altKey?.1:1;this.start(a);k._delta=d(G);k._keyboardActive=!0;pk.addTo(k._movement,k._delta);this.compute(a);this.emit()}}keyUp(a){a.key in KA&&(this.state._keyboardActive=!1,this.setActive(),this.compute(a),this.emit())}bind(a){const d=this.config.device;a(d,"start",this.pointerDown.bind(this));this.config.pointerCapture&&
(a(d,"change",this.pointerMove.bind(this)),a(d,"end",this.pointerUp.bind(this)),a(d,"cancel",this.pointerUp.bind(this)),a("lostPointerCapture","",this.pointerUp.bind(this)));this.config.keys&&(a("key","down",this.keyDown.bind(this)),a("key","up",this.keyUp.bind(this)));this.config.filterTaps&&a("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}},Ls="undefined"!==typeof window&&window.document&&window.document.createElement;try{var LA="constructor"in GestureEvent}catch(a){LA=!1}var YE=
LA,Mu=Ls&&"ontouchstart"in window||Ls&&1<window.navigator.maxTouchPoints,MA=Ls&&"ontouchstart"in window||Ls&&1<window.navigator.maxTouchPoints,NA=Ls&&"onpointerdown"in window,ZE=Ls&&"exitPointerLock"in window.document,OA={mouse:0,touch:0,pen:8},$E=Pg(Pg({},Ks),{},{device(a,d,{pointer:{touch:k=!1,lock:G=!1,mouse:fa=!1}={}}){this.pointerLock=G&&ZE;return Mu&&k?"touch":this.pointerLock?"mouse":NA&&!fa?"pointer":Mu?"touch":"mouse"},preventScrollAxis(a,d,{preventScroll:k}){this.preventScrollDelay="number"===
typeof k?k:k||void 0===k&&a?250:void 0;if(MA&&!1!==k)return a?a:void 0!==k?"y":void 0},pointerCapture(a,d,{pointer:{capture:k=!0,buttons:G=1,keys:fa=!0}={}}){this.pointerButtons=G;this.keys=fa;return!this.pointerLock&&"pointer"===this.device&&k},threshold(a,d,{filterTaps:k=!1,tapsThreshold:G=3,axis:fa}){a=pk.toVector(a,k?G:fa?1:0);this.filterTaps=k;this.tapsThreshold=G;return a},swipe({velocity:a=.5,distance:d=50,duration:k=250}={}){return{velocity:this.transform(pk.toVector(a)),distance:this.transform(pk.toVector(d)),
duration:k}},delay(a=0){switch(a){case !0:return 180;case !1:return 0;default:return a}},axisThreshold(a){return a?Pg(Pg({},OA),a):OA}}),aF=class extends IA{constructor(...a){super(...a);li(this,"ingKey","pinching");li(this,"aliasKey","da")}init(){this.state.offset=[1,0];this.state.lastOffset=[1,0];this.state._pointerEvents=new Map}reset(){super.reset();const a=this.state;a._touchIds=[];a.canceled=!1;a.cancel=this.cancel.bind(this);a.turns=0}computeOffset(){const {type:a,movement:d,lastOffset:k}=
this.state;this.state.offset="wheel"===a?pk.add(d,k):[(1+d[0])*k[0],d[1]+k[1]]}computeMovement(){const {offset:a,lastOffset:d}=this.state;this.state.movement=[a[0]/d[0],a[1]-d[1]]}axisIntent(){const a=this.state,[d,k]=a._movement;if(!a.axis){const G=30*Math.abs(d)-Math.abs(k);0>G?a.axis="angle":0<G&&(a.axis="scale")}}restrictToAxis(a){this.config.lockDirection&&("scale"===this.state.axis?a[1]=0:"angle"===this.state.axis&&(a[0]=0))}cancel(){const a=this.state;a.canceled||setTimeout(()=>{a.canceled=
!0;a._active=!1;this.compute();this.emit()},0)}touchStart(a){this.ctrl.setEventIds(a);var d=this.state;const k=this.ctrl.touchIds;d._active&&d._touchIds.every(G=>k.has(G))||2>k.size||(this.start(a),d._touchIds=Array.from(k).slice(0,2),d=Zi(a,d._touchIds),this.pinchStart(a,d))}pointerStart(a){if(null==a.buttons||1===a.buttons%2){this.ctrl.setEventIds(a);a.target.setPointerCapture(a.pointerId);var d=this.state,k=d._pointerEvents,G=this.ctrl.pointerIds;d._active&&Array.from(k.keys()).every(fa=>G.has(fa))||
(2>k.size&&k.set(a.pointerId,a),2>d._pointerEvents.size||(this.start(a),d=Om(...Array.from(k.values())),this.pinchStart(a,d)))}}pinchStart(a,d){this.state.origin=d.origin;this.computeValues([d.distance,d.angle]);this.computeInitial();this.compute(a);this.emit()}touchMove(a){if(this.state._active){var d=Zi(a,this.state._touchIds);this.pinchMove(a,d)}}pointerMove(a){var d=this.state._pointerEvents;d.has(a.pointerId)&&d.set(a.pointerId,a);this.state._active&&(d=Om(...Array.from(d.values())),this.pinchMove(a,
d))}pinchMove(a,d){const k=this.state,G=d.angle-k._values[1];let fa=0;270<Math.abs(G)&&(fa+=Math.sign(G));this.computeValues([d.distance,d.angle-360*fa]);k.origin=d.origin;k.turns=fa;k._movement=[k._values[0]/k._initial[0]-1,k._values[1]-k._initial[1]];this.compute(a);this.emit()}touchEnd(a){this.ctrl.setEventIds(a);this.state._active&&this.state._touchIds.some(d=>!this.ctrl.touchIds.has(d))&&(this.state._active=!1,this.compute(a),this.emit())}pointerEnd(a){const d=this.state;this.ctrl.setEventIds(a);
try{a.target.releasePointerCapture(a.pointerId)}catch(k){}d._pointerEvents.has(a.pointerId)&&d._pointerEvents.delete(a.pointerId);d._active&&2>d._pointerEvents.size&&(d._active=!1,this.compute(a),this.emit())}gestureStart(a){a.cancelable&&a.preventDefault();const d=this.state;d._active||(this.start(a),this.computeValues([a.scale,a.rotation]),d.origin=[a.clientX,a.clientY],this.compute(a),this.emit())}gestureMove(a){a.cancelable&&a.preventDefault();if(this.state._active){var d=this.state;this.computeValues([a.scale,
a.rotation]);d.origin=[a.clientX,a.clientY];var k=d._movement;d._movement=[a.scale-1,a.rotation];d._delta=pk.sub(d._movement,k);this.compute(a);this.emit()}}gestureEnd(a){this.state._active&&(this.state._active=!1,this.compute(a),this.emit())}wheel(a){const d=this.config.modifierKey;if(!d||a[d])this.state._active?this.wheelChange(a):this.wheelStart(a),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelStart(a){this.start(a);this.wheelChange(a)}wheelChange(a){"uv"in a||a.cancelable&&a.preventDefault();
const d=this.state;d._delta=[-Qj(a)[1]/100*d.offset[0],0];pk.addTo(d._movement,d._delta);Pm(d);this.state.origin=[a.clientX,a.clientY];this.compute(a);this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(a){const d=this.config.device;d&&(a(d,"start",this[d+"Start"].bind(this)),a(d,"change",this[d+"Move"].bind(this)),a(d,"end",this[d+"End"].bind(this)),a(d,"cancel",this[d+"End"].bind(this)));this.config.pinchOnWheel&&a("wheel","",this.wheel.bind(this),
{passive:!1})}},bF=Pg(Pg({},JA),{},{device(a,d,{shared:k,pointer:{touch:G=!1}={}}){if(k.target&&!Mu&&YE)return"gesture";if(Mu&&G)return"touch";if(MA){if(NA)return"pointer";if(Mu)return"touch"}},bounds(a,d,{scaleBounds:k={},angleBounds:G={}}){const fa=ta=>{ta=Jg(k,ta);ta=Object.assign({},{min:-Infinity,max:Infinity},ta||{});return[ta.min,ta.max]},na=ta=>{ta=Jg(G,ta);ta=Object.assign({},{min:-Infinity,max:Infinity},ta||{});return[ta.min,ta.max]};return"function"!==typeof k&&"function"!==typeof G?[fa(),
na()]:ta=>[fa(ta),na(ta)]},threshold(a,d,k){this.lockDirection="lock"===k.axis;return pk.toVector(a,this.lockDirection?[.1,3]:0)},modifierKey(a){return void 0===a?"ctrlKey":a},pinchOnWheel(a=!0){return a}}),cF=class extends Lu{constructor(...a){super(...a);li(this,"ingKey","moving")}move(a){this.config.mouseOnly&&"mouse"!==a.pointerType||(this.state._active?this.moveChange(a):this.moveStart(a),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(a){this.start(a);this.computeValues(Ck(a));
this.compute(a);this.computeInitial();this.emit()}moveChange(a){if(this.state._active){var d=Ck(a),k=this.state;k._delta=pk.sub(d,k._values);pk.addTo(k._movement,k._delta);this.computeValues(d);this.compute(a);this.emit()}}moveEnd(a){this.state._active&&(this.state._active=!1,this.compute(a),this.emit())}bind(a){a("pointer","change",this.move.bind(this));a("pointer","leave",this.moveEnd.bind(this))}},dF=Pg(Pg({},Ks),{},{mouseOnly:(a=!0)=>a}),eF=class extends Lu{constructor(...a){super(...a);li(this,
"ingKey","scrolling")}scroll(a){this.state._active||this.start(a);this.scrollChange(a);this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(a){a.cancelable&&a.preventDefault();const d=this.state;var k,G;const {scrollX:fa,scrollY:na,scrollLeft:ta,scrollTop:Ha}=a.currentTarget;var Sa=[null!==(k=null!==fa&&void 0!==fa?fa:ta)&&void 0!==k?k:0,null!==(G=null!==na&&void 0!==na?na:Ha)&&void 0!==G?G:0];d._delta=pk.sub(Sa,d._values);pk.addTo(d._movement,d._delta);this.computeValues(Sa);
this.compute(a);this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(a){a("scroll","",this.scroll.bind(this))}},fF=Ks,gF=class extends Lu{constructor(...a){super(...a);li(this,"ingKey","wheeling")}wheel(a){this.state._active||this.start(a);this.wheelChange(a);this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(a){const d=this.state;d._delta=Qj(a);pk.addTo(d._movement,d._delta);Pm(d);this.compute(a);this.emit()}wheelEnd(){this.state._active&&
(this.state._active=!1,this.compute(),this.emit())}bind(a){a("wheel","",this.wheel.bind(this))}},hF=Ks,iF=class extends Lu{constructor(...a){super(...a);li(this,"ingKey","hovering")}enter(a){this.config.mouseOnly&&"mouse"!==a.pointerType||(this.start(a),this.computeValues(Ck(a)),this.compute(a),this.emit())}leave(a){if(!this.config.mouseOnly||"mouse"===a.pointerType){var d=this.state;if(d._active){d._active=!1;var k=Ck(a);d._movement=d._delta=pk.sub(k,d._values);this.computeValues(k);this.compute(a);
d.delta=d.movement;this.emit()}}}bind(a){a("pointer","enter",this.enter.bind(this));a("pointer","leave",this.leave.bind(this))}},jF=Pg(Pg({},Ks),{},{mouseOnly:(a=!0)=>a}),Lx=new Map,Mx=new Map,kF={key:"drag",engine:XE,resolver:$E},lF={key:"hover",engine:iF,resolver:jF},mF={key:"move",engine:cF,resolver:dF},nF={key:"pinch",engine:aF,resolver:bF},oF={key:"scroll",engine:eF,resolver:fF},pF={key:"wheel",engine:gF,resolver:hF},Nx=$e(ba(22)),qF={target(a){if(a)return()=>"current"in a?a.current:a},enabled(a=
!0){return a},window(a=Ls?window:void 0){return a},eventOptions({passive:a=!0,capture:d=!1}={}){return{passive:a,capture:d}},transform(a){return a}},rF=["target","eventOptions","window","enabled","transform"],PA=class{constructor(a,d){li(this,"_listeners",new Set);this._ctrl=a;this._gestureKey=d}add(a,d,k,G,fa){const na=this._listeners,ta=fj(d,k),Ha=Pg(Pg({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),fa);a.addEventListener(ta,G,Ha);const Sa=()=>{a.removeEventListener(ta,
G,Ha);na.delete(Sa)};na.add(Sa);return Sa}clean(){this._listeners.forEach(a=>a());this._listeners.clear()}},sF=class{constructor(){li(this,"_timeouts",new Map)}add(a,d,k=140,...G){this.remove(a);this._timeouts.set(a,window.setTimeout(d,k,...G))}remove(a){(a=this._timeouts.get(a))&&window.clearTimeout(a)}clean(){this._timeouts.forEach(a=>void window.clearTimeout(a));this._timeouts.clear()}},tF=class{constructor(a){li(this,"gestures",new Set);li(this,"_targetEventStore",new PA(this));li(this,"gestureEventStores",
{});li(this,"gestureTimeoutStores",{});li(this,"handlers",{});li(this,"config",{});li(this,"pointerIds",new Set);li(this,"touchIds",new Set);li(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}});a.drag&&hj(this,"drag");a.wheel&&hj(this,"wheel");a.scroll&&hj(this,"scroll");a.move&&hj(this,"move");a.pinch&&hj(this,"pinch");a.hover&&hj(this,"hover")}setEventIds(a){if("touches"in a)return this.touchIds=new Set(al(a));if("pointerId"in a)return"pointerup"===a.type||"pointercancel"===a.type?
this.pointerIds.delete(a.pointerId):"pointerdown"===a.type&&this.pointerIds.add(a.pointerId),this.pointerIds}applyHandlers(a,d){this.handlers=a;this.nativeHandlers=d}applyConfig(a,d){this.config=sj(a,d,this.config)}clean(){this._targetEventStore.clean();for(const a of this.gestures)this.gestureEventStores[a].clean(),this.gestureTimeoutStores[a].clean()}effect(){this.config.shared.target&&this.bind();return()=>this._targetEventStore.clean()}bind(...a){var d=this.config.shared;const k={};let G;if(d.target&&
(G=d.target(),!G))return;if(d.enabled){for(const fa of this.gestures){const na=this.config[fa],ta=QA(k,na.eventOptions,!!G);na.enabled&&(new (Lx.get(fa))(this,a,fa)).bind(ta)}d=QA(k,d.eventOptions,!!G);for(const fa in this.nativeHandlers)d(fa,"",na=>this.nativeHandlers[fa](Pg(Pg({},this.state.shared),{},{event:na,args:a})),void 0,!0)}for(const fa in k)k[fa]=mi(...k[fa]);if(!G)return k;for(const fa in k){const {device:na,capture:ta,passive:Ha}=zf(fa);this._targetEventStore.add(G,na,"",k[fa],{capture:ta,
passive:Ha})}}},QA=(a,d,k)=>(G,fa,na,ta={},Ha=!1)=>{var Sa,Za;const fb=null!==(Sa=ta.capture)&&void 0!==Sa?Sa:d.capture;ta=null!==(Za=ta.passive)&&void 0!==Za?Za:d.passive;G=Ha?G:Nm(G,fa,fb);k&&ta&&(G+="Passive");a[G]=a[G]||[];a[G].push(na)},uF=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/,$v=$e(ba(22)),Ox=$e(ba(22)),RA=$e(ba(22)),SA=$e(ba(22)),vF=$e(ba(22)),wF=$e(ba(22)),xF=$e(ba(22)),yF=$e(ba(22)),zF={none:(a,d)=>"none",["default"]:(a,d)=>"default",pointer:(a,d)=>"pointer",crosshair:(a,d)=>"crosshair",
move:(a,d)=>"move",wait:(a,d)=>"wait",progress:(a,d)=>"progress",grab:(a,d)=>Sj('\x3cpath d\x3d"m13.5557 17.5742c-.098-.375-.196-.847-.406-1.552-.167-.557-.342-.859-.47-1.233-.155-.455-.303-.721-.496-1.181-.139-.329-.364-1.048-.457-1.44-.119-.509.033-.924.244-1.206.253-.339.962-.49 1.357-.351.371.13.744.512.916.788.288.46.357.632.717 1.542.393.992.564 1.918.611 2.231l.085.452c-.001-.04-.043-1.122-.044-1.162-.035-1.029-.06-1.823-.038-2.939.002-.126.064-.587.084-.715.078-.5.305-.8.673-.979.412-.201.926-.215 1.401-.017.423.173.626.55.687 1.022.014.109.094.987.093 1.107-.013 1.025.006 1.641.015 2.174.004.231.003 1.625.017 1.469.061-.656.094-3.189.344-3.942.144-.433.405-.746.794-.929.431-.203 1.113-.07 1.404.243.285.305.446.692.482 1.153.032.405-.019.897-.02 1.245 0 .867-.021 1.324-.037 2.121-.001.038-.015.298.023.182.094-.28.188-.542.266-.745.049-.125.241-.614.359-.859.114-.234.211-.369.415-.688.2-.313.415-.448.668-.561.54-.235 1.109.112 1.301.591.086.215.009.713-.028 1.105-.061.647-.254 1.306-.352 1.648-.128.447-.274 1.235-.34 1.601-.072.394-.234 1.382-.359 1.82-.086.301-.371.978-.652 1.384 0 0-1.074 1.25-1.192 1.812-.117.563-.078.567-.101.965-.024.399.121.923.121.923s-.802.104-1.234.034c-.391-.062-.875-.841-1-1.078-.172-.328-.539-.265-.682-.023-.225.383-.709 1.07-1.051 1.113-.668.084-2.054.03-3.139.02 0 0 .185-1.011-.227-1.358-.305-.26-.83-.784-1.144-1.06l-.832-.921c-.284-.36-.629-1.093-1.243-1.985-.348-.504-1.027-1.085-1.284-1.579-.223-.425-.331-.954-.19-1.325.225-.594.675-.897 1.362-.832.519.05.848.206 1.238.537.225.19.573.534.75.748.163.195.203.276.377.509.23.307.302.459.214.121" fill\x3d"%23fff"/\x3e\x3cg stroke\x3d"%23000" stroke-linecap\x3d"round" stroke-width\x3d".75"\x3e\x3cpath d\x3d"m13.5557 17.5742c-.098-.375-.196-.847-.406-1.552-.167-.557-.342-.859-.47-1.233-.155-.455-.303-.721-.496-1.181-.139-.329-.364-1.048-.457-1.44-.119-.509.033-.924.244-1.206.253-.339.962-.49 1.357-.351.371.13.744.512.916.788.288.46.357.632.717 1.542.393.992.564 1.918.611 2.231l.085.452c-.001-.04-.043-1.122-.044-1.162-.035-1.029-.06-1.823-.038-2.939.002-.126.064-.587.084-.715.078-.5.305-.8.673-.979.412-.201.926-.215 1.401-.017.423.173.626.55.687 1.022.014.109.094.987.093 1.107-.013 1.025.006 1.641.015 2.174.004.231.003 1.625.017 1.469.061-.656.094-3.189.344-3.942.144-.433.405-.746.794-.929.431-.203 1.113-.07 1.404.243.285.305.446.692.482 1.153.032.405-.019.897-.02 1.245 0 .867-.021 1.324-.037 2.121-.001.038-.015.298.023.182.094-.28.188-.542.266-.745.049-.125.241-.614.359-.859.114-.234.211-.369.415-.688.2-.313.415-.448.668-.561.54-.235 1.109.112 1.301.591.086.215.009.713-.028 1.105-.061.647-.254 1.306-.352 1.648-.128.447-.274 1.235-.34 1.601-.072.394-.234 1.382-.359 1.82-.086.301-.371.978-.652 1.384 0 0-1.074 1.25-1.192 1.812-.117.563-.078.567-.101.965-.024.399.121.923.121.923s-.802.104-1.234.034c-.391-.062-.875-.841-1-1.078-.172-.328-.539-.265-.682-.023-.225.383-.709 1.07-1.051 1.113-.668.084-2.054.03-3.139.02 0 0 .185-1.011-.227-1.358-.305-.26-.83-.784-1.144-1.06l-.832-.921c-.284-.36-.629-1.093-1.243-1.985-.348-.504-1.027-1.085-1.284-1.579-.223-.425-.331-.954-.19-1.325.225-.594.675-.897 1.362-.832.519.05.848.206 1.238.537.225.19.573.534.75.748.163.195.203.276.377.509.23.307.302.459.214.121" stroke-linejoin\x3d"round"/\x3e\x3cpath d\x3d"m20.5664 21.7344v-3.459"/\x3e\x3cpath d\x3d"m18.5508 21.7461-.016-3.473"/\x3e\x3cpath d\x3d"m16.5547 18.3047.021 3.426"/\x3e\x3c/g\x3e',
a,d),grabbing:(a,d)=>Sj("\x3cpath d\x3d'm13.5732 12.0361c.48-.178 1.427-.069 1.677.473.213.462.396 1.241.406 1.075.024-.369-.024-1.167.137-1.584.117-.304.347-.59.686-.691.285-.086.62-.116.916-.055.313.064.642.287.765.499.362.623.368 1.899.385 1.831.064-.272.07-1.229.283-1.584.141-.235.497-.445.687-.479.294-.052.656-.068.964-.008.249.049.586.344.677.487.219.344.342 1.316.379 1.658.016.141.074-.393.293-.736.406-.639 1.844-.763 1.898.639.026.654.02.624.02 1.064 0 .516-.012.828-.04 1.202-.03.399-.116 1.304-.241 1.742-.086.301-.371.978-.653 1.384 0 0-1.074 1.25-1.191 1.812-.117.563-.078.567-.102.965-.023.399.121.923.121.923s-.801.104-1.234.034c-.391-.062-.875-.84-1-1.078-.172-.328-.539-.265-.682-.023-.224.383-.709 1.07-1.05 1.113-.669.084-2.055.03-3.14.02 0 0 .185-1.011-.227-1.358-.305-.26-.83-.784-1.144-1.06l-.832-.921c-.283-.36-1.002-.929-1.243-1.985-.213-.936-.192-1.395.037-1.77.232-.381.67-.589.854-.625.208-.042.692-.039.875.062.223.123.313.159.488.391.23.307.312.456.213.121-.076-.262-.322-.595-.434-.97-.109-.361-.401-.943-.38-1.526.008-.221.103-.771.832-1.042' fill\x3d'%23fff'/\x3e\x3cg stroke\x3d'%23000' stroke-width\x3d'.75'\x3e\x3cpath d\x3d'm13.5732 12.0361c.48-.178 1.427-.069 1.677.473.213.462.396 1.241.406 1.075.024-.369-.024-1.167.137-1.584.117-.304.347-.59.686-.691.285-.086.62-.116.916-.055.313.064.642.287.765.499.362.623.368 1.899.385 1.831.064-.272.07-1.229.283-1.584.141-.235.497-.445.687-.479.294-.052.656-.068.964-.008.249.049.586.344.677.487.219.344.342 1.316.379 1.658.016.141.074-.393.293-.736.406-.639 1.844-.763 1.898.639.026.654.02.624.02 1.064 0 .516-.012.828-.04 1.202-.03.399-.116 1.304-.241 1.742-.086.301-.371.978-.653 1.384 0 0-1.074 1.25-1.191 1.812-.117.563-.078.567-.102.965-.023.399.121.923.121.923s-.801.104-1.234.034c-.391-.062-.875-.84-1-1.078-.172-.328-.539-.265-.682-.023-.224.383-.709 1.07-1.05 1.113-.669.084-2.055.03-3.14.02 0 0 .185-1.011-.227-1.358-.305-.26-.83-.784-1.144-1.06l-.832-.921c-.283-.36-1.002-.929-1.243-1.985-.213-.936-.192-1.395.037-1.77.232-.381.67-.589.854-.625.208-.042.692-.039.875.062.223.123.313.159.488.391.23.307.312.456.213.121-.076-.262-.322-.595-.434-.97-.109-.361-.401-.943-.38-1.526.008-.221.103-.771.832-1.042z' stroke-linejoin\x3d'round'/\x3e\x3cpath d\x3d'm20.5664 19.7344v-3.459' stroke-linecap\x3d'round'/\x3e\x3cpath d\x3d'm18.5508 19.7461-.016-3.473' stroke-linecap\x3d'round'/\x3e\x3cpath d\x3d'm16.5547 16.3047.021 3.426' stroke-linecap\x3d'round'/\x3e\x3c/g\x3e",
a,d),text:(a,d)=>Sj("\x3cpath d\x3d'm6.94 2v-1c-1.35866267-.08246172-2.66601117.53165299-3.47 1.63-.80398883-1.09834701-2.11133733-1.71246172-3.47-1.63v1c1.30781678-.16635468 2.55544738.59885876 3 1.84v5.1h-1v1h1v4.16c-.4476345 1.2386337-1.69302129 2.002471-3 1.84v1c1.35687108.0731933 2.6600216-.5389494 3.47-1.63.8099784 1.0910506 2.11312892 1.7031933 3.47 1.63v-1c-1.28590589.133063-2.49760499-.6252793-2.94-1.84v-4.18h1v-1h-1v-5.08c.43943906-1.21710975 1.65323743-1.97676587 2.94-1.84z' transform\x3d'translate(14 9)'/\x3e",
a,d),["resize-edge"]:(a,d)=>Sj("\x3cpath d\x3d'm9 17.9907v.005l5.997 5.996.001-3.999h1.999 2.02v4l5.98-6.001-5.98-5.999.001 4.019-2.021.002h-2l.001-4.022zm1.411.003 3.587-3.588-.001 2.587h3.5 2.521v-2.585l3.565 3.586-3.564 3.585-.001-2.585h-2.521l-3.499-.001-.001 2.586z' fill\x3d'%23fff'/\x3e\x3cpath d\x3d'm17.4971 18.9932h2.521v2.586l3.565-3.586-3.565-3.585v2.605h-2.521-3.5v-2.607l-3.586 3.587 3.586 3.586v-2.587z' fill\x3d'%23000'/\x3e",a,d),["resize-corner"]:(a,d)=>Sj("\x3cpath d\x3d'm19.7432 17.0869-4.072 4.068 2.829 2.828-8.473-.013-.013-8.47 2.841 2.842 4.075-4.068 1.414-1.415-2.844-2.842h8.486v8.484l-2.83-2.827z' fill\x3d'%23fff'/\x3e\x3cpath d\x3d'm18.6826 16.7334-4.427 4.424 1.828 1.828-5.056-.016-.014-5.054 1.842 1.841 4.428-4.422 2.474-2.475-1.844-1.843h5.073v5.071l-1.83-1.828z' fill\x3d'%23000'/\x3e",
a,d),["ew-resize"]:(a,d)=>Sj("\x3cpath d\x3d'm9 17.9907v.005l5.997 5.996.001-3.999h1.999 2.02v4l5.98-6.001-5.98-5.999.001 4.019-2.021.002h-2l.001-4.022zm1.411.003 3.587-3.588-.001 2.587h3.5 2.521v-2.585l3.565 3.586-3.564 3.585-.001-2.585h-2.521l-3.499-.001-.001 2.586z' fill\x3d'%23fff'/\x3e\x3cpath d\x3d'm17.4971 18.9932h2.521v2.586l3.565-3.586-3.565-3.585v2.605h-2.521-3.5v-2.607l-3.586 3.587 3.586 3.586v-2.587z' fill\x3d'%23000'/\x3e",a,d),["ns-resize"]:(a,d)=>Sj("\x3cpath d\x3d'm9 17.9907v.005l5.997 5.996.001-3.999h1.999 2.02v4l5.98-6.001-5.98-5.999.001 4.019-2.021.002h-2l.001-4.022zm1.411.003 3.587-3.588-.001 2.587h3.5 2.521v-2.585l3.565 3.586-3.564 3.585-.001-2.585h-2.521l-3.499-.001-.001 2.586z' fill\x3d'%23fff'/\x3e\x3cpath d\x3d'm17.4971 18.9932h2.521v2.586l3.565-3.586-3.565-3.585v2.605h-2.521-3.5v-2.607l-3.586 3.587 3.586 3.586v-2.587z' fill\x3d'%23000'/\x3e",
a+90,d),["nesw-resize"]:(a,d)=>Sj("\x3cpath d\x3d'm19.7432 17.0869-4.072 4.068 2.829 2.828-8.473-.013-.013-8.47 2.841 2.842 4.075-4.068 1.414-1.415-2.844-2.842h8.486v8.484l-2.83-2.827z' fill\x3d'%23fff'/\x3e\x3cpath d\x3d'm18.6826 16.7334-4.427 4.424 1.828 1.828-5.056-.016-.014-5.054 1.842 1.841 4.428-4.422 2.474-2.475-1.844-1.843h5.073v5.071l-1.83-1.828z' fill\x3d'%23000'/\x3e",a,d),["nwse-resize"]:(a,d)=>Sj("\x3cpath d\x3d'm19.7432 17.0869-4.072 4.068 2.829 2.828-8.473-.013-.013-8.47 2.841 2.842 4.075-4.068 1.414-1.415-2.844-2.842h8.486v8.484l-2.83-2.827z' fill\x3d'%23fff'/\x3e\x3cpath d\x3d'm18.6826 16.7334-4.427 4.424 1.828 1.828-5.056-.016-.014-5.054 1.842 1.841 4.428-4.422 2.474-2.475-1.844-1.843h5.073v5.071l-1.83-1.828z' fill\x3d'%23000'/\x3e",
a+90,d),rotate:(a,d)=>Sj('\x3cg\x3e\x3cpath d\x3d"M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" fill\x3d"black"/\x3e\x3cpath fill-rule\x3d"evenodd" clip-rule\x3d"evenodd" d\x3d"M21.4789 7.03223L27.4035 12.9945L21.4789 18.9521V15.1868C18.4798 15.6549 16.1113 18.0273 15.649 21.0284H19.475L13.5128 26.953L7.55519 21.0284H11.6189C12.1243 15.8155 16.2679 11.6677 21.4789 11.1559L21.4789 7.03223ZM22.4789 12.1031C17.0214 12.1503 12.6071 16.5691 12.5674 22.0284H9.97889L13.513 25.543L17.05 22.0284H14.5675C14.5705 21.6896 14.5947 21.3558 14.6386 21.0284C15.1157 17.4741 17.9266 14.6592 21.4789 14.1761C21.8063 14.1316 22.1401 14.1069 22.4789 14.1032V16.5284L25.9935 12.9942L22.4789 9.45729L22.4789 12.1031Z" fill\x3d"white"/\x3e\x3c/g\x3e',
a+45,d),["nwse-rotate"]:(a,d)=>Sj('\x3cg\x3e\x3cpath d\x3d"M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" fill\x3d"black"/\x3e\x3cpath fill-rule\x3d"evenodd" clip-rule\x3d"evenodd" d\x3d"M21.4789 7.03223L27.4035 12.9945L21.4789 18.9521V15.1868C18.4798 15.6549 16.1113 18.0273 15.649 21.0284H19.475L13.5128 26.953L7.55519 21.0284H11.6189C12.1243 15.8155 16.2679 11.6677 21.4789 11.1559L21.4789 7.03223ZM22.4789 12.1031C17.0214 12.1503 12.6071 16.5691 12.5674 22.0284H9.97889L13.513 25.543L17.05 22.0284H14.5675C14.5705 21.6896 14.5947 21.3558 14.6386 21.0284C15.1157 17.4741 17.9266 14.6592 21.4789 14.1761C21.8063 14.1316 22.1401 14.1069 22.4789 14.1032V16.5284L25.9935 12.9942L22.4789 9.45729L22.4789 12.1031Z" fill\x3d"white"/\x3e\x3c/g\x3e',
a,d),["nesw-rotate"]:(a,d)=>Sj('\x3cg\x3e\x3cpath d\x3d"M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" fill\x3d"black"/\x3e\x3cpath fill-rule\x3d"evenodd" clip-rule\x3d"evenodd" d\x3d"M21.4789 7.03223L27.4035 12.9945L21.4789 18.9521V15.1868C18.4798 15.6549 16.1113 18.0273 15.649 21.0284H19.475L13.5128 26.953L7.55519 21.0284H11.6189C12.1243 15.8155 16.2679 11.6677 21.4789 11.1559L21.4789 7.03223ZM22.4789 12.1031C17.0214 12.1503 12.6071 16.5691 12.5674 22.0284H9.97889L13.513 25.543L17.05 22.0284H14.5675C14.5705 21.6896 14.5947 21.3558 14.6386 21.0284C15.1157 17.4741 17.9266 14.6592 21.4789 14.1761C21.8063 14.1316 22.1401 14.1069 22.4789 14.1032V16.5284L25.9935 12.9942L22.4789 9.45729L22.4789 12.1031Z" fill\x3d"white"/\x3e\x3c/g\x3e',
a+90,d),["senw-rotate"]:(a,d)=>Sj('\x3cg\x3e\x3cpath d\x3d"M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" fill\x3d"black"/\x3e\x3cpath fill-rule\x3d"evenodd" clip-rule\x3d"evenodd" d\x3d"M21.4789 7.03223L27.4035 12.9945L21.4789 18.9521V15.1868C18.4798 15.6549 16.1113 18.0273 15.649 21.0284H19.475L13.5128 26.953L7.55519 21.0284H11.6189C12.1243 15.8155 16.2679 11.6677 21.4789 11.1559L21.4789 7.03223ZM22.4789 12.1031C17.0214 12.1503 12.6071 16.5691 12.5674 22.0284H9.97889L13.513 25.543L17.05 22.0284H14.5675C14.5705 21.6896 14.5947 21.3558 14.6386 21.0284C15.1157 17.4741 17.9266 14.6592 21.4789 14.1761C21.8063 14.1316 22.1401 14.1069 22.4789 14.1032V16.5284L25.9935 12.9942L22.4789 9.45729L22.4789 12.1031Z" fill\x3d"white"/\x3e\x3c/g\x3e',
a+180,d),["swne-rotate"]:(a,d)=>Sj('\x3cg\x3e\x3cpath d\x3d"M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" fill\x3d"black"/\x3e\x3cpath fill-rule\x3d"evenodd" clip-rule\x3d"evenodd" d\x3d"M21.4789 7.03223L27.4035 12.9945L21.4789 18.9521V15.1868C18.4798 15.6549 16.1113 18.0273 15.649 21.0284H19.475L13.5128 26.953L7.55519 21.0284H11.6189C12.1243 15.8155 16.2679 11.6677 21.4789 11.1559L21.4789 7.03223ZM22.4789 12.1031C17.0214 12.1503 12.6071 16.5691 12.5674 22.0284H9.97889L13.513 25.543L17.05 22.0284H14.5675C14.5705 21.6896 14.5947 21.3558 14.6386 21.0284C15.1157 17.4741 17.9266 14.6592 21.4789 14.1761C21.8063 14.1316 22.1401 14.1069 22.4789 14.1032V16.5284L25.9935 12.9942L22.4789 9.45729L22.4789 12.1031Z" fill\x3d"white"/\x3e\x3c/g\x3e',
a+270,d)},AF=$e(ba(22));$e(ba(22));var TA=ba(22),UA=$e(ba(22));if(!ba(22).useState)throw Error("mobx-react-lite requires React with Hooks support");if(!Hf)throw Error("mobx-react-lite@3 requires mobx at least version 6 to be available");var BF=ba(31),Nu=$e(ba(22)),VA="undefined"===typeof FinalizationRegistry?void 0:FinalizationRegistry,CF=1E4,DF=function(a){var d="function"===typeof Symbol&&Symbol.iterator,k=d&&a[d],G=0;if(k)return k.call(a);if(a&&"number"===typeof a.length)return{next:function(){a&&
G>=a.length&&(a=void 0);return{value:a&&a[G++],done:!a}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.");},WA=VA?Rg(VA):um(),EF=WA.addReactionToTrack,FF=WA.recordReactionAsCommitted,XA=function(a,d){var k="function"===typeof Symbol&&a[Symbol.iterator];if(!k)return a;a=k.call(a);var G,fa=[];try{for(;(void 0===d||0<d--)&&!(G=a.next()).done;)fa.push(G.value)}catch(ta){var na={error:ta}}finally{try{G&&!G.done&&(k=a["return"])&&k.call(a)}finally{if(na)throw na.error;
}}return fa},GF=function(){return function(){}}(),Jt=ba(22),YA="function"===typeof Symbol&&Symbol.for,ZA=YA?Symbol.for("react.forward_ref"):"function"===typeof Jt.forwardRef&&(0,Jt.forwardRef)(function(a){return null}).$$typeof,$A=YA?Symbol.for("react.memo"):"function"===typeof Jt.memo&&(0,Jt.memo)(function(a){return null}).$$typeof,HF={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};Bj.displayName="Observer";ba(22);ba(22);ba(22);(function(a){a||=Rm;Kc({reactionScheduler:a})})(BF.unstable_batchedUpdates);
var IF=$e(ba(22)),Px=ba(598),Eo=IF.forwardRef(function(a,d){var {children:k,opacity:G,centered:fa,className:na=""}=a,ta=nf(a,["children","opacity","centered","className"]);return(0,Px.jsx)(Bj,{children:()=>(0,Px.jsx)("div",{ref:d,className:`tl-positioned-div ${na}`,style:G?{opacity:G}:void 0,draggable:!1,children:(0,Px.jsx)("div",Re(Ud({className:`tl-positioned-inner ${fa?"tl-centered":""}`},ta),{children:k}))})})}),JF=$e(ba(22)),Qx=ba(598),fp=JF.forwardRef(function(a,d){var {id:k,className:G="",
style:fa,children:na}=a,ta=nf(a,["id","className","style","children"]);return(0,Qx.jsx)(Bj,{children:()=>(0,Qx.jsx)("svg",{ref:d,style:fa,className:`tl-positioned-svg ${G}`,children:(0,Qx.jsx)("g",Re(Ud({id:k,className:"tl-centered-g"},ta),{children:na}))})})}),Ou=$e(ba(22)),aB=$e(ba(22)),aw=$e(ba(22)),KF=ba(598),Er=Ze(function(a){var {id:d,bounds:k,zIndex:G,rotation:fa=0,className:na="",children:ta}=a;a=nf(a,"id bounds zIndex rotation className children".split(" "));const Ha=aw.useRef(null);aw.useLayoutEffect(()=>
{Ha.current.style.transform=`translate(
calc(${k.minX}px - var(--tl-padding)),
calc(${k.minY}px - var(--tl-padding)))
rotate(${fa+(k.rotation||0)}rad)`},[k.minX,k.minY,fa,k.rotation]);aw.useLayoutEffect(()=>{const Sa=Ha.current;Sa.style.width=`calc(${Math.floor(k.width)}px + (var(--tl-padding) * 2))`;Sa.style.height=`calc(${Math.floor(k.height)}px + (var(--tl-padding) * 2))`},[k.width,k.height]);aw.useLayoutEffect(()=>{const Sa=Ha.current;void 0!==G&&(Sa.style.zIndex=G.toString())},[G]);return(0,KF.jsx)("div",Re(Ud({id:d,ref:Ha,className:`tl-positioned ${na}`,"aria-label":"container"},a),{children:ta}))}),
LF=$e(ba(22)),bB=ba(598),MF=Ze(function({shapes:a,hidden:d,bounds:k,rotation:G=0}){const {components:{ContextBar:fa},viewport:{bounds:na,camera:{point:[ta,Ha],zoom:Sa}}}=Pe(),Za=LF.useRef(null);var fb=cf.getRotatedBounds(k,G);fb=cf.multiplyBounds(fb,Sa);ik(Za,k,G,10005);if(!fa)throw Error("Expected a ContextBar component.");const ib=cf.translateBounds(fb,[ta*Sa,Ha*Sa]);return(0,bB.jsx)("div",{ref:Za,className:"tl-counter-scaled-positioned","aria-label":"context-bar-container","data-html2canvas-ignore":"true",
children:(0,bB.jsx)(fa,{hidden:d,shapes:a,bounds:k,offsets:{left:ib.minX,right:na.width-ib.maxX,top:ib.minY,bottom:na.height-ib.maxY,width:ib.width,height:ib.height},scaledBounds:fb,rotation:G})})}),cB=$e(ba(22)),NF=ba(598),dB=Ze(function({children:a}){const d=cB.useRef(null),{viewport:k}=Pe(),G=d.current,{zoom:fa,point:na}=k.camera;cB.useEffect(()=>{G&&(G.style.transform=`scale(${fa}) translate3d(${na[0]}px, ${na[1]}px, 0)`)},[fa,na,G]);return(0,NF.jsx)("div",{ref:d,className:"tl-absolute tl-layer",
children:a})}),bw=ba(598),eB=Ze(function({shape:a,isHovered:d=!1,isSelected:k=!1,isBinding:G=!1,isEditing:fa=!1,isLocked:na=!1,meta:ta}){const {bounds:Ha,props:{scale:Sa,rotation:Za=0},ReactIndicator:fb}=a;return(0,bw.jsx)(Er,{"data-type":"Indicator","data-html2canvas-ignore":"true",bounds:Ha,rotation:Za,scale:Sa,zIndex:fa?1E3:1E4,children:(0,bw.jsx)(fp,{children:(0,bw.jsx)("g",{className:`tl-indicator-container ${k?"tl-selected":"tl-hovered"} ${na?"tl-locked":""}`,children:(0,bw.jsx)(fb,{isEditing:fa,
isBinding:G,isHovered:d,isLocked:na,isSelected:k,isErasing:!1,meta:ta})})})})}),fB=$e(ba(22)),cw=ba(598),OF=Ze(function({bounds:a,shape:d}){const {viewport:{camera:{zoom:k}},components:{QuickLinks:G}}=Pe();var fa=kg();const na=yl(d);if(!G)throw Error("Expected a QuickLinks component.");fa=50>a.height*k||!fa.selectedShapesArray.includes(d);return(0,cw.jsx)(Er,{bounds:a,className:"tl-quick-links-container","data-html2canvas-ignore":"true",children:(0,cw.jsx)(Eo,{children:(0,cw.jsx)("span",Re(Ud({style:{position:"absolute",
top:"100%",pointerEvents:"all",transformOrigin:"left top",paddingTop:"8px",transform:"scale(var(--tl-scale))",minWidth:"320px"}},na),{onPointerDown:ta=>ta.stopPropagation(),children:(0,cw.jsx)(G,{className:"tl-backlinks-count "+(fa?"tl-backlinks-count-rounded":""),id:d.id,shape:d})}))})})}),dw=ba(598),PF=Ze(function({bounds:a,shape:d}){const {viewport:{camera:{zoom:k}},components:{BacklinksCount:G}}=Pe();var fa=kg();if(!G)throw Error("Expected a BacklinksCount component.");const na=ta=>ta.stopPropagation();
fa=50>a.height*k||!fa.selectedShapesArray.includes(d)||d.hideSelection;return(0,dw.jsx)(Er,{bounds:a,className:"tl-backlinks-count-container",children:(0,dw.jsx)(Eo,{children:(0,dw.jsx)("span",{style:{position:"absolute",left:"100%",pointerEvents:"all",transformOrigin:"left top",transform:"translateY(6px) scale(var(--tl-scale))"},onPointerDown:na,onWheelCapture:na,onKeyDown:na,title:"Shape Backlinks",children:(0,dw.jsx)(G,{className:"tl-backlinks-count "+(fa?"tl-backlinks-count-rounded":""),id:d.id,
shape:d})})})})}),QF=$e(ba(22)),gB=ba(598),RF=Ze(function({bounds:a,hidden:d,shapes:k,rotation:G=0,detail:fa="size"}){const {components:{SelectionDetail:na},viewport:{camera:{zoom:ta}}}=Pe(),Ha=QF.useRef(null),Sa=cf.multiplyBounds(a,ta);ik(Ha,a,G,10003);if(!na)throw Error("Expected a SelectionDetail component.");return(0,gB.jsx)("div",{ref:Ha,className:`tl-counter-scaled-positioned ${d?"tl-fade-out":""}`,"aria-label":"bounds-detail-container","data-html2canvas-ignore":"true",children:(0,gB.jsx)(na,
{shapes:k,bounds:a,scaledBounds:Sa,zoom:ta,rotation:G,detail:fa})})}),hB=ba(598),SF=Ze(function({shape:a,isHovered:d=!1,isSelected:k=!1,isBinding:G=!1,isErasing:fa=!1,isEditing:na=!1,onEditingEnd:ta,asset:Ha,meta:Sa,zIndex:Za}){const {bounds:fb,props:{rotation:ib,scale:Bb},ReactComponent:Ob}=a,Fb=kg(),cc=yl(a);var oc=Fb.getParentGroup(a);oc=Fb.selectedIds.has(null==oc?void 0:oc.id);return(0,hB.jsx)(Er,{"data-shape-id":a.id,"data-html2canvas-ignore":!k&&!oc&&0!==Fb.selectedShapes.size||null,zIndex:Za,
"data-type":"Shape",bounds:fb,rotation:ib,scale:Bb,children:(0,hB.jsx)(Ob,{meta:Sa,isEditing:na,isBinding:G,isHovered:d,isSelected:k,isErasing:fa,events:cc,asset:Ha,onEditingEnd:ta})})}),Kt=ba(598),iB=[[-1,.15,64],[.05,.375,16],[.15,1,4],[.7,2.5,1]],TF=Ze(function({size:a}){const {viewport:{camera:{point:d,zoom:k}}}=Pe();return(0,Kt.jsxs)("svg",{className:"tl-grid",version:"1.1",xmlns:"http://www.w3.org/2000/svg","data-html2canvas-ignore":"true",children:[(0,Kt.jsx)("defs",{children:iB.map(([G,fa,
na],ta)=>{na=na*a*k;var Ha=d[0]*k,Sa=d[1]*k;Ha=0<Ha?Ha%na:na+Ha%na;Sa=0<Sa?Sa%na:na+Sa%na;G=Oj(k,[G,fa],[0,1]);return(0,Kt.jsx)("pattern",{id:`grid-${ta}`,width:na,height:na,patternUnits:"userSpaceOnUse",children:!(2<G||.1>G)&&(0,Kt.jsx)("circle",{className:"tl-grid-dot",cx:Ha,cy:Sa,r:1.5,opacity:Math.max(0,Math.min(G,1))})},`grid-pattern-${ta}`)})}),iB.map((G,fa)=>(0,Kt.jsx)("rect",{width:"100%",height:"100%",fill:`url(#grid-${fa})`},`grid-rect-${fa}`))]})}),jB=Ze(function({size:a}){return(0,Kt.jsx)(TF,
{size:a})}),kB=ba(598),lB=Ze(function({bounds:a}){const d=ek("background");return(0,kB.jsx)(fp,Re(Ud({"data-html2canvas-ignore":"true"},d),{children:(0,kB.jsx)("rect",{className:"tl-bounds-bg",width:Math.max(1,a.width),height:Math.max(1,a.height),pointerEvents:"all",rx:8,ry:8})}))});ba(22);var mB=ba(598),nB=Ze(function({scaledBounds:a,shapes:d,detail:k="size",rotation:G=0}){var fa;const na=1===d.length?G:null!=(fa=a.rotation)?fa:0;return(0,mB.jsx)(Eo,{centered:!0,children:(0,mB.jsx)("div",{className:"tl-bounds-detail",
style:{transform:na<Gn||na>3*Gn?`rotate(${na}rad) translateY(${a.height/2+24}px)`:`rotate(${Math.PI+na}rad) translateY(${a.height/2+32}px)`,padding:"2px 3px",borderRadius:"1px"},children:1===d.length&&"line"===d[0].type?`${Pd.dist(d[0].props.handles.start.point,d[0].props.handles.end.point).toFixed()}`:"size"===k?`${a.width.toFixed()} \xD7 ${a.height.toFixed()}`:`\u2220${Wl.radiansToDegrees(Wl.clampRadians(G)).toFixed()}\xB0`})})}),Rx=ba(598),UF={top_left_corner:"tl-cursor-nwse",top_right_corner:"tl-cursor-nesw",
bottom_right_corner:"tl-cursor-nwse",bottom_left_corner:"tl-cursor-nesw"},ew=Ze(function({cx:a,cy:d,size:k,targetSize:G,corner:fa,isHidden:na}){const ta=ek(fa);return(0,Rx.jsxs)("g",Re(Ud({opacity:na?0:1},ta),{children:[(0,Rx.jsx)("rect",{className:"tl-transparent "+(na?"":UF[fa]),"aria-label":`${fa} target`,x:a-1.25*G,y:d-1.25*G,width:2.5*G,height:2.5*G,pointerEvents:na?"none":"all"}),(0,Rx.jsx)("rect",{className:"tl-corner-handle","aria-label":`${fa} handle`,x:a-k/2,y:d-k/2,width:k,height:k,pointerEvents:"none"})]}))}),
VF=ba(598),WF={top_edge:"tl-cursor-ns",right_edge:"tl-cursor-ew",bottom_edge:"tl-cursor-ns",left_edge:"tl-cursor-ew"},fw=Ze(function({x:a,y:d,width:k,height:G,targetSize:fa,edge:na,disabled:ta,isHidden:Ha}){const Sa=ek(na);return(0,VF.jsx)("rect",Ud({pointerEvents:Ha||ta?"none":"all",className:"tl-transparent tl-edge-handle "+(Ha?"":WF[na]),"aria-label":`${na} target`,opacity:Ha?0:1,x:a-fa,y:d-fa,width:Math.max(1,k+2*fa),height:Math.max(1,G+2*fa)},Sa))}),Sx=ba(598);Ze(function({cx:a,cy:d,size:k,targetSize:G,
isHidden:fa}){const na=ek("rotate");return(0,Sx.jsxs)("g",Re(Ud({opacity:fa?0:1},na),{children:[(0,Sx.jsx)("circle",{className:"tl-transparent ","aria-label":"rotate target",cx:a,cy:d,r:G,pointerEvents:fa?"none":"all"}),(0,Sx.jsx)("circle",{className:"tl-rotate-handle","aria-label":"rotate handle",cx:a,cy:d,r:k/2,pointerEvents:"none"})]}))});ba(22);var oB=ba(598),gw=Ze(function({cx:a,cy:d,targetSize:k,corner:G,isHidden:fa}){const na=ek(G);return(0,oB.jsx)("g",Re(Ud({opacity:fa?0:1},na),{children:(0,oB.jsx)("rect",
{className:"tl-transparent","aria-label":`${G} target`,x:a-2.5*k,y:d-2.5*k,width:3*k,height:3*k,pointerEvents:fa?"none":"all"})}))}),Am=ba(598),pB=Ze(function({bounds:a,showResizeHandles:d,showRotateHandles:k,shapes:G}){var fa,na;const ta=kg();let {width:Ha,height:Sa}=a;var Za=ta.viewport.camera.zoom;a=8/Za;Za=6/Za;const fb=1===G.length?G[0].canResize:[!0,!0],ib=null!=(na=null==(fa=ta.editingShape)?void 0:fa.props.borderRadius)?na:0;return(0,Am.jsx)(Am.Fragment,{children:0<G.length&&(0,Am.jsxs)(fp,
{children:[!ta.editingShape&&(0,Am.jsx)("rect",{className:"tl-bounds-fg",width:Math.max(Ha,1),height:Math.max(Sa,1),rx:ib,ry:ib,pointerEvents:"none"}),(0,Am.jsx)(fw,{x:2*Za,y:0,width:Ha-4*Za,height:0,targetSize:Za,edge:"top_edge",disabled:!fb[1],isHidden:!d}),(0,Am.jsx)(fw,{x:Ha,y:2*Za,width:0,height:Sa-4*Za,targetSize:Za,edge:"right_edge",disabled:!fb[0],isHidden:!d}),(0,Am.jsx)(fw,{x:2*Za,y:Sa,width:Ha-4*Za,height:0,targetSize:Za,edge:"bottom_edge",disabled:!fb[1],isHidden:!d}),(0,Am.jsx)(fw,{x:0,
y:2*Za,width:0,height:Sa-4*Za,targetSize:Za,edge:"left_edge",disabled:!fb[0],isHidden:!d}),(0,Am.jsx)(gw,{cx:0,cy:0,targetSize:Za,corner:"top_left_resize_corner",isHidden:!k}),(0,Am.jsx)(gw,{cx:Ha+2*Za,cy:0,targetSize:Za,corner:"top_right_resize_corner",isHidden:!k}),(0,Am.jsx)(gw,{cx:Ha+2*Za,cy:Sa+2*Za,targetSize:Za,corner:"bottom_right_resize_corner",isHidden:!k}),(0,Am.jsx)(gw,{cx:0,cy:Sa+2*Za,targetSize:Za,corner:"bottom_left_resize_corner",isHidden:!k}),(null==fb?void 0:fb.every(Bb=>Bb))&&(0,Am.jsxs)(Am.Fragment,
{children:[(0,Am.jsx)(ew,{cx:0,cy:0,size:a,targetSize:Za,corner:"top_left_corner",isHidden:!d}),(0,Am.jsx)(ew,{cx:Ha,cy:0,size:a,targetSize:Za,corner:"top_right_corner",isHidden:!d}),(0,Am.jsx)(ew,{cx:Ha,cy:Sa,size:a,targetSize:Za,corner:"bottom_right_corner",isHidden:!d}),(0,Am.jsx)(ew,{cx:0,cy:Sa,size:a,targetSize:Za,corner:"bottom_left_corner",isHidden:!d})]})]})})}),Tx=ba(598),qB=Ze(function({bounds:a}){return(0,Tx.jsx)(Er,{bounds:a,zIndex:10001,children:(0,Tx.jsx)(fp,{children:(0,Tx.jsx)("rect",
{className:"tl-brush",x:0,y:0,width:a.width,height:a.height})})})}),rB=ba(598);Ze(function(){return(0,rB.jsx)(rB.Fragment,{})});var Ux=ba(598),sB=Ze(function({shape:a,handle:d,id:k}){a=up(a,k);const [G,fa]=d.point;return(0,Ux.jsxs)("g",Re(Ud({className:"tl-handle","aria-label":"handle"},a),{transform:`translate(${G}, ${fa})`,children:[(0,Ux.jsx)("circle",{className:"tl-handle-bg",pointerEvents:"all"}),(0,Ux.jsx)("circle",{className:"tl-counter-scaled tl-handle",pointerEvents:"none",r:4})]}))}),tB=
$e(ba(22)),Vx=ba(598),Wx=Ze(function({direction:a}){const {viewport:{bounds:d}}=Pe(),k=tB.useRef(null);tB.useLayoutEffect(()=>{const G=k.current;if(G){var fa=[d.width/2,d.height/2],na=cf.getRectangleSides([12,12],[d.width-24,d.height-24]);for(const [,[ta,Ha]]of na)na=u(fa,a,ta,Ha),na.didIntersect&&(na=na.points[0],G.style.transform=`translate(${na[0]-6}px,${na[1]-6}px) rotate(${Pd.toAngle(a)}rad)`)}},[a,d]);return(0,Vx.jsx)("div",{ref:k,className:"tl-direction-indicator","data-html2canvas-ignore":"true",
children:(0,Vx.jsx)("svg",{height:12,width:12,children:(0,Vx.jsx)("polygon",{points:"0,0 12,6 0,12"})})})}),qk=ba(598),XF=Ze(function({id:a,className:d,brush:k,shapes:G,assets:fa,bindingShapes:na,editingShape:ta,hoveredShape:Ha,hoveredGroup:Sa,selectionBounds:Za,selectedShapes:fb,erasingShapes:ib,selectionDirectionHint:Bb,cursor:Ob="default",cursorRotation:Fb=0,selectionRotation:cc=0,showSelection:oc=!0,showHandles:Xb=!0,showSelectionRotation:hc=!1,showResizeHandles:ec=!0,showRotateHandles:Ec=!0,
showSelectionDetail:Ic=!0,showContextBar:nd=!0,showGrid:Bd=!0,gridSize:Ee=8,onEditingEnd:Vd=QE,theme:te=Kq,children:gf}){var Be;const Fe=Ou.useRef(null),{viewport:Fd,components:bd,meta:Gd}=Pe(),Zc=kg(),td=Ou.useCallback(hf=>{Zc.inputs.updateContainerOffset([hf.minX,hf.minY])},[]);Jl(te,a);Qm(Fe);fk(Fe,Fd,td);Aj(Fe);am();xl(Fe,Ob,Fb);Ek(Fe);Fn(Fe);a=rg();const we=(Ob=1===(null==fb?void 0:fb.length)&&fb[0])&&"handles"in Ob.props?null==fb?void 0:fb[0]:void 0,Te=Ou.useMemo(()=>new Set(fb||[]),[fb]),vf=
Ou.useMemo(()=>new Set(ib||[]),[ib]);Ob=1===(null==fb?void 0:fb.length)?fb[0]:void 0;Sa=[...(new Set([Sa,Ha]))].filter(Zf);return(0,qk.jsxs)("div",{ref:Fe,className:`tl-container ${null!=d?d:""}`,children:[(0,qk.jsxs)("div",Re(Ud({tabIndex:-1,className:"tl-absolute tl-canvas"},a),{children:[Bd&&bd.Grid&&(0,qk.jsx)(bd.Grid,{size:Ee}),(0,qk.jsxs)(dB,{children:[bd.SelectionBackground&&fb&&Za&&oc&&(0,qk.jsx)(Er,{"data-type":"SelectionBackground",bounds:Za,zIndex:2,"data-html2canvas-ignore":"true",children:(0,qk.jsx)(bd.SelectionBackground,
{shapes:fb,bounds:Za,showResizeHandles:ec,showRotateHandles:Ec})}),G&&G.map((hf,Mf)=>(0,qk.jsx)(SF,{shape:hf,asset:fa&&hf.props.assetId?fa[hf.props.assetId]:void 0,isEditing:hf===ta,isHovered:hf===Ha,isBinding:null==na?void 0:na.includes(hf),isSelected:Te.has(hf),isErasing:vf.has(hf),meta:Gd,zIndex:1E3+Mf,onEditingEnd:Vd},"shape_"+hf.id)),!Zc.isIn("select.pinching")&&(null==fb?void 0:fb.map(hf=>(0,qk.jsx)(eB,{shape:hf,isEditing:hf===ta,isHovered:!1,isBinding:!1,isSelected:!0,isLocked:hf.props.isLocked},
"selected_indicator_"+hf.id))),Sa.map(hf=>hf!==ta&&(0,qk.jsx)(eB,{shape:hf},"hovered_indicator_"+hf.id)),Ob&&bd.BacklinksCount&&(0,qk.jsx)(PF,{hidden:!1,bounds:Ob.bounds,shape:Ob}),Ha&&Ha!==Ob&&bd.QuickLinks&&(0,qk.jsx)(OF,{hidden:!1,bounds:Ha.bounds,shape:Ha}),k&&bd.Brush&&(0,qk.jsx)(bd.Brush,{bounds:k}),fb&&Za&&(0,qk.jsxs)(qk.Fragment,{children:[oc&&bd.SelectionForeground&&(0,qk.jsx)(Er,{"data-type":"SelectionForeground","data-html2canvas-ignore":"true",bounds:Za,zIndex:ta&&fb.includes(ta)?1002:
10002,children:(0,qk.jsx)(bd.SelectionForeground,{shapes:fb.filter(hf=>!hf.props.isLocked),bounds:Za,showResizeHandles:ec,showRotateHandles:Ec})}),Xb&&we&&bd.Handle&&(0,qk.jsx)(Er,{"data-type":"onlySelectedShapeWithHandles","data-html2canvas-ignore":"true",bounds:Za,zIndex:10003,children:(0,qk.jsx)(fp,{children:Object.entries(null!=(Be=we.props.handles)?Be:{}).map(([hf,Mf])=>Ou.createElement(bd.Handle,{key:`${Mf.id}_handle_${Mf.id}`,shape:we,handle:Mf,id:hf}))})}),fb&&bd.SelectionDetail&&(0,qk.jsx)(RF,
{"data-html2canvas-ignore":"true",shapes:fb,bounds:Za,detail:hc?"rotation":"size",hidden:!Ic,rotation:cc},"detail"+fb.map(hf=>hf.id).join(""))]})]}),Bb&&Za&&fb&&(0,qk.jsx)(Wx,{direction:Bb,bounds:Za,shapes:fb}),(0,qk.jsx)("div",{id:"tl-dev-tools-canvas-anchor","data-html2canvas-ignore":"true"})]})),(0,qk.jsx)(dB,{children:fb&&Za&&(0,qk.jsx)(qk.Fragment,{children:fb&&bd.ContextBar&&(0,qk.jsx)(MF,{shapes:fb.filter(hf=>!hf.props.isLocked),hidden:!nd,bounds:Ob?Ob.bounds:Za,rotation:Ob?Ob.props.rotation:
0},"context"+fb.map(hf=>hf.id).join(""))})}),gf]})}),uB=$e(ba(22)),vB=$e(ba(22)),wB=ba(598);Ze(function({children:a}){const d=vB.useRef(null),{viewport:k}=Pe();vB.useEffect(()=>wd(()=>{const G=d.current;if(G){var {zoom:fa,point:na}=k.camera;G.style.transform=`scale(${fa}) translateX(${na[0]}px) translateY(${na[1]}px)`}}),[]);return(0,wB.jsx)("svg",{className:"tl-absolute tl-overlay",pointerEvents:"none",children:(0,wB.jsx)("g",{ref:d,pointerEvents:"none",children:a})})});var YF=ba(598),ZF=Ze(function(a){const d=
Yn(a),k=Kk(a.id);Lk(d,a);uo(d,a);return(0,YF.jsx)(k.Provider,{value:d,children:a.children})}),$F=ba(598),aG=Ze(function({id:a="noid",viewport:d,inputs:k,callbacks:G=Kq,meta:fa=Kq,components:na=Kq,children:ta}){const [Ha,Sa]=uB.useState(()=>{const {Brush:fb,ContextBar:ib,DirectionIndicator:Bb,Grid:Ob,Handle:Fb,SelectionBackground:cc,SelectionDetail:oc,SelectionForeground:Xb}=na,hc=nf(na,"Brush ContextBar DirectionIndicator Grid Handle SelectionBackground SelectionDetail SelectionForeground".split(" "));
return{id:a,viewport:d,inputs:k,callbacks:G,meta:fa,components:Re(Ud({},hc),{Brush:null===fb?void 0:qB,ContextBar:ib,DirectionIndicator:null===Bb?void 0:Wx,Grid:null===Ob?void 0:jB,Handle:null===Fb?void 0:sB,SelectionBackground:null===cc?void 0:lB,SelectionDetail:null===oc?void 0:nB,SelectionForeground:null===Xb?void 0:pB})}});uB.useLayoutEffect(()=>{const {Brush:fb,ContextBar:ib,DirectionIndicator:Bb,Grid:Ob,Handle:Fb,SelectionBackground:cc,SelectionDetail:oc,SelectionForeground:Xb}=na,hc=nf(na,
"Brush ContextBar DirectionIndicator Grid Handle SelectionBackground SelectionDetail SelectionForeground".split(" "));return wd(()=>{Sa({id:a,viewport:d,inputs:k,callbacks:G,meta:fa,components:Re(Ud({},hc),{Brush:null===fb?void 0:qB,ContextBar:ib,DirectionIndicator:null===Bb?void 0:Wx,Grid:null===Ob?void 0:jB,Handle:null===Fb?void 0:sB,SelectionBackground:null===cc?void 0:lB,SelectionDetail:null===oc?void 0:nB,SelectionForeground:null===Xb?void 0:pB})})})},[]);const Za=Il(a);return(0,$F.jsx)(Za.Provider,
{value:Ha,children:ta})}),xB=ba(598),bG=ba(598),cG=Ze(function(a){const d=kg();return(0,bG.jsx)(sn,Ud({viewport:d.viewport,inputs:d.inputs,callbacks:d._events,brush:d.brush,editingShape:d.editingShape,hoveredShape:d.hoveredShape,hoveredGroup:d.hoveredGroup,bindingShapes:d.bindingShapes,selectionDirectionHint:d.selectionDirectionHint,selectionBounds:d.selectionBounds,selectedShapes:d.selectedShapesArray,erasingShapes:d.erasingShapesArray,shapes:d.shapes,assets:d.assets,showGrid:d.settings.showGrid,
penMode:d.settings.penMode,showSelection:d.showSelection,showSelectionRotation:d.showSelectionRotation,showResizeHandles:d.showResizeHandles,showRotateHandles:d.showRotateHandles,showSelectionDetail:d.showSelectionDetail,showContextBar:d.showContextBar,cursor:d.cursors.cursor,cursorRotation:d.cursors.rotation,selectionRotation:d.selectionRotation,onEditingEnd:d.clearEditingState},a))});ba(598);var Lt=$e(ba(22)),Fr=$e(ba(22)),dG=ba(598),eG="add-link block-search block connector group internal-link link-to-block link-to-page link-to-whiteboard move-to-sidebar-right object-compact object-expanded open-as-page page-search page references-hide references-show select-cursor text ungroup whiteboard-element whiteboard".split(" "),
gh=a=>{var {name:d,className:k}=a;a=nf(a,["name","className"]);const G=eG.includes(d)?"tie tie-":"ti ti-";return(0,dG.jsx)("i",Ud({className:[G+d,k].join(" ")},a))},ah=ba(22),fG=ba(22),Ms=ba(22),$n=ba(22),Xx=ba(22),gG=ba(31),an=ba(22),lq=(0,an.forwardRef)((a,d)=>{var {children:k}=a;a=nf(a,["children"]);const G=an.Children.toArray(k),fa=G.find(lg);if(fa){const na=fa.props.children;k=G.map(ta=>ta===fa?1<an.Children.count(na)?an.Children.only(null):(0,an.isValidElement)(na)?na.props.children:null:ta);
return(0,an.createElement)(Yx,He({},a,{ref:d}),(0,an.isValidElement)(na)?(0,an.cloneElement)(na,void 0,k):null)}return(0,an.createElement)(Yx,He({},a,{ref:d}),k)});lq.displayName="Slot";var Yx=(0,an.forwardRef)((a,d)=>{const {children:k}=a;a=nf(a,["children"]);return(0,an.isValidElement)(k)?(0,an.cloneElement)(k,Re(Ud({},fl(a,k.props)),{ref:xg(d,k.ref)})):1<an.Children.count(k)?an.Children.only(null):null});Yx.displayName="SlotClone";var yB=({children:a})=>(0,an.createElement)(an.Fragment,null,a),
Gk="a button div h2 h3 img label li nav ol p span svg ul".split(" ").reduce((a,d)=>{const k=(0,Xx.forwardRef)((G,fa)=>{var {asChild:na}=G;G=nf(G,["asChild"]);na=na?lq:d;(0,Xx.useEffect)(()=>{window[Symbol.for("radix-ui")]=!0},[]);return(0,Xx.createElement)(na,He({},G,{ref:fa}))});k.displayName=`Primitive.${d}`;return Re(Ud({},a),{[d]:k})},{}),Zx=ba(22),hG=ba(22),zB,iG=(0,$n.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$x=(0,$n.forwardRef)((a,d)=>
{var k;const {disableOutsidePointerEvents:G=!1,onEscapeKeyDown:fa,onPointerDownOutside:na,onFocusOutside:ta,onInteractOutside:Ha,onDismiss:Sa}=a,Za=nf(a,"disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside onDismiss".split(" ")),fb=(0,$n.useContext)(iG),[ib,Bb]=(0,$n.useState)(null),Ob=null!==(k=null===ib||void 0===ib?void 0:ib.ownerDocument)&&void 0!==k?k:null===globalThis||void 0===globalThis?void 0:globalThis.document,[,Fb]=(0,$n.useState)({});d=eh(d,
ec=>Bb(ec));k=Array.from(fb.layers);var [cc]=[...fb.layersWithOutsidePointerEventsDisabled].slice(-1);cc=k.indexOf(cc);const oc=ib?k.indexOf(ib):-1;k=0<fb.layersWithOutsidePointerEventsDisabled.size;const Xb=oc>=cc;cc=ij(ec=>{const Ec=ec.target,Ic=[...fb.branches].some(nd=>nd.contains(Ec));Xb&&!Ic&&(null===na||void 0===na||na(ec),null===Ha||void 0===Ha||Ha(ec),ec.defaultPrevented||null===Sa||void 0===Sa||Sa())},Ob);const hc=gj(ec=>{const Ec=ec.target;[...fb.branches].some(Ic=>Ic.contains(Ec))||(null===
ta||void 0===ta||ta(ec),null===Ha||void 0===Ha||Ha(ec),ec.defaultPrevented||null===Sa||void 0===Sa||Sa())},Ob);Fk(ec=>{oc===fb.layers.size-1&&(null===fa||void 0===fa||fa(ec),!ec.defaultPrevented&&Sa&&(ec.preventDefault(),Sa()))},Ob);(0,$n.useEffect)(()=>{if(ib)return G&&(0===fb.layersWithOutsidePointerEventsDisabled.size&&(zB=Ob.body.style.pointerEvents,Ob.body.style.pointerEvents="none"),fb.layersWithOutsidePointerEventsDisabled.add(ib)),fb.layers.add(ib),bl(),()=>{G&&1===fb.layersWithOutsidePointerEventsDisabled.size&&
(Ob.body.style.pointerEvents=zB)}},[ib,Ob,G,fb]);(0,$n.useEffect)(()=>()=>{ib&&(fb.layers.delete(ib),fb.layersWithOutsidePointerEventsDisabled.delete(ib),bl())},[ib,fb]);(0,$n.useEffect)(()=>{const ec=()=>Fb({});document.addEventListener("dismissableLayer.update",ec);return()=>document.removeEventListener("dismissableLayer.update",ec)},[]);return(0,$n.createElement)(Gk.div,He({},Za,{ref:d,style:Ud({pointerEvents:k?Xb?"auto":"none":void 0},a.style),onFocusCapture:Lf(a.onFocusCapture,hc.onFocusCapture),
onBlurCapture:Lf(a.onBlurCapture,hc.onBlurCapture),onPointerDownCapture:Lf(a.onPointerDownCapture,cc.onPointerDownCapture)}))}),AB=$e(ba(22)),jG=ba(22),Bm=(null===globalThis||void 0===globalThis?0:globalThis.document)?jG.useLayoutEffect:()=>{},kG=AB["useId".toString()]||(()=>{}),lG=0,Ql=ba(22),mG=(a,d,k)=>Nh(void 0,null,function*(){const {placement:G="bottom",strategy:fa="absolute",middleware:na=[],platform:ta}=k,Ha=yield null==ta.isRTL?void 0:ta.isRTL(d);let Sa=yield ta.getElementRects({reference:a,
floating:d,strategy:fa}),{x:Za,y:fb}=Ui(Sa,G,Ha),ib=G,Bb={},Ob=0;for(let Fb=0;Fb<na.length;Fb++){const {name:cc,fn:oc}=na[Fb],{x:Xb,y:hc,data:ec,reset:Ec}=yield oc({x:Za,y:fb,initialPlacement:G,placement:ib,strategy:fa,middlewareData:Bb,rects:Sa,platform:ta,elements:{reference:a,floating:d}});Za=null!=Xb?Xb:Za;fb=null!=hc?hc:fb;Bb=Re(Ud({},Bb),{[cc]:Ud(Ud({},Bb[cc]),ec)});Ec&&50>=Ob&&(Ob++,"object"==typeof Ec&&(Ec.placement&&(ib=Ec.placement),Ec.rects&&(Sa=!0===Ec.rects?yield ta.getElementRects({reference:a,
floating:d,strategy:fa}):Ec.rects),{x:Za,y:fb}=Ui(Sa,ib,Ha)),Fb=-1)}return{x:Za,y:fb,placement:ib,strategy:fa,middlewareData:Bb}}),ay=Math.min,Pq=Math.max,BB=a=>({name:"arrow",options:a,fn(d){return Nh(this,null,function*(){const {element:k,padding:G=0}=null!=a?a:{},{x:fa,y:na,placement:ta,rects:Ha,platform:Sa}=d;if(null==k)return{};const Za=dm(G),fb={x:fa,y:na},ib=cl(ta),Bb=ta.split("-")[1],Ob=Ok(ib);var Fb=yield Sa.getDimensions(k);const cc="y"===ib?"top":"left",oc="y"===ib?"bottom":"right";var Xb=
Ha.reference[Ob]+Ha.reference[ib]-fb[ib]-Ha.floating[Ob];const hc=fb[ib]-Ha.reference[ib];var ec=yield null==Sa.getOffsetParent?void 0:Sa.getOffsetParent(k);let Ec=ec?"y"===ib?ec.clientHeight||0:ec.clientWidth||0:0;0===Ec&&(Ec=Ha.floating[Ob]);ec=Za[cc];const Ic=Ec-Fb[Ob]-Za[oc];Fb=Ec/2-Fb[Ob]/2+(Xb/2-hc/2);Xb=Pq(ec,ay(Fb,Ic));return{[ib]:fb[ib]-(0<("start"===Bb?Za[cc]:Za[oc])&&Fb!==Xb&&Ha.reference[Ob]<=Ha.floating[Ob]?Fb<ec?ec-Fb:Ic-Fb:0),data:{[ib]:Xb,centerOffset:Fb-Xb}}})}}),nG={left:"right",
right:"left",bottom:"top",top:"bottom"},oG={start:"end",end:"start"},CB=["top","right","bottom","left"];CB.reduce((a,d)=>a.concat(d,d+"-start",d+"-end"),[]);var DB=function(a){return void 0===a&&(a={}),{name:"flip",options:a,fn(d){return Nh(this,null,function*(){var k;const {placement:G,middlewareData:fa,rects:na,initialPlacement:ta,platform:Ha,elements:Sa}=d;var Za=a;const {mainAxis:fb=!0,crossAxis:ib=!0,fallbackPlacements:Bb,fallbackStrategy:Ob="bestFit",flipAlignment:Fb=!0}=Za;Za=nf(Za,["mainAxis",
"crossAxis","fallbackPlacements","fallbackStrategy","flipAlignment"]);const cc=wi(G);var oc=Bb||(cc!==ta&&Fb?function(nd){const Bd=Tm(nd);return[cm(nd),Bd,cm(Bd)]}(ta):[Tm(ta)]);oc=[ta,...oc];const Xb=yield Dk(d,Za),hc=[];Za=(null==(k=fa.flip)?void 0:k.overflows)||[];if(fb&&hc.push(Xb[cc]),ib){const {main:nd,cross:Bd}=Hn(G,na,yield null==Ha.isRTL?void 0:Ha.isRTL(Sa.floating));hc.push(Xb[nd],Xb[Bd])}if(Za=[...Za,{placement:G,overflows:hc}],!hc.every(nd=>0>=nd)){var ec,Ec;k=(null!=(ec=null==(Ec=fa.flip)?
void 0:Ec.index)?ec:0)+1;if(ec=oc[k])return{data:{index:k,overflows:Za},reset:{placement:ec}};ec="bottom";switch(Ob){case "bestFit":var Ic;(Ec=null==(Ic=Za.map(nd=>[nd,nd.overflows.filter(Bd=>0<Bd).reduce((Bd,Ee)=>Bd+Ee,0)]).sort((nd,Bd)=>nd[1]-Bd[1])[0])?void 0:Ic[0].placement)&&(ec=Ec);break;case "initialPlacement":ec=ta}if(G!==ec)return{reset:{placement:ec}}}return{}})}}},EB=function(a){a=void 0===a?{}:a;let {strategy:d="referenceHidden"}=a,k=nf(a,["strategy"]);return{name:"hide",fn(G){return Nh(this,
null,function*(){var {rects:fa}=G;switch(d){case "referenceHidden":return fa=Rb(yield Dk(G,Re(Ud({},k),{elementContext:"reference"})),fa.reference),{data:{referenceHiddenOffsets:fa,referenceHidden:Ra(fa)}};case "escaped":return fa=Rb(yield Dk(G,Re(Ud({},k),{altBoundary:!0})),fa.floating),{data:{escapedOffsets:fa,escaped:Ra(fa)}};default:return{}}})}}},FB=function(a){return void 0===a&&(a=0),{name:"offset",options:a,fn(d){return Nh(this,null,function*(){const {x:k,y:G}=d,fa=yield function(na,ta){return Nh(this,
null,function*(){const {placement:Ha,platform:Sa,elements:Za}=na;var fb=yield null==Sa.isRTL?void 0:Sa.isRTL(Za.floating),ib=wi(Ha);const Bb=Ha.split("-")[1],Ob="x"===cl(Ha);ib=["left","top"].includes(ib)?-1:1;fb=fb&&Ob?-1:1;const Fb="function"==typeof ta?ta(na):ta;let {mainAxis:cc,crossAxis:oc,alignmentAxis:Xb}="number"==typeof Fb?{mainAxis:Fb,crossAxis:0,alignmentAxis:null}:Ud({mainAxis:0,crossAxis:0,alignmentAxis:null},Fb);return Bb&&"number"==typeof Xb&&(oc="end"===Bb?-1*Xb:Xb),Ob?{x:oc*fb,y:cc*
ib}:{x:cc*ib,y:oc*fb}})}(d,a);return{x:k+fa.x,y:G+fa.y,data:fa}})}}},GB=function(a){return void 0===a&&(a={}),{name:"shift",options:a,fn(d){return Nh(this,null,function*(){const {x:k,y:G,placement:fa}=d;var na=a;const {mainAxis:ta=!0,crossAxis:Ha=!1,limiter:Sa={fn:Ob=>{let {x:Fb,y:cc}=Ob;return{x:Fb,y:cc}}}}=na;var Za=nf(na,["mainAxis","crossAxis","limiter"]);na={x:k,y:G};Za=yield Dk(d,Za);const fb=cl(wi(fa)),ib="x"===fb?"y":"x";let Bb=na[fb];na=na[ib];ta&&(Bb=Pq(Bb+Za["y"===fb?"top":"left"],ay(Bb,
Bb-Za["y"===fb?"bottom":"right"])));Ha&&(na=Pq(na+Za["y"===ib?"top":"left"],ay(na,na-Za["y"===ib?"bottom":"right"])));na=Sa.fn(Re(Ud({},d),{[fb]:Bb,[ib]:na}));return Re(Ud({},na),{data:{x:na.x-k,y:na.y-G}})})}}},HB=function(a){return void 0===a&&(a={}),{options:a,fn(d){const {x:k,y:G,placement:fa,rects:na,middlewareData:ta}=d,{offset:Ha=0,mainAxis:Sa=!0,crossAxis:Za=!0}=a;var fb={x:k,y:G};d=cl(fa);const ib="x"===d?"y":"x";let Bb=fb[d];fb=fb[ib];var Ob="function"==typeof Ha?Ha(Re(Ud({},na),{placement:fa})):
Ha;Ob="number"==typeof Ob?{mainAxis:Ob,crossAxis:0}:Ud({mainAxis:0,crossAxis:0},Ob);if(Sa){var Fb="y"===d?"height":"width",cc=na.reference[d]-na.floating[Fb]+Ob.mainAxis;Fb=na.reference[d]+na.reference[Fb]-Ob.mainAxis;Bb<cc?Bb=cc:Bb>Fb&&(Bb=Fb)}if(Za){var oc,Xb,hc,ec;const Ec="y"===d?"width":"height";cc=["top","left"].includes(wi(fa));Fb=na.reference[ib]-na.floating[Ec]+(cc&&null!=(oc=null==(Xb=ta.offset)?void 0:Xb[ib])?oc:0)+(cc?0:Ob.crossAxis);oc=na.reference[ib]+na.reference[Ec]+(cc?0:null!=(hc=
null==(ec=ta.offset)?void 0:ec[ib])?hc:0)-(cc?Ob.crossAxis:0);fb<Fb?fb=Fb:fb>oc&&(fb=oc)}return{[d]:Bb,[ib]:fb}}}},pG=function(a){return void 0===a&&(a={}),{name:"size",options:a,fn(d){return Nh(this,null,function*(){const {placement:k,rects:G,platform:fa,elements:na}=d;var ta=a,{apply:Ha}=ta;ta=nf(ta,["apply"]);ta=yield Dk(d,ta);var Sa=wi(k),Za=k.split("-")[1],fb,ib;"top"===Sa||"bottom"===Sa?(fb=Sa,ib=Za===((yield null==fa.isRTL?void 0:fa.isRTL(na.floating))?"start":"end")?"left":"right"):(ib=Sa,
fb="end"===Za?"top":"bottom");Sa=Pq(ta.left,0);Za=Pq(ta.right,0);const Bb=Pq(ta.top,0),Ob=Pq(ta.bottom,0);ib={availableHeight:G.floating.height-(["left","right"].includes(k)?2*(0!==Bb||0!==Ob?Bb+Ob:Pq(ta.top,ta.bottom)):ta[fb]),availableWidth:G.floating.width-(["top","bottom"].includes(k)?2*(0!==Sa||0!==Za?Sa+Za:Pq(ta.left,ta.right)):ta[ib])};fb=yield fa.getDimensions(na.floating);null==Ha||Ha(Ud(Ud({},d),ib));Ha=yield fa.getDimensions(na.floating);return fb.width!==Ha.width||fb.height!==Ha.height?
{reset:{rects:!0}}:{}})}}},IB=Math.min,Pu=Math.max,hw=Math.round,qG={getClippingRect:function(a){let {element:d,boundary:k,rootBoundary:G,strategy:fa}=a;a=[...("clippingAncestors"===k?Pf(d):[].concat(k)),G];a=a.reduce((na,ta)=>{ta=Qg(d,ta,fa);return na.top=Pu(ta.top,na.top),na.right=IB(ta.right,na.right),na.bottom=IB(ta.bottom,na.bottom),na.left=Pu(ta.left,na.left),na},Qg(d,a[0],fa));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(a){let {rect:d,
offsetParent:k,strategy:G}=a;var fa=jc(k);const na=hd(k);if(k===na)return d;a={scrollLeft:0,scrollTop:0};var ta=0,Ha=0;(fa||!fa&&"fixed"!==G)&&(("body"!==Tb(k)||fc(na))&&(a=Ld(k)),jc(k))&&(fa=Sc(k,!0),ta=fa.x+k.clientLeft,Ha=fa.y+k.clientTop);return Re(Ud({},d),{x:d.x-a.scrollLeft+ta,y:d.y-a.scrollTop+Ha})},isElement:Lb,getDimensions:jf,getOffsetParent:af,getDocumentElement:hd,getElementRects:a=>{let {reference:d,floating:k,strategy:G}=a;a=af(k);var fa=jc(a);const na=hd(a);var ta;if(ta=fa)ta=Sc(a),
ta=hw(ta.width)!==a.offsetWidth||hw(ta.height)!==a.offsetHeight;ta=Sc(d,ta,"fixed"===G);let Ha={scrollLeft:0,scrollTop:0};var Sa=0,Za=0;if(fa||!fa&&"fixed"!==G)(("body"!==Tb(a)||fc(na))&&(Ha=Ld(a)),jc(a))?(fa=Sc(a,!0),Sa=fa.x+a.clientLeft,Za=fa.y+a.clientTop):na&&(Sa=pe(na));return{reference:{x:ta.left+Ha.scrollLeft-Sa,y:ta.top+Ha.scrollTop-Za,width:ta.width,height:ta.height},floating:Re(Ud({},jf(k)),{x:0,y:0})}},getClientRects:a=>Array.from(a.getClientRects()),isRTL:a=>"rtl"===qc(a).direction},rG=
(a,d,k)=>mG(a,d,Ud({platform:qG},k)),Fo=$e(ba(22),1),JB=ba(22),sG=$e(ba(31),1),by="undefined"!==typeof document?JB.useLayoutEffect:JB.useEffect,KB=a=>{const {element:d,padding:k}=a;return{name:"arrow",options:a,fn(G){if(Object.prototype.hasOwnProperty.call(d,"current")){if(null!=d.current)return BB({element:d.current,padding:k}).fn(G)}else if(d)return BB({element:d,padding:k}).fn(G);return{}}}},cy=ba(22),tG=(0,cy.forwardRef)((a,d)=>{const {children:k,width:G=10,height:fa=5}=a,na=nf(a,["children",
"width","height"]);return(0,cy.createElement)(Gk.svg,He({},na,{ref:d,width:G,height:fa,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),a.asChild?k:(0,cy.createElement)("polygon",{points:"0,0 30,0 15,10"}))}),uG=ba(22),[dy,Mt]=Ji("Popper"),[vG,LB]=dy("Popper"),ey=(0,Ql.forwardRef)((a,d)=>{const {__scopePopper:k,virtualRef:G}=a;a=nf(a,["__scopePopper","virtualRef"]);const fa=LB("PopperAnchor",k),na=(0,Ql.useRef)(null);d=eh(d,na);(0,Ql.useEffect)(()=>{fa.onAnchorChange((null===G||void 0===G?void 0:
G.current)||na.current)});return G?null:(0,Ql.createElement)(Gk.div,He({},a,{ref:d}))}),[wG,xG]=dy("PopperContent"),[yG,zG]=dy("PopperContent",{hasParent:!1,positionUpdateFns:new Set}),fy=(0,Ql.forwardRef)((a,d)=>{var k,G,fa,na,ta,Ha,Sa,Za;const {__scopePopper:fb,side:ib="bottom",sideOffset:Bb=0,align:Ob="center",alignOffset:Fb=0,arrowPadding:cc=0,collisionBoundary:oc=[],collisionPadding:Xb=0,sticky:hc="partial",hideWhenDetached:ec=!1,avoidCollisions:Ec=!0}=a;a=nf(a,"__scopePopper side sideOffset align alignOffset arrowPadding collisionBoundary collisionPadding sticky hideWhenDetached avoidCollisions".split(" "));
const Ic=LB("PopperContent",fb),[nd,Bd]=(0,Ql.useState)(null);d=eh(d,wk=>Bd(wk));const [Ee,Vd]=(0,Ql.useState)(null);var te=Oh(Ee),gf=null!==(k=null===te||void 0===te?void 0:te.width)&&void 0!==k?k:0;k=null!==(G=null===te||void 0===te?void 0:te.height)&&void 0!==G?G:0;G=ib+("center"!==Ob?"-"+Ob:"");te="number"===typeof Xb?Xb:Ud({top:0,right:0,bottom:0,left:0},Xb);const Be=Array.isArray(oc)?oc:[oc],Fe=0<Be.length;te={padding:te,boundary:Be.filter($f),altBoundary:Fe};const {reference:Fd,floating:bd,
strategy:Gd,x:Zc,y:td,placement:we,middlewareData:Te,update:vf}=Sf({strategy:"fixed",placement:G,whileElementsMounted:Qf,middleware:[FB({mainAxis:Bb+k,alignmentAxis:Fb}),Ec?GB(Ud({mainAxis:!0,crossAxis:!1,limiter:"partial"===hc?HB():void 0},te)):void 0,Ee?KB({element:Ee,padding:cc}):void 0,Ec?DB(Ud({},te)):void 0,BG({arrowWidth:gf,arrowHeight:k}),ec?EB({strategy:"referenceHidden"}):void 0].filter(Jj)});Bm(()=>{Fd(Ic.anchor)},[Fd,Ic.anchor]);const hf=null!==Zc&&null!==td,[Mf,Ig]=xi(we);gf=null===(fa=
Te.arrow)||void 0===fa?void 0:fa.x;fa=null===(na=Te.arrow)||void 0===na?void 0:na.y;na=0!==(null===(ta=Te.arrow)||void 0===ta?void 0:ta.centerOffset);const [qf,Cg]=(0,Ql.useState)();Bm(()=>{nd&&Cg(window.getComputedStyle(nd).zIndex)},[nd]);const {hasParent:dh,positionUpdateFns:Qi}=zG("PopperContent",fb),bk=!dh;(0,Ql.useLayoutEffect)(()=>{if(!bk)return Qi.add(vf),()=>{Qi.delete(vf)}},[bk,Qi,vf]);(0,Ql.useLayoutEffect)(()=>{bk&&hf&&Array.from(Qi).reverse().forEach(wk=>requestAnimationFrame(wk))},[bk,
hf,Qi]);ta=Re(Ud({"data-side":Mf,"data-align":Ig},a),{ref:d,style:Re(Ud({},a.style),{animation:hf?void 0:"none",opacity:null!==(Ha=Te.hide)&&void 0!==Ha&&Ha.referenceHidden?0:void 0})});return(0,Ql.createElement)("div",{ref:bd,"data-radix-popper-content-wrapper":"",style:{position:Gd,left:0,top:0,transform:hf?`translate3d(${Math.round(Zc)}px, ${Math.round(td)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:qf,["--radix-popper-transform-origin"]:[null===(Sa=Te.transformOrigin)||void 0===
Sa?void 0:Sa.x,null===(Za=Te.transformOrigin)||void 0===Za?void 0:Za.y].join(" ")}},(0,Ql.createElement)(wG,{scope:fb,placedSide:Mf,onArrowChange:Vd,arrowX:gf,arrowY:fa,shouldHideArrow:na},bk?(0,Ql.createElement)(yG,{scope:fb,hasParent:!0,positionUpdateFns:Qi},(0,Ql.createElement)(Gk.div,ta)):(0,Ql.createElement)(Gk.div,ta)))}),AG={top:"bottom",right:"left",bottom:"top",left:"right"},MB=(0,Ql.forwardRef)(function(a,d){var {__scopePopper:k}=a;a=nf(a,["__scopePopper"]);k=xG("PopperArrow",k);return(0,Ql.createElement)("span",
{ref:k.onArrowChange,style:{position:"absolute",left:k.arrowX,top:k.arrowY,[AG[k.placedSide]]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[k.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[k.placedSide],visibility:k.shouldHideArrow?"hidden":void 0}},(0,Ql.createElement)(tG,He({},a,{ref:d,style:Re(Ud({},a.style),{display:"block"})})))}),BG=a=>
({name:"transformOrigin",options:a,fn(d){var k,G,fa,na,ta;const {placement:Ha,rects:Sa,middlewareData:Za}=d,fb=(d=0!==(null===(k=Za.arrow)||void 0===k?void 0:k.centerOffset))?0:a.arrowWidth;k=d?0:a.arrowHeight;const [ib,Bb]=xi(Ha),Ob={start:"0%",center:"50%",end:"100%"}[Bb],Fb=(null!==(G=null===(fa=Za.arrow)||void 0===fa?void 0:fa.x)&&void 0!==G?G:0)+fb/2;G=(null!==(na=null===(ta=Za.arrow)||void 0===ta?void 0:ta.y)&&void 0!==na?na:0)+k/2;ta=na="";"bottom"===ib?(na=d?Ob:`${Fb}px`,ta=`${-k}px`):"top"===
ib?(na=d?Ob:`${Fb}px`,ta=`${Sa.floating.height+k}px`):"right"===ib?(na=`${-k}px`,ta=d?Ob:`${G}px`):"left"===ib&&(na=`${Sa.floating.width+k}px`,ta=d?Ob:`${G}px`);return{data:{x:na,y:ta}}}}),gy=a=>{const {__scopePopper:d,children:k}=a,[G,fa]=(0,Ql.useState)(null);return(0,Ql.createElement)(vG,{scope:d,anchor:G,onAnchorChange:fa},k)},NB=ba(22),CG=$e(ba(31)),DG=(0,NB.forwardRef)((a,d)=>{var k;const {container:G=null===globalThis||void 0===globalThis?void 0:null===(k=globalThis.document)||void 0===k?void 0:
k.body}=a;a=nf(a,["container"]);return G?CG.default.createPortal((0,NB.createElement)(Gk.div,He({},a,{ref:d})),G):null}),Qq=ba(22),EG=ba(31),Qu=a=>{const {present:d,children:k}=a;a=yg(d);const G="function"===typeof k?k({present:a.isPresent}):Qq.Children.only(k),fa=eh(a.ref,G.ref);return"function"===typeof k||a.isPresent?(0,Qq.cloneElement)(G,{ref:fa}):null};Qu.displayName="Presence";var iw=ba(22),OB=ba(22),FG=(0,OB.forwardRef)((a,d)=>(0,OB.createElement)(Gk.span,He({},a,{ref:d,style:Ud({position:"absolute",
border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"},a.style)}))),[jw]=Ji("Tooltip",[Mt]),kw=Mt(),[GG,hy]=jw("TooltipProvider"),[HG,Ru]=jw("Tooltip"),IG=(0,ah.forwardRef)((a,d)=>{var {__scopeTooltip:k}=a;const G=nf(a,["__scopeTooltip"]),fa=Ru("TooltipTrigger",k),na=hy("TooltipTrigger",k);k=kw(k);const ta=(0,ah.useRef)(null);d=eh(d,ta,fa.onTriggerChange);const Ha=(0,ah.useRef)(!1),Sa=(0,ah.useRef)(!1),Za=(0,ah.useCallback)(()=>
Ha.current=!1,[]);(0,ah.useEffect)(()=>()=>document.removeEventListener("pointerup",Za),[Za]);return(0,ah.createElement)(ey,He({asChild:!0},k),(0,ah.createElement)(Gk.button,He({"aria-describedby":fa.open?fa.contentId:void 0,"data-state":fa.stateAttribute},G,{ref:d,onPointerMove:Lf(a.onPointerMove,fb=>{"touch"===fb.pointerType||Sa.current||na.isPointerInTransitRef.current||(fa.onTriggerEnter(),Sa.current=!0)}),onPointerLeave:Lf(a.onPointerLeave,()=>{fa.onTriggerLeave();Sa.current=!1}),onPointerDown:Lf(a.onPointerDown,
()=>{Ha.current=!0;document.addEventListener("pointerup",Za,{once:!0})}),onFocus:Lf(a.onFocus,()=>{if(!Ha.current)fa.onOpen()}),onBlur:Lf(a.onBlur,fa.onClose),onClick:Lf(a.onClick,fa.onClose)})))}),[JG,KG]=jw("TooltipPortal",{forceMount:void 0}),LG=(0,ah.forwardRef)((a,d)=>{var k=KG("TooltipContent",a.__scopeTooltip);const {forceMount:G=k.forceMount,side:fa="top"}=a;k=nf(a,["forceMount","side"]);a=Ru("TooltipContent",a.__scopeTooltip);return(0,ah.createElement)(Qu,{present:G||a.open},a.disableHoverableContent?
(0,ah.createElement)(PB,He({side:fa},k,{ref:d})):(0,ah.createElement)(MG,He({side:fa},k,{ref:d})))}),MG=(0,ah.forwardRef)((a,d)=>{const k=Ru("TooltipContent",a.__scopeTooltip),G=hy("TooltipContent",a.__scopeTooltip),fa=(0,ah.useRef)(null);d=eh(d,fa);const [na,ta]=(0,ah.useState)(null),{trigger:Ha,onClose:Sa}=k,Za=fa.current,{onPointerInTransitChange:fb}=G,ib=(0,ah.useCallback)(()=>{ta(null);fb(!1)},[fb]),Bb=(0,ah.useCallback)((Ob,Fb)=>{const cc=nm({x:Ob.clientX,y:Ob.clientY},Ob.currentTarget.getBoundingClientRect()),
oc="right"===cc||"bottom"===cc?-5:5;Ob="right"===cc||"left"===cc?{x:Ob.clientX+oc,y:Ob.clientY}:{x:Ob.clientX,y:Ob.clientY+oc};Fb=Fb.getBoundingClientRect();const {top:Xb,right:hc,bottom:ec,left:Ec}=Fb;Fb=hh([Ob,{x:Ec,y:Xb},{x:hc,y:Xb},{x:hc,y:ec},{x:Ec,y:ec}]);ta(Fb);fb(!0)},[fb]);(0,ah.useEffect)(()=>()=>ib(),[ib]);(0,ah.useEffect)(()=>{if(Ha&&Za){const Ob=cc=>Bb(cc,Za),Fb=cc=>Bb(cc,Ha);Ha.addEventListener("pointerleave",Ob);Za.addEventListener("pointerleave",Fb);return()=>{Ha.removeEventListener("pointerleave",
Ob);Za.removeEventListener("pointerleave",Fb)}}},[Ha,Za,Bb,ib]);(0,ah.useEffect)(()=>{if(na){const Ob=Fb=>{var cc=Fb.target;Fb={x:Fb.clientX,y:Fb.clientY};cc=(null===Ha||void 0===Ha?void 0:Ha.contains(cc))||(null===Za||void 0===Za?void 0:Za.contains(cc));const {x:oc,y:Xb}=Fb;Fb=!1;for(let hc=0,ec=na.length-1;hc<na.length;ec=hc++){const Ec=na[hc].x,Ic=na[hc].y,nd=na[ec].x,Bd=na[ec].y;Ic>Xb!==Bd>Xb&&oc<(nd-Ec)*(Xb-Ic)/(Bd-Ic)+Ec&&(Fb=!Fb)}Fb=!Fb;cc?ib():Fb&&(ib(),Sa())};document.addEventListener("pointermove",
Ob);return()=>document.removeEventListener("pointermove",Ob)}},[Ha,Za,na,Sa,ib]);return(0,ah.createElement)(PB,He({},a,{ref:d}))}),[NG,OG]=jw("Tooltip",{isInside:!1}),PB=(0,ah.forwardRef)((a,d)=>{const {__scopeTooltip:k,children:G,"aria-label":fa,onEscapeKeyDown:na,onPointerDownOutside:ta}=a;a=nf(a,["__scopeTooltip","children","aria-label","onEscapeKeyDown","onPointerDownOutside"]);const Ha=Ru("TooltipContent",k),Sa=kw(k),{onClose:Za}=Ha;(0,ah.useEffect)(()=>{document.addEventListener("tooltip.open",
Za);return()=>document.removeEventListener("tooltip.open",Za)},[Za]);(0,ah.useEffect)(()=>{if(Ha.trigger){const fb=ib=>{ib=ib.target;null!==ib&&void 0!==ib&&ib.contains(Ha.trigger)&&Za()};window.addEventListener("scroll",fb,{capture:!0});return()=>window.removeEventListener("scroll",fb,{capture:!0})}},[Ha.trigger,Za]);return(0,ah.createElement)($x,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:na,onPointerDownOutside:ta,onFocusOutside:fb=>fb.preventDefault(),onDismiss:Za},(0,ah.createElement)(fy,
He({"data-state":Ha.stateAttribute},Sa,a,{ref:d,style:Re(Ud({},a.style),{["--radix-tooltip-content-transform-origin"]:"var(--radix-popper-transform-origin)"})}),(0,ah.createElement)(yB,null,G),(0,ah.createElement)(NG,{scope:k,isInside:!0},(0,ah.createElement)(FG,{id:Ha.contentId,role:"tooltip"},fa||G))))}),PG=(0,ah.forwardRef)((a,d)=>{const {__scopeTooltip:k}=a;a=nf(a,["__scopeTooltip"]);const G=kw(k);return OG("TooltipArrow",k).isInside?null:(0,ah.createElement)(MB,He({},G,a,{ref:d}))}),QG=a=>{const {__scopeTooltip:d,
delayDuration:k=700,skipDelayDuration:G=300,disableHoverableContent:fa=!1,children:na}=a,[ta,Ha]=(0,ah.useState)(!0),Sa=(0,ah.useRef)(!1),Za=(0,ah.useRef)(0);(0,ah.useEffect)(()=>{const fb=Za.current;return()=>window.clearTimeout(fb)},[]);return(0,ah.createElement)(GG,{scope:d,isOpenDelayed:ta,delayDuration:k,onOpen:(0,ah.useCallback)(()=>{window.clearTimeout(Za.current);Ha(!1)},[]),onClose:(0,ah.useCallback)(()=>{window.clearTimeout(Za.current);Za.current=window.setTimeout(()=>Ha(!0),G)},[G]),isPointerInTransitRef:Sa,
onPointerInTransitChange:(0,ah.useCallback)(fb=>{Sa.current=fb},[]),disableHoverableContent:fa},na)},RG=a=>{const {__scopeTooltip:d,children:k,open:G,defaultOpen:fa=!1,onOpenChange:na,disableHoverableContent:ta,delayDuration:Ha}=a,Sa=hy("Tooltip",a.__scopeTooltip);a=kw(d);const [Za,fb]=(0,ah.useState)(null),ib=Sh(),Bb=(0,ah.useRef)(0),Ob=null!==ta&&void 0!==ta?ta:Sa.disableHoverableContent,Fb=null!==Ha&&void 0!==Ha?Ha:Sa.delayDuration,cc=(0,ah.useRef)(!1),[oc=!1,Xb]=Fh({prop:G,defaultProp:fa,onChange:nd=>
{if(nd)Sa.onOpen(),document.dispatchEvent(new CustomEvent("tooltip.open"));else Sa.onClose();null===na||void 0===na||na(nd)}}),hc=(0,ah.useMemo)(()=>oc?cc.current?"delayed-open":"instant-open":"closed",[oc]),ec=(0,ah.useCallback)(()=>{window.clearTimeout(Bb.current);cc.current=!1;Xb(!0)},[Xb]),Ec=(0,ah.useCallback)(()=>{window.clearTimeout(Bb.current);Xb(!1)},[Xb]),Ic=(0,ah.useCallback)(()=>{window.clearTimeout(Bb.current);Bb.current=window.setTimeout(()=>{cc.current=!0;Xb(!0)},Fb)},[Fb,Xb]);(0,ah.useEffect)(()=>
()=>window.clearTimeout(Bb.current),[]);return(0,ah.createElement)(gy,a,(0,ah.createElement)(HG,{scope:d,contentId:ib,open:oc,stateAttribute:hc,trigger:Za,onTriggerChange:fb,onTriggerEnter:(0,ah.useCallback)(()=>{Sa.isOpenDelayed?Ic():ec()},[Sa.isOpenDelayed,Ic,ec]),onTriggerLeave:(0,ah.useCallback)(()=>{Ob?Ec():window.clearTimeout(Bb.current)},[Ec,Ob]),onOpen:ec,onClose:Ec,disableHoverableContent:Ob},k))},SG=IG,TG=a=>{const {__scopeTooltip:d,forceMount:k,children:G,container:fa}=a;a=Ru("TooltipPortal",
d);return(0,ah.createElement)(JG,{scope:d,forceMount:k},(0,ah.createElement)(Qu,{present:k||a.open},(0,ah.createElement)(DG,{asChild:!0,container:fa},G)))},UG=LG,VG=PG,Gr=ba(598),QB=ba(598),iy=ba(598),WG=({style:a,icon:d,onClick:k})=>(0,iy.jsx)("button",{"data-html2canvas-ignore":"true",style:a,className:"tl-circle-button",onPointerDown:k,children:(0,iy.jsx)("div",{className:"tl-circle-button-icons-wrapper",children:(0,iy.jsx)(gh,{name:d})})}),RB=ba(22),SB=(0,RB.forwardRef)((a,d)=>{const {pressed:k,
defaultPressed:G=!1,onPressedChange:fa}=a,na=nf(a,["pressed","defaultPressed","onPressedChange"]),[ta=!1,Ha]=Fh({prop:k,onChange:fa,defaultProp:G});return(0,RB.createElement)(Gk.button,He({type:"button","aria-pressed":ta,"data-state":ta?"on":"off","data-disabled":a.disabled?"":void 0},na,{ref:d,onClick:Lf(a.onClick,()=>{a.disabled||Ha(!ta)})}))}),XG=SB,jy=ba(598),gp=ba(22),Lg=ba(22),mq=$e(ba(22)),TB=ba(22),YG=(0,TB.createContext)(void 0),ZG=ba(22),ky=0,Hr=ba(22),UB={bubbles:!1,cancelable:!0},VB=(0,Hr.forwardRef)((a,
d)=>{const {loop:k=!1,trapped:G=!1,onMountAutoFocus:fa,onUnmountAutoFocus:na}=a;a=nf(a,["loop","trapped","onMountAutoFocus","onUnmountAutoFocus"]);const [ta,Ha]=(0,Hr.useState)(null),Sa=Ei(fa),Za=Ei(na),fb=(0,Hr.useRef)(null);d=eh(d,Ob=>Ha(Ob));const ib=(0,Hr.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,Hr.useEffect)(()=>{if(G){let Ob=function(cc){!ib.paused&&ta&&(cc=cc.target,ta.contains(cc)?fb.current=cc:dk(fb.current,{select:!0}))},Fb=function(cc){!ib.paused&&
ta&&(ta.contains(cc.relatedTarget)||dk(fb.current,{select:!0}))};document.addEventListener("focusin",Ob);document.addEventListener("focusout",Fb);return()=>{document.removeEventListener("focusin",Ob);document.removeEventListener("focusout",Fb)}}},[G,ta,ib.paused]);(0,Hr.useEffect)(()=>{if(ta){WB.add(ib);const Ob=document.activeElement;if(!ta.contains(Ob)){const Fb=new CustomEvent("focusScope.autoFocusOnMount",UB);ta.addEventListener("focusScope.autoFocusOnMount",Sa);ta.dispatchEvent(Fb);Fb.defaultPrevented||
(ck(rp(lj(ta)),{select:!0}),document.activeElement===Ob&&dk(ta))}return()=>{ta.removeEventListener("focusScope.autoFocusOnMount",Sa);setTimeout(()=>{const Fb=new CustomEvent("focusScope.autoFocusOnUnmount",UB);ta.addEventListener("focusScope.autoFocusOnUnmount",Za);ta.dispatchEvent(Fb);Fb.defaultPrevented||dk(null!==Ob&&void 0!==Ob?Ob:document.body,{select:!0});ta.removeEventListener("focusScope.autoFocusOnUnmount",Za);WB.remove(ib)},0)}}},[ta,Sa,Za,ib]);const Bb=(0,Hr.useCallback)(Ob=>{if((k||G)&&
!ib.paused){var Fb=document.activeElement;if("Tab"===Ob.key&&!Ob.altKey&&!Ob.ctrlKey&&!Ob.metaKey&&Fb){const oc=Ob.currentTarget;var cc=oc;const Xb=lj(cc),hc=Kj(Xb,cc);cc=Kj(Xb.reverse(),cc);const [ec,Ec]=[hc,cc];ec&&Ec?Ob.shiftKey||Fb!==Ec?Ob.shiftKey&&Fb===ec&&(Ob.preventDefault(),k&&dk(Ec,{select:!0})):(Ob.preventDefault(),k&&dk(ec,{select:!0})):Fb===oc&&Ob.preventDefault()}}},[k,G,ib.paused]);return(0,Hr.createElement)(Gk.div,He({tabIndex:-1},a,{ref:d,onKeyDown:Bb}))}),WB=function(){let a=[];
return{add(d){const k=a[0];d===k||null!==k&&void 0!==k&&k.pause();a=xk(a,d);a.unshift(d)},remove(d){var k;a=xk(a,d);null===(k=a[0])||void 0===k||k.resume()}}}(),Rl=ba(22),$G={bubbles:!1,cancelable:!0},[ly,XB,aH]=Tk("RovingFocusGroup"),[bH,lw]=Ji("RovingFocusGroup",[aH]),[cH,dH]=bH("RovingFocusGroup"),YB=(0,Rl.forwardRef)((a,d)=>(0,Rl.createElement)(ly.Provider,{scope:a.__scopeRovingFocusGroup},(0,Rl.createElement)(ly.Slot,{scope:a.__scopeRovingFocusGroup},(0,Rl.createElement)(eH,He({},a,{ref:d}))))),
eH=(0,Rl.forwardRef)((a,d)=>{const {__scopeRovingFocusGroup:k,orientation:G,loop:fa=!1,dir:na,currentTabStopId:ta,defaultCurrentTabStopId:Ha,onCurrentTabStopIdChange:Sa,onEntryFocus:Za}=a,fb=nf(a,"__scopeRovingFocusGroup orientation loop dir currentTabStopId defaultCurrentTabStopId onCurrentTabStopIdChange onEntryFocus".split(" ")),ib=(0,Rl.useRef)(null);d=eh(d,ib);const Bb=Vn(na),[Ob=null,Fb]=Fh({prop:ta,defaultProp:Ha,onChange:Sa}),[cc,oc]=(0,Rl.useState)(!1),Xb=Ei(Za),hc=XB(k),ec=(0,Rl.useRef)(!1),
[Ec,Ic]=(0,Rl.useState)(0);(0,Rl.useEffect)(()=>{const nd=ib.current;if(nd)return nd.addEventListener("rovingFocusGroup.onEntryFocus",Xb),()=>nd.removeEventListener("rovingFocusGroup.onEntryFocus",Xb)},[Xb]);return(0,Rl.createElement)(cH,{scope:k,orientation:G,dir:Bb,loop:fa,currentTabStopId:Ob,onItemFocus:(0,Rl.useCallback)(nd=>Fb(nd),[Fb]),onItemShiftTab:(0,Rl.useCallback)(()=>oc(!0),[]),onFocusableItemAdd:(0,Rl.useCallback)(()=>Ic(nd=>nd+1),[]),onFocusableItemRemove:(0,Rl.useCallback)(()=>Ic(nd=>
nd-1),[])},(0,Rl.createElement)(Gk.div,He({tabIndex:cc||0===Ec?-1:0,"data-orientation":G},fb,{ref:d,style:Ud({outline:"none"},a.style),onMouseDown:Lf(a.onMouseDown,()=>{ec.current=!0}),onFocus:Lf(a.onFocus,nd=>{var Bd=!ec.current;if(nd.target===nd.currentTarget&&Bd&&!cc&&(Bd=new CustomEvent("rovingFocusGroup.onEntryFocus",$G),nd.currentTarget.dispatchEvent(Bd),!Bd.defaultPrevented)){nd=hc().filter(Vd=>Vd.focusable);Bd=nd.find(Vd=>Vd.active);const Ee=nd.find(Vd=>Vd.id===Ob);nd=[Bd,Ee,...nd].filter(Boolean).map(Vd=>
Vd.ref.current);zn(nd)}ec.current=!1}),onBlur:Lf(a.onBlur,()=>oc(!1))})))}),ZB=(0,Rl.forwardRef)((a,d)=>{const {__scopeRovingFocusGroup:k,focusable:G=!0,active:fa=!1}=a,na=nf(a,["__scopeRovingFocusGroup","focusable","active"]),ta=Sh(),Ha=dH("RovingFocusGroupItem",k),Sa=Ha.currentTabStopId===ta,Za=XB(k),{onFocusableItemAdd:fb,onFocusableItemRemove:ib}=Ha;(0,Rl.useEffect)(()=>{if(G)return fb(),()=>ib()},[G,fb,ib]);return(0,Rl.createElement)(ly.ItemSlot,{scope:k,id:ta,focusable:G,active:fa},(0,Rl.createElement)(Gk.span,
He({tabIndex:Sa?0:-1,"data-orientation":Ha.orientation},na,{ref:d,onMouseDown:Lf(a.onMouseDown,Bb=>{if(G)Ha.onItemFocus(ta);else Bb.preventDefault()}),onFocus:Lf(a.onFocus,()=>Ha.onItemFocus(ta)),onKeyDown:Lf(a.onKeyDown,Bb=>{if("Tab"===Bb.key&&Bb.shiftKey)Ha.onItemShiftTab();else if(Bb.target===Bb.currentTarget){var Ob=ko(Bb,Ha.orientation,Ha.dir);if(void 0!==Ob){Bb.preventDefault();let Fb=Za().filter(cc=>cc.focusable).map(cc=>cc.ref.current);if("last"===Ob)Fb.reverse();else if("prev"===Ob||"next"===
Ob)"prev"===Ob&&Fb.reverse(),Bb=Fb.indexOf(Bb.currentTarget),Fb=Ha.loop?Sg(Fb,Bb+1):Fb.slice(Bb+1);setTimeout(()=>zn(Fb))}}})})))}),fH={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"},gH=function(a){return"undefined"===typeof document?null:(Array.isArray(a)?a[0]:a).ownerDocument.body},Nt=new WeakMap,mw=new WeakMap,nw={},my=0,ny=function(a,d,k){void 0===d&&(d=gH(a));void 0===k&&(k="data-aria-hidden");var G=Array.isArray(a)?
a:[a];nw[k]||(nw[k]=new WeakMap);var fa=nw[k],na=[],ta=new Set,Ha=function(Za){Za&&!ta.has(Za)&&(ta.add(Za),Ha(Za.parentNode))};G.forEach(Ha);var Sa=function(Za){!Za||0<=G.indexOf(Za)||Array.prototype.forEach.call(Za.children,function(fb){if(ta.has(fb))Sa(fb);else{var ib=fb.getAttribute("aria-hidden");ib=null!==ib&&"false"!==ib;var Bb=(Nt.get(fb)||0)+1,Ob=(fa.get(fb)||0)+1;Nt.set(fb,Bb);fa.set(fb,Ob);na.push(fb);1===Bb&&ib&&mw.set(fb,!0);1===Ob&&fb.setAttribute(k,"true");ib||fb.setAttribute("aria-hidden",
"true")}})};Sa(d);ta.clear();my++;return function(){na.forEach(function(Za){var fb=Nt.get(Za)-1,ib=fa.get(Za)-1;Nt.set(Za,fb);fa.set(Za,ib);fb||(mw.has(Za)||Za.removeAttribute("aria-hidden"),mw.delete(Za));ib||Za.removeAttribute(k)});my--;my||(Nt=new WeakMap,Nt=new WeakMap,mw=new WeakMap,nw={})}},hH=$e(gs(),1),{__assign:Ir,__rest:$B,__spreadArray:iH}=hH.default,hp=$e(ba(22)),Rq=$e(ba(22)),jH=ba(22),kH=$e(ba(22)),oy=function(a){var d=a.sideCar;a=$B(a,["sideCar"]);if(!d)throw Error("Sidecar: please provide `sideCar` property to import the right car");
d=d.read();if(!d)throw Error("Sidecar medium not found");return kH.createElement(d,Ir({},a))};oy.isSideCarExport=!0;var Ym=function(a){void 0===a&&(a={});var d=mm(null);d.options=Ir({async:!0,ssr:!1},a);return d}(),Jn=function(){},mt=Rq.forwardRef(function(a,d){var k=Rq.useRef(null),G=Rq.useState({onScrollCapture:Jn,onWheelCapture:Jn,onTouchMoveCapture:Jn}),fa=G[0];G=G[1];var na=a.forwardProps,ta=a.children,Ha=a.className,Sa=a.removeScrollBar,Za=a.enabled,fb=a.shards,ib=a.sideCar,Bb=a.noIsolation,
Ob=a.inert,Fb=a.allowPinchZoom,cc=a.as;cc=void 0===cc?"div":cc;a=$B(a,"forwardProps children className removeScrollBar enabled shards sideCar noIsolation inert allowPinchZoom as".split(" "));d=vj([k,d]);fa=Ir(Ir({},a),fa);return Rq.createElement(Rq.Fragment,null,Za&&Rq.createElement(ib,{sideCar:Ym,removeScrollBar:Sa,shards:fb,noIsolation:Bb,inert:Ob,setCallbacks:G,allowPinchZoom:!!Fb,lockRef:k}),na?Rq.cloneElement(Rq.Children.only(ta),Ir(Ir({},fa),{ref:d})):Rq.createElement(cc,Ir({},fa,{className:Ha,
ref:d}),ta))});mt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};mt.classNames={fullWidth:"width-before-scroll-bar",zeroRight:"right-scroll-bar-position"};var fm=$e(ba(22)),yz=$e(ba(22)),zz=$e(ba(22)),WD=function(){var a=0,d=null;return{add:function(k){if(0==a){if(document){var G=document.createElement("style");G.type="text/css";var fa="undefined"!==typeof __webpack_nonce__?__webpack_nonce__:void 0;fa&&G.setAttribute("nonce",fa)}else G=null;if(d=G)G=d,G.styleSheet?G.styleSheet.cssText=k:G.appendChild(document.createTextNode(k)),
k=d,(document.head||document.getElementsByTagName("head")[0]).appendChild(k)}a++},remove:function(){a--;!a&&d&&(d.parentNode&&d.parentNode.removeChild(d),d=null)}}},nt=function(){var a=WD();return function(d,k){zz.useEffect(function(){a.add(d);return function(){a.remove()}},[d&&k])}},Ov=function(){var a=nt();return function(d){a(d.styles,d.dynamic);return null}},lH={left:0,top:0,right:0,gap:0},aC=Ov(),bC=function(a,d,k,G){var fa=a.left,na=a.top,ta=a.right;a=a.gap;void 0===k&&(k="margin");return"\n .".concat("with-scroll-bars-hidden",
" {\n overflow: hidden ").concat(G,";\n padding-right: ").concat(a,"px ").concat(G,";\n }\n body {\n overflow: hidden ").concat(G,";\n overscroll-behavior: contain;\n ").concat([d&&"position: relative ".concat(G,";"),"margin"===k&&"\n padding-left: ".concat(fa,"px;\n padding-top: ").concat(na,"px;\n padding-right: ").concat(ta,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(a,"px ").concat(G,";\n "),"padding"===k&&"padding-right: ".concat(a,"px ").concat(G,
";")].filter(Boolean).join(""),"\n }\n \n .").concat("right-scroll-bar-position"," {\n right: ").concat(a,"px ").concat(G,";\n }\n \n .").concat("width-before-scroll-bar"," {\n margin-right: ").concat(a,"px ").concat(G,";\n }\n \n .").concat("right-scroll-bar-position"," .").concat("right-scroll-bar-position"," {\n right: 0 ").concat(G,";\n }\n \n .").concat("width-before-scroll-bar"," .").concat("width-before-scroll-bar"," {\n margin-right: 0 ").concat(G,";\n }\n \n body {\n ").concat("--removed-body-scroll-bar-size",
": ").concat(a,"px;\n }\n")},cC=function(a){var d=a.noRelative,k=a.noImportant;a=a.gapMode;var G=void 0===a?"margin":a;a=yz.useMemo(function(){var fa=G;void 0===fa&&(fa="margin");if("undefined"===typeof window)fa=lH;else{var na=window.getComputedStyle(document.body),ta=na["padding"===fa?"paddingTop":"marginTop"],Ha=na["padding"===fa?"paddingRight":"marginRight"];fa=[parseInt(na["padding"===fa?"paddingLeft":"marginLeft"]||"",10)||0,parseInt(ta||"",10)||0,parseInt(Ha||"",10)||0];fa={left:fa[0],top:fa[1],
right:fa[2],gap:Math.max(0,window.innerWidth-document.documentElement.clientWidth+fa[2]-fa[0])}}return fa},[G]);return yz.createElement(aC,{styles:bC(a,!d,G,k?"":"!important")})},ow=!1;if("undefined"!==typeof window)try{var Pv=Object.defineProperty({},"passive",{get:function(){return ow=!0}});window.addEventListener("test",Pv,Pv);window.removeEventListener("test",Pv,Pv)}catch(a){ow=!1}var Nq=ow?{passive:!1}:!1,sx=function(a,d){var k=window.getComputedStyle(a);return"hidden"!==k[d]&&!(k.overflowY===
k.overflowX&&"TEXTAREA"!==a.tagName&&"visible"===k[d])},rx=function(a,d){do{"undefined"!==typeof ShadowRoot&&d instanceof ShadowRoot&&(d=d.host);if(dC(a,d)){var k=eC(a,d);if(k[1]>k[2])return!0}d=d.parentNode}while(d&&d!==document.body);return!1},dC=function(a,d){return"v"===a?sx(d,"overflowY"):sx(d,"overflowX")},eC=function(a,d){return"v"===a?[d.scrollTop,d.scrollHeight,d.clientHeight]:[d.scrollLeft,d.scrollWidth,d.clientWidth]},pw=function(a){return"changedTouches"in a?[a.changedTouches[0].clientX,
a.changedTouches[0].clientY]:[0,0]},py=function(a){return a&&"current"in a?a.current:a},qy=function(a){return"\n .block-interactivity-".concat(a," {pointer-events: none;}\n .allow-interactivity-").concat(a," {pointer-events: all;}\n")},rk=0,wn=[];Ym.useMedium(function(a){var d=fm.useRef([]),k=fm.useRef([0,0]),G=fm.useRef(),fa=fm.useState(rk++)[0],na=fm.useState(function(){return Ov()})[0],ta=fm.useRef(a);fm.useEffect(function(){ta.current=a},[a]);fm.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(fa));
var Fb=iH([a.lockRef.current],(a.shards||[]).map(py),!0).filter(Boolean);Fb.forEach(function(cc){return cc.classList.add("allow-interactivity-".concat(fa))});return function(){document.body.classList.remove("block-interactivity-".concat(fa));Fb.forEach(function(cc){return cc.classList.remove("allow-interactivity-".concat(fa))})}}},[a.inert,a.lockRef.current,a.shards]);var Ha=fm.useCallback(function(Fb,cc){if("touches"in Fb&&2===Fb.touches.length)return!ta.current.allowPinchZoom;var oc=pw(Fb),Xb=k.current,
hc="deltaX"in Fb?Fb.deltaX:Xb[0]-oc[0];Xb="deltaY"in Fb?Fb.deltaY:Xb[1]-oc[1];var ec=Fb.target,Ec=Math.abs(hc)>Math.abs(Xb)?"h":"v";if("touches"in Fb&&"h"===Ec&&"range"===ec.type)return!1;var Ic=rx(Ec,ec);if(!Ic)return!0;Ic?oc=Ec:(oc="v"===Ec?"h":"v",Ic=rx(Ec,ec));if(!Ic)return!1;!G.current&&"changedTouches"in Fb&&(hc||Xb)&&(G.current=oc);if(!oc)return!0;oc=G.current||oc;Xb="h"===oc?hc:Xb;hc=window.getComputedStyle(cc).direction;hc="h"===oc&&"rtl"===hc?-1:1;Ec=hc*Xb;Fb=Fb.target;Xb=cc.contains(Fb);
ec=!1;Ec=0<Ec;var nd=Ic=0;do{var Bd=eC(oc,Fb),Ee=Bd[0];Bd=Bd[1]-Bd[2]-hc*Ee;(Ee||Bd)&&dC(oc,Fb)&&(Ic+=Bd,nd+=Ee);Fb=Fb.parentNode}while(!Xb&&Fb!==document.body||Xb&&(cc.contains(Fb)||cc===Fb));Ec&&0===Ic?ec=!0:Ec||0!==nd||(ec=!0);return ec},[]),Sa=fm.useCallback(function(Fb){if(wn.length&&wn[wn.length-1]===na){var cc="deltaY"in Fb?[Fb.deltaX,Fb.deltaY]:pw(Fb),oc=d.current.filter(function(Xb){var hc;if(hc=Xb.name===Fb.type&&Xb.target===Fb.target)Xb=Xb.delta,hc=Xb[0]===cc[0]&&Xb[1]===cc[1];return hc})[0];
oc&&oc.should?Fb.cancelable&&Fb.preventDefault():oc||(oc=(ta.current.shards||[]).map(py).filter(Boolean).filter(function(Xb){return Xb.contains(Fb.target)}),(0<oc.length?Ha(Fb,oc[0]):!ta.current.noIsolation)&&Fb.cancelable&&Fb.preventDefault())}},[]),Za=fm.useCallback(function(Fb,cc,oc,Xb){var hc={name:Fb,delta:cc,target:oc,should:Xb};d.current.push(hc);setTimeout(function(){d.current=d.current.filter(function(ec){return ec!==hc})},1)},[]),fb=fm.useCallback(function(Fb){k.current=pw(Fb);G.current=
void 0},[]),ib=fm.useCallback(function(Fb){Za(Fb.type,[Fb.deltaX,Fb.deltaY],Fb.target,Ha(Fb,a.lockRef.current))},[]),Bb=fm.useCallback(function(Fb){Za(Fb.type,pw(Fb),Fb.target,Ha(Fb,a.lockRef.current))},[]);fm.useEffect(function(){wn.push(na);a.setCallbacks({onScrollCapture:ib,onWheelCapture:ib,onTouchMoveCapture:Bb});document.addEventListener("wheel",Sa,Nq);document.addEventListener("touchmove",Sa,Nq);document.addEventListener("touchstart",fb,Nq);return function(){wn=wn.filter(function(Fb){return Fb!==
na});document.removeEventListener("wheel",Sa,Nq);document.removeEventListener("touchmove",Sa,Nq);document.removeEventListener("touchstart",fb,Nq)}},[]);var Ob=a.removeScrollBar;return fm.createElement(fm.Fragment,null,a.inert?fm.createElement(na,{styles:qy(fa)}):null,Ob?fm.createElement(cC,{gapMode:"margin"}):null)});var sk=hp.forwardRef(function(a,d){return hp.createElement(mt,Ir({},a,{ref:d,sideCar:oy}))});sk.classNames=mt.classNames;var Sq=["Enter"," "],im=["ArrowUp","PageDown","End"],Go=["ArrowDown",
"PageUp","Home",...im];[...Sq];[...Sq];var [Fi,fC,qw]=Tk("Menu"),[nq,Ot]=Ji("Menu",[qw,Mt,lw]),rw=Mt(),sw=lw(),[Pi,Pt]=nq("Menu"),[ry,Su]=nq("Menu"),Ns=(0,Lg.forwardRef)((a,d)=>{var {__scopeMenu:k}=a;a=nf(a,["__scopeMenu"]);k=rw(k);return(0,Lg.createElement)(ey,He({},k,a,{ref:d}))}),[,gC]=nq("MenuPortal",{forceMount:void 0}),[Os,hC]=nq("MenuContent"),Tu=(0,Lg.forwardRef)((a,d)=>{var k=gC("MenuContent",a.__scopeMenu);({forceMount:k=k.forceMount}=a);const G=nf(a,["forceMount"]),fa=Pt("MenuContent",
a.__scopeMenu),na=Su("MenuContent",a.__scopeMenu);return(0,Lg.createElement)(Fi.Provider,{scope:a.__scopeMenu},(0,Lg.createElement)(Qu,{present:k||fa.open},(0,Lg.createElement)(Fi.Slot,{scope:a.__scopeMenu},na.modal?(0,Lg.createElement)(tw,He({},G,{ref:d})):(0,Lg.createElement)(sy,He({},G,{ref:d})))))}),tw=(0,Lg.forwardRef)((a,d)=>{const k=Pt("MenuContent",a.__scopeMenu),G=(0,Lg.useRef)(null);d=eh(d,G);(0,Lg.useEffect)(()=>{const fa=G.current;if(fa)return ny(fa)},[]);return(0,Lg.createElement)(Qt,
He({},a,{ref:d,trapFocus:k.open,disableOutsidePointerEvents:k.open,disableOutsideScroll:!0,onFocusOutside:Lf(a.onFocusOutside,fa=>fa.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>k.onOpenChange(!1)}))}),sy=(0,Lg.forwardRef)((a,d)=>{const k=Pt("MenuContent",a.__scopeMenu);return(0,Lg.createElement)(Qt,He({},a,{ref:d,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>k.onOpenChange(!1)}))}),Qt=(0,Lg.forwardRef)((a,d)=>{const {__scopeMenu:k,loop:G=!1,trapFocus:fa,
onOpenAutoFocus:na,onCloseAutoFocus:ta,disableOutsidePointerEvents:Ha,onEscapeKeyDown:Sa,onPointerDownOutside:Za,onFocusOutside:fb,onInteractOutside:ib,onDismiss:Bb,disableOutsideScroll:Ob}=a,Fb=nf(a,"__scopeMenu loop trapFocus onOpenAutoFocus onCloseAutoFocus disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside onDismiss disableOutsideScroll".split(" ")),cc=Pt("MenuContent",k),oc=Su("MenuContent",k),Xb=rw(k),hc=sw(k),ec=fC(k),[Ec,Ic]=(0,Lg.useState)(null),
nd=(0,Lg.useRef)(null);d=eh(d,nd,cc.onContentChange);const Bd=(0,Lg.useRef)(0),Ee=(0,Lg.useRef)(""),Vd=(0,Lg.useRef)(0),te=(0,Lg.useRef)(null),gf=(0,Lg.useRef)("right"),Be=(0,Lg.useRef)(0),Fe=Ob?sk:Lg.Fragment,Fd=Ob?{as:lq,allowPinchZoom:!0}:void 0,bd=Zc=>{var td,we;Zc=Ee.current+Zc;const Te=ec().filter(qf=>!qf.disabled),vf=document.activeElement,hf=null===(td=Te.find(qf=>qf.ref.current===vf))||void 0===td?void 0:td.textValue;td=Te.map(qf=>qf.textValue);const Mf=dj(td,Zc,hf),Ig=null===(we=Te.find(qf=>
qf.textValue===Mf))||void 0===we?void 0:we.ref.current;(function dh(Cg){Ee.current=Cg;window.clearTimeout(Bd.current);""!==Cg&&(Bd.current=window.setTimeout(()=>dh(""),1E3))})(Zc);Ig&&setTimeout(()=>Ig.focus())};(0,Lg.useEffect)(()=>()=>window.clearTimeout(Bd.current),[]);hi();const Gd=(0,Lg.useCallback)(Zc=>{var td,we,Te;if(Te=gf.current===(null===(td=te.current)||void 0===td?void 0:td.side)){if(td=null===(we=te.current)||void 0===we?void 0:we.area){const {x:vf,y:hf}={x:Zc.clientX,y:Zc.clientY};
Zc=!1;for(let Mf=0,Ig=td.length-1;Mf<td.length;Ig=Mf++){we=td[Mf].x;Te=td[Mf].y;const qf=td[Ig].x,Cg=td[Ig].y;Te>hf!==Cg>hf&&vf<(qf-we)*(hf-Te)/(Cg-Te)+we&&(Zc=!Zc)}td=Zc}else td=!1;Te=td}return Te},[]);return(0,Lg.createElement)(Os,{scope:k,searchRef:Ee,onItemEnter:(0,Lg.useCallback)(Zc=>{Gd(Zc)&&Zc.preventDefault()},[Gd]),onItemLeave:(0,Lg.useCallback)(Zc=>{var td;Gd(Zc)||(null===(td=nd.current)||void 0===td||td.focus(),Ic(null))},[Gd]),onTriggerLeave:(0,Lg.useCallback)(Zc=>{Gd(Zc)&&Zc.preventDefault()},
[Gd]),pointerGraceTimerRef:Vd,onPointerGraceIntentChange:(0,Lg.useCallback)(Zc=>{te.current=Zc},[])},(0,Lg.createElement)(Fe,Fd,(0,Lg.createElement)(VB,{asChild:!0,trapped:fa,onMountAutoFocus:Lf(na,Zc=>{var td;Zc.preventDefault();null===(td=nd.current)||void 0===td||td.focus()}),onUnmountAutoFocus:ta},(0,Lg.createElement)($x,{asChild:!0,disableOutsidePointerEvents:Ha,onEscapeKeyDown:Sa,onPointerDownOutside:Za,onFocusOutside:fb,onInteractOutside:ib,onDismiss:Bb},(0,Lg.createElement)(YB,He({asChild:!0},
hc,{dir:oc.dir,orientation:"vertical",loop:G,currentTabStopId:Ec,onCurrentTabStopIdChange:Ic,onEntryFocus:Zc=>{oc.isUsingKeyboardRef.current||Zc.preventDefault()}}),(0,Lg.createElement)(fy,He({role:"menu","aria-orientation":"vertical","data-state":cc.open?"open":"closed","data-radix-menu-content":"",dir:oc.dir},Xb,Fb,{ref:d,style:Ud({outline:"none"},Fb.style),onKeyDown:Lf(Fb.onKeyDown,Zc=>{var td=Zc.target.closest("[data-radix-menu-content]")===Zc.currentTarget;const we=Zc.ctrlKey||Zc.altKey||Zc.metaKey,
Te=1===Zc.key.length;td&&("Tab"===Zc.key&&Zc.preventDefault(),!we&&Te&&bd(Zc.key));Zc.target===nd.current&&Go.includes(Zc.key)&&(Zc.preventDefault(),td=ec().filter(vf=>!vf.disabled).map(vf=>vf.ref.current),im.includes(Zc.key)&&td.reverse(),To(td))}),onBlur:Lf(a.onBlur,Zc=>{Zc.currentTarget.contains(Zc.target)||(window.clearTimeout(Bd.current),Ee.current="")}),onPointerMove:Lf(a.onPointerMove,xo(Zc=>{const td=Be.current!==Zc.clientX;Zc.currentTarget.contains(Zc.target)&&td&&(gf.current=Zc.clientX>
Be.current?"right":"left",Be.current=Zc.clientX)}))})))))))}),uw=(0,Lg.forwardRef)((a,d)=>{const {disabled:k=!1,onSelect:G}=a,fa=nf(a,["disabled","onSelect"]),na=(0,Lg.useRef)(null),ta=Su("MenuItem",a.__scopeMenu),Ha=hC("MenuItem",a.__scopeMenu);d=eh(d,na);const Sa=(0,Lg.useRef)(!1);return(0,Lg.createElement)(Uu,He({},fa,{ref:d,disabled:k,onClick:Lf(a.onClick,()=>{const Za=na.current;if(!k&&Za){const fb=new CustomEvent("menu.itemSelect",{bubbles:!0,cancelable:!0});Za.addEventListener("menu.itemSelect",
ib=>null===G||void 0===G?void 0:G(ib),{once:!0});Mk(Za,fb);if(fb.defaultPrevented)Sa.current=!1;else ta.onClose()}}),onPointerDown:Za=>{var fb;null===(fb=a.onPointerDown)||void 0===fb||fb.call(a,Za);Sa.current=!0},onPointerUp:Lf(a.onPointerUp,Za=>{var fb;Sa.current||null===(fb=Za.currentTarget)||void 0===fb||fb.click()}),onKeyDown:Lf(a.onKeyDown,Za=>{const fb=""!==Ha.searchRef.current;k||fb&&" "===Za.key||!Sq.includes(Za.key)||(Za.currentTarget.click(),Za.preventDefault())})}))}),Uu=(0,Lg.forwardRef)((a,
d)=>{const {__scopeMenu:k,disabled:G=!1,textValue:fa}=a,na=nf(a,["__scopeMenu","disabled","textValue"]),ta=hC("MenuItem",k),Ha=sw(k),Sa=(0,Lg.useRef)(null);d=eh(d,Sa);const [Za,fb]=(0,Lg.useState)(!1),[ib,Bb]=(0,Lg.useState)("");(0,Lg.useEffect)(()=>{const Ob=Sa.current;if(Ob){var Fb;Bb((null!==(Fb=Ob.textContent)&&void 0!==Fb?Fb:"").trim())}},[na.children]);return(0,Lg.createElement)(Fi.ItemSlot,{scope:k,disabled:G,textValue:null!==fa&&void 0!==fa?fa:ib},(0,Lg.createElement)(ZB,He({asChild:!0},Ha,
{focusable:!G}),(0,Lg.createElement)(Gk.div,He({role:"menuitem","data-highlighted":Za?"":void 0,"aria-disabled":G||void 0,"data-disabled":G?"":void 0},na,{ref:d,onPointerMove:Lf(a.onPointerMove,xo(Ob=>{if(G)ta.onItemLeave(Ob);else ta.onItemEnter(Ob),Ob.defaultPrevented||Ob.currentTarget.focus()})),onPointerLeave:Lf(a.onPointerLeave,xo(Ob=>ta.onItemLeave(Ob))),onFocus:Lf(a.onFocus,()=>fb(!0)),onBlur:Lf(a.onBlur,()=>fb(!1))}))))});nq("MenuRadioGroup",{value:void 0,onValueChange:()=>{}});nq("MenuItemIndicator",
{checked:!1});var iC=(0,Lg.forwardRef)((a,d)=>{a=nf(a,["__scopeMenu"]);return(0,Lg.createElement)(Gk.div,He({role:"separator","aria-orientation":"horizontal"},a,{ref:d}))});nq("MenuSub");var ty=a=>{const {__scopeMenu:d,open:k=!1,children:G,dir:fa,onOpenChange:na,modal:ta=!0}=a;a=rw(d);const [Ha,Sa]=(0,Lg.useState)(null),Za=(0,Lg.useRef)(!1),fb=Ei(na),ib=Vn(fa);(0,Lg.useEffect)(()=>{const Bb=()=>{Za.current=!0;document.addEventListener("pointerdown",Ob,{capture:!0,once:!0});document.addEventListener("pointermove",
Ob,{capture:!0,once:!0})},Ob=()=>Za.current=!1;document.addEventListener("keydown",Bb,{capture:!0});return()=>{document.removeEventListener("keydown",Bb,{capture:!0});document.removeEventListener("pointerdown",Ob,{capture:!0});document.removeEventListener("pointermove",Ob,{capture:!0})}},[]);return(0,Lg.createElement)(gy,a,(0,Lg.createElement)(Pi,{scope:d,open:k,onOpenChange:fb,content:Ha,onContentChange:Sa},(0,Lg.createElement)(ry,{scope:d,onClose:(0,Lg.useCallback)(()=>fb(!1),[fb]),isUsingKeyboardRef:Za,
dir:ib,modal:ta},G)))},[mH]=Ji("DropdownMenu",[Ot]),Tq=Ot(),[Vu,Wu]=mH("DropdownMenu"),vw=(0,gp.forwardRef)((a,d)=>{const {__scopeDropdownMenu:k,disabled:G=!1}=a,fa=nf(a,["__scopeDropdownMenu","disabled"]),na=Wu("DropdownMenuTrigger",k),ta=Tq(k);return(0,gp.createElement)(Ns,He({asChild:!0},ta),(0,gp.createElement)(Gk.button,He({type:"button",id:na.triggerId,"aria-haspopup":"menu","aria-expanded":na.open,"aria-controls":na.open?na.contentId:void 0,"data-state":na.open?"open":"closed","data-disabled":G?
"":void 0,disabled:G},fa,{ref:xg(d,na.triggerRef),onPointerDown:Lf(a.onPointerDown,Ha=>{G||0!==Ha.button||!1!==Ha.ctrlKey||(na.onOpenToggle(),na.open||Ha.preventDefault())}),onKeyDown:Lf(a.onKeyDown,Ha=>{if(!G){if(["Enter"," "].includes(Ha.key))na.onOpenToggle();if("ArrowDown"===Ha.key)na.onOpenChange(!0);["Enter"," ","ArrowDown"].includes(Ha.key)&&Ha.preventDefault()}})})))}),jC=(0,gp.forwardRef)((a,d)=>{var {__scopeDropdownMenu:k}=a;const G=nf(a,["__scopeDropdownMenu"]),fa=Wu("DropdownMenuContent",
k);k=Tq(k);const na=(0,gp.useRef)(!1);return(0,gp.createElement)(Tu,He({id:fa.contentId,"aria-labelledby":fa.triggerId},k,G,{ref:d,onCloseAutoFocus:Lf(a.onCloseAutoFocus,ta=>{var Ha;na.current||null===(Ha=fa.triggerRef.current)||void 0===Ha||Ha.focus();na.current=!1;ta.preventDefault()}),onInteractOutside:Lf(a.onInteractOutside,ta=>{ta=ta.detail.originalEvent;const Ha=0===ta.button&&!0===ta.ctrlKey;ta=2===ta.button||Ha;if(!fa.modal||ta)na.current=!0}),style:Re(Ud({},a.style),{["--radix-dropdown-menu-content-transform-origin"]:"var(--radix-popper-transform-origin)"})}))}),
Jr=(0,gp.forwardRef)((a,d)=>{var {__scopeDropdownMenu:k}=a;a=nf(a,["__scopeDropdownMenu"]);k=Tq(k);return(0,gp.createElement)(uw,He({},k,a,{ref:d}))}),nH=a=>{const {__scopeDropdownMenu:d,children:k,dir:G,open:fa,defaultOpen:na,onOpenChange:ta,modal:Ha=!0}=a;a=Tq(d);const Sa=(0,gp.useRef)(null),[Za=!1,fb]=Fh({prop:fa,defaultProp:na,onChange:ta});return(0,gp.createElement)(Vu,{scope:d,triggerId:Sh(),triggerRef:Sa,contentId:Sh(),open:Za,onOpenChange:fb,onOpenToggle:(0,gp.useCallback)(()=>fb(ib=>!ib),
[fb]),modal:Ha},(0,gp.createElement)(ty,He({},a,{open:Za,onOpenChange:fb,dir:G,modal:Ha}),k))},Gi=$e(ba(22)).default.createContext({}),oH=$e(ba(22)),uy=ba(598),bn=a=>{var {action:d}=a;a=nf(a,["action"]);var {renderers:k}=oH.useContext(Gi);k=null==k?void 0:k.KeyboardShortcut;return(0,uy.jsx)("div",Re(Ud({className:"tl-menu-right-slot"},a),{children:(0,uy.jsx)(k,{action:d})}))};ba(22);var cn=ba(598),Ps=Ze(function(){const a=kg(),d=k=>{k.preventDefault()};return(0,cn.jsxs)(nH,{children:[(0,cn.jsx)(vw,
{className:"tl-button text-sm px-2 important",id:"tl-zoom",children:(100*a.viewport.camera.zoom).toFixed(0)+"%"}),(0,cn.jsxs)(jC,{onCloseAutoFocus:k=>k.preventDefault(),className:"tl-menu",id:"zoomPopup",sideOffset:12,children:[(0,cn.jsxs)(Jr,{className:"tl-menu-item",onSelect:d,onClick:a.api.zoomToFit,children:["Zoom to drawing",(0,cn.jsx)(bn,{action:"whiteboard/zoom-to-fit"})]}),(0,cn.jsxs)(Jr,{className:"tl-menu-item",onSelect:d,onClick:a.api.zoomToSelection,disabled:0===a.selectedShapesArray.length,
children:["Zoom to fit selection",(0,cn.jsx)(bn,{action:"whiteboard/zoom-to-selection"})]}),(0,cn.jsxs)(Jr,{className:"tl-menu-item",onSelect:d,onClick:a.api.zoomIn,children:["Zoom in",(0,cn.jsx)(bn,{action:"whiteboard/zoom-in"})]}),(0,cn.jsxs)(Jr,{className:"tl-menu-item",onSelect:d,onClick:a.api.zoomOut,children:["Zoom out",(0,cn.jsx)(bn,{action:"whiteboard/zoom-out"})]}),(0,cn.jsxs)(Jr,{className:"tl-menu-item",onSelect:d,onClick:a.api.resetZoom,children:["Reset zoom",(0,cn.jsx)(bn,{action:"whiteboard/reset-zoom"})]})]})]})}),
vy=ba(22),ww=["horizontal","vertical"],Kr=(0,vy.forwardRef)((a,d)=>{const {decorative:k,orientation:G="horizontal"}=a;a=nf(a,["decorative","orientation"]);const fa=ww.includes(G)?G:"horizontal";return(0,vy.createElement)(Gk.div,He({"data-orientation":fa},k?{role:"none"}:{"aria-orientation":"vertical"===fa?fa:void 0,role:"separator"},a,{ref:d}))});Kr.propTypes={orientation(a,d,k){a=a[d];d=String(a);return a&&!ww.includes(a)?Error(`Invalid prop \`orientation\` of value \`${d}\` supplied to \`${k}\`, expected one of:
- horizontal
- vertical
Defaulting to \`${"horizontal"}\`.`):null}};var Hk=ba(598),kC=Ze(function(){const a=kg(),{handlers:{t:d}}=Fr.useContext(Gi),k=Fr.useCallback(()=>{a.api.undo()},[a]),G=Fr.useCallback(()=>{a.api.redo()},[a]),fa=Fr.useCallback(()=>{a.api.zoomIn()},[a]),na=Fr.useCallback(()=>{a.api.zoomOut()},[a]),ta=Fr.useCallback(()=>{a.api.toggleGrid()},[a]),Ha=Fr.useCallback(()=>{a.api.toggleSnapToGrid()},[a]),Sa=Fr.useCallback(()=>{a.api.togglePenMode()},[a]);return(0,Hk.jsxs)("div",{className:"tl-action-bar","data-html2canvas-ignore":"true",
children:[!a.readOnly&&(0,Hk.jsxs)("div",{className:"tl-toolbar tl-history-bar mr-2 mb-2",children:[(0,Hk.jsx)(ig,{tooltip:d("whiteboard/undo"),onClick:k,children:(0,Hk.jsx)(gh,{name:"arrow-back-up"})}),(0,Hk.jsx)(ig,{tooltip:d("whiteboard/redo"),onClick:G,children:(0,Hk.jsx)(gh,{name:"arrow-forward-up"})})]}),(0,Hk.jsxs)("div",{className:"tl-toolbar tl-zoom-bar mr-2 mb-2",children:[(0,Hk.jsx)(ig,{tooltip:d("whiteboard/zoom-in"),onClick:fa,id:"tl-zoom-in",children:(0,Hk.jsx)(gh,{name:"plus"})}),(0,Hk.jsx)(ig,
{tooltip:d("whiteboard/zoom-out"),onClick:na,id:"tl-zoom-out",children:(0,Hk.jsx)(gh,{name:"minus"})}),(0,Hk.jsx)(Kr,{className:"tl-toolbar-separator",orientation:"vertical"}),(0,Hk.jsx)(Ps,{})]}),(0,Hk.jsxs)("div",{className:"tl-toolbar tl-grid-bar mr-2 mb-2",children:[(0,Hk.jsx)(yi,{tooltip:d("whiteboard/toggle-grid"),className:"tl-button",pressed:a.settings.showGrid,id:"tl-show-grid",onPressedChange:ta,children:(0,Hk.jsx)(gh,{name:"grid-dots"})}),!a.readOnly&&(0,Hk.jsx)(yi,{tooltip:d("whiteboard/snap-to-grid"),
className:"tl-button",pressed:a.settings.snapToGrid,id:"tl-snap-to-grid",onPressedChange:Ha,children:(0,Hk.jsx)(gh,{name:a.settings.snapToGrid?"magnet":"magnet-off"})})]}),!a.readOnly&&(0,Hk.jsx)("div",{className:"tl-toolbar tl-pen-mode-bar mb-2",children:(0,Hk.jsx)(yi,{tooltip:d("whiteboard/toggle-pen-mode"),className:"tl-button",pressed:a.settings.penMode,id:"tl-toggle-pen-mode",onPressedChange:Sa,children:(0,Hk.jsx)(gh,{name:a.settings.penMode?"pencil":"pencil-off"})})})]})}),xw=$e(ba(22)),Xu=
$e(ba(31)),Yu=ba(598),Zu=a=>`[${a.map(d=>{var k;return null!=(k=null==d?void 0:d.toFixed(2))?k:"-"}).join(", ")}]`,Ho=Ze(()=>{var a;const {viewport:{bounds:d,camera:{point:k,zoom:G}},inputs:fa}=Pe(),na=xw.default.useRef();xw.default.useEffect(()=>{const Ha=document.getElementById("tl-statusbar-anchor");na.current=Ha},[]);const ta=[["Z",null!=(a=null==G?void 0:G.toFixed(2))?a:"null"],["MP",Zu(fa.currentPoint)],["MS",Zu(fa.currentScreenPoint)],["VP",Zu(k)],["VBR",Zu([d.maxX,d.maxY])]].map(Ha=>Ha.join("")).join("|");
a=na.current?Xu.default.createPortal((0,Yu.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center"},children:ta}),na.current):null;return(0,Yu.jsx)(Yu.Fragment,{children:a})}),jm=$e(ba(22)),Io=ba(598),Bp=Ze(a=>{var {id:d,icon:k,tooltip:G,tooltipSide:fa="left",handleClick:na}=a;a=nf(a,["id","icon","tooltip","tooltipSide","handleClick"]);var ta;const Ha=kg(),Sa=null==(ta=[...Ha.Tools,Et,Ft])?void 0:ta.find(Za=>Za.id===d);ta=(ta=null==Sa?void 0:Sa.shortcut)&&G?(0,Io.jsxs)("div",{className:"flex",
children:[G,(0,Io.jsx)(bn,{action:ta})]}):G;return(0,Io.jsx)(ig,Re(Ud({},a),{tooltipSide:fa,tooltip:ta,"data-tool":d,"data-selected":d===Ha.selectedTool.id,onClick:na,children:"string"===typeof k?(0,Io.jsx)(gh,{name:k}):k}))}),nj=ba(22),[wy]=Ji("Popover",[Mt]),$u=Mt(),[xy,Qs]=wy("Popover"),yw=(0,nj.forwardRef)((a,d)=>{var {__scopePopover:k}=a;const G=nf(a,["__scopePopover"]),fa=Qs("PopoverTrigger",k);k=$u(k);d=eh(d,fa.triggerRef);a=(0,nj.createElement)(Gk.button,He({type:"button","aria-haspopup":"dialog",
"aria-expanded":fa.open,"aria-controls":fa.contentId,"data-state":fa.open?"open":"closed"},G,{ref:d,onClick:Lf(a.onClick,fa.onOpenToggle)}));return fa.hasCustomAnchor?a:(0,nj.createElement)(ey,He({asChild:!0},k),a)}),[,lC]=wy("PopoverPortal",{forceMount:void 0}),zw=(0,nj.forwardRef)((a,d)=>{var k=lC("PopoverContent",a.__scopePopover);({forceMount:k=k.forceMount}=a);const G=nf(a,["forceMount"]);a=Qs("PopoverContent",a.__scopePopover);return(0,nj.createElement)(Qu,{present:k||a.open},a.modal?(0,nj.createElement)(mC,
He({},G,{ref:d})):(0,nj.createElement)(Rt,He({},G,{ref:d})))}),mC=(0,nj.forwardRef)((a,d)=>{const k=Qs("PopoverContent",a.__scopePopover),G=(0,nj.useRef)(null);d=eh(d,G);const fa=(0,nj.useRef)(!1);(0,nj.useEffect)(()=>{const na=G.current;if(na)return ny(na)},[]);return(0,nj.createElement)(sk,{as:lq,allowPinchZoom:!0},(0,nj.createElement)(yy,He({},a,{ref:d,trapFocus:k.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Lf(a.onCloseAutoFocus,na=>{var ta;na.preventDefault();fa.current||null===(ta=k.triggerRef.current)||
void 0===ta||ta.focus()}),onPointerDownOutside:Lf(a.onPointerDownOutside,na=>{na=na.detail.originalEvent;const ta=0===na.button&&!0===na.ctrlKey;fa.current=2===na.button||ta},{checkForDefaultPrevented:!1}),onFocusOutside:Lf(a.onFocusOutside,na=>na.preventDefault(),{checkForDefaultPrevented:!1})})))}),Rt=(0,nj.forwardRef)((a,d)=>{const k=Qs("PopoverContent",a.__scopePopover),G=(0,nj.useRef)(!1);return(0,nj.createElement)(yy,He({},a,{ref:d,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:fa=>
{var na;null===(na=a.onCloseAutoFocus)||void 0===na||na.call(a,fa);if(!fa.defaultPrevented){var ta;G.current||null===(ta=k.triggerRef.current)||void 0===ta||ta.focus();fa.preventDefault()}G.current=!1},onInteractOutside:fa=>{var na,ta;null===(na=a.onInteractOutside)||void 0===na||na.call(a,fa);fa.defaultPrevented||(G.current=!0);na=fa.target;(null===(ta=k.triggerRef.current)||void 0===ta?0:ta.contains(na))&&fa.preventDefault()}}))}),yy=(0,nj.forwardRef)((a,d)=>{const {__scopePopover:k,trapFocus:G,
onOpenAutoFocus:fa,onCloseAutoFocus:na,disableOutsidePointerEvents:ta,onEscapeKeyDown:Ha,onPointerDownOutside:Sa,onFocusOutside:Za,onInteractOutside:fb}=a;a=nf(a,"__scopePopover trapFocus onOpenAutoFocus onCloseAutoFocus disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside".split(" "));const ib=Qs("PopoverContent",k),Bb=$u(k);hi();return(0,nj.createElement)(VB,{asChild:!0,loop:!0,trapped:G,onMountAutoFocus:fa,onUnmountAutoFocus:na},(0,nj.createElement)($x,
{asChild:!0,disableOutsidePointerEvents:ta,onInteractOutside:fb,onEscapeKeyDown:Ha,onPointerDownOutside:Sa,onFocusOutside:Za,onDismiss:()=>ib.onOpenChange(!1)},(0,nj.createElement)(fy,He({"data-state":ib.open?"open":"closed",role:"dialog",id:ib.contentId},Bb,a,{ref:d,style:Re(Ud({},a.style),{["--radix-popover-content-transform-origin"]:"var(--radix-popper-transform-origin)"})}))))}),nC=(0,nj.forwardRef)((a,d)=>{var {__scopePopover:k}=a;a=nf(a,["__scopePopover"]);k=$u(k);return(0,nj.createElement)(MB,
He({},k,a,{ref:d}))}),Rs=a=>{const {__scopePopover:d,children:k,open:G,defaultOpen:fa,onOpenChange:na,modal:ta=!1}=a;a=$u(d);const Ha=(0,nj.useRef)(null),[Sa,Za]=(0,nj.useState)(!1),[fb=!1,ib]=Fh({prop:G,defaultProp:fa,onChange:na});return(0,nj.createElement)(gy,a,(0,nj.createElement)(xy,{scope:d,contentId:Sh(),triggerRef:Ha,open:fb,onOpenChange:ib,onOpenToggle:(0,nj.useCallback)(()=>ib(Bb=>!Bb),[ib]),hasCustomAnchor:Sa,onCustomAnchorAdd:(0,nj.useCallback)(()=>Za(!0),[]),onCustomAnchorRemove:(0,nj.useCallback)(()=>
Za(!1),[]),modal:ta},k))},zy=$e(ba(22)),oq=ba(598),Ay=Ze(function(a){var {popoverSide:d="left",setGeometry:k,activeGeometry:G,chevron:fa=!0}=a;a=nf(a,["popoverSide","setGeometry","activeGeometry","chevron"]);var {handlers:{t:na}}=zy.default.useContext(Gi);const ta=[{id:"box",icon:"square",tooltip:na("whiteboard/rectangle")},{id:"ellipse",icon:"circle",tooltip:na("whiteboard/circle")},{id:"polygon",icon:"triangle",tooltip:na("whiteboard/triangle")}];na={id:"shapes",icon:"triangle-square-circle",tooltip:na("whiteboard/shape")};
na=G?ta.find(Ha=>Ha.id===G):na;return(0,oq.jsxs)(Rs,{children:[(0,oq.jsx)(yw,{asChild:!0,children:(0,oq.jsxs)("div",Re(Ud({},a),{className:"tl-geometry-tools-pane-anchor",children:[(0,oq.jsx)(Bp,Re(Ud({},na),{tooltipSide:d})),fa&&(0,oq.jsx)(gh,{"data-selected":G,className:"tl-popover-indicator",name:"chevron-down-left"})]}))}),(0,oq.jsxs)(zw,{className:"tl-popover-content",side:d,sideOffset:15,children:[(0,oq.jsx)("div",{className:`tl-toolbar tl-geometry-toolbar ${["left","right"].includes(d)?"flex-col":
"flex-row"}`,children:ta.map(Ha=>(0,oq.jsx)(Bp,{id:Ha.id,icon:Ha.icon,tooltip:G?Ha.tooltip:"",handleClick:k,tooltipSide:d},Ha.id))}),(0,oq.jsx)(nC,{className:"tl-popover-arrow"})]})]})}),ci=ba(22),By=ba(22),Cy=["PageUp","PageDown"],Dy=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],av={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},
[Aw,pH,qH]=Tk("Slider"),[Ey]=Ji("Slider",[qH]),[Uq,ip]=Ey("Slider"),St=(0,ci.forwardRef)((a,d)=>{function k(Be){const Fe=zq(Vd,Be);na(Be,Fe)}function G(Be){na(Be,nd.current)}function fa(){Vd[nd.current]!==gf.current[nd.current]&&oc(Vd)}function na(Be,Fe,{commit:Fd}={commit:!1}){const bd=(String(Za).split(".")[1]||"").length;Be=jn(Math.round((Be-Ha)/Za)*Za+Ha,bd);const Gd=yo(Be,[Ha,Sa]);te((Zc=[])=>{const td=Vi(Zc,Gd,Fe);var we=Bb*Za;if(0<we){const Te=xm(td);we=Math.min(...Te)>=we}else we=!0;return we?
(nd.current=td.indexOf(Gd),(we=String(td)!==String(Zc))&&Fd&&oc(td),we?td:Zc):Zc})}const {name:ta,min:Ha=0,max:Sa=100,step:Za=1,orientation:fb="horizontal",disabled:ib=!1,minStepsBetweenThumbs:Bb=0,defaultValue:Ob=[Ha],value:Fb,onValueChange:cc=()=>{},onValueCommit:oc=()=>{},inverted:Xb=!1}=a,hc=nf(a,"name min max step orientation disabled minStepsBetweenThumbs defaultValue value onValueChange onValueCommit inverted".split(" ")),[ec,Ec]=(0,ci.useState)(null);d=eh(d,Be=>Ec(Be));const Ic=(0,ci.useRef)(new Set),
nd=(0,ci.useRef)(0);var Bd="horizontal"===fb;const Ee=ec?!!ec.closest("form"):!0;Bd=Bd?rH:sH;const [Vd=[],te]=Fh({prop:Fb,defaultProp:Ob,onChange:Be=>{var Fe;null===(Fe=[...Ic.current][nd.current])||void 0===Fe||Fe.focus();cc(Be)}}),gf=(0,ci.useRef)(Vd);return(0,ci.createElement)(Uq,{scope:a.__scopeSlider,disabled:ib,min:Ha,max:Sa,valueIndexToChangeRef:nd,thumbs:Ic.current,values:Vd,orientation:fb},(0,ci.createElement)(Aw.Provider,{scope:a.__scopeSlider},(0,ci.createElement)(Aw.Slot,{scope:a.__scopeSlider},
(0,ci.createElement)(Bd,He({"aria-disabled":ib,"data-disabled":ib?"":void 0},hc,{ref:d,onPointerDown:Lf(hc.onPointerDown,()=>{ib||(gf.current=Vd)}),min:Ha,max:Sa,inverted:Xb,onSlideStart:ib?void 0:k,onSlideMove:ib?void 0:G,onSlideEnd:ib?void 0:fa,onHomeKeyDown:()=>!ib&&na(Ha,0,{commit:!0}),onEndKeyDown:()=>!ib&&na(Sa,Vd.length-1,{commit:!0}),onStepKeyDown:({event:Be,direction:Fe})=>{if(!ib){Be=Cy.includes(Be.key)||Be.shiftKey&&Dy.includes(Be.key);const Fd=nd.current;na(Vd[Fd]+Za*(Be?10:1)*Fe,Fd,{commit:!0})}}})))),
Ee&&Vd.map((Be,Fe)=>(0,ci.createElement)(Jo,{key:Fe,name:ta?ta+(1<Vd.length?"[]":""):void 0,value:Be})))}),[Lr,Fy]=Ey("Slider",{startEdge:"left",endEdge:"right",size:"width",direction:1}),rH=(0,ci.forwardRef)((a,d)=>{function k(hc){const ec=Fb.current||Bb.getBoundingClientRect(),Ec=rn([0,ec.width],Xb?[G,fa]:[fa,G]);Fb.current=ec;return Ec(hc-ec.left)}const {min:G,max:fa,dir:na,inverted:ta,onSlideStart:Ha,onSlideMove:Sa,onSlideEnd:Za,onStepKeyDown:fb}=a,ib=nf(a,"min max dir inverted onSlideStart onSlideMove onSlideEnd onStepKeyDown".split(" ")),
[Bb,Ob]=(0,ci.useState)(null);d=eh(d,hc=>Ob(hc));const Fb=(0,ci.useRef)(),cc=Vn(na),oc="ltr"===cc,Xb=oc&&!ta||!oc&&ta;return(0,ci.createElement)(Lr,{scope:a.__scopeSlider,startEdge:Xb?"left":"right",endEdge:Xb?"right":"left",direction:Xb?1:-1,size:"width"},(0,ci.createElement)(Gy,He({dir:cc,"data-orientation":"horizontal"},ib,{ref:d,style:Re(Ud({},ib.style),{["--radix-slider-thumb-transform"]:"translateX(-50%)"}),onSlideStart:hc=>{hc=k(hc.clientX);null===Ha||void 0===Ha||Ha(hc)},onSlideMove:hc=>{hc=
k(hc.clientX);null===Sa||void 0===Sa||Sa(hc)},onSlideEnd:()=>{Fb.current=void 0;null===Za||void 0===Za||Za()},onStepKeyDown:hc=>{const ec=av[Xb?"from-left":"from-right"].includes(hc.key);null===fb||void 0===fb||fb({event:hc,direction:ec?-1:1})}})))}),sH=(0,ci.forwardRef)((a,d)=>{function k(Fb){const cc=Bb.current||ib.current.getBoundingClientRect(),oc=rn([0,cc.height],Ob?[fa,G]:[G,fa]);Bb.current=cc;return oc(Fb-cc.top)}const {min:G,max:fa,inverted:na,onSlideStart:ta,onSlideMove:Ha,onSlideEnd:Sa,
onStepKeyDown:Za}=a,fb=nf(a,"min max inverted onSlideStart onSlideMove onSlideEnd onStepKeyDown".split(" ")),ib=(0,ci.useRef)(null);d=eh(d,ib);const Bb=(0,ci.useRef)(),Ob=!na;return(0,ci.createElement)(Lr,{scope:a.__scopeSlider,startEdge:Ob?"bottom":"top",endEdge:Ob?"top":"bottom",size:"height",direction:Ob?1:-1},(0,ci.createElement)(Gy,He({"data-orientation":"vertical"},fb,{ref:d,style:Re(Ud({},fb.style),{["--radix-slider-thumb-transform"]:"translateY(50%)"}),onSlideStart:Fb=>{Fb=k(Fb.clientY);null===
ta||void 0===ta||ta(Fb)},onSlideMove:Fb=>{Fb=k(Fb.clientY);null===Ha||void 0===Ha||Ha(Fb)},onSlideEnd:()=>{Bb.current=void 0;null===Sa||void 0===Sa||Sa()},onStepKeyDown:Fb=>{const cc=av[Ob?"from-bottom":"from-top"].includes(Fb.key);null===Za||void 0===Za||Za({event:Fb,direction:cc?-1:1})}})))}),Gy=(0,ci.forwardRef)((a,d)=>{const {__scopeSlider:k,onSlideStart:G,onSlideMove:fa,onSlideEnd:na,onHomeKeyDown:ta,onEndKeyDown:Ha,onStepKeyDown:Sa}=a,Za=nf(a,"__scopeSlider onSlideStart onSlideMove onSlideEnd onHomeKeyDown onEndKeyDown onStepKeyDown".split(" ")),
fb=ip("Slider",k);return(0,ci.createElement)(Gk.span,He({},Za,{ref:d,onKeyDown:Lf(a.onKeyDown,ib=>{"Home"===ib.key?(ta(ib),ib.preventDefault()):"End"===ib.key?(Ha(ib),ib.preventDefault()):Cy.concat(Dy).includes(ib.key)&&(Sa(ib),ib.preventDefault())}),onPointerDown:Lf(a.onPointerDown,ib=>{const Bb=ib.target;Bb.setPointerCapture(ib.pointerId);ib.preventDefault();fb.thumbs.has(Bb)?Bb.focus():G(ib)}),onPointerMove:Lf(a.onPointerMove,ib=>{ib.target.hasPointerCapture(ib.pointerId)&&fa(ib)}),onPointerUp:Lf(a.onPointerUp,
ib=>{const Bb=ib.target;Bb.hasPointerCapture(ib.pointerId)&&(Bb.releasePointerCapture(ib.pointerId),na(ib))})}))}),Le=(0,ci.forwardRef)((a,d)=>{var {__scopeSlider:k}=a;a=nf(a,["__scopeSlider"]);k=ip("SliderTrack",k);return(0,ci.createElement)(Gk.span,He({"data-disabled":k.disabled?"":void 0,"data-orientation":k.orientation},a,{ref:d}))}),Wf=(0,ci.forwardRef)((a,d)=>{var {__scopeSlider:k}=a;const G=nf(a,["__scopeSlider"]),fa=ip("SliderRange",k);k=Fy("SliderRange",k);var na=(0,ci.useRef)(null);d=eh(d,
na);var ta=fa.values.length;na=fa.values.map(Ha=>ti(Ha,fa.min,fa.max));ta=1<ta?Math.min(...na):0;na=100-Math.max(...na);return(0,ci.createElement)(Gk.span,He({"data-orientation":fa.orientation,"data-disabled":fa.disabled?"":void 0},G,{ref:d,style:Re(Ud({},a.style),{[k.startEdge]:ta+"%",[k.endEdge]:na+"%"})}))}),Qe=(0,ci.forwardRef)((a,d)=>{const k=pH(a.__scopeSlider),[G,fa]=(0,ci.useState)(null);d=eh(d,ta=>fa(ta));const na=(0,ci.useMemo)(()=>G?k().findIndex(ta=>ta.ref.current===G):-1,[k,G]);return(0,ci.createElement)(yf,
He({},a,{ref:d,index:na}))}),yf=(0,ci.forwardRef)((a,d)=>{const {__scopeSlider:k,index:G}=a,fa=nf(a,["__scopeSlider","index"]),na=ip("SliderThumb",k),ta=Fy("SliderThumb",k),[Ha,Sa]=(0,ci.useState)(null);d=eh(d,Ob=>Sa(Ob));var Za=Oh(Ha);const fb=na.values[G],ib=void 0===fb?0:ti(fb,na.min,na.max),Bb=Uk(G,na.values.length);Za=(Za=null===Za||void 0===Za?void 0:Za[ta.size])?Ll(Za,ib,ta.direction):0;(0,ci.useEffect)(()=>{if(Ha)return na.thumbs.add(Ha),()=>{na.thumbs.delete(Ha)}},[Ha,na.thumbs]);return(0,ci.createElement)("span",
{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[ta.startEdge]:`calc(${ib}% + ${Za}px)`}},(0,ci.createElement)(Aw.ItemSlot,{scope:a.__scopeSlider},(0,ci.createElement)(Gk.span,He({role:"slider","aria-label":a["aria-label"]||Bb,"aria-valuemin":na.min,"aria-valuenow":fb,"aria-valuemax":na.max,"aria-orientation":na.orientation,"data-orientation":na.orientation,"data-disabled":na.disabled?"":void 0,tabIndex:na.disabled?void 0:0},fa,{ref:d,style:void 0===fb?{display:"none"}:
a.style,onFocus:Lf(a.onFocus,()=>{na.valueIndexToChangeRef.current=G})}))))}),Jo=a=>{const {value:d}=a;a=nf(a,["value"]);const k=(0,ci.useRef)(null),G=In(d);(0,ci.useEffect)(()=>{const fa=k.current,na=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;if(G!==d&&na){const ta=new Event("input",{bubbles:!0});na.call(fa,d);fa.dispatchEvent(ta)}},[G,d]);return(0,ci.createElement)("input",He({style:{display:"none"}},a,{ref:k,defaultValue:d}))},kl=St,bv=Le,Vj=Wf,pq=Qe,ye=$e(ba(22)),
Df=ba(598),Kn=Ze(a=>{var {side:d,align:k,alignOffset:G,label:fa,arrow:na,children:ta,border:Ha}=a;a=nf(a,"side align alignOffset label arrow children border".split(" "));const Sa=ye.useRef(null),[Za,fb]=ye.useState(!1),{viewport:{bounds:ib,camera:{point:Bb,zoom:Ob}}}=kg(),[Fb,cc]=ye.useState(0);ye.useEffect(()=>{if(Sa.current&&Za){var oc=Sa.current.getBoundingClientRect();cf.boundsContain(ib,{minX:oc.x,minY:oc.y,maxX:oc.right,maxY:oc.bottom,width:oc.width,height:oc.height})||cc(Xb=>Xb+1)}},[Bb[0],
Bb[1],Ob,Za]);return(0,Df.jsxs)(Rs,{onOpenChange:oc=>fb(oc),children:[(0,Df.jsx)(yw,Re(Ud({},a),{"data-border":Ha,className:"tl-button tl-popover-trigger-button",children:fa})),(0,Df.jsxs)(zw,{ref:Sa,className:"tl-popover-content",align:k,alignOffset:G,side:d,sideOffset:15,collisionBoundary:document.querySelector(".logseq-tldraw"),children:[ta,na&&(0,Df.jsx)(nC,{className:"tl-popover-arrow"})]},"popover-content-"+Fb)]})}),ve=$e(ba(22)),tk=ba(598),oC=$e(ba(22)),ff=ba(22),Tt=ba(31),Sk=$e(ba(22)),Bl=
ba(22),cv=ba(22),Ln=ba(31),ll="a button div form h2 h3 img input label li nav ol p span svg ul".split(" ").reduce((a,d)=>{const k=(0,cv.forwardRef)((G,fa)=>{var {asChild:na}=G;G=nf(G,["asChild"]);na=na?lq:d;(0,cv.useEffect)(()=>{window[Symbol.for("radix-ui")]=!0},[]);return(0,cv.createElement)(na,He({},G,{ref:fa}))});k.displayName=`Primitive.${d}`;return Re(Ud({},a),{[d]:k})},{}),Vq,Cp=(0,Bl.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),wg=(0,Bl.forwardRef)((a,
d)=>{var k;const {disableOutsidePointerEvents:G=!1,onEscapeKeyDown:fa,onPointerDownOutside:na,onFocusOutside:ta,onInteractOutside:Ha,onDismiss:Sa}=a,Za=nf(a,"disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside onDismiss".split(" ")),fb=(0,Bl.useContext)(Cp),[ib,Bb]=(0,Bl.useState)(null),Ob=null!==(k=null===ib||void 0===ib?void 0:ib.ownerDocument)&&void 0!==k?k:null===globalThis||void 0===globalThis?void 0:globalThis.document,[,Fb]=(0,Bl.useState)({});
d=eh(d,ec=>Bb(ec));k=Array.from(fb.layers);var [cc]=[...fb.layersWithOutsidePointerEventsDisabled].slice(-1);cc=k.indexOf(cc);const oc=ib?k.indexOf(ib):-1;k=0<fb.layersWithOutsidePointerEventsDisabled.size;const Xb=oc>=cc;cc=lo(ec=>{const Ec=ec.target,Ic=[...fb.branches].some(nd=>nd.contains(Ec));Xb&&!Ic&&(null===na||void 0===na||na(ec),null===Ha||void 0===Ha||Ha(ec),ec.defaultPrevented||null===Sa||void 0===Sa||Sa())},Ob);const hc=Dl(ec=>{const Ec=ec.target;[...fb.branches].some(Ic=>Ic.contains(Ec))||
(null===ta||void 0===ta||ta(ec),null===Ha||void 0===Ha||Ha(ec),ec.defaultPrevented||null===Sa||void 0===Sa||Sa())},Ob);Fk(ec=>{oc===fb.layers.size-1&&(null===fa||void 0===fa||fa(ec),!ec.defaultPrevented&&Sa&&(ec.preventDefault(),Sa()))},Ob);(0,Bl.useEffect)(()=>{if(ib)return G&&(0===fb.layersWithOutsidePointerEventsDisabled.size&&(Vq=Ob.body.style.pointerEvents,Ob.body.style.pointerEvents="none"),fb.layersWithOutsidePointerEventsDisabled.add(ib)),fb.layers.add(ib),Vl(),()=>{G&&1===fb.layersWithOutsidePointerEventsDisabled.size&&
(Ob.body.style.pointerEvents=Vq)}},[ib,Ob,G,fb]);(0,Bl.useEffect)(()=>()=>{ib&&(fb.layers.delete(ib),fb.layersWithOutsidePointerEventsDisabled.delete(ib),Vl())},[ib,fb]);(0,Bl.useEffect)(()=>{const ec=()=>Fb({});document.addEventListener("dismissableLayer.update",ec);return()=>document.removeEventListener("dismissableLayer.update",ec)},[]);return(0,Bl.createElement)(ll.div,He({},Za,{ref:d,style:Ud({pointerEvents:k?Xb?"auto":"none":void 0},a.style),onFocusCapture:Lf(a.onFocusCapture,hc.onFocusCapture),
onBlurCapture:Lf(a.onBlurCapture,hc.onBlurCapture),onPointerDownCapture:Lf(a.onPointerDownCapture,cc.onPointerDownCapture)}))}),ml=ba(22),qq={bubbles:!1,cancelable:!0},pC=(0,ml.forwardRef)((a,d)=>{const {loop:k=!1,trapped:G=!1,onMountAutoFocus:fa,onUnmountAutoFocus:na}=a;a=nf(a,["loop","trapped","onMountAutoFocus","onUnmountAutoFocus"]);const [ta,Ha]=(0,ml.useState)(null),Sa=Ei(fa),Za=Ei(na),fb=(0,ml.useRef)(null);d=eh(d,Ob=>Ha(Ob));const ib=(0,ml.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=
!1}}).current;(0,ml.useEffect)(()=>{if(G){let Ob=function(cc){!ib.paused&&ta&&(cc=cc.target,ta.contains(cc)?fb.current=cc:El(fb.current,{select:!0}))},Fb=function(cc){!ib.paused&&ta&&(ta.contains(cc.relatedTarget)||El(fb.current,{select:!0}))};document.addEventListener("focusin",Ob);document.addEventListener("focusout",Fb);return()=>{document.removeEventListener("focusin",Ob);document.removeEventListener("focusout",Fb)}}},[G,ta,ib.paused]);(0,ml.useEffect)(()=>{if(ta){Mr.add(ib);const Ob=document.activeElement;
if(!ta.contains(Ob)){const Fb=new CustomEvent("focusScope.autoFocusOnMount",qq);ta.addEventListener("focusScope.autoFocusOnMount",Sa);ta.dispatchEvent(Fb);Fb.defaultPrevented||(An(mo(Wn(ta)),{select:!0}),document.activeElement===Ob&&El(ta))}return()=>{ta.removeEventListener("focusScope.autoFocusOnMount",Sa);setTimeout(()=>{const Fb=new CustomEvent("focusScope.autoFocusOnUnmount",qq);ta.addEventListener("focusScope.autoFocusOnUnmount",Za);ta.dispatchEvent(Fb);Fb.defaultPrevented||El(null!==Ob&&void 0!==
Ob?Ob:document.body,{select:!0});ta.removeEventListener("focusScope.autoFocusOnUnmount",Za);Mr.remove(ib)},0)}}},[ta,Sa,Za,ib]);const Bb=(0,ml.useCallback)(Ob=>{if((k||G)&&!ib.paused){var Fb=document.activeElement;if("Tab"===Ob.key&&!Ob.altKey&&!Ob.ctrlKey&&!Ob.metaKey&&Fb){const oc=Ob.currentTarget;var cc=oc;const Xb=Wn(cc),hc=mn(Xb,cc);cc=mn(Xb.reverse(),cc);const [ec,Ec]=[hc,cc];ec&&Ec?Ob.shiftKey||Fb!==Ec?Ob.shiftKey&&Fb===ec&&(Ob.preventDefault(),k&&El(Ec,{select:!0})):(Ob.preventDefault(),k&&
El(ec,{select:!0})):Fb===oc&&Ob.preventDefault()}}},[k,G,ib.paused]);return(0,ml.createElement)(ll.div,He({tabIndex:-1},a,{ref:d,onKeyDown:Bb}))}),Mr=function(){let a=[];return{add(d){const k=a[0];d===k||null!==k&&void 0!==k&&k.pause();a=kn(a,d);a.unshift(d)},remove(d){var k;a=kn(a,d);null===(k=a[0])||void 0===k||k.resume()}}}(),Uf=ba(22),[Bw,rq]=Ji("Popper"),[Hg,Ut]=Bw("Popper"),Nj=(0,Uf.forwardRef)((a,d)=>{const {__scopePopper:k,virtualRef:G}=a;a=nf(a,["__scopePopper","virtualRef"]);const fa=Ut("PopperAnchor",
k),na=(0,Uf.useRef)(null);d=eh(d,na);(0,Uf.useEffect)(()=>{fa.onAnchorChange((null===G||void 0===G?void 0:G.current)||na.current)});return G?null:(0,Uf.createElement)(ll.div,He({},a,{ref:d}))}),[nl]=Bw("PopperContent"),[Vt,dv]=Bw("PopperContent",{hasParent:!1,positionUpdateFns:new Set}),Hy=(0,Uf.forwardRef)((a,d)=>{var k,G,fa,na,ta,Ha,Sa,Za;const {__scopePopper:fb,side:ib="bottom",sideOffset:Bb=0,align:Ob="center",alignOffset:Fb=0,arrowPadding:cc=0,collisionBoundary:oc=[],collisionPadding:Xb=0,sticky:hc=
"partial",hideWhenDetached:ec=!1,avoidCollisions:Ec=!0,onPlaced:Ic}=a,nd=nf(a,"__scopePopper side sideOffset align alignOffset arrowPadding collisionBoundary collisionPadding sticky hideWhenDetached avoidCollisions onPlaced".split(" ")),Bd=Ut("PopperContent",fb),[Ee,Vd]=(0,Uf.useState)(null);d=eh(d,xq=>Vd(xq));const [te,gf]=(0,Uf.useState)(null);var Be=Oh(te),Fe=null!==(k=null===Be||void 0===Be?void 0:Be.width)&&void 0!==k?k:0;k=null!==(G=null===Be||void 0===Be?void 0:Be.height)&&void 0!==G?G:0;G=
ib+("center"!==Ob?"-"+Ob:"");Be="number"===typeof Xb?Xb:Ud({top:0,right:0,bottom:0,left:0},Xb);const Fd=Array.isArray(oc)?oc:[oc],bd=0<Fd.length;Be={padding:Be,boundary:Fd.filter(Dg),altBoundary:bd};const {reference:Gd,floating:Zc,strategy:td,x:we,y:Te,placement:vf,middlewareData:hf,update:Mf}=Sf({strategy:"fixed",placement:G,whileElementsMounted:Qf,middleware:[Wt(),FB({mainAxis:Bb+k,alignmentAxis:Fb}),Ec?GB(Ud({mainAxis:!0,crossAxis:!1,limiter:"partial"===hc?HB():void 0},Be)):void 0,te?KB({element:te,
padding:cc}):void 0,Ec?DB(Ud({},Be)):void 0,pG(Re(Ud({},Be),{apply:({elements:xq,availableWidth:tu,availableHeight:DD})=>{xq.floating.style.setProperty("--radix-popper-available-width",`${tu}px`);xq.floating.style.setProperty("--radix-popper-available-height",`${DD}px`)}})),Sl({arrowWidth:Fe,arrowHeight:k}),ec?EB({strategy:"referenceHidden"}):void 0].filter(no)});Bm(()=>{Gd(Bd.anchor)},[Gd,Bd.anchor]);const Ig=null!==we&&null!==Te,[qf,Cg]=oo(vf),dh=Ei(Ic);Bm(()=>{Ig&&(null===dh||void 0===dh||dh())},
[Ig,dh]);Fe=null===(fa=hf.arrow)||void 0===fa?void 0:fa.x;fa=null===(na=hf.arrow)||void 0===na?void 0:na.y;na=0!==(null===(ta=hf.arrow)||void 0===ta?void 0:ta.centerOffset);const [Qi,bk]=(0,Uf.useState)();Bm(()=>{Ee&&bk(window.getComputedStyle(Ee).zIndex)},[Ee]);const {hasParent:wk,positionUpdateFns:Np}=dv("PopperContent",fb),hr=!wk;(0,Uf.useLayoutEffect)(()=>{if(!hr)return Np.add(Mf),()=>{Np.delete(Mf)}},[hr,Np,Mf]);Bm(()=>{hr&&Ig&&Array.from(Np).reverse().forEach(xq=>requestAnimationFrame(xq))},
[hr,Ig,Np]);ta=Re(Ud({"data-side":qf,"data-align":Cg},nd),{ref:d,style:Re(Ud({},nd.style),{animation:Ig?void 0:"none",opacity:null!==(Ha=hf.hide)&&void 0!==Ha&&Ha.referenceHidden?0:void 0})});return(0,Uf.createElement)("div",{ref:Zc,"data-radix-popper-content-wrapper":"",style:{position:td,left:0,top:0,transform:Ig?`translate3d(${Math.round(we)}px, ${Math.round(Te)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:Qi,["--radix-popper-transform-origin"]:[null===(Sa=hf.transformOrigin)||
void 0===Sa?void 0:Sa.x,null===(Za=hf.transformOrigin)||void 0===Za?void 0:Za.y].join(" ")},dir:a.dir},(0,Uf.createElement)(nl,{scope:fb,placedSide:qf,onArrowChange:gf,arrowX:Fe,arrowY:fa,shouldHideArrow:na},hr?(0,Uf.createElement)(Vt,{scope:fb,hasParent:!0,positionUpdateFns:Np},(0,Uf.createElement)(ll.div,ta)):(0,Uf.createElement)(ll.div,ta)))}),Wt=()=>({name:"anchorCssProperties",fn(a){const {rects:d,elements:k}=a,{width:G,height:fa}=d.reference;k.floating.style.setProperty("--radix-popper-anchor-width",
`${G}px`);k.floating.style.setProperty("--radix-popper-anchor-height",`${fa}px`);return{}}}),Sl=a=>({name:"transformOrigin",options:a,fn(d){var k,G,fa,na,ta;const {placement:Ha,rects:Sa,middlewareData:Za}=d,fb=(d=0!==(null===(k=Za.arrow)||void 0===k?void 0:k.centerOffset))?0:a.arrowWidth;k=d?0:a.arrowHeight;const [ib,Bb]=oo(Ha),Ob={start:"0%",center:"50%",end:"100%"}[Bb],Fb=(null!==(G=null===(fa=Za.arrow)||void 0===fa?void 0:fa.x)&&void 0!==G?G:0)+fb/2;G=(null!==(na=null===(ta=Za.arrow)||void 0===
ta?void 0:ta.y)&&void 0!==na?na:0)+k/2;ta=na="";"bottom"===ib?(na=d?Ob:`${Fb}px`,ta=`${-k}px`):"top"===ib?(na=d?Ob:`${Fb}px`,ta=`${Sa.floating.height+k}px`):"right"===ib?(na=`${-k}px`,ta=d?Ob:`${G}px`):"left"===ib&&(na=`${Sa.floating.width+k}px`,ta=d?Ob:`${G}px`);return{data:{x:na,y:ta}}}}),qC=a=>{const {__scopePopper:d,children:k}=a,[G,fa]=(0,Uf.useState)(null);return(0,Uf.createElement)(Hg,{scope:d,anchor:G,onAnchorChange:fa},k)},rC=ba(22),tH=$e(ba(31)),uH=(0,rC.forwardRef)((a,d)=>{var k;const {container:G=
null===globalThis||void 0===globalThis?void 0:null===(k=globalThis.document)||void 0===k?void 0:k.body}=a;a=nf(a,["container"]);return G?tH.default.createPortal((0,rC.createElement)(ll.div,He({},a,{ref:d})),G):null}),Wq=ba(22),Nr=(0,Wq.forwardRef)((a,d)=>(0,Wq.createElement)(ll.span,He({},a,{ref:d,style:Ud({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"},a.style)}))),Fj=[" ","Enter","ArrowUp","ArrowDown"],
sC=[" ","Enter"],[Xt,Cw,Or]=function(a){var d=a+"CollectionProvider";const [k,G]=Ji(d),[fa,na]=k(d,{collectionRef:{current:null},itemMap:new Map}),ta=fb=>{const {scope:ib,children:Bb}=fb;fb=Sk.default.useRef(null);const Ob=Sk.default.useRef(new Map).current;return Sk.default.createElement(fa,{scope:ib,itemMap:Ob,collectionRef:fb},Bb)};Object.assign(ta,{displayName:d});const Ha=a+"CollectionSlot";d=Sk.default.forwardRef((fb,ib)=>{const {scope:Bb,children:Ob}=fb;fb=na(Ha,Bb);ib=eh(ib,fb.collectionRef);
return Sk.default.createElement(lq,{ref:ib},Ob)});Object.assign(d,{displayName:Ha});const Sa=a+"CollectionItemSlot",Za=Sk.default.forwardRef((fb,ib)=>{const {scope:Bb,children:Ob}=fb,Fb=nf(fb,["scope","children"]),cc=Sk.default.useRef(null);fb=eh(ib,cc);const oc=na(Sa,Bb);Sk.default.useEffect(()=>{oc.itemMap.set(cc,Ud({ref:cc},Fb));return()=>void oc.itemMap.delete(cc)});return Sk.default.createElement(lq,{["data-radix-collection-item"]:"",ref:fb},Ob)});Object.assign(Za,{displayName:Sa});return[{Provider:ta,
Slot:d,ItemSlot:Za},function(fb){const ib=na(a+"CollectionConsumer",fb);return Sk.default.useCallback(()=>{const Bb=ib.collectionRef.current;if(!Bb)return[];const Ob=Array.from(Bb.querySelectorAll("[data-radix-collection-item]"));return Array.from(ib.itemMap.values()).sort((Fb,cc)=>Ob.indexOf(Fb.ref.current)-Ob.indexOf(cc.ref.current))},[ib.collectionRef,ib.itemMap])},G]}("Select"),[Yt]=Ji("Select",[Or,rq]),Zt=rq(),[vH,sq]=Yt("Select"),[Iy,Jy]=Yt("Select"),Ky=(0,ff.forwardRef)((a,d)=>{const {__scopeSelect:k,
disabled:G=!1}=a;a=nf(a,["__scopeSelect","disabled"]);const fa=Zt(k),na=sq("SelectTrigger",k),ta=na.disabled||G;d=eh(d,na.onTriggerChange);const Ha=Cw(k),[Sa,Za,fb]=Fl(ib=>{const Bb=Ha().filter(Fb=>!Fb.disabled),Ob=Bb.find(Fb=>Fb.value===na.value);ib=sl(Bb,ib,Ob);if(void 0!==ib)na.onValueChange(ib.value)});return(0,ff.createElement)(Nj,He({asChild:!0},fa),(0,ff.createElement)(ll.button,He({type:"button",role:"combobox","aria-controls":na.contentId,"aria-expanded":na.open,"aria-required":na.required,
"aria-autocomplete":"none",dir:na.dir,"data-state":na.open?"open":"closed",disabled:ta,"data-disabled":ta?"":void 0,"data-placeholder":void 0===na.value?"":void 0},a,{ref:d,onClick:Lf(a.onClick,ib=>{ib.currentTarget.focus()}),onPointerDown:Lf(a.onPointerDown,ib=>{const Bb=ib.target;Bb.hasPointerCapture(ib.pointerId)&&Bb.releasePointerCapture(ib.pointerId);0===ib.button&&!1===ib.ctrlKey&&(ta||(na.onOpenChange(!0),fb()),na.triggerPointerDownPosRef.current={x:Math.round(ib.pageX),y:Math.round(ib.pageY)},
ib.preventDefault())}),onKeyDown:Lf(a.onKeyDown,ib=>{const Bb=""!==Sa.current;ib.ctrlKey||ib.altKey||ib.metaKey||1!==ib.key.length||Za(ib.key);Bb&&" "===ib.key||!Fj.includes(ib.key)||(ta||(na.onOpenChange(!0),fb()),ib.preventDefault())})})))}),tC=(0,ff.forwardRef)((a,d)=>{const {__scopeSelect:k,children:G,placeholder:fa}=a;a=nf(a,["__scopeSelect","className","style","children","placeholder"]);const na=sq("SelectValue",k),{onValueNodeHasChildrenChange:ta}=na,Ha=void 0!==G;d=eh(d,na.onValueNodeChange);
Bm(()=>{ta(Ha)},[ta,Ha]);return(0,ff.createElement)(ll.span,He({},a,{ref:d,style:{pointerEvents:"none"}}),void 0===na.value&&void 0!==fa?fa:G)}),uC=(0,ff.forwardRef)((a,d)=>{const {children:k}=a;a=nf(a,["__scopeSelect","children"]);return(0,ff.createElement)(ll.span,He({"aria-hidden":!0},a,{ref:d}),k||"▼")}),vC=(0,ff.forwardRef)((a,d)=>{const k=sq("SelectContent",a.__scopeSelect),[G,fa]=(0,ff.useState)();Bm(()=>{fa(new DocumentFragment)},[]);return k.open?(0,ff.createElement)(Ly,He({},a,{ref:d})):
G?(0,Tt.createPortal)((0,ff.createElement)(Pr,{scope:a.__scopeSelect},(0,ff.createElement)(Xt.Slot,{scope:a.__scopeSelect},(0,ff.createElement)("div",null,a.children))),G):null}),[Pr,Ko]=Yt("SelectContent"),Ly=(0,ff.forwardRef)((a,d)=>{const {__scopeSelect:k,position:G="item-aligned",onCloseAutoFocus:fa,onEscapeKeyDown:na,onPointerDownOutside:ta,side:Ha,sideOffset:Sa,align:Za,alignOffset:fb,arrowPadding:ib,collisionBoundary:Bb,collisionPadding:Ob,sticky:Fb,hideWhenDetached:cc,avoidCollisions:oc}=
a;a=nf(a,"__scopeSelect position onCloseAutoFocus onEscapeKeyDown onPointerDownOutside side sideOffset align alignOffset arrowPadding collisionBoundary collisionPadding sticky hideWhenDetached avoidCollisions".split(" "));const Xb=sq("SelectContent",k),[hc,ec]=(0,ff.useState)(null),[Ec,Ic]=(0,ff.useState)(null);d=eh(d,qf=>ec(qf));const [nd,Bd]=(0,ff.useState)(null),[Ee,Vd]=(0,ff.useState)(null),te=Cw(k),[gf,Be]=(0,ff.useState)(!1),Fe=(0,ff.useRef)(!1);(0,ff.useEffect)(()=>{if(hc)return ny(hc)},[hc]);
hi();const Fd=(0,ff.useCallback)(qf=>{const [Cg,...dh]=te().map(wk=>wk.ref.current),[Qi]=dh.slice(-1),bk=document.activeElement;for(const wk of qf){if(wk===bk)break;null===wk||void 0===wk||wk.scrollIntoView({block:"nearest"});wk===Cg&&Ec&&(Ec.scrollTop=0);wk===Qi&&Ec&&(Ec.scrollTop=Ec.scrollHeight);null===wk||void 0===wk||wk.focus();if(document.activeElement!==bk)break}},[te,Ec]),bd=(0,ff.useCallback)(()=>Fd([nd,hc]),[Fd,nd,hc]);(0,ff.useEffect)(()=>{gf&&bd()},[gf,bd]);const {onOpenChange:Gd,triggerPointerDownPosRef:Zc}=
Xb;(0,ff.useEffect)(()=>{if(hc){var qf=0,Cg=0;const dh=bk=>{var wk,Np,hr,xq;qf=Math.abs(Math.round(bk.pageX)-(null!==(wk=null===(Np=Zc.current)||void 0===Np?void 0:Np.x)&&void 0!==wk?wk:0));Cg=Math.abs(Math.round(bk.pageY)-(null!==(hr=null===(xq=Zc.current)||void 0===xq?void 0:xq.y)&&void 0!==hr?hr:0))},Qi=bk=>{10>=qf&&10>=Cg?bk.preventDefault():hc.contains(bk.target)||Gd(!1);document.removeEventListener("pointermove",dh);Zc.current=null};null!==Zc.current&&(document.addEventListener("pointermove",
dh),document.addEventListener("pointerup",Qi,{capture:!0,once:!0}));return()=>{document.removeEventListener("pointermove",dh);document.removeEventListener("pointerup",Qi,{capture:!0})}}},[hc,Gd,Zc]);(0,ff.useEffect)(()=>{const qf=()=>Gd(!1);window.addEventListener("blur",qf);window.addEventListener("resize",qf);return()=>{window.removeEventListener("blur",qf);window.removeEventListener("resize",qf)}},[Gd]);const [td,we]=Fl(qf=>{const Cg=te().filter(bk=>!bk.disabled),dh=Cg.find(bk=>bk.ref.current===
document.activeElement),Qi=sl(Cg,qf,dh);Qi&&setTimeout(()=>Qi.ref.current.focus())}),Te=(0,ff.useCallback)((qf,Cg,dh)=>{dh=!Fe.current&&!dh;if(void 0!==Xb.value&&Xb.value===Cg||dh)Bd(qf),dh&&(Fe.current=!0)},[Xb.value]),vf=(0,ff.useCallback)(()=>null===hc||void 0===hc?void 0:hc.focus(),[hc]),hf=(0,ff.useCallback)((qf,Cg,dh)=>{dh=!Fe.current&&!dh;(void 0!==Xb.value&&Xb.value===Cg||dh)&&Vd(qf)},[Xb.value]),Mf="popper"===G?My:wC,Ig=Mf===My?{side:Ha,sideOffset:Sa,align:Za,alignOffset:fb,arrowPadding:ib,
collisionBoundary:Bb,collisionPadding:Ob,sticky:Fb,hideWhenDetached:cc,avoidCollisions:oc}:{};return(0,ff.createElement)(Pr,{scope:k,content:hc,viewport:Ec,onViewportChange:Ic,itemRefCallback:Te,selectedItem:nd,onItemLeave:vf,itemTextRefCallback:hf,focusSelectedItem:bd,selectedItemText:Ee,position:G,isPositioned:gf,searchRef:td},(0,ff.createElement)(sk,{as:lq,allowPinchZoom:!0},(0,ff.createElement)(pC,{asChild:!0,trapped:Xb.open,onMountAutoFocus:qf=>{qf.preventDefault()},onUnmountAutoFocus:Lf(fa,
qf=>{var Cg;null===(Cg=Xb.trigger)||void 0===Cg||Cg.focus({preventScroll:!0});qf.preventDefault()})},(0,ff.createElement)(wg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:na,onPointerDownOutside:ta,onFocusOutside:qf=>qf.preventDefault(),onDismiss:()=>Xb.onOpenChange(!1)},(0,ff.createElement)(Mf,He({role:"listbox",id:Xb.contentId,"data-state":Xb.open?"open":"closed",dir:Xb.dir,onContextMenu:qf=>qf.preventDefault()},a,Ig,{onPlaced:()=>Be(!0),ref:d,style:Ud({display:"flex",flexDirection:"column",
outline:"none"},a.style),onKeyDown:Lf(a.onKeyDown,qf=>{var Cg=qf.ctrlKey||qf.altKey||qf.metaKey;"Tab"===qf.key&&qf.preventDefault();Cg||1!==qf.key.length||we(qf.key);if(["ArrowUp","ArrowDown","Home","End"].includes(qf.key)){let dh=te().filter(Qi=>!Qi.disabled).map(Qi=>Qi.ref.current);["ArrowUp","End"].includes(qf.key)&&(dh=dh.slice().reverse());["ArrowUp","ArrowDown"].includes(qf.key)&&(Cg=dh.indexOf(qf.target),dh=dh.slice(Cg+1));setTimeout(()=>Fd(dh));qf.preventDefault()}})}))))))}),wC=(0,ff.forwardRef)((a,
d)=>{const {__scopeSelect:k,onPlaced:G}=a;a=nf(a,["__scopeSelect","onPlaced"]);const fa=sq("SelectContent",k);var na=Ko("SelectContent",k);const [ta,Ha]=(0,ff.useState)(null),[Sa,Za]=(0,ff.useState)(null);d=eh(d,Ec=>Za(Ec));const fb=Cw(k),ib=(0,ff.useRef)(!1),Bb=(0,ff.useRef)(!0),{viewport:Ob,selectedItem:Fb,selectedItemText:cc,focusSelectedItem:oc}=na,Xb=(0,ff.useCallback)(()=>{if(fa.trigger&&fa.valueNode&&ta&&Sa&&Ob&&Fb&&cc){var Ec=fa.trigger.getBoundingClientRect(),Ic=Sa.getBoundingClientRect(),
nd=fa.valueNode.getBoundingClientRect(),Bd=cc.getBoundingClientRect();"rtl"!==fa.dir?(Bd=nd.left-(Bd.left-Ic.left),nd=Ec.width+(Ec.left-Bd),Ic=yo(Bd,[10,window.innerWidth-10-Math.max(nd,Ic.width)]),ta.style.minWidth=nd+"px",ta.style.left=Ic+"px"):(Bd=window.innerWidth-nd.right-(Ic.right-Bd.right),nd=Ec.width+(window.innerWidth-Ec.right-Bd),Ic=yo(Bd,[10,window.innerWidth-10-Math.max(nd,Ic.width)]),ta.style.minWidth=nd+"px",ta.style.right=Ic+"px");const Fe=fb();Ic=window.innerHeight-20;var Ee=Ob.scrollHeight,
Vd=window.getComputedStyle(Sa);nd=parseInt(Vd.borderTopWidth,10);var te=parseInt(Vd.paddingTop,10);Bd=parseInt(Vd.borderBottomWidth,10);Vd=parseInt(Vd.paddingBottom,10);var gf=nd+te+Ee+Vd+Bd;Ee=Math.min(5*Fb.offsetHeight,gf);var Be=window.getComputedStyle(Ob);Vd=parseInt(Be.paddingTop,10);Be=parseInt(Be.paddingBottom,10);const Fd=Ec.top+Ec.height/2-10,bd=Ic-Fd;Ec=Fb.offsetHeight/2;te=nd+te+(Fb.offsetTop+Ec);gf-=te;te<=Fd?(nd=Fb===Fe[Fe.length-1].ref.current,ta.style.bottom="0px",ta.style.height=te+
Math.max(bd,Ec+(nd?Be:0)+(Sa.clientHeight-Ob.offsetTop-Ob.offsetHeight)+Bd)+"px"):(Bd=Fb===Fe[0].ref.current,ta.style.top="0px",ta.style.height=Math.max(Fd,nd+Ob.offsetTop+(Bd?Vd:0)+Ec)+gf+"px",Ob.scrollTop=te-Fd+Ob.offsetTop);ta.style.margin="10px 0";ta.style.minHeight=Ee+"px";ta.style.maxHeight=Ic+"px";null===G||void 0===G||G();requestAnimationFrame(()=>ib.current=!0)}},[fb,fa.trigger,fa.valueNode,ta,Sa,Ob,Fb,cc,fa.dir,G]);Bm(()=>Xb(),[Xb]);const [hc,ec]=(0,ff.useState)();Bm(()=>{Sa&&ec(window.getComputedStyle(Sa).zIndex)},
[Sa]);na=(0,ff.useCallback)(Ec=>{Ec&&!0===Bb.current&&(Xb(),null===oc||void 0===oc||oc(),Bb.current=!1)},[Xb,oc]);return(0,ff.createElement)($t,{scope:k,contentWrapper:ta,shouldExpandOnScrollRef:ib,onScrollButtonChange:na},(0,ff.createElement)("div",{ref:Ha,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:hc}},(0,ff.createElement)(ll.div,He({},a,{ref:d,style:Ud({boxSizing:"border-box",maxHeight:"100%"},a.style)}))))}),My=(0,ff.forwardRef)((a,d)=>{const {__scopeSelect:k,align:G=
"start",collisionPadding:fa=10}=a;a=nf(a,["__scopeSelect","align","collisionPadding"]);const na=Zt(k);return(0,ff.createElement)(Hy,He({},na,a,{ref:d,align:G,collisionPadding:fa,style:Re(Ud({boxSizing:"border-box"},a.style),{"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)",
"--radix-select-trigger-height":"var(--radix-popper-anchor-height)"})}))}),[$t,Qr]=Yt("SelectContent",{}),ev=(0,ff.forwardRef)((a,d)=>{const {__scopeSelect:k}=a;a=nf(a,["__scopeSelect"]);const G=Ko("SelectViewport",k),fa=Qr("SelectViewport",k);d=eh(d,G.onViewportChange);const na=(0,ff.useRef)(0);return(0,ff.createElement)(ff.Fragment,null,(0,ff.createElement)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"}}),
(0,ff.createElement)(Xt.Slot,{scope:k},(0,ff.createElement)(ll.div,He({"data-radix-select-viewport":"",role:"presentation"},a,{ref:d,style:Ud({position:"relative",flex:1,overflow:"auto"},a.style),onScroll:Lf(a.onScroll,ta=>{ta=ta.currentTarget;const {contentWrapper:Ha,shouldExpandOnScrollRef:Sa}=fa;if(null!==Sa&&void 0!==Sa&&Sa.current&&Ha){var Za=Math.abs(na.current-ta.scrollTop);if(0<Za){var fb=window.innerHeight-20,ib=parseFloat(Ha.style.minHeight);const Bb=parseFloat(Ha.style.height);ib=Math.max(ib,
Bb);ib<fb&&(Za=ib+Za,fb=Math.min(fb,Za),Za-=fb,Ha.style.height=fb+"px","0px"===Ha.style.bottom&&(ta.scrollTop=0<Za?Za:0,Ha.style.justifyContent="flex-end"))}}na.current=ta.scrollTop})}))))});Yt("SelectGroup");var [fv,gv]=Yt("SelectItem"),Rr=(0,ff.forwardRef)((a,d)=>{const {__scopeSelect:k,value:G,disabled:fa=!1,textValue:na}=a;a=nf(a,["__scopeSelect","value","disabled","textValue"]);const ta=sq("SelectItem",k),Ha=Ko("SelectItem",k),Sa=ta.value===G,[Za,fb]=(0,ff.useState)(null!==na&&void 0!==na?na:
""),[ib,Bb]=(0,ff.useState)(!1);d=eh(d,cc=>{var oc;return null===(oc=Ha.itemRefCallback)||void 0===oc?void 0:oc.call(Ha,cc,G,fa)});const Ob=Sh(),Fb=()=>{fa||(ta.onValueChange(G),ta.onOpenChange(!1))};return(0,ff.createElement)(fv,{scope:k,value:G,disabled:fa,textId:Ob,isSelected:Sa,onItemTextChange:(0,ff.useCallback)(cc=>{fb(oc=>{var Xb;return oc||(null!==(Xb=null===cc||void 0===cc?void 0:cc.textContent)&&void 0!==Xb?Xb:"").trim()})},[])},(0,ff.createElement)(Xt.ItemSlot,{scope:k,value:G,disabled:fa,
textValue:Za},(0,ff.createElement)(ll.div,He({role:"option","aria-labelledby":Ob,"data-highlighted":ib?"":void 0,"aria-selected":Sa&&ib,"data-state":Sa?"checked":"unchecked","aria-disabled":fa||void 0,"data-disabled":fa?"":void 0,tabIndex:fa?void 0:-1},a,{ref:d,onFocus:Lf(a.onFocus,()=>Bb(!0)),onBlur:Lf(a.onBlur,()=>Bb(!1)),onPointerUp:Lf(a.onPointerUp,Fb),onPointerMove:Lf(a.onPointerMove,cc=>{if(fa){var oc;null===(oc=Ha.onItemLeave)||void 0===oc||oc.call(Ha)}else cc.currentTarget.focus({preventScroll:!0})}),
onPointerLeave:Lf(a.onPointerLeave,cc=>{if(cc.currentTarget===document.activeElement){var oc;null===(oc=Ha.onItemLeave)||void 0===oc||oc.call(Ha)}}),onKeyDown:Lf(a.onKeyDown,cc=>{var oc;if(""===(null===(oc=Ha.searchRef)||void 0===oc?void 0:oc.current)||" "!==cc.key)sC.includes(cc.key)&&Fb()," "===cc.key&&cc.preventDefault()})}))))}),jp=(0,ff.forwardRef)((a,d)=>{var {__scopeSelect:k}=a;a=nf(a,["__scopeSelect","className","style"]);const G=sq("SelectItemText",k),fa=Ko("SelectItemText",k),na=gv("SelectItemText",
k);k=Jy("SelectItemText",k);const [ta,Ha]=(0,ff.useState)(null);d=eh(d,Bb=>Ha(Bb),na.onItemTextChange,Bb=>{var Ob;return null===(Ob=fa.itemTextRefCallback)||void 0===Ob?void 0:Ob.call(fa,Bb,na.value,na.disabled)});const Sa=null===ta||void 0===ta?void 0:ta.textContent,Za=(0,ff.useMemo)(()=>(0,ff.createElement)("option",{key:na.value,value:na.value,disabled:na.disabled},Sa),[na.disabled,na.value,Sa]),{onNativeOptionAdd:fb,onNativeOptionRemove:ib}=k;Bm(()=>{fb(Za);return()=>ib(Za)},[fb,ib,Za]);return(0,ff.createElement)(ff.Fragment,
null,(0,ff.createElement)(ll.span,He({id:na.textId},a,{ref:d})),na.isSelected&&G.valueNode&&!G.valueNodeHasChildren?(0,Tt.createPortal)(a.children,G.valueNode):null)}),xC=(0,ff.forwardRef)((a,d)=>{const k=Ko("SelectScrollUpButton",a.__scopeSelect),G=Qr("SelectScrollUpButton",a.__scopeSelect),[fa,na]=(0,ff.useState)(!1);d=eh(d,G.onScrollButtonChange);Bm(()=>{if(k.viewport&&k.isPositioned){let ta=function(){na(0<Ha.scrollTop)};const Ha=k.viewport;ta();Ha.addEventListener("scroll",ta);return()=>Ha.removeEventListener("scroll",
ta)}},[k.viewport,k.isPositioned]);return fa?(0,ff.createElement)(Ss,He({},a,{ref:d,onAutoScroll:()=>{const {viewport:ta,selectedItem:Ha}=k;ta&&Ha&&(ta.scrollTop-=Ha.offsetHeight)}})):null}),Lo=(0,ff.forwardRef)((a,d)=>{const k=Ko("SelectScrollDownButton",a.__scopeSelect),G=Qr("SelectScrollDownButton",a.__scopeSelect),[fa,na]=(0,ff.useState)(!1);d=eh(d,G.onScrollButtonChange);Bm(()=>{if(k.viewport&&k.isPositioned){let ta=function(){na(Math.ceil(Ha.scrollTop)<Ha.scrollHeight-Ha.clientHeight)};const Ha=
k.viewport;ta();Ha.addEventListener("scroll",ta);return()=>Ha.removeEventListener("scroll",ta)}},[k.viewport,k.isPositioned]);return fa?(0,ff.createElement)(Ss,He({},a,{ref:d,onAutoScroll:()=>{const {viewport:ta,selectedItem:Ha}=k;ta&&Ha&&(ta.scrollTop+=Ha.offsetHeight)}})):null}),Ss=(0,ff.forwardRef)((a,d)=>{const {__scopeSelect:k,onAutoScroll:G}=a;a=nf(a,["__scopeSelect","onAutoScroll"]);const fa=Ko("SelectScrollButton",k),na=(0,ff.useRef)(null),ta=Cw(k),Ha=(0,ff.useCallback)(()=>{null!==na.current&&
(window.clearInterval(na.current),na.current=null)},[]);(0,ff.useEffect)(()=>()=>Ha(),[Ha]);Bm(()=>{var Sa;const Za=ta().find(fb=>fb.ref.current===document.activeElement);null===Za||void 0===Za||null===(Sa=Za.ref.current)||void 0===Sa||Sa.scrollIntoView({block:"nearest"})},[ta]);return(0,ff.createElement)(ll.div,He({"aria-hidden":!0},a,{ref:d,style:Ud({flexShrink:0},a.style),onPointerMove:Lf(a.onPointerMove,()=>{var Sa;null===(Sa=fa.onItemLeave)||void 0===Sa||Sa.call(fa);null===na.current&&(na.current=
window.setInterval(G,50))}),onPointerLeave:Lf(a.onPointerLeave,()=>{Ha()})}))}),hv=(0,ff.forwardRef)((a,d)=>{const {value:k}=a;a=nf(a,["value"]);const G=(0,ff.useRef)(null);d=eh(d,G);const fa=In(k);(0,ff.useEffect)(()=>{const na=G.current,ta=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(fa!==k&&ta){const Ha=new Event("change",{bubbles:!0});ta.call(na,k);na.dispatchEvent(Ha)}},[fa,k]);return(0,ff.createElement)(Nr,{asChild:!0},(0,ff.createElement)("select",He({},
a,{ref:d,defaultValue:k})))});hv.displayName="BubbleSelect";var Sr=a=>{const {__scopeSelect:d,children:k,open:G,defaultOpen:fa,onOpenChange:na,value:ta,defaultValue:Ha,onValueChange:Sa,dir:Za,name:fb,autoComplete:ib,disabled:Bb,required:Ob}=a,Fb=Zt(d),[cc,oc]=(0,ff.useState)(null),[Xb,hc]=(0,ff.useState)(null),[ec,Ec]=(0,ff.useState)(!1),Ic=Vn(Za),[nd=!1,Bd]=Fh({prop:G,defaultProp:fa,onChange:na}),[Ee,Vd]=Fh({prop:ta,defaultProp:Ha,onChange:Sa}),te=(0,ff.useRef)(null),gf=cc?!!cc.closest("form"):!0,
[Be,Fe]=(0,ff.useState)(new Set),Fd=Array.from(Be).map(bd=>bd.props.value).join(";");return(0,ff.createElement)(qC,Fb,(0,ff.createElement)(vH,{required:Ob,scope:d,trigger:cc,onTriggerChange:oc,valueNode:Xb,onValueNodeChange:hc,valueNodeHasChildren:ec,onValueNodeHasChildrenChange:Ec,contentId:Sh(),value:Ee,onValueChange:Vd,open:nd,onOpenChange:Bd,dir:Ic,triggerPointerDownPosRef:te,disabled:Bb},(0,ff.createElement)(Xt.Provider,{scope:d},(0,ff.createElement)(Iy,{scope:a.__scopeSelect,onNativeOptionAdd:(0,ff.useCallback)(bd=>
{Fe(Gd=>(new Set(Gd)).add(bd))},[]),onNativeOptionRemove:(0,ff.useCallback)(bd=>{Fe(Gd=>{Gd=new Set(Gd);Gd.delete(bd);return Gd})},[])},k)),gf?(0,ff.createElement)(hv,{key:Fd,"aria-hidden":!0,required:Ob,tabIndex:-1,name:fb,autoComplete:ib,value:Ee,onChange:bd=>Vd(bd.target.value),disabled:Bb},void 0===Ee?(0,ff.createElement)("option",{value:""}):null,Array.from(Be)):null))},yC=Ky,AC=tC,BC=uC,Cm=a=>(0,ff.createElement)(uH,He({asChild:!0},a)),Ny=vC,zC=ev,ao=Rr,sd=jp,CC=xC,Kh=Lo,Mg=ba(598),DC=$e(ba(22)),
iv=ba(598),Dm=ba(598),EC=Ze(function(){const a=kg(),{handlers:{t:d}}=jm.useContext(Gi),k=jm.useCallback(ta=>{a.api.setColor(ta)},[]),G=jm.useCallback(ta=>{(ta=ta.currentTarget.dataset.tool)&&a.selectTool(ta)},[]),[fa,na]=jm.useState(()=>{var ta;return null!=(ta=Object.values(or).find(Ha=>Ha===a.selectedTool.id))?ta:Object.values(or)[0]});jm.useEffect(()=>{na(ta=>{var Ha;return null!=(Ha=Object.values(or).find(Sa=>Sa===a.selectedTool.id))?Ha:ta})},[a.selectedTool.id]);return(0,Dm.jsx)("div",{className:"tl-primary-tools",
"data-html2canvas-ignore":"true",children:(0,Dm.jsxs)("div",{className:"tl-toolbar tl-tools-floating-panel",children:[(0,Dm.jsx)(Bp,{handleClick:()=>a.selectTool("select"),tooltip:d("whiteboard/select"),id:"select",icon:"select-cursor"}),(0,Dm.jsx)(Bp,{handleClick:()=>a.selectTool("move"),tooltip:d("whiteboard/pan"),id:"move",icon:a.isIn("move.panning")?"hand-grab":"hand-stop"}),(0,Dm.jsx)(Kr,{className:"tl-toolbar-separator",orientation:"horizontal"}),(0,Dm.jsx)(Bp,{handleClick:()=>a.selectTool("logseq-portal"),
tooltip:d("whiteboard/add-block-or-page"),id:"logseq-portal",icon:"circle-plus"}),(0,Dm.jsx)(Bp,{handleClick:()=>a.selectTool("pencil"),tooltip:d("whiteboard/draw"),id:"pencil",icon:"ballpen"}),(0,Dm.jsx)(Bp,{handleClick:()=>a.selectTool("highlighter"),tooltip:d("whiteboard/highlight"),id:"highlighter",icon:"highlight"}),(0,Dm.jsx)(Bp,{handleClick:()=>a.selectTool("erase"),tooltip:d("whiteboard/eraser"),id:"erase",icon:"eraser"}),(0,Dm.jsx)(Bp,{handleClick:()=>a.selectTool("line"),tooltip:d("whiteboard/connector"),
id:"line",icon:"connector"}),(0,Dm.jsx)(Bp,{handleClick:()=>a.selectTool("text"),tooltip:d("whiteboard/text"),id:"text",icon:"text"}),(0,Dm.jsx)(Ay,{activeGeometry:fa,setGeometry:G}),(0,Dm.jsx)(Kr,{className:"tl-toolbar-separator",orientation:"horizontal",style:{margin:"0 -4px"}}),(0,Dm.jsx)(Wm,{popoverSide:"left",color:a.settings.color,setColor:k}),(0,Dm.jsx)(Uo,{scaleLevel:a.settings.scaleLevel,popoverSide:"left",compact:!0})]})})}),Oy=ba(598),Dw=Ze(function(){const a=kg();return(0,Oy.jsxs)("div",
{className:"tl-statusbar","data-html2canvas-ignore":"true",children:[a.selectedTool.id," | ",a.selectedTool.currentState.id,(0,Oy.jsx)("div",{style:{flex:1}}),(0,Oy.jsx)("div",{id:"tl-statusbar-anchor",className:"flex gap-1"})]})}),Ts=ba(598),FC=Ze(function(){const a=kg();return(0,Ts.jsxs)(Ts.Fragment,{children:[wf()&&(0,Ts.jsx)(Dw,{}),wf()&&(0,Ts.jsx)(Ho,{}),!a.readOnly&&(0,Ts.jsx)(EC,{}),(0,Ts.jsx)(kC,{})]})}),Mo=$e(ba(22)),Tl=$e(ba(22)),Py=$e(ba(22)),GC=$e(ba(22)),Xq=ba(598),Qy=({id:a,showReferenceContent:d=
!1})=>{var k;const {handlers:{isWhiteboardPage:G,redirectToPage:fa,sidebarAddBlock:na,queryBlockByUUID:ta},renderers:{Breadcrumb:Ha,PageName:Sa}}=GC.default.useContext(Gi);var Za="";let fb=Hl(a)?"B":"P",ib="";if(Hl(a)){Za=ta(a);if(!Za)return(0,Xq.jsx)("span",{className:"p-2",children:"Invalid reference. Did you remove it?"});ib=Za.content;Za="whiteboard-shape"===(null==(k=Za.properties)?void 0:k["ls-type"])?"link-to-whiteboard":"link-to-block"}else Za=G(a)?"link-to-whiteboard":"link-to-page";k=ib&&
23<ib.length?ib.slice(0,20)+"...":ib;return(0,Xq.jsxs)("button",{className:"inline-flex gap-1 items-center w-full",onPointerDown:Bb=>{Bb.stopPropagation();Bb.shiftKey?na(a,"B"===fb?"block":"page"):fa(a)},children:[(0,Xq.jsx)(gh,{name:Za}),(0,Xq.jsx)("span",{className:"pointer-events-none block-link-reference-row",children:"P"===fb?(0,Xq.jsx)(Sa,{pageName:a}):(0,Xq.jsxs)(Xq.Fragment,{children:[(0,Xq.jsx)(Ha,{levelLimit:1,blockId:a,endSeparator:d}),d&&k]})})]})},uk=$e(ba(22)),Mn=ba(22),HC=["children"],
au="undefined"!==typeof document?Mn.useLayoutEffect:Mn.useEffect,bh=$e(ba(22)),Bh=ba(22),IC=ba(31),jv,Cl,wH="undefined"!=typeof document?Bh.useLayoutEffect:Bh.useEffect;!function(a){a[a.DEBUG=0]="DEBUG";a[a.INFO=1]="INFO";a[a.WARN=2]="WARN";a[a.ERROR=3]="ERROR"}(Cl||={});var JC=((jv={})[Cl.DEBUG]="debug",jv[Cl.INFO]="log",jv[Cl.WARN]="warn",jv[Cl.ERROR]="error",jv),Yq=Vh(function(){var a=Ef(Cl.ERROR);return{log:Ef(function(d,k,G){var fa;void 0===G&&(G=Cl.INFO);G>=(null!=(fa=("undefined"==typeof globalThis?
window:globalThis).VIRTUOSO_LOG_LEVEL)?fa:a(4))&&console[JC[G]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",d,k)}),logLevel:a}},[],{singleton:!0}),Nn=Vh(function(){var a=vg(),d=vg(),k=Ef(0),G=vg(),fa=Ef(0),na=vg(),ta=vg(),Ha=Ef(0),Sa=Ef(0),Za=Ef(0),fb=Ef(0),ib=vg(),Bb=vg(),Ob=Ef(!1),Fb=Ef(!1);return Gf(mf(a,ag(function(cc){return cc.scrollTop})),d),Gf(mf(a,ag(function(cc){return cc.scrollHeight})),ta),Gf(d,fa),{scrollContainerState:a,scrollTop:d,viewportHeight:na,
headerHeight:Ha,fixedHeaderHeight:Sa,fixedFooterHeight:Za,footerHeight:fb,scrollHeight:ta,smoothScrollTargetReached:G,react18ConcurrentRendering:Fb,scrollTo:ib,scrollBy:Bb,statefulScrollTop:fa,deviation:k,scrollingInProgress:Ob}},[],{singleton:!0}),Ci={lvl:0},Ry=Vh(function(){return{recalcInProgress:Ef(!1)}},[],{singleton:!0}),xH={offsetHeight:"height",offsetWidth:"width"},Zq=Vh(function(a){var d=a[0].log,k=a[1].recalcInProgress;a=vg();var G=vg(),fa=pj(G,0),na=vg(),ta=vg(),Ha=Ef(0),Sa=Ef([]),Za=Ef(void 0),
fb=Ef(void 0),ib=Ef(function(hc,ec){return oi(hc,xH[ec])}),Bb=Ef(void 0),Ob=Ef(0),Fb={offsetTree:[],sizeTree:Ci,groupOffsetTree:Ci,lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},cc=pj(mf(a,sh(Sa,d,Ob),Lj(Uh,Fb),Gh()),Fb);Gf(mf(Sa,Xf(function(hc){return 0<hc.length}),sh(cc,Ob),ag(function(hc){var ec=hc[0],Ec=hc[1],Ic=hc[2];hc=ec.reduce(function(nd,Bd,Ee){return Aa(nd,Bd,Qh(Bd,Ec.offsetTree,Ic)||Ee)},Ci);return Yg({},Ec,{groupIndices:ec,groupOffsetTree:hc})})),cc);Gf(mf(G,sh(cc),Xf(function(hc){return hc[0]<
hc[1].lastIndex}),ag(function(hc){var ec=hc[1];return[{startIndex:hc[0],endIndex:ec.lastIndex,size:ec.lastSize}]})),a);Gf(Za,fb);var oc=pj(mf(Za,ag(function(hc){return void 0===hc})),!0);Gf(mf(fb,Xf(function(hc){return void 0!==hc&&cc(4).sizeTree===Ci}),ag(function(hc){return[{startIndex:0,endIndex:0,size:hc}]})),a);Fb=yk(mf(a,sh(cc),Lj(function(hc,ec){ec=ec[1];return{changed:ec!==hc.sizes,sizes:ec}},{changed:!1,sizes:Fb}),ag(function(hc){return hc.changed})));ch(mf(Ha,Lj(function(hc,ec){return{diff:hc.prev-
ec,prev:ec}},{diff:0,prev:0}),ag(function(hc){return hc.diff})),function(hc){0<hc?(k(0,!0),na(0,hc)):0>hc&&ta(0,hc)});ch(mf(Ha,sh(d)),function(hc){0>hc[0]&&(0,hc[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:Ha},Cl.ERROR)});d=yk(na);Gf(mf(na,sh(cc),ag(function(hc){var ec=hc[0];hc=hc[1];if(0<hc.groupIndices.length)throw Error("Virtuoso: prepending items does not work with groups");return Ia(hc.sizeTree).reduce(function(Ec,
Ic){var nd=Ic.k;Ic=Ic.v;return{ranges:[].concat(Ec.ranges,[{startIndex:Ec.prevIndex,endIndex:nd+ec-1,size:Ec.prevSize}]),prevIndex:nd+ec,prevSize:Ic}},{ranges:[],prevIndex:0,prevSize:hc.lastSize}).ranges})),a);var Xb=yk(mf(ta,sh(cc,Ob),ag(function(hc){return Qh(-hc[0],hc[1].offsetTree,hc[2])})));return Gf(mf(ta,sh(cc,Ob),ag(function(hc){var ec=hc[0],Ec=hc[1];hc=hc[2];if(0<Ec.groupIndices.length)throw Error("Virtuoso: shifting items does not work with groups");var Ic=Ia(Ec.sizeTree).reduce(function(nd,
Bd){return Aa(nd,Math.max(0,Bd.k+ec),Bd.v)},Ci);return Yg({},Ec,{sizeTree:Ic},Di(Ec.offsetTree,0,Ic,hc))})),cc),{data:Bb,totalCount:G,sizeRanges:a,groupIndices:Sa,defaultItemSize:fb,fixedItemSize:Za,unshiftWith:na,shiftWith:ta,shiftWithOffset:Xb,beforeUnshiftWith:d,firstItemIndex:Ha,gap:Ob,sizes:cc,listRefresh:Fb,statefulTotalCount:fa,trackItemSizes:oc,itemSize:ib}},Ni(Yq,Ry),{singleton:!0}),yH="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style,kv=Vh(function(a){function d(){oc&&
(oc(),oc=null);hc&&(hc(),hc=null);Xb&&(clearTimeout(Xb),Xb=null);Ha(0,!1)}var k=a[0],G=k.sizes,fa=k.totalCount,na=k.listRefresh;k=k.gap;var ta=a[1],Ha=ta.scrollingInProgress,Sa=ta.viewportHeight,Za=ta.scrollTo,fb=ta.smoothScrollTargetReached,ib=ta.headerHeight,Bb=ta.footerHeight,Ob=ta.fixedHeaderHeight;ta=ta.fixedFooterHeight;a=a[2].log;var Fb=vg(),cc=Ef(0),oc=null,Xb=null,hc=null;return Gf(mf(Fb,sh(G,Sa,fa,cc,ib,Bb,a),sh(k,Ob,ta),ag(function(ec){var Ec=ec[0],Ic=Ec[0],nd=Ec[1],Bd=Ec[2],Ee=Ec[3],Vd=
Ec[4],te=Ec[5],gf=Ec[6],Be=Ec[7],Fe=ec[1];Ec=ec[2];ec=ec[3];var Fd=Wh(Ic),bd=Fd.align,Gd=Fd.behavior,Zc=Fd.offset;--Ee;Fd=di(Fd,nd,Ee);te=Qh(Fd,nd.offsetTree,Fe)+te;"end"===bd?(te+=Ec+ca(nd.sizeTree,Fd)[1]-Bd+ec,Fd===Ee&&(te+=gf)):"center"===bd?te+=(Ec+ca(nd.sizeTree,Fd)[1]-Bd+ec)/2:te-=Vd;Zc&&(te+=Zc);var td=function(Te){d();Te?(Be("retrying to scroll to",{location:Ic},Cl.DEBUG),Fb(0,Ic)):Be("list did not change, scroll successful",{},Cl.DEBUG)};if(d(),"smooth"===Gd){var we=!1;hc=ch(na,function(Te){we=
we||Te});oc=Jk(fb,function(){td(we)})}else oc=Jk(mf(na,function(Te){var vf=setTimeout(function(){Te(!1)},150);return function(hf){hf&&(Te(!0),clearTimeout(vf))}}),td);Xb=setTimeout(function(){d()},1200);Ha(0,!0);return Be("scrolling from index to",{index:Fd,top:te,behavior:Gd},Cl.DEBUG),{top:te,behavior:Gd}})),Za),{scrollToIndex:Fb,topListHeight:cc}},Ni(Zq,Nn,Yq),{singleton:!0}),zH={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},
lv=Vh(function(a){var d=a[0],k=d.scrollContainerState;a=d.scrollTop;var G=d.viewportHeight,fa=d.headerHeight,na=d.footerHeight,ta=d.scrollBy;d=Ef(!1);var Ha=Ef(!0),Sa=vg(),Za=vg(),fb=Ef(4),ib=Ef(0),Bb=pj(mf(Zp(mf(nh(a),Nl(1),Bn(!0)),mf(nh(a),Nl(1),Bn(!1),mj(100))),Gh()),!1),Ob=pj(mf(Zp(mf(ta,Bn(!0)),mf(ta,Bn(!1),mj(200))),Gh()),!1);Gf(mf(Cj(nh(a),nh(ib)),ag(function(Fb){return Fb[0]<=Fb[1]}),Gh()),Ha);Gf(mf(Ha,Xm(50)),Za);G=yk(mf(Cj(k,nh(G),nh(fa),nh(na),nh(fb)),Lj(function(Fb,cc){var oc,Xb,hc=cc[0],
ec=hc.scrollTop;hc=hc.scrollHeight;var Ec=cc[1],Ic={viewportHeight:Ec,scrollTop:ec,scrollHeight:hc};return ec+Ec-hc>-cc[4]?(ec>Fb.state.scrollTop?(oc="SCROLLED_DOWN",Xb=Fb.state.scrollTop-ec):(oc="SIZE_DECREASED",Xb=Fb.state.scrollTop-ec||Fb.scrollTopDelta),{atBottom:!0,state:Ic,atBottomBecause:oc,scrollTopDelta:Xb}):{atBottom:!1,notAtBottomBecause:Ic.scrollHeight>Fb.state.scrollHeight?"SIZE_INCREASED":Ec<Fb.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":ec<Fb.state.scrollTop?"SCROLLING_UPWARDS":
"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:Ic}},zH),Gh(function(Fb,cc){return Fb&&Fb.atBottom===cc.atBottom})));fa=pj(mf(k,Lj(function(Fb,cc){var oc=cc.scrollTop,Xb=cc.scrollHeight;cc=cc.viewportHeight;return 1.01>Math.abs(Fb.scrollHeight-Xb)?{scrollTop:oc,scrollHeight:Xb,jump:0,changed:!1}:Fb.scrollTop!==oc&&1>Xb-(oc+cc)?{scrollHeight:Xb,scrollTop:oc,jump:Fb.scrollTop-oc,changed:!0}:{scrollHeight:Xb,scrollTop:oc,jump:0,changed:!0}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),Xf(function(Fb){return Fb.changed}),
ag(function(Fb){return Fb.jump})),0);Gf(mf(G,ag(function(Fb){return Fb.atBottom})),d);Gf(mf(d,Xm(50)),Sa);na=Ef("down");Gf(mf(k,ag(function(Fb){return Fb.scrollTop}),Gh(),Lj(function(Fb,cc){return Ob(4)?{direction:Fb.direction,prevScrollTop:cc}:{direction:cc<Fb.prevScrollTop?"up":"down",prevScrollTop:cc}},{direction:"down",prevScrollTop:0}),ag(function(Fb){return Fb.direction})),na);Gf(mf(k,Xm(50),Bn("none")),na);k=Ef(0);return Gf(mf(Bb,Xf(function(Fb){return!Fb}),Bn(0)),k),Gf(mf(a,Xm(100),sh(Bb),
Xf(function(Fb){return!!Fb[1]}),Lj(function(Fb,cc){return[Fb[1],cc[0]]},[0,0]),ag(function(Fb){return Fb[1]-Fb[0]})),k),{isScrolling:Bb,isAtTop:Ha,isAtBottom:d,atBottomState:G,atTopStateChange:Za,atBottomStateChange:Sa,scrollDirection:na,atBottomThreshold:fb,atTopThreshold:ib,scrollVelocity:k,lastJumpDueToItemResize:fa}},Ni(Nn)),Us=Vh(function(a){var d=a[0].log;a=Ef(!1);var k=yk(mf(a,Xf(function(G){return G}),Gh()));return ch(a,function(G){G&&d(4)("props updated",{},Cl.DEBUG)}),{propsReady:a,didMount:k}},
Ni(Yq),{singleton:!0}),Ew=Vh(function(a){var d=a[0],k=d.sizes,G=d.listRefresh;d=d.defaultItemSize;var fa=a[1].scrollTop,na=a[2].scrollToIndex;a=a[3].didMount;var ta=Ef(!0),Ha=Ef(0);return Gf(mf(a,sh(Ha),Xf(function(Sa){return!!Sa[1]}),Bn(!1)),ta),ch(mf(Cj(G,a),sh(ta,k,d),Xf(function(Sa){var Za=Sa[1],fb=Sa[3];return Sa[0][1]&&(Sa[2].sizeTree!==Ci||void 0!==fb)&&!Za}),sh(Ha)),function(Sa){var Za=Sa[1];setTimeout(function(){Jk(fa,function(){ta(0,!0)});na(0,Za)})}),{scrolledToInitialItem:ta,initialTopMostItemIndex:Ha}},
Ni(Zq,Nn,kv,Us),{singleton:!0}),KC=Vh(function(a){function d(cc){Sa(0,{index:"LAST",align:"end",behavior:cc})}function k(cc){var oc=Jk(Ha,function(Xb){!cc||Xb.atBottom||"SIZE_INCREASED"!==Xb.notAtBottomBecause||Fb||(ib(4)("scrolling to bottom due to increased size",{},Cl.DEBUG),d("auto"))});setTimeout(oc,100)}var G=a[0],fa=G.totalCount,na=G.listRefresh,ta=a[1];G=ta.isAtBottom;var Ha=ta.atBottomState,Sa=a[2].scrollToIndex;ta=a[3].scrolledToInitialItem;var Za=a[4],fb=Za.propsReady;Za=Za.didMount;var ib=
a[5].log;a=a[6].scrollingInProgress;var Bb=Ef(!1),Ob=vg(),Fb=null;return ch(mf(Cj(mf(nh(fa),Nl(1)),Za),sh(nh(Bb),G,ta,a),ag(function(cc){var oc=cc[0],Xb=oc[0];oc=oc[1]&&cc[3];var hc="auto";oc&&(hc=cc[1],cc=cc[2]||cc[4],hc="function"==typeof hc?Xh(hc(cc)):cc&&Xh(hc),oc=oc&&!!hc);return{totalCount:Xb,shouldFollow:oc,followOutputBehavior:hc}}),Xf(function(cc){return cc.shouldFollow})),function(cc){var oc=cc.totalCount,Xb=cc.followOutputBehavior;Fb&&(Fb(),Fb=null);Fb=Jk(na,function(){ib(4)("following output to ",
{totalCount:oc},Cl.DEBUG);d(Xb);Fb=null})}),ch(mf(Cj(nh(Bb),fa,fb),Xf(function(cc){return cc[0]&&cc[2]}),Lj(function(cc,oc){oc=oc[1];return{refreshed:cc.value===oc,value:oc}},{refreshed:!1,value:0}),Xf(function(cc){return cc.refreshed}),sh(Bb,fa)),function(cc){k(!1!==cc[1])}),ch(Ob,function(){k(!1!==Bb(4))}),ch(Cj(nh(Bb),Ha),function(cc){var oc=cc[1];cc[0]&&!oc.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===oc.notAtBottomBecause&&d("auto")}),{followOutput:Bb,autoscrollToBottom:Ob}},Ni(Zq,lv,kv,Ew,Us,Yq,
Nn)),Sy=Vh(function(a){var d=a[0],k=d.totalCount,G=d.groupIndices;d=d.sizes;var fa=a[1];a=fa.scrollTop;fa=fa.headerHeight;var na=vg(),ta=vg(),Ha=yk(mf(na,ag(bi)));return Gf(mf(Ha,ag(function(Sa){return Sa.totalCount})),k),Gf(mf(Ha,ag(function(Sa){return Sa.groupIndices})),G),Gf(mf(Cj(a,d,fa),Xf(function(Sa){return Sa[1].groupOffsetTree!==Ci}),ag(function(Sa){return ca(Sa[1].groupOffsetTree,Math.max(Sa[0]-Sa[2],0),"v")[0]}),Gh(),ag(function(Sa){return[Sa]})),ta),{groupCounts:na,topItemsIndexes:ta}},
Ni(Zq,Nn)),Ty=Vh(function(a){var d=a[0];a=d.scrollTop;var k=d.viewportHeight,G=d.deviation,fa=d.headerHeight,na=d.fixedHeaderHeight;d=vg();var ta=Ef(0),Ha=Ef(0),Sa=Ef(0);a=pj(mf(Cj(nh(a),nh(k),nh(fa),nh(d,qj),nh(Sa),nh(ta),nh(na),nh(G),nh(Ha)),ag(function(Za){var fb=Za[0],ib=Za[1],Bb=Za[2],Ob=Za[3],Fb=Ob[0];Ob=Ob[1];var cc=Za[4],oc=Za[6],Xb=Za[7],hc=Za[8],ec=fb-Xb;Za=Za[5]+oc;var Ec=Math.max(Bb-ec,0),Ic="none",nd="number"==typeof hc?hc:hc.top||0;hc="number"==typeof hc?hc:hc.bottom||0;return Fb-=Xb,
Ob+=Bb+oc,Fb+(Bb+oc)>fb+Za-nd&&(Ic="up"),Ob-Xb<fb-Ec+ib+hc&&(Ic="down"),"none"!==Ic?[Math.max(ec-Bb-hl(cc,"top",Ic)-nd,0),ec-Ec-oc+ib+hl(cc,"bottom",Ic)+hc]:null}),Xf(function(Za){return null!=Za}),Gh(qj)),[0,0]);return{listBoundary:d,overscan:Sa,topListHeight:ta,increaseViewportBy:Ha,visibleRange:a}},Ni(Nn),{singleton:!0}),LC={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0},bu=Vh(function(a){var d=a[0],k=d.sizes,G=d.totalCount,fa=d.data,
na=d.firstItemIndex,ta=d.gap,Ha=a[1],Sa=a[2],Za=Sa.visibleRange;d=Sa.listBoundary;Sa=Sa.topListHeight;var fb=a[3],ib=fb.scrolledToInitialItem,Bb=fb.initialTopMostItemIndex;fb=a[4].topListHeight;var Ob=a[5],Fb=a[6].didMount,cc=a[7].recalcInProgress;a=Ef([]);var oc=vg();Gf(Ha.topItemsIndexes,a);k=pj(mf(Cj(Fb,cc,nh(Za,qj),nh(G),nh(k),nh(Bb),ib,nh(a),nh(na),nh(ta),fa),Xf(function(Xb){return Xb[0]&&!Xb[1]}),ag(function(Xb){var hc=Xb[2],ec=hc[0],Ec=hc[1];hc=Xb[3];var Ic=Xb[5],nd=Xb[6],Bd=Xb[7],Ee=Xb[8],
Vd=Xb[9],te=Xb[10];Xb=Xb[4];var gf=Xb.sizeTree,Be=Xb.offsetTree;if(0===hc||0===ec&&0===Ec)return Yg({},LC,{totalCount:hc});if(gf===Ci)return Vm(function(hf,Mf,Ig){return Mf.groupOffsetTree!==Ci?(hf=qh(hf,Mf),[{index:ca(Mf.groupOffsetTree,hf)[0],size:0,offset:0},{index:hf,size:0,offset:0,data:Ig&&Ig[0]}]):[{index:hf,size:0,offset:0,data:Ig&&Ig[0]}]}("number"==typeof Ic?Ic:"LAST"===Ic.index?hc-1:Ic.index,Xb,te),[],hc,Vd,Xb,Ee);Ic=[];if(0<Bd.length){var Fe,Fd=Bd[0],bd=Bd[Bd.length-1],Gd=0;for(gf=qm(Lc(gf,
Fd,bd));!(Fe=gf()).done;){var Zc=Fe.value;Fe=Zc.value;var td=Math.min(Zc.end,bd);for(Zc=Math.max(Zc.start,Fd);Zc<=td;Zc++)Ic.push({index:Zc,size:Fe,offset:Gd,data:te&&te[Zc]}),Gd+=Fe}}if(!nd)return Vm([],Ic,hc,Vd,Xb,Ee);var we=0<Bd.length?Bd[Bd.length-1]+1:0,Te=function(hf,Mf,Ig,qf){return void 0===qf&&(qf=0),0<qf&&(Mf=Math.max(Mf,hf[oe(hf,qf,Bg)].offset)),od((dh=Ig,bk=oe(Cg=hf,Mf,Qi=vi),wk=oe(Cg,dh,Qi,bk),Cg.slice(bk,wk+1)),sg);var Cg,dh,Qi,bk,wk}(Be,ec,Ec,we);if(0===Te.length)return null;var vf=
hc-1;return Vm(Mi([],function(hf){for(var Mf,Ig=qm(Te);!(Mf=Ig()).done;){var qf=Mf.value,Cg=qf.value;Mf=Cg.offset;var dh=qf.start,Qi=Cg.size;Cg.offset<ec&&(Cg=(dh+=Math.floor((ec-Cg.offset+Vd)/(Qi+Vd)))-qf.start,Mf+=Cg*Qi+Cg*Vd);dh<we&&(Mf+=(we-dh)*Qi,dh=we);for(qf=Math.min(qf.end,vf);dh<=qf&&!(Mf>=Ec);dh++)hf.push({index:dh,size:Qi,offset:Mf,data:te&&te[dh]}),Mf+=Qi+Vd}}),Ic,hc,Vd,Xb,Ee)}),Xf(function(Xb){return null!==Xb}),Gh()),LC);return Gf(mf(fa,Xf(function(Xb){return void 0!==Xb}),ag(function(Xb){return Xb.length})),
G),Gf(mf(k,ag(function(Xb){return Xb.topListHeight})),fb),Gf(fb,Sa),Gf(mf(k,ag(function(Xb){return[Xb.top,Xb.bottom]})),d),Gf(mf(k,ag(function(Xb){return Xb.items})),oc),Yg({listState:k,topItemsIndexes:a,endReached:yk(mf(k,Xf(function(Xb){return 0<Xb.items.length}),sh(G,fa),Xf(function(Xb){var hc=Xb[0].items;return hc[hc.length-1].originalIndex===Xb[1]-1}),ag(function(Xb){return[Xb[1]-1,Xb[2]]}),Gh(qj),ag(function(Xb){return Xb[0]}))),startReached:yk(mf(k,Xm(200),Xf(function(Xb){var hc=Xb.items;return 0<
hc.length&&hc[0].originalIndex===Xb.topItems.length}),ag(function(Xb){return Xb.items[0].index}),Gh())),rangeChanged:yk(mf(k,Xf(function(Xb){return 0<Xb.items.length}),ag(function(Xb){Xb=Xb.items;for(var hc=0,ec=Xb.length-1;"group"===Xb[hc].type&&hc<ec;)hc++;for(;"group"===Xb[ec].type&&ec>hc;)ec--;return{startIndex:Xb[hc].index,endIndex:Xb[ec].index}}),Gh(zk))),itemsRendered:oc},Ob)},Ni(Zq,Sy,Ty,Ew,kv,lv,Us,Ry),{singleton:!0}),AH=Vh(function(a){var d=a[0],k=d.sizes,G=d.firstItemIndex,fa=d.data;d=
d.gap;var na=a[1].listState;a=a[2].didMount;var ta=Ef(0);return Gf(mf(a,sh(ta),Xf(function(Ha){return 0!==Ha[1]}),sh(k,G,d,fa),ag(function(Ha){var Sa=Ha[0][1],Za=Ha[1],fb=Ha[2],ib=Ha[3];Ha=Ha[4];var Bb=void 0===Ha?[]:Ha;Ha=0;if(0<Za.groupIndices.length)for(var Ob,Fb=qm(Za.groupIndices);!((Ob=Fb()).done||Ob.value-Ha>=Sa);)Ha++;Sa+=Ha;return Vm(Array.from({length:Sa}).map(function(cc,oc){return{index:oc,size:0,offset:0,data:Bb[oc]}}),[],Sa,ib,Za,fb)})),na),{initialItemCount:ta}},Ni(Zq,bu,Us),{singleton:!0}),
tq=Vh(function(a){a=a[0].scrollVelocity;var d=Ef(!1),k=vg(),G=Ef(!1);return Gf(mf(a,sh(G,d,k),Xf(function(fa){return!!fa[1]}),ag(function(fa){var na=fa[0],ta=fa[1],Ha=fa[2];fa=fa[3];var Sa=ta.enter;if(Ha){if((0,ta.exit)(na,fa))return!1}else if(Sa(na,fa))return!0;return Ha}),Gh()),d),ch(mf(Cj(d,a,k),sh(G)),function(fa){var na=fa[0];fa=fa[1];return na[0]&&fa&&fa.change&&fa.change(na[1],na[2])}),{isSeeking:d,scrollSeekConfiguration:G,scrollVelocity:a,scrollSeekRangeChanged:k}},Ni(lv),{singleton:!0}),
Uy=Vh(function(a){a=a[0].topItemsIndexes;var d=Ef(0);return Gf(mf(d,Xf(function(k){return 0<k}),ag(function(k){return Array.from({length:k}).map(function(G,fa){return fa})})),a),{topItemCount:d}},Ni(bu)),cu=Vh(function(a){var d=a[0],k=d.footerHeight,G=d.headerHeight,fa=d.fixedHeaderHeight;d=d.fixedFooterHeight;var na=a[1].listState;a=vg();k=pj(mf(Cj(k,d,G,fa,na),ag(function(ta){var Ha=ta[4];return ta[0]+ta[1]+ta[2]+ta[3]+Ha.offsetBottom+Ha.bottom})),0);return Gf(nh(k),a),{totalListHeight:k,totalListHeightChanged:a}},
Ni(Nn,bu),{singleton:!0}),Fw=tn(function(){return/iP(ad|hone|od).+Version\/[\d.]+.*Safari/i.test(navigator.userAgent)}),Vy=Vh(function(a){function d(oc){0<oc?(G(0,{top:-oc,behavior:"auto"}),na(0,0)):(na(0,0),G(0,{top:-oc,behavior:"auto"}))}var k=a[0],G=k.scrollBy,fa=k.scrollTop,na=k.deviation,ta=k.scrollingInProgress,Ha=a[1];k=Ha.isScrolling;var Sa=Ha.isAtBottom,Za=Ha.scrollDirection,fb=a[3],ib=fb.beforeUnshiftWith,Bb=fb.shiftWithOffset,Ob=fb.sizes;fb=fb.gap;var Fb=a[4].log,cc=a[5].recalcInProgress;
a=yk(mf(a[2].listState,sh(Ha.lastJumpDueToItemResize),Lj(function(oc,Xb){var hc=oc[1],ec=Xb[0],Ec=ec.items,Ic=ec.totalCount;ec=ec.bottom+ec.offsetBottom;var nd=0;return oc[2]===Ic&&0<hc.length&&0<Ec.length&&(0===Ec[0].originalIndex&&0===hc[0].originalIndex||0!=(nd=ec-oc[3])&&(nd+=Xb[1])),[nd,Ec,Ic,ec]},[0,[],0,0]),Xf(function(oc){return 0!==oc[0]}),sh(fa,Za,ta,Sa,Fb),Xf(function(oc){return!oc[3]&&0!==oc[1]&&"up"===oc[2]}),ag(function(oc){var Xb=oc[0][0];return(0,oc[5])("Upward scrolling compensation",
{amount:Xb},Cl.DEBUG),Xb})));return ch(mf(a,sh(na,k)),function(oc){var Xb=oc[0],hc=oc[1];oc[2]&&Fw()?na(0,hc-Xb):d(-Xb)}),ch(mf(Cj(pj(k,!1),na,cc),Xf(function(oc){return!oc[0]&&!oc[2]&&0!==oc[1]}),ag(function(oc){return oc[1]}),Xm(1)),d),Gf(mf(Bb,ag(function(oc){return{top:-oc}})),G),ch(mf(ib,sh(Ob,fb),ag(function(oc){var Xb=oc[0];return Xb*oc[1].lastSize+Xb*oc[2]})),function(oc){na(0,oc);requestAnimationFrame(function(){Op(G,{top:oc});requestAnimationFrame(function(){na(0,0);cc(0,!1)})})}),{deviation:na}},
Ni(Nn,lv,bu,Zq,Yq,Ry)),MC=Vh(function(a){var d=a[0].totalListHeight,k=a[1].didMount,G=a[2].scrollTo;a=Ef(0);return ch(mf(k,sh(a),Xf(function(fa){return 0!==fa[1]}),ag(function(fa){return{top:fa[1]}})),function(fa){Jk(mf(d,Xf(function(na){return 0!==na})),function(){setTimeout(function(){G(0,fa)})})}),{initialScrollTop:a}},Ni(cu,Us,Nn),{singleton:!0}),Wy=Vh(function(a){var d=a[0].viewportHeight;a=a[1].totalListHeight;var k=Ef(!1);return{alignToBottom:k,paddingTopAddition:pj(mf(Cj(k,d,a),Xf(function(G){return G[0]}),
ag(function(G){return Math.max(0,G[1]-G[2])}),Gh()),0)}},Ni(Nn,cu),{singleton:!0}),Gw=Vh(function(a){var d=a[0];a=d.scrollTo;d=d.scrollContainerState;var k=vg(),G=vg(),fa=vg(),na=Ef(!1),ta=Ef(void 0);return Gf(mf(Cj(k,G),ag(function(Ha){var Sa=Ha[0];return{scrollTop:Math.max(0,Sa.scrollTop-Ha[1].offsetTop),scrollHeight:Sa.scrollHeight,viewportHeight:Sa.viewportHeight}})),d),Gf(mf(a,sh(G),ag(function(Ha){var Sa=Ha[0];return Yg({},Sa,{top:Sa.top+Ha[1].offsetTop})})),fa),{useWindowScroll:na,customScrollParent:ta,
windowScrollContainerState:k,windowViewportRect:G,windowScrollTo:fa}},Ni(Nn)),Vs=["done","behavior","align"],Tr=Vh(function(a){var d=a[0],k=d.sizes,G=d.totalCount;d=d.gap;var fa=a[1],na=fa.scrollTop,ta=fa.viewportHeight,Ha=fa.headerHeight,Sa=fa.fixedHeaderHeight,Za=fa.fixedFooterHeight,fb=fa.scrollingInProgress;a=a[2].scrollToIndex;fa=vg();return Gf(mf(fa,sh(k,ta,G,Ha,Sa,Za,na),sh(d),ag(function(ib){var Bb=ib[0],Ob=Bb[0],Fb=Bb[1],cc=Bb[2],oc=Bb[3],Xb=Bb[4],hc=Bb[5],ec=Bb[6];Bb=Bb[7];var Ec=ib[1];
ib=Ob.done;var Ic=Ob.behavior,nd=Ob.align,Bd=pm(Ob,Vs),Ee=null;Ob=di(Ob,Fb,oc-1);Xb=Qh(Ob,Fb.offsetTree,Ec)+Xb+hc;return Xb<Bb+hc?Ee=Yg({},Bd,{behavior:Ic,align:null!=nd?nd:"start"}):Xb+ca(Fb.sizeTree,Ob)[1]>Bb+cc-ec&&(Ee=Yg({},Bd,{behavior:Ic,align:null!=nd?nd:"end"})),Ee?ib&&Jk(mf(fb,Nl(1),Xf(function(Vd){return!1===Vd})),ib):ib&&ib(),Ee}),Xf(function(ib){return null!==ib})),a),{scrollIntoView:fa}},Ni(Zq,Nn,kv,bu,Yq),{singleton:!0}),Xy=["listState","topItemsIndexes"],NC=Vh(function(a){return Yg({},
a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])},Ni(Ty,AH,Us,tq,cu,MC,Wy,Gw,Tr)),du=Vh(function(a){var d=a[0],k=d.totalCount,G=d.sizeRanges,fa=d.fixedItemSize,na=d.defaultItemSize,ta=d.trackItemSizes,Ha=d.itemSize,Sa=d.data,Za=d.firstItemIndex,fb=d.groupIndices,ib=d.statefulTotalCount;d=d.gap;var Bb=a[1],Ob=Bb.initialTopMostItemIndex;Bb=Bb.scrolledToInitialItem;var Fb=a[2],cc=a[3],oc=a[4],Xb=oc.listState,hc=oc.topItemsIndexes;oc=pm(oc,Xy);var ec=a[5].scrollToIndex,Ec=a[7].topItemCount,Ic=a[8].groupCounts,
nd=a[9];a=a[10];return Gf(oc.rangeChanged,nd.scrollSeekRangeChanged),Gf(mf(nd.windowViewportRect,ag(function(Bd){return Bd.visibleHeight})),Fb.viewportHeight),Yg({totalCount:k,data:Sa,firstItemIndex:Za,sizeRanges:G,initialTopMostItemIndex:Ob,scrolledToInitialItem:Bb,topItemsIndexes:hc,topItemCount:Ec,groupCounts:Ic,fixedItemHeight:fa,defaultItemHeight:na,gap:d},cc,{statefulTotalCount:ib,listState:Xb,scrollToIndex:ec,trackItemSizes:ta,itemSize:Ha,groupIndices:fb},oc,nd,Fb,a)},Ni(Zq,Ew,Nn,KC,bu,kv,
Vy,Uy,Sy,NC,Yq)),OC=tn(function(){if("undefined"==typeof document)return"sticky";var a=document.createElement("div");return a.style.position="-webkit-sticky","-webkit-sticky"===a.style.position?"-webkit-sticky":"sticky"}),mv=bh.createContext(void 0),Dp=bh.createContext(void 0),PC=["placeholder"],Yy=["style","children"],QC=["style","children"],RC=Vh(function(){var a=Ef(function(Sa){return"Item "+Sa}),d=Ef(null),k=Ef(function(Sa){return"Group "+Sa}),G=Ef({}),fa=Ef($p),na=Ef("div"),ta=Ef(ei),Ha=function(Sa,
Za){return void 0===Za&&(Za=null),pj(mf(G,ag(function(fb){return fb[Sa]}),Gh()),Za)};return{context:d,itemContent:a,groupContent:k,components:G,computeItemKey:fa,headerFooterTag:na,scrollerRef:ta,FooterComponent:Ha("Footer"),HeaderComponent:Ha("Header"),TopItemListComponent:Ha("TopItemList"),ListComponent:Ha("List","div"),ItemComponent:Ha("Item","div"),GroupComponent:Ha("Group","div"),ScrollerComponent:Ha("Scroller","div"),EmptyPlaceholder:Ha("EmptyPlaceholder"),ScrollSeekPlaceholder:Ha("ScrollSeekPlaceholder")}}),
Hw=Vh(function(a){function d(fa,na,ta){Gf(mf(fa,sh(G.components),ag(function(Ha){var Sa,Za=Ha[0];Ha=Ha[1];return console.warn("react-virtuoso: "+ta+" property is deprecated. Pass components."+na+" instead."),Yg({},Ha,((Sa={})[na]=Za,Sa))})),G.components)}var k=a[0],G=a[1];a={item:Ak(G.itemContent,"Rename the %citem%c prop to %citemContent."),group:Ak(G.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:Ak(k.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:Ak(k.fixedItemHeight,
"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:Ak(k.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:vg(),maxHeightCacheSize:vg(),footer:vg(),header:vg(),HeaderContainer:vg(),FooterContainer:vg(),ItemContainer:vg(),ScrollContainer:vg(),GroupContainer:vg(),ListContainer:vg(),emptyComponent:vg(),scrollSeek:vg()};return ch(a.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.",
"color: red;","color: inherit;","color: blue;")}),ch(a.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),ch(a.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.")}),ch(a.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.")}),
ch(a.scrollSeek,function(fa){var na=fa.placeholder;fa=pm(fa,PC);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead.");na=Yg({},(0,G.components)(4),{ScrollSeekPlaceholder:na});(0,G.components)(0,na);(0,k.scrollSeekConfiguration)(0,fa)}),d(a.footer,"Footer","footer"),d(a.header,"Header","header"),d(a.ItemContainer,"Item","ItemContainer"),d(a.ListContainer,"List","ListContainer"),d(a.ScrollContainer,
"Scroller","ScrollContainer"),d(a.emptyComponent,"EmptyPlaceholder","emptyComponent"),d(a.GroupContainer,"Group","GroupContainer"),Yg({},k,G,a)},Ni(du,RC)),SC=function(a){return bh.createElement("div",{style:{height:a.height}})},On={position:OC(),zIndex:1,overflowAnchor:"none"},BH={overflowAnchor:"none"},eu=bh.memo(function(a){a=a.showTopList;a=void 0!==a&&a;var d=Yh("listState"),k=bo("sizeRanges"),G=Yh("useWindowScroll"),fa=Yh("customScrollParent"),na=bo("windowScrollContainerState"),ta=bo("scrollContainerState");
G=fa||G?na:ta;var Ha=Yh("itemContent"),Sa=Yh("context"),Za=Yh("groupContent");na=Yh("trackItemSizes");ta=Yh("itemSize");var fb=Yh("log"),ib=bo("gap");k=zi(k,ta,na,a?ei:G,fb,ib,fa).callbackRef;fa=bh.useState(0);var Bb=fa[0],Ob=fa[1];Li("deviation",function(Ec){Bb!==Ec&&Ob(Ec)});fa=Yh("EmptyPlaceholder");var Fb=Yh("ScrollSeekPlaceholder")||SC;G=Yh("ListComponent");var cc=Yh("ItemComponent"),oc=Yh("GroupComponent"),Xb=Yh("computeItemKey"),hc=Yh("isSeeking"),ec=0<Yh("groupIndices").length;na=Yh("paddingTopAddition");
na=a?{}:{boxSizing:"border-box",paddingTop:d.offsetTop+na,paddingBottom:d.offsetBottom,marginTop:Bb};return!a&&0===d.totalCount&&fa?(0,Bh.createElement)(fa,wj(fa,Sa)):(0,Bh.createElement)(G,Yg({},wj(G,Sa),{ref:k,style:na,"data-test-id":a?"virtuoso-top-item-list":"virtuoso-item-list"}),(a?d.topItems:d.items).map(function(Ec){var Ic=Ec.originalIndex,nd=Xb(Ic+d.firstItemIndex,Ec.data,Sa);return hc?(0,Bh.createElement)(Fb,Yg({},wj(Fb,Sa),{key:nd,index:Ec.index,height:Ec.size,type:Ec.type||"item"},"group"===
Ec.type?{}:{groupIndex:Ec.groupIndex})):"group"===Ec.type?(0,Bh.createElement)(oc,Yg({},wj(oc,Sa),{key:nd,"data-index":Ic,"data-known-size":Ec.size,"data-item-index":Ec.index,style:On}),Za(Ec.index)):(0,Bh.createElement)(cc,Yg({},wj(cc,Sa),{key:nd,"data-index":Ic,"data-known-size":Ec.size,"data-item-index":Ec.index,"data-item-group-index":Ec.groupIndex,style:BH}),ec?Ha(Ec.index,Ec.groupIndex,Ec.data,Sa):Ha(Ec.index,Ec.data,Sa))}))}),CH={height:"100%",outline:"none",overflowY:"auto",position:"relative",
WebkitOverflowScrolling:"touch"},fu={width:"100%",height:"100%",position:"absolute",top:0},TC={width:"100%",position:OC(),top:0},Iw=bh.memo(function(){var a=Yh("HeaderComponent"),d=bo("headerHeight"),k=Yh("headerFooterTag"),G=cj(function(na){return d(oi(na,"height"))}),fa=Yh("context");return a?(0,Bh.createElement)(k,{ref:G},(0,Bh.createElement)(a,wj(a,fa))):null}),Jw=bh.memo(function(){var a=Yh("FooterComponent"),d=bo("footerHeight"),k=Yh("headerFooterTag"),G=cj(function(na){return d(oi(na,"height"))}),
fa=Yh("context");return a?(0,Bh.createElement)(k,{ref:G},(0,Bh.createElement)(a,wj(a,fa))):null}),DH=function(a){a=a.children;var d=(0,Bh.useContext)(mv),k=bo("viewportHeight"),G=bo("fixedItemHeight"),fa=cj(Km(k,function(na){return oi(na,"height")}));return bh.useEffect(function(){d&&(k(d.viewportHeight),G(d.itemHeight))},[d,k,G]),bh.createElement("div",{style:fu,ref:fa,"data-viewport-type":"element"},a)},UC=function(a){a=a.children;var d=(0,Bh.useContext)(mv),k=bo("windowViewportRect"),G=bo("fixedItemHeight"),
fa=Yh("customScrollParent");fa=kh(k,fa);return bh.useEffect(function(){d&&(G(d.itemHeight),k({offsetTop:0,visibleHeight:d.viewportHeight,visibleWidth:100}))},[d,k,G]),bh.createElement("div",{ref:fa,style:fu,"data-viewport-type":"window"},a)},VC=function(a){a=a.children;var d=Yh("TopItemListComponent"),k=Yh("headerHeight");k=Yg({},TC,{marginTop:k+"px"});var G=Yh("context");return(0,Bh.createElement)(d||"div",{style:k,context:G},a)},nv=Dj(Hw,{required:{},optional:{context:"context",followOutput:"followOutput",
firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",
headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",
ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",
startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},bh.memo(function(a){var d=Yh("useWindowScroll"),k=0<Yh("topItemsIndexes").length,G=Yh("customScrollParent"),fa=G||d?UC:DH;return bh.createElement(G||d?ov:Ur,Yg({},a),bh.createElement(fa,null,bh.createElement(Iw,null),bh.createElement(eu,null),bh.createElement(Jw,
null)),k&&bh.createElement(VC,null,bh.createElement(eu,{showTopList:!0})))})),Zy=nv.Component,bo=nv.usePublisher,Yh=nv.useEmitterValue,Li=nv.useEmitter,Ur=qo({usePublisher:bo,useEmitterValue:Yh,useEmitter:Li}),ov=Rp({usePublisher:bo,useEmitterValue:Yh,useEmitter:Li}),pv={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},co={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},$y=Math.round,Kw=Math.ceil,qv=Math.floor,az=Math.min,Hi=Math.max,
gu=Vh(function(a){var d=a[0],k=d.overscan,G=d.visibleRange,fa=d.listBoundary,na=a[1];d=na.scrollTop;var ta=na.viewportHeight,Ha=na.scrollBy,Sa=na.scrollTo,Za=na.smoothScrollTargetReached,fb=na.scrollContainerState,ib=na.footerHeight;na=na.headerHeight;var Bb=a[2],Ob=a[3],Fb=a[4],cc=Fb.propsReady,oc=Fb.didMount,Xb=a[5];Fb=Xb.windowViewportRect;var hc=Xb.windowScrollTo,ec=Xb.useWindowScroll,Ec=Xb.customScrollParent;Xb=Xb.windowScrollContainerState;a=a[6];var Ic=Ef(0),nd=Ef(0),Bd=Ef(pv),Ee=Ef({height:0,
width:0}),Vd=Ef({height:0,width:0}),te=vg(),gf=vg(),Be=Ef(0),Fe=Ef(void 0),Fd=Ef({row:0,column:0});Gf(mf(Cj(oc,nd,Fe),Xf(function(bd){return 0!==bd[1]}),ag(function(bd){return{items:Sp(0,bd[1]-1,bd[2]),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),Bd);Gf(mf(Cj(nh(Ic),G,nh(Fd,Cn),nh(Vd,function(bd,Gd){return bd&&bd.width===Gd.width&&bd.height===Gd.height}),Fe),sh(Ee),ag(function(bd){var Gd=bd[0],Zc=Gd[0],td=Gd[1],we=td[0],Te=td[1],vf=Gd[2],hf=Gd[3],Mf=Gd[4],Ig=bd[1];bd=vf.row;
var qf=vf.column;Gd=hf.height;td=hf.width;var Cg=Ig.width;if(0===Zc||0===Cg)return pv;if(0===td)return Yg({},co,{items:Sp(0,0,Mf)});qf=Hi(1,qv((Cg+qf)/(td+qf)));we=qf*qv((we+bd)/(Gd+bd));Te=qf*Kw((Te+bd)/(Gd+bd))-1;Te=az(Zc-1,Hi(Te,qf-1));we=Sp(az(Te,Hi(0,we)),Te,Mf);hf=ro(Ig,vf,hf,we);vf=hf.top;hf=hf.bottom;Zc=Kw(Zc/qf);return{items:we,offsetTop:vf,offsetBottom:Zc*Gd+(Zc-1)*bd-hf,top:vf,bottom:hf,itemHeight:Gd,itemWidth:td}})),Bd);Gf(mf(Fe,Xf(function(bd){return void 0!==bd}),ag(function(bd){return bd.length})),
Ic);Gf(mf(Ee,ag(function(bd){return bd.height})),ta);Gf(mf(Cj(Ee,Vd,Bd,Fd),ag(function(bd){bd=ro(bd[0],bd[3],bd[1],bd[2].items);return[bd.top,bd.bottom]}),Gh(qj)),fa);G=yk(mf(nh(Bd),Xf(function(bd){return 0<bd.items.length}),sh(Ic),Xf(function(bd){var Gd=bd[0].items;return Gd[Gd.length-1].index===bd[1]-1}),ag(function(bd){return bd[1]-1}),Gh()));fa=yk(mf(nh(Bd),Xf(function(bd){bd=bd.items;return 0<bd.length&&0===bd[0].index}),Bn(0),Gh()));ta=yk(mf(nh(Bd),Xf(function(bd){return 0<bd.items.length}),
ag(function(bd){bd=bd.items;return{startIndex:bd[0].index,endIndex:bd[bd.length-1].index}}),Gh(zk)));Gf(ta,Ob.scrollSeekRangeChanged);Gf(mf(te,sh(Ee,Vd,Ic,Fd),ag(function(bd){var Gd=bd[1],Zc=bd[2],td=bd[3],we=bd[4],Te=Wh(bd[0]);bd=Te.align;var vf=Te.behavior,hf=Te.offset;Te=Te.index;"LAST"===Te&&(Te=td-1);td=Wk(Gd,we,Zc,Hi(0,Te,az(td-1,Te)));return"end"===bd?td=$y(td-Gd.height+Zc.height):"center"===bd&&(td=$y(td-Gd.height/2+Zc.height/2)),hf&&(td+=hf),{top:td,behavior:vf}})),Sa);oc=pj(mf(Bd,ag(function(bd){return bd.offsetBottom+
bd.bottom})),0);return Gf(mf(Fb,ag(function(bd){return{width:bd.visibleWidth,height:bd.visibleHeight}})),Ee),Yg({data:Fe,totalCount:Ic,viewportDimensions:Ee,itemDimensions:Vd,scrollTop:d,scrollHeight:gf,overscan:k,scrollBy:Ha,scrollTo:Sa,scrollToIndex:te,smoothScrollTargetReached:Za,windowViewportRect:Fb,windowScrollTo:hc,useWindowScroll:ec,customScrollParent:Ec,windowScrollContainerState:Xb,deviation:Be,scrollContainerState:fb,footerHeight:ib,headerHeight:na,initialItemCount:nd,gap:Fd},Ob,{gridState:Bd,
totalListHeight:oc},Bb,{startReached:fa,endReached:G,rangeChanged:ta,propsReady:cc},a)},Ni(Ty,Nn,lv,tq,Us,Gw,Yq)),rv=["placeholder"],EH=Vh(function(){var a=Ef(function(Za){return"Item "+Za}),d=Ef({}),k=Ef(null),G=Ef("virtuoso-grid-item"),fa=Ef("virtuoso-grid-list"),na=Ef($p),ta=Ef("div"),Ha=Ef(ei),Sa=function(Za,fb){return void 0===fb&&(fb=null),pj(mf(d,ag(function(ib){return ib[Za]}),Gh()),fb)};return{context:k,itemContent:a,components:d,computeItemKey:na,itemClassName:G,listClassName:fa,headerFooterTag:ta,
scrollerRef:Ha,FooterComponent:Sa("Footer"),HeaderComponent:Sa("Header"),ListComponent:Sa("List","div"),ItemComponent:Sa("Item","div"),ScrollerComponent:Sa("Scroller","div"),ScrollSeekPlaceholder:Sa("ScrollSeekPlaceholder","div")}}),Wj=Vh(function(a){function d(fa,na,ta){Gf(mf(fa,sh(G.components),ag(function(Ha){var Sa,Za=Ha[0];Ha=Ha[1];return console.warn("react-virtuoso: "+ta+" property is deprecated. Pass components."+na+" instead."),Yg({},Ha,((Sa={})[na]=Za,Sa))})),G.components)}var k=a[0],G=
a[1];a={item:Ak(G.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:vg(),ScrollContainer:vg(),ListContainer:vg(),emptyComponent:vg(),scrollSeek:vg()};return ch(a.scrollSeek,function(fa){var na=fa.placeholder;fa=pm(fa,rv);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead.");na=Yg({},(0,G.components)(4),{ScrollSeekPlaceholder:na});(0,G.components)(0,na);(0,k.scrollSeekConfiguration)(0,
fa)}),d(a.ItemContainer,"Item","ItemContainer"),d(a.ListContainer,"List","ListContainer"),d(a.ScrollContainer,"Scroller","ScrollContainer"),Yg({},k,G,a)},Ni(gu,EH)),Ws=bh.memo(function(){var a=Xj("gridState"),d=Xj("listClassName"),k=Xj("itemClassName"),G=Xj("itemContent"),fa=Xj("computeItemKey"),na=Xj("isSeeking"),ta=dn("scrollHeight"),Ha=Xj("ItemComponent"),Sa=Xj("ListComponent"),Za=Xj("ScrollSeekPlaceholder"),fb=Xj("context"),ib=dn("itemDimensions"),Bb=dn("gap"),Ob=Xj("log"),Fb=cj(function(cc){ta(cc.parentElement.parentElement.scrollHeight);
var oc=cc.firstChild;oc&&ib(oc.getBoundingClientRect());Bb({row:Yl("row-gap",getComputedStyle(cc).rowGap,Ob),column:Yl("column-gap",getComputedStyle(cc).columnGap,Ob)})});return(0,Bh.createElement)(Sa,Yg({ref:Fb,className:d},wj(Sa,fb),{style:{paddingTop:a.offsetTop,paddingBottom:a.offsetBottom}}),a.items.map(function(cc){var oc=fa(cc.index,cc.data,fb);return na?(0,Bh.createElement)(Za,Yg({key:oc},wj(Za,fb),{index:cc.index,height:a.itemHeight,width:a.itemWidth})):(0,Bh.createElement)(Ha,Yg({},wj(Ha,
fb),{className:k,"data-index":cc.index,key:oc}),G(cc.index,cc.data,fb))}))}),WC=bh.memo(function(){var a=Xj("HeaderComponent"),d=dn("headerHeight"),k=Xj("headerFooterTag"),G=cj(function(na){return d(oi(na,"height"))}),fa=Xj("context");return a?(0,Bh.createElement)(k,{ref:G},(0,Bh.createElement)(a,wj(a,fa))):null}),XC=bh.memo(function(){var a=Xj("FooterComponent"),d=dn("footerHeight"),k=Xj("headerFooterTag"),G=cj(function(na){return d(oi(na,"height"))}),fa=Xj("context");return a?(0,Bh.createElement)(k,
{ref:G},(0,Bh.createElement)(a,wj(a,fa))):null}),Ng=function(a){a=a.children;var d=(0,Bh.useContext)(Dp),k=dn("itemDimensions"),G=dn("viewportDimensions"),fa=cj(function(na){G(na.getBoundingClientRect())});return bh.useEffect(function(){d&&(G({height:d.viewportHeight,width:d.viewportWidth}),k({height:d.itemHeight,width:d.itemWidth}))},[d,G,k]),bh.createElement("div",{style:fu,ref:fa},a)},Lw=function(a){a=a.children;var d=(0,Bh.useContext)(Dp),k=dn("windowViewportRect"),G=dn("itemDimensions"),fa=Xj("customScrollParent");
fa=kh(k,fa);return bh.useEffect(function(){d&&(G({height:d.itemHeight,width:d.itemWidth}),k({offsetTop:0,visibleHeight:d.viewportHeight,visibleWidth:d.viewportWidth}))},[d,k,G]),bh.createElement("div",{ref:fa,style:fu},a)},eo=Dj(Wj,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",
listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",
atTopStateChange:"atTopStateChange"}},bh.memo(function(a){a=Yg({},a);var d=Xj("useWindowScroll"),k=Xj("customScrollParent"),G=k||d?Lw:Ng;return bh.createElement(k||d?hu:YC,Yg({},a),bh.createElement(G,null,bh.createElement(WC,null),bh.createElement(Ws,null),bh.createElement(XC,null)))})),dn=eo.usePublisher,Xj=eo.useEmitterValue,Mw=eo.useEmitter,YC=qo({usePublisher:dn,useEmitterValue:Xj,useEmitter:Mw}),hu=Rp({usePublisher:dn,useEmitterValue:Xj,useEmitter:Mw}),Nw=Vh(function(){var a=Ef(function(Sa){return bh.createElement("td",
null,"Item $",Sa)}),d=Ef(null),k=Ef(null),G=Ef(null),fa=Ef({}),na=Ef($p),ta=Ef(ei),Ha=function(Sa,Za){return void 0===Za&&(Za=null),pj(mf(fa,ag(function(fb){return fb[Sa]}),Gh()),Za)};return{context:d,itemContent:a,fixedHeaderContent:k,fixedFooterContent:G,components:fa,computeItemKey:na,scrollerRef:ta,TableComponent:Ha("Table","table"),TableHeadComponent:Ha("TableHead","thead"),TableFooterComponent:Ha("TableFoot","tfoot"),TableBodyComponent:Ha("TableBody","tbody"),TableRowComponent:Ha("TableRow",
"tr"),ScrollerComponent:Ha("Scroller","div"),EmptyPlaceholder:Ha("EmptyPlaceholder"),ScrollSeekPlaceholder:Ha("ScrollSeekPlaceholder"),FillerRow:Ha("FillerRow")}}),iu=Vh(function(a){return Yg({},a[0],a[1])},Ni(du,Nw)),ZC=function(a){return bh.createElement("tr",null,bh.createElement("td",{style:{height:a.height}}))},$C=function(a){return bh.createElement("tr",null,bh.createElement("td",{style:{height:a.height,padding:0,border:0}}))},Pn=bh.memo(function(){var a=oj("listState"),d=kp("sizeRanges"),k=
oj("useWindowScroll"),G=oj("customScrollParent"),fa=kp("windowScrollContainerState"),na=kp("scrollContainerState");k=G||k?fa:na;var ta=oj("itemContent");fa=oj("trackItemSizes");G=zi(d,oj("itemSize"),fa,k,oj("log"),void 0,G);d=G.callbackRef;var Ha=G.ref;G=bh.useState(0);var Sa=G[0],Za=G[1];Pw("deviation",function(Xb){Sa!==Xb&&(Ha.current.style.marginTop=Xb+"px",Za(Xb))});fa=oj("EmptyPlaceholder");var fb=oj("ScrollSeekPlaceholder")||ZC;k=oj("FillerRow")||$C;G=oj("TableBodyComponent");var ib=oj("TableRowComponent"),
Bb=oj("computeItemKey"),Ob=oj("isSeeking");na=oj("paddingTopAddition");var Fb=oj("firstItemIndex"),cc=oj("statefulTotalCount"),oc=oj("context");if(0===cc&&fa)return(0,Bh.createElement)(fa,wj(fa,oc));fa=a.offsetTop+na+Sa;na=a.offsetBottom;fa=0<fa?bh.createElement(k,{height:fa,key:"padding-top"}):null;k=0<na?bh.createElement(k,{height:na,key:"padding-bottom"}):null;a=a.items.map(function(Xb){var hc=Xb.originalIndex,ec=Bb(hc+Fb,Xb.data,oc);return Ob?(0,Bh.createElement)(fb,Yg({},wj(fb,oc),{key:ec,index:Xb.index,
height:Xb.size,type:Xb.type||"item"})):(0,Bh.createElement)(ib,Yg({},wj(ib,oc),{key:ec,"data-index":hc,"data-known-size":Xb.size,"data-item-index":Xb.index,style:{overflowAnchor:"none"}}),ta(Xb.index,Xb.data,oc))});return(0,Bh.createElement)(G,Yg({ref:d,"data-test-id":"virtuoso-item-list"},wj(G,oc)),[fa].concat(a,[k]))}),Ow=function(a){a=a.children;var d=(0,Bh.useContext)(mv),k=kp("viewportHeight"),G=kp("fixedItemHeight"),fa=cj(Km(k,function(na){return oi(na,"height")}));return bh.useEffect(function(){d&&
(k(d.viewportHeight),G(d.itemHeight))},[d,k,G]),bh.createElement("div",{style:fu,ref:fa,"data-viewport-type":"element"},a)},bz=function(a){a=a.children;var d=(0,Bh.useContext)(mv),k=kp("windowViewportRect"),G=kp("fixedItemHeight"),fa=oj("customScrollParent");fa=kh(k,fa);return bh.useEffect(function(){d&&(G(d.itemHeight),k({offsetTop:0,visibleHeight:d.viewportHeight,visibleWidth:100}))},[d,k,G]),bh.createElement("div",{ref:fa,style:fu,"data-viewport-type":"window"},a)},sv=Dj(iu,{required:{},optional:{context:"context",
followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",fixedFooterContent:"fixedFooterContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",
fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},
events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},bh.memo(function(a){var d=oj("useWindowScroll"),k=oj("customScrollParent"),G=kp("fixedHeaderHeight"),fa=kp("fixedFooterHeight"),na=oj("fixedHeaderContent"),ta=oj("fixedFooterContent"),Ha=oj("context");
G=cj(Km(G,function(ib){return oi(ib,"height")}));var Sa=cj(Km(fa,function(ib){return oi(ib,"height")}));fa=k||d?aD:FH;d=k||d?bz:Ow;k=oj("TableComponent");var Za=oj("TableHeadComponent"),fb=oj("TableFooterComponent");na=na?bh.createElement(Za,Yg({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:G},wj(Za,Ha)),na()):null;ta=ta?bh.createElement(fb,Yg({key:"TableFoot",style:{zIndex:1,position:"sticky",bottom:0},ref:Sa},wj(fb,Ha)),ta()):null;return bh.createElement(fa,Yg({},a),bh.createElement(d,
null,bh.createElement(k,Yg({style:{borderSpacing:0}},wj(k,Ha)),[na,bh.createElement(Pn,{key:"TableBody"}),ta])))})),kp=sv.usePublisher,oj=sv.useEmitterValue,Pw=sv.useEmitter,FH=qo({usePublisher:kp,useEmitterValue:oj,useEmitter:Pw}),aD=Rp({usePublisher:kp,useEmitterValue:oj,useEmitter:Pw}),ju=$e(ba(22)),en=function(a){function d(k){k=a.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+k+" for more information.")||this;if(void 0===
k)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k}Yp(d,a);return d}(Dq(Error)),Qw={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",
darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",
floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",
lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",
mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",
sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},bD=/^#[a-fA-F0-9]{6}$/,cD=/^#[a-fA-F0-9]{8}$/,cz=/^#[a-fA-F0-9]{3}$/,No=/^#[a-fA-F0-9]{4}$/,Xs=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,
km=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,Rw=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,tv=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,fo=function(a){return 7===a.length&&a[1]===a[2]&&a[3]===a[4]&&a[5]===a[6]?"#"+a[1]+a[3]+a[5]:a},bj=jr(kr,kr.length,[]),ku=
ba(598),Em=$e(ba(22)),go=class{static insertTextFirefox(a,d){a.setRangeText(d,a.selectionStart||0,a.selectionEnd||0,"end");a.dispatchEvent(new InputEvent("input",{data:d,inputType:"insertText",isComposing:!1}))}static insert(a,d){const k=a.ownerDocument,G=k.activeElement;G!==a&&a.focus();k.execCommand("insertText",!1,d)||go.insertTextFirefox(a,d);G===k.body?a.blur():G instanceof HTMLElement&&G!==a&&G.focus()}static set(a,d){a.select();go.insert(a,d)}static getSelection(a){const {selectionStart:d,
selectionEnd:k}=a;return a.value.slice(d?d:void 0,k?k:void 0)}static wrapSelection(a,d,k){const {selectionStart:G,selectionEnd:fa}=a,na=go.getSelection(a);go.insert(a,d+na+(null!=k?k:d));a.selectionStart=(G||0)+d.length;a.selectionEnd=(fa||0)+d.length}static replace(a,d,k){let G=0;a.value.replace(d,(...fa)=>{const na=G+fa[fa.length-2],ta=fa[0].length;a.selectionStart=na;a.selectionEnd=na+ta;fa="string"===typeof k?k:k(...fa);go.insert(a,fa);a.selectionStart=na;G+=fa.length-ta;return fa})}static findLineEnd(a,
d){const k=a.lastIndexOf("\n",d-1)+1;return"\t"!==a.charAt(k)?d:k+1}static indent(a){var d;const {selectionStart:k,selectionEnd:G,value:fa}=a;var na=fa.slice(k,G);if((na=null==(d=/\n/g.exec(na))?void 0:d.length)&&0<na){d=fa.lastIndexOf("\n",k-1)+1;var ta=a.value.slice(d,G-1);na=ta.replace(/^|\n/g,"$\x26 ");ta=na.length-ta.length;a.setSelectionRange(d,G-1);go.insert(a,na);a.setSelectionRange(k+1,G+ta)}else go.insert(a," ")}static unindent(a){const {selectionStart:d,selectionEnd:k,value:G}=a;var fa=
G.lastIndexOf("\n",d-1)+1;const na=go.findLineEnd(G,k);var ta=a.value.slice(fa,na);const Ha=ta.replace(/(^|\n)(\t| {1,2})/g,"$1");ta=ta.length-Ha.length;a.setSelectionRange(fa,na);go.insert(a,Ha);fa=(fa=/\t| {1,2}/.exec(G.slice(fa,d)))?fa[0].length:0;a.setSelectionRange(d-fa,Math.max(d-fa,k-ta))}},Sw=ba(598),lu=a=>a.stopPropagation(),mu=Em.memo(function({font:a,text:d,color:k,fontStyle:G,fontSize:fa,fontWeight:na,offsetX:ta=0,offsetY:Ha=0,scale:Sa=1,isEditing:Za=!1,pointerEvents:fb=!1,onBlur:ib,onChange:Bb}){const Ob=
Em.useRef(null),Fb=Em.useRef(!1),cc=Em.useCallback(Ic=>{Bb(It.normalizeText(Ic.currentTarget.value))},[Bb]),oc=Em.useCallback(Ic=>{if("Escape"!==Ic.key)if("Tab"===Ic.key&&0===d.length)Ic.preventDefault();else{if("Meta"!==Ic.key&&!Ic.metaKey)Ic.stopPropagation();else if("z"===Ic.key&&Ic.metaKey){document.execCommand(Ic.shiftKey?"redo":"undo",!1);Ic.stopPropagation();Ic.preventDefault();return}"Tab"===Ic.key&&(Ic.preventDefault(),Ic.shiftKey?go.unindent(Ic.currentTarget):go.indent(Ic.currentTarget),
null==Bb?void 0:Bb(It.normalizeText(Ic.currentTarget.value)))}},[Bb]),Xb=Em.useCallback(Ic=>{Za&&(Ic.currentTarget.setSelectionRange(0,0),null==ib?void 0:ib())},[ib]),hc=Em.useCallback(Ic=>{Za&&Fb.current&&document.activeElement===Ic.currentTarget&&Ic.currentTarget.select()},[Za]),ec=Em.useCallback(Ic=>{Za&&Ic.stopPropagation()},[Za]);Em.useEffect(()=>{Za&&requestAnimationFrame(()=>{Fb.current=!0;const Ic=Ob.current;Ic&&(Ic.focus(),Ic.select())})},[Za,ib]);const Ec=Em.useRef(null);Em.useLayoutEffect(()=>
{const Ic=Ec.current;if(Ic){var nd=yj(d||"Enter text",{fontFamily:"var(--ls-font-family)",fontSize:fa,lineHeight:1,fontWeight:na},4);Ic.style.transform=`scale(${Sa}, ${Sa}) translate(${ta}px, ${Ha}px)`;Ic.style.width=nd[0]+1+"px";Ic.style.height=nd[1]+1+"px"}},[d,na,fa,Ha,ta,Sa]);return(0,Sw.jsx)("div",{className:"tl-text-label-wrapper",children:(0,Sw.jsxs)("div",{className:"tl-text-label-inner-wrapper",ref:Ec,style:{font:a,fontStyle:G,fontSize:fa,fontWeight:na,color:k,pointerEvents:fb?"all":"none",
userSelect:Za?"text":"none"},children:[Za?(0,Sw.jsx)("textarea",{ref:Ob,style:{font:a,color:k,fontStyle:G,fontSize:fa,fontWeight:na},className:"tl-text-label-textarea",name:"text",tabIndex:-1,autoComplete:"false",autoCapitalize:"false",autoCorrect:"false",autoSave:"false",autoFocus:!0,placeholder:"Enter text",spellCheck:"true",wrap:"off",dir:"auto",datatype:"wysiwyg",defaultValue:d,color:k,onFocus:hc,onChange:cc,onKeyDown:oc,onBlur:Xb,onPointerDown:ec,onContextMenu:lu,onCopy:lu,onPaste:lu,onCut:lu}):
d,""]})})}),lp=ba(598),ho={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},Qn=class extends vn{constructor(){super(...arguments);gb(this,"canEdit",!0);gb(this,"ReactComponent",Ze(({events:a,isErasing:d,isBinding:k,isSelected:G,isEditing:fa,onEditingEnd:na})=>{const {props:{size:[ta,Ha],stroke:Sa,fill:Za,noFill:fb,strokeWidth:ib,strokeType:Bb,borderRadius:Ob,opacity:Fb,label:cc,italic:oc,fontWeight:Xb,fontSize:hc}}=this;var ec=cc||fa?yj(cc,{fontFamily:"var(--ls-font-family)",fontSize:hc,lineHeight:1,fontWeight:Xb},
4):[0,0];const Ec=Pd.mul(this.props.size,.5);ec=Math.max(.5,Math.min(1,ta/ec[0],Ha/ec[1]));const Ic=this.getBounds(),nd=ju.useMemo(()=>Pd.sub(Ec,Pd.toFixed([Ic.width/2,Ic.height/2])),[Ic,ec,Ec]),Bd=ju.useCallback(Ee=>{var Vd;null==(Vd=this.update)?void 0:Vd.call(this,{label:Ee})},[cc]);return(0,lp.jsxs)("div",Re(Ud({},a),{style:{width:"100%",height:"100%",overflow:"hidden"},className:"tl-box-container",children:[(0,lp.jsx)(mu,{font:"20px / 1 var(--ls-font-family)",text:cc,color:th(Sa,"text"),offsetX:nd[0],
offsetY:nd[1],fontSize:hc,scale:ec,isEditing:fa,onChange:Bd,onBlur:na,fontStyle:oc?"italic":"normal",fontWeight:Xb,pointerEvents:!!cc}),(0,lp.jsxs)(fp,{opacity:d?.2:Fb,children:[k&&(0,lp.jsx)(js,{mode:"svg",strokeWidth:ib,size:[ta,Ha]}),(0,lp.jsx)("rect",{className:G||!fb?"tl-hitarea-fill":"tl-hitarea-stroke",x:ib/2,y:ib/2,rx:Ob,ry:Ob,width:Math.max(.01,ta-ib),height:Math.max(.01,Ha-ib),pointerEvents:"all"}),(0,lp.jsx)("rect",{x:ib/2,y:ib/2,rx:Ob,ry:Ob,width:Math.max(.01,ta-ib),height:Math.max(.01,
Ha-ib),strokeWidth:ib,stroke:th(Sa,"stroke"),strokeDasharray:"dashed"===Bb?"8 2":void 0,fill:fb?"none":th(Za,"background")})]})]}))}));gb(this,"setScaleLevel",a=>Nh(this,null,function*(){this.update({scaleLevel:a,fontSize:ho[null!=a?a:"md"],strokeWidth:ho[null!=a?a:"md"]/10});this.onResetBounds()}));gb(this,"ReactIndicator",Ze(()=>{const {props:{size:[a,d],borderRadius:k,isLocked:G}}=this;return(0,lp.jsx)("g",{children:(0,lp.jsx)("rect",{width:a,height:d,rx:k,ry:k,fill:"transparent",strokeDasharray:G?
"8 2":void 0})})}));gb(this,"validateProps",a=>{void 0!==a.size&&(a.size[0]=Math.max(a.size[0],1),a.size[1]=Math.max(a.size[1],1));void 0!==a.borderRadius&&(a.borderRadius=Math.max(0,a.borderRadius));return Um(this,a)})}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}};gb(Qn,"id","box");gb(Qn,"defaultProps",{id:"box",parentId:"page",type:"box",point:[0,0],size:[100,100],borderRadius:2,stroke:"",fill:"",noFill:!1,fontWeight:400,fontSize:20,italic:!1,strokeType:"line",strokeWidth:2,
opacity:1,label:""});Nd([kf],Qn.prototype,"scaleLevel",1);Nd([hg],Qn.prototype,"setScaleLevel",2);var Tw=$e(ba(22)),mp=ba(598),uv={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},Ys=class extends wx{constructor(){super(...arguments);gb(this,"canEdit",!0);gb(this,"ReactComponent",Ze(({isSelected:a,isErasing:d,events:k,isEditing:G,onEditingEnd:fa})=>{const {size:[na,ta],stroke:Ha,fill:Sa,noFill:Za,strokeWidth:fb,strokeType:ib,opacity:Bb,label:Ob,italic:Fb,fontWeight:cc,fontSize:oc}=this.props;var Xb=Ob||G?yj(Ob,
{fontFamily:"var(--ls-font-family)",fontSize:oc,lineHeight:1,fontWeight:cc},4):[0,0];const hc=Pd.mul(this.props.size,.5);Xb=Math.max(.5,Math.min(1,na/Xb[0],ta/Xb[1]));const ec=this.getBounds(),Ec=Tw.useMemo(()=>Pd.sub(hc,Pd.toFixed([ec.width/2,ec.height/2])),[ec,Xb,hc]),Ic=Tw.useCallback(nd=>{var Bd;null==(Bd=this.update)?void 0:Bd.call(this,{label:nd})},[Ob]);return(0,mp.jsxs)("div",Re(Ud({},k),{style:{width:"100%",height:"100%",overflow:"hidden"},className:"tl-ellipse-container",children:[(0,mp.jsx)(mu,
{font:"18px / 1 var(--ls-font-family)",text:Ob,color:th(Ha,"text"),offsetX:Ec[0],offsetY:Ec[1],scale:Xb,isEditing:G,onChange:Ic,onBlur:fa,fontStyle:Fb?"italic":"normal",fontSize:oc,fontWeight:cc,pointerEvents:!!Ob}),(0,mp.jsxs)(fp,Re(Ud({},k),{opacity:d?.2:Bb,children:[(0,mp.jsx)("ellipse",{className:a||!Za?"tl-hitarea-fill":"tl-hitarea-stroke",cx:na/2,cy:ta/2,rx:Math.max(.01,(na-fb)/2),ry:Math.max(.01,(ta-fb)/2)}),(0,mp.jsx)("ellipse",{cx:na/2,cy:ta/2,rx:Math.max(.01,(na-fb)/2),ry:Math.max(.01,(ta-
fb)/2),strokeWidth:fb,stroke:th(Ha,"stroke"),strokeDasharray:"dashed"===ib?"8 2":void 0,fill:Za?"none":th(Sa,"background")})]}))]}))}));gb(this,"setScaleLevel",a=>Nh(this,null,function*(){this.update({scaleLevel:a,fontSize:uv[null!=a?a:"md"],strokeWidth:uv[null!=a?a:"md"]/10});this.onResetBounds()}));gb(this,"ReactIndicator",Ze(()=>{const {size:[a,d],isLocked:k}=this.props;return(0,mp.jsx)("g",{children:(0,mp.jsx)("ellipse",{cx:a/2,cy:d/2,rx:a/2,ry:d/2,strokeWidth:2,fill:"transparent",strokeDasharray:k?
"8 2":"undefined"})})}));gb(this,"validateProps",a=>{void 0!==a.size&&(a.size[0]=Math.max(a.size[0],1),a.size[1]=Math.max(a.size[1],1));return Um(this,a)})}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx(a){const {size:[d,k],stroke:G,fill:fa,noFill:na,strokeWidth:ta,strokeType:Ha,opacity:Sa}=this.props;return(0,mp.jsxs)("g",{opacity:Sa,children:[(0,mp.jsx)("ellipse",{className:na?"tl-hitarea-stroke":"tl-hitarea-fill",cx:d/2,cy:k/2,rx:Math.max(.01,(d-ta)/2),ry:Math.max(.01,
(k-ta)/2)}),(0,mp.jsx)("ellipse",{cx:d/2,cy:k/2,rx:Math.max(.01,(d-ta)/2),ry:Math.max(.01,(k-ta)/2),strokeWidth:ta,stroke:th(G,"stroke"),strokeDasharray:"dashed"===Ha?"8 2":void 0,fill:na?"none":th(fa,"background")})]})}};gb(Ys,"id","ellipse");gb(Ys,"defaultProps",{id:"ellipse",parentId:"page",type:"ellipse",point:[0,0],size:[100,100],stroke:"",fill:"",noFill:!1,fontWeight:400,fontSize:20,italic:!1,strokeType:"line",strokeWidth:2,opacity:1,label:""});Nd([kf],Ys.prototype,"scaleLevel",1);Nd([hg],Ys.prototype,
"setScaleLevel",2);var Vr=ba(598),Uw=class extends Wv{constructor(){super(...arguments);gb(this,"ReactComponent",Ze(({events:a})=>{const d=this.getBounds(),k=kg(),G=k.selectedShapesArray.some(na=>k.shapesInGroups([this]).includes(na)),fa=this.ReactIndicator;return(0,Vr.jsxs)(fp,Re(Ud({},a),{className:"tl-group-container",children:[(0,Vr.jsx)("rect",{className:"tl-hitarea-fill",x:1,y:1,width:Math.max(.01,d.width-2),height:Math.max(.01,d.height-2),pointerEvents:"all"}),G&&(0,Vr.jsx)("g",{stroke:"var(--color-selectedFill)",
children:(0,Vr.jsx)(fa,{})})]}))}));gb(this,"ReactIndicator",Ze(()=>{const a=this.getBounds();return(0,Vr.jsx)("rect",{strokeDasharray:"8 2",x:-8,y:-8,rx:4,ry:4,width:a.width+16,height:a.height+16,fill:"transparent"})}))}};gb(Uw,"id","group");gb(Uw,"defaultProps",{id:"group",type:"group",parentId:"page",point:[0,0],size:[0,0],children:[]});var vv=ba(598),dz={xs:1,sm:1.6,md:2,lg:3.2,xl:4.8,xxl:6},Wr=class extends Bt{constructor(a={}){super(a);gb(this,"ReactComponent",Ze(({events:d,isErasing:k})=>{const {pointsPath:G,
props:{stroke:fa,strokeWidth:na,opacity:ta}}=this;return(0,vv.jsx)(fp,Re(Ud({},d),{opacity:k?.2:1,children:(0,vv.jsx)("path",{d:G,strokeWidth:16*na,stroke:th(fa,"stroke"),fill:"none",pointerEvents:"all",strokeLinejoin:"round",strokeLinecap:"round",opacity:ta})}))}));gb(this,"setScaleLevel",d=>Nh(this,null,function*(){this.update({scaleLevel:d,strokeWidth:dz[null!=d?d:"md"]});this.onResetBounds()}));gb(this,"ReactIndicator",Ze(()=>{const {pointsPath:d,props:k}=this;return(0,vv.jsx)("path",{d,fill:"none",
strokeDasharray:k.isLocked?"8 2":"undefined"})}));gb(this,"validateProps",d=>{d=Um(this,d);void 0!==d.strokeWidth&&(d.strokeWidth=Math.max(d.strokeWidth,1));return d});Hf(this)}get pointsPath(){const {points:a}=this.props;return wu.getCurvedPathForPoints(a)}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx(){const {pointsPath:a,props:{stroke:d,strokeWidth:k,opacity:G}}=this;return(0,vv.jsx)("path",{d:a,strokeWidth:16*k,stroke:th(d,"stroke"),fill:"none",pointerEvents:"all",
strokeLinejoin:"round",strokeLinecap:"round",opacity:G})}};gb(Wr,"id","highlighter");gb(Wr,"defaultProps",{id:"highlighter",parentId:"page",type:"highlighter",point:[0,0],points:[],isComplete:!1,stroke:"",fill:"",noFill:!0,strokeType:"line",strokeWidth:2,opacity:.5});Nd([kf],Wr.prototype,"pointsPath",1);Nd([kf],Wr.prototype,"scaleLevel",1);Nd([hg],Wr.prototype,"setScaleLevel",2);var Zs=$e(ba(22)),Se=ba(598),Fg={xs:.5,sm:.8,md:1,lg:1.5,xl:2,xxl:3},Ep=class extends vn{constructor(){super(...arguments);
gb(this,"canChangeAspectRatio",!0);gb(this,"canFlip",!1);gb(this,"canEdit",!0);gb(this,"htmlAnchorRef",Zs.createRef());gb(this,"setScaleLevel",a=>Nh(this,null,function*(){var d;const k=Pd.mul(this.props.size,Fg[null!=a?a:"md"]/Fg[null!=(d=this.props.scaleLevel)?d:"md"]);this.update({scaleLevel:a});yield vl();this.update({size:k})}));gb(this,"onResetBounds",a=>{var d;if(this.htmlAnchorRef.current){const k=this.htmlAnchorRef.current.getBoundingClientRect(),[G,fa]=Pd.div([k.width,k.height],null!=(d=
null==a?void 0:a.zoom)?d:1);this.update({size:[Math.max(Math.min(G||400,1400),10),Math.max(Math.min(fa||400,1400),10)]})}return this});gb(this,"ReactComponent",Ze(({events:a,isErasing:d,isEditing:k})=>{const {props:{html:G,scaleLevel:fa}}=this,na=on(),ta=kg(),Ha=ta.selectedIds.has(this.id),Sa=na||Ha&&!k||"select"!==ta.selectedTool.id,Za=Zs.useCallback(ib=>{Sa||ib.stopPropagation()},[Sa]),fb=Fg[null!=fa?fa:"md"];Zs.useEffect(()=>{0===this.props.size[1]&&(this.onResetBounds({zoom:ta.viewport.camera.zoom}),
ta.persist(!0))},[]);return(0,Se.jsx)(Eo,Re(Ud({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:1}},a),{children:(0,Se.jsx)("div",{onWheelCapture:Za,onPointerDown:Za,onPointerUp:Za,className:"tl-html-container",style:{pointerEvents:na||!k&&!Ha?"none":"all",overflow:k?"auto":"hidden",width:`calc(100% / ${fb})`,height:`calc(100% / ${fb})`,transform:`scale(${fb})`},children:(0,Se.jsx)("div",{ref:this.htmlAnchorRef,className:"tl-html-anchor",dangerouslySetInnerHTML:{__html:G.trim()}})})}))}));
gb(this,"ReactIndicator",Ze(()=>{const {props:{size:[a,d],isLocked:k}}=this;return(0,Se.jsx)("rect",{width:a,height:d,fill:"transparent",strokeDasharray:k?"8 2":"undefined"})}));gb(this,"validateProps",a=>{void 0!==a.size&&(a.size[0]=Math.max(a.size[0],1),a.size[1]=Math.max(a.size[1],1));return Um(this,a)})}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}};gb(Ep,"id","html");gb(Ep,"defaultProps",{id:"html",type:"html",parentId:"page",point:[0,0],size:[600,0],html:""});Nd([kf],
Ep.prototype,"scaleLevel",1);Nd([hg],Ep.prototype,"setScaleLevel",2);var ez=$e(ba(22)),nu=ba(598),Xr=class extends vn{constructor(){super(...arguments);gb(this,"frameRef",ez.createRef());gb(this,"canEdit",!0);gb(this,"onIFrameSourceChange",a=>{this.update({url:a})});gb(this,"reload",()=>{var a,d;this.frameRef.current&&(this.frameRef.current.src=null==(d=null==(a=this.frameRef)?void 0:a.current)?void 0:d.src)});gb(this,"ReactComponent",Ze(({events:a,isErasing:d,isEditing:k})=>{ez.useRef(null);const G=
kg();return(0,nu.jsx)(Eo,Re(Ud({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:1}},a),{children:(0,nu.jsx)("div",{className:"tl-iframe-container",style:{pointerEvents:k||G.readOnly?"all":"none",userSelect:"none"},children:this.props.url&&(0,nu.jsx)("div",{style:{overflow:"hidden",position:"relative",height:"100%"},children:(0,nu.jsx)("iframe",{ref:this.frameRef,className:"absolute inset-0 w-full h-full m-0",width:"100%",height:"100%",src:`${this.props.url}`,frameBorder:"0",sandbox:"allow-scripts allow-same-origin allow-presentation"})})})}))}));
gb(this,"ReactIndicator",Ze(()=>{const {props:{size:[a,d],isLocked:k}}=this;return(0,nu.jsx)("rect",{width:a,height:d,fill:"transparent",rx:8,ry:8,strokeDasharray:k?"8 2":"undefined"})}))}};gb(Xr,"id","iframe");gb(Xr,"defaultProps",{id:"iframe",type:"iframe",parentId:"page",point:[0,0],size:[853,480],url:""});Nd([hg],Xr.prototype,"onIFrameSourceChange",2);Nd([hg],Xr.prototype,"reload",2);var fz=$e(ba(22)),$s=ba(598),wv=class extends xx{constructor(){super(...arguments);gb(this,"ReactComponent",Ze(({events:a,
isErasing:d,isBinding:k,asset:G})=>{const {props:{opacity:fa,objectFit:na,clipping:ta,size:[Ha,Sa]}}=this,[Za,fb,ib,Bb]=Array.isArray(ta)?ta:[ta,ta,ta,ta],{handlers:Ob}=fz.useContext(Gi);return(0,$s.jsxs)(Eo,Re(Ud({},a),{opacity:d?.2:fa,children:[k&&(0,$s.jsx)(js,{mode:"html",strokeWidth:4,size:[Ha,Sa]}),(0,$s.jsx)("div",{"data-asset-loaded":!!G,className:"tl-image-shape-container",children:G?(0,$s.jsx)("img",{src:Ob?Ob.makeAssetUrl(G.src):G.src,draggable:!1,style:{position:"relative",top:-Za,left:-Bb,
width:Ha+(Bb-fb),height:Sa+(Za-ib),objectFit:na}}):"Asset is missing"})]}))}));gb(this,"ReactIndicator",Ze(()=>{const {props:{size:[a,d],isLocked:k}}=this;return(0,$s.jsx)("rect",{width:a,height:d,fill:"transparent",strokeDasharray:k?"8 2":"undefined"})}))}getShapeSVGJsx({assets:a}){var d,k;const G=this.getBounds(),{assetId:fa,clipping:na}=this.props;if(a=a.find(ta=>ta.id===fa)){Array.isArray(na);const ta=null==(k=null==(d=window.logseq)?void 0:d.api)?void 0:k.make_asset_url;return(0,$s.jsx)("image",
{width:G.width,height:G.height,href:ta?ta(a.src):a.src})}return super.getShapeSVGJsx({})}};gb(wv,"id","image");gb(wv,"defaultProps",{id:"image1",parentId:"page",type:"image",point:[0,0],size:[100,100],opacity:1,assetId:"",clipping:0,objectFit:"fill",isAspectRatioLocked:!0});var Ii=$e(ba(22)),dD=$e(ba(22)),Vw=ba(598),$q=ba(598),eD={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},ou=dD.memo(function({style:a,start:d,end:k,decorationStart:G,decorationEnd:fa,scaleLevel:na}){const ta=Pd.dist(d,k);if(2>ta)return null;
const {strokeWidth:Ha}=a,Sa=1+Ha*eD[null!=na?na:"md"]/10,Za="M"+Pd.toFixed(d)+"L"+Pd.toFixed(k);na=Math.min(ta/3,Ha*eD[null!=na?na:"md"]);G=G?Eq(d,k,na):null;fa=fa?Eq(k,d,na):null;return(0,$q.jsxs)($q.Fragment,{children:[(0,$q.jsx)("path",{className:"tl-stroke-hitarea",d:Za}),(0,$q.jsx)("path",{d:Za,strokeWidth:Sa,stroke:a.stroke,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"dashed"===a.strokeType?"8 4":void 0,pointerEvents:"stroke"}),G&&(0,$q.jsx)(Cq,{left:G.left,middle:d,right:G.right,
stroke:a.stroke,strokeWidth:Sa}),fa&&(0,$q.jsx)(Cq,{left:fa.left,middle:k,right:fa.right,stroke:a.stroke,strokeWidth:Sa})]})}),xv=ba(598),Rn=ba(598),Yr={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},at=class extends Iu{constructor(){super(...arguments);gb(this,"hideSelection",!0);gb(this,"canEdit",!0);gb(this,"ReactComponent",Ze(({events:a,isErasing:d,isEditing:k,onEditingEnd:G})=>{const {stroke:fa,handles:{start:na,end:ta},opacity:Ha,label:Sa,italic:Za,fontWeight:fb,fontSize:ib,id:Bb}=this.props,Ob=Sa||
k?yj(Sa||"Enter text",{fontFamily:"var(--ls-font-family)",fontSize:ib,lineHeight:1,fontWeight:fb},6):[0,0],Fb=Pd.med(na.point,ta.point);var cc=Pd.dist(na.point,ta.point);cc=Math.max(.5,Math.min(1,Math.max(cc/(Ob[1]+128),cc/(Ob[0]+128))));const oc=this.getBounds(),Xb=Ii.useMemo(()=>Pd.sub(Fb,Pd.toFixed([oc.width/2,oc.height/2])),[oc,cc,Fb]),hc=Ii.useCallback(ec=>{var Ec;null==(Ec=this.update)?void 0:Ec.call(this,{label:ec})},[Sa]);return(0,Rn.jsxs)("div",Re(Ud({},a),{style:{width:"100%",height:"100%",
overflow:"hidden"},className:"tl-line-container",children:[(0,Rn.jsx)(mu,{font:"20px / 1 var(--ls-font-family)",text:Sa,fontSize:ib,color:th(fa,"text"),offsetX:Xb[0],offsetY:Xb[1],scale:cc,isEditing:k,onChange:hc,onBlur:G,fontStyle:Za?"italic":"normal",fontWeight:fb,pointerEvents:!!Sa}),(0,Rn.jsxs)(fp,{opacity:d?.2:Ha,id:Bb+"_svg",children:[(0,Rn.jsx)(hs,{id:Bb,bounds:oc,labelSize:Ob,offset:Xb,scale:cc}),(0,Rn.jsx)("g",{pointerEvents:"none",mask:Sa||k?`url(#${Bb}_clip)`:"",children:this.getShapeSVGJsx({preview:!1})})]})]}))}));
gb(this,"setScaleLevel",a=>Nh(this,null,function*(){this.update({scaleLevel:a,fontSize:Yr[null!=a?a:"md"]});this.onResetBounds()}));gb(this,"ReactIndicator",Ze(({isEditing:a})=>{const {id:d,decorations:k,label:G,strokeWidth:fa,fontSize:na,fontWeight:ta,handles:{start:Ha,end:Sa},isLocked:Za}=this.props,fb=this.getBounds(),ib=G||a?yj(G,{fontFamily:"var(--ls-font-family)",fontSize:na,lineHeight:1,fontWeight:ta},6):[0,0],Bb=Pd.med(Ha.point,Sa.point);var Ob=Pd.dist(Ha.point,Sa.point);Ob=Math.max(.5,Math.min(1,
Math.max(Ob/(ib[1]+128),Ob/(ib[0]+128))));const Fb=Ii.useMemo(()=>Pd.sub(Bb,Pd.toFixed([fb.width/2,fb.height/2])),[fb,Ob,Bb]);return(0,Rn.jsxs)("g",{children:[(0,Rn.jsx)("path",{mask:G?`url(#${d}_clip)`:"",d:Ml({strokeWidth:fa},Ha.point,Sa.point,null==k?void 0:k.start,null==k?void 0:k.end),strokeDasharray:Za?"8 2":"undefined"}),G&&!a&&(0,Rn.jsx)("rect",{x:fb.width/2-ib[0]/2*Ob+Fb[0],y:fb.height/2-ib[1]/2*Ob+Fb[1],width:ib[0]*Ob,height:ib[1]*Ob,rx:4*Ob,ry:4*Ob,fill:"transparent"})]})}));gb(this,"validateProps",
a=>Um(this,a))}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx({preview:a}){const {stroke:d,fill:k,strokeWidth:G,strokeType:fa,decorations:na,label:ta,scaleLevel:Ha,handles:{start:Sa,end:Za}}=this.props,fb=Pd.med(Sa.point,Za.point);return(0,Rn.jsxs)(Rn.Fragment,{children:[(0,Rn.jsx)(ou,{style:{stroke:th(d,"text"),fill:k,strokeWidth:G,strokeType:fa},scaleLevel:Ha,start:Sa.point,end:Za.point,decorationStart:null==na?void 0:na.start,decorationEnd:null==na?void 0:na.end}),
a&&(0,Rn.jsx)(Rn.Fragment,{children:(0,Rn.jsx)("text",{style:{transformOrigin:"top left"},fontFamily:"Inter",fontSize:20,transform:`translate(${fb[0]}, ${fb[1]})`,textAnchor:"middle",fill:th(d,"text"),stroke:th(d,"text"),children:ta})})]})}};gb(at,"id","line");gb(at,"defaultProps",{id:"line",parentId:"page",type:"line",point:[0,0],handles:{start:{id:"start",canBind:!0,point:[0,0]},end:{id:"end",canBind:!0,point:[1,1]}},stroke:"",fill:"",noFill:!0,fontWeight:400,fontSize:20,italic:!1,strokeType:"line",
strokeWidth:1,opacity:1,decorations:{end:"arrow"},label:""});Nd([kf],at.prototype,"scaleLevel",1);Nd([hg],at.prototype,"setScaleLevel",2);var Sn=$e(ba(22)),Yi=ba(598),np={xs:.5,sm:.8,md:1,lg:1.5,xl:2,xxl:3},Fp=Ze(({type:a,fill:d,opacity:k,children:G})=>{const fa="var(--ls-secondary-background-color)"!==d?th(d,"background"):"var(--ls-tertiary-background-color)";d=d&&"var(--ls-secondary-background-color)"!==d?Oi(d)?`var(--ls-highlight-color-${d})`:d:"var(--ls-secondary-background-color)";return(0,Yi.jsxs)("div",
{className:`tl-logseq-portal-header tl-logseq-portal-header-${"P"===a?"page":"block"}`,children:[(0,Yi.jsx)("div",{className:"absolute inset-0 tl-logseq-portal-header-bg",style:{opacity:k,background:"P"===a?fa:`linear-gradient(0deg, ${d}, ${fa})`}}),(0,Yi.jsx)("div",{className:"relative",children:G})]})}),vk=class extends vn{constructor(a={}){var d;super(a);gb(this,"hideRotateHandle",!0);gb(this,"canChangeAspectRatio",!0);gb(this,"canFlip",!0);gb(this,"canEdit",!0);gb(this,"persist",null);gb(this,
"initialHeightCalculated",!0);gb(this,"getInnerHeight",null);gb(this,"setCollapsed",k=>Nh(this,null,function*(){var G;if("B"===this.props.blockType){if(this.update({compact:k}),this.canResize[1]=!k,!k)this.onResetBounds()}else{const fa=this.props.size[1];this.canResize[1]=!k;this.update({isAutoResizing:!k,collapsed:k,size:[this.props.size[0],k?this.getHeaderHeight():this.props.collapsedHeight],collapsedHeight:k?fa:this.props.collapsedHeight})}null==(G=this.persist)?void 0:G.call(this)}));gb(this,
"setScaleLevel",k=>Nh(this,null,function*(){var G;const fa=Pd.mul(this.props.size,np[null!=k?k:"md"]/np[null!=(G=this.props.scaleLevel)?G:"md"]);this.update({scaleLevel:k});yield vl();this.update({size:fa})}));gb(this,"onResetBounds",k=>{k=this.getAutoResizeHeight();null!==k&&1<Math.abs(k-this.props.size[1])&&(this.update({size:[this.props.size[0],k]}),this.initialHeightCalculated=!0);return this});gb(this,"onResize",(k,G)=>{var fa;const {bounds:na,rotation:ta,scale:[Ha,Sa]}=G;k=[...this.scale];0>
Ha&&(k[0]*=-1);0>Sa&&(k[1]*=-1);G=na.height;this.props.isAutoResizing&&(G=null!=(fa=this.getAutoResizeHeight())?fa:G);return this.update({point:[na.minX,na.minY],size:[Math.max(1,na.width),Math.max(1,G)],scale:k,rotation:ta})});gb(this,"PortalComponent",Ze(({})=>{const {props:{pageId:k,fill:G,opacity:fa}}=this,{renderers:na}=Sn.useContext(Gi),ta=kg(),Ha=Sn.useRef(null),[,Sa]=this.useComponentSize(Ha,this.props.compact?".tl-logseq-cp-container \x3e .single-block":".tl-logseq-cp-container \x3e .page");
if(null==na||!na.Page)return null;const {Page:Za,Block:fb}=na,[ib,Bb]=Sn.useState(!1);Sn.useEffect(()=>{var Ob,Fb;if(this.props.isAutoResizing){const cc=(null!=(Fb=null==(Ob=this.getInnerHeight)?void 0:Ob.call(this))?Fb:Sa)+this.getHeaderHeight();Sa&&1<Math.abs(cc-this.props.size[1])&&(this.update({size:[this.props.size[0],cc]}),ib&&ta.persist(!0))}},[Sa,this.props.isAutoResizing]);Sn.useEffect(()=>{this.initialHeightCalculated||setTimeout(()=>{this.onResetBounds();ta.persist(!0)})},[this.initialHeightCalculated]);
Sn.useEffect(()=>{setTimeout(function(){Bb(!0)})},[]);return(0,Yi.jsxs)(Yi.Fragment,{children:[(0,Yi.jsx)("div",{className:"absolute inset-0 tl-logseq-cp-container-bg",style:{textRendering:.5>ta.viewport.camera.zoom?"optimizeSpeed":"auto",background:G&&"var(--ls-secondary-background-color)"!==G?Oi(G)?`var(--ls-highlight-color-${G})`:G:"var(--ls-secondary-background-color)",opacity:fa}}),(0,Yi.jsx)("div",{ref:Ha,className:"relative tl-logseq-cp-container",style:{overflow:this.props.isAutoResizing?
"visible":"auto"},children:(ib||!this.initialHeightCalculated)&&("B"===this.props.blockType&&this.props.compact?(0,Yi.jsx)(fb,{blockId:k}):(0,Yi.jsx)(Za,{pageName:k}))})]})}));gb(this,"ReactComponent",Ze(k=>{var G;const {events:fa,isErasing:na,isEditing:ta,isBinding:Ha}=k,{props:{opacity:Sa,pageId:Za,fill:fb,scaleLevel:ib,strokeWidth:Bb,size:Ob}}=this,Fb=kg(),{renderers:cc,handlers:oc}=Sn.useContext(Gi);this.persist=()=>Fb.persist();const Xb=on(),hc=Fb.selectedIds.has(this.id)&&1===Fb.selectedIds.size,
ec=Fb.isIn("logseq-portal.creating")&&!Za,Ec=(Xb||hc&&!ta||"select"!==Fb.selectedTool.id)&&!ec,Ic=Sn.useCallback(bd=>{Ec||bd.stopPropagation()},[Ec]),nd=1===Fb.selectedShapesArray.length&&Fb.selectedShapesArray.some(bd=>"logseq-portal"===bd.type&&bd.props.id!==this.props.id&&Za&&bd.props.pageId===Za),Bd=np[null!=ib?ib:"md"];Sn.useEffect(()=>this.props.collapsed&&ta?(this.update({size:[this.props.size[0],this.props.collapsedHeight]}),()=>{this.update({size:[this.props.size[0],this.getHeaderHeight()]})}):
()=>{},[ta,this.props.collapsed]);Sn.useEffect(()=>{if(ec){const bd=[Fb.viewport.bounds.width,Fb.viewport.bounds.height],Gd=Fb.viewport.getScreenPoint([this.bounds.minX,this.bounds.minY]);(Gd[0]>bd[0]-400||Gd[1]>bd[1]-240||1.5<Fb.viewport.camera.zoom||.5>Fb.viewport.camera.zoom)&&Fb.viewport.zoomToBounds(Re(Ud({},this.bounds),{minY:this.bounds.maxY+25}))}},[Fb.viewport.bounds.height.toFixed(2)]);const Ee=Sn.useCallback(bd=>{this.initialHeightCalculated=!1;const Gd=Hl(bd)?"B":"P";this.update({pageId:bd,
size:[400,320],blockType:Gd,compact:"B"===Gd});Fb.selectTool("select");Fb.history.resume();Fb.history.persist()},[]),Vd=this.PortalComponent;var te=Sn.useMemo(()=>{var bd;if(Za&&"B"===this.props.blockType)return null==(bd=null==oc?void 0:oc.queryBlockByUUID(Za))?void 0:bd.content},[null==oc?void 0:oc.queryBlockByUUID,Za]);te="B"===this.props.blockType&&"string"!==typeof te;const gf=(!this.props.collapsed||ta)&&!te;if(null==cc||!cc.Page)return null;const {Breadcrumb:Be,PageName:Fe}=cc,Fd={width:`calc(100% / ${Bd})`,
height:`calc(100% / ${Bd})`,opacity:na?.2:1};1!==Bd&&(Fd.transform=`scale(${Bd})`);return(0,Yi.jsxs)(Eo,Re(Ud({style:{pointerEvents:"all"}},fa),{children:[Ha&&(0,Yi.jsx)(js,{mode:"html",strokeWidth:Bb,size:Ob}),(0,Yi.jsx)("div",{"data-inner-events":!Ec,onWheelCapture:Ic,onPointerDown:Ic,onPointerUp:Ic,style:{width:"100%",height:"100%",pointerEvents:Xb||!ta&&!hc?"none":"all"},children:ec?(0,Yi.jsx)(ft,{onChange:Ee,onAddBlock:bd=>{setTimeout(()=>{var Gd,Zc,td;Fb.api.editShape(this);null==(td=null==
(Zc=null==(Gd=window.logseq)?void 0:Gd.api)?void 0:Zc.edit_block)?void 0:td.call(Zc,bd)})},placeholder:"Create or search your graph..."}):(0,Yi.jsxs)("div",{className:"tl-logseq-portal-container","data-collapsed":this.collapsed,"data-page-id":Za,"data-portal-selected":nd,"data-editing":ta,style:Fd,children:[!this.props.compact&&!te&&(0,Yi.jsx)(Fp,{type:null!=(G=this.props.blockType)?G:"P",fill:fb,opacity:Sa,children:"P"===this.props.blockType?(0,Yi.jsx)(Fe,{pageName:Za}):(0,Yi.jsx)(Be,{blockId:Za})}),
te&&(0,Yi.jsx)("div",{className:"tl-target-not-found",children:"Target not found"}),gf&&(0,Yi.jsx)(Vd,Ud({},k))]})})]}))}));gb(this,"ReactIndicator",Ze(()=>{const k=this.getBounds();return(0,Yi.jsx)("rect",{width:k.width,height:k.height,fill:"transparent",rx:8,ry:8,strokeDasharray:this.props.isLocked?"8 2":"undefined"})}));gb(this,"validateProps",k=>{var G;if(void 0!==k.size){const fa=np[null!=(G=this.props.scaleLevel)?G:"md"];k.size[0]=Math.max(k.size[0],60*fa);k.size[1]=Math.max(k.size[1],40*fa)}return Um(this,
k)});Hf(this);a.collapsed&&Object.assign(this.canResize,[!0,!1]);0===(null==(d=a.size)?void 0:d[1])&&(this.initialHeightCalculated=!1)}static isPageOrBlock(a){return a?/^\(\(.*\)\)$/.test(a)&&40===a.length?"B":"P":!1}get collapsed(){return"B"===this.props.blockType?this.props.compact:this.props.collapsed}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}useComponentSize(a,d=""){const [k,G]=Sn.useState([0,0]),fa=kg();Sn.useEffect(()=>{setTimeout(()=>{if(null==a?0:a.current){const na=
d?a.current.querySelector(d):a.current;if(na){const ta=()=>{const {width:Sa,height:Za}=na.getBoundingClientRect(),fb=Pd.div([Sa,Za],fa.viewport.camera.zoom);G(fb);return fb};ta();this.getInnerHeight=()=>ta()[1];const Ha=new ResizeObserver(()=>{ta()});Ha.observe(na);return()=>{Ha.disconnect()}}}return()=>{}},10)},[a,d]);return k}getHeaderHeight(){var a;const d=np[null!=(a=this.props.scaleLevel)?a:"md"];return this.props.compact?0:40*d}getAutoResizeHeight(){return this.getInnerHeight?this.getHeaderHeight()+
this.getInnerHeight():null}getShapeSVGJsx({}){var a,d,k;const G=this.getBounds();return(0,Yi.jsxs)(Yi.Fragment,{children:[(0,Yi.jsx)("rect",{fill:this.props.fill&&"var(--ls-secondary-background-color)"!==this.props.fill?Oi(this.props.fill)?`var(--ls-highlight-color-${this.props.fill})`:this.props.fill:"var(--ls-secondary-background-color)",stroke:th(this.props.fill,"background"),strokeWidth:null!=(a=this.props.strokeWidth)?a:2,fillOpacity:null!=(d=this.props.opacity)?d:.2,width:G.width,rx:8,ry:8,
height:G.height}),!this.props.compact&&(0,Yi.jsx)("rect",{fill:this.props.fill&&"var(--ls-secondary-background-color)"!==this.props.fill?th(this.props.fill,"background"):"var(--ls-tertiary-background-color)",fillOpacity:null!=(k=this.props.opacity)?k:.2,x:1,y:1,width:G.width-2,height:38,rx:8,ry:8}),(0,Yi.jsx)("text",{style:{transformOrigin:"top left"},transform:`translate(${G.width/2}, ${10+G.height/2})`,textAnchor:"middle",fontFamily:"var(--ls-font-family)",fontSize:"32",fill:"var(--ls-secondary-text-color)",
stroke:"var(--ls-secondary-text-color)",children:"P"===this.props.blockType?this.props.pageId:""})]})}};gb(vk,"id","logseq-portal");gb(vk,"defaultSearchQuery","");gb(vk,"defaultSearchFilter",null);gb(vk,"defaultProps",{id:"logseq-portal",type:"logseq-portal",parentId:"page",point:[0,0],size:[400,50],collapsedHeight:0,stroke:"",fill:"",noFill:!1,borderRadius:8,strokeWidth:2,strokeType:"line",opacity:1,pageId:"",collapsed:!1,compact:!1,scaleLevel:"md",isAutoResizing:!0});Nd([kf],vk.prototype,"collapsed",
1);Nd([hg],vk.prototype,"setCollapsed",2);Nd([kf],vk.prototype,"scaleLevel",1);Nd([hg],vk.prototype,"setScaleLevel",2);var {min:Gp,PI:fD}=Math,ar=fD+1E-4,yv=ba(598),Hp={xs:1,sm:1.6,md:2,lg:3.2,xl:4.8,xxl:6},bt={easing:a=>Math.sin(a*Math.PI/2),simulatePressure:!0},gz={easing:a=>a*a,simulatePressure:!1},ng=class extends Bt{constructor(a={}){super(a);gb(this,"ReactComponent",Ze(({events:d,isErasing:k})=>{const {props:{opacity:G}}=this;return(0,yv.jsx)(fp,Re(Ud({},d),{opacity:k?.2:G,children:this.getShapeSVGJsx()}))}));
gb(this,"setScaleLevel",d=>Nh(this,null,function*(){this.update({scaleLevel:d,strokeWidth:Hp[null!=d?d:"md"]});this.onResetBounds()}));gb(this,"ReactIndicator",Ze(()=>{const {pointsPath:d}=this;return(0,yv.jsx)("path",{d,strokeDasharray:this.props.isLocked?"8 2":"undefined"})}));gb(this,"validateProps",d=>{d=Um(this,d);void 0!==d.strokeWidth&&(d.strokeWidth=Math.max(d.strokeWidth,1));return d});Hf(this)}get pointsPath(){var a=this.props;if(2>a.points.length)var d="";else d=Re(Ud({size:1+1.5*a.strokeWidth,
thinning:.65,streamline:.65,smoothing:.65},.5===a.points[1][2]?bt:gz),{last:a.isComplete}),a=Rj(a.points,d),d=wu.getSvgPathFromStroke(Gq(a,d));return d}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx(){const {pointsPath:a,props:{stroke:d,strokeWidth:k,strokeType:G}}=this;return(0,yv.jsx)("path",{pointerEvents:"all",d:a,strokeWidth:k/2,strokeLinejoin:"round",strokeLinecap:"round",stroke:th(d,"text"),fill:th(d,"text"),strokeDasharray:"dashed"===G?"12 4":void 0})}};
gb(ng,"id","pencil");gb(ng,"defaultProps",{id:"pencil",parentId:"page",type:"pencil",point:[0,0],points:[],isComplete:!1,stroke:"",fill:"",noFill:!0,strokeType:"line",strokeWidth:2,opacity:1});Nd([kf],ng.prototype,"pointsPath",1);Nd([kf],ng.prototype,"scaleLevel",1);Nd([hg],ng.prototype,"setScaleLevel",2);var zv=$e(ba(22)),Oo=ba(598),br={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},Po=class extends Ar{constructor(){super(...arguments);gb(this,"canEdit",!0);gb(this,"ReactComponent",Ze(({events:a,isErasing:d,
isSelected:k,isEditing:G,onEditingEnd:fa})=>{const {offset:[na,ta],props:{stroke:Ha,fill:Sa,noFill:Za,strokeWidth:fb,opacity:ib,strokeType:Bb,label:Ob,italic:Fb,fontWeight:cc,fontSize:oc}}=this,Xb=this.getVertices(fb/2).join();var hc=Ob||G?yj(Ob,{fontFamily:"var(--ls-font-family)",fontSize:oc,lineHeight:1,fontWeight:cc},4):[0,0];const ec=[this.props.size[0]/2,2*this.props.size[1]/3];hc=Math.max(.5,Math.min(1,this.props.size[0]/(2*hc[0]),this.props.size[1]/(2*hc[1])));const Ec=this.getBounds(),Ic=
zv.useMemo(()=>Pd.sub(ec,Pd.toFixed([Ec.width/2,Ec.height/2])),[Ec,hc,ec]),nd=zv.useCallback(Bd=>{var Ee;null==(Ee=this.update)?void 0:Ee.call(this,{label:Bd})},[Ob]);return(0,Oo.jsxs)("div",Re(Ud({},a),{style:{width:"100%",height:"100%",overflow:"hidden"},children:[(0,Oo.jsx)(mu,{font:"20px / 1 var(--ls-font-family)",text:Ob,fontSize:oc,color:th(Ha,"text"),offsetX:Ic[0],offsetY:Ic[1]/hc,scale:hc,isEditing:G,onChange:nd,onBlur:fa,fontStyle:Fb?"italic":"normal",fontWeight:cc,pointerEvents:!!Ob}),(0,Oo.jsx)(fp,
{opacity:d?.2:ib,children:(0,Oo.jsxs)("g",{transform:`translate(${na}, ${ta})`,children:[(0,Oo.jsx)("polygon",{className:k||!Za?"tl-hitarea-fill":"tl-hitarea-stroke",points:Xb}),(0,Oo.jsx)("polygon",{points:Xb,stroke:th(Ha,"stroke"),fill:Za?"none":th(Sa,"background"),strokeWidth:fb,rx:2,ry:2,strokeLinejoin:"round",strokeDasharray:"dashed"===Bb?"8 2":void 0})]})})]}))}));gb(this,"setScaleLevel",a=>Nh(this,null,function*(){this.update({scaleLevel:a,fontSize:br[null!=a?a:"md"],strokeWidth:br[null!=a?
a:"md"]/10});this.onResetBounds()}));gb(this,"ReactIndicator",Ze(()=>{const {offset:[a,d],props:{strokeWidth:k,isLocked:G}}=this;return(0,Oo.jsx)("g",{children:(0,Oo.jsx)("polygon",{transform:`translate(${a}, ${d})`,points:this.getVertices(k/2).join(),strokeDasharray:G?"8 2":"undefined"})})}));gb(this,"validateProps",a=>{void 0!==a.sides&&(a.sides=Math.max(a.sides,3));return Um(this,a)})}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx(a){const {offset:[d,k],props:{stroke:G,
fill:fa,noFill:na,strokeWidth:ta,opacity:Ha,strokeType:Sa}}=this;a=this.getVertices(ta/2).join();return(0,Oo.jsxs)("g",{transform:`translate(${d}, ${k})`,opacity:Ha,children:[(0,Oo.jsx)("polygon",{className:na?"tl-hitarea-stroke":"tl-hitarea-fill",points:a}),(0,Oo.jsx)("polygon",{points:a,stroke:th(G,"stroke"),fill:na?"none":th(fa,"background"),strokeWidth:ta,rx:2,ry:2,strokeLinejoin:"round",strokeDasharray:"dashed"===Sa?"8 2":void 0})]})}};gb(Po,"id","polygon");gb(Po,"defaultProps",{id:"polygon",
parentId:"page",type:"polygon",point:[0,0],size:[100,100],sides:3,ratio:1,isFlippedY:!1,stroke:"",fill:"",fontWeight:400,fontSize:20,italic:!1,noFill:!1,strokeType:"line",strokeWidth:2,opacity:1,label:""});Nd([kf],Po.prototype,"scaleLevel",1);Nd([hg],Po.prototype,"setScaleLevel",2);var op=$e(ba(22)),Fm=ba(598),gD={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},fn=class extends yx{constructor(){super(...arguments);gb(this,"ReactComponent",Ze(({events:a,isErasing:d,isEditing:k,onEditingEnd:G})=>{const {props:{opacity:fa,
fontFamily:na,fontSize:ta,fontWeight:Ha,italic:Sa,lineHeight:Za,text:fb,stroke:ib,padding:Bb}}=this,Ob=op.useRef(null),Fb=op.useRef(!1),cc=op.useRef(null),oc=op.useCallback(Ic=>{const {isSizeLocked:nd}=this.props;Ic=It.normalizeText(Ic.currentTarget.value);nd?this.update({text:Ic,size:this.getAutoSizedBoundingBox({text:Ic})}):this.update({text:Ic})},[]),Xb=op.useCallback(Ic=>{if("Escape"!==Ic.key)if("Tab"===Ic.key&&0===fb.length)Ic.preventDefault();else{if("Meta"!==Ic.key&&!Ic.metaKey)Ic.stopPropagation();
else if("z"===Ic.key&&Ic.metaKey){Ic.shiftKey?document.execCommand("redo",!1):document.execCommand("undo",!1);Ic.stopPropagation();Ic.preventDefault();return}"Tab"===Ic.key&&(Ic.preventDefault(),Ic.shiftKey?go.unindent(Ic.currentTarget):go.indent(Ic.currentTarget),this.update({text:It.normalizeText(Ic.currentTarget.value)}))}},[]),hc=op.useCallback(Ic=>{k&&(null==G?void 0:G())},[G]),ec=op.useCallback(Ic=>{k&&Fb.current&&document.activeElement===Ic.currentTarget&&Ic.currentTarget.select()},[k]),Ec=
op.useCallback(Ic=>{k&&Ic.stopPropagation()},[k]);op.useEffect(()=>{k&&requestAnimationFrame(()=>{Fb.current=!0;const Ic=Ob.current;Ic&&(Ic.focus(),Ic.select())})},[k,G]);op.useLayoutEffect(()=>{if(0===this.props.size[0]||0===this.props.size[1])this.onResetBounds()},[]);return(0,Fm.jsx)(Eo,Re(Ud({},a),{opacity:d?.2:fa,children:(0,Fm.jsx)("div",{ref:cc,className:"tl-text-shape-wrapper","data-hastext":!!fb,"data-isediting":k,style:{fontFamily:na,fontStyle:Sa?"italic":"normal",fontSize:ta,fontWeight:Ha,
padding:Bb,lineHeight:Za,color:th(ib,"text")},children:k?(0,Fm.jsx)("textarea",{ref:Ob,className:"tl-text-shape-input",name:"text",tabIndex:-1,autoComplete:"false",autoCapitalize:"false",autoCorrect:"false",autoSave:"false",placeholder:"",spellCheck:"true",wrap:"off",dir:"auto",datatype:"wysiwyg",defaultValue:fb,onFocus:ec,onChange:oc,onKeyDown:Xb,onBlur:hc,onPointerDown:Ec}):(0,Fm.jsxs)(Fm.Fragment,{children:[fb,""]})})}))}));gb(this,"setScaleLevel",a=>Nh(this,null,function*(){this.update({scaleLevel:a,
fontSize:gD[null!=a?a:"md"]});this.onResetBounds()}));gb(this,"ReactIndicator",Ze(({isEditing:a})=>{const {props:{borderRadius:d,isLocked:k},bounds:G}=this;return a?null:(0,Fm.jsx)("rect",{width:G.width,height:G.height,rx:d,ry:d,fill:"transparent",strokeDasharray:k?"8 2":"undefined"})}));gb(this,"validateProps",a=>Um(this,a));gb(this,"getBounds",()=>{const [a,d]=this.props.point,[k,G]=this.props.size;return{minX:a,minY:d,maxX:a+k,maxY:d+G,width:k,height:G}});gb(this,"onResizeStart",({isSingle:a})=>
{var d;if(!a)return this;this.scale=[...(null!=(d=this.props.scale)?d:[1,1])];return this.update({isSizeLocked:!1})});gb(this,"onResetBounds",()=>{this.update({size:this.getAutoSizedBoundingBox(),isSizeLocked:!0});return this})}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getAutoSizedBoundingBox(a={}){const {text:d=this.props.text,fontFamily:k=this.props.fontFamily,fontSize:G=this.props.fontSize,fontWeight:fa=this.props.fontWeight,lineHeight:na=this.props.lineHeight,padding:ta=
this.props.padding}=a,[Ha,Sa]=yj(d,{fontFamily:k,fontSize:G,lineHeight:na,fontWeight:fa},ta);return[Ha,Sa]}getShapeSVGJsx(){var a=window.navigator.userAgent.toLowerCase();if(a.includes("webkit")&&!a.includes("chrome"))return super.getShapeSVGJsx(null);const {props:{text:d,stroke:k,fontSize:G,fontFamily:fa}}=this;a=this.getBounds();return(0,Fm.jsx)("foreignObject",{width:a.width,height:a.height,children:(0,Fm.jsx)("div",{style:{color:th(k,"text"),fontSize:G,fontFamily:fa,display:"contents"},children:d})})}};
gb(fn,"id","text");gb(fn,"defaultProps",{id:"box",parentId:"page",type:"text",point:[0,0],size:[0,0],isSizeLocked:!0,text:"",lineHeight:1.2,fontSize:20,fontWeight:400,italic:!1,padding:4,fontFamily:"var(--ls-font-family)",borderRadius:0,stroke:"",fill:"",noFill:!0,strokeType:"line",strokeWidth:2,opacity:1});Nd([kf],fn.prototype,"scaleLevel",1);Nd([hg],fn.prototype,"setScaleLevel",2);var ct=$e(ba(22)),pu=ba(598),Zr=class extends vn{constructor(){super(...arguments);gb(this,"canFlip",!1);gb(this,"canEdit",
!0);gb(this,"canChangeAspectRatio",!1);gb(this,"ReactComponent",Ze(({events:a,isErasing:d,asset:k,isEditing:G})=>{const {props:{opacity:fa}}=this,na=on();var ta=kg();const Ha=ta.selectedIds.has(this.id),Sa=na||Ha&&!G||"select"!==ta.selectedTool.id;ta=ct.useCallback(fb=>{Sa||fb.stopPropagation()},[Sa]);const {handlers:Za}=ct.useContext(Gi);return(0,pu.jsx)(Eo,Re(Ud({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:fa}},a),{children:(0,pu.jsx)("div",{onWheelCapture:ta,onPointerDown:ta,onPointerUp:ta,
className:"tl-video-container",style:{pointerEvents:na||!G&&!Ha?"none":"all",overflow:G?"auto":"hidden"},children:k&&(0,pu.jsx)("video",{controls:!0,src:Za?Za.makeAssetUrl(k.src):k.src})})}))}));gb(this,"ReactIndicator",Ze(()=>{const {props:{size:[a,d],isLocked:k}}=this;return(0,pu.jsx)("rect",{width:a,height:d,fill:"transparent",strokeDasharray:k?"8 2":"undefined"})}))}};gb(Zr,"id","video");gb(Zr,"defaultProps",{id:"video1",parentId:"page",type:"video",point:[0,0],size:[100,100],opacity:1,assetId:"",
clipping:0,isAspectRatioLocked:!0});var Ul=ba(598),Av=/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/,Ww=class extends vn{constructor(){super(...arguments);gb(this,"aspectRatio",480/853);gb(this,"canChangeAspectRatio",!1);gb(this,"canFlip",!1);gb(this,"canEdit",!0);gb(this,"onYoutubeLinkChange",a=>{this.update({url:a,size:Ww.defaultProps.size})});gb(this,"ReactComponent",Ze(({events:a,isErasing:d,isEditing:k})=>{const G=kg();return(0,Ul.jsx)(Eo,
Re(Ud({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:1}},a),{children:(0,Ul.jsx)("div",{className:"rounded-lg w-full h-full relative overflow-hidden shadow-xl tl-youtube-container",style:{pointerEvents:k||G.readOnly?"all":"none",userSelect:"none",background:`url('https://img.youtube.com/vi/${this.embedId}/mqdefault.jpg') no-repeat center/cover`},children:this.embedId?(0,Ul.jsx)("div",{style:{overflow:"hidden",position:"relative",height:"100%"},children:(0,Ul.jsx)("iframe",{className:"absolute inset-0 w-full h-full m-0",
width:"853",height:"480",src:`https://www.youtube.com/embed/${this.embedId}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"Embedded youtube"})}):(0,Ul.jsx)("div",{className:"w-full h-full flex items-center justify-center p-4",style:{backgroundColor:"var(--ls-primary-background-color)"},children:(0,Ul.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 502 210.649",height:"210.65",width:"128",children:(0,Ul.jsxs)("g",
{children:[(0,Ul.jsx)("path",{d:"M498.333 45.7s-2.91-20.443-11.846-29.447C475.157 4.44 462.452 4.38 456.627 3.687c-41.7-3-104.25-3-104.25-3h-.13s-62.555 0-104.255 3c-5.826.693-18.523.753-29.86 12.566-8.933 9.004-11.84 29.447-11.84 29.447s-2.983 24.003-2.983 48.009v22.507c0 24.006 2.983 48.013 2.983 48.013s2.907 20.44 11.84 29.446c11.337 11.817 26.23 11.44 32.86 12.677 23.84 2.28 101.315 2.983 101.315 2.983s62.62-.094 104.32-3.093c5.824-.694 18.527-.75 29.857-12.567 8.936-9.006 11.846-29.446 11.846-29.446s2.98-24.007 2.98-48.013V93.709c0-24.006-2.98-48.01-2.98-48.01",
fill:"#cd201f"}),(0,Ul.jsx)("g",{children:(0,Ul.jsx)("path",{d:"M187.934 169.537h-18.96V158.56c-7.19 8.24-13.284 12.4-19.927 12.4-5.826 0-9.876-2.747-11.9-7.717-1.23-3.02-2.103-7.736-2.103-14.663V68.744h18.957v81.833c.443 2.796 1.636 3.823 4.043 3.823 3.63 0 6.913-3.153 10.93-8.817V68.744h18.96v100.793zM102.109 139.597c.996 9.98-2.1 14.93-7.987 14.93s-8.98-4.95-7.98-14.93v-39.92c-1-9.98 2.093-14.657 7.98-14.657 5.89 0 8.993 4.677 7.996 14.657l-.01 39.92zm18.96-37.923c0-10.77-2.164-18.86-5.987-23.95-5.054-6.897-12.973-9.72-20.96-9.72-9.033 0-15.913 2.823-20.957 9.72-3.886 5.09-5.97 13.266-5.97 24.036l-.016 35.84c0 10.71 1.853 18.11 5.736 23.153 5.047 6.873 13.227 10.513 21.207 10.513 7.986 0 16.306-3.64 21.36-10.513 3.823-5.043 5.586-12.443 5.586-23.153v-35.926zM46.223 114.647v54.889h-19.96v-54.89S5.582 47.358 1.314 34.815H22.27L36.277 87.38l13.936-52.566H71.17l-24.947 79.833z"})}),
(0,Ul.jsxs)("g",{fill:"#fff",children:[(0,Ul.jsx)("path",{d:"M440.413 96.647c0-9.33 2.557-11.874 8.59-11.874 5.99 0 8.374 2.777 8.374 11.997v10.893l-16.964.02V96.647zm35.96 25.986l-.003-20.4c0-10.656-2.1-18.456-5.88-23.5-5.06-6.823-12.253-10.436-21.317-10.436-9.226 0-16.42 3.613-21.643 10.436-3.84 5.044-6.076 13.28-6.076 23.943v34.927c0 10.596 2.46 18.013 6.296 23.003 5.227 6.813 12.42 10.216 21.87 10.216 9.44 0 16.853-3.566 21.85-10.81 2.2-3.196 3.616-6.82 4.226-10.823.164-1.81.64-5.933.64-11.753v-2.827h-18.96c0 7.247.037 11.557-.133 12.54-1.033 4.834-3.623 7.25-8.07 7.25-6.203 0-8.826-4.636-8.76-13.843v-17.923h35.96zM390.513 140.597c0 9.98-2.353 13.806-7.563 13.806-2.973 0-6.4-1.53-9.423-4.553l.02-60.523c3.02-2.98 6.43-4.55 9.403-4.55 5.21 0 7.563 2.93 7.563 12.91v42.91zm2.104-72.453c-6.647 0-13.253 4.087-19.09 11.27l.02-43.603h-17.963V169.54h17.963l.027-10.05c6.036 7.47 12.62 11.333 19.043 11.333 7.193 0 12.45-3.85 14.863-11.267 1.203-4.226 1.993-10.733 1.993-19.956V99.684c0-9.447-1.21-15.907-2.416-19.917-2.41-7.466-7.247-11.623-14.44-11.623M340.618 169.537h-18.956V158.56c-7.193 8.24-13.283 12.4-19.926 12.4-5.827 0-9.877-2.747-11.9-7.717-1.234-3.02-2.107-7.736-2.107-14.663V69.744h18.96v80.833c.443 2.796 1.633 3.823 4.043 3.823 3.63 0 6.913-3.153 10.93-8.817V69.744h18.957v99.793z"}),
(0,Ul.jsx)("path",{d:"M268.763 169.537h-19.956V54.77h-20.956V35.835l62.869-.024v18.96h-21.957v114.766z"})]})]})})})})}))}));gb(this,"ReactIndicator",Ze(()=>{const {props:{size:[a,d],isLocked:k}}=this;return(0,Ul.jsx)("rect",{width:a,height:d,fill:"transparent",rx:8,ry:8,strokeDasharray:k?"8 2":"undefined"})}));gb(this,"validateProps",a=>{void 0!==a.size&&(a.size[0]=Math.max(a.size[0],1),a.size[1]=Math.max(a.size[0]*this.aspectRatio,1));return Um(this,a)})}get embedId(){var a,d;const k=this.props.url,
G=k.match(Av);return null!=(d=null!=(a=null==G?void 0:G[1])?a:k)?d:""}getShapeSVGJsx(){const a=this.getBounds(),d=this.embedId;return d?(0,Ul.jsxs)("g",{children:[(0,Ul.jsx)("image",{width:a.width,height:a.height,href:`https://img.youtube.com/vi/${d}/mqdefault.jpg`,className:"grayscale-[50%]"}),(0,Ul.jsx)("svg",{x:a.width/4,y:a.height/4,width:a.width/2,height:a.height/2,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,Ul.jsx)("path",{d:"M4.76447 3.12199C5.63151 3.04859 6.56082 3 7.5 3C8.43918 3 9.36849 3.04859 10.2355 3.12199C11.2796 3.21037 11.9553 3.27008 12.472 3.39203C12.9425 3.50304 13.2048 3.64976 13.4306 3.88086C13.4553 3.90618 13.4902 3.94414 13.5133 3.97092C13.7126 4.20149 13.8435 4.4887 13.918 5.03283C13.9978 5.6156 14 6.37644 14 7.52493C14 8.66026 13.9978 9.41019 13.9181 9.98538C13.8439 10.5206 13.7137 10.8061 13.5125 11.0387C13.4896 11.0651 13.4541 11.1038 13.4296 11.1287C13.2009 11.3625 12.9406 11.5076 12.4818 11.6164C11.9752 11.7365 11.3143 11.7942 10.2878 11.8797C9.41948 11.9521 8.47566 12 7.5 12C6.52434 12 5.58052 11.9521 4.7122 11.8797C3.68572 11.7942 3.02477 11.7365 2.51816 11.6164C2.05936 11.5076 1.7991 11.3625 1.57037 11.1287C1.54593 11.1038 1.51035 11.0651 1.48748 11.0387C1.28628 10.8061 1.15612 10.5206 1.08193 9.98538C1.00221 9.41019 1 8.66026 1 7.52493C1 6.37644 1.00216 5.6156 1.082 5.03283C1.15654 4.4887 1.28744 4.20149 1.48666 3.97092C1.5098 3.94414 1.54468 3.90618 1.56942 3.88086C1.7952 3.64976 2.05752 3.50304 2.52796 3.39203C3.04473 3.27008 3.7204 3.21037 4.76447 3.12199ZM0 7.52493C0 5.28296 0 4.16198 0.729985 3.31713C0.766457 3.27491 0.815139 3.22194 0.854123 3.18204C1.63439 2.38339 2.64963 2.29744 4.68012 2.12555C5.56923 2.05028 6.52724 2 7.5 2C8.47276 2 9.43077 2.05028 10.3199 2.12555C12.3504 2.29744 13.3656 2.38339 14.1459 3.18204C14.1849 3.22194 14.2335 3.27491 14.27 3.31713C15 4.16198 15 5.28296 15 7.52493C15 9.74012 15 10.8477 14.2688 11.6929C14.2326 11.7348 14.1832 11.7885 14.1444 11.8281C13.3629 12.6269 12.3655 12.71 10.3709 12.8763C9.47971 12.9505 8.50782 13 7.5 13C6.49218 13 5.52028 12.9505 4.62915 12.8763C2.63446 12.71 1.63712 12.6269 0.855558 11.8281C0.816844 11.7885 0.767442 11.7348 0.731221 11.6929C0 10.8477 0 9.74012 0 7.52493ZM5.25 5.38264C5.25 5.20225 5.43522 5.08124 5.60041 5.15369L10.428 7.27105C10.6274 7.35853 10.6274 7.64147 10.428 7.72895L5.60041 9.84631C5.43522 9.91876 5.25 9.79775 5.25 9.61736V5.38264Z",
fill:"#D10014",fillRule:"evenodd",clipRule:"evenodd"})})]}):super.getShapeSVGJsx({})}},cr=Ww;gb(cr,"id","youtube");gb(cr,"defaultProps",{id:"youtube",type:"youtube",parentId:"page",point:[0,0],size:[853,480],url:""});Nd([kf],cr.prototype,"embedId",1);Nd([hg],cr.prototype,"onYoutubeLinkChange",2);var $r=$e(ba(22)),uq=ba(598),Xw=/https?:\/\/twitter.com\/[0-9a-zA-Z_]{1,20}\/status\/([0-9]*)/,hz=class extends vn{constructor(){super(...arguments);gb(this,"canFlip",!1);gb(this,"canEdit",!0);gb(this,"initialHeightCalculated",
!0);gb(this,"getInnerHeight",null);gb(this,"onTwitterLinkChange",a=>{this.update({url:a,size:hz.defaultProps.size})});gb(this,"ReactComponent",Ze(({events:a,isErasing:d,isEditing:k})=>{const {renderers:{Tweet:G}}=$r.useContext(Gi),fa=kg(),na=$r.useRef(null),[,ta]=this.useComponentSize(na);$r.useEffect(()=>{var Ha,Sa;const Za=null!=(Sa=null==(Ha=this.getInnerHeight)?void 0:Ha.call(this))?Sa:ta;ta&&1<Math.abs(Za-this.props.size[1])&&(this.update({size:[this.props.size[0],Za]}),fa.persist(!0))},[ta]);
$r.useEffect(()=>{this.initialHeightCalculated||setTimeout(()=>{this.onResetBounds();fa.persist(!0)})},[this.initialHeightCalculated]);return(0,uq.jsx)(Eo,Re(Ud({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:1}},a),{children:(0,uq.jsx)("div",{className:"rounded-xl w-full h-full relative shadow-xl tl-tweet-container",style:{pointerEvents:k||fa.readOnly?"all":"none",userSelect:"none"},children:this.embedId?(0,uq.jsx)("div",{ref:na,children:(0,uq.jsx)(G,{tweetId:this.embedId})}):null})}))}));
gb(this,"ReactIndicator",Ze(()=>{const {props:{size:[a,d],isLocked:k}}=this;return(0,uq.jsx)("rect",{width:a,height:d,fill:"transparent",rx:8,ry:8,strokeDasharray:k?"8 2":"undefined"})}));gb(this,"onResetBounds",a=>{a=this.getAutoResizeHeight();null!==a&&1<Math.abs(a-this.props.size[1])&&(this.update({size:[this.props.size[0],a]}),this.initialHeightCalculated=!0);return this});gb(this,"onResize",(a,d)=>{var k;const {bounds:G,rotation:fa,scale:[na,ta]}=d;a=[...this.scale];0>na&&(a[0]*=-1);0>ta&&(a[1]*=
-1);d=null!=(k=this.getAutoResizeHeight())?k:G.height;return this.update({point:[G.minX,G.minY],size:[Math.max(1,G.width),Math.max(1,d)],scale:a,rotation:fa})});gb(this,"validateProps",a=>{void 0!==a.size&&(a.size[0]=Math.min(Math.max(a.size[0],300),550),a.size[1]=Math.max(a.size[1],1));return Um(this,a)})}get embedId(){var a,d;const k=this.props.url,G=k.match(Xw);return null!=(d=null!=(a=null==G?void 0:G[1])?a:k)?d:""}useComponentSize(a,d=""){const [k,G]=$r.useState([0,0]),fa=kg();$r.useEffect(()=>
{if(null==a?0:a.current){const na=d?a.current.querySelector(d):a.current;if(na){const ta=()=>{const {width:Sa,height:Za}=na.getBoundingClientRect(),fb=Pd.div([Sa,Za],fa.viewport.camera.zoom);G(fb);return fb};ta();this.getInnerHeight=()=>ta()[1];const Ha=new ResizeObserver(()=>{ta()});Ha.observe(na);return()=>{Ha.disconnect()}}}return()=>{}},[a,d]);return k}getAutoResizeHeight(){return this.getInnerHeight?this.getInnerHeight():null}getShapeSVGJsx(){const a=this.getBounds();return this.embedId?(0,uq.jsxs)("g",
{children:[(0,uq.jsx)("rect",{width:a.width,height:a.height,fill:"#15202b",rx:8,ry:8}),(0,uq.jsx)("svg",{x:a.width/4,y:a.height/4,width:a.width/2,height:a.height/2,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,uq.jsx)("path",{d:"m13.464 4.4401c0.0091 0.13224 0.0091 0.26447 0.0091 0.39793 0 4.0664-3.0957 8.7562-8.7562 8.7562v-0.0024c-1.6721 0.0024-3.3095-0.47658-4.7172-1.3797 0.24314 0.02925 0.48751 0.04387 0.73248 0.04448 1.3857 0.0013 2.7319-0.46374 3.8221-1.3199-1.3169-0.024981-2.4717-0.8836-2.8751-2.1371 0.4613 0.08897 0.93662 0.070688 1.3894-0.053016-1.4357-0.29007-2.4686-1.5515-2.4686-3.0165v-0.039001c0.42779 0.23827 0.90676 0.37051 1.3967 0.38513-1.3522-0.90372-1.769-2.7026-0.95247-4.1091 1.5625 1.9226 3.8678 3.0914 6.3425 3.2151-0.24802-1.0689 0.090798-2.1889 0.89031-2.9403 1.2395-1.1651 3.1889-1.1054 4.3541 0.13346 0.68921-0.13589 1.3498-0.38879 1.9543-0.74711-0.22974 0.71237-0.71054 1.3175-1.3528 1.702 0.60999-0.071907 1.206-0.23522 1.7672-0.48446-0.41316 0.61913-0.93358 1.1584-1.5356 1.5942z",
fill:"#1d9bf0",fillRule:"evenodd",clipRule:"evenodd"})})]}):super.getShapeSVGJsx({})}},dt=hz;gb(dt,"id","tweet");gb(dt,"defaultProps",{id:"tweet",type:"tweet",parentId:"page",point:[0,0],size:[331,290],url:""});Nd([kf],dt.prototype,"embedId",1);Nd([hg],dt.prototype,"onTwitterLinkChange",2);var Yw=$e(ba(22)),Bv=ba(598),Ip=class extends vn{constructor(){super(...arguments);gb(this,"frameRef",Yw.createRef());gb(this,"canChangeAspectRatio",!0);gb(this,"canFlip",!0);gb(this,"canEdit",!0);gb(this,"ReactComponent",
Ze(({events:a,asset:d,isErasing:k,isEditing:G})=>{Yw.useRef(null);const {handlers:fa}=Yw.useContext(Gi);kg();const na=on();return(0,Bv.jsx)(Eo,Re(Ud({style:{overflow:"hidden",pointerEvents:"all",opacity:k?.2:1}},a),{children:d?(0,Bv.jsx)("embed",{src:fa?fa.inflateAsset(d.src).url:d.src,className:"relative tl-pdf-container",onWheelCapture:stop,onPointerDown:stop,onPointerUp:stop,style:{width:"100%",height:"100%",pointerEvents:!na&&G?"all":"none"}}):null}))}));gb(this,"ReactIndicator",Ze(()=>{const {props:{size:[a,
d],isLocked:k}}=this;return(0,Bv.jsx)("rect",{width:a,height:d,fill:"transparent",rx:8,ry:8,strokeDasharray:k?"8 2":"undefined"})}))}};gb(Ip,"id","pdf");gb(Ip,"defaultProps",{id:"pdf",type:"pdf",parentId:"page",point:[0,0],size:[595,842],assetId:""});ba(598);var Zw=[Qn,Ys,Wr,wv,Zr,at,ng,Po,fn,cr,dt,Xr,Ep,Ip,vk,Uw],Gm=class extends Oq{constructor(){super(...arguments);gb(this,"Shape",Qn)}};gb(Gm,"id","box");gb(Gm,"shortcut","whiteboard/rectangle");var et=class extends Oq{constructor(){super(...arguments);
gb(this,"Shape",Ys)}};gb(et,"id","ellipse");gb(et,"shortcut","whiteboard/ellipse");var gn=class extends Xv{};gb(gn,"id","erase");gb(gn,"shortcut","whiteboard/eraser");var iz=class extends Ju{constructor(){super(...arguments);gb(this,"Shape",Wr);gb(this,"simplify",!0);gb(this,"simplifyTolerance",.618)}};gb(iz,"id","highlighter");gb(iz,"shortcut","whiteboard/highlighter");var Hm=class extends Yv{constructor(){super(...arguments);gb(this,"Shape",at)}};gb(Hm,"id","line");gb(Hm,"shortcut","whiteboard/connector");
var pp=class extends Ju{constructor(){super(...arguments);gb(this,"Shape",ng);gb(this,"simplify",!1)}};gb(pp,"id","pencil");gb(pp,"shortcut","whiteboard/pencil");var jz=class extends Oq{constructor(){super(...arguments);gb(this,"Shape",Po)}};gb(jz,"id","polygon");var kz=class extends Zv{constructor(){super(...arguments);gb(this,"Shape",fn)}};gb(kz,"id","text");gb(kz,"shortcut","whiteboard/text");var hD=class extends Oq{constructor(){super(...arguments);gb(this,"Shape",cr)}};gb(hD,"id","youtube");
var ol=class extends ri{constructor(){super(...arguments);gb(this,"creatingShape");gb(this,"offset",[0,0]);gb(this,"onEnter",()=>{this.app.history.pause();ed(()=>{var a=Pd.sub(this.app.inputs.originPoint,this.offset);this.app.settings.snapToGrid&&(a=Pd.snap(a,8));this.creatingShape=a=new vk({id:Ij(),parentId:this.app.currentPage.id,point:a,size:vk.defaultProps.size,fill:this.app.settings.color,stroke:this.app.settings.color});this.app.currentPage.addShapes(a);this.app.setEditingShape(a);this.app.setSelectedShapes([a])})});
gb(this,"onPointerDown",a=>{switch(a.type){case "shape":if(a.shape===this.creatingShape)break;this.app.selectTool("select");break;case "canvas":a.order||this.app.selectTool("select")}});gb(this,"onExit",()=>{var a;this.creatingShape&&(this.app.history.resume(),(null==(a=this.creatingShape)?0:a.props.pageId)?this.app.setSelectedShapes([this.creatingShape.id]):(this.app.deleteShapes([this.creatingShape.id]),this.app.setEditingShape()),this.creatingShape=void 0)})}};gb(ol,"id","creating");var dr=class extends ri{constructor(){super(...arguments);
gb(this,"cursor","crosshair");gb(this,"onPointerDown",a=>{this.tool.transition("creating")})}};gb(dr,"id","idle");var xn=class extends Br{constructor(){super(...arguments);gb(this,"Shape",vk);gb(this,"onPinch",a=>{this.app.viewport.pinchZoom(a.point,a.delta,a.delta[2])})}};gb(xn,"id","logseq-portal");gb(xn,"shortcut","whiteboard/portal");gb(xn,"states",[dr,ol]);gb(xn,"initial","idle");var $w=class extends Oq{constructor(){super(...arguments);gb(this,"Shape",Ep)}};gb($w,"id","youtube");var Ch=class extends Oq{constructor(){super(...arguments);
gb(this,"Shape",Xr)}};gb(Ch,"id","iframe");var GH=$e(ba(601)),qp=ba(598),iD=new Map(Zw.map(a=>[a.id,a])),zh=class{constructor(a){gb(this,"shapes");gb(this,"pageId");gb(this,"assets");a&&this.load(a)}load(a){var d;const k=null==(d=null==a?void 0:a.pages)?void 0:d[0];this.pageId=null==k?void 0:k.id;this.assets=a.assets;this.shapes=null==k?void 0:k.shapes.map(G=>{var fa=G.type;if(!fa)throw Error("No shape type provided.");const na=iD.get(fa);if(!na)throw Error(`Could not find shape class for ${fa}`);
return new na(G)}).filter(G=>"group"!==G.type)}generatePreviewJsx(a,d){var k,G;const fa=[...(null!=(k=this.shapes)?k:[]).map(Za=>Za.getRotatedBounds())];(k=null==a?void 0:a.currentView)&&fa.push(k);let na=cf.getCommonBounds(fa);if(!na)return null;na=cf.expandBounds(na,16);na=d?cf.ensureRatio(na,d):na;const ta=Za=>[(Za[0]-na.minX).toFixed(2),(Za[1]-na.minY).toFixed(2)],[Ha,Sa]=k?ta([k.minX,k.minY]):[0,0];return na&&(0,qp.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg","data-common-bound-x":na.minX.toFixed(2),
"data-common-bound-y":na.minY.toFixed(2),"data-common-bound-width":na.width.toFixed(2),"data-common-bound-height":na.height.toFixed(2),viewBox:[0,0,na.width,na.height].join(" "),children:[(0,qp.jsx)("defs",{children:k&&(0,qp.jsxs)(qp.Fragment,{children:[(0,qp.jsx)("rect",{id:this.pageId+"-camera-rect",transform:`translate(${Ha}, ${Sa})`,width:k.width,height:k.height}),(0,qp.jsxs)("mask",{id:this.pageId+"-camera-mask",children:[(0,qp.jsx)("rect",{width:na.width,height:na.height,fill:"white"}),(0,qp.jsx)("use",
{href:`#${this.pageId}-camera-rect`,fill:"black"})]})]})}),(0,qp.jsx)("g",{id:this.pageId+"-preview-shapes",children:null==(G=this.shapes)?void 0:G.map(Za=>{var fb,ib;const {bounds:Bb,props:{rotation:Ob}}=Za,[Fb,cc]=ta([Bb.minX,Bb.minY]),oc=+(180*((null!=Ob?Ob:0)+(null!=(fb=Bb.rotation)?fb:0))/Math.PI).toFixed(2),[Xb,hc]=[(Bb.width/2).toFixed(2),(Bb.height/2).toFixed(2)];return(0,qp.jsx)("g",{transform:[`translate(${Fb}, ${cc})`,`rotate(${oc}, ${Xb}, ${hc})`].join(" "),children:Za.getShapeSVGJsx({assets:null!=
(ib=this.assets)?ib:[]})},Za.id)})}),(0,qp.jsx)("rect",{mask:k?`url(#${this.pageId}-camera-mask)`:"",width:na.width,height:na.height,fill:"transparent"}),k&&(0,qp.jsx)("use",{id:"minimap-camera-rect","data-x":Ha,"data-y":Sa,"data-width":k.width,"data-height":k.height,href:`#${this.pageId}-camera-rect`,fill:"transparent",stroke:"red",strokeWidth:4/a.camera.zoom})]})}exportAsSVG(a){return(a=this.generatePreviewJsx(void 0,a))?GH.default.renderToString(a):""}},qu=$e(ba(22)),Qo=ba(598),Jp=qu.forwardRef((a,
d)=>{var {value:k,className:G}=a;a=nf(a,["autoResize","value","className"]);return(0,Qo.jsx)("div",{className:"tl-input"+(G?" "+G:""),children:(0,Qo.jsxs)("div",{className:"tl-input-sizer",children:[(0,Qo.jsx)("div",{className:"tl-input-hidden",children:k}),(0,Qo.jsx)("input",Ud({ref:d,value:k,className:"tl-text-input",type:"text"},a))]})})}),Lh=ba(598),Kp=({type:a,active:d})=>(0,Lh.jsx)("span",{className:"tl-type-tag","data-active":d,children:(0,Lh.jsx)("i",{className:`tie tie-${({B:"block",P:"page",
WP:"whiteboard",BA:"new-block",PA:"new-page",WA:"new-whiteboard",BS:"block-search",PS:"page-search"})[a]}`})}),jD=(a,d)=>(0,Lh.jsx)("span",{children:a.split(new RegExp(`(${d.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$\x26")})`,"gi")).map((k,G)=>1===G%2?(0,Lh.jsx)("mark",{className:"tl-highlighted",children:k}):k).map((k,G)=>(0,Lh.jsx)(uk.default.Fragment,{children:k},G))}),HH=(a,d)=>{const {handlers:k}=uk.default.useContext(Gi),[G,fa]=uk.default.useState(null),na=En(a,200);uk.default.useEffect(()=>{let ta=
!1;if(0<na.length){const Ha={"pages?":!0,"blocks?":!0,"files?":!1};"B"===d?Ha["pages?"]=!1:"P"===d&&(Ha["blocks?"]=!1);k.search(na,Ha).then(Sa=>{ta||fa(Sa)})}else fa(null);return()=>{ta=!0}},[na,null==k?void 0:k.search]);return G},ft=Ze(({className:a,style:d,placeholder:k,onChange:G,onBlur:fa,onAddBlock:na})=>{const [ta,Ha]=uk.default.useState(vk.defaultSearchQuery),[Sa,Za]=uk.default.useState(vk.defaultSearchFilter),fb=uk.default.useRef(null),{handlers:ib,renderers:Bb}=uk.default.useContext(Gi),
Ob=ib.t,Fb=uk.default.useCallback(Vd=>{var te;setTimeout(()=>G(Vd));null==(te=fb.current)?void 0:te.blur();Vd&&(vk.defaultSearchQuery="",vk.defaultSearchFilter=null)},[]),cc=uk.default.useCallback(Vd=>{if(Vd=null==ib?void 0:ib.addNewBlock(Vd))Fb(Vd),null==na?void 0:na(Vd);return Vd},[na]),oc=uk.default.useRef(null),[Xb,hc]=uk.default.useState(0),ec=HH(ta,Sa),[Ec,Ic]=uk.default.useState("circle-plus"),[nd,Bd]=uk.default.useState(!1);uk.default.useEffect(()=>{setTimeout(()=>{var Vd;null==(Vd=fb.current)?
void 0:Vd.focus()})},[Sa]);uk.default.useEffect(()=>{vk.defaultSearchQuery=ta;vk.defaultSearchFilter=Sa},[ta,Sa]);const Ee=uk.default.useMemo(()=>{var Vd;const te=[],gf=null==Bb?void 0:Bb.Breadcrumb;if(!gf||!ib)return[];na&&te.push({actionIcon:"circle-plus",onChosen:()=>!!cc(ta),element:(0,Lh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Lh.jsx)(Kp,{active:!0,type:"BA"}),0<ta.length?(0,Lh.jsxs)(Lh.Fragment,{children:[(0,Lh.jsx)("strong",{children:Ob("whiteboard/new-block")}),ta]}):
(0,Lh.jsx)("strong",{children:Ob("whiteboard/new-block-no-colon")})]})});(null==(Vd=null==ec?void 0:ec.pages)?0:Vd.some(Be=>Be.toLowerCase()===ta.toLowerCase()))||!ta||te.push({actionIcon:"circle-plus",onChosen:()=>{Fb(ta);return!0},element:(0,Lh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Lh.jsx)(Kp,{active:!0,type:"PA"}),(0,Lh.jsx)("strong",{children:Ob("whiteboard/new-page")}),ta]})},{actionIcon:"circle-plus",onChosen:()=>{null==ib?void 0:ib.addNewWhiteboard(ta);Fb(ta);return!0},
element:(0,Lh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Lh.jsx)(Kp,{active:!0,type:"WA"}),(0,Lh.jsx)("strong",{children:Ob("whiteboard/new-whiteboard")}),ta]})});0===ta.length&&null===Sa&&te.push({actionIcon:"search",onChosen:()=>{Za("B");return!0},element:(0,Lh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Lh.jsx)(Kp,{type:"BS"}),Ob("whiteboard/search-only-blocks")]})},{actionIcon:"search",onChosen:()=>{Za("P");return!0},element:(0,Lh.jsxs)("div",{className:"tl-quick-search-option-row",
children:[(0,Lh.jsx)(Kp,{type:"PS"}),Ob("whiteboard/search-only-pages")]})});Sa&&"P"!==Sa||!ec||!ec.pages||te.push(...ec.pages.map(Be=>({actionIcon:"search",onChosen:()=>{Fb(Be);return!0},element:(0,Lh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Lh.jsx)(Kp,{type:ib.isWhiteboardPage(Be)?"WP":"P"}),jD(Be,ta)]})})));Sa&&"B"!==Sa||!ec||!ec.blocks||te.push(...ec.blocks.filter(Be=>Be.content&&Be.uuid).map(({content:Be,uuid:Fe})=>{const Fd=ib.queryBlockByUUID(Fe);return{actionIcon:"search",
onChosen:()=>{var bd,Gd,Zc;return Fd?(Fb(Fe),null==(Zc=null==(Gd=null==(bd=window.logseq)?void 0:bd.api)?void 0:Gd.set_blocks_id)?void 0:Zc.call(Gd,[Fe]),!0):!1},element:Fd?(0,Lh.jsxs)(Lh.Fragment,{children:[(0,Lh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Lh.jsx)(Kp,{type:"B"}),(0,Lh.jsx)("div",{className:"tl-quick-search-option-breadcrumb",children:(0,Lh.jsx)(gf,{blockId:Fe})})]}),(0,Lh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Lh.jsx)("div",{className:"tl-quick-search-option-placeholder"}),
jD(Be,ta)]})]}):(0,Lh.jsx)("div",{className:"tl-quick-search-option-row",children:Ob("whiteboard/cache-outdated")})}}));return te},[ta,Sa,ec,null==Bb?void 0:Bb.Breadcrumb,ib]);uk.default.useEffect(()=>{const Vd=te=>{var gf,Be;let Fe=Xb;"ArrowDown"===te.key?Fe=Math.min(Ee.length-1,Xb+1):"ArrowUp"===te.key?Fe=Math.max(0,Xb-1):"Enter"===te.key?(null==(gf=Ee[Xb])?void 0:gf.onChosen(),te.stopPropagation(),te.preventDefault()):"Backspace"===te.key&&0===ta.length?Za(null):"Escape"===te.key&&Fb("");Fe!==
Xb&&(gf=Ee[Fe],hc(Fe),Ic(gf.actionIcon),te.stopPropagation(),te.preventDefault(),(te=null==(Be=oc.current)?void 0:Be.querySelector(".tl-quick-search-option:nth-child("+(Fe+1)+")"))&&(null==te?void 0:te.scrollIntoViewIfNeeded(!1)))};document.addEventListener("keydown",Vd,!0);return()=>{document.removeEventListener("keydown",Vd,!0)}},[Ee,Xb,ta]);return(0,Lh.jsxs)("div",{className:"tl-quick-search "+(null!=a?a:""),style:d,children:[(0,Lh.jsx)(WG,{icon:Ec,onClick:()=>{var Vd;null==(Vd=Ee[Xb])?void 0:
Vd.onChosen()}}),(0,Lh.jsxs)("div",{className:"tl-quick-search-input-container",children:[Sa&&(0,Lh.jsxs)("div",{className:"tl-quick-search-input-filter",children:[(0,Lh.jsx)(Kp,{type:Sa}),"B"===Sa?"Search blocks":"Search pages",(0,Lh.jsx)("div",{className:"tl-quick-search-input-filter-remove",onClick:()=>Za(null),children:(0,Lh.jsx)(gh,{name:"x"})})]}),(0,Lh.jsx)(Jp,{ref:fb,type:"text",value:ta,className:"tl-quick-search-input",placeholder:null!=k?k:"Create or search your graph...",onChange:Vd=>
Ha(Vd.target.value),onKeyDown:Vd=>{"Enter"===Vd.key&&Fb(ta);Vd.stopPropagation()},onFocus:()=>{Bd(!0)},onBlur:()=>{Bd(!1);null==fa?void 0:fa()}})]}),0<Ee.length&&(0,Lh.jsx)("div",{onWheelCapture:Vd=>Vd.stopPropagation(),className:"tl-quick-search-options",ref:oc,style:{visibility:nd?"visible":"hidden",pointerEvents:nd?"all":"none"},children:(0,Lh.jsx)(Zy,{style:{height:40*Math.min(Math.max(1,Ee.length),12)},totalCount:Ee.length,itemContent:Vd=>{const {actionIcon:te,onChosen:gf,element:Be}=Ee[Vd];
return(0,Lh.jsx)("div",{"data-focused":Vd===Xb,className:"tl-quick-search-option",tabIndex:0,onMouseEnter:()=>{Ic(te);hc(Vd)},onPointerDownCapture:Fe=>{gf()&&(Fe.stopPropagation(),Fe.preventDefault())},children:Be},Vd)}})})]})}),si=ba(598),ax=Ze(function(a){var {pageId:d,portalType:k,refs:G,side:fa,onRefsChange:na}=a;a=nf(a,"pageId portalType shapeType refs side onRefsChange".split(" "));const {handlers:{t:ta}}=Py.default.useContext(Gi),Ha=G.length+(d?1:0),Sa=0===G.length,Za=ib=>{ib&&!G.includes(ib)&&
Sa&&na([...G,ib])},fb=!(!d||!k);return(0,si.jsx)(Kn,Re(Ud({},a),{side:fa,align:"start",alignOffset:-6,label:(0,si.jsx)(Gj,{content:ta("whiteboard/link"),sideOffset:14,children:(0,si.jsxs)("div",{className:"flex gap-1 relative items-center justify-center px-1",children:[(0,si.jsx)(gh,{name:0<Ha?"link":"add-link"}),0<Ha&&(0,si.jsx)("div",{className:"tl-shape-links-count",children:Ha})]})}),children:(0,si.jsxs)("div",{className:"color-level rounded-lg","data-show-reference-panel":fb,children:[fb&&(0,si.jsxs)("div",
{className:"tl-shape-links-reference-panel",children:[(0,si.jsxs)("div",{className:"text-base inline-flex gap-1 items-center",children:[(0,si.jsx)(gh,{className:"opacity-50",name:"internal-link"}),ta("whiteboard/references")]}),(0,si.jsx)(Mm,{type:k,id:d})]}),(0,si.jsxs)("div",{className:"tl-shape-links-panel color-level",children:[(0,si.jsxs)("div",{className:"text-base inline-flex gap-1 items-center",children:[(0,si.jsx)(gh,{className:"opacity-50",name:"add-link"}),ta("whiteboard/link-to-any-page-or-block")]}),
Sa&&(0,si.jsx)(ft,{style:{width:"calc(100% - 46px)",marginLeft:"46px"},placeholder:ta("whiteboard/start-typing-to-search"),onChange:Za}),0<G.length&&(0,si.jsx)("div",{className:"flex flex-col items-stretch gap-2",children:G.map((ib,Bb)=>(0,si.jsx)(Mm,{id:ib,type:Hl(ib)?"B":"P",onRemove:()=>{na(G.filter((Ob,Fb)=>Bb!==Fb))},showContent:!0},ib))})]})]})}))}),Yj=$e(ba(22)),[Cv]=Ji("ToggleGroup",[lw]),Dv=lw(),kD=Yj.default.forwardRef((a,d)=>{const {type:k}=a;a=nf(a,["type"]);if("single"===k)return Yj.default.createElement(IH,
He({},a,{ref:d}));if("multiple"===k)return Yj.default.createElement(JH,He({},a,{ref:d}));throw Error("Missing prop `type` expected on `ToggleGroup`");}),[lz,Lp]=Cv("ToggleGroup"),IH=Yj.default.forwardRef((a,d)=>{const {value:k,defaultValue:G,onValueChange:fa=()=>{}}=a,na=nf(a,["value","defaultValue","onValueChange"]),[ta,Ha]=Fh({prop:k,defaultProp:G,onChange:fa});return Yj.default.createElement(lz,{scope:a.__scopeToggleGroup,type:"single",value:ta?[ta]:[],onItemActivate:Ha,onItemDeactivate:Yj.default.useCallback(()=>
Ha(""),[Ha])},Yj.default.createElement(mD,He({},na,{ref:d})))}),JH=Yj.default.forwardRef((a,d)=>{const {value:k,defaultValue:G,onValueChange:fa=()=>{}}=a,na=nf(a,["value","defaultValue","onValueChange"]),[ta=[],Ha]=Fh({prop:k,defaultProp:G,onChange:fa}),Sa=Yj.default.useCallback(fb=>Ha((ib=[])=>[...ib,fb]),[Ha]),Za=Yj.default.useCallback(fb=>Ha((ib=[])=>ib.filter(Bb=>Bb!==fb)),[Ha]);return Yj.default.createElement(lz,{scope:a.__scopeToggleGroup,type:"multiple",value:ta,onItemActivate:Sa,onItemDeactivate:Za},
Yj.default.createElement(mD,He({},na,{ref:d})))}),[KH,lD]=Cv("ToggleGroup"),mD=Yj.default.forwardRef((a,d)=>{const {__scopeToggleGroup:k,disabled:G=!1,rovingFocus:fa=!0,orientation:na,dir:ta,loop:Ha=!0}=a;var Sa=nf(a,"__scopeToggleGroup disabled rovingFocus orientation dir loop".split(" "));a=Dv(k);const Za=Vn(ta);Sa=Ud({role:"group",dir:Za},Sa);return Yj.default.createElement(KH,{scope:k,rovingFocus:fa,disabled:G},fa?Yj.default.createElement(YB,He({asChild:!0},a,{orientation:na,dir:Za,loop:Ha}),
Yj.default.createElement(Gk.div,He({},Sa,{ref:d}))):Yj.default.createElement(Gk.div,He({},Sa,{ref:d})))}),Ev=Yj.default.forwardRef((a,d)=>{var k=Lp("ToggleGroupItem",a.__scopeToggleGroup);const G=lD("ToggleGroupItem",a.__scopeToggleGroup),fa=Dv(a.__scopeToggleGroup);k=k.value.includes(a.value);const na=G.disabled||a.disabled;a=Re(Ud({},a),{pressed:k,disabled:na});const ta=Yj.default.useRef(null);return G.rovingFocus?Yj.default.createElement(ZB,He({asChild:!0},fa,{focusable:!na,active:k,ref:ta}),Yj.default.createElement(nD,
He({},a,{ref:d}))):Yj.default.createElement(nD,He({},a,{ref:d}))}),nD=Yj.default.forwardRef((a,d)=>{const {__scopeToggleGroup:k,value:G}=a,fa=nf(a,["__scopeToggleGroup","value"]),na=Lp("ToggleGroupItem",k);a={role:"radio","aria-checked":a.pressed,"aria-pressed":void 0};return Yj.default.createElement(SB,He({},"single"===na.type?a:void 0,fa,{ref:d,onPressedChange:ta=>{if(ta)na.onItemActivate(G);else na.onItemDeactivate(G)}}))}),oD=kD,pD=Ev,er=ba(598),Ph=ba(598),Fv="EditPdf LogseqPortalViewMode Geometry AutoResizing Swatch NoFill StrokeType ScaleLevel TextStyle YoutubeLink TwitterLink IFrameSource ArrowMode Links".split(" "),
qD=["YoutubeLink","TwitterLink","IFrameSource","Links","EditPdf"],Tn=new Map,mz={"logseq-portal":["Swatch","LogseqPortalViewMode","ScaleLevel","AutoResizing","Links"],youtube:["YoutubeLink","Links"],tweet:["TwitterLink","Links"],iframe:["IFrameSource","Links"],box:"Geometry TextStyle Swatch ScaleLevel NoFill StrokeType Links".split(" "),ellipse:"Geometry TextStyle Swatch ScaleLevel NoFill StrokeType Links".split(" "),polygon:"Geometry TextStyle Swatch ScaleLevel NoFill StrokeType Links".split(" "),
line:["TextStyle","Swatch","ScaleLevel","ArrowMode","Links"],pencil:["Swatch","Links","ScaleLevel"],highlighter:["Swatch","Links","ScaleLevel"],text:["TextStyle","Swatch","ScaleLevel","AutoResizing","Links"],html:["ScaleLevel","AutoResizing","Links"],image:["Links"],video:["Links"],pdf:["EditPdf","Links"]},LH=Object.entries(mz).filter(([,a])=>a.includes("NoFill")&&a.includes("Swatch")).map(([a])=>a),MH=Ze(()=>{const a=kg(),{handlers:{t:d}}=Tl.default.useContext(Gi),k=Wa("AutoResizing"),G=k.every(fa=>
fa.props.isAutoResizing);return(0,Ph.jsx)(yi,{tooltip:d("whiteboard/auto-resize"),toggle:k.every(fa=>"logseq-portal"===fa.props.type),className:"tl-button",pressed:G,onPressedChange:fa=>{k.forEach(na=>{if("logseq-portal"===na.props.type)na.update({isAutoResizing:fa});else na.onResetBounds({zoom:a.viewport.camera.zoom})});a.persist()},children:(0,Ph.jsx)(gh,{name:"dimensions"})})}),NH=Ze(()=>{const a=kg();var {handlers:{t:d}}=Tl.default.useContext(Gi);const k=Wa("LogseqPortalViewMode"),G=k.every(fa=>
fa.collapsed);if(!G&&!k.every(fa=>!fa.collapsed))return null;d=(0,Ph.jsxs)("div",{className:"flex",children:[G?d("whiteboard/expand"):d("whiteboard/collapse"),(0,Ph.jsx)(bn,{action:G?"editor/expand-block-children":"editor/collapse-block-children"})]});return(0,Ph.jsx)(yi,{tooltip:d,toggle:k.every(fa=>"logseq-portal"===fa.props.type),className:"tl-button",pressed:G,onPressedChange:()=>a.api.setCollapsed(!G),children:(0,Ph.jsx)(gh,{name:G?"object-expanded":"object-compact"})})}),OH=Ze(()=>{const {handlers:{isMobile:a}}=
Tl.default.useContext(Gi);var d=Wa("ScaleLevel");d=1<(new Set(d.map(k=>k.scaleLevel))).size?"":d[0].scaleLevel;return(0,Ph.jsx)(Uo,{scaleLevel:d,compact:a()})}),PH=Ze(()=>{const a=kg(),{handlers:{t:d}}=Tl.default.useContext(Gi),k=Wa("IFrameSource")[0],G=Tl.default.useCallback(na=>{k.onIFrameSourceChange(na.target.value.trim().toLowerCase());a.persist()},[]),fa=Tl.default.useCallback(()=>{k.reload()},[]);return(0,Ph.jsxs)("span",{className:"flex gap-3",children:[(0,Ph.jsx)(ig,{tooltip:d("whiteboard/reload"),
type:"button",onClick:fa,children:(0,Ph.jsx)(gh,{name:"refresh"})}),(0,Ph.jsx)(Jp,{title:d("whiteboard/website-url"),className:"tl-iframe-src",value:`${k.props.url}`,onChange:G}),(0,Ph.jsx)(ig,{tooltip:d("whiteboard/open-website-url"),type:"button",onClick:()=>window.open(k.props.url),children:(0,Ph.jsx)(gh,{name:"external-link"})})]})}),vq=Ze(()=>{const a=kg(),{handlers:{t:d}}=Tl.default.useContext(Gi),k=Wa("YoutubeLink")[0],G=Tl.default.useCallback(fa=>{k.onYoutubeLinkChange(fa.target.value);a.persist()},
[]);return(0,Ph.jsxs)("span",{className:"flex gap-3",children:[(0,Ph.jsx)(Jp,{title:d("whiteboard/youtube-url"),className:"tl-youtube-link",value:`${k.props.url}`,onChange:G}),(0,Ph.jsx)(ig,{tooltip:d("whiteboard/open-youtube-url"),type:"button",onClick:()=>{var fa,na,ta;return null==(ta=null==(na=null==(fa=window.logseq)?void 0:fa.api)?void 0:na.open_external_link)?void 0:ta.call(na,k.props.url)},children:(0,Ph.jsx)(gh,{name:"external-link"})})]})}),QH=Ze(()=>{const a=kg(),{handlers:{t:d}}=Tl.default.useContext(Gi),
k=Wa("TwitterLink")[0],G=Tl.default.useCallback(fa=>{k.onTwitterLinkChange(fa.target.value);a.persist()},[]);return(0,Ph.jsxs)("span",{className:"flex gap-3",children:[(0,Ph.jsx)(Jp,{title:d("whiteboard/twitter-url"),className:"tl-twitter-link",value:`${k.props.url}`,onChange:G}),(0,Ph.jsx)(ig,{tooltip:d("whiteboard/open-twitter-url"),type:"button",onClick:()=>{var fa,na,ta;return null==(ta=null==(na=null==(fa=window.logseq)?void 0:fa.api)?void 0:na.open_external_link)?void 0:ta.call(na,k.props.url)},
children:(0,Ph.jsx)(gh,{name:"external-link"})})]})}),RH=Ze(()=>{const a=kg(),{handlers:{t:d,setCurrentPdf:k}}=Tl.default.useContext(Gi),G=a.selectedShapesArray[0];return(0,Ph.jsx)(ig,{tooltip:d("whiteboard/edit-pdf"),type:"button",onClick:()=>k(a.assets[G.props.assetId].src),children:(0,Ph.jsx)(gh,{name:"edit"})})}),SH=Ze(()=>{const a=kg(),{handlers:{t:d}}=Tl.default.useContext(Gi);var k=Wa("NoFill");const G=Tl.default.useCallback(fa=>{a.selectedShapesArray.forEach(na=>na.update({noFill:fa}));a.persist()},
[]);k=k.every(fa=>fa.props.noFill);return(0,Ph.jsx)(yi,{tooltip:d("whiteboard/fill"),className:"tl-button",pressed:k,onPressedChange:G,children:(0,Ph.jsx)(gh,{name:k?"droplet-off":"droplet"})})}),TH=Ze(()=>{const a=kg(),d=Wa("Swatch"),k=Tl.default.useCallback(fa=>{a.selectedShapesArray.forEach(na=>{na.update({fill:fa,stroke:fa})});a.persist()},[]),G=Tl.default.useCallback(fa=>{a.selectedShapesArray.forEach(na=>{na.update({opacity:fa})});a.persist()},[]);return(0,Ph.jsx)(Wm,{popoverSide:"top",color:d[0].props.noFill?
d[0].props.stroke:d[0].props.fill,opacity:d[0].props.opacity,setOpacity:G,setColor:k})}),UH=Ze(()=>{const a=kg(),d=Tl.default.useCallback(k=>{a.api.convertShapes(k.currentTarget.dataset.tool)},[]);return(0,Ph.jsx)(Ay,{popoverSide:"top",chevron:!1,setGeometry:d})}),VH=Ze(()=>{const a=kg(),{handlers:{t:d}}=Tl.default.useContext(Gi),k=Wa("StrokeType"),G=k.every(fa=>"dashed"===fa.props.strokeType)?"dashed":k.every(fa=>"line"===fa.props.strokeType)?"line":"mixed";return(0,Ph.jsx)(ka,{title:d("whiteboard/stroke-type"),
options:[{value:"line",icon:"circle",tooltip:"Solid"},{value:"dashed",icon:"circle-dashed",tooltip:"Dashed"}],value:G,onValueChange:fa=>{k.forEach(na=>{na.update({strokeType:fa})});a.persist()}})}),rD=Ze(()=>{const a=kg(),{handlers:{t:d}}=Tl.default.useContext(Gi),k=Wa("ArrowMode");var G=k.every(na=>{var ta;return"arrow"===(null==(ta=na.props.decorations)?void 0:ta.start)});const fa=k.every(na=>{var ta;return"arrow"===(null==(ta=na.props.decorations)?void 0:ta.end)});G=[G?"start":null,fa?"end":null].filter(Zf);
return(0,Ph.jsx)(Ca,{title:d("whiteboard/arrow-head"),options:[{value:"start",icon:"arrow-narrow-left"},{value:"end",icon:"arrow-narrow-right"}],value:G,onValueChange:na=>{k.forEach(ta=>{var Ha=ta.update;var Sa={start:na.includes("start")?"arrow":null,end:na.includes("end")?"arrow":null};Ha.call(ta,{decorations:Sa})});a.persist()}})}),WH=Ze(()=>{const a=kg(),{handlers:{t:d}}=Tl.default.useContext(Gi),k=Wa("TextStyle"),G=k.every(na=>500<na.props.fontWeight),fa=k.every(na=>na.props.italic);return(0,Ph.jsxs)("span",
{className:"flex gap-1",children:[(0,Ph.jsx)(yi,{tooltip:d("whiteboard/bold"),className:"tl-button",pressed:G,onPressedChange:na=>{k.forEach(ta=>{ta.update({fontWeight:na?700:400});ta.onResetBounds()});a.persist()},children:(0,Ph.jsx)(gh,{name:"bold"})}),(0,Ph.jsx)(yi,{tooltip:d("whiteboard/italic"),className:"tl-button",pressed:fa,onPressedChange:na=>{k.forEach(ta=>{ta.update({italic:na});ta.onResetBounds()});a.persist()},children:(0,Ph.jsx)(gh,{name:"italic"})})]})}),XH=Ze(()=>{var a;const d=kg(),
k=d.selectedShapesArray[0];return(0,Ph.jsx)(ax,{onRefsChange:G=>{k.update({refs:G});d.persist()},refs:null!=(a=k.props.refs)?a:[],shapeType:k.props.type,side:"right",pageId:"logseq-portal"===k.props.type?k.props.pageId:void 0,portalType:"logseq-portal"===k.props.type?k.props.blockType:void 0})});Tn.set("Geometry",UH);Tn.set("AutoResizing",MH);Tn.set("LogseqPortalViewMode",NH);Tn.set("ScaleLevel",OH);Tn.set("YoutubeLink",vq);Tn.set("TwitterLink",QH);Tn.set("IFrameSource",PH);Tn.set("NoFill",SH);Tn.set("Swatch",
TH);Tn.set("StrokeType",VH);Tn.set("ArrowMode",rD);Tn.set("TextStyle",WH);Tn.set("Links",XH);Tn.set("EditPdf",RH);var sD=a=>{var d;return(null!=(d=mz[a])?d:[]).filter(Zf)},tD=a=>{const d=a.map(G=>G.props.type),k=new Set(0<a.length?sD(d[0]):[]);for(let G=1;G<d.length&&0<k.size;G++){const fa=sD(d[G]);k.forEach(na=>{fa.includes(na)||k.delete(na)})}1<a.length&&qD.forEach(G=>{k.has(G)&&k.delete(G)});return Array.from(k).sort((G,fa)=>Fv.indexOf(G)-Fv.indexOf(fa)).map(G=>Tn.get(G))},Gv=ba(598),YH=Ze(({shapes:a,
offsets:d,hidden:k})=>{const G=kg(),fa=Mo.useRef(null),na=Mo.useRef(null);Mo.useLayoutEffect(()=>{setTimeout(()=>{const Ha=na.current;if(Ha){var {offsetWidth:Sa,offsetHeight:Za}=Ha;fa.current=[Sa,Za]}})});Mo.useLayoutEffect(()=>{var Ha;const Sa=na.current;if(Sa){var Za=null!=(Ha=fa.current)?Ha:[0,0];Ha=0;if(116>d.top){var fb=d.height/2+40;140>d.bottom&&(fb+=d.bottom-140)}else fb=-(d.height/2+40);16>d.left+d.width/2-Za[0]/2?Ha+=-(d.left+d.width/2-Za[0]/2-16):16>d.right+d.width/2-Za[0]/2&&(Ha+=d.right+
d.width/2-Za[0]/2-16);var [ib,Bb]=[Ha,fb];Sa.style.transform=`translateX(${ib}px) translateY(${Bb}px)`}},[d]);if(!G)return null;const ta=tD(a);return(0,Gv.jsx)(Eo,{centered:!0,children:0<ta.length&&(0,Gv.jsx)("div",{ref:na,className:"tl-toolbar tl-context-bar",style:{visibility:k?"hidden":"visible",pointerEvents:k?"none":"all"},children:ta.map((Ha,Sa)=>(0,Gv.jsxs)(Mo.Fragment,{children:[(0,Gv.jsx)(Ha,{}),Sa<ta.length-1&&(0,Gv.jsx)(Kr,{className:"tl-toolbar-separator",orientation:"vertical"})]},Sa))})})}),
bx=$e(ba(22)),pl=ba(22),[ZH]=Ji("ContextMenu",[Ot]),ru=Ot(),[uD,su]=ZH("ContextMenu"),Hv=(0,pl.forwardRef)((a,d)=>{const {__scopeContextMenu:k,disabled:G=!1}=a,fa=nf(a,["__scopeContextMenu","disabled"]),na=su("ContextMenuTrigger",k),ta=ru(k),Ha=(0,pl.useRef)({x:0,y:0}),Sa=(0,pl.useRef)({getBoundingClientRect:()=>DOMRect.fromRect(Ud({width:0,height:0},Ha.current))}),Za=(0,pl.useRef)(0),fb=(0,pl.useCallback)(()=>window.clearTimeout(Za.current),[]);(0,pl.useEffect)(()=>fb,[fb]);(0,pl.useEffect)(()=>
void(G&&fb()),[G,fb]);return(0,pl.createElement)(pl.Fragment,null,(0,pl.createElement)(Ns,He({},ta,{virtualRef:Sa})),(0,pl.createElement)(Gk.span,He({"data-state":na.open?"open":"closed","data-disabled":G?"":void 0},fa,{ref:d,style:Ud({WebkitTouchCallout:"none"},a.style),onContextMenu:G?a.onContextMenu:Lf(a.onContextMenu,ib=>{fb();Ha.current={x:ib.clientX,y:ib.clientY};na.onOpenChange(!0);ib.preventDefault()}),onPointerDown:G?a.onPointerDown:Lf(a.onPointerDown,Pb(ib=>{fb();Za.current=window.setTimeout(()=>
{Ha.current={x:ib.clientX,y:ib.clientY};na.onOpenChange(!0)},700)})),onPointerMove:G?a.onPointerMove:Lf(a.onPointerMove,Pb(fb)),onPointerCancel:G?a.onPointerCancel:Lf(a.onPointerCancel,Pb(fb)),onPointerUp:G?a.onPointerUp:Lf(a.onPointerUp,Pb(fb))})))}),nz=(0,pl.forwardRef)((a,d)=>{var {__scopeContextMenu:k}=a;const G=nf(a,["__scopeContextMenu"]),fa=su("ContextMenuContent",k);k=ru(k);const na=(0,pl.useRef)(!1);return(0,pl.createElement)(Tu,He({},k,G,{ref:d,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:ta=>
{var Ha;null===(Ha=a.onCloseAutoFocus)||void 0===Ha||Ha.call(a,ta);!ta.defaultPrevented&&na.current&&ta.preventDefault();na.current=!1},onInteractOutside:ta=>{var Ha;null===(Ha=a.onInteractOutside)||void 0===Ha||Ha.call(a,ta);ta.defaultPrevented||fa.modal||(na.current=!0)},style:Re(Ud({},a.style),{["--radix-context-menu-content-transform-origin"]:"var(--radix-popper-transform-origin)"})}))}),ql=(0,pl.forwardRef)((a,d)=>{var {__scopeContextMenu:k}=a;a=nf(a,["__scopeContextMenu"]);k=ru(k);return(0,pl.createElement)(uw,
He({},k,a,{ref:d}))}),fr=(0,pl.forwardRef)((a,d)=>{var {__scopeContextMenu:k}=a;a=nf(a,["__scopeContextMenu"]);k=ru(k);return(0,pl.createElement)(iC,He({},k,a,{ref:d}))}),$H=a=>{const {__scopeContextMenu:d,children:k,onOpenChange:G,dir:fa,modal:na=!0}=a,[ta,Ha]=(0,pl.useState)(!1);a=ru(d);const Sa=Ei(G),Za=(0,pl.useCallback)(fb=>{Ha(fb);Sa(fb)},[Sa]);return(0,pl.createElement)(uD,{scope:d,open:ta,onOpenChange:Za,modal:na},(0,pl.createElement)(ty,He({},a,{dir:fa,open:ta,onOpenChange:Za,modal:na}),
k))},pf=ba(598),as=Ze(function({children:a,collisionRef:d}){var k,G,fa,na,ta,Ha,Sa,Za,fb,ib,Bb,Ob,Fb,cc,oc,Xb,hc;const ec=kg(),{handlers:Ec}=bx.useContext(Gi),Ic=Ec.t,nd=bx.useRef(null),Bd=Vd=>{Vd();ec.transition("select")},Ee=bx.useMemo(()=>wf(),[]);return(0,pf.jsxs)($H,{onOpenChange:Vd=>{Vd&&!ec.isIn("select.contextMenu")?ec.transition("select").selectedTool.transition("contextMenu"):!Vd&&ec.isIn("select.contextMenu")&&ec.selectedTool.transition("idle")},children:[(0,pf.jsx)(Hv,{disabled:ec.editingShape&&
0!==Object.keys(ec.editingShape).length,children:a}),(0,pf.jsx)(nz,{className:"tl-menu tl-context-menu",ref:nd,onEscapeKeyDown:()=>ec.transition("select"),collisionBoundary:d.current,asChild:!0,tabIndex:-1,children:(0,pf.jsxs)("div",{children:[1<(null==(k=ec.selectedShapes)?void 0:k.size)&&!ec.readOnly&&(null==(G=ec.selectedShapesArray)?void 0:G.some(Vd=>!Vd.props.isLocked))&&(0,pf.jsxs)(pf.Fragment,{children:[(0,pf.jsxs)(ql,{children:[(0,pf.jsxs)("div",{className:"tl-menu-button-row pb-0",children:[(0,pf.jsx)(ig,
{tooltip:Ic("whiteboard/align-left"),onClick:()=>Bd(()=>ec.align("left")),children:(0,pf.jsx)(gh,{name:"layout-align-left"})}),(0,pf.jsx)(ig,{tooltip:Ic("whiteboard/align-center-horizontally"),onClick:()=>Bd(()=>ec.align("centerHorizontal")),children:(0,pf.jsx)(gh,{name:"layout-align-center"})}),(0,pf.jsx)(ig,{tooltip:Ic("whiteboard/align-right"),onClick:()=>Bd(()=>ec.align("right")),children:(0,pf.jsx)(gh,{name:"layout-align-right"})}),(0,pf.jsx)(Kr,{className:"tl-toolbar-separator",orientation:"vertical"}),
(0,pf.jsx)(ig,{tooltip:Ic("whiteboard/distribute-horizontally"),onClick:()=>Bd(()=>ec.distribute("horizontal")),children:(0,pf.jsx)(gh,{name:"layout-distribute-vertical"})})]}),(0,pf.jsxs)("div",{className:"tl-menu-button-row pt-0",children:[(0,pf.jsx)(ig,{tooltip:Ic("whiteboard/align-top"),onClick:()=>Bd(()=>ec.align("top")),children:(0,pf.jsx)(gh,{name:"layout-align-top"})}),(0,pf.jsx)(ig,{tooltip:Ic("whiteboard/align-center-vertically"),onClick:()=>Bd(()=>ec.align("centerVertical")),children:(0,pf.jsx)(gh,
{name:"layout-align-middle"})}),(0,pf.jsx)(ig,{tooltip:Ic("whiteboard/align-bottom"),onClick:()=>Bd(()=>ec.align("bottom")),children:(0,pf.jsx)(gh,{name:"layout-align-bottom"})}),(0,pf.jsx)(Kr,{className:"tl-toolbar-separator",orientation:"vertical"}),(0,pf.jsx)(ig,{tooltip:Ic("whiteboard/distribute-vertically"),onClick:()=>Bd(()=>ec.distribute("vertical")),children:(0,pf.jsx)(gh,{name:"layout-distribute-horizontal"})})]})]}),(0,pf.jsx)(fr,{className:"menu-separator"}),(0,pf.jsxs)(ql,{className:"tl-menu-item",
onClick:()=>Bd(ec.packIntoRectangle),children:[(0,pf.jsx)(gh,{className:"tl-menu-icon",name:"layout-grid"}),Ic("whiteboard/pack-into-rectangle")]}),(0,pf.jsx)(fr,{className:"menu-separator"})]}),0<(null==(fa=ec.selectedShapes)?void 0:fa.size)&&(0,pf.jsxs)(pf.Fragment,{children:[(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(ec.api.zoomToSelection),children:[Ic("whiteboard/zoom-to-fit"),(0,pf.jsx)(bn,{action:"whiteboard/zoom-to-fit"})]}),(0,pf.jsx)(fr,{className:"menu-separator"})]}),(ec.selectedShapesArray.some(Vd=>
"group"===Vd.type||ec.getParentGroup(Vd))||1<ec.selectedShapesArray.length)&&(null==(na=ec.selectedShapesArray)?void 0:na.some(Vd=>!Vd.props.isLocked))&&!ec.readOnly&&(0,pf.jsxs)(pf.Fragment,{children:[ec.selectedShapesArray.some(Vd=>"group"===Vd.type||ec.getParentGroup(Vd))&&(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(ec.api.unGroup),children:[(0,pf.jsx)(gh,{className:"tl-menu-icon",name:"ungroup"}),Ic("whiteboard/ungroup"),(0,pf.jsx)(bn,{action:"whiteboard/ungroup"})]}),1<ec.selectedShapesArray.length&&
(null==(ta=ec.selectedShapesArray)?void 0:ta.some(Vd=>!Vd.props.isLocked))&&(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(ec.api.doGroup),children:[(0,pf.jsx)(gh,{className:"tl-menu-icon",name:"group"}),Ic("whiteboard/group"),(0,pf.jsx)(bn,{action:"whiteboard/group"})]}),(0,pf.jsx)(fr,{className:"menu-separator"})]}),0<(null==(Ha=ec.selectedShapes)?void 0:Ha.size)&&(null==(Sa=ec.selectedShapesArray)?void 0:Sa.some(Vd=>!Vd.props.isLocked))&&(0,pf.jsxs)(pf.Fragment,{children:[!ec.readOnly&&
(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(ec.cut),children:[(0,pf.jsx)(gh,{className:"tl-menu-icon",name:"cut"}),Ic("whiteboard/cut")]}),(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(ec.copy),children:[(0,pf.jsx)(gh,{className:"tl-menu-icon",name:"copy"}),Ic("whiteboard/copy"),(0,pf.jsx)(bn,{action:"editor/copy"})]})]}),!ec.readOnly&&(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(ec.paste),children:[(0,pf.jsx)(gh,{className:"tl-menu-icon",name:"clipboard"}),Ic("whiteboard/paste"),
(0,pf.jsx)("div",{className:"tl-menu-right-slot",children:(0,pf.jsx)("span",{className:"keyboard-shortcut",children:(0,pf.jsxs)("code",{children:[CA,"+v"]})})})]}),1===(null==(Za=ec.selectedShapes)?void 0:Za.size)&&!ec.readOnly&&(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(()=>ec.paste(void 0,!0)),children:[Ic("whiteboard/paste-as-link"),(0,pf.jsx)("div",{className:"tl-menu-right-slot",children:(0,pf.jsx)("span",{className:"keyboard-shortcut",children:(0,pf.jsxs)("code",{children:[CA,"+⇧+v"]})})})]}),
0<(null==(fb=ec.selectedShapes)?void 0:fb.size)&&(0,pf.jsxs)(pf.Fragment,{children:[(0,pf.jsx)(fr,{className:"menu-separator"}),(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(()=>{var Vd,te;return Ec.exportToImage(ec.currentPageId,{x:ec.selectionBounds.minX+ec.viewport.camera.point[0]-8,y:ec.selectionBounds.minY+ec.viewport.camera.point[1]-8,width:(null==(Vd=ec.selectionBounds)?void 0:Vd.width)+16,height:(null==(te=ec.selectionBounds)?void 0:te.height)+16,zoom:ec.viewport.camera.zoom})}),
children:[(0,pf.jsx)(gh,{className:"tl-menu-icon",name:"file-export"}),Ic("whiteboard/export"),(0,pf.jsx)("div",{className:"tl-menu-right-slot",children:(0,pf.jsx)("span",{className:"keyboard-shortcut"})})]})]}),(0,pf.jsx)(fr,{className:"menu-separator"}),(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(ec.api.selectAll),children:[Ic("whiteboard/select-all"),(0,pf.jsx)(bn,{action:"editor/select-parent"})]}),1<(null==(ib=ec.selectedShapes)?void 0:ib.size)&&(0,pf.jsx)(ql,{className:"tl-menu-item",
onClick:()=>Bd(ec.api.deselectAll),children:Ic("whiteboard/deselect-all")}),!ec.readOnly&&0<(null==(Bb=ec.selectedShapes)?void 0:Bb.size)&&(null==(Ob=ec.selectedShapesArray)?void 0:Ob.some(Vd=>!Vd.props.isLocked))&&(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(()=>ec.setLocked(!0)),children:[(0,pf.jsx)(gh,{className:"tl-menu-icon",name:"lock"}),Ic("whiteboard/lock"),(0,pf.jsx)(bn,{action:"whiteboard/lock"})]}),!ec.readOnly&&0<(null==(Fb=ec.selectedShapes)?void 0:Fb.size)&&(null==(cc=ec.selectedShapesArray)?
void 0:cc.some(Vd=>Vd.props.isLocked))&&(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(()=>ec.setLocked(!1)),children:[(0,pf.jsx)(gh,{className:"tl-menu-icon",name:"lock-open"}),Ic("whiteboard/unlock"),(0,pf.jsx)(bn,{action:"whiteboard/unlock"})]}),0<(null==(oc=ec.selectedShapes)?void 0:oc.size)&&!ec.readOnly&&(null==(Xb=ec.selectedShapesArray)?void 0:Xb.some(Vd=>!Vd.props.isLocked))&&(0,pf.jsxs)(pf.Fragment,{children:[(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(ec.api.deleteShapes),
children:[(0,pf.jsx)(gh,{className:"tl-menu-icon",name:"backspace"}),Ic("whiteboard/delete"),(0,pf.jsx)(bn,{action:"editor/delete"})]}),1<(null==(hc=ec.selectedShapes)?void 0:hc.size)&&!ec.readOnly&&(0,pf.jsxs)(pf.Fragment,{children:[(0,pf.jsx)(fr,{className:"menu-separator"}),(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(ec.flipHorizontal),children:[(0,pf.jsx)(gh,{className:"tl-menu-icon",name:"flip-horizontal"}),Ic("whiteboard/flip-horizontally")]}),(0,pf.jsxs)(ql,{className:"tl-menu-item",
onClick:()=>Bd(ec.flipVertical),children:[(0,pf.jsx)(gh,{className:"tl-menu-icon",name:"flip-vertical"}),Ic("whiteboard/flip-vertically")]})]}),!ec.readOnly&&(0,pf.jsxs)(pf.Fragment,{children:[(0,pf.jsx)(fr,{className:"menu-separator"}),(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(ec.bringToFront),children:[Ic("whiteboard/move-to-front"),(0,pf.jsx)(bn,{action:"whiteboard/bring-to-front"})]}),(0,pf.jsxs)(ql,{className:"tl-menu-item",onClick:()=>Bd(ec.sendToBack),children:[Ic("whiteboard/move-to-back"),
(0,pf.jsx)(bn,{action:"whiteboard/send-to-back"})]})]}),Ee&&(0,pf.jsx)(ql,{className:"tl-menu-item",onClick:()=>{1===ec.selectedShapesArray.length?console.log(yc(ec.selectedShapesArray[0].serialized)):console.log(ec.selectedShapesArray.map(Vd=>yc(Vd.serialized)))},children:Ic("whiteboard/dev-print-shape-props")})]})]})})]})}),wq=$e(ba(22)),cx=ba(598),vD=Ze(({shape:a})=>{const d=kg(),{handlers:k}=wq.default.useContext(Gi),G=k.t,fa=wq.default.useMemo(()=>{var na;const ta=[...(null!=(na=a.props.refs)?
na:[])].map(Ha=>[Ha,!0]);"logseq-portal"===a.props.type&&a.props.pageId&&ta.unshift([a.props.pageId,!1]);return ta.filter(Ha=>Ha[0].toLowerCase()!==d.currentPage.name&&k.getBlockPageName(Ha[0])!==d.currentPage.name)},[a.props.id,a.props.type,a.props.parentId,a.props.refs]);return 0===fa.length?null:(0,cx.jsx)("div",{className:"tl-quick-links",title:G("whiteboard/shape-quick-links"),children:fa.map(([na,ta])=>(0,cx.jsx)("div",{className:"tl-quick-links-row",children:(0,cx.jsx)(Qy,{id:na,showReferenceContent:ta})},
na))})}),aI=$e(ba(22)),wD=$e(ba(22)),gr={image:[".png",".svg",".jpg",".jpeg",".gif"],video:[".mp4",".webm",".ogg"],pdf:[".pdf"]},xD=(a,d,k)=>Nh(void 0,[a,d,k],function*(G,{point:fa,shiftKey:na,dataTransfer:ta,fromDrop:Ha},Sa){function Za(Zc,td){return Nh(this,null,function*(){const we=Object.values(G.assets).find(Te=>Te.src===Zc);return we?we:{id:Ij(),type:td,src:Zc,size:yield rj(Sa.makeAssetUrl(Zc),td)}})}function fb(Zc){return Nh(this,null,function*(){const td=Zc.filter(we=>"unknown"!==mc(we.name)).map(we=>
Nh(this,null,function*(){try{const Te=yield Sa.saveAsset(we);return yield Za(Te,mc(we.name))}catch(Te){console.error(Te)}return null}));return(yield Promise.all(td)).filter(Zf)})}function ib(Zc){return[Re(Ud({},Ep.defaultProps),{html:Zc,point:[fa[0],fa[1]]})]}function Bb(Zc){return Nh(this,null,function*(){return Bc(Fb,cc,hc,Xb,ec,oc,Ee)(Zc)})}function Ob(){return Nh(this,null,function*(){const Zc=yield navigator.clipboard.read(),td=Bc(ec,oc,Ee);return(yield Promise.all(Zc.map(we=>td(we)))).flat().filter(Zf)})}
function Fb(Zc){return Nh(this,null,function*(){var td=Zc.getData("file");if(!td)return null;const we=yield Za(td,"pdf");G.addAssets([we]);td=Re(Ud({},Ip.defaultProps),{id:Ij(),assetId:we.id,url:td,opacity:1});we.size&&Object.assign(td,{point:[fa[0]-we.size[0]/4+16,fa[1]-we.size[1]/4+16],size:Pd.div(we.size,2)});return[td]})}function cc(Zc){return Nh(this,null,function*(){var td=Array.from(Zc.files);return 0<td.length?(gf=td=yield fb(td),td.map((we,Te)=>{switch(we.type){case "video":var vf=Zr.defaultProps;
break;case "image":vf=wv.defaultProps;break;case "pdf":vf=Ip.defaultProps;break;default:return null}vf=Re(Ud({},vf),{id:Ij(),assetId:we.id,opacity:1});we.size&&Object.assign(vf,{point:[fa[0]-we.size[0]/4+16*Te,fa[1]-we.size[1]/4+16*Te],size:Pd.div(we.size,2)});return vf})):null})}function oc(Zc){return Nh(this,null,function*(){if(Zc.types.includes("text/plain")&&(na||Ha))return null;const td=yield id(Zc,"text/html");return td?Bc(Ec,ib)(td):null})}function Xb(Zc){return Nh(this,null,function*(){var td,
we,Te,vf,hf,Mf,Ig=Zc.getData("block-uuid");if(Ig){Ig=Ig.trim();const qf=null==(Te=null==(we=null==(td=window.logseq)?void 0:td.api)?void 0:we.get_selected_blocks)?void 0:Te.call(we);td=qf&&1<(null==qf?void 0:qf.length)?qf.map(Cg=>Cg.uuid):[Ig];null==(Mf=null==(hf=null==(vf=window.logseq)?void 0:vf.api)?void 0:hf.set_blocks_id)?void 0:Mf.call(hf,td);vf=td.map(Cg=>Bd(`((${Cg}))`));return(yield Promise.all(vf)).flat().filter(Zf).map((Cg,dh)=>Re(Ud({},Cg),{point:[fa[0]+(vk.defaultProps.size[0]+16)*dh,
fa[1]]}))}return null})}function hc(Zc){return Nh(this,null,function*(){var td=Zc.getData("page-name");return td?(td=td.trim(),Bd(`[[${td}]]`)):null})}function ec(Zc){return Nh(this,null,function*(){var td=yield id(Zc,"text/plain");return td?(td=td.trim(),Bc(Ic,nd)(td)):null})}function Ec(Zc){if(Zc=G.api.getClonedShapesFromTldrString(decodeURIComponent(Zc),fa)){const {shapes:td,assets:we,bindings:Te}=Zc;Be.push(...we);Fe.push(...Te);return td}return null}function Ic(Zc){return Nh(this,null,function*(){try{const we=
new URL(Zc);var td=we.host&&["http:","https:"].includes(we.protocol)}catch(we){td=!1}return td&&!na?Av.test(Zc)?[Re(Ud({},cr.defaultProps),{url:Zc,point:[fa[0],fa[1]]})]:Xw.test(Zc)?[Re(Ud({},dt.defaultProps),{url:Zc,point:[fa[0],fa[1]]})]:[Re(Ud({},Xr.defaultProps),{url:Zc,point:[fa[0],fa[1]]})]:null})}function nd(Zc){return Zc.startsWith("\x3ciframe")?[Re(Ud({},Ep.defaultProps),{html:Zc,point:[fa[0],fa[1]]})]:null}function Bd(Zc){return Nh(this,null,function*(){if(/^\(\(.*\)\)$/.test(Zc)&&40===
Zc.length){var td=Zc.slice(2,-2);if(Hl(td))return[Re(Ud({},vk.defaultProps),{point:[fa[0],fa[1]],size:[400,0],pageId:td,fill:G.settings.color,stroke:G.settings.color,scaleLevel:G.settings.scaleLevel,blockType:"B"})]}else if(/^\[\[.*\]\]$/.test(Zc))return td=Zc.slice(2,-2),[Re(Ud({},vk.defaultProps),{point:[fa[0],fa[1]],size:[400,0],pageId:td,fill:G.settings.color,stroke:G.settings.color,scaleLevel:G.settings.scaleLevel,blockType:"P"})];return null})}function Ee(Zc){return Nh(this,null,function*(){var td=
yield id(Zc,"text/plain");return td&&(td=td.trim(),td=null==Sa?void 0:Sa.addNewBlock(td))?[Re(Ud({},vk.defaultProps),{size:[400,0],point:[fa[0],fa[1]],pageId:td,fill:G.settings.color,stroke:G.settings.color,scaleLevel:G.settings.scaleLevel,blockType:"B",compact:!0})]:null})}var Vd,te;let gf=[],Be=[];const Fe=[];G.cursors.setCursor("progress");let Fd=[];try{ta?Fd.push(...(null!=(Vd=yield Bb(ta))?Vd:[])):Fd.push(...(null!=(te=yield Ob())?te:[]))}catch(Zc){console.error(Zc)}const bd=Fd.map(Zc=>Re(Ud({},
Zc),{parentId:G.currentPageId,isLocked:!1,id:Hl(Zc.id)?Zc.id:Ij()})),Gd=null==ta?void 0:ta.types.every(Zc=>"Files"===Zc);G.wrapUpdate(()=>{var Zc=[...gf,...Be];0<Zc.length&&G.createAssets(Zc);0<bd.length&&G.createShapes(bd);G.currentPage.updateBindings(Object.fromEntries(Fe.map(td=>[td.id,td])));if(1===G.selectedShapesArray.length&&1===bd.length&&Ha){Zc=G.selectedShapesArray[0];const td=G.getShapeById(bd[0].id);G.createNewLineBinding(Zc,td)}G.setSelectedShapes(bd.map(td=>td.id));G.selectedTool.transition("idle");
G.cursors.setCursor("default");(Ha||Gd)&&G.packIntoRectangle()})}),dx=$e(ba(22)),ex=$e(ba(22)),Mp=ba(598),yD=[Gm,et,jz,gn,iz,Hm,pp,kz,hD,Ch,$w,xn],zD=a=>{const {renderers:d}=Lt.useContext(Gi);return(0,Mp.jsx)(d.BacklinksCount,Re(Ud({},a),{options:{"portal?":!1}}))},AD=()=>{const a=Lt.useRef(null),d=kg(),k=Lt.useMemo(()=>({ContextBar:YH,BacklinksCount:zD,QuickLinks:vD}),[]);return(0,Mp.jsx)(as,{collisionRef:a,children:(0,Mp.jsx)("div",{ref:a,className:"logseq-tldraw logseq-tldraw-wrapper","data-tlapp":d.uuid,
children:(0,Mp.jsx)(cG,{components:k,children:(0,Mp.jsx)(FC,{})})})})},BD=a=>{var {onPersist:d,readOnly:k,model:G}=a;a=nf(a,["onPersist","readOnly","model"]);const fa=Td(),na=Cd(),ta=me(),Ha=k?null:Je(),Sa=Lt.useCallback((Za,fb)=>{null==d?void 0:d(Za,fb)},[G]);return(0,Mp.jsx)(ZF,Re(Ud({Shapes:Zw,Tools:yD,onDrop:fa,onPaste:na,onCopy:ta,readOnly:k,onCanvasDBClick:Ha,onPersist:Sa,model:G},a),{children:(0,Mp.jsx)(AD,{})}))},CD=function(a){var {renderers:d,handlers:k}=a;a=nf(a,["renderers","handlers"]);
const G={renderers:Lt.useMemo(()=>Object.fromEntries(Object.entries(d).map(([fa,na])=>[fa,Lt.memo(na)])),[]),handlers:k};return(0,Mp.jsx)(Gi.Provider,{value:G,children:(0,Mp.jsx)(BD,Ud({},a))})}};
'use strict';var Rvd=function(a){return a},Svd=function(a,b){return $APP.ki.j(function(c){var d=$APP.Nf(c);c=$APP.G.j(d,$APP.$B);d=$APP.G.j(d,$APP.HE);return new $APP.l(null,2,[$APP.Sl,$APP.t.A(c),$APP.hNb,$APP.ky.j(d,new $APP.O(null,2,5,$APP.P,[$APP.mD,$APP.hNb],null))],null)},$APP.wg.j(function(c){return $APP.mD.A($APP.HE.A(c))},$APP.x2a(a,b,new $APP.l(null,1,[$APP.ct,new $APP.O(null,2,5,$APP.P,[$APP.$B,$APP.HE],null)],null))))},Tvd=function(a){return $APP.zq.F(a,$APP.F([$APP.Aq,!0]))},Uvd=function(a,
b,c,d){var e=$APP.AF(a);b=new $APP.l(null,2,[$APP.nD,$APP.qob,$APP.oD,new $APP.l(null,6,[$APP.Sl,$APP.sa(b,"id"),$APP.cq,$APP.sa(b,"name"),$APP.oG,Tvd($APP.sa(b,"bindings")),$APP.hNb,$APP.sa(b,"nonce"),$APP.iNb,Tvd(c),$APP.eNb,d],null)],null);c=$APP.Aw();e=$APP.RF.A(e);e=$APP.n(e)?e:$APP.Aw();return new $APP.l(null,5,[$APP.jr,a,$APP.fF,"whiteboard",$APP.HE,b,$APP.SF,c,$APP.RF,e],null)},Vvd=function(a,b,c,d,e,f){a=Tvd(a.getCleanUpAssets());var g=b.shapes,h=$APP.ki.j(function(E){return $APP.sa(E,"id")},
g),m=$APP.Nh(h,$APP.bk.A(g.length));g=$APP.Kh($APP.ki.j(function(E){E=$APP.Nf(E);E=$APP.G.j(E,$APP.Sl);return $APP.T.C(Tvd(b.getShapeById(E).serialized),$APP.Bx,$APP.G.j(m,E))},$APP.Sz.j(c,d)));d=$APP.Kh($APP.ki.j($APP.Sl,d));var p=$APP.Kh($APP.ki.j($APP.Sl,c)),q=$APP.Kh($APP.Wm.j($APP.xk,$APP.Sz.j(p,d)));c=$APP.Kh($APP.wg.j(function(E){E=$APP.Sl.A(E);return q.A?q.A(E):q.call(null,E)},g));var r=$APP.Wm.j($APP.xk,$APP.Sz.j(d,p)),u=$APP.aB();d=$APP.x(r)?$APP.ki.j(function(E){return $APP.ky.j(E,new $APP.O(null,
2,5,$APP.P,[$APP.HE,$APP.mD],null))},function(){var E=new $APP.O(null,1,5,$APP.P,[$APP.Sy],null),H=$APP.ak.j(function(K){return new $APP.O(null,2,5,$APP.P,[$APP.$B,$APP.Mi(K)],null)},r);return $APP.PD?$APP.PD(u,E,H):$APP.QD.call(null,u,E,H)}()):null;p=$APP.ak.j(function(E){return new $APP.O(null,2,5,$APP.P,[$APP.DMa,new $APP.O(null,2,5,$APP.P,[$APP.$B,$APP.Mi(E)],null)],null)},r);var y=$APP.Sz.j(g,c),z=$APP.x(y)?function(){var E=new $APP.O(null,1,5,$APP.P,[$APP.Sy],null),H=$APP.ak.j(function(K){return new $APP.O(null,
2,5,$APP.P,[$APP.$B,$APP.Mi($APP.Sl.A(K))],null)},y);return $APP.PD?$APP.PD(u,E,H):$APP.QD.call(null,u,E,H)}():null;return new $APP.l(null,4,[$APP.bBc,Uvd(e,b,a,h),$APP.JQc,$APP.ki.j(function(E){return $APP.je(q,$APP.t.A($APP.$B.A(E)))?$APP.T.C(E,$APP.SF,$APP.Aw()):$APP.Wzb(E)},$APP.ki.j(function(E){E=new $APP.l(null,2,[$APP.nD,$APP.wK,$APP.mD,E],null);E=new $APP.l(null,3,[$APP.OD,new $APP.l(null,1,[$APP.jr,$APP.ir.A?$APP.ir.A(e):$APP.ir.call(null,e)],null),$APP.YD,new $APP.l(null,1,[$APP.jr,e],null),
$APP.HE,E],null);var H=$APP.wob(E,e);return $APP.jm.F($APP.F([E,H]))},g)),$APP.lE,p,$APP.k4b,new $APP.l(null,3,[$APP.SJb,$APP.xb(f),$APP.izb,f,$APP.Mv,new $APP.l(null,5,[$APP.yK,e,$APP.yNb,d,$APP.zNb,c,$APP.ANb,y,$APP.BNb,z],null)],null)],null)},Wvd=function(a,b,c){var d=$APP.Sc($APP.A(b.pages)),e=d.shapes,f=$APP.AF(a);f=$APP.ky.j(f,new $APP.O(null,3,5,$APP.P,[$APP.HE,$APP.oD,$APP.eNb],null));var g=$APP.Nh(f,$APP.bk.A($APP.Oc(f)));e=$APP.Kh($APP.$n.j(function(q,r){var u=r.id;return new $APP.l(null,
2,[$APP.Sl,u,$APP.hNb,$APP.B.j(q,$APP.G.j(g,u))?r.nonce:Date.now()],null)},e));var h=$APP.aB();f=function(){var q=$APP.ky.j($APP.v($APP.ngd),new $APP.O(null,2,5,$APP.P,[h,a],null));return $APP.n(q)?q:$APP.Kh($APP.ki.j(function(r){return $APP.sr.C(r,$APP.Sl,$APP.t)},Svd(h,a)))}();b=Vvd(b,d,e,f,a,c);f=$APP.Nf(b);d=$APP.G.j(f,$APP.bBc);b=$APP.G.j(f,$APP.JQc);c=$APP.G.j(f,$APP.lE);f=$APP.G.j(f,$APP.k4b);d=$APP.ql.F(c,new $APP.O(null,1,5,$APP.P,[d],null),$APP.F([b]));var m=$APP.ky.j(f,new $APP.O(null,
2,5,$APP.P,[$APP.Mv,$APP.zNb],null)),p=$APP.ky.j(f,new $APP.O(null,2,5,$APP.P,[$APP.Mv,$APP.yNb],null));m=$APP.n($APP.Yf(function(q){return $APP.B.j("group",$APP.Ym.A(q))},m))?$APP.T.C(f,$APP.CNb,$APP.Dv):$APP.n(function(){var q=$APP.Of(p);return $APP.n(q)?$APP.Xf(function(r){return $APP.B.j("group",$APP.Ym.A(r))},p):q}())?$APP.T.C(f,$APP.CNb,$APP.hCc):$APP.n($APP.Yf(function(q){return $APP.B.j("line",$APP.Ym.A(q))&&$APP.B.j("arrow ",$APP.Po.A($APP.Xzc.A(q)))},m))?$APP.T.C(f,$APP.CNb,$APP.QMc):f;
b=$APP.x($APP.ql.j(b,c))?m:$APP.T.C(f,$APP.u0a,!0);$APP.ui.J($APP.ngd,$APP.ev,new $APP.O(null,2,5,$APP.P,[h,a],null),e);if($APP.je(new $APP.Gh(null,new $APP.l(null,1,[$APP.QMc,null],null),null),$APP.CNb.A(b)))return $APP.bB($APP.z2c,new $APP.l(null,2,[$APP.qy,d,$APP.k4b,b],null));e=$APP.z2c.A($APP.v($APP.YA));$APP.ql.j($APP.qy.A(e),d);$APP.jm.F($APP.F([b,$APP.k4b.A(e)]));$APP.bB($APP.z2c,$APP.Mf);return null},Xvd=function(a){a=$APP.v2a(a);return $APP.Wm.j($APP.oob,a)},Yvd=function(a){var b=$APP.ry.A($APP.AF(a));
a=Xvd(a);a=$APP.wg.j(function(d){return $APP.B.j(b,$APP.ry.A($APP.YD.A(d)))},a);var c=$APP.Kh($APP.Wm.j($APP.ub,$APP.ki.j(function(d){return $APP.ky.C(d,new $APP.O(null,2,5,$APP.P,[$APP.ZD,$APP.ry],null),null)},a)));a=$APP.Wm.j(function(d){d=$APP.ry.A(d);return c.A?c.A(d):c.call(null,d)},a);return $APP.x(a)?$APP.A(a):null},Zvd=function(){return $APP.xm(null,function(){return $APP.xm(fetch("./whiteboard/onboarding.edn"),function(a){return $APP.xm(a.text(),function(b){return $APP.xm($APP.pr($APP.Mf,
b),function(c){return $APP.rm(c)})})})})},$vd=function(a){var b=$APP.r4a();return($APP.ud(b)||$APP.B.j(1,$APP.Oc(b))&&$APP.B.j(a,$APP.jr.A($APP.A(b))))&&$APP.xb($APP.ky.j($APP.v($APP.YA),new $APP.O(null,1,5,$APP.P,[$APP.hXa],null)))},awd=function(a){return null!=a?$APP.Am($APP.xm(null,function(){return $APP.xm(Zvd(),function(b){var c=$APP.Nf(b);b=$APP.G.j(c,$APP.PF);c=$APP.G.j(c,$APP.xw);var d=$APP.A(b);b=$APP.fNb(d,c);d=$APP.nob(d);c=$APP.iNb.A(d);d=$APP.oG.A(d);a.cloneShapesIntoCurrentPage($APP.wj(new $APP.l(null,
3,[$APP.qNb,b,$APP.iNb,c,$APP.oG,d],null)));b=$APP.jXa();return $APP.rm(b)})}),function(b){return console.warn("Failed to populate onboarding whiteboard",b)}):null},bwd=function(a){a.cleanup($APP.ki.j(function(b){return b.id},a.shapes))},ewd=function(a,b){b=$APP.zq.F(b,$APP.F([new $APP.l(null,1,[$APP.Aq,!0],null)]));b=$APP.Nf(b);var c=$APP.G.j(b,cwd),d=$APP.G.j(b,$APP.JH),e=$APP.G.j(b,dwd),f=$APP.aB();return $APP.xm(null,function(){return $APP.xm($APP.n(d)?$APP.Cib(f,a,new $APP.l(null,1,[$APP.cx,
100],null)):null,function(g){return $APP.xm($APP.n(c)?$APP.Hib(a,10):null,function(h){return $APP.xm($APP.n(e)?$APP.Jib(a,100):null,function(m){return $APP.rm($APP.wj(new $APP.l(null,3,[$APP.PF,h,$APP.xw,g,$APP.oI,m],null)))})})})})},fwd=function(a){return $APP.wm($APP.ZGb($APP.aB(),new $APP.O(null,1,5,$APP.P,[$APP.zq.A(a)],null)),function(b){var c=(c=$APP.x(b))?$APP.A(b):c;return $APP.n(c)?(b=$APP.C.C(c,0,null),$APP.C.C(c,1,null),c=$APP.C.C(c,2,null),$APP.aHb($APP.n(c)?c:b)):null})},gwd=function(){return $APP.WJb(null)},
hwd=function(){return $APP.YJb(null)},ywd=function(a){return $APP.rh([iwd,jwd,kwd,lwd,mwd,nwd,owd,pwd,$APP.sC,qwd,rwd,swd,twd,$APP.xY,uwd,vwd,wwd,xwd],[function(b){return $APP.jr.A($APP.B2a($APP.aB(),$APP.nj(b)))},function(b){return $APP.wj($APP.v1b(b))},function(b){return $APP.BF(b,!1)},function(b){return $APP.sXa($APP.n(b)?$APP.v1b(b):null)},function(b){return $APP.jNb(b)},$APP.Uw,function(b){return $APP.UFb(b,new $APP.l(null,1,[$APP.GO,!1],null))},$APP.NF,ewd,fwd,Rvd,function(b,c){return $APP.uw(b,
$APP.F([$APP.ww,c]))},function(b){var c=$APP.t,d=c.A,e=$APP.qA(),f=$APP.AF(a),g=Yvd(a);b=new $APP.l(null,6,[$APP.ZD,$APP.Ch($APP.n(g)?g:f,new $APP.O(null,1,5,$APP.P,[$APP.ry],null)),$APP.$B,e,$APP.XB,$APP.n(b)?b:"",$APP.pE,$APP.kr,$APP.OD,new $APP.l(null,2,[$APP.jr,$APP.ir.A?$APP.ir.A(a):$APP.ir.call(null,a),$APP.Ew,a],null),$APP.YD,new $APP.l(null,1,[$APP.jr,a],null)],null);$APP.RD(new $APP.O(null,1,5,$APP.P,[b],null));return d.call(c,e)},function(b){return $APP.II.F($APP.F([$APP.li.A(b)]))},function(b,
c){return $APP.oC(function(){return(0,$APP.mZb)(b,$APP.jm.F($APP.F([$APP.zq.F(c,$APP.F([$APP.Aq,!0])),new $APP.l(null,1,[$APP.HO,!0],null)])))})},function(b,c){return $APP.VB($APP.aB(),$APP.ry.A($APP.AF(b)),$APP.li.A(c))},function(b){var c=$APP.cw(b)?$APP.jr.A($APP.B2a($APP.aB(),$APP.nj(b))):null;c=$APP.n(c)?c:b;var d=$APP.vF(c),e=$APP.NF(c);return $APP.n(d)?$APP.n(e)?$APP.$J(c,new $APP.l(null,1,[$APP.ZJ,b],null)):$APP.YJ($APP.BF(b,!1)):null},function(b){return $APP.wj($APP.ZE($APP.nj(b)))}])},xwd=
new $APP.N(null,"queryBlockByUUID","queryBlockByUUID",2091812895),uwd=new $APP.N(null,"exportToImage","exportToImage",-154356643),twd=new $APP.N(null,"addNewBlock","addNewBlock",1426762680),zwd=new $APP.N(null,"KeyboardShortcut","KeyboardShortcut",1250004264),dwd=new $APP.N(null,"files?","files?",-1267491104),iwd=new $APP.N(null,"getBlockPageName","getBlockPageName",-1656908032),Awd=new $APP.N(null,"renderers","renderers",-1460292282),Bwd=new $APP.N(null,"model","model",331153215),kwd=new $APP.N(null,
"getRedirectPageName","getRedirectPageName",-1858136925),nwd=new $APP.N(null,"isMobile","isMobile",-2043133877),lwd=new $APP.N(null,"setCurrentPdf","setCurrentPdf",-63289336),Cwd=new $APP.N(null,"onMount","onMount",-876858467),owd=new $APP.N(null,"insertFirstPageBlock","insertFirstPageBlock",-1676658548),rwd=new $APP.N(null,"makeAssetUrl","makeAssetUrl",217779988),Dwd=new $APP.N(null,"onPersist","onPersist",-1848738852),Ewd=new $APP.N(null,"Breadcrumb","Breadcrumb",-1351298906),swd=new $APP.N(null,
"copyToClipboard","copyToClipboard",1092115063),wwd=new $APP.N(null,"redirectToPage","redirectToPage",87147838),mwd=new $APP.N(null,"addNewWhiteboard","addNewWhiteboard",554297706),qwd=new $APP.N(null,"saveAsset","saveAsset",-668047853),Fwd=new $APP.N(null,"BacklinksCount","BacklinksCount",364670631),Gwd=new $APP.N(null,"Block","Block",-1959785792),vwd=new $APP.N(null,"sidebarAddBlock","sidebarAddBlock",-1204903203),Hwd=new $APP.N(null,"Page","Page",-1267059506),cwd=new $APP.N(null,"pages?","pages?",
-2065014049),Iwd=new $APP.N(null,"PageName","PageName",-164991013),Jwd=new $APP.N(null,"Tweet","Tweet",-452258680),pwd=new $APP.N(null,"isWhiteboardPage","isWhiteboardPage",-134150579),Kwd=new $APP.N(null,"BlockReference","BlockReference",-120254741),jwd=new $APP.N(null,"inflateAsset","inflateAsset",-1449040639);$APP.gda("tldraw");var Lwd=$APP.Hm(602);var Mwd,Nwd;$APP.tmd={};Mwd=$APP.fP($APP.sa(Lwd,"App"));$APP.wmd=$APP.sa(Lwd,"generateJSXFromModel");
Nwd=new $APP.l(null,8,[Hwd,$APP.Jr($APP.Nr,function(a){return(0,$APP.wld)(new $APP.l(null,2,[$APP.yK,$APP.BF($APP.sa(a,"pageName"),!1),$APP.HO,!0],null))},null,"frontend.extensions.tldraw/page-cp"),Gwd,$APP.Jr($APP.Nr,function(a){a=$APP.Mi($APP.sa(a,"blockId"));var b=$APP.uWa($APP.Wfc);a=b.A?b.A(a):b.call(null,a);return $APP.xr(a)},null,"frontend.extensions.tldraw/block-cp"),Ewd,$APP.Jr($APP.Nr,function(a){return $APP.xr($APP.FR(new $APP.l(null,1,[$APP.ZV,!0],null),$APP.aB(),$APP.Mi($APP.sa(a,"blockId")),
new $APP.l(null,2,[$APP.g6b,$APP.sa(a,"endSeparator"),$APP.h6b,$APP.sa(a,"levelLimit",3)],null)))},null,"frontend.extensions.tldraw/breadcrumb"),Jwd,$APP.Jr($APP.Nr,function(a){return(0,$APP.X4b)($APP.sa(a,"tweetId"))},null,"frontend.extensions.tldraw/tweet"),Iwd,$APP.Jr($APP.Nr,function(a){return(0,$APP.rR)(new $APP.l(null,1,[$APP.ZV,!0],null),new $APP.l(null,1,[$APP.jr,$APP.sa(a,"pageName")],null))},null,"frontend.extensions.tldraw/page-name-link"),Fwd,function(a){return $APP.$f.j($APP.zmd,$APP.ki.j(function(b){return $APP.zq.F($APP.sa(a,
b),$APP.F([new $APP.l(null,1,[$APP.Aq,!0],null)]))},new $APP.O(null,3,5,$APP.P,["id","className","options"],null)))},Kwd,$APP.Jr($APP.Nr,function(a){return(0,$APP.g4b)($APP.Mf,$APP.sa(a,"blockId"),null)},null,"frontend.extensions.tldraw/block-reference"),zwd,$APP.Jr($APP.Nr,function(a){a=$APP.mP($APP.li.A($APP.sa(a,"action")));return"string"===typeof a?$APP.xr($APP.jP(a)):$APP.xr($APP.yp.j(" | ",$APP.ki.j($APP.jP,a)))},null,"frontend.extensions.tldraw/keyboard-shortcut")],null);
$APP.umd=$APP.Jr($APP.Nr,function(a,b){function c(m){if($APP.n(m)){m.appUndo=gwd;m.appRedo=hwd;var p=$APP.sa(m,"api");return $APP.n(p)?$APP.wm(d?awd(p):null,function(){bwd(m.currentPage);$APP.tXa(m,b);return h.A?h.A(m):h.call(null,m)}):null}return null}var d=$vd(a),e=$APP.rNb(a),f=$APP.Tr(null),g=$APP.C.C(f,0,null),h=$APP.C.C(f,1,null);$APP.Ur(function(){$APP.n($APP.n(g)?b:g)&&$APP.tXa(g,b);return function(){return $APP.uc}},new $APP.O(null,2,5,$APP.P,[b,g],null));return $APP.n(e)?$APP.W("div",{style:{overscrollBehavior:"none"},
onBlur:function(m){m=$APP.sa(m,"target").tagName;var p=new $APP.Gh(null,new $APP.l(null,2,["INPUT",null,"TEXTAREA",null],null),null);m=p.A?p.A(m):p.call(null,m);return $APP.n(m)?$APP.ZB():null},onWheel:$APP.ow,className:"draw tldraw whiteboard relative w-full h-full"},[d&&$APP.xb(g)?$APP.W("div",{style:{zIndex:200},className:"absolute inset-0 flex items-center justify-center"},[$APP.xr($APP.qP("Loading onboarding whiteboard ..."))]):null,$APP.xr(function(){var m=new $APP.l(null,6,[Awd,Nwd,$APP.pRa,
ywd(a),Cwd,c,$APP.jSc,!0,Dwd,function(p,q){$APP.bB(new $APP.O(null,2,5,$APP.P,[$APP.iUc,$APP.aB()],null),$APP.Aw());return $APP.n(!1)?(console.time("tldraw persist"),p=Wvd(a,p,q.replace),console.timeEnd("tldraw persist"),p):Wvd(a,p,q.replace)},Bwd,e],null);return Mwd.A?Mwd.A(m):Mwd.call(null,m)}())]):null},null,"frontend.extensions.tldraw/tldraw-app");$APP.Ra.Wi();
}).call(this);