(function(){
shadow$provide[614]=function(wa,aa,Pa,Q){function w(u,y,z){var A,P={},g=null,h=null;void 0!==z&&(g=""+z);void 0!==y.key&&(g=""+y.key);void 0!==y.ref&&(h=y.ref);for(A in y)p.call(y,A)&&!c.hasOwnProperty(A)&&(P[A]=y[A]);if(u&&u.defaultProps)for(A in y=u.defaultProps,y)void 0===P[A]&&(P[A]=y[A]);return{$$typeof:Y,type:u,key:g,ref:h,props:P,_owner:B.current}}aa(239);wa=aa(0);var Y=60103;Q.Fragment=60107;"function"===typeof Symbol&&Symbol.for&&(aa=Symbol.for,Y=aa("react.element"),Q.Fragment=aa("react.fragment"));
var B=wa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p=Object.prototype.hasOwnProperty,c={key:!0,ref:!0,__self:!0,__source:!0};Q.jsx=w;Q.jsxs=w};
shadow$provide[616]=function(wa,aa,Pa,Q){Pa.exports=aa(614)};
shadow$provide[617]=function(wa,aa,Pa,Q){function w(dc){for(var Nc="https://reactjs.org/docs/error-decoder.html?invariant\x3d"+dc,Qc=1;Qc<arguments.length;Qc++)Nc+="\x26args[]\x3d"+encodeURIComponent(arguments[Qc]);return"Minified React error #"+dc+"; visit "+Nc+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Y(dc){if(null==dc)return null;if("function"===typeof dc)return dc.displayName||dc.name||null;if("string"===typeof dc)return dc;
switch(dc){case R:return"Fragment";case S:return"Portal";case F:return"Profiler";case G:return"StrictMode";case ia:return"Suspense";case U:return"SuspenseList"}if("object"===typeof dc)switch(dc.$$typeof){case M:return(dc.displayName||"Context")+".Consumer";case N:return(dc._context.displayName||"Context")+".Provider";case I:var Nc=dc.render;Nc=Nc.displayName||Nc.name||"";return dc.displayName||(""!==Nc?"ForwardRef("+Nc+")":"ForwardRef");case Z:return Y(dc.type);case V:return Y(dc._render);case ba:Nc=
dc._payload;dc=dc._init;try{return Y(dc(Nc))}catch(Qc){}}return null}function B(dc,Nc){for(var Qc=dc._threadCount|0;Qc<=Nc;Qc++)dc[Qc]=dc._currentValue2,dc._threadCount=Qc+1}function p(dc,Nc,Qc,Ad){if(Ad&&(Ad=dc.contextType,"object"===typeof Ad&&null!==Ad))return B(Ad,Qc),Ad[Qc];if(dc=dc.contextTypes){Qc={};for(var Xc in dc)Qc[Xc]=Nc[Xc];Nc=Qc}else Nc=ua;return Nc}function c(dc){if(Ha.call(Xa,dc))return!0;if(Ha.call(Ja,dc))return!1;if(xa.test(dc))return Xa[dc]=!0;Ja[dc]=!0;return!1}function u(dc,
Nc,Qc,Ad){if(null!==Qc&&0===Qc.type)return!1;switch(typeof Nc){case "function":case "symbol":return!0;case "boolean":if(Ad)return!1;if(null!==Qc)return!Qc.acceptsBooleans;dc=dc.toLowerCase().slice(0,5);return"data-"!==dc&&"aria-"!==dc;default:return!1}}function y(dc,Nc,Qc,Ad){if(null===Nc||"undefined"===typeof Nc||u(dc,Nc,Qc,Ad))return!0;if(Ad)return!1;if(null!==Qc)switch(Qc.type){case 3:return!Nc;case 4:return!1===Nc;case 5:return isNaN(Nc);case 6:return isNaN(Nc)||1>Nc}return!1}function z(dc,Nc,
Qc,Ad,Xc,sc,Sc){this.acceptsBooleans=2===Nc||3===Nc||4===Nc;this.attributeName=Ad;this.attributeNamespace=Xc;this.mustUseProperty=Qc;this.propertyName=dc;this.type=Nc;this.sanitizeURL=sc;this.removeEmptyString=Sc}function A(dc){return dc[1].toUpperCase()}function P(dc){if("boolean"===typeof dc||"number"===typeof dc)return""+dc;dc=""+dc;var Nc=Ba.exec(dc);if(Nc){var Qc="",Ad,Xc=0;for(Ad=Nc.index;Ad<dc.length;Ad++){switch(dc.charCodeAt(Ad)){case 34:Nc="\x26quot;";break;case 38:Nc="\x26amp;";break;case 39:Nc=
"\x26#x27;";break;case 60:Nc="\x26lt;";break;case 62:Nc="\x26gt;";break;default:continue}Xc!==Ad&&(Qc+=dc.substring(Xc,Ad));Xc=Ad+1;Qc+=Nc}dc=Xc!==Ad?Qc+dc.substring(Xc,Ad):Qc}return dc}function g(dc,Nc){var Qc=Fa.hasOwnProperty(dc)?Fa[dc]:null,Ad;if(Ad="style"!==dc)Ad=null!==Qc?0===Qc.type:!(2<dc.length)||"o"!==dc[0]&&"O"!==dc[0]||"n"!==dc[1]&&"N"!==dc[1]?!1:!0;if(Ad||y(dc,Nc,Qc,!1))return"";if(null!==Qc){dc=Qc.attributeName;Ad=Qc.type;if(3===Ad||4===Ad&&!0===Nc)return dc+'\x3d""';Qc.sanitizeURL&&
(Nc=""+Nc);return dc+'\x3d"'+(P(Nc)+'"')}return c(dc)?dc+'\x3d"'+(P(Nc)+'"'):""}function h(dc,Nc){return dc===Nc&&(0!==dc||1/dc===1/Nc)||dc!==dc&&Nc!==Nc}function b(){if(null===pa)throw Error(w(321));return pa}function m(){if(0<Ta)throw Error(w(312));return{memoizedState:null,queue:null,next:null}}function k(){null===ma?null===za?(oa=!1,za=ma=m()):(oa=!0,ma=za):null===ma.next?(oa=!1,ma=ma.next=m()):(oa=!0,ma=ma.next);return ma}function q(dc,Nc,Qc,Ad){for(;Da;)Da=!1,Ta+=1,ma=null,Qc=dc(Nc,Ad);D();
return Qc}function D(){pa=null;Da=!1;za=null;Ta=0;ma=Ma=null}function v(dc,Nc){return"function"===typeof Nc?Nc(dc):Nc}function t(dc,Nc,Qc){pa=b();ma=k();if(oa){var Ad=ma.queue;Nc=Ad.dispatch;if(null!==Ma&&(Qc=Ma.get(Ad),void 0!==Qc)){Ma.delete(Ad);Ad=ma.memoizedState;do Ad=dc(Ad,Qc.action),Qc=Qc.next;while(null!==Qc);ma.memoizedState=Ad;return[Ad,Nc]}return[ma.memoizedState,Nc]}dc=dc===v?"function"===typeof Nc?Nc():Nc:void 0!==Qc?Qc(Nc):Nc;ma.memoizedState=dc;dc=ma.queue={last:null,dispatch:null};
dc=dc.dispatch=f.bind(null,pa,dc);return[ma.memoizedState,dc]}function r(dc,Nc){pa=b();ma=k();Nc=void 0===Nc?null:Nc;if(null!==ma){var Qc=ma.memoizedState;if(null!==Qc&&null!==Nc){var Ad=Qc[1];a:if(null===Ad)Ad=!1;else{for(var Xc=0;Xc<Ad.length&&Xc<Nc.length;Xc++)if(!ka(Nc[Xc],Ad[Xc])){Ad=!1;break a}Ad=!0}if(Ad)return Qc[0]}}dc=dc();ma.memoizedState=[dc,Nc];return dc}function f(dc,Nc,Qc){if(!(25>Ta))throw Error(w(301));if(dc===pa)if(Da=!0,dc={action:Qc,next:null},null===Ma&&(Ma=new Map),Qc=Ma.get(Nc),
void 0===Qc)Ma.set(Nc,dc);else{for(Nc=Qc;null!==Nc.next;)Nc=Nc.next;Nc.next=dc}}function E(){}function C(dc){switch(dc){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 J(dc){if(void 0===dc||null===dc)return dc;var Nc="";L.Children.forEach(dc,function(Qc){null!=Qc&&(Nc+=Qc)});return Nc}function W(dc,Nc){if(void 0===dc)throw Error(w(152,Y(Nc)||"Component"));}function H(dc,Nc,Qc){function Ad(Sc,
Ib){var lb=Ib.prototype&&Ib.prototype.isReactComponent,Db=p(Ib,Nc,Qc,lb),Gb=[],db=!1,sb={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===Gb)return null},enqueueReplaceState:function(Rc,fd){db=!0;Gb=[fd]},enqueueSetState:function(Rc,fd){if(null===Gb)return null;Gb.push(fd)}};if(lb){if(lb=new Ib(Sc.props,Db,sb),"function"===typeof Ib.getDerivedStateFromProps){var Nb=Ib.getDerivedStateFromProps.call(null,Sc.props,lb.state);null!=Nb&&(lb.state=T({},lb.state,Nb))}}else if(pa={},
lb=Ib(Sc.props,Db,sb),lb=q(Ib,Sc.props,lb,Db),null==lb||null==lb.render){dc=lb;W(dc,Ib);return}lb.props=Sc.props;lb.context=Db;lb.updater=sb;sb=lb.state;void 0===sb&&(lb.state=sb=null);if("function"===typeof lb.UNSAFE_componentWillMount||"function"===typeof lb.componentWillMount)if("function"===typeof lb.componentWillMount&&"function"!==typeof Ib.getDerivedStateFromProps&&lb.componentWillMount(),"function"===typeof lb.UNSAFE_componentWillMount&&"function"!==typeof Ib.getDerivedStateFromProps&&lb.UNSAFE_componentWillMount(),
Gb.length){sb=Gb;var fc=db;Gb=null;db=!1;if(fc&&1===sb.length)lb.state=sb[0];else{Nb=fc?sb[0]:lb.state;var Bc=!0;for(fc=fc?1:0;fc<sb.length;fc++){var Jc=sb[fc];Jc="function"===typeof Jc?Jc.call(lb,Nb,Sc.props,Db):Jc;null!=Jc&&(Bc?(Bc=!1,Nb=T({},Nb,Jc)):T(Nb,Jc))}lb.state=Nb}}else Gb=null;dc=lb.render();W(dc,Ib);if("function"===typeof lb.getChildContext&&(Sc=Ib.childContextTypes,"object"===typeof Sc)){var ic=lb.getChildContext(),Oc;for(Oc in ic)if(!(Oc in Sc))throw Error(w(108,Y(Ib)||"Unknown",Oc));
}ic&&(Nc=T({},Nc,ic))}for(;L.isValidElement(dc);){var Xc=dc,sc=Xc.type;if("function"!==typeof sc)break;Ad(Xc,sc)}return{child:dc,context:Nc}}var T=aa(239),L=aa(0),S=60106,R=60107,G=60108,F=60114,N=60109,M=60110,I=60112,ia=60113,U=60120,Z=60115,ba=60116,V=60121,fa=60117,X=60119,ea=60129,na=60131;"function"===typeof Symbol&&Symbol.for&&(wa=Symbol.for,S=wa("react.portal"),R=wa("react.fragment"),G=wa("react.strict_mode"),F=wa("react.profiler"),N=wa("react.provider"),M=wa("react.context"),I=wa("react.forward_ref"),
ia=wa("react.suspense"),U=wa("react.suspense_list"),Z=wa("react.memo"),ba=wa("react.lazy"),V=wa("react.block"),fa=wa("react.fundamental"),X=wa("react.scope"),ea=wa("react.debug_trace_mode"),na=wa("react.legacy_hidden"));wa=L.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;var ua={},ta=new Uint16Array(16);for(aa=0;15>aa;aa++)ta[aa]=aa+1;ta[15]=0;var xa=/^[: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]*$/,
Ha=Object.prototype.hasOwnProperty,Ja={},Xa={},Fa={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(dc){Fa[dc]=new z(dc,0,!1,dc,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(dc){var Nc=dc[0];Fa[Nc]=new z(Nc,1,!1,dc[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(dc){Fa[dc]=
new z(dc,2,!1,dc.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(dc){Fa[dc]=new z(dc,2,!1,dc,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(dc){Fa[dc]=new z(dc,3,!1,dc.toLowerCase(),null,!1,!1)});["checked",
"multiple","muted","selected"].forEach(function(dc){Fa[dc]=new z(dc,3,!0,dc,null,!1,!1)});["capture","download"].forEach(function(dc){Fa[dc]=new z(dc,4,!1,dc,null,!1,!1)});["cols","rows","size","span"].forEach(function(dc){Fa[dc]=new z(dc,6,!1,dc,null,!1,!1)});["rowSpan","start"].forEach(function(dc){Fa[dc]=new z(dc,5,!1,dc.toLowerCase(),null,!1,!1)});var La=/[\-:]([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(dc){var Nc=
dc.replace(La,A);Fa[Nc]=new z(Nc,1,!1,dc,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(dc){var Nc=dc.replace(La,A);Fa[Nc]=new z(Nc,1,!1,dc,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(dc){var Nc=dc.replace(La,A);Fa[Nc]=new z(Nc,1,!1,dc,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(dc){Fa[dc]=new z(dc,1,!1,dc.toLowerCase(),null,!1,!1)});
Fa.xlinkHref=new z("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(dc){Fa[dc]=new z(dc,1,!1,dc.toLowerCase(),null,!0,!0)});var Ba=/["'&<>]/,ka="function"===typeof Object.is?Object.is:h,pa=null,za=null,ma=null,oa=!1,Da=!1,Ma=null,Ta=0,Oa=null,Ua={readContext:function(dc){var Nc=Oa.threadID;B(dc,Nc);return dc[Nc]},useContext:function(dc){b();var Nc=Oa.threadID;B(dc,Nc);return dc[Nc]},useMemo:r,useReducer:t,useRef:function(dc){pa=
b();ma=k();var Nc=ma.memoizedState;return null===Nc?(dc={current:dc},ma.memoizedState=dc):Nc},useState:function(dc){return t(v,dc)},useLayoutEffect:function(){},useCallback:function(dc,Nc){return r(function(){return dc},Nc)},useImperativeHandle:E,useEffect:E,useDebugValue:E,useDeferredValue:function(dc){b();return dc},useTransition:function(){b();return[function(dc){dc()},!1]},useOpaqueIdentifier:function(){return(Oa.identifierPrefix||"")+"R:"+(Oa.uniqueID++).toString(36)},useMutableSource:function(dc,
Nc){b();return Nc(dc._source)}},ib={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},vb=T({menuitem:!0},ib),rb={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},Wa=["Webkit","ms","Moz","O"];Object.keys(rb).forEach(function(dc){Wa.forEach(function(Nc){Nc=Nc+dc.charAt(0).toUpperCase()+dc.substring(1);rb[Nc]=rb[dc]})});var fb=/([A-Z])/g,ab=/^ms-/,Ra=L.Children.toArray,
$a=wa.ReactCurrentDispatcher,Qa={listing:!0,pre:!0,textarea:!0},Kb=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,vc={},mc={},oc=Object.prototype.hasOwnProperty,Cc={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null},bd=function(){function dc(Qc,Ad,Xc){L.isValidElement(Qc)?Qc.type!==R?Qc=[Qc]:(Qc=Qc.props.children,Qc=L.isValidElement(Qc)?[Qc]:Ra(Qc)):Qc=Ra(Qc);Qc={type:null,domNamespace:"http://www.w3.org/1999/xhtml",children:Qc,childIndex:0,context:ua,footer:""};
var sc=ta[0];if(0===sc){var Sc=ta;sc=Sc.length;var Ib=2*sc;if(!(65536>=Ib))throw Error(w(304));var lb=new Uint16Array(Ib);lb.set(Sc);ta=lb;ta[0]=sc+1;for(Sc=sc;Sc<Ib-1;Sc++)ta[Sc]=Sc+1;ta[Ib-1]=0}else ta[0]=ta[sc];this.threadID=sc;this.stack=[Qc];this.exhausted=!1;this.currentSelectValue=null;this.previousWasTextNode=!1;this.makeStaticMarkup=Ad;this.suspenseDepth=0;this.contextIndex=-1;this.contextStack=[];this.contextValueStack=[];this.uniqueID=0;this.identifierPrefix=Xc&&Xc.identifierPrefix||""}
var Nc=dc.prototype;Nc.destroy=function(){if(!this.exhausted){this.exhausted=!0;this.clearProviders();var Qc=this.threadID;ta[Qc]=ta[0];ta[0]=Qc}};Nc.pushProvider=function(Qc){var Ad=++this.contextIndex,Xc=Qc.type._context,sc=this.threadID;B(Xc,sc);var Sc=Xc[sc];this.contextStack[Ad]=Xc;this.contextValueStack[Ad]=Sc;Xc[sc]=Qc.props.value};Nc.popProvider=function(){var Qc=this.contextIndex,Ad=this.contextStack[Qc],Xc=this.contextValueStack[Qc];this.contextStack[Qc]=null;this.contextValueStack[Qc]=
null;this.contextIndex--;Ad[this.threadID]=Xc};Nc.clearProviders=function(){for(var Qc=this.contextIndex;0<=Qc;Qc--)this.contextStack[Qc][this.threadID]=this.contextValueStack[Qc]};Nc.read=function(Qc){if(this.exhausted)return null;var Ad=Oa;Oa=this;var Xc=$a.current;$a.current=Ua;try{for(var sc=[""],Sc=!1;sc[0].length<Qc;){if(0===this.stack.length){this.exhausted=!0;var Ib=this.threadID;ta[Ib]=ta[0];ta[0]=Ib;break}var lb=this.stack[this.stack.length-1];if(Sc||lb.childIndex>=lb.children.length){var Db=
lb.footer;""!==Db&&(this.previousWasTextNode=!1);this.stack.pop();if("select"===lb.type)this.currentSelectValue=null;else if(null!=lb.type&&null!=lb.type.type&&lb.type.type.$$typeof===N)this.popProvider(lb.type);else if(lb.type===ia){this.suspenseDepth--;var Gb=sc.pop();if(Sc){Sc=!1;var db=lb.fallbackFrame;if(!db)throw Error(w(303));this.stack.push(db);sc[this.suspenseDepth]+="\x3c!--$!--\x3e";continue}else sc[this.suspenseDepth]+=Gb}sc[this.suspenseDepth]+=Db}else{var sb=lb.children[lb.childIndex++],
Nb="";try{Nb+=this.render(sb,lb.context,lb.domNamespace)}catch(fc){if(null!=fc&&"function"===typeof fc.then)throw Error(w(294));throw fc;}finally{}sc.length<=this.suspenseDepth&&sc.push("");sc[this.suspenseDepth]+=Nb}}return sc[0]}finally{$a.current=Xc,Oa=Ad,D()}};Nc.render=function(Qc,Ad,Xc){if("string"===typeof Qc||"number"===typeof Qc){Xc=""+Qc;if(""===Xc)return"";if(this.makeStaticMarkup)return P(Xc);if(this.previousWasTextNode)return"\x3c!-- --\x3e"+P(Xc);this.previousWasTextNode=!0;return P(Xc)}Ad=
H(Qc,Ad,this.threadID);Qc=Ad.child;Ad=Ad.context;if(null===Qc||!1===Qc)return"";if(!L.isValidElement(Qc)){if(null!=Qc&&null!=Qc.$$typeof){Xc=Qc.$$typeof;if(Xc===S)throw Error(w(257));throw Error(w(258,Xc.toString()));}Qc=Ra(Qc);this.stack.push({type:null,domNamespace:Xc,children:Qc,childIndex:0,context:Ad,footer:""});return""}var sc=Qc.type;if("string"===typeof sc)return this.renderDOM(Qc,Ad,Xc);switch(sc){case na:case ea:case G:case F:case U:case R:return Qc=Ra(Qc.props.children),this.stack.push({type:null,
domNamespace:Xc,children:Qc,childIndex:0,context:Ad,footer:""}),"";case ia:throw Error(w(294));case X:throw Error(w(343));}if("object"===typeof sc&&null!==sc)switch(sc.$$typeof){case I:pa={};var Sc=sc.render(Qc.props,Qc.ref);Sc=q(sc.render,Qc.props,Sc,Qc.ref);Sc=Ra(Sc);this.stack.push({type:null,domNamespace:Xc,children:Sc,childIndex:0,context:Ad,footer:""});return"";case Z:return Qc=[L.createElement(sc.type,T({ref:Qc.ref},Qc.props))],this.stack.push({type:null,domNamespace:Xc,children:Qc,childIndex:0,
context:Ad,footer:""}),"";case N:return sc=Ra(Qc.props.children),Xc={type:Qc,domNamespace:Xc,children:sc,childIndex:0,context:Ad,footer:""},this.pushProvider(Qc),this.stack.push(Xc),"";case M:sc=Qc.type;Sc=Qc.props;var Ib=this.threadID;B(sc,Ib);sc=Ra(Sc.children(sc[Ib]));this.stack.push({type:Qc,domNamespace:Xc,children:sc,childIndex:0,context:Ad,footer:""});return"";case fa:throw Error(w(338));case ba:return sc=Qc.type,Sc=sc._init,sc=Sc(sc._payload),Qc=[L.createElement(sc,T({ref:Qc.ref},Qc.props))],
this.stack.push({type:null,domNamespace:Xc,children:Qc,childIndex:0,context:Ad,footer:""}),""}throw Error(w(130,null==sc?sc:typeof sc,""));};Nc.renderDOM=function(Qc,Ad,Xc){var sc=Qc.type.toLowerCase();"http://www.w3.org/1999/xhtml"===Xc&&C(sc);if(!vc.hasOwnProperty(sc)){if(!Kb.test(sc))throw Error(w(65,sc));vc[sc]=!0}var Sc=Qc.props;if("input"===sc)Sc=T({type:void 0},Sc,{defaultChecked:void 0,defaultValue:void 0,value:null!=Sc.value?Sc.value:Sc.defaultValue,checked:null!=Sc.checked?Sc.checked:Sc.defaultChecked});
else if("textarea"===sc){var Ib=Sc.value;if(null==Ib){Ib=Sc.defaultValue;var lb=Sc.children;if(null!=lb){if(null!=Ib)throw Error(w(92));if(Array.isArray(lb)){if(!(1>=lb.length))throw Error(w(93));lb=lb[0]}Ib=""+lb}null==Ib&&(Ib="")}Sc=T({},Sc,{value:void 0,children:""+Ib})}else if("select"===sc)this.currentSelectValue=null!=Sc.value?Sc.value:Sc.defaultValue,Sc=T({},Sc,{value:void 0});else if("option"===sc){lb=this.currentSelectValue;var Db=J(Sc.children);if(null!=lb){var Gb=null!=Sc.value?Sc.value+
"":Db;Ib=!1;if(Array.isArray(lb))for(var db=0;db<lb.length;db++){if(""+lb[db]===Gb){Ib=!0;break}}else Ib=""+lb===Gb;Sc=T({selected:void 0,children:void 0},Sc,{selected:Ib,children:Db})}}if(Ib=Sc){if(vb[sc]&&(null!=Ib.children||null!=Ib.dangerouslySetInnerHTML))throw Error(w(137,sc));if(null!=Ib.dangerouslySetInnerHTML){if(null!=Ib.children)throw Error(w(60));if(!("object"===typeof Ib.dangerouslySetInnerHTML&&"__html"in Ib.dangerouslySetInnerHTML))throw Error(w(61));}if(null!=Ib.style&&"object"!==
typeof Ib.style)throw Error(w(62));}Ib=Sc;lb=this.makeStaticMarkup;Db=1===this.stack.length;Gb="\x3c"+Qc.type;a:if(-1===sc.indexOf("-"))db="string"===typeof Ib.is;else switch(sc){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":db=!1;break a;default:db=!0}for(fd in Ib)if(oc.call(Ib,fd)){var sb=Ib[fd];if(null!=sb){if("style"===fd){var Nb=void 0,fc="",Bc="";for(Nb in sb)if(sb.hasOwnProperty(Nb)){var Jc=
0===Nb.indexOf("--"),ic=sb[Nb];if(null!=ic){if(Jc)var Oc=Nb;else if(Oc=Nb,mc.hasOwnProperty(Oc))Oc=mc[Oc];else{var Rc=Oc.replace(fb,"-$1").toLowerCase().replace(ab,"-ms-");Oc=mc[Oc]=Rc}fc+=Bc+Oc+":";Bc=Nb;Jc=null==ic||"boolean"===typeof ic||""===ic?"":Jc||"number"!==typeof ic||0===ic||rb.hasOwnProperty(Bc)&&rb[Bc]?(""+ic).trim():ic+"px";fc+=Jc;Bc=";"}}sb=fc||null}Nb=null;db?Cc.hasOwnProperty(fd)||(Nb=fd,Nb=c(Nb)&&null!=sb?Nb+'\x3d"'+(P(sb)+'"'):""):Nb=g(fd,sb);Nb&&(Gb+=" "+Nb)}}lb||Db&&(Gb+=' data-reactroot\x3d""');
var fd=Gb;Ib="";ib.hasOwnProperty(sc)?fd+="/\x3e":(fd+="\x3e",Ib="\x3c/"+Qc.type+"\x3e");a:{lb=Sc.dangerouslySetInnerHTML;if(null!=lb){if(null!=lb.__html){lb=lb.__html;break a}}else if(lb=Sc.children,"string"===typeof lb||"number"===typeof lb){lb=P(lb);break a}lb=null}null!=lb?(Sc=[],Qa.hasOwnProperty(sc)&&"\n"===lb.charAt(0)&&(fd+="\n"),fd+=lb):Sc=Ra(Sc.children);Qc=Qc.type;Xc=null==Xc||"http://www.w3.org/1999/xhtml"===Xc?C(Qc):"http://www.w3.org/2000/svg"===Xc&&"foreignObject"===Qc?"http://www.w3.org/1999/xhtml":
Xc;this.stack.push({domNamespace:Xc,type:sc,children:Sc,childIndex:0,context:Ad,footer:Ib});this.previousWasTextNode=!1;return fd};return dc}();Q.renderToNodeStream=function(){throw Error(w(207));};Q.renderToStaticMarkup=function(dc,Nc){dc=new bd(dc,!0,Nc);try{return dc.read(Infinity)}finally{dc.destroy()}};Q.renderToStaticNodeStream=function(){throw Error(w(208));};Q.renderToString=function(dc,Nc){dc=new bd(dc,!1,Nc);try{return dc.read(Infinity)}finally{dc.destroy()}};Q.version="17.0.2"};
shadow$provide[619]=function(wa,aa,Pa,Q){Pa.exports=aa(617)};
shadow$provide[620]=function(wa,aa,Pa,Q){function w(){if(!Ou&&(Ou="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ou))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ou(DD)}function Y(a,d=0){return(Ll[a[d+0]]+Ll[a[d+1]]+Ll[a[d+2]]+Ll[a[d+3]]+"-"+Ll[a[d+4]]+Ll[a[d+5]]+"-"+Ll[a[d+6]]+Ll[a[d+7]]+"-"+Ll[a[d+8]]+Ll[a[d+9]]+"-"+Ll[a[d+10]]+Ll[a[d+11]]+Ll[a[d+12]]+Ll[a[d+13]]+Ll[a[d+14]]+
Ll[a[d+15]]).toLowerCase()}function B(a){let d=0;var l=0;for(var K of a)d+=K.w*K.h,l=Math.max(l,K.w);a.sort((ra,Ka)=>Ka.h-ra.h);l=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(d/.95)),l),h:Infinity}];let da=K=0;for(const ra of a)for(a=l.length-1;0<=a;a--){var ja=l[a];if(!(ra.w>ja.w||ra.h>ja.h)){ra.x=ja.x;ra.y=ja.y;da=Math.max(da,ra.y+ra.h);K=Math.max(K,ra.x+ra.w);ra.w===ja.w&&ra.h===ja.h?(ja=l.pop(),a<l.length&&(l[a]=ja)):ra.h===ja.h?(ja.x+=ra.w,ja.w-=ra.w):(ra.w!==ja.w&&l.push({x:ja.x+ra.w,y:ja.y,w:ja.w-
ra.w,h:ra.h}),ja.y+=ra.h,ja.h-=ra.h);break}}return{w:K,h:da,fill:d/(K*da)||0}}function p(a,...d){return{didIntersect:0<d.length,message:a,points:d}}function c(a,d,l=0){const K=[a[0]+d[0]/2,a[1]+d[1]/2],da=yd.rotWith(a,K,l),ja=yd.rotWith(yd.add(a,[d[0],0]),K,l),ra=yd.rotWith(yd.add(a,d),K,l);a=yd.rotWith(yd.add(a,[0,d[1]]),K,l);return[["top",[da,ja]],["right",[ja,ra]],["bottom",[ra,a]],["left",[a,da]]]}function u(a,d,l,K){const [da,ja]=a,[ra,Ka]=d,[Sa,bb]=l,[gb,jb]=K;return Ka/ra!==(jb-bb)/(gb-Sa)&&
(d=ra*(jb-bb)-Ka*(gb-Sa),0!==d&&(a=((ja-bb)*(gb-Sa)-(da-Sa)*(jb-bb))/d,d=((ja-bb)*ra-(da-Sa)*Ka)/d,0<=a&&0<=d&&1>=d))?p("intersection",[da+a*ra,ja+a*Ka]):p("no intersection")}function y(a,d,l,K,da=0){return b(l,K,da,a,d)}function z(a,d,l,K=0){const {minX:da,minY:ja,width:ra,height:Ka}=l;return y(a,d,[da,ja],[ra,Ka],K)}function A(a,d,l,K){var da=yd.sub(a,l);l=yd.sub(K,l);d=yd.sub(d,a);K=l[0]*da[1]-l[1]*da[0];da=d[0]*da[1]-d[1]*da[0];l=l[1]*d[0]-l[0]*d[1];return 0===K||0===da?p("coincident"):0===l?
p("parallel"):0!==l&&(K/=l,da/=l,0<=K&&1>=K&&0<=da&&1>=da)?p("intersection",yd.add(a,yd.mul(d,K))):p("no intersection")}function P(a,d,l,K){var da=(d[0]-a[0])*(d[0]-a[0])+(d[1]-a[1])*(d[1]-a[1]),ja=2*((d[0]-a[0])*(a[0]-l[0])+(d[1]-a[1])*(a[1]-l[1]));l=ja*ja-4*da*(l[0]*l[0]+l[1]*l[1]+a[0]*a[0]+a[1]*a[1]-2*(l[0]*a[0]+l[1]*a[1])-K*K);if(0>l)return p("outside");if(0===l)return p("tangent");K=Math.sqrt(l);l=(-ja+K)/(2*da);da=(-ja-K)/(2*da);if((0>l||1<l)&&(0>da||1<da))return 0>l&&0>da||1<l&&1<da?p("outside"):
p("inside");ja=[];0<=l&&1>=l&&ja.push(yd.lrp(a,d,l));0<=da&&1>=da&&ja.push(yd.lrp(a,d,da));return p("intersection",...ja)}function g(a,d,l,K,da,ja=0){if(0===K||0===da||yd.isEqual(a,d))return p("no intersection");K=0>K?K:-K;da=0>da?da:-da;a=yd.sub(yd.rotWith(a,l,-ja),l);d=yd.sub(yd.rotWith(d,l,-ja),l);var ra=yd.sub(d,a),Ka=ra[0]*ra[0]/K/K+ra[1]*ra[1]/da/da;ra=2*a[0]*ra[0]/K/K+2*a[1]*ra[1]/da/da;const Sa=[];K=ra*ra-4*Ka*(a[0]*a[0]/K/K+a[1]*a[1]/da/da-1);0===K?Sa.push(-ra/2/Ka):0<K&&(K=Math.sqrt(K),
Sa.push((-ra+K)/2/Ka),Sa.push((-ra-K)/2/Ka));Ka=Sa.filter(bb=>0<=bb&&1>=bb).map(bb=>yd.add(l,yd.add(a,yd.mul(yd.sub(d,a),bb)))).map(bb=>yd.rotWith(bb,l,ja));return p("intersection",...Ka)}function h(a,d,l){const K=[];for(let da=1;da<l.length;da++){const ja=A(a,d,l[da-1],l[da]);ja&&K.push(...ja.points)}return 0===K.length?p("no intersection"):p("intersection",...l)}function b(a,d,l,K,da){return c(a,d,l).reduce((ja,[ra,[Ka,Sa]])=>{(Ka=u(K,da,Ka,Sa))&&ja.push(p(ra,...Ka.points));return ja},[]).filter(ja=>
ja.didIntersect)}function m(a,d,l,K){return c(a,d).reduce((da,[ja,[ra,Ka]])=>{(ra=A(l,K,ra,Ka))&&da.push(p(ja,...ra.points));return da},[]).filter(da=>da.didIntersect)}function k(a,d,l,K){return c(a,d).reduce((da,[ja,[ra,Ka]])=>{(ra=P(ra,Ka,l,K))&&da.push(ff(Zd({},ra),{message:ja}));return da},[]).filter(da=>da.didIntersect)}function q(a,d,l,K,da,ja=0){return c(a,d).reduce((ra,[Ka,[Sa,bb]])=>{(Sa=g(Sa,bb,l,K,da,ja))&&ra.push(ff(Zd({},Sa),{message:Ka}));return ra},[]).filter(ra=>ra.didIntersect)}function D(a,
d,l){return c(a,d).reduce((K,[da,[ja,ra]])=>{ja=h(ja,ra,l);ja.didIntersect&&K.push(p(da,...ja.points));return K},[]).filter(K=>K.didIntersect)}function v(a,d,l){return c(a,d).reduce((K,[da,[ja,ra]])=>{{const Ka=[];for(let Sa=1;Sa<l.length+1;Sa++){const bb=A(ja,ra,l[Sa-1],l[Sa%l.length]);bb&&Ka.push(...bb.points)}ja=0===Ka.length?p("no intersection"):p("intersection",...l)}ja.didIntersect&&K.push(p(da,...ja.points));return K},[]).filter(K=>K.didIntersect)}function t(a,d,l,K=0,da,ja){return d===l?k(da,
ja,a,d):q(da,ja,a,d,l,K)}function r(a,d,l){const {minX:K,minY:da,width:ja,height:ra}=a;return m([K,da],[ja,ra],d,l)}function f(a){for(var d=arguments.length,l=Array(1<d?d-1:0),K=1;K<d;K++)l[K-1]=arguments[K];throw Error("number"===typeof a?"[MobX] minified error nr: "+a+(l.length?" "+l.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+a);}function E(){return"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?
window:"undefined"!==typeof wa?wa:"undefined"!==typeof self?self:FD}function C(){HD||f("Proxy not available")}function J(a){var d=!1;return function(){if(!d)return d=!0,a.apply(this,arguments)}}function W(a){return"function"===typeof a}function H(a){switch(typeof a){case "string":case "symbol":case "number":return!0}return!1}function T(a){return null!==a&&"object"===typeof a}function L(a){if(!T(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()===ID}function S(a){return(a=null==a?void 0:a.constructor)?"GeneratorFunction"===a.name||"GeneratorFunction"===a.displayName?!0:!1:!1}function R(a,d,l){jp(a,d,{enumerable:!1,writable:!0,configurable:!0,value:l})}function G(a,d,l){jp(a,d,{enumerable:!1,writable:!1,configurable:!0,value:l})}function F(a,d){var l="isMobX"+a;d.prototype[l]=!0;return function(K){return T(K)&&!0===K[l]}}function N(a){return a instanceof Map}function M(a){return a instanceof
Set}function I(a){var d=Object.keys(a);if(!Zy)return d;var l=Object.getOwnPropertySymbols(a);return l.length?[].concat(d,l.filter(function(K){return pt.propertyIsEnumerable.call(a,K)})):d}function ia(a){return null===a?null:"object"===typeof a?""+a:a}function U(a,d){return pt.hasOwnProperty.call(a,d)}function Z(a,d){for(var l=0;l<d.length;l++){var K=d[l];K.enumerable=K.enumerable||!1;K.configurable=!0;"value"in K&&(K.writable=!0);Object.defineProperty(a,K.key,K)}}function ba(a,d,l){d&&Z(a.prototype,
d);l&&Z(a,l);Object.defineProperty(a,"prototype",{writable:!1});return a}function V(){V=Object.assign||function(a){for(var d=1;d<arguments.length;d++){var l=arguments[d],K;for(K in l)Object.prototype.hasOwnProperty.call(l,K)&&(a[K]=l[K])}return a};return V.apply(this,arguments)}function fa(a,d){a.prototype=Object.create(d.prototype);a.prototype.constructor=a;X(a,d)}function X(a,d){X=Object.setPrototypeOf||function(l,K){l.__proto__=K;return l};return X(a,d)}function ea(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return a}function na(a,d){if(a){if("string"===typeof a)return ua(a,d);var l=Object.prototype.toString.call(a).slice(8,-1);"Object"===l&&a.constructor&&(l=a.constructor.name);if("Map"===l||"Set"===l)return Array.from(a);if("Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return ua(a,d)}}function ua(a,d){if(null==d||d>a.length)d=a.length;for(var l=0,K=Array(d);l<d;l++)K[l]=a[l];return K}function ta(a,d){var l="undefined"!==typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(l)return(l=
l.call(a)).next.bind(l);if(Array.isArray(a)||(l=na(a))||d&&a&&"number"===typeof a.length){l&&(a=l);var K=0;return function(){return K>=a.length?{done:!0}:{done:!1,value:a[K++]}}}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 xa(a){return Object.assign(function(d,l){Ha(d,l,a)},a)}function Ha(a,d,l){U(a,ko)||R(a,ko,V({},a[ko]));l.annotationType_!==KD&&(a[ko][d]=l)}function Ja(a){U(a,
ko)||R(a,ko,V({},a[ko]));return a[ko]}function Xa(a,d,l){void 0===d&&(d=bs);void 0===l&&(l=bs);a=new qt(a);d!==bs&&Ic($D,a,d,void 0);l!==bs&&pd(a,l);return a}function Fa(a,d,l){return kd(a)?a:Array.isArray(a)?yg.array(a,{name:l}):L(a)?yg.object(a,void 0,{name:l}):N(a)?yg.map(a,{name:l}):M(a)?yg.set(a,{name:l}):"function"!==typeof a||Jc(a)||ue(a)?a:S(a)?vt(a):ut(l,a)}function La(a){return a}function Ba(a,d){return{annotationType_:a,options_:d,make_:ka,extend_:pa}}function ka(a,d,l,K){var da;if(null!=
(da=this.options_)&&da.bound)return null===this.extend_(a,d,l,!1)?0:1;if(K===a.target_)return null===this.extend_(a,d,l,!1)?0:2;if(Jc(l.value))return 1;a=za(a,this,d,l,!1);jp(K,d,a);return 2}function pa(a,d,l,K){l=za(a,this,d,l);return a.defineProperty_(d,l,K)}function za(a,d,l,K,da){var ja,ra,Ka,Sa,bb,gb,jb;void 0===da&&(da=Af.safeDescriptors);K=K.value;if(null!=(ja=d.options_)&&ja.bound){var Jb;K=K.bind(null!=(Jb=a.proxy_)?Jb:a.target_)}return{value:Qa(null!=(ra=null==(Ka=d.options_)?void 0:Ka.name)?
ra:l.toString(),K,null!=(Sa=null==(bb=d.options_)?void 0:bb.autoAction)?Sa:!1,null!=(gb=d.options_)&&gb.bound?null!=(jb=a.proxy_)?jb:a.target_:void 0),configurable:da?a.isPlainObject_:!0,enumerable:!1,writable:da?!1:!0}}function ma(a,d){return{annotationType_:a,options_:d,make_:oa,extend_:Da}}function oa(a,d,l,K){var da;if(K===a.target_)return null===this.extend_(a,d,l,!1)?0:2;if(null!=(da=this.options_)&&da.bound&&(!U(a.target_,d)||!ue(a.target_[d]))&&null===this.extend_(a,d,l,!1))return 0;if(ue(l.value))return 1;
a=Ma(a,this,d,l,!1,!1);jp(K,d,a);return 2}function Da(a,d,l,K){var da;l=Ma(a,this,d,l,null==(da=this.options_)?void 0:da.bound);return a.defineProperty_(d,l,K)}function Ma(a,d,l,K,da,ja){void 0===ja&&(ja=Af.safeDescriptors);d=K.value;ue(d)||(d=vt(d));if(da){var ra;d=d.bind(null!=(ra=a.proxy_)?ra:a.target_);d.isMobXFlow=!0}return{value:d,configurable:ja?a.isPlainObject_:!0,enumerable:!1,writable:ja?!1:!0}}function Ta(a,d){return{annotationType_:a,options_:d,make_:Oa,extend_:Ua}}function Oa(a,d,l){return null===
this.extend_(a,d,l,!1)?0:1}function Ua(a,d,l,K){return a.defineComputedProperty_(d,V({},this.options_,{get:l.get,set:l.set}),K)}function ib(a,d){return{annotationType_:a,options_:d,make_:vb,extend_:rb}}function vb(a,d,l){return null===this.extend_(a,d,l,!1)?0:1}function rb(a,d,l,K){var da,ja;return a.defineObservableProperty_(d,l.value,null!=(da=null==(ja=this.options_)?void 0:ja.enhancer)?da:Fa,K)}function Wa(a){return{annotationType_:"true",options_:a,make_:fb,extend_:ab}}function fb(a,d,l,K){var da,
ja;if(l.get)return Dg.make_(a,d,l,K);if(l.set){l=Qa(d.toString(),l.set);if(K===a.target_)return null===a.defineProperty_(d,{configurable:Af.safeDescriptors?a.isPlainObject_:!0,set:l})?0:2;jp(K,d,{configurable:!0,set:l});return 2}if(K!==a.target_&&"function"===typeof l.value){var ra;if(S(l.value)){var Ka;return(null!=(Ka=this.options_)&&Ka.autoBind?vt.bound:vt).make_(a,d,l,K)}return(null!=(ra=this.options_)&&ra.autoBind?ut.bound:ut).make_(a,d,l,K)}ra=!1===(null==(da=this.options_)?void 0:da.deep)?
yg.ref:yg;if("function"===typeof l.value&&null!=(ja=this.options_)&&ja.autoBind){var Sa;l.value=l.value.bind(null!=(Sa=a.proxy_)?Sa:a.target_)}return ra.make_(a,d,l,K)}function ab(a,d,l,K){var da,ja;if(l.get)return Dg.extend_(a,d,l,K);if(l.set)return a.defineProperty_(d,{configurable:Af.safeDescriptors?a.isPlainObject_:!0,set:Qa(d.toString(),l.set)},K);if("function"===typeof l.value&&null!=(da=this.options_)&&da.autoBind){var ra;l.value=l.value.bind(null!=(ra=a.proxy_)?ra:a.target_)}return(!1===(null==
(ja=this.options_)?void 0:ja.deep)?yg.ref:yg).extend_(a,d,l,K)}function Ra(a){if(!0===a.deep)var d=Fa;else{if(!1===a.deep)a=La;else{a=a.defaultDecorator;var l;a=a?null!=(d=null==(l=a.options_)?void 0:l.enhancer)?d:Fa:Fa}d=a}return d}function $a(a,d,l){if(H(d))Ha(a,d,$y);else return kd(a)?a:L(a)?yg.object(a,d,l):Array.isArray(a)?yg.array(a,d):N(a)?yg.map(a,d):M(a)?yg.set(a,d):"object"===typeof a&&null!==a?a:yg.box(a,d)}function Qa(a,d,l,K){function da(){a:{var ja=K||this,ra=arguments,Ka=Af.trackingDerivation,
Sa=!l||!Ka;Sc();var bb=Af.allowStateChanges;Sa&&(dc(),bb=vc(!0));var gb=Nc(!0),jb=RD++,Jb=Tu;Tu=jb;try{var Ob=d.apply(ja,ra);break a}catch(gc){var Lb=gc;throw gc;}finally{Tu!==jb&&f(30),Tu=Jb,void 0!==Lb&&(Af.suppressReactionErrors=!0),Af.allowStateChanges=bb,Af.allowStateReads=gb,Ib(),Sa&&(Af.trackingDerivation=Ka),Af.suppressReactionErrors=!1}Ob=void 0}return Ob}void 0===l&&(l=!1);da.isMobxAction=!0;SD&&(ez.value=a,Object.defineProperty(da,"name",ez));return da}function Kb(a,d){a=vc(a);try{return d()}finally{Af.allowStateChanges=
a}}function vc(a){var d=Af.allowStateChanges;Af.allowStateChanges=a;return d}function mc(a){switch(a.dependenciesState_){case Ti.UP_TO_DATE_:return!1;case Ti.NOT_TRACKING_:case Ti.STALE_:return!0;case Ti.POSSIBLY_STALE_:for(var d=Nc(!0),l=dc(),K=a.observing_,da=K.length,ja=0;ja<da;ja++){var ra=K[ja];if(tt(ra)){if(Af.disableErrorBoundaries)ra.get();else try{ra.get()}catch(Ka){return Af.trackingDerivation=l,Af.allowStateReads=d,!0}if(a.dependenciesState_===Ti.STALE_)return Af.trackingDerivation=l,Af.allowStateReads=
d,!0}}Qc(a);Af.trackingDerivation=l;Af.allowStateReads=d;return!1}}function oc(a,d,l){var K=Nc(!0);Qc(a);a.newObserving_=Array(a.observing_.length+100);a.unboundDepsCount_=0;a.runId_=++Af.runId;var da=Af.trackingDerivation;Af.trackingDerivation=a;Af.inBatch++;if(!0===Af.disableErrorBoundaries)var ja=d.call(l);else try{ja=d.call(l)}catch(gb){ja=new fr(gb)}Af.inBatch--;Af.trackingDerivation=da;var ra=a.observing_;d=a.observing_=a.newObserving_;l=Ti.UP_TO_DATE_;da=0;for(var Ka=a.unboundDepsCount_,Sa=
0;Sa<Ka;Sa++){var bb=d[Sa];0===bb.diffValue_&&(bb.diffValue_=1,da!==Sa&&(d[da]=bb),da++);bb.dependenciesState_>l&&(l=bb.dependenciesState_)}d.length=da;a.newObserving_=null;for(Ka=ra.length;Ka--;)Sa=ra[Ka],0===Sa.diffValue_&&Xc(Sa,a),Sa.diffValue_=0;for(;da--;)ra=d[da],1===ra.diffValue_&&(ra.diffValue_=0,Ka=a,ra.observers_.add(Ka),ra.lowestObserverState_>Ka.dependenciesState_&&(ra.lowestObserverState_=Ka.dependenciesState_));l!==Ti.UP_TO_DATE_&&(a.dependenciesState_=l,a.onBecomeStale_());Af.allowStateReads=
K;return ja}function Cc(a){var d=a.observing_;a.observing_=[];for(var l=d.length;l--;)Xc(d[l],a);a.dependenciesState_=Ti.NOT_TRACKING_}function bd(a){var d=dc();try{return a()}finally{Af.trackingDerivation=d}}function dc(){var a=Af.trackingDerivation;Af.trackingDerivation=null;return a}function Nc(a){var d=Af.allowStateReads;Af.allowStateReads=a;return d}function Qc(a){if(a.dependenciesState_!==Ti.UP_TO_DATE_){a.dependenciesState_=Ti.UP_TO_DATE_;a=a.observing_;for(var d=a.length;d--;)a[d].lowestObserverState_=
Ti.UP_TO_DATE_}}function Ad(){(Af.pendingReactions.length||Af.inBatch||Af.isRunningReactions)&&f(36);fz=!0;if(Vu){var a=E();0===--a.__mobxInstanceCount&&(a.__mobxGlobals=void 0);Af=new Uu}}function Xc(a,d){a.observers_["delete"](d);0===a.observers_.size&&sc(a)}function sc(a){!1===a.isPendingUnobservation_&&(a.isPendingUnobservation_=!0,Af.pendingUnobservations.push(a))}function Sc(){Af.inBatch++}function Ib(){if(0===--Af.inBatch){0<Af.inBatch||Af.isRunningReactions||Wu(sb);for(var a=Af.pendingUnobservations,
d=0;d<a.length;d++){var l=a[d];l.isPendingUnobservation_=!1;0===l.observers_.size&&(l.isBeingObserved_&&(l.isBeingObserved_=!1,l.onBUO()),l instanceof st&&l.suspend_())}Af.pendingUnobservations=[]}}function lb(a){var d=Af.trackingDerivation;if(null!==d)return d.runId_!==a.lastAccessedBy_&&(a.lastAccessedBy_=d.runId_,d.newObserving_[d.unboundDepsCount_++]=a,!a.isBeingObserved_&&Af.trackingContext&&(a.isBeingObserved_=!0,a.onBO())),a.isBeingObserved_;0===a.observers_.size&&0<Af.inBatch&&sc(a);return!1}
function Db(a){a.lowestObserverState_!==Ti.STALE_&&(a.lowestObserverState_=Ti.STALE_,a.observers_.forEach(function(d){if(d.dependenciesState_===Ti.UP_TO_DATE_)d.onBecomeStale_();d.dependenciesState_=Ti.STALE_}))}function Gb(a){a.lowestObserverState_!==Ti.STALE_&&(a.lowestObserverState_=Ti.STALE_,a.observers_.forEach(function(d){d.dependenciesState_===Ti.POSSIBLY_STALE_?d.dependenciesState_=Ti.STALE_:d.dependenciesState_===Ti.UP_TO_DATE_&&(a.lowestObserverState_=Ti.UP_TO_DATE_)}))}function db(a){a.lowestObserverState_===
Ti.UP_TO_DATE_&&(a.lowestObserverState_=Ti.POSSIBLY_STALE_,a.observers_.forEach(function(d){d.dependenciesState_===Ti.UP_TO_DATE_&&(d.dependenciesState_=Ti.POSSIBLY_STALE_,d.onBecomeStale_())}))}function sb(){Af.isRunningReactions=!0;for(var a=Af.pendingReactions,d=0;0<a.length;){++d===WD&&(console.error("[mobx] cycle in reaction: "+a[0]),a.splice(0));for(var l=a.splice(0),K=0,da=l.length;K<da;K++)l[K].runReaction_()}Af.isRunningReactions=!1}function Nb(a){var d=Wu;Wu=function(l){return a(function(){return d(l)})}}
function fc(a){console.warn("[mobx.spy] Is a no-op in production builds");return function(){}}function Bc(a){return function(d,l){if(W(d))return Qa(d.name||"\x3cunnamed action\x3e",d,a);if(W(l))return Qa(d,l,a);if(H(l))return Ha(d,l,a?iz:hz);if(H(d))return xa(Ba(a?"autoAction":gz,{name:d,autoAction:a}))}}function Jc(a){return W(a)&&!0===a.isMobxAction}function ic(a,d){function l(){a(Sa)}var K,da;void 0===d&&(d=Ow);var ja=null!=(K=null==(da=d)?void 0:da.name)?K:"Autorun";if(d.scheduler||d.delay){var ra=
Oc(d),Ka=!1;var Sa=new es(ja,function(){Ka||(Ka=!0,ra(function(){Ka=!1;Sa.isDisposed_||Sa.track(l)}))},d.onError,d.requiresObservable)}else Sa=new es(ja,function(){this.track(l)},d.onError,d.requiresObservable);Sa.schedule_();return Sa.getDisposer_()}function Oc(a){return a.scheduler?a.scheduler:a.delay?function(d){return setTimeout(d,a.delay)}:ZD}function Rc(a,d,l){function K(){gb=!1;if(!Lb.isDisposed_){var gc=!1;Lb.track(function(){var rc=Kb(!1,function(){return a(Lb)});gc=bb||!Ob(jb,rc);Jb=jb;
jb=rc});bb&&l.fireImmediately?ra(jb,Jb,Lb):!bb&&gc&&ra(jb,Jb,Lb);bb=!1}}var da;void 0===l&&(l=Ow);var ja=null!=(da=l.name)?da:"Reaction",ra=jg(ja,l.onError?fd(l.onError,d):d),Ka=!l.scheduler&&!l.delay,Sa=Oc(l),bb=!0,gb=!1,jb,Jb,Ob=l.compareStructural?cs.structural:l.equals||cs["default"],Lb=new es(ja,function(){bb||Ka?K():gb||(gb=!0,Sa(K))},l.onError,l.requiresObservable);Lb.schedule_();return Lb.getDisposer_()}function fd(a,d){return function(){try{return d.apply(this,arguments)}catch(l){a.call(this,
l)}}}function pd(a,d,l){return Ic(aE,a,d,l)}function Ic(a,d,l,K){var da="function"===typeof K?ec(d,l):ec(d),ja=W(K)?K:l,ra=a+"L";da[ra]?da[ra].add(ja):da[ra]=new Set([ja]);return function(){var Ka=da[ra];Ka&&(Ka["delete"](ja),0===Ka.size&&delete da[ra])}}function xc(a){!0===a.isolateGlobalState&&Ad();var d=a.useProxies,l=a.enforceActions;void 0!==d&&(Af.useProxies="always"===d?!0:"never"===d?!1:"undefined"!==typeof Proxy);"ifavailable"===d&&(Af.verifyProxies=!0);void 0!==l&&(d="always"===l?"always":
"observed"===l,Af.enforceActions=d,Af.allowStateChanges=!0===d||"always"===d?!1:!0);["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(K){K in a&&(Af[K]=!!a[K])});Af.allowStateReads=!Af.observableRequiresReaction;a.reactionScheduler&&Nb(a.reactionScheduler)}function je(a,d,l,K){var da=JD(d),ja=Hd(a,K)[ih];Sc();try{Su(da).forEach(function(ra){ja.extend_(ra,da[ra],l?ra in l?l[ra]:!0:!0)})}finally{Ib()}return a}
function pf(a){var d={name:a.name_};a.observing_&&0<a.observing_.length&&(d.dependencies=Array.from(new Set(a.observing_)).map(pf));return d}function qe(){this.message="FLOW_CANCELLED"}function ue(a){return!0===(null==a?void 0:a.isMobXFlow)}function kd(a,d){return a?void 0!==d?ve(a)?a[ih].values_.has(d):!1:ve(a)||!!a[ih]||Pw(a)||Xu(a)||tt(a):!1}function Ae(a){if(ve(a))return a[ih].ownKeys_();f(38)}function Bf(a,d,l){a.set(d,l);return l}function gg(a,d){if(null==a||"object"!==typeof a||a instanceof
Date||!kd(a))return a;if(UD(a)||tt(a))return gg(a.get(),d);if(d.has(a))return d.get(a);if(rd(a)){var l=Bf(d,a,Array(a.length));a.forEach(function(ra,Ka){l[Ka]=gg(ra,d)});return l}if(gr(a)){var K=Bf(d,a,new Set);a.forEach(function(ra){K.add(gg(ra,d))});return K}if(Vp(a)){var da=Bf(d,a,new Map);a.forEach(function(ra,Ka){da.set(Ka,gg(ra,d))});return da}var ja=Bf(d,a,{});Ae(a).forEach(function(ra){pt.propertyIsEnumerable.call(a,ra)&&(ja[ra]=gg(a[ra],d))});return ja}function jc(a,d){return gg(a,new Map)}
function Zc(){f("trace() is not available in production builds");for(var a=!1,d=arguments.length,l=Array(d),K=0;K<d;K++)l[K]=arguments[K];"boolean"===typeof l[l.length-1]&&(a=l.pop());a:{switch(l.length){case 0:d=Af.trackingDerivation;break a;case 1:d=ec(l[0]);break a;case 2:d=ec(l[0],l[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_===ds.NONE&&console.log("[mobx.trace] '"+
d.name_+"' tracing enabled");d.isTracing_=a?ds.BREAK:ds.LOG}function Gc(a,d){void 0===d&&(d=void 0);Sc();try{return a.apply(d)}finally{Ib()}}function wb(a){return void 0!==a.interceptors_&&0<a.interceptors_.length}function Bb(a,d){var l=a.interceptors_||(a.interceptors_=[]);l.push(d);return J(function(){var K=l.indexOf(d);-1!==K&&l.splice(K,1)})}function Eb(a,d){var l=dc();try{var K=[].concat(a.interceptors_||[]);a=0;for(var da=K.length;a<da&&((d=K[a](d))&&!d.type&&f(14),d);a++);return d}finally{Af.trackingDerivation=
l}}function hd(a){return void 0!==a.changeListeners_&&0<a.changeListeners_.length}function Ud(a,d){var l=a.changeListeners_||(a.changeListeners_=[]);l.push(d);return J(function(){var K=l.indexOf(d);-1!==K&&l.splice(K,1)})}function Td(a,d){var l=dc();if(a=a.changeListeners_){a=a.slice();for(var K=0,da=a.length;K<da;K++)a[K](d);Af.trackingDerivation=l}}function Ue(a,d,l){var K=Hd(a,l)[ih];Sc();try{var da;null!=(da=d)?da:d=Ja(a);Su(d).forEach(function(ja){return K.make_(ja,d[ja])})}finally{Ib()}return a}
function kb(a,d,l,K){void 0===l&&(l="ObservableArray");void 0===K&&(K=!1);C();d=new Qw(l,d,K,!1);G(d.values_,ih,d);l=new Proxy(d.values_,eE);d.proxy_=l;a&&a.length&&(K=vc(!0),d.spliceWithArray_(0,0,a),Af.allowStateChanges=K);return l}function ub(a,d){"function"===typeof Array.prototype[a]&&(Yu[a]=d(a))}function ob(a){return function(){var d=this[ih];d.atom_.reportObserved();d=d.dehanceValues_(d.values_);return d[a].apply(d,arguments)}}function Ub(a){return function(d,l){var K=this,da=this[ih];da.atom_.reportObserved();
return da.dehanceValues_(da.values_)[a](function(ja,ra){return d.call(l,ja,ra,K)})}}function Tb(a){return function(){var d=this,l=this[ih];l.atom_.reportObserved();l=l.dehanceValues_(l.values_);var K=arguments[0];arguments[0]=function(da,ja,ra){return K(da,ja,ra,d)};return l[a].apply(l,arguments)}}function rd(a){return T(a)&&fE(a[ih])}function td(a){if(N(a)||Vp(a))return a;if(Array.isArray(a))return new Map(a);if(L(a)){var d=new Map,l;for(l in a)d.set(l,a[l]);return d}return f(21,a)}function Hd(a,
d){var l;if(U(a,ih))return a;var K=null!=(l=null==d?void 0:d.name)?l:"ObservableObject";l=nz;var da=new Map;K=String(K);var ja;var ra=d?null!=(ja=d.defaultDecorator)?ja:Wa(d):void 0;d=new l(a,da,K,ra);R(a,ih,d);return a}function te(a){return mz[a]||(mz[a]={get:function(){return this[ih].getObservablePropValue_(a)},set:function(d){return this[ih].setObservablePropValue_(a,d)}})}function ve(a){return T(a)?mE(a[ih]):!1}function pe(a){return{enumerable:!1,configurable:!0,get:function(){return this[ih].get_(a)},
set:function(d){this[ih].set_(a,d)}}}function $d(a){if(a>Rw){for(var d=Rw;d<a+100;d++)jp(Sw.prototype,""+d,pe(d));Rw=a}}function Ab(a,d,l){return new Sw(a,d,l)}function ec(a,d){if("object"===typeof a&&null!==a){if(rd(a))return void 0!==d&&f(23),a[ih].atom_;if(gr(a))return a[ih];if(Vp(a)){if(void 0===d)return a.keysAtom_;var l=a.data_.get(d)||a.hasMap_.get(d);l||f(25,d,Ya(a));return l}if(ve(a)){if(!d)return f(26);(l=a[ih].values_.get(d))||f(27,d,Ya(a));return l}if(Pw(a)||tt(a)||Xu(a))return a}else if(W(a)&&
Xu(a[ih]))return a[ih];f(28)}function wc(a,d){a||f(29);if(void 0!==d)return wc(ec(a,d));if(Pw(a)||tt(a)||Xu(a)||Vp(a)||gr(a))return a;if(a[ih])return a[ih];f(24,a)}function Ya(a,d){if(void 0!==d)a=ec(a,d);else{if(Jc(a))return a.name;a=ve(a)||Vp(a)||gr(a)?wc(a):ec(a)}return a.name_}function sa(a,d,l){void 0===l&&(l=-1);return qa(a,d,l)}function qa(a,d,l,K,da){if(a===d)return 0!==a||1/a===1/d;if(null==a||null==d)return!1;if(a!==a)return d!==d;var ja=typeof a;if("function"!==ja&&"object"!==ja&&"object"!=
typeof d)return!1;ja=pz.call(a);if(ja!==pz.call(d))return!1;switch(ja){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<=l&&l++}a=Ea(a);d=Ea(d);ja="[object Array]"===ja;if(!ja){if("object"!=typeof a||"object"!=
typeof d)return!1;var ra=a.constructor,Ka=d.constructor;if(ra!==Ka&&!(W(ra)&&ra instanceof ra&&W(Ka)&&Ka instanceof Ka)&&"constructor"in a&&"constructor"in d)return!1}if(0===l)return!1;0>l&&(l=-1);K=K||[];da=da||[];for(ra=K.length;ra--;)if(K[ra]===a)return da[ra]===d;K.push(a);da.push(d);if(ja){ra=a.length;if(ra!==d.length)return!1;for(;ra--;)if(!qa(a[ra],d[ra],l-1,K,da))return!1}else{ja=Object.keys(a);ra=ja.length;if(Object.keys(d).length!==ra)return!1;for(;ra--;)if(Ka=ja[ra],!U(d,Ka)||!qa(a[Ka],
d[Ka],l-1,K,da))return!1}K.pop();da.pop();return!0}function Ea(a){return rd(a)?a.slice():N(a)||Vp(a)||M(a)||gr(a)?Array.from(a.entries()):a}function Va(a){a[Symbol.iterator]=xb;return a}function xb(){return this}function ac(a,d){const l=new Set(d),K=Object.values(a),da=new Set(K.filter(ja=>l.has(ja.toId)||l.has(ja.fromId)));a=da.size;for(d=-1;0!==d;)da.forEach(ja=>{ja=ja.fromId;for(const ra of K)ra.fromId===ja&&da.add(ra),ra.toId===ja&&da.add(ra)}),d=da.size-a,a=da.size;return Array.from(da.values())}
function Hc(a,d,l,K,da,ja,ra,Ka){if(da=d.getBindingPoint(da,ja,ra,Ka))return{id:K,type:"line",fromId:a.id,toId:d.id,handleId:l,point:be.toFixed(da.point),distance:da.distance}}function Wc(a,d){const l=a.getCenter(),K=d.getCenter();var da=qk();da=ff(Zd({},wt.defaultProps),{id:da,type:wt.id,parentId:a.props.parentId,point:l});a=Hc(da,a,"start",qk(),l,l,be.uni(be.sub(K,l)),!1);d=Hc(da,d,"end",qk(),K,K,be.uni(be.sub(l,K)),!1);return a&&d?(da.handles.start.point=[0,0],da.handles.end.point=be.sub(K,l),
da.handles.start.bindingId=a.id,da.handles.end.bindingId=d.id,[da,[a,d]]):null}function Wd(){return new vE}function re(){return new WeakMap}function xe(a){if(!a)return $w(null);var d=a.constructor;if(d===Object)return a===Object.prototype?{}:$w(a);if(~tE.call(d).indexOf("[native code]"))try{return new d}catch(l){}return $w(a)}function Cf(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 kf(a){return a.flags}function Df(a){a=
uE.call(a);return a.substring(8,a.length-1)}function tf(a){return a[Symbol.toStringTag]||Df(a)}function rg(a){return bA(a).concat(ax(a))}function gh(a,d,l){for(var K=CE(a),da=0,ja=K.length,ra,Ka;da<ja;++da)if(ra=K[da],"callee"!==ra&&"caller"!==ra)if(Ka=AE(a,ra)){Ka.get||Ka.set||(Ka.value=l.copier(Ka.value,l));try{zE(d,ra,Ka)}catch(Sa){d[ra]=Ka.value}}else d[ra]=l.copier(a[ra],l);return d}function jh(a,d){var l=new d.Constructor;d.cache.set(a,l);a.forEach(function(K,da){l.set(da,d.copier(K,d))});return l}
function Uf(a,d){var l=xe(d.prototype);d.cache.set(a,l);for(var K in a)dA.call(a,K)&&(l[K]=d.copier(a[K],d));return l}function hh(a,d){var l=xe(d.prototype);d.cache.set(a,l);for(var K in a)dA.call(a,K)&&(l[K]=d.copier(a[K],d));K=ax(a);for(var da=0,ja=K.length,ra;da<ja;++da)ra=K[da],BE.call(a,ra)&&(l[ra]=d.copier(a[ra],d));return l}function ti(a,d){return new d.Constructor(a.valueOf())}function hi(a,d){return a}function Rj(a,d){var l=new d.Constructor;d.cache.set(a,l);a.forEach(function(K){l.add(d.copier(K,
d))});return l}function Lk(a){function d(ja,ra){ra.prototype=ra.Constructor=void 0;if(!ja||"object"!==typeof ja)return ja;if(ra.cache.has(ja))return ra.cache.get(ja);ra.prototype=ja.__proto__||EE(ja);ra.Constructor=ra.prototype&&ra.prototype.constructor;if(!ra.Constructor||ra.Constructor===Object)return da(ja,ra);if(DE(ja))return K(ja,ra);var Ka=l[yE(ja)];return Ka?Ka(ja,ra):"function"===typeof ja.then?ja:da(ja,ra)}a=bx({},fA,a);var l={Arguments:a.object,Array:a.array,ArrayBuffer:a.arrayBuffer,Blob:a.blob,
Boolean:ti,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:ti,Object:a.object,Promise:hi,RegExp:a.regExp,Set:a.set,String:ti,WeakMap:hi,WeakSet:hi,Uint8Array:a.arrayBuffer,Uint8ClampedArray:a.arrayBuffer,Uint16Array:a.arrayBuffer,Uint32Array:a.arrayBuffer,Uint64Array:a.arrayBuffer},K=l.Array,da=l.Object;return function(ja){return d(ja,{Constructor:void 0,cache:wE(),
copier:d,prototype:void 0})}}function Vl(a,d){return(0,IE.default)(a,d,{arrayMerge:(l,K,da)=>K})}function jk(a,d,l,K=!1){const [da,ja]=d,[ra,Ka]=l;a=ra+(a-da)/(ja-da)*(Ka-ra);return K?ra<Ka?Math.max(Math.min(a,Ka),ra):Math.max(Math.min(a,ra),Ka):a}function lj(a,d){return new Promise((l,K)=>{if("video"===d){const da=document.createElement("video");da.addEventListener("loadedmetadata",function(){l([this.videoWidth,this.videoHeight])},!1);da.src=a}else if("image"===d){const da=new Image;da.onload=()=>
l([da.width,da.height]);da.src=a;da.onerror=ja=>K(ja)}else"pdf"===d&&l([595,842])})}function Gi(a){return Object.values(Iw).includes(a)}function sh(a,d){return Gi(a)||null==a?`var(--ls-wb-${d}-color-${a?a:"default"})`:a}function Wl(){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 Mi(a,d,l=0){var K,da,ja;if(!a)return[16,32];let ra;ra="string"===typeof d?d:`${null!=(K=d.fontStyle)?K:"normal"} ${null!=(da=d.fontVariant)?da:"normal"} ${null!=(ja=d.fontWeight)?ja:"normal"} ${d.fontSize}px/${d.fontSize*d.lineHeight}px ${d.fontFamily}`;if(!cx.has(`${a}-${ra}-${l}`)){if(!Zp)return[10,
10];Zp.parentNode||document.body.appendChild(Zp);Zp.innerHTML=`${a}&#8203;`;Zp.style.font=ra;Zp.style.padding=l+"px";d=Zp.getBoundingClientRect();cx.set(`${a}-${ra}-${l}`,[Math.ceil(d.width||1),Math.ceil(d.height||1)])}return cx.get(`${a}-${ra}-${l}`)}function Dj(a){try{if("string"!==typeof a||!ED.test(a))throw TypeError("Invalid UUID");let d;const l=new Uint8Array(16);l[0]=(d=parseInt(a.slice(0,8),16))>>>24;l[1]=d>>>16&255;l[2]=d>>>8&255;l[3]=d&255;l[4]=(d=parseInt(a.slice(9,13),16))>>>8;l[5]=d&
255;l[6]=(d=parseInt(a.slice(14,18),16))>>>8;l[7]=d&255;l[8]=(d=parseInt(a.slice(19,23),16))>>>8;l[9]=d&255;l[10]=(d=parseInt(a.slice(24,36),16))/1099511627776&255;l[11]=d/4294967296&255;l[12]=d>>>24&255;l[13]=d>>>16&255;l[14]=d>>>8&255;l[15]=d&255;return!0}catch(d){return!1}}function Xj(a,d=0,l){let K;return function(...da){null==l?void 0:l(...da);clearTimeout(K);K=setTimeout(()=>a.apply(da),d)}}function oh(){return/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)}function wf(){var a,d,l;return(null==
(l=null==(d=null==(a=null==window?void 0:window.logseq)?void 0:a.api)?void 0:d.get_state_from_store)?void 0:l.call(d,"ui/developer-mode?"))||!1}function cg(a){return!!a}function zk(a=0){return new Promise(d=>setTimeout(d,a))}function ll(a="noid"){dx[a]||(dx[a]=iA.createContext({}));return dx[a]}function dh(a="noid"){return iA.useContext(ll(a))}function kk(a){const {callbacks:d}=dh(),l=hA.useRef(-1);return hA.useMemo(()=>{const K=da=>{var ja,ra;const {order:Ka=0}=da;if(!Ka){var Sa=da.target;Sa.removeEventListener("pointerup",
K);Sa.releasePointerCapture(da.pointerId);null==(ja=d.onPointerUp)?void 0:ja.call(d,{type:"selection",handle:a,order:Ka},da);ja=Date.now();Sa=ja-l.current;300<Sa?l.current=ja:300>=Sa&&(null==(ra=d.onDoubleClick)?void 0:ra.call(d,{type:"selection",handle:a,order:Ka},da),l.current=-1);da.order=Ka+1}};return{onPointerDown:da=>{var ja;const {order:ra=0}=da;if(!ra){var Ka=Zk(da.currentTarget);Ka.setPointerCapture(da.pointerId);Ka.addEventListener("pointerup",K);null==(ja=d.onPointerDown)?void 0:ja.call(d,
{type:"selection",handle:a,order:ra},da);da.order=ra+1}},onPointerMove:da=>{var ja;const {order:ra=0}=da;ra||(null==(ja=d.onPointerMove)?void 0:ja.call(d,{type:"selection",handle:a,order:ra},da),da.order=ra+1)},onPointerEnter:da=>{var ja;const {order:ra=0}=da;ra||(null==(ja=d.onPointerEnter)?void 0:ja.call(d,{type:"selection",handle:a,order:ra},da),da.order=ra+1)},onPointerLeave:da=>{var ja;const {order:ra=0}=da;ra||(null==(ja=d.onPointerLeave)?void 0:ja.call(d,{type:"selection",handle:a,order:ra},
da),da.order=ra+1)},onKeyDown:da=>{var ja;null==(ja=d.onKeyDown)?void 0:ja.call(d,{type:"selection",handle:a,order:-1},da)},onKeyUp:da=>{var ja;null==(ja=d.onKeyUp)?void 0:ja.call(d,{type:"selection",handle:a,order:-1},da)}}},[d])}function Zk(a){var d;if(null==(d=a.namespaceURI)?0:d.endsWith("svg")){if(a.parentElement)return Zk(a.parentElement);throw Error("Could not find a parent element of an HTML type!");}return a}function mj(a,d,l){const K=yt.useRef(!1),da=yt.useCallback(()=>{var ja;if(K.current){const ra=
null==(ja=a.current)?void 0:ja.getBoundingClientRect();ra&&(ja={minX:ra.left,maxX:ra.left+ra.width,minY:ra.top,maxY:ra.top+ra.height,width:ra.width,height:ra.height},d.updateBounds(ja),null==l?void 0:l(ja))}else K.current=!0},[a,l]);yt.useEffect(()=>{const ja=a.current?LE(a.current):document,ra=Xj(da,100);ja.addEventListener("scroll",ra);window.addEventListener("resize",ra);return()=>{ja.removeEventListener("scroll",ra);window.removeEventListener("resize",ra)}},[]);yt.useLayoutEffect(()=>{const ja=
new ResizeObserver(ra=>{ra[0].contentRect&&da()});a.current&&ja.observe(a.current);return()=>{ja.disconnect()}},[a]);yt.useEffect(()=>{da();setTimeout(()=>{var ja,ra;null==(ra=null==(ja=a.current)?void 0:ja.querySelector(".tl-canvas"))?void 0:ra.focus()})},[a])}function ml(a,d){return Object.keys(d).reduce((l,K)=>{const da=d[K];return da?l+`${`--${a}-${K}`}: ${da};
`:l},"")}function Ch(a,d,l=".logseq-tldraw"){ex.useLayoutEffect(()=>{const K=document.createElement("style"),da=ml(a,d);K.setAttribute("id",`${a}-theme`);K.setAttribute("data-selector",l);K.innerHTML=`
        ${l} {
          ${da}
        }
      `;document.head.appendChild(K);return()=>{K&&document.head.contains(K)&&document.head.removeChild(K)}},[a,d,l])}function Yj(a,d){ex.useLayoutEffect(()=>{if(fx.get(a))return()=>{};const l=document.createElement("style");l.innerHTML=d;l.setAttribute("id",a);document.head.appendChild(l);fx.set(a,l);return()=>{l&&document.head.contains(l)&&(document.head.removeChild(l),fx.delete(a))}},[a,d])}function $k(a,d){const l=ex.useMemo(()=>Zd(Zd({},ME),a),[a]);Ch("tl",l,d);Yj("tl-canvas",NE)}function Ej(a=
"noid"){gx[a]||(gx[a]=kA.createContext({}));return gx[a]}function mg(a="noid"){return kA.useContext(Ej(a))}function hg(){const a=mg(),{callbacks:d}=dh(),l=jA.useRef(-1);return jA.useMemo(()=>({onPointerDown:K=>{var da,ja,ra;if(!a.settings.penMode||"pen"===K.pointerType&&K.isPrimary){var {order:Ka=0}=K;Ka||(null==(da=K.currentTarget)?void 0:da.setPointerCapture(K.pointerId));K.isPrimary&&(null==(ja=d.onPointerDown)?void 0:ja.call(d,{type:"canvas",order:Ka},K),da=Date.now(),ja=da-l.current,300<ja?l.current=
da:300>=ja&&(null==(ra=d.onDoubleClick)?void 0:ra.call(d,{type:"canvas",order:Ka},K),l.current=-1))}},onPointerMove:K=>{var da;if(!a.settings.penMode||"pen"===K.pointerType&&K.isPrimary){var {order:ja=0}=K;null==(da=d.onPointerMove)?void 0:da.call(d,{type:"canvas",order:ja},K)}},onPointerUp:K=>{var da,ja;if(!a.settings.penMode||"pen"===K.pointerType&&K.isPrimary){var {order:ra=0}=K;ra||(null==(da=K.currentTarget)?void 0:da.releasePointerCapture(K.pointerId));null==(ja=d.onPointerUp)?void 0:ja.call(d,
{type:"canvas",order:ra},K)}},onPointerEnter:K=>{var da;if(!a.settings.penMode||"pen"===K.pointerType&&K.isPrimary){var {order:ja=0}=K;null==(da=d.onPointerEnter)?void 0:da.call(d,{type:"canvas",order:ja},K)}},onPointerLeave:K=>{var da;if(!a.settings.penMode||"pen"===K.pointerType&&K.isPrimary){var {order:ja=0}=K;null==(da=d.onPointerLeave)?void 0:da.call(d,{type:"canvas",order:ja},K)}},onDrop:K=>Oh(this,null,function*(){K.preventDefault();"clientX"in K&&a.drop(K.dataTransfer,[K.clientX,K.clientY])}),
onDragOver:K=>{K.preventDefault()},onTouchEnd:K=>{let da=a.selectedTool.id;"pencil"!==da&&"highlighter"!==da||K.preventDefault()}}),[d])}function qf(a,d,l){return 0===d||Infinity===Math.abs(d)?Math.pow(a,5*l):a*d*l/(d+l*a)}function nj(a,d,l,K=.15){return 0===K?Math.max(d,Math.min(a,l)):a<d?-qf(d-a,l-d,K)+d:a>l?+qf(a-l,l-d,K)+l:a}function Zh(a,[d,l],[K,da]){const [[ja,ra],[Ka,Sa]]=a;return[nj(d,ja,ra,K),nj(l,Ka,Sa,da)]}function ui(a,d,l){d in a?Object.defineProperty(a,d,{value:l,enumerable:!0,configurable:!0,
writable:!0}):a[d]=l;return a}function oj(a,d){var l=Object.keys(a);if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(a);d&&(K=K.filter(function(da){return Object.getOwnPropertyDescriptor(a,da).enumerable}));l.push.apply(l,K)}return l}function Tg(a){for(var d=1;d<arguments.length;d++){var l=null!=arguments[d]?arguments[d]:{};d%2?oj(Object(l),!0).forEach(function(K){ui(a,K,l[K])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(l)):oj(Object(l)).forEach(function(K){Object.defineProperty(a,
K,Object.getOwnPropertyDescriptor(l,K))})}return a}function $h(a){return a?a[0].toUpperCase()+a.slice(1):""}function fj(a=!1,d){return a&&!OE.includes(d)}function El(a,d="",l=!1){const K=lA[a];d=K?K[d]||d:d;return"on"+$h(a)+$h(d)+(fj(l,d)?"Capture":"")}function Of(a){a=a.substring(2).toLowerCase();const d=!!~a.indexOf("passive");d&&(a=a.replace("passive",""));var l=PE.includes(a)?"capturecapture":"capture";(l=!!~a.indexOf(l))&&(a=a.replace("capture",""));return{device:a,capture:l,passive:d}}function Ni(a,
d=""){const l=lA[a];return a+(l?l[d]||d:d)}function wh(a){return"touches"in a?"touch":"pointerType"in a?a.pointerType:"mouse"}function nl(a){return Array.from(a.touches).filter(d=>{var l,K;return d.target===a.currentTarget||(null===(l=a.currentTarget)||void 0===l?void 0:null===(K=l.contains)||void 0===K?void 0:K.call(l,d.target))})}function Sj(a){return"touches"in a?("touchend"===a.type||"touchcancel"===a.type?a.changedTouches:a.targetTouches)[0]:a}function im(a,d){const l=d.clientX-a.clientX,K=d.clientY-
a.clientY;return{angle:-(180*Math.atan2(l,K))/Math.PI,distance:Math.hypot(l,K),origin:[(d.clientX+a.clientX)/2,(d.clientY+a.clientY)/2]}}function Fj(a){return nl(a).map(d=>d.identifier)}function Oi(a,d){const [l,K]=Array.from(a.touches).filter(da=>d.includes(da.identifier));return im(l,K)}function Zi(a){const d=Sj(a);return"touches"in a?d.identifier:d.pointerId}function Mk(a){a=Sj(a);return[a.clientX,a.clientY]}function Nk(a){let {deltaX:d,deltaY:l,deltaMode:K}=a;1===K?(d*=40,l*=40):2===K&&(d*=800,
l*=800);return[d,l]}function ah(a,...d){return"function"===typeof a?a(...d):a}function ai(){}function Ph(...a){return 0===a.length?ai:1===a.length?a[0]:function(){let d;for(const l of a)d=l.apply(this,arguments)||d;return d}}function Ak([a,d],l){a=Math.abs(a);d=Math.abs(d);if(a>d&&a>l)return"x";if(d>a&&d>l)return"y"}function al(a){const [d,l]=a.overflow,[K,da]=a._delta,[ja,ra]=a._direction;if(0>d&&0<K&&0>ja||0<d&&0>K&&0<ja)a._movement[0]=a._movementBound[0];if(0>l&&0<da&&0>ra||0<l&&0>da&&0<ra)a._movement[1]=
a._movementBound[1]}function bi(a){hx.set(a.key,a.engine);ix.set(a.key,a.resolver)}function bl(a={},d){const l={};for(const [K,da]of Object.entries(d))switch(typeof da){case "function":l[K]=da.call(l,a[K],K,a);break;case "object":l[K]=bl(a[K],da);break;case "boolean":da&&(l[K]=a[K])}return l}function Di(a,d,l={}){const {target:K,eventOptions:da,window:ja,enabled:ra,transform:Ka}=a;var Sa=lF;if(null==a)a={};else{if(null==a)var bb={};else{bb={};var gb=Object.keys(a),jb;for(jb=0;jb<gb.length;jb++){var Jb=
gb[jb];0<=Sa.indexOf(Jb)||(bb[Jb]=a[Jb])}}if(Object.getOwnPropertySymbols)for(jb=Object.getOwnPropertySymbols(a),Jb=0;Jb<jb.length;Jb++)gb=jb[Jb],0<=Sa.indexOf(gb)||Object.prototype.propertyIsEnumerable.call(a,gb)&&(bb[gb]=a[gb]);a=bb}l.shared=bl({target:K,eventOptions:da,window:ja,enabled:ra,transform:Ka},kF);if(d){var Ob=ix.get(d);l[d]=bl(Tg({shared:l.shared},a),Ob)}else for(Ob in a)(d=ix.get(Ob))&&(l[Ob]=bl(Tg({shared:l.shared},a[Ob]),d));return l}function mi(a,d){a.gestures.add(d);a.gestureEventStores[d]=
new tA(a,d);a.gestureTimeoutStores[d]=new mF}function Zj(a,d,l,K,da,ja){if(a.has(l)&&hx.has(K)){var ra=l+"Start",Ka=l+"End";da[K]=Sa=>{let bb=void 0;if(Sa.first&&ra in d)d[ra](Sa);l in d&&(bb=d[l](Sa));if(Sa.last&&Ka in d)d[Ka](Sa);return bb};ja[K]=ja[K]||{}}}function ni(a,d={},l,K){const da=jx.default.useMemo(()=>new nF(a),[]);da.applyHandlers(a,K);da.applyConfig(d,l);jx.default.useEffect(da.effect.bind(da));jx.default.useEffect(()=>da.clean.bind(da),[]);if(void 0===d.target)return da.bind.bind(da)}
function Dh(a){a.forEach(bi);return function(d,l){l=l||{};const K={},da={},ja=new Set;for(let Jb in d)oF.test(Jb)?(ja.add(RegExp.lastMatch),da[Jb]=d[Jb]):K[Jb]=d[Jb];const [ra,Ka,Sa]=[da,K,ja];d={};Zj(Sa,ra,"onDrag","drag",d,l);Zj(Sa,ra,"onWheel","wheel",d,l);Zj(Sa,ra,"onScroll","scroll",d,l);Zj(Sa,ra,"onPinch","pinch",d,l);Zj(Sa,ra,"onMove","move",d,l);Zj(Sa,ra,"onHover","hover",d,l);const {handlers:bb,nativeHandlers:gb,config:jb}={handlers:d,config:l,nativeHandlers:Ka};return ni(bb,jb,void 0,gb)}}
function vi(a,d){return Dh([eF,hF,iF,jF,gF,fF])(a,d||{})}function $i(a){const {viewport:d,inputs:l,callbacks:K}=dh(),da=cv.useRef(void 0),ja=cv.useRef([0,0]),ra=cv.useRef(0),Ka=cv.useMemo(()=>({onWheel:Sa=>{var bb;({event:Sa}=Sa);Sa.preventDefault();const {deltaY:gb,deltaX:jb}=Sa;var Jb=0;if(Sa.ctrlKey||Sa.metaKey){Jb=Math.sign(Sa.deltaY);let rc=gb;10<Math.abs(Sa.deltaY)&&(rc=10*Jb);Jb=rc}const [Ob,Lb,gc]=[jb,gb,Jb];"pinching"===l.state||ra.current>=Sa.timeStamp||(ra.current=Sa.timeStamp,(Sa.altKey||
Sa.ctrlKey||Sa.metaKey)&&0===Sa.buttons?(Jb=d.bounds,Sa=null!=(bb=l.currentScreenPoint)?bb:[Jb.width/2,Jb.height/2],bb=d.camera.zoom,d.onZoom(Sa,bb-gc/100*bb)):(bb=be.mul(Sa.shiftKey&&!oh()?[Lb,0]:[Ob,Lb],.8),be.isEqual(bb,[0,0])||d.panCamera(bb)))},onPinchStart:({event:Sa,delta:bb,offset:gb,origin:jb})=>{var Jb;const Ob=a.current;Sa instanceof WheelEvent||!(Sa.target===Ob||null!=Ob&&Ob.contains(Sa.target))||(null==(Jb=K.onPinchStart)?void 0:Jb.call(K,{type:"canvas",order:0,delta:[...bb,gb[0]],offset:gb,
point:be.sub(jb,l.containerOffset)},Sa),da.current=jb,ja.current=[0,0])},onPinchEnd:({event:Sa,offset:bb,origin:gb})=>{var jb;const Jb=a.current;Sa instanceof WheelEvent||!(Sa.target===Jb||null!=Jb&&Jb.contains(Sa.target))||"pinching"!==l.state||(null==(jb=K.onPinchEnd)?void 0:jb.call(K,{type:"canvas",order:0,delta:[0,0,bb[0]],offset:bb,point:be.sub(gb,l.containerOffset)},Sa),ja.current=[0,0])},onPinch:({event:Sa,offset:bb,origin:gb})=>{var jb,Jb=a.current;if(!(Sa instanceof WheelEvent)&&(Sa.target===
Jb||null!=Jb&&Jb.contains(Sa.target))){da.current||(da.current=gb);Jb=be.sub(da.current,gb);var Ob=be.sub(Jb,ja.current);null==(jb=K.onPinch)?void 0:jb.call(K,{type:"canvas",order:0,delta:[...Ob,bb[0]],offset:bb,point:be.sub(gb,l.containerOffset)},Sa);ja.current=Jb}}}),[K]);vi(Ka,{target:a,eventOptions:{passive:!1},pinch:{from:[d.camera.zoom,d.camera.zoom],scaleBounds:()=>({from:d.camera.zoom,max:Mn.maxZoom,min:Mn.minZoom})}})}function pb(a,d,l,K){kx.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,l,d.rotation]);kx.useLayoutEffect(()=>{const da=a.current;da.style.width=`calc(${Math.floor(d.width)}px + (var(--tl-padding) * 2))`;da.style.height=`calc(${Math.floor(d.height)}px + (var(--tl-padding) * 2))`},[d.width,d.height]);kx.useLayoutEffect(()=>{const da=a.current;void 0!==K&&(da.style.zIndex=K.toString())},[K])}function nc(a,d){const {onPersist:l,onError:K,onMount:da,onCreateAssets:ja,onCreateShapes:ra,onDeleteAssets:Ka,onDeleteShapes:Sa,onDrop:bb,
onPaste:gb,onCopy:jb,onCanvasDBClick:Jb}=d;vA.useLayoutEffect(()=>{const Ob=[];if(a)return window.tlapps=window.tlapps||{},window.tlapps[a.uuid]=a,da&&da(a,null),()=>{Ob.forEach(Lb=>Lb());window.tlapps&&delete window.tlapps[a.uuid]}},[a]);vA.useLayoutEffect(()=>{const Ob=[];l&&Ob.push(a.subscribe("persist",l));K&&Ob.push(a.subscribe("error",K));ra&&Ob.push(a.subscribe("create-shapes",ra));ja&&Ob.push(a.subscribe("create-assets",ja));Sa&&Ob.push(a.subscribe("delete-shapes",Sa));Ka&&Ob.push(a.subscribe("delete-assets",
Ka));bb&&Ob.push(a.subscribe("drop",bb));gb&&Ob.push(a.subscribe("paste",gb));jb&&Ob.push(a.subscribe("copy",jb));Jb&&Ob.push(a.subscribe("canvas-dbclick",Jb));return()=>Ob.forEach(Lb=>Lb())},[a,l,K])}function yc(a){if("app"in a)return a.app;const [d]=wA.useState(()=>new JE(a.model,a.Shapes,a.Tools,a.readOnly));wA.useLayoutEffect(()=>()=>{d.dispose()},[d]);return d}function Tc(a,d){pF.useEffect(()=>{"model"in d&&d.model&&a.loadDocumentModel(d.model)},[d.model])}function $c(a){const d=dh(),{viewport:{bounds:l}}=
d;qF.useEffect(()=>{const K=ra=>{ra.preventDefault()},da=ra=>{if(0!==ra.touches.length){var Ka=ra.touches[0].pageX,Sa=ra.touches[0].radiusX||0;(10>Ka-Sa||Ka+Sa>l.width-10)&&ra.preventDefault()}},ja=a.current;if(!ja)return()=>{};ja.addEventListener("touchstart",K,{passive:!0});ja.addEventListener("gestureend",K,{passive:!0});ja.addEventListener("gesturechange",K,{passive:!0});ja.addEventListener("gesturestart",K,{passive:!0});ja.addEventListener("touchstart",da,{passive:!0});return()=>{ja&&(ja.removeEventListener("touchstart",
K),ja.removeEventListener("gestureend",K),ja.removeEventListener("gesturechange",K),ja.removeEventListener("gesturestart",K),ja.removeEventListener("touchstart",da))}},[a,l.width])}function ld(a,d){const {inputs:l,callbacks:K}=dh();return rF.useMemo(()=>({onPointerDown:da=>{var ja,ra;const {order:Ka=0}=da;Ka||(null==(ja=da.currentTarget)?void 0:ja.setPointerCapture(da.pointerId));ja=a.props.handles[d];null==(ra=K.onPointerDown)?void 0:ra.call(K,{type:"handle",shape:a,handle:ja,id:d,order:Ka},da);
da.order=Ka+1},onPointerMove:da=>{var ja;const {order:ra=0}=da,Ka=a.props.handles[d];null==(ja=K.onPointerMove)?void 0:ja.call(K,{type:"handle",shape:a,handle:Ka,id:d,order:ra},da);da.order=ra+1},onPointerUp:da=>{var ja,ra;const {order:Ka=0}=da;Ka||(null==(ja=da.currentTarget)?void 0:ja.releasePointerCapture(da.pointerId));ja=a.props.handles[d];null==(ra=K.onPointerUp)?void 0:ra.call(K,{type:"handle",shape:a,handle:ja,id:d,order:Ka},da);da.order=Ka+1},onPointerEnter:da=>{var ja;const {order:ra=0}=
da,Ka=a.props.handles[d];null==(ja=K.onPointerEnter)?void 0:ja.call(K,{type:"handle",shape:a,handle:Ka,id:d,order:ra},da);da.order=ra+1},onPointerLeave:da=>{var ja;const {order:ra=0}=da,Ka=a.props.handles[d];null==(ja=K.onPointerLeave)?void 0:ja.call(K,{type:"handle",shape:a,handle:Ka,id:d,order:ra},da);da.order=ra+1},onKeyUp:da=>{var ja;const ra=a.props.handles[d];null==(ja=K.onKeyUp)?void 0:ja.call(K,{type:"handle",shape:a,handle:ra,id:d,order:-1},da)},onKeyDown:da=>{var ja;const ra=a.props.handles[d];
null==(ja=K.onKeyDown)?void 0:ja.call(K,{type:"handle",shape:a,handle:ra,id:d,order:-1},da)}}),[a.id,l,K])}function Ed(a,d,l=!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})${l?" scale(-1,-1) translate(0, -32)":""}'>`+a.replaceAll('"',"'")+'\x3c/g\x3e\x3c/svg\x3e") 16 16, pointer'}function Xd(a,d,l=0){sF.useEffect(()=>{const K=a.current;K&&(K.style.cursor=
tF[d](Ml.radiansToDegrees(l)))},[d,l])}function oe(a){const {viewport:d}=dh(),l=mg();uF.useLayoutEffect(()=>ic(()=>{const K=Xj(()=>{var da;null==(da=a.current)?void 0:da.style.setProperty("--tl-zoom",d.camera.zoom.toString())},200);"pinching"!==l.inputs.state&&null!=d.camera.zoom&&K()}),[])}function ye(a,d=0){const [l,K]=(0,xA.useState)(a);(0,xA.useEffect)(()=>{let da=!1;const ja=setTimeout(()=>{da||K(a)},d);return()=>{da=!0;clearTimeout(ja)}},[a,d]);return l}function ie(){const a=mg();yA.useEffect(()=>
{Rc(()=>Zd({},a.viewport.camera),()=>{window.sessionStorage.setItem("logseq.tldraw.camera:"+a.currentPageId,JSON.stringify(a.viewport.camera))})},[a.viewport.camera]);yA.useEffect(()=>{var d;const l=JSON.parse(null!=(d=window.sessionStorage.getItem("logseq.tldraw.camera:"+a.currentPageId))?d:"null");l?a.viewport.update(l):a.selectedIds.size?a.api.zoomToSelection():a.api.zoomToFit()},[a])}function se(a){a()}function Ke(a){return pf(ec(a,void 0))}function Se(a){return{reaction:a,mounted:!1,changedBeforeMount:!1,
cleanAt:Date.now()+wF}}function Nd(a){var d=new Map,l=1,K=new a(function(da){var ja=d.get(da);ja&&(ja.reaction.dispose(),d.delete(da))});return{addReactionToTrack:function(da,ja,ra){var Ka=l++;K.register(ra,Ka,da);da.current=Se(ja);da.current.finalizationRegistryCleanupToken=Ka;d.set(Ka,da.current);return da.current},recordReactionAsCommitted:function(da){K.unregister(da);da.current&&da.current.finalizationRegistryCleanupToken&&d.delete(da.current.finalizationRegistryCleanupToken)},forceCleanupTimerToRunNowForTests:function(){},
resetCleanupScheduleForTests:function(){}}}function Le(){function a(){void 0===K&&(K=setTimeout(d,1E4))}function d(){K=void 0;var da=Date.now();l.forEach(function(ja){var ra=ja.current;ra&&da>=ra.cleanAt&&(ra.reaction.dispose(),ja.current=null,l.delete(ja))});0<l.size&&a()}var l=new Set,K;return{addReactionToTrack:function(da,ja,ra){da.current=Se(ja);l.add(da);a();return da.current},recordReactionAsCommitted:function(da){l.delete(da)},forceCleanupTimerToRunNowForTests:function(){K&&(clearTimeout(K),
d())},resetCleanupScheduleForTests:function(){var da;if(0<l.size){try{for(var ja=xF(l),ra=ja.next();!ra.done;ra=ja.next()){var Ka=ra.value,Sa=Ka.current;Sa&&(Sa.reaction.dispose(),Ka.current=null)}}catch(gb){var bb={error:gb}}finally{try{ra&&!ra.done&&(da=ja.return)&&da.call(ja)}finally{if(bb)throw bb.error;}}l.clear()}K&&(clearTimeout(K),K=void 0)}}}function ne(){return new AF}function Qf(a,d){void 0===d&&(d="observed");var l=BA(Bt.default.useState(ne),1)[0],K=BA(Bt.default.useState(),2)[1],da=Bt.default.useRef(null);
if(!da.current)var ja=new es("observer".concat(d),function(){ra.mounted?K([]):ra.changedBeforeMount=!0}),ra=yF(da,ja,l);l=da.current.reaction;Bt.default.useDebugValue(l,Ke);Bt.default.useEffect(function(){zF(da);da.current?(da.current.mounted=!0,da.current.changedBeforeMount&&(da.current.changedBeforeMount=!1,K([]))):(da.current={reaction:new es("observer".concat(d),function(){K([])}),mounted:!0,changedBeforeMount:!1,cleanAt:Infinity},K([]));return function(){da.current.reaction.dispose();da.current=
null}},[]);var Ka,Sa;l.track(function(){try{Ka=a()}catch(bb){Sa=bb}});if(Sa)throw Sa;return Ka}function ee(a,d){var l;if(EA&&a.$$typeof===EA)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!==(l=null===d||void 0===d?void 0:d.forwardRef)&&void 0!==l?l:!1;var K=a,da=a.displayName||a.name;if(DA&&a.$$typeof===DA&&(d=!0,K=a.render,"function"!==typeof K))throw Error("[mobx-react-lite] `render` property of ForwardRef was not a function");
l=function(ja,ra){return Qf(function(){return K(ja,ra)},da)};""!==da&&(l.displayName=da);a.contextTypes&&(l.contextTypes=a.contextTypes);d&&(l=(0,ns.forwardRef)(l));l=(0,ns.memo)(l);Qe(a,l);return l}function Qe(a,d){Object.keys(a).forEach(function(l){BF[l]||Object.defineProperty(d,l,Object.getOwnPropertyDescriptor(a,l))})}function rf(a){var d=a.render;a=a.children||d;return"function"!==typeof a?null:Qf(a)}function sg(a){const d=mg(),{callbacks:l}=dh(),K=FA.useRef(!1);FA.useEffect(()=>{const da=Sa=>
{var bb,gb;if(null==(bb=a.current)?0:bb.contains(document.activeElement))null==(gb=l.onKeyDown)?void 0:gb.call(l,{type:"canvas",order:-1},Sa),K.current=Sa.shiftKey},ja=Sa=>{var bb,gb;if(null==(bb=a.current)?0:bb.contains(document.activeElement))null==(gb=l.onKeyUp)?void 0:gb.call(l,{type:"canvas",order:-1},Sa),K.current=Sa.shiftKey},ra=Sa=>{var bb,gb,jb;!d.editingShape&&(null==(bb=a.current)?0:bb.contains(document.activeElement))&&!["INPUT","TEXTAREA"].includes(null!=(jb=null==(gb=document.activeElement)?
void 0:gb.tagName)?jb:"")&&(Sa.preventDefault(),d.paste(Sa,K.current))},Ka=Sa=>{var bb,gb,jb;!d.editingShape&&0<d.selectedShapes.size&&(null==(bb=a.current)?0:bb.contains(document.activeElement))&&!["INPUT","TEXTAREA"].includes(null!=(jb=null==(gb=document.activeElement)?void 0:gb.tagName)?jb:"")&&(Sa.preventDefault(),d.copy())};window.addEventListener("keydown",da);window.addEventListener("keyup",ja);document.addEventListener("paste",ra);document.addEventListener("copy",Ka);return()=>{window.removeEventListener("keydown",
da);window.removeEventListener("keyup",ja);document.removeEventListener("paste",ra);document.removeEventListener("copy",Ka)}},[])}function Jg(a){const d=mg(),{inputs:l,callbacks:K}=dh(),da=KA.useRef(-1);return KA.useMemo(()=>({onPointerDown:ja=>{var ra,Ka;if(!d.settings.penMode||"pen"===ja.pointerType&&ja.isPrimary){var {order:Sa=0}=ja;Sa||(null==(ra=ja.currentTarget)?void 0:ra.setPointerCapture(ja.pointerId));null==(Ka=K.onPointerDown)?void 0:Ka.call(K,{type:"shape",shape:a,order:Sa},ja);ja.order=
Sa+1}},onPointerMove:ja=>{var ra;if(!d.settings.penMode||"pen"===ja.pointerType&&ja.isPrimary){var {order:Ka=0}=ja;null==(ra=K.onPointerMove)?void 0:ra.call(K,{type:"shape",shape:a,order:Ka},ja);ja.order=Ka+1}},onPointerUp:ja=>{var ra,Ka,Sa;if(!d.settings.penMode||"pen"===ja.pointerType&&ja.isPrimary){var {order:bb=0}=ja;bb||(null==(ra=ja.currentTarget)?void 0:ra.releasePointerCapture(ja.pointerId));null==(Ka=K.onPointerUp)?void 0:Ka.call(K,{type:"shape",shape:a,order:bb},ja);ra=Date.now();Ka=ra-
da.current;300<Ka?da.current=ra:300>=Ka&&(null==(Sa=K.onDoubleClick)?void 0:Sa.call(K,{type:"shape",shape:a,order:bb},ja),da.current=-1);ja.order=bb+1}},onPointerEnter:ja=>{var ra;if(!d.settings.penMode||"pen"===ja.pointerType&&ja.isPrimary){var {order:Ka=0}=ja;null==(ra=K.onPointerEnter)?void 0:ra.call(K,{type:"shape",shape:a,order:Ka},ja);ja.order=Ka+1}},onPointerLeave:ja=>{var ra;if(!d.settings.penMode||"pen"===ja.pointerType&&ja.isPrimary){var {order:Ka=0}=ja;null==(ra=K.onPointerLeave)?void 0:
ra.call(K,{type:"shape",shape:a,order:Ka},ja);ja.order=Ka+1}},onKeyUp:ja=>{var ra;null==(ra=K.onKeyUp)?void 0:ra.call(K,{type:"shape",shape:a,order:-1},ja)},onKeyDown:ja=>{var ra;null==(ra=K.onKeyDown)?void 0:ra.call(K,{type:"shape",shape:a,order:-1},ja)}}),[a.id,l,K])}function Mg(a){var {viewport:d,inputs:l,callbacks:K,components:da}=a;a=Jf(a,["viewport","inputs","callbacks","components"]);return(0,bB.jsx)(VF,{id:a.id,viewport:d,inputs:l,callbacks:K,components:da,meta:a.meta,children:(0,bB.jsx)(RF,
Zd({},a))})}function Oe(){Oe=Object.assign?Object.assign.bind():function(a){for(var d=1;d<arguments.length;d++){var l=arguments[d],K;for(K in l)Object.prototype.hasOwnProperty.call(l,K)&&(a[K]=l[K])}return a};return Oe.apply(this,arguments)}function Wf(a,d,{checkForDefaultPrevented:l=!0}={}){return function(K){null===a||void 0===a||a(K);if(!1===l||!K.defaultPrevented)return null===d||void 0===d?void 0:d(K)}}function vg(...a){return d=>a.forEach(l=>{"function"===typeof l?l(d):null!==l&&void 0!==l&&
(l.current=d)})}function $g(...a){return(0,$F.useCallback)(vg(...a),a)}function Gh(a,d=[]){let l=[];const K=()=>{const da=l.map(ja=>(0,lr.createContext)(ja));return function(ja){const ra=(null===ja||void 0===ja?void 0:ja[a])||da;return(0,lr.useMemo)(()=>({[`__scope${a}`]:ff(Zd({},ja),{[a]:ra})}),[ja,ra])}};K.scopeName=a;return[function(da,ja){function ra(bb){const {scope:gb,children:jb}=bb,Jb=Jf(bb,["scope","children"]);bb=(null===gb||void 0===gb?void 0:gb[a][Sa])||Ka;const Ob=(0,lr.useMemo)(()=>
Jb,Object.values(Jb));return(0,lr.createElement)(bb.Provider,{value:Ob},jb)}const Ka=(0,lr.createContext)(ja),Sa=l.length;l=[...l,ja];ra.displayName=da+"Provider";return[ra,function(bb,gb){if(gb=(0,lr.useContext)((null===gb||void 0===gb?void 0:gb[a][Sa])||Ka))return gb;if(void 0!==ja)return ja;throw Error(`\`${bb}\` must be used within \`${da}\``);}]},Qk(K,...d)]}function Qk(...a){const d=a[0];if(1===a.length)return d;const l=()=>{const K=a.map(da=>({useScope:da(),scopeName:da.scopeName}));return function(da){const ja=
K.reduce((ra,{useScope:Ka,scopeName:Sa})=>{Ka=Ka(da)[`__scope${Sa}`];return Zd(Zd({},ra),Ka)},{});return(0,lr.useMemo)(()=>({[`__scope${d.scopeName}`]:ja}),[ja])}};l.scopeName=d.scopeName;return l}function ug(a){return(0,Nl.isValidElement)(a)&&a.type===cB}function Zl(a,d){const l=Zd({},d);for(const K in d){const da=a[K],ja=d[K];/^on[A-Z]/.test(K)?da&&ja?l[K]=(...ra)=>{ja(...ra);da(...ra)}:da&&(l[K]=da):"style"===K?l[K]=Zd(Zd({},da),ja):"className"===K&&(l[K]=[da,ja].filter(Boolean).join(" "))}return Zd(Zd({},
a),l)}function ql(a,d){a&&(0,aG.flushSync)(()=>a.dispatchEvent(d))}function Qi(a){const d=(0,wx.useRef)(a);(0,wx.useEffect)(()=>{d.current=a});return(0,wx.useMemo)(()=>(...l)=>{var K;return null===(K=d.current)||void 0===K?void 0:K.call(d,...l)},[])}function rl(a,d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const l=Qi(a);(0,bG.useEffect)(()=>{const K=da=>{"Escape"===da.key&&l(da)};d.addEventListener("keydown",K);return()=>d.removeEventListener("keydown",K)},[l,d])}function Il(a,
d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const l=Qi(a),K=(0,Mm.useRef)(!1),da=(0,Mm.useRef)(()=>{});(0,Mm.useEffect)(()=>{const ja=Ka=>{if(Ka.target&&!K.current){let Sa=function(){Tj("dismissableLayer.pointerDownOutside",l,bb,{discrete:!0})};const bb={originalEvent:Ka};"touch"===Ka.pointerType?(d.removeEventListener("click",da.current),da.current=Sa,d.addEventListener("click",da.current,{once:!0})):Sa()}K.current=!1},ra=window.setTimeout(()=>{d.addEventListener("pointerdown",
ja)},0);return()=>{window.clearTimeout(ra);d.removeEventListener("pointerdown",ja);d.removeEventListener("click",da.current)}},[d,l]);return{onPointerDownCapture:()=>K.current=!0}}function sl(a,d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const l=Qi(a),K=(0,Mm.useRef)(!1);(0,Mm.useEffect)(()=>{const da=ja=>{ja.target&&!K.current&&Tj("dismissableLayer.focusOutside",l,{originalEvent:ja},{discrete:!1})};d.addEventListener("focusin",da);return()=>d.removeEventListener("focusin",
da)},[d,l]);return{onFocusCapture:()=>K.current=!0,onBlurCapture:()=>K.current=!1}}function Jn(){const a=new CustomEvent("dismissableLayer.update");document.dispatchEvent(a)}function Tj(a,d,l,{discrete:K}){const da=l.originalEvent.target;l=new CustomEvent(a,{bubbles:!1,cancelable:!0,detail:l});d&&da.addEventListener(a,d,{once:!0});K?ql(da,l):da.dispatchEvent(l)}function Ei(a){const [d,l]=eB.useState(eG());vl(()=>{a||l(K=>null!==K&&void 0!==K?K:String(fG++))},[a]);return a||(d?`radix-${d}`:"")}function Ih(a){return a.split("-")[0]}
function cl(a){return["top","bottom"].includes(Ih(a))?"x":"y"}function $l(a){return"y"===a?"height":"width"}function Ck(a,d,l){let {reference:K,floating:da}=a;var ja=K.x+K.width/2-da.width/2;const ra=K.y+K.height/2-da.height/2;a=cl(d);var Ka=$l(a);Ka=K[Ka]/2-da[Ka]/2;const Sa="x"===a;switch(Ih(d)){case "top":ja={x:ja,y:K.y-da.height};break;case "bottom":ja={x:ja,y:K.y+K.height};break;case "right":ja={x:K.x+K.width,y:ra};break;case "left":ja={x:K.x-da.width,y:ra};break;default:ja={x:K.x,y:K.y}}switch(d.split("-")[1]){case "start":ja[a]-=
Ka*(l&&Sa?-1:1);break;case "end":ja[a]+=Ka*(l&&Sa?-1:1)}return ja}function mm(a){return"number"!=typeof a?Zd({top:0,right:0,bottom:0,left:0},a):{top:a,right:a,bottom:a,left:a}}function am(a){return ff(Zd({},a),{top:a.y,left:a.x,right:a.x+a.width,bottom:a.y+a.height})}function Jl(a,d){return Oh(this,null,function*(){var l;void 0===d&&(d={});const {x:K,y:da,platform:ja,rects:ra,elements:Ka,strategy:Sa}=a,{boundary:bb="clippingAncestors",rootBoundary:gb="viewport",elementContext:jb="floating",altBoundary:Jb=
!1,padding:Ob=0}=d,Lb=mm(Ob),gc=Ka[Jb?"floating"===jb?"reference":"floating":jb],rc=am(yield ja.getClippingRect({element:null==(l=yield null==ja.isElement?void 0:ja.isElement(gc))||l?gc:gc.contextElement||(yield null==ja.getDocumentElement?void 0:ja.getDocumentElement(Ka.floating)),boundary:bb,rootBoundary:gb,strategy:Sa}));l=am(ja.convertOffsetParentRelativeRectToViewportRelativeRect?yield ja.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===jb?ff(Zd({},ra.floating),{x:K,y:da}):
ra.reference,offsetParent:yield null==ja.getOffsetParent?void 0:ja.getOffsetParent(Ka.floating),strategy:Sa}):ra[jb]);return{top:rc.top-l.top+Lb.top,bottom:l.bottom-rc.bottom+Lb.bottom,left:rc.left-l.left+Lb.left,right:l.right-rc.right+Lb.right}})}function dl(a){return a.replace(/left|right|bottom|top/g,d=>hG[d])}function tl(a,d,l){void 0===l&&(l=!1);const K=a.split("-")[1],da=cl(a);a=$l(da);l="x"===da?K===(l?"end":"start")?"right":"left":"start"===K?"bottom":"top";return d.reference[a]>d.floating[a]&&
(l=dl(l)),{main:l,cross:dl(l)}}function xi(a){return a.replace(/start|end/g,d=>iG[d])}function dk(a,d){return{top:a.top-d.height,right:a.right-d.width,bottom:a.bottom-d.height,left:a.left-d.width}}function ek(a){return gB.some(d=>0<=a[d])}function ok(a){return null==a?window:a&&a.document&&a.location&&a.alert&&a.setInterval?a:(a=a.ownerDocument)&&a.defaultView||window}function Ri(a){return ok(a).getComputedStyle(a)}function Ci(a){return a&&a.document&&a.location&&a.alert&&a.setInterval?"":a?(a.nodeName||
"").toLowerCase():""}function Li(){const a=navigator.userAgentData;return null!=a&&a.brands?a.brands.map(d=>d.brand+"/"+d.version).join(" "):navigator.userAgent}function rj(a){return a instanceof ok(a).HTMLElement}function xk(a){return a instanceof ok(a).Element}function kj(a){return"undefined"==typeof ShadowRoot?!1:a instanceof ok(a).ShadowRoot||a instanceof ShadowRoot}function Ji(a){const {overflow:d,overflowX:l,overflowY:K}=Ri(a);return/auto|scroll|overlay|hidden/.test(d+K+l)}function Jk(a){const d=
/firefox/i.test(Li());a=Ri(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 Kk(){return!/^((?!chrome|android).)*safari/i.test(Li())}function ik(a,d,l){var K,da,ja,ra;void 0===d&&(d=!1);void 0===l&&(l=!1);var Ka=a.getBoundingClientRect();let Sa=1,bb=1;d&&rj(a)&&(Sa=0<a.offsetWidth&&lv(Ka.width)/a.offsetWidth||1,bb=0<a.offsetHeight&&lv(Ka.height)/a.offsetHeight||
1);a=xk(a)?ok(a):window;d=!Kk()&&l;l=(Ka.left+(d&&null!=(K=null==(da=a.visualViewport)?void 0:da.offsetLeft)?K:0))/Sa;K=(Ka.top+(d&&null!=(ja=null==(ra=a.visualViewport)?void 0:ra.offsetTop)?ja:0))/bb;ja=Ka.width/Sa;Ka=Ka.height/bb;return{width:ja,height:Ka,top:K,right:l+ja,bottom:K+Ka,left:l,x:l,y:K}}function Cj(a){return(d=a,(d instanceof ok(d).Node?a.ownerDocument:a.document)||window.document).documentElement;var d}function bm(a){return xk(a)?{scrollLeft:a.scrollLeft,scrollTop:a.scrollTop}:{scrollLeft:a.pageXOffset,
scrollTop:a.pageYOffset}}function yn(a){return ik(Cj(a)).left+bm(a).scrollLeft}function yk(a){return"html"===Ci(a)?a:a.assignedSlot||a.parentNode||(kj(a)?a.host:null)||Cj(a)}function dj(a){return rj(a)&&"fixed"!==getComputedStyle(a).position?a.offsetParent:null}function bj(a){for(var d=ok(a),l=dj(a);l&&["table","td","th"].includes(Ci(l))&&"static"===getComputedStyle(l).position;)l=dj(l);if(!l||"html"!==Ci(l)&&("body"!==Ci(l)||"static"!==getComputedStyle(l).position||Jk(l))){if(!l)a:{a=yk(a);for(kj(a)&&
(a=a.host);rj(a)&&!["html","body"].includes(Ci(a));){if(Jk(a)){l=a;break a}a=a.parentNode}l=null}d=l||d}return d}function Ul(a){if(rj(a))return{width:a.offsetWidth,height:a.offsetHeight};a=ik(a);return{width:a.width,height:a.height}}function nm(a){const d=yk(a);return["html","body","#document"].includes(Ci(d))?a.ownerDocument.body:rj(d)&&Ji(d)?d:nm(d)}function Hm(a,d){var l;void 0===d&&(d=[]);var K=nm(a);a=K===(null==(l=a.ownerDocument)?void 0:l.body);l=ok(K);K=a?[l].concat(l.visualViewport||[],Ji(K)?
K:[]):K;d=d.concat(K);return a?d:d.concat(Hm(K))}function co(a,d,l){return"viewport"===d?am(function(K,da){var ja=ok(K),ra=Cj(K);ja=ja.visualViewport;K=ra.clientWidth;ra=ra.clientHeight;let Ka=0,Sa=0;if(ja){K=ja.width;ra=ja.height;const bb=Kk();(bb||!bb&&"fixed"===da)&&(Ka=ja.offsetLeft,Sa=ja.offsetTop)}return{width:K,height:ra,x:Ka,y:Sa}}(a,l)):xk(d)?function(K,da){var ja=ik(K,!1,"fixed"===da);da=ja.top+K.clientTop;ja=ja.left+K.clientLeft;return{top:da,left:ja,x:ja,y:da,right:ja+K.clientWidth,bottom:da+
K.clientHeight,width:K.clientWidth,height:K.clientHeight}}(d,l):am(function(K){var da;const ja=Cj(K);var ra=bm(K);const Ka=null==(da=K.ownerDocument)?void 0:da.body;da=Dt(ja.scrollWidth,ja.clientWidth,Ka?Ka.scrollWidth:0,Ka?Ka.clientWidth:0);const Sa=Dt(ja.scrollHeight,ja.clientHeight,Ka?Ka.scrollHeight:0,Ka?Ka.clientHeight:0);K=-ra.scrollLeft+yn(K);ra=-ra.scrollTop;return"rtl"===Ri(Ka||ja).direction&&(K+=Dt(ja.clientWidth,Ka?Ka.clientWidth:0)-da),{width:da,height:Sa,x:K,y:ra}}(Cj(a)))}function gp(a){const d=
Hm(a),l=["absolute","fixed"].includes(Ri(a).position)&&rj(a)?bj(a):a;return xk(l)?d.filter(K=>{var da;if(da=xk(K))a:if(da=null==l.getRootNode?void 0:l.getRootNode(),K.contains(l))da=!0;else{if(da&&kj(da)){da=l;do{if(da&&K===da){da=!0;break a}da=da.parentNode||da.host}while(da)}da=!1}return da&&"body"!==Ci(K)}):[]}function Sb(a,d,l,K){void 0===K&&(K={});const {ancestorScroll:da=!0,ancestorResize:ja=!0,elementResize:ra=!0,animationFrame:Ka=!1}=K,Sa=da&&!Ka,bb=ja&&!Ka,gb=Sa||bb?[...(xk(a)?Hm(a):[]),
...Hm(d)]:[];gb.forEach(Lb=>{Sa&&Lb.addEventListener("scroll",l,{passive:!0});bb&&Lb.addEventListener("resize",l)});let jb,Jb=null;if(ra){let Lb=!0;Jb=new ResizeObserver(()=>{Lb||l();Lb=!1});xk(a)&&!Ka&&Jb.observe(a);Jb.observe(d)}let Ob=Ka?ik(a):null;return Ka&&function gc(){const rc=ik(a);!Ob||rc.x===Ob.x&&rc.y===Ob.y&&rc.width===Ob.width&&rc.height===Ob.height||l();Ob=rc;jb=requestAnimationFrame(gc)}(),l(),()=>{var gc;gb.forEach(rc=>{Sa&&rc.removeEventListener("scroll",l);bb&&rc.removeEventListener("resize",
l)});null==(gc=Jb)||gc.disconnect();Jb=null;Ka&&cancelAnimationFrame(jb)}}function Ga(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 l,K;if(a&&d&&"object"==typeof a){if(Array.isArray(a)){var da=a.length;if(da!=d.length)return!1;for(l=da;0!==l--;)if(!Ga(a[l],d[l]))return!1;return!0}K=Object.keys(a);da=K.length;if(da!==Object.keys(d).length)return!1;for(l=da;0!==l--;)if(!Object.prototype.hasOwnProperty.call(d,K[l]))return!1;
for(l=da;0!==l--;)if(da=K[l],!("_owner"===da&&a.$$typeof||Ga(a[da],d[da])))return!1;return!0}return a!==a&&d!==d}function $b(a){const d=mn.useRef(a);zx(()=>{d.current=a});return d}function Xb(a){let {middleware:d,placement:l="bottom",strategy:K="absolute",whileElementsMounted:da}=void 0===a?{}:a;const ja=mn.useRef(null),ra=mn.useRef(null),Ka=$b(da),Sa=mn.useRef(null),[bb,gb]=mn.useState({x:null,y:null,strategy:K,placement:l,middlewareData:{}}),[jb,Jb]=mn.useState(d);Ga(null==jb?void 0:jb.map(hc=>
{({options:hc}=hc);return hc}),null==d?void 0:d.map(hc=>{({options:hc}=hc);return hc}))||Jb(d);const Ob=mn.useCallback(()=>{ja.current&&ra.current&&lG(ja.current,ra.current,{middleware:jb,placement:l,strategy:K}).then(hc=>{Lb.current&&mG.flushSync(()=>{gb(hc)})})},[jb,l,K]);zx(()=>{Lb.current&&Ob()},[Ob]);const Lb=mn.useRef(!1);zx(()=>{Lb.current=!0;return()=>{Lb.current=!1}},[]);const gc=mn.useCallback(()=>{"function"===typeof Sa.current&&(Sa.current(),Sa.current=null);if(ja.current&&ra.current)if(Ka.current){const hc=
Ka.current(ja.current,ra.current,Ob);Sa.current=hc}else Ob()},[Ob,Ka]),rc=mn.useCallback(hc=>{ja.current=hc;gc()},[gc]),Wb=mn.useCallback(hc=>{ra.current=hc;gc()},[gc]),kc=mn.useMemo(()=>({reference:ja,floating:ra}),[]);return mn.useMemo(()=>ff(Zd({},bb),{update:Ob,refs:kc,reference:rc,floating:Wb}),[bb,Ob,kc,rc,Wb])}function tb(a){const [d,l]=(0,oG.useState)(void 0);vl(()=>{if(a){l({width:a.offsetWidth,height:a.offsetHeight});const K=new ResizeObserver(da=>{if(Array.isArray(da)&&da.length){da=da[0];
if("borderBoxSize"in da){da=da.borderBoxSize;var ja=Array.isArray(da)?da[0]:da;da=ja.inlineSize;ja=ja.blockSize}else da=a.offsetWidth,ja=a.offsetHeight;l({width:da,height:ja})}});K.observe(a,{box:"border-box"});return()=>K.unobserve(a)}l(void 0)},[a]);return d}function cc(a){return void 0!==a}function Qb(a){return null!==a}function zb(a){const [d,l="center"]=a.split("-");return[d,l]}function yb(a,d){return(0,mp.useReducer)((l,K)=>{K=d[l][K];return null!==K&&void 0!==K?K:l},a)}function Zb(a){const [d,
l]=(0,mp.useState)(),K=(0,mp.useRef)({}),da=(0,mp.useRef)(a),ja=(0,mp.useRef)("none"),[ra,Ka]=yb(a?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});(0,mp.useEffect)(()=>{const Sa=qc(K.current);ja.current="mounted"===ra?Sa:"none"},[ra]);vl(()=>{const Sa=K.current,bb=da.current;if(bb!==a){const gb=ja.current,jb=qc(Sa);a?Ka("MOUNT"):"none"===jb||"none"===(null===Sa||void 0===
Sa?void 0:Sa.display)?Ka("UNMOUNT"):bb&&gb!==jb?Ka("ANIMATION_OUT"):Ka("UNMOUNT");da.current=a}},[a,Ka]);vl(()=>{if(d){const Sa=gb=>{const jb=qc(K.current).includes(gb.animationName);gb.target===d&&jb&&(0,yG.flushSync)(()=>Ka("ANIMATION_END"))},bb=gb=>{gb.target===d&&(ja.current=qc(K.current))};d.addEventListener("animationstart",bb);d.addEventListener("animationcancel",Sa);d.addEventListener("animationend",Sa);return()=>{d.removeEventListener("animationstart",bb);d.removeEventListener("animationcancel",
Sa);d.removeEventListener("animationend",Sa)}}Ka("ANIMATION_END")},[d,Ka]);return{isPresent:["mounted","unmountSuspended"].includes(ra),ref:(0,mp.useCallback)(Sa=>{Sa&&(K.current=getComputedStyle(Sa));l(Sa)},[])}}function qc(a){return(null===a||void 0===a?void 0:a.animationName)||"none"}function Dc({prop:a,defaultProp:d,onChange:l=()=>{}}){const [K,da]=Yc({defaultProp:d,onChange:l}),ja=void 0!==a;d=ja?a:K;const ra=Qi(l);l=(0,mv.useCallback)(Ka=>{ja?(Ka="function"===typeof Ka?Ka(a):Ka,Ka!==a&&ra(Ka)):
da(Ka)},[ja,a,da,ra]);return[d,l]}function Yc({defaultProp:a,onChange:d}){a=(0,mv.useState)(a);const [l]=a,K=(0,mv.useRef)(l),da=Qi(d);(0,mv.useEffect)(()=>{K.current!==l&&(da(l),K.current=l)},[l,K,da]);return a}function ed(a,d){const l=Math.abs(d.top-a.y),K=Math.abs(d.bottom-a.y),da=Math.abs(d.right-a.x);a=Math.abs(d.left-a.x);switch(Math.min(l,K,da,a)){case a:return"left";case da:return"right";case l:return"top";case K:return"bottom";default:return null}}function nd(a){a=a.slice();a.sort((d,l)=>
d.x<l.x?-1:d.x>l.x?1:d.y<l.y?-1:d.y>l.y?1:0);return Rd(a)}function Rd(a){if(1>=a.length)return a.slice();const d=[];for(var l=0;l<a.length;l++){for(var K=a[l];2<=d.length;){var da=d[d.length-1],ja=d[d.length-2];if((da.x-ja.x)*(K.y-ja.y)>=(da.y-ja.y)*(K.x-ja.x))d.pop();else break}d.push(K)}d.pop();l=[];for(K=a.length-1;0<=K;K--){for(da=a[K];2<=l.length;){ja=l[l.length-1];const ra=l[l.length-2];if((ja.x-ra.x)*(da.y-ra.y)>=(ja.y-ra.y)*(da.x-ra.x))l.pop();else break}l.push(da)}l.pop();return 1===d.length&&
1===l.length&&d[0].x===l[0].x&&d[0].y===l[0].y?d:d.concat(l)}function ce(a){var {side:d,content:l,sideOffset:K=10}=a;a=Jf(a,["side","content","sideOffset"]);return l?(0,bq.jsx)(KG,{delayDuration:300,children:(0,bq.jsxs)(LG,{children:[(0,bq.jsx)(MG,{asChild:!0,children:a.children}),(0,bq.jsx)(NG,{children:(0,bq.jsxs)(OG,ff(Zd({className:"tl-tooltip-content",sideOffset:K,side:d},a),{children:[l,(0,bq.jsx)(PG,{className:"tl-tooltip-arrow"})]}))})]})}):(0,bq.jsx)(bq.Fragment,{children:a.children})}function Yd(a){var {className:d,
tooltip:l,tooltipSide:K}=a;a=Jf(a,["className","tooltip","tooltipSide"]);return(0,uB.jsx)(ce,{content:l,side:K,children:(0,uB.jsx)("button",Zd({className:"tl-button "+(null!=d?d:"")},a))})}function Ne(a){var {toggle:d=!0,pressed:l,onPressedChange:K,className:da,tooltip:ja}=a;a=Jf(a,["toggle","pressed","onPressedChange","className","tooltip"]);return(0,Hx.jsx)(ce,{content:ja,children:(0,Hx.jsx)("div",{className:"inline-block",children:(0,Hx.jsx)(RG,ff(Zd({},a),{"data-toggle":d,className:"tl-toggle-input"+
(da?" "+da:""),pressed:l,onPressedChange:K}))})})}function ag(a){var d=a+"CollectionProvider";const [l,K]=Gh(d),[da,ja]=l(d,{collectionRef:{current:null},itemMap:new Map}),ra=gb=>{const {scope:jb,children:Jb}=gb;gb=Po.default.useRef(null);const Ob=Po.default.useRef(new Map).current;return Po.default.createElement(da,{scope:jb,itemMap:Ob,collectionRef:gb},Jb)};Object.assign(ra,{displayName:d});const Ka=a+"CollectionSlot";d=Po.default.forwardRef((gb,jb)=>{const {scope:Jb,children:Ob}=gb;gb=ja(Ka,Jb);
jb=$g(jb,gb.collectionRef);return Po.default.createElement(Oo,{ref:jb},Ob)});Object.assign(d,{displayName:Ka});const Sa=a+"CollectionItemSlot",bb=Po.default.forwardRef((gb,jb)=>{const {scope:Jb,children:Ob}=gb,Lb=Jf(gb,["scope","children"]),gc=Po.default.useRef(null);gb=$g(jb,gc);const rc=ja(Sa,Jb);Po.default.useEffect(()=>{rc.itemMap.set(gc,Zd({ref:gc},Lb));return()=>void rc.itemMap.delete(gc)});return Po.default.createElement(Oo,{["data-radix-collection-item"]:"",ref:gb},Ob)});Object.assign(bb,
{displayName:Sa});return[{Provider:ra,Slot:d,ItemSlot:bb},function(gb){const jb=ja(a+"CollectionConsumer",gb);return Po.default.useCallback(()=>{const Jb=jb.collectionRef.current;if(!Jb)return[];const Ob=Array.from(Jb.querySelectorAll("[data-radix-collection-item]"));return Array.from(jb.itemMap.values()).sort((Lb,gc)=>Ob.indexOf(Lb.ref.current)-Ob.indexOf(gc.ref.current))},[jb.collectionRef,jb.itemMap])},K]}function pg(a){const d=(0,xB.useContext)(SG);return a||d||"ltr"}function Gf(){(0,TG.useEffect)(()=>
{var a,d;const l=document.querySelectorAll("[data-radix-focus-guard]");document.body.insertAdjacentElement("afterbegin",null!==(a=l[0])&&void 0!==a?a:Tf());document.body.insertAdjacentElement("beforeend",null!==(d=l[1])&&void 0!==d?d:Tf());Ix++;return()=>{1===Ix&&document.querySelectorAll("[data-radix-focus-guard]").forEach(K=>K.remove());Ix--}},[])}function Tf(){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 nf(a,{select:d=!1}={}){const l=document.activeElement;for(const K of a)if(hf(K,{select:d}),document.activeElement!==l)break}function Ze(a){const d=[];for(a=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,{acceptNode:l=>{const K="INPUT"===l.tagName&&"hidden"===l.type;return l.disabled||l.hidden||K?NodeFilter.FILTER_SKIP:0<=l.tabIndex?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});a.nextNode();)d.push(a.currentNode);return d}function xg(a,d){for(const l of a)if(!og(l,{upTo:d}))return l}
function og(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 hf(a,{select:d=!1}={}){if(a&&a.focus){const l=document.activeElement;a.focus({preventScroll:!0});a!==l&&a instanceof HTMLInputElement&&"select"in a&&d&&a.select()}}function th(a,d){a=[...a];d=a.indexOf(d);-1!==d&&a.splice(d,1);return a}function xh(a){return a.filter(d=>"A"!==d.tagName)}function Qh(a,d,l){a=
a.key;l="rtl"!==l?a:"ArrowLeft"===a?"ArrowRight":"ArrowRight"===a?"ArrowLeft":a;if("vertical"!==d||!["ArrowLeft","ArrowRight"].includes(l))if("horizontal"!==d||!["ArrowUp","ArrowDown"].includes(l))return $G[l]}function Hg(a){const d=document.activeElement;for(const l of a){if(l===d)break;l.focus();if(document.activeElement!==d)break}}function tg(a,d){return a.map((l,K)=>a[(d+K)%a.length])}function Hh(a,d){var l=(0,cH.useState)(function(){return{value:a,callback:d,facade:{get current(){return l.value},
set current(K){var da=l.value;da!==K&&(l.value=K,l.callback(K,da))}}}})[0];l.callback=d;return l.facade}function Gj(a,d){return Hh(d||null,function(l){return a.forEach(function(K){"function"===typeof K?K(l):K&&(K.current=l);return K})})}function zn(a){return a}function Xl(a,d){void 0===d&&(d=zn);var l=[],K=!1;return{read:function(){if(K)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return l.length?l[l.length-1]:a},useMedium:function(da){var ja=
d(da,K);l.push(ja);return function(){l=l.filter(function(ra){return ra!==ja})}},assignSyncMedium:function(da){for(K=!0;l.length;){var ja=l;l=[];ja.forEach(da)}l={push:function(ra){return da(ra)},filter:function(){return l}}},assignMedium:function(da){K=!0;var ja=[];if(l.length){var ra=l;l=[];ra.forEach(da);ja=l}var Ka=function(){var Sa=ja;ja=[];Sa.forEach(da)};Promise.resolve().then(Ka);l={push:function(Sa){ja.push(Sa);Promise.resolve().then(Ka)},filter:function(Sa){ja=ja.filter(Sa);return l}}}}}
function yo(a){const d=document.activeElement;for(const l of a){if(l===d)break;l.focus();if(document.activeElement!==d)break}}function Fl(a,d){return a.map((l,K)=>a[(d+K)%a.length])}function pj(a,d,l){const K=1<d.length&&Array.from(d).every(ja=>ja===d[0])?d[0]:d,da=l?a.indexOf(l):-1;a=Fl(a,Math.max(da,0));1===K.length&&(a=a.filter(ja=>ja!==l));a=a.find(ja=>ja.toLowerCase().startsWith(K.toLowerCase()));return a!==l?a:void 0}function zo(a){return d=>"mouse"===d.pointerType?a(d):void 0}function $o(a,
[d,l]){return Math.min(l,Math.max(d,a))}function Yn(a){const d=(0,Xx.useRef)({value:a,previous:a});return(0,Xx.useMemo)(()=>{d.current.value!==a&&(d.current.previous=d.current.value,d.current.value=a);return d.current.previous},[a])}function Zm(a=[],d,l){a=[...a];a[l]=d;return a.sort((K,da)=>K-da)}function wi(a,d,l){return 100/(l-d)*(a-d)}function ol(a,d){if(2<d)return`Value ${a+1} of ${d}`;if(2===d)return["Minimum","Maximum"][a]}function Xs(a,d){if(1===a.length)return 0;a=a.map(K=>Math.abs(K-d));
const l=Math.min(...a);return a.indexOf(l)}function Yl(a,d,l){a/=2;const K=cn([0,50],[0,a]);return(a-K(d)*l)*l}function dn(a){return a.slice(0,-1).map((d,l)=>a[l+1]-d)}function cn(a,d){return l=>a[0]===a[1]||d[0]===d[1]?d[0]:d[0]+(d[1]-d[0])/(a[1]-a[0])*(l-a[0])}function Io(a,d){d=Math.pow(10,d);return Math.round(a*d)/d}function km(a){function d(bb){return bb?(0,Oj.jsx)("div",{className:"tl-color-bg",style:{backgroundColor:bb},children:(0,Oj.jsx)("div",{className:`w-full h-full bg-${bb}-500`})}):
(0,Oj.jsx)("div",{className:"tl-color-bg",children:(0,Oj.jsx)(Qg,{name:"color-swatch"})})}var {color:l,opacity:K,popoverSide:da,setColor:ja,setOpacity:ra}=a;a=Jf(a,["color","opacity","popoverSide","setColor","setOpacity"]);const {handlers:{t:Ka}}=He.default.useContext(ji),Sa=He.default.useMemo(()=>{let bb="";return Xj(gb=>{ja(bb)},100,gb=>{bb=gb.target.value})},[]);return(0,Oj.jsx)(qm,ff(Zd({},a),{border:!0,arrow:!0,side:da,label:(0,Oj.jsx)(ce,{content:Ka("whiteboard/color"),side:da,sideOffset:14,
children:d(l)}),children:(0,Oj.jsxs)("div",{className:"p-1",children:[(0,Oj.jsx)("div",{className:"tl-color-palette",children:Object.values(Iw).map(bb=>(0,Oj.jsx)("button",{className:`tl-color-drip m-1${bb===l?" active":""}`,onClick:()=>ja(bb),children:d(bb)},bb))}),(0,Oj.jsxs)("div",{className:"flex items-center tl-custom-color",children:[(0,Oj.jsx)("div",{className:`tl-color-drip m-1 mr-3 ${Gi(l)?"":"active"}`,children:(0,Oj.jsx)("div",{className:"color-input-wrapper tl-color-bg",children:(0,Oj.jsx)("input",
Zd({className:"color-input cursor-pointer",id:"tl-custom-color-input",type:"color",value:/^#(?:[0-9a-f]{3}){1,2}$/i.test(l)?l:"#000000",onChange:Sa,style:{opacity:Gi(l)?0:1}},a))})}),(0,Oj.jsx)("label",{htmlFor:"tl-custom-color-input",className:"cursor-pointer",children:Ka("whiteboard/select-custom-color")})]}),ra&&(0,Oj.jsx)("div",{className:"mx-1 my-2",children:(0,Oj.jsxs)(sk,{defaultValue:[null!=K?K:0],onValueCommit:bb=>ra(bb[0]),max:1,step:.1,"aria-label":Ka("whiteboard/opacity"),className:"tl-slider-root",
children:[(0,Oj.jsx)(St,{className:"tl-slider-track",children:(0,Oj.jsx)(vj,{className:"tl-slider-range"})}),(0,Oj.jsx)(So,{className:"tl-slider-thumb"})]})})]})}))}function ei(a,d){a&&(0,rm.flushSync)(()=>a.dispatchEvent(d))}function dp(a,d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const l=Qi(a),K=(0,Hk.useRef)(!1),da=(0,Hk.useRef)(()=>{});(0,Hk.useEffect)(()=>{const ja=Ka=>{if(Ka.target&&!K.current){let Sa=function(){jm("dismissableLayer.pointerDownOutside",l,bb,{discrete:!0})};
const bb={originalEvent:Ka};"touch"===Ka.pointerType?(d.removeEventListener("click",da.current),da.current=Sa,d.addEventListener("click",da.current,{once:!0})):Sa()}K.current=!1},ra=window.setTimeout(()=>{d.addEventListener("pointerdown",ja)},0);return()=>{window.clearTimeout(ra);d.removeEventListener("pointerdown",ja);d.removeEventListener("click",da.current)}},[d,l]);return{onPointerDownCapture:()=>K.current=!0}}function $m(a,d=null===globalThis||void 0===globalThis?void 0:globalThis.document){const l=
Qi(a),K=(0,Hk.useRef)(!1);(0,Hk.useEffect)(()=>{const da=ja=>{ja.target&&!K.current&&jm("dismissableLayer.focusOutside",l,{originalEvent:ja},{discrete:!1})};d.addEventListener("focusin",da);return()=>d.removeEventListener("focusin",da)},[d,l]);return{onFocusCapture:()=>K.current=!0,onBlurCapture:()=>K.current=!1}}function Bn(){const a=new CustomEvent("dismissableLayer.update");document.dispatchEvent(a)}function jm(a,d,l,{discrete:K}){const da=l.originalEvent.target;l=new CustomEvent(a,{bubbles:!1,
cancelable:!0,detail:l});d&&da.addEventListener(a,d,{once:!0});K?ei(da,l):da.dispatchEvent(l)}function Rq(a,{select:d=!1}={}){const l=document.activeElement;for(const K of a)if(Em(K,{select:d}),document.activeElement!==l)break}function Go(a){const d=[];for(a=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,{acceptNode:l=>{const K="INPUT"===l.tagName&&"hidden"===l.type;return l.disabled||l.hidden||K?NodeFilter.FILTER_SKIP:0<=l.tabIndex?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});a.nextNode();)d.push(a.currentNode);
return d}function Hn(a,d){for(const l of a)if(!An(l,{upTo:d}))return l}function An(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 Em(a,{select:d=!1}={}){if(a&&a.focus){const l=document.activeElement;a.focus({preventScroll:!0});a!==l&&a instanceof HTMLInputElement&&"select"in a&&d&&a.select()}}function Zn(a,d){a=[...a];d=a.indexOf(d);-1!==d&&a.splice(d,1);return a}function Fp(a){return a.filter(d=>
"A"!==d.tagName)}function ap(a){return void 0!==a}function Og(a){return null!==a}function ep(a){const [d,l="center"]=a.split("-");return[d,l]}function fp(a){const d=Qi(a),l=(0,mf.useRef)(""),K=(0,mf.useRef)(0);a=(0,mf.useCallback)(ja=>{ja=l.current+ja;d(ja);(function Sa(Ka){l.current=Ka;window.clearTimeout(K.current);""!==Ka&&(K.current=window.setTimeout(()=>Sa(""),1E3))})(ja)},[d]);const da=(0,mf.useCallback)(()=>{l.current="";window.clearTimeout(K.current)},[]);(0,mf.useEffect)(()=>()=>window.clearTimeout(K.current),
[]);return[l,a,da]}function In(a,d,l){const K=1<d.length&&Array.from(d).every(ja=>ja===d[0])?d[0]:d,da=l?a.indexOf(l):-1;a=bn(a,Math.max(da,0));1===K.length&&(a=a.filter(ja=>ja!==l));a=a.find(ja=>ja.textValue.toLowerCase().startsWith(K.toLowerCase()));return a!==l?a:void 0}function bn(a,d){return a.map((l,K)=>a[(d+K)%a.length])}function Pp(a){var {options:d,tooltip:l,popoverSide:K,chevron:da=!0,value:ja,onValueChange:ra}=a;a=Jf(a,"options tooltip popoverSide chevron value onValueChange".split(" "));
const [Ka,Sa]=XB.useState(!1);return(0,Rg.jsx)("div",ff(Zd({},a),{className:"tl-select-input",children:(0,Rg.jsxs)(oq,{open:Ka,onOpenChange:Sa,value:ja,onValueChange:ra,children:[(0,Rg.jsx)(ce,{content:l,side:K,children:(0,Rg.jsxs)(gC,{className:"tl-select-input-trigger",children:[(0,Rg.jsx)("div",{className:"tl-select-input-trigger-value",children:(0,Rg.jsx)(iC,{})}),da&&(0,Rg.jsx)(jC,{style:{lineHeight:1},className:"ml-1 md:ml-3",children:(0,Rg.jsx)(Qg,{name:Ka?"chevron-up":"chevron-down"})})]})}),
(0,Rg.jsx)(wl,{className:"tl-select-input-portal",children:(0,Rg.jsxs)(iy,{className:"tl-select-input-content",side:K,position:"popper",sideOffset:14,align:"center",onKeyDown:bb=>bb.stopPropagation(),children:[(0,Rg.jsx)(kC,{}),(0,Rg.jsx)(hC,{className:"tl-select-input-viewport",children:d.map(bb=>(0,Rg.jsx)(Pm,{className:"tl-select-input-select-item",value:bb.value,children:(0,Rg.jsx)(zd,{children:bb.label})},bb.value))}),(0,Rg.jsx)(Ah,{})]})})]})}))}function Jr(a){var {scaleLevel:d,compact:l,popoverSide:K}=
a;Jf(a,["scaleLevel","compact","popoverSide"]);const da=mg();({handlers:{t:a}}=lC.default.useContext(ji));const ja=[{label:l?"XS":a("whiteboard/extra-small"),value:"xs"},{label:l?"SM":a("whiteboard/small"),value:"sm"},{label:l?"MD":a("whiteboard/medium"),value:"md"},{label:l?"LG":a("whiteboard/large"),value:"lg"},{label:l?"XL":a("whiteboard/extra-large"),value:"xl"},{label:l?"XXL":a("whiteboard/huge"),value:"xxl"}];return(0,Zt.jsx)(Pp,{tooltip:a("whiteboard/scale-level"),options:ja,value:d,popoverSide:K,
chevron:!l,onValueChange:ra=>{da.api.setScaleLevel(ra)}})}function bo(a,d){return function(l){return a(d(l))}}function Cq(a,d){return d(a)}function Dm(a,d){return function(l){return a(d,l)}}function Cm(a,d){return function(){return a(d)}}function Wi(a,d){d(a);return a}function Si(){for(var a=arguments.length,d=Array(a),l=0;l<a;l++)d[l]=arguments[l];return d}function lm(a){a()}function Yq(a){return function(){return a}}function Vr(){for(var a=arguments.length,d=Array(a),l=0;l<a;l++)d[l]=arguments[l];
return function(){d.map(lm)}}function fi(){}function fh(a,d){return a(1,d)}function Ur(a,d){a(0,d)}function bt(a){a(2)}function eo(a){return a(4)}function Kg(a,d){return fh(a,Dm(d,0))}function Fm(a,d){var l=a(1,function(K){l();d(K)});return l}function Cg(){var a=[];return function(d,l){switch(d){case 2:a.splice(0,a.length);break;case 1:return a.push(l),function(){var K=a.indexOf(l);-1<K&&a.splice(K,1)};case 0:a.slice().forEach(function(K){K(l)});break;default:throw Error("unrecognized action "+d);
}}}function Rf(a){var d=a,l=Cg();return function(K,da){switch(K){case 1:da(d);break;case 0:d=da;break;case 4:return d}return l(K,da)}}function Gm(a){var d,l;return function(K,da){switch(K){case 1:if(da){if(l===da)break;d&&d();l=da;return d=a(1,da)}d&&d();return fi;case 2:d&&d();l=null;break;default:throw Error("unrecognized action "+K);}}}function nk(a){return Wi(Cg(),function(d){return Kg(a,d)})}function Uj(a,d){return Wi(Rf(d),function(l){return Kg(a,l)})}function fo(){for(var a=arguments.length,
d=Array(a),l=0;l<a;l++)d[l]=arguments[l];return function(K){return d.reduceRight(Cq,K)}}function xf(a){for(var d=arguments.length,l=Array(1<d?d-1:0),K=1;K<d;K++)l[K-1]=arguments[K];var da=fo.apply(void 0,l);return function(ja,ra){switch(ja){case 1:return fh(a,da(ra));case 2:a(2);break;default:throw Error("unrecognized action "+ja);}}}function Im(a,d){return a===d}function Sh(a){void 0===a&&(a=Im);var d;return function(l){return function(K){a(d,K)||(d=K,l(K))}}}function lg(a){return function(d){return function(l){a(l)&&
d(l)}}}function qg(a){return function(d){return bo(d,a)}}function en(a){return function(d){return function(){return d(a)}}}function fk(a,d){return function(l){return function(K){return l(d=a(d,K))}}}function cm(a){return function(d){return function(l){0<a?a--:d(l)}}}function go(a){var d,l;return function(K){return function(da){d=da;l||=setTimeout(function(){l=void 0;K(d)},a)}}}function Jj(a){var d,l;return function(K){return function(da){d=da;l&&clearTimeout(l);l=setTimeout(function(){K(d)},a)}}}
function vh(){for(var a=arguments.length,d=Array(a),l=0;l<a;l++)d[l]=arguments[l];var K=Array(d.length),da=0,ja=null,ra=Math.pow(2,d.length)-1;d.forEach(function(Ka,Sa){var bb=Math.pow(2,Sa);fh(Ka,function(gb){var jb=da;da|=bb;K[Sa]=gb;jb!==ra&&da===ra&&ja&&(ja(),ja=null)})});return function(Ka){return function(Sa){var bb=function(){return Ka([Sa].concat(K))};da===ra?bb():ja=bb}}}function Qp(){for(var a=arguments.length,d=Array(a),l=0;l<a;l++)d[l]=arguments[l];return function(K,da){switch(K){case 1:return Vr.apply(void 0,
d.map(function(ja){return ja(1,da)}));case 2:break;default:throw Error("unrecognized action "+K);}}}function kh(a,d){void 0===d&&(d=Im);return xf(a,Sh(d))}function sj(){for(var a=Cg(),d=arguments.length,l=Array(d),K=0;K<d;K++)l[K]=arguments[K];var da=Array(l.length),ja=0,ra=Math.pow(2,l.length)-1;l.forEach(function(Ka,Sa){var bb=Math.pow(2,Sa);fh(Ka,function(gb){da[Sa]=gb;ja|=bb;ja===ra&&a(0,da)})});return function(Ka,Sa){switch(Ka){case 1:return ja===ra&&Sa(da),a(1,Sa);case 2:a(2);break;default:throw Error("unrecognized action "+
Ka);}}}function Vh(a,d,l){void 0===d&&(d=[]);l=(void 0===l?{singleton:!0}:l).singleton;return{id:Symbol(),constructor:a,dependencies:d,singleton:l}}function hp(a){var d=new Map;return function da(K){var ja=K.id,ra=K.constructor,Ka=K.dependencies;if((K=K.singleton)&&d.has(ja))return d.get(ja);ra=ra(Ka.map(function(Sa){return da(Sa)}));K&&d.set(ja,ra);return ra}(a)}function Jo(a,d){if(null==a)return{};var l={},K=Object.keys(a),da;for(da=0;da<K.length;da++){var ja=K[da];0<=d.indexOf(ja)||(l[ja]=a[ja])}return l}
function ip(a,d){if(a){if("string"===typeof a)return Rp(a,d);var l=Object.prototype.toString.call(a).slice(8,-1);"Object"===l&&a.constructor&&(l=a.constructor.name);if("Map"===l||"Set"===l)return Array.from(a);if("Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return Rp(a,d)}}function Rp(a,d){if(null==d||d>a.length)d=a.length;for(var l=0,K=Array(d);l<d;l++)K[l]=a[l];return K}function ho(a,d){var l="undefined"!==typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(l)return(l=l.call(a)).next.bind(l);
if(Array.isArray(a)||(l=ip(a))||d&&a&&"number"===typeof a.length){l&&(a=l);var K=0;return function(){return K>=a.length?{done:!0}:{done:!1,value:a[K++]}}}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 l={},K={},da=0,ja=a.length;da<ja;)K[a[da]]=1,da+=1;for(var ra in d)K.hasOwnProperty(ra)||(l[ra]=d[ra]);return l}function tj(a,d,l){function K(jb,Jb){jb.propsReady&&
(0,jb.propsReady)(0,!1);for(var Ob=ho(ra),Lb;!(Lb=Ob()).done;)Lb=Lb.value,(0,jb[d.required[Lb]])(0,Jb[Lb]);for(Ob=ho(Ka);!(Lb=Ob()).done;)if(Lb=Lb.value,Lb in Jb)(0,jb[d.optional[Lb]])(0,Jb[Lb]);jb.propsReady&&(0,jb.propsReady)(0,!0)}function da(jb){return Sa.reduce(function(Jb,Ob){Jb[Ob]=function(Lb){(0,jb[d.methods[Ob]])(0,Lb)};return Jb},{})}function ja(jb){return bb.reduce(function(Jb,Ob){Jb[Ob]=Gm(jb[d.events[Ob]]);return Jb},{})}var ra=Object.keys(d.required||{}),Ka=Object.keys(d.optional||
{}),Sa=Object.keys(d.methods||{}),bb=Object.keys(d.events||{}),gb=(0,sm.createContext)({});return{Component:(0,sm.forwardRef)(function(jb,Jb){var Ob=jb.children,Lb=Jo(jb,pC),gc=(0,sm.useState)(function(){return Wi(hp(a),function(Wb){return K(Wb,Lb)})})[0],rc=(0,sm.useState)(Cm(ja,gc))[0];Ds(function(){for(var Wb=ho(bb),kc;!(kc=Wb()).done;)if(kc=kc.value,kc in Lb)(0,rc[kc])(1,Lb[kc]);return function(){Object.values(rc).map(bt)}},[Lb,rc,gc]);Ds(function(){K(gc,Lb)});(0,sm.useImperativeHandle)(Jb,Yq(da(gc)));
return(0,sm.createElement)(gb.Provider,{value:gc},l?(0,sm.createElement)(l,Sp([].concat(ra,Ka,bb),Lb),Ob):Ob)}),usePublisher:function(jb){return(0,sm.useCallback)(Dm(Ur,(0,sm.useContext)(gb)[jb]),[jb])},useEmitterValue:function(jb){var Jb=(0,sm.useContext)(gb)[jb];jb=(0,sm.useState)(Cm(eo,Jb));var Ob=jb[0],Lb=jb[1];Ds(function(){return fh(Jb,function(gc){gc!==Ob&&Lb(Yq(gc))})},[Jb,Ob]);return Ob},useEmitter:function(jb,Jb){var Ob=(0,sm.useContext)(gb)[jb];Ds(function(){return Ob(1,Jb)},[Jb,Ob])}}}
function bh(){return bh=Object.assign||function(a){for(var d=1;d<arguments.length;d++){var l=arguments[d],K;for(K in l)Object.prototype.hasOwnProperty.call(l,K)&&(a[K]=l[K])}return a},bh.apply(this,arguments)}function dm(a,d){if(null==a)return{};var l,K,da={},ja=Object.keys(a);for(K=0;K<ja.length;K++)0<=d.indexOf(l=ja[K])||(da[l]=a[l]);return da}function io(a,d){(null==d||d>a.length)&&(d=a.length);for(var l=0,K=Array(d);l<d;l++)K[l]=a[l];return K}function em(a,d){var l="undefined"!=typeof Symbol&&
a[Symbol.iterator]||a["@@iterator"];if(l)return(l=l.call(a)).next.bind(l);if(Array.isArray(a)||(l=function(da,ja){if(da){if("string"==typeof da)return io(da,ja);var ra=Object.prototype.toString.call(da).slice(8,-1);return"Object"===ra&&da.constructor&&(ra=da.constructor.name),"Map"===ra||"Set"===ra?Array.from(da):"Arguments"===ra||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ra)?io(da,ja):void 0}}(a))||d&&a&&"number"==typeof a.length){l&&(a=l);var K=0;return function(){return K>=a.length?{done:!0}:
{done:!1,value:a[K++]}}}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 Ko(a,d){void 0===d&&(d=!0);var l=(0,qh.useRef)(null),K=function(ja){};if("undefined"!=typeof ResizeObserver){var da=new ResizeObserver(function(ja){ja=ja[0].target;null!==ja.offsetParent&&a(ja)});K=function(ja){ja&&d?(da.observe(ja),l.current=ja):(l.current&&da.unobserve(l.current),l.current=null)}}return{ref:l,
callbackRef:K}}function hj(a,d){return void 0===d&&(d=!0),Ko(a,d).callbackRef}function oi(a,d,l,K,da,ja,ra){return Ko(function(Ka){for(var Sa=function(jb,Jb,Ob,Lb){Ob=jb.length;if(0===Ob)return null;for(var gc=[],rc=0;rc<Ob;rc++){var Wb=jb.item(rc);if(Wb&&void 0!==Wb.dataset.index){var kc=parseInt(Wb.dataset.index),hc=parseFloat(Wb.dataset.knownSize),Fc=Jb(Wb,"offsetHeight");if(0===Fc&&Lb("Zero-sized element, this should not happen",{child:Wb},Ik.ERROR),Fc!==hc)Wb=gc[gc.length-1],0===gc.length||Wb.size!==
Fc||Wb.endIndex!==kc-1?gc.push({startIndex:kc,endIndex:kc,size:Fc}):gc[gc.length-1].endIndex++}}return gc}(Ka.children,d,0,da),bb=Ka.parentElement;!bb.dataset.virtuosoScroller;)bb=bb.parentElement;var gb="window"===bb.firstElementChild.dataset.viewportType;K({scrollTop:Math.max(ra?ra.scrollTop:gb?window.pageYOffset||document.documentElement.scrollTop:bb.scrollTop,0),scrollHeight:ra?ra.scrollHeight:gb?document.documentElement.scrollHeight:bb.scrollHeight,viewportHeight:ra?ra.offsetHeight:gb?window.innerHeight:
bb.offsetHeight});null==ja||ja(function(jb,Jb,Ob){return"normal"===Jb||null!=Jb&&Jb.endsWith("px")||Ob("row-gap was not resolved to pixel value correctly",Jb,Ik.WARN),"normal"===Jb?0:parseInt(null!=Jb?Jb:"0",10)}(0,getComputedStyle(Ka).rowGap,da));null!==Sa&&a(Sa)},l)}function ii(a,d){return Math.round(a.getBoundingClientRect()[d])}function Wr(a,d,l,K,da){void 0===K&&(K=fi);var ja=(0,qh.useRef)(null),ra=(0,qh.useRef)(null),Ka=(0,qh.useRef)(null),Sa=(0,qh.useRef)(!1),bb=(0,qh.useCallback)(function(gb){gb=
gb.target;var jb=gb===window||gb===document,Jb=jb?window.pageYOffset||document.documentElement.scrollTop:gb.scrollTop,Ob=jb?document.documentElement.scrollHeight:gb.scrollHeight,Lb=jb?window.innerHeight:gb.offsetHeight;gb=function(){a({scrollTop:Math.max(Jb,0),scrollHeight:Ob,viewportHeight:Lb})};Sa.current?(0,qC.flushSync)(gb):gb();Sa.current=!1;null!==ra.current&&(Jb===ra.current||0>=Jb||Jb===Ob-Lb)&&(ra.current=null,d(!0),Ka.current&&(clearTimeout(Ka.current),Ka.current=null))},[a,d]);return(0,qh.useEffect)(function(){var gb=
da||ja.current;return K(da||ja.current),bb({target:gb}),gb.addEventListener("scroll",bb,{passive:!0}),function(){K(null);gb.removeEventListener("scroll",bb)}},[ja,bb,l,K,da]),{scrollerRef:ja,scrollByCallback:function(gb){Sa.current=!0;ja.current.scrollBy(gb)},scrollToCallback:function(gb){var jb=ja.current;if(jb&&!("offsetHeight"in jb&&0===jb.offsetHeight)){var Jb,Ob,Lb,gc="smooth"===gb.behavior;if(jb===window?(Ob=Math.max(ii(document.documentElement,"height"),document.documentElement.scrollHeight),
Jb=window.innerHeight,Lb=document.documentElement.scrollTop):(Ob=jb.scrollHeight,Jb=ii(jb,"height"),Lb=jb.scrollTop),gb.top=Math.ceil(Math.max(Math.min(Ob-Jb,gb.top),0)),1.01>Math.abs(Jb-Ob)||gb.top===Lb)return a({scrollTop:Lb,scrollHeight:Ob,viewportHeight:Jb}),void(gc&&d(!0));gc?(ra.current=gb.top,Ka.current&&clearTimeout(Ka.current),Ka.current=setTimeout(function(){Ka.current=null;ra.current=null;d(!0)},1E3)):ra.current=null;jb.scrollTo(gb)}}}}function Lo(a,d,l,K,da){return void 0===K&&(K=gi),
void 0===da&&(da=gi),{k:a,v:d,lvl:l,l:K,r:da}}function x(a,d){if(a===gi)return gi;var l=a.k,K=a.l,da=a.r;if(d===l){if(K===gi)return da;if(da===gi)return K;d=cb(K);return zc(qb(a,{k:d[0],v:d[1],l:nb(K)}))}return zc(qb(a,d<l?{l:x(K,d)}:{r:x(da,d)}))}function ca(a,d,l){return(void 0===l&&(l="k"),a===gi)?[-Infinity,void 0]:a[l]===d?[a.k,a.v]:a[l]<d?(d=ca(a.r,d,l),-Infinity===d[0]?[a.k,a.v]:d):ca(a.l,d,l)}function ya(a,d,l){return a===gi?Lo(d,l,1):d===a.k?qb(a,{k:d,v:l}):Bd(Id(qb(a,d<a.k?{l:ya(a.l,d,l)}:
{r:ya(a.r,d,l)})))}function va(a,d,l){if(a===gi)return[];var K=a.k,da=a.v,ja=a.r,ra=[];return K>d&&(ra=ra.concat(va(a.l,d,l))),K>=d&&K<=l&&ra.push({k:K,v:da}),K<=l&&(ra=ra.concat(va(ja,d,l))),ra}function Ia(a){return a===gi?[]:[].concat(Ia(a.l),[{k:a.k,v:a.v}],Ia(a.r))}function cb(a){return a.r===gi?[a.k,a.v]:cb(a.r)}function nb(a){return a.r===gi?a.l:zc(qb(a,{r:nb(a.r)}))}function qb(a,d){return Lo(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===gi||a.lvl>a.r.lvl}function zc(a){var d=a.l,l=a.r,K=a.lvl;if(l.lvl>=K-1&&d.lvl>=K-1)return a;if(K>l.lvl+1){if(Vb(d))return Id(qb(a,{lvl:K-1}));if(d===gi||d.r===gi)throw Error("Unexpected empty nodes");return qb(d.r,{l:qb(d,{r:d.r.l}),r:qb(a,{l:d.r.r,lvl:K-1}),lvl:K})}if(Vb(a))return Bd(qb(a,{lvl:K-1}));if(l===gi||l.l===gi)throw Error("Unexpected empty nodes");d=l.l;var da=Vb(d)?l.lvl-1:l.lvl;return qb(d,{l:qb(a,{r:d.l,lvl:K-1}),r:Bd(qb(l,{l:d.r,lvl:da})),lvl:d.lvl+
1})}function Pc(a,d,l){return a===gi?[]:wd(va(a,ca(a,d)[0],l),function(K){return{index:K.k,value:K.v}})}function wd(a,d){var l=a.length;if(0===l)return[];var K=d(a[0]),da=K.index;K=K.value;for(var ja=[],ra=1;ra<l;ra++){var Ka=d(a[ra]),Sa=Ka.index;Ka=Ka.value;ja.push({start:da,end:Sa-1,value:K});da=Sa;K=Ka}return ja.push({start:da,end:Infinity,value:K}),ja}function Bd(a){var d=a.r,l=a.lvl;return d===gi||d.r===gi||d.lvl!==l||d.r.lvl!==l?a:qb(d,{l:qb(a,{r:d.l}),lvl:l+1})}function Id(a){var d=a.l;return d===
gi||d.lvl!==a.lvl?a:qb(d,{r:qb(a,{l:d.r})})}function Ce(a,d,l,K){void 0===K&&(K=0);for(var da=a.length-1;K<=da;){var ja=Math.floor((K+da)/2),ra=l(a[ja],d);if(0===ra)return ja;if(-1===ra){if(2>da-K)return ja-1;da=ja-1}else{if(da===K)return ja;K=ja+1}}throw Error("Failed binary finding record in array - "+a.join(",")+", searched for "+d);}function Mf(a){var d=a.size,l=a.startIndex,K=a.endIndex;return function(da){return da.start===l&&(da.end===K||Infinity===da.end)&&da.value===d}}function Pg(a,d){a=
a.index;return d===a?0:d<a?-1:1}function Vj(a,d){a=a.offset;return d===a?0:d<a?-1:1}function Ag(a){return{index:a.index,value:a}}function yi(a,d,l,K){var da=0,ja=0,ra=0,Ka;0!==d?(ra=a[Ka=Ce(a,d-1,Pg)].offset,ja=ca(l,d-1),da=ja[0],ja=ja[1],a.length&&a[Ka].size===ca(l,d)[1]&&--Ka,a=a.slice(0,Ka+1)):a=[];for(d=em(Pc(l,d,Infinity));!(l=d()).done;)Ka=l.value,l=Ka.start,Ka=Ka.value,da=l-da,ra=da*ja+ra+da*K,a.push({offset:ra,size:Ka,index:l}),da=l,ja=Ka;return{offsetTree:a,lastIndex:da,lastOffset:ra,lastSize:ja}}
function pi(a,d){var l=d[0],K=d[1],da=d[3];0<l.length&&(0,d[2])("received item sizes",l,Ik.DEBUG);var ja=a.sizeTree;d=ja;var ra=0;if(0<K.length&&ja===gi&&2===l.length){var Ka=l[0].size,Sa=l[1].size;d=K.reduce(function(gb,jb){return ya(ya(gb,jb,Ka),jb+1,Sa)},d)}else l=function(gb,jb){var Jb,Ob=gb===gi?0:Infinity;for(jb=em(jb);!(Jb=jb()).done;){var Lb=Jb.value;Jb=Lb.size;var gc=Lb.startIndex,rc=Lb.endIndex;if(Ob=Math.min(Ob,gc),gb===gi)gb=ya(gb,0,Jb);else{var Wb=Pc(gb,gc-1,rc+1);if(!Wb.some(Mf(Lb))){var kc,
hc=Lb=!1;for(Wb=em(Wb);!(kc=Wb()).done;){var Fc=kc.value;kc=Fc.start;var Lc=Fc.end;Fc=Fc.value;Lb?(rc>=kc||Jb===Fc)&&(gb=x(gb,kc)):(hc=Fc!==Jb,Lb=!0);Lc>rc&&rc>=kc&&Fc!==Jb&&(gb=ya(gb,rc+1,Fc))}hc&&(gb=ya(gb,gc,Jb))}}}return[gb,Ob]}(d,l),d=l[0],ra=l[1];if(d===ja)return a;a=yi(a.offsetTree,ra,d,da);var bb=a.offsetTree;return{sizeTree:d,offsetTree:bb,lastIndex:a.lastIndex,lastOffset:a.lastOffset,lastSize:a.lastSize,groupOffsetTree:K.reduce(function(gb,jb){return ya(gb,jb,Th(jb,bb,da))},gi),groupIndices:K}}
function Th(a,d,l){if(0===d.length)return 0;d=d[Ce(d,a,Pg)];a-=d.index;a=d.size*a+(a-1)*l+d.offset;return 0<a?a+l:a}function zi(a,d,l){if(void 0!==a.groupIndex)return d.groupIndices[a.groupIndex]+1;a=zh("LAST"===a.index?l:a.index,d);return Math.max(0,a,Math.min(l,a))}function zh(a,d){if(d.groupOffsetTree===gi)return a;for(var l=0;d.groupIndices[l]<=a+l;)l++;return a+l}function Uh(a){a="number"==typeof a?{index:a}:a;return a.align||(a.align="start"),a.behavior&&qH||(a.behavior="auto"),a.offset||(a.offset=
0),a}function Wh(a){return!!a&&("smooth"===a?"smooth":"auto")}function qi(a){return a.reduce(function(d,l){return d.groupIndices.push(d.totalCount),d.totalCount+=l+1,d},{totalCount:0,groupIndices:[]})}function uj(a,d){return!(!a||a[0]!==d[0]||a[1]!==d[1])}function Dk(a,d){return!(!a||a.startIndex!==d.startIndex||a.endIndex!==d.endIndex)}function ul(a,d,l){return"number"==typeof a?"up"===l&&"top"===d||"down"===l&&"bottom"===d?a:0:"up"===l?"top"===d?a.main:a.reverse:"bottom"===d?a.main:a.reverse}function Kn(a,
d,l){if(0===a.length)return[];if(d.groupOffsetTree===gi)return a.map(function(Sa){return bh({},Sa,{index:Sa.index+l,originalIndex:Sa.index})});var K,da=[],ja=Pc(d.groupOffsetTree,a[0].index,a[a.length-1].index),ra=void 0,Ka=0;for(a=em(a);!(K=a()).done;)K=K.value,(!ra||ra.end<K.index)&&(ra=ja.shift(),Ka=d.groupIndices.indexOf(ra.start)),da.push(bh({},K.index===ra.start?{type:"group",index:Ka}:{index:K.index-(Ka+1)+l,groupIndex:Ka},{size:K.size,offset:K.offset,originalIndex:K.index,data:K.data}));return da}
function Jm(a,d,l,K,da,ja){var ra=0,Ka=0;0<a.length&&(ra=a[0].offset,Ka=a[a.length-1],Ka=Ka.offset+Ka.size);var Sa=l-da.lastIndex,bb=ra;K=da.lastOffset+Sa*da.lastSize+(Sa-1)*K-Ka;return{items:Kn(a,da,ja),topItems:Kn(d,da,ja),topListHeight:d.reduce(function(gb,jb){return jb.size+gb},0),offsetTop:ra,offsetBottom:K,top:bb,bottom:Ka,totalCount:l,firstItemIndex:ja}}function Km(a){var d,l=!1;return function(){return l||(l=!0,d=a()),d}}function ph(a,d){var l=(0,qh.useRef)(null),K=(0,qh.useCallback)(function(Sa){if(null!==
Sa&&Sa.offsetParent){var bb=Sa.getBoundingClientRect();Sa=bb.width;if(d){var gb=d.getBoundingClientRect();bb=bb.top-gb.top;gb=gb.height-Math.max(0,bb);bb+=d.scrollTop}else gb=window.innerHeight-Math.max(0,bb.top),bb=bb.top+window.pageYOffset;l.current={offsetTop:bb,visibleHeight:gb,visibleWidth:Sa};a(l.current)}},[a,d]),da=Ko(K),ja=da.callbackRef,ra=da.ref,Ka=(0,qh.useCallback)(function(){K(ra.current)},[K,ra]);return(0,qh.useEffect)(function(){if(d){d.addEventListener("scroll",Ka);var Sa=new ResizeObserver(Ka);
return Sa.observe(d),function(){d.removeEventListener("scroll",Ka);Sa.unobserve(d)}}return window.addEventListener("scroll",Ka),window.addEventListener("resize",Ka),function(){window.removeEventListener("scroll",Ka);window.removeEventListener("resize",Ka)}},[Ka,d]),ja}function ct(a){return a}function om(a,d){var l=Cg();return fh(l,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+d,"color: red;","color: inherit;","color: blue;")}),Kg(l,a),l}function gk(a,d){if("string"!=
typeof a)return{context:d}}function Xr(a){var d=a.usePublisher,l=a.useEmitter,K=a.useEmitterValue;return Zg.memo(function(da){var ja=da.style,ra=da.children;da=dm(da,ty);var Ka=d("scrollContainerState"),Sa=K("ScrollerComponent"),bb=d("smoothScrollTargetReached"),gb=K("scrollerRef"),jb=K("context");Ka=Wr(Ka,bb,Sa,gb);bb=Ka.scrollerRef;gb=Ka.scrollByCallback;return l("scrollTo",Ka.scrollToCallback),l("scrollBy",gb),(0,qh.createElement)(Sa,bh({ref:bb,style:bh({},uH,ja),"data-test-id":"virtuoso-scroller",
"data-virtuoso-scroller":!0,tabIndex:0},da,gk(Sa,jb)),ra)})}function Zq(a){var d=a.usePublisher,l=a.useEmitter,K=a.useEmitterValue;return Zg.memo(function(da){var ja=da.style,ra=da.children;da=dm(da,yC);var Ka=d("windowScrollContainerState"),Sa=K("ScrollerComponent"),bb=d("smoothScrollTargetReached"),gb=K("totalListHeight"),jb=K("deviation"),Jb=K("customScrollParent"),Ob=K("context");bb=Wr(Ka,bb,Sa,fi,Jb);var Lb=bb.scrollerRef;Ka=bb.scrollByCallback;bb=bb.scrollToCallback;return oH(function(){return Lb.current=
Jb||window,function(){Lb.current=null}},[Lb,Jb]),l("windowScrollTo",bb),l("scrollBy",Ka),(0,qh.createElement)(Sa,bh({style:bh({position:"relative"},ja,0!==gb?{height:gb+jb}:{}),"data-virtuoso-scroller":!0},da,gk(Sa,Ob)),ra)})}function Yr(a,d,l){return Array.from({length:d-a+1}).map(function(K,da){return{index:da+a,data:null==l?void 0:l[da+a]}})}function Tp(a,d){return a&&a.column===d.column&&a.row===d.row}function Fu(a,d,l,K){var da=l.height;return void 0===da||0===K.length?{top:0,bottom:0}:{top:dt(a,
d,l,K[0].index),bottom:dt(a,d,l,K[K.length-1].index)+da}}function dt(a,d,l,K){var da=d.column;a=ki(1,gu((a.width+da)/(l.width+da)));K=gu(K/a);l=K*l.height+ki(0,K-1)*d.row;return 0<l?l+d.row:l}function Gu(a,d,l){return"normal"===d||null!=d&&d.endsWith("px")||l(a+" was not resolved to pixel value correctly",d,Ik.WARN),"normal"===d?0:parseInt(null!=d?d:"0",10)}function Up(a,d){Up=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(l,K){l.__proto__=K;return l};return Up(a,d)}function Zr(a,d){a.prototype=
Object.create(d.prototype);a.prototype.constructor=a;Up(a,d)}function et(a){et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(d){return d.__proto__||Object.getPrototypeOf(d)};return et(a)}function ww(){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 ft(a,d,l){ft=ww()?Reflect.construct.bind():function(K,
da,ja){var ra=[null];ra.push.apply(ra,da);K=new (Function.bind.apply(K,ra));ja&&Up(K,ja.prototype);return K};return ft.apply(null,arguments)}function gt(a){var d="function"===typeof Map?new Map:void 0;gt=function(l){function K(){return ft(l,arguments,et(this).constructor)}if(null===l||-1===Function.toString.call(l).indexOf("[native code]"))return l;if("function"!==typeof l)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof d){if(d.has(l))return d.get(l);
d.set(l,K)}K.prototype=Object.create(l.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}});return Up(K,l)};return gt(a)}function xw(a,d,l){return Math.round(255*a)+","+Math.round(255*d)+","+Math.round(255*l)}function $q(a,d,l,K){void 0===K&&(K=xw);if(0===d)return K(l,l,l);a=(a%360+360)%360/60;var da=(1-Math.abs(2*l-1))*d,ja=da*(1-Math.abs(a%2-1)),ra=d=0,Ka=0;0<=a&&1>a?(d=da,ra=ja):1<=a&&2>a?(d=ja,ra=da):2<=a&&3>a?(ra=da,Ka=ja):3<=a&&4>a?(ra=ja,Ka=da):4<=a&&5>a?(d=ja,Ka=da):
5<=a&&6>a&&(d=da,Ka=ja);l-=da/2;return K(d+l,ra+l,Ka+l)}function yw(a){if("string"!==typeof a)throw new Ql(3);if("string"===typeof a){var d=a.toLowerCase();a=Tv[d]?"#"+Tv[d]:a}if(a.match(KC))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(LC))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(yy))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(tn))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=vr.exec(a))return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10)};if(d=jl.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 l=Uv.exec(a);if(l){d=parseInt(""+l[1],10);var K=parseInt(""+l[2],10)/100;l=parseInt(""+l[3],10)/100;d="rgb("+$q(d,K,l)+")";K=vr.exec(d);if(!K)throw new Ql(4,a,d);return{red:parseInt(""+K[1],10),green:parseInt(""+K[2],10),blue:parseInt(""+K[3],10)}}if(d=ju.exec(a.substring(0,50))){K=parseInt(""+d[1],10);l=parseInt(""+d[2],10)/100;var da=parseInt(""+d[3],10)/100;K="rgb("+$q(K,l,da)+")";l=vr.exec(K);if(!l)throw new Ql(4,a,K);return{red:parseInt(""+
l[1],10),green:parseInt(""+l[2],10),blue:parseInt(""+l[3],10),alpha:1<parseFloat(""+d[4])?parseFloat(""+d[4])/100:parseFloat(""+d[4])}}throw new Ql(5);}function jo(a){a=a.toString(16);return 1===a.length?"0"+a:a}function ht(a,d,l){return Tm("#"+jo(Math.round(255*a))+jo(Math.round(255*d))+jo(Math.round(255*l)))}function Hu(a,d,l){if("number"===typeof a&&"number"===typeof d&&"number"===typeof l)return Tm("#"+jo(a)+jo(d)+jo(l));if("object"===typeof a&&void 0===d&&void 0===l)return Tm("#"+jo(a.red)+jo(a.green)+
jo(a.blue));throw new Ql(6);}function zw(a){if("object"!==typeof a)throw new Ql(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?Hu(a.red,a.green,a.blue):"rgba("+a.red+","+a.green+","+a.blue+","+a.alpha+")";else throw new Ql(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 Hu(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?$q(a.hue,a.saturation,a.lightness,ht):"rgba("+$q(a.hue,a.saturation,a.lightness)+","+a.alpha+")";else throw new Ql(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=$q(a.hue,a.saturation,a.lightness,ht);else throw new Ql(1);
return a}throw new Ql(8);}function it(a,d,l){return function(){var K=l.concat(Array.prototype.slice.call(arguments));return K.length>=d?a.apply(this,K):it(a,d,K)}}function jt(a,d){if("transparent"===d)return d;d=yw(d);var l=d.red/255,K=d.green/255,da=d.blue/255,ja=Math.max(l,K,da),ra=Math.min(l,K,da),Ka=(ja+ra)/2;if(ja===ra)d=void 0!==d.alpha?{hue:0,saturation:0,lightness:Ka,alpha:d.alpha}:{hue:0,saturation:0,lightness:Ka};else{var Sa=ja-ra;ra=.5<Ka?Sa/(2-ja-ra):Sa/(ja+ra);switch(ja){case l:l=(K-
da)/Sa+(K<da?6:0);break;case K:l=(da-l)/Sa+2;break;default:l=(l-K)/Sa+4}l*=60;d=void 0!==d.alpha?{hue:l,saturation:ra,lightness:Ka,alpha:d.alpha}:{hue:l,saturation:ra,lightness:Ka}}Ka=Oe;a=d.lightness-parseFloat(a);return zw(Ka({},d,{lightness:Math.max(0,Math.min(1,a))}))}function fn(a,d){var l;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 K=null!=(l=d.fill)?l:a.props.fill;void 0===K||Gi(K)||"var(--ls-secondary-background-color)"===
K||d.noFill||!DH.includes(a.props.type)||(a=Ui(.3,K),d.stroke=a);return d}function kt({strokeWidth:a,size:d,mode:l}){return"svg"===l?(0,Ns.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,Ns.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 $r(){const a=mg();return"panning"===a.inputs.state||
"pinching"===a.inputs.state}function Iu({left:a,middle:d,right:l,stroke:K,strokeWidth:da}){return(0,Yv.jsxs)("g",{children:[(0,Yv.jsx)("path",{className:"tl-stroke-hitarea",d:`M ${a} L ${d} ${l}`}),(0,Yv.jsx)("path",{d:`M ${a} L ${d} ${l}`,fill:"none",stroke:K,strokeWidth:da,strokeLinecap:"round",strokeLinejoin:"round",pointerEvents:"none"})]})}function lt(a,d,l){d=P(a,d,a,l).points;if(!d)return console.warn("Could not find an intersection for the arrow head."),{left:a,right:a};d=(l=d[0])?be.rotWith(l,
a,Math.PI/6):a;a=l?be.rotWith(l,a,-Math.PI/6):a;return{left:d,right:a}}function Ju(a,d,l){const {left:K,right:da}=lt(a,d,l);return`M ${K} L ${a} ${da}`}function Aw(a,d,l,K,da){a=a.strokeWidth;var ja=be.dist(d,l);a=Math.min(ja/3,16*a);ja=[];ja.push(`M ${d} L ${l}`);K&&ja.push(Ju(d,l,a));da&&ja.push(Ju(l,d,a));return ja.join(" ")}function mt({id:a,bounds:d,labelSize:l,offset:K,scale:da=1}){return(0,nu.jsx)("defs",{children:(0,nu.jsxs)("mask",{id:a+"_clip",children:[(0,nu.jsx)("rect",{x:-100,y:-100,
width:d.width+200,height:d.height+200,fill:"white"}),(0,nu.jsx)("rect",{x:d.width/2-l[0]/2*da+((null==K?void 0:K[0])||0),y:d.height/2-l[1]/2*da+((null==K?void 0:K[1])||0),width:l[0]*da,height:l[1]*da,rx:4*da,ry:4*da,fill:"black"})]})})}function nt(a,d,l,K=da=>da){return a*K(.5-d*(.5-l))}function Bw(a){return[-a[0],-a[1]]}function gn(a,d){return[a[0]+d[0],a[1]+d[1]]}function pm(a,d){return[a[0]-d[0],a[1]-d[1]]}function hn(a,d){return[a[0]*d,a[1]*d]}function ar(a){return[a[1],-a[0]]}function Cw(a,d){return a[0]===
d[0]&&a[1]===d[1]}function Ku(a){return a[0]*a[0]+a[1]*a[1]}function Lu(a){var d=Math.hypot(a[0],a[1]);return[a[0]/d,a[1]/d]}function Dw(a,d){return Math.hypot(a[1]-d[1],a[0]-d[0])}function br(a,d,l){let K=Math.sin(l);l=Math.cos(l);let da=a[0]-d[0];a=a[1]-d[1];return[da*l-a*K+d[0],da*K+a*l+d[1]]}function ot(a,d,l){return gn(a,hn(pm(d,a),l))}function Mu(a,d,l){return gn(a,hn(d,l))}function Ew(a,d={}){let {size:l=16,smoothing:K=.5,thinning:da=.5,simulatePressure:ja=!0,easing:ra=Dd=>Dd,start:Ka={},end:Sa=
{},last:bb=!1}=d,{cap:gb=!0,easing:jb=Dd=>Dd*(2-Dd)}=Ka,{cap:Jb=!0,easing:Ob=Dd=>--Dd*Dd*Dd+1}=Sa;if(0===a.length||0>=l)return[];var Lb=a[a.length-1].runningLength;let gc=!1===Ka.taper?0:!0===Ka.taper?Math.max(l,Lb):Ka.taper,rc=!1===Sa.taper?0:!0===Sa.taper?Math.max(l,Lb):Sa.taper;var Wb=Math.pow(l*K,2);d=[];let kc=[];var hc=a.slice(0,10).reduce((Dd,jd)=>{var Cd=jd.pressure;ja&&(jd=so(1,jd.distance/l),Cd=so(1,1-jd),Cd=so(1,Dd+.275*(Cd-Dd)*jd));return(Dd+Cd)/2},a[0].pressure),Fc=nt(l,da,a[a.length-
1].pressure,ra),Lc;let ud=a[0].vector;var Jd=a[0].point;let Ee=Jd;var Sd=Jd;let De=Ee;var gf=!1;for(var Te=0;Te<a.length;Te++){var {pressure:df}=a[Te];let {point:Dd,vector:jd,distance:Cd,runningLength:Me}=a[Te];if(Te<a.length-1&&3>Lb-Me)continue;da?(ja&&(Fc=so(1,Cd/l),df=so(1,1-Fc),df=so(1,hc+.275*(df-hc)*Fc)),Fc=nt(l,da,df,ra)):Fc=l/2;void 0===Lc&&(Lc=Fc);var Gd=Me<gc?jb(Me/gc):1,od=Lb-Me<rc?Ob((Lb-Me)/rc):1;Fc=Math.max(.01,Fc*Math.min(Gd,od));od=(Te<a.length-1?a[Te+1]:a[Te]).vector;let af=Te<a.length-
1?jd[0]*od[0]+jd[1]*od[1]:1;Gd=null!==af&&0>af;if(0>jd[0]*ud[0]+jd[1]*ud[1]&&!gf||Gd){Jd=hn(ar(ud),Fc);for(let Nf=1/13,bg=0;1>=bg;bg+=Nf)Sd=br(pm(Dd,Jd),Dd,xp*bg),d.push(Sd),De=br(gn(Dd,Jd),Dd,xp*-bg),kc.push(De);Jd=Sd;Ee=De;Gd&&(gf=!0)}else(gf=!1,Te===a.length-1)?(df=hn(ar(jd),Fc),d.push(pm(Dd,df)),kc.push(gn(Dd,df))):(hc=hn(ar(ot(od,jd,af)),Fc),Sd=pm(Dd,hc),(1>=Te||Ku(pm(Jd,Sd))>Wb)&&(d.push(Sd),Jd=Sd),De=gn(Dd,hc),(1>=Te||Ku(pm(Ee,De))>Wb)&&(kc.push(De),Ee=De),hc=df,ud=jd)}Lb=a[0].point.slice(0,
2);Wb=1<a.length?a[a.length-1].point.slice(0,2):gn(a[0].point,[1,1]);Sd=[];gf=[];if(1===a.length){if(!gc&&!rc||bb){a=Mu(Lb,Lu(ar(pm(Lb,Wb))),-(Lc||Fc));d=[];for(let Dd=1/13,jd=Dd;1>=jd;jd+=Dd)d.push(br(a,Lb,2*xp*jd));return d}}else{if(!(gc||rc&&1===a.length))if(gb)for(let Dd=1/13,jd=Dd;1>=jd;jd+=Dd)Lc=br(kc[0],Lb,xp*jd),Sd.push(Lc);else Te=pm(d[0],kc[0]),Lc=hn(Te,.5),Te=hn(Te,.51),Sd.push(pm(Lb,Lc),pm(Lb,Te),gn(Lb,Te),gn(Lb,Lc));Lc=ar(Bw(a[a.length-1].vector));if(rc||gc&&1===a.length)gf.push(Wb);
else if(Jb){a=Mu(Wb,Lc,Fc);for(let Dd=1/29,jd=Dd;1>jd;jd+=Dd)gf.push(br(a,Wb,3*xp*jd))}else gf.push(gn(Wb,hn(Lc,Fc)),gn(Wb,hn(Lc,.99*Fc)),pm(Wb,hn(Lc,.99*Fc)),pm(Wb,hn(Lc,Fc)))}return d.concat(gf,kc.reverse(),Sd)}function Fw(a,d={}){var l;let {streamline:K=.5,size:da=16,last:ja=!1}=d;if(0===a.length)return[];d=.15+.85*(1-K);a=Array.isArray(a[0])?a:a.map(({x:jb,y:Jb,pressure:Ob=.5})=>[jb,Jb,Ob]);if(2===a.length){var ra=a[1];a=a.slice(0,-1);for(var Ka=1;5>Ka;Ka++)a.push(ot(a[0],ra,Ka/4))}1===a.length&&
(a=[...a,[...gn(a[0],[1,1]),...a[0].slice(2)]]);ra=[{point:[a[0][0],a[0][1]],pressure:0<=a[0][2]?a[0][2]:.25,vector:[1,1],distance:0,runningLength:0}];Ka=!1;let Sa=0,bb=ra[0],gb=a.length-1;for(let jb=1;jb<a.length;jb++){let Jb=ja&&jb===gb?a[jb].slice(0,2):ot(bb.point,a[jb],d);if(Cw(bb.point,Jb))continue;let Ob=Dw(Jb,bb.point);if(Sa+=Ob,jb<gb&&!Ka){if(Sa<da)continue;Ka=!0}bb={point:Jb,pressure:0<=a[jb][2]?a[jb][2]:.5,vector:Lu(pm(bb.point,Jb)),distance:Ob,runningLength:Sa};ra.push(bb)}return ra[0].vector=
(null==(l=ra[1])?void 0:l.vector)||[0,0],ra}function Gw(a,d=4/3){return(new nh(a)).exportAsSVG(d)}function Hw(a,d=4/3){return(new nh(a)).generatePreviewJsx(void 0,d)}function Nu({id:a,type:d,onRemove:l,showContent:K}){const da=mg(),{handlers:ja}=ky.default.useContext(ji),ra=ja.t;return(0,Yh.jsxs)("div",{className:"tl-shape-links-panel-item color-level relative",children:[(0,Yh.jsx)("div",{className:"whitespace-pre break-all overflow-hidden text-ellipsis inline-flex",children:(0,Yh.jsx)(ly,{id:a,showReferenceContent:K})}),
(0,Yh.jsx)("div",{className:"flex-1"}),ja.getBlockPageName(a)!==da.currentPage.name&&(0,Yh.jsx)(Yd,{tooltip:ra("whiteboard/open-page"),type:"button",onClick:()=>null==ja?void 0:ja.redirectToPage(a),children:(0,Yh.jsx)(Qg,{name:"open-as-page"})}),(0,Yh.jsx)(Yd,{tooltip:ra("whiteboard/open-page-in-sidebar"),type:"button",onClick:()=>null==ja?void 0:ja.sidebarAddBlock(a,"B"===d?"block":"page"),children:(0,Yh.jsx)(Qg,{name:"move-to-sidebar-right"})}),l&&(0,Yh.jsx)(Yd,{className:"tl-shape-links-panel-item-remove-button",
tooltip:ra("whiteboard/remove-link"),type:"button",onClick:l,children:(0,Yh.jsx)(Qg,{name:"x",className:"!translate-y-0"})})]})}function ha({options:a,value:d,onValueChange:l}){return(0,Bp.jsx)(XC,{className:"tl-toggle-group-input",type:"single",value:d,onValueChange:l,children:a.map(K=>(0,Bp.jsx)(ce,{content:K.tooltip,children:(0,Bp.jsx)("div",{className:"inline-block",children:(0,Bp.jsx)(YC,{className:"tl-toggle-group-input-button",value:K.value,disabled:K.value===d,children:(0,Bp.jsx)(Qg,{name:K.icon})})})},
K.value))})}function Aa({options:a,value:d,onValueChange:l}){return(0,Bp.jsx)(XC,{className:"tl-toggle-group-input",type:"multiple",value:d,onValueChange:l,children:a.map(K=>(0,Bp.jsx)(YC,{className:"tl-toggle-group-input-button",value:K.value,children:(0,Bp.jsx)(Qg,{name:K.icon})},K.value))})}function Za(a){return mg().selectedShapesArray.filter(d=>!d.props.isLocked).filter(d=>{var l;return null==(l=Iy[d.props.type])?void 0:l.includes(a)})}function Rb(a){var d;a=a.match(/\.[0-9a-z]+$/i);if(!a)return"unknown";
const l=a[0].toLowerCase();[a]=null!=(d=Object.entries(dD).find(([,K])=>K.includes(l)))?d:["unknown",null];return a}function tc(...a){return(...d)=>Oh(this,null,function*(){for(const l of a){const K=yield l(...d);if(K&&0<K.length)return K}return null})}function Kc(a,d){return Oh(this,null,function*(){return a.types.includes(d)?a instanceof DataTransfer?a.getData(d):yield(yield a.getType(d)).text():null})}function xd(){const {handlers:a}=fw.useContext(ji);return fw.useCallback((d,l)=>Oh(this,null,
function*(){if(l.shiftKey&&1===d.selectedShapesArray.length){var K=yield navigator.clipboard.read();let da;0<K.length&&(K=(yield(yield K[0].getType("text/plain")).text()).trim())&&(/^\(\(.*\)\)$/.test(K)&&40===K.length?(K=K.slice(2,-2),Dj(K)&&(da=K)):/^\[\[.*\]\]$/.test(K)&&(da=K.slice(2,-2)));if(da){d.selectedShapesArray[0].update({refs:[da]});d.persist();return}}RH(d,l,a)}),[])}function Md(){const a=xd();return Ky.useCallback((d,l)=>Oh(this,[d,l],function*(K,{dataTransfer:da,point:ja}){a(K,{point:ja,
shiftKey:!1,dataTransfer:da,fromDrop:!0})}),[])}function de(){const {handlers:a}=Ly.useContext(ji);return Ly.useCallback((d,{text:l,html:K})=>{a.copyToClipboard(l,K)},[])}function Be(){return xq.default.useCallback(a=>Oh(this,null,function*(){setTimeout(()=>{a.transition("logseq-portal").selectedTool.transition("creating")},100)}),[])}var Xe=Object.create,Ff=Object.defineProperty,dg=Object.defineProperties,lh=Object.getOwnPropertyDescriptor,Kh=Object.getOwnPropertyDescriptors,Ek=Object.getOwnPropertyNames,
jn=Object.getOwnPropertySymbols,Lm=Object.getPrototypeOf,Lh=Object.prototype.hasOwnProperty,pk=Object.prototype.propertyIsEnumerable,Kl=(a,d,l)=>d in a?Ff(a,d,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[d]=l,Zd=(a,d)=>{for(var l in d||={})Lh.call(d,l)&&Kl(a,l,d[l]);if(jn)for(l of jn(d))pk.call(d,l)&&Kl(a,l,d[l]);return a},ff=(a,d)=>dg(a,Kh(d)),Jf=(a,d)=>{var l={},K;for(K in a)Lh.call(a,K)&&0>d.indexOf(K)&&(l[K]=a[K]);if(null!=a&&jn)for(K of jn(a))0>d.indexOf(K)&&pk.call(a,K)&&(l[K]=a[K]);
return l},cr=(a,d)=>function(){return d||(0,a[Ek(a)[0]])((d={exports:{}}).exports,d),d.exports},Wy=(a,d,l,K)=>{if(d&&"object"===typeof d||"function"===typeof d)for(let da of Ek(d))Lh.call(a,da)||da===l||Ff(a,da,{get:()=>d[da],enumerable:!(K=lh(d,da))||K.enumerable});return a},Kf=(a,d,l)=>(l=null!=a?Xe(Lm(a)):{},Wy(!d&&a&&a.__esModule?l:Ff(l,"default",{value:a,enumerable:!0}),a)),fe=(a,d,l,K)=>{for(var da=1<K?void 0:K?lh(d,l):d,ja=a.length-1,ra;0<=ja;ja--)if(ra=a[ja])da=(K?ra(d,l,da):ra(da))||da;K&&
da&&Ff(d,l,da);return da},hb=(a,d,l)=>{Kl(a,"symbol"!==typeof d?d+"":d,l);return l},Oh=(a,d,l)=>new Promise((K,da)=>{var ja=Sa=>{try{Ka(l.next(Sa))}catch(bb){da(bb)}},ra=Sa=>{try{Ka(l.throw(Sa))}catch(bb){da(bb)}},Ka=Sa=>Sa.done?K(Sa.value):Promise.resolve(Sa.value).then(ja,ra);Ka((l=l.apply(a,d)).next())}),zD=cr({["../../node_modules/rbush/rbush.min.js"](a,d){!function(l,K){"object"==typeof a&&"undefined"!=typeof d?d.exports=K():"function"==typeof define&&define.amd?define(K):(l=l||self).RBush=K()}(a,
function(){function l(Wb,kc,hc,Fc,Lc){!function Te(Jd,Ee,Sd,De,gf){for(;De>Sd;){if(600<De-Sd){var df=De-Sd+1,Gd=Ee-Sd+1,od=Math.log(df),Dd=.5*Math.exp(2*od/3);od=.5*Math.sqrt(od*Dd*(df-Dd)/df)*(0>Gd-df/2?-1:1);Te(Jd,Ee,Math.max(Sd,Math.floor(Ee-Gd*Dd/df+od)),Math.min(De,Math.floor(Ee+(df-Gd)*Dd/df+od)),gf)}df=Jd[Ee];Gd=Sd;Dd=De;K(Jd,Sd,Ee);for(0<gf(Jd[De],df)&&K(Jd,Sd,De);Gd<Dd;){K(Jd,Gd,Dd);Gd++;for(Dd--;0>gf(Jd[Gd],df);)Gd++;for(;0<gf(Jd[Dd],df);)Dd--}0===gf(Jd[Sd],df)?K(Jd,Sd,Dd):K(Jd,++Dd,De);
Dd<=Ee&&(Sd=Dd+1);Ee<=Dd&&(De=Dd-1)}}(Wb,kc,hc||0,Fc||Wb.length-1,Lc||da)}function K(Wb,kc,hc){var Fc=Wb[kc];Wb[kc]=Wb[hc];Wb[hc]=Fc}function da(Wb,kc){return Wb<kc?-1:Wb>kc?1:0}function ja(Wb,kc){ra(Wb,0,Wb.children.length,kc,Wb)}function ra(Wb,kc,hc,Fc,Lc){Lc||=Lb(null);Lc.minX=1/0;Lc.minY=1/0;Lc.maxX=-1/0;for(Lc.maxY=-1/0;kc<hc;kc++){var ud=Wb.children[kc];Ka(Lc,Wb.leaf?Fc(ud):ud)}return Lc}function Ka(Wb,kc){return Wb.minX=Math.min(Wb.minX,kc.minX),Wb.minY=Math.min(Wb.minY,kc.minY),Wb.maxX=Math.max(Wb.maxX,
kc.maxX),Wb.maxY=Math.max(Wb.maxY,kc.maxY),Wb}function Sa(Wb,kc){return Wb.minX-kc.minX}function bb(Wb,kc){return Wb.minY-kc.minY}function gb(Wb){return(Wb.maxX-Wb.minX)*(Wb.maxY-Wb.minY)}function jb(Wb){return Wb.maxX-Wb.minX+(Wb.maxY-Wb.minY)}function Jb(Wb,kc){return Wb.minX<=kc.minX&&Wb.minY<=kc.minY&&kc.maxX<=Wb.maxX&&kc.maxY<=Wb.maxY}function Ob(Wb,kc){return kc.minX<=Wb.maxX&&kc.minY<=Wb.maxY&&kc.maxX>=Wb.minX&&kc.maxY>=Wb.minY}function Lb(Wb){return{children:Wb,height:1,leaf:!0,minX:1/0,minY:1/
0,maxX:-1/0,maxY:-1/0}}function gc(Wb,kc,hc,Fc,Lc){for(var ud=[kc,hc];ud.length;)if(!((hc=ud.pop())-(kc=ud.pop())<=Fc)){var Jd=kc+Math.ceil((hc-kc)/Fc/2)*Fc;l(Wb,Jd,kc,hc,Lc);ud.push(kc,Jd,Jd,hc)}}var rc=function(Wb){void 0===Wb&&(Wb=9);this._maxEntries=Math.max(4,Wb);this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries));this.clear()};return rc.prototype.all=function(){return this._all(this.data,[])},rc.prototype.search=function(Wb){var kc=this.data,hc=[];if(!Ob(Wb,kc))return hc;for(var Fc=
this.toBBox,Lc=[];kc;){for(var ud=0;ud<kc.children.length;ud++){var Jd=kc.children[ud],Ee=kc.leaf?Fc(Jd):Jd;Ob(Wb,Ee)&&(kc.leaf?hc.push(Jd):Jb(Wb,Ee)?this._all(Jd,hc):Lc.push(Jd))}kc=Lc.pop()}return hc},rc.prototype.collides=function(Wb){var kc=this.data;if(!Ob(Wb,kc))return!1;for(var hc=[];kc;){for(var Fc=0;Fc<kc.children.length;Fc++){var Lc=kc.children[Fc],ud=kc.leaf?this.toBBox(Lc):Lc;if(Ob(Wb,ud)){if(kc.leaf||Jb(Wb,ud))return!0;hc.push(Lc)}}kc=hc.pop()}return!1},rc.prototype.load=function(Wb){if(!Wb||
!Wb.length)return this;if(Wb.length<this._minEntries){for(var kc=0;kc<Wb.length;kc++)this.insert(Wb[kc]);return this}Wb=this._build(Wb.slice(),0,Wb.length-1,0);this.data.children.length?this.data.height===Wb.height?this._splitRoot(this.data,Wb):(this.data.height<Wb.height&&(kc=this.data,this.data=Wb,Wb=kc),this._insert(Wb,this.data.height-Wb.height-1,!0)):this.data=Wb;return this},rc.prototype.insert=function(Wb){return Wb&&this._insert(Wb,this.data.height-1),this},rc.prototype.clear=function(){return this.data=
Lb([]),this},rc.prototype.remove=function(Wb,kc){if(!Wb)return this;for(var hc,Fc,Lc,ud=this.data,Jd=this.toBBox(Wb),Ee=[],Sd=[];ud||Ee.length;){if(ud||(ud=Ee.pop(),Fc=Ee[Ee.length-1],hc=Sd.pop(),Lc=!0),ud.leaf){a:{var De=Wb;var gf=ud.children,Te=kc;if(Te){for(var df=0;df<gf.length;df++)if(Te(De,gf[df])){De=df;break a}De=-1}else De=gf.indexOf(De)}if(-1!==De)return ud.children.splice(De,1),Ee.push(ud),this._condense(Ee),this}Lc||ud.leaf||!Jb(ud,Jd)?Fc?(hc++,ud=Fc.children[hc],Lc=!1):ud=null:(Ee.push(ud),
Sd.push(hc),hc=0,Fc=ud,ud=ud.children[0])}return this},rc.prototype.toBBox=function(Wb){return Wb},rc.prototype.compareMinX=function(Wb,kc){return Wb.minX-kc.minX},rc.prototype.compareMinY=function(Wb,kc){return Wb.minY-kc.minY},rc.prototype.toJSON=function(){return this.data},rc.prototype.fromJSON=function(Wb){return this.data=Wb,this},rc.prototype._all=function(Wb,kc){for(var hc=[];Wb;)Wb.leaf?kc.push.apply(kc,Wb.children):hc.push.apply(hc,Wb.children),Wb=hc.pop();return kc},rc.prototype._build=
function(Wb,kc,hc,Fc){var Lc,ud=hc-kc+1,Jd=this._maxEntries;if(ud<=Jd)return ja(Lc=Lb(Wb.slice(kc,hc+1)),this.toBBox),Lc;Fc||(Fc=Math.ceil(Math.log(ud)/Math.log(Jd)),Jd=Math.ceil(ud/Math.pow(Jd,Fc-1)));(Lc=Lb([])).leaf=!1;Lc.height=Fc;ud=Math.ceil(ud/Jd);Jd=ud*Math.ceil(Math.sqrt(Jd));for(gc(Wb,kc,hc,Jd,this.compareMinX);kc<=hc;kc+=Jd){var Ee=Math.min(kc+Jd-1,hc);gc(Wb,kc,Ee,ud,this.compareMinY);for(var Sd=kc;Sd<=Ee;Sd+=ud)Lc.children.push(this._build(Wb,Sd,Math.min(Sd+ud-1,Ee),Fc-1))}return ja(Lc,
this.toBBox),Lc},rc.prototype._chooseSubtree=function(Wb,kc,hc,Fc){for(;Fc.push(kc),!kc.leaf&&Fc.length-1!==hc;){for(var Lc=1/0,ud=1/0,Jd=void 0,Ee=0;Ee<kc.children.length;Ee++){var Sd=kc.children[Ee],De=gb(Sd),gf=(Te=Wb,df=Sd,(Math.max(df.maxX,Te.maxX)-Math.min(df.minX,Te.minX))*(Math.max(df.maxY,Te.maxY)-Math.min(df.minY,Te.minY))-De);gf<ud?(ud=gf,Lc=De<Lc?De:Lc,Jd=Sd):gf===ud&&De<Lc&&(Lc=De,Jd=Sd)}kc=Jd||kc.children[0]}var Te,df;return kc},rc.prototype._insert=function(Wb,kc,hc){hc=hc?Wb:this.toBBox(Wb);
var Fc=[],Lc=this._chooseSubtree(hc,this.data,kc,Fc);Lc.children.push(Wb);for(Ka(Lc,hc);0<=kc&&Fc[kc].children.length>this._maxEntries;)this._split(Fc,kc),kc--;this._adjustParentBBoxes(hc,Fc,kc)},rc.prototype._split=function(Wb,kc){var hc=Wb[kc],Fc=hc.children.length,Lc=this._minEntries;this._chooseSplitAxis(hc,Lc,Fc);Fc=this._chooseSplitIndex(hc,Lc,Fc);Fc=Lb(hc.children.splice(Fc,hc.children.length-Fc));Fc.height=hc.height;Fc.leaf=hc.leaf;ja(hc,this.toBBox);ja(Fc,this.toBBox);kc?Wb[kc-1].children.push(Fc):
this._splitRoot(hc,Fc)},rc.prototype._splitRoot=function(Wb,kc){this.data=Lb([Wb,kc]);this.data.height=Wb.height+1;this.data.leaf=!1;ja(this.data,this.toBBox)},rc.prototype._chooseSplitIndex=function(Wb,kc,hc){for(var Fc,Lc,ud,Jd,Ee,Sd,De,gf=1/0,Te=1/0,df=kc;df<=hc-kc;df++){var Gd=ra(Wb,0,df,this.toBBox),od=ra(Wb,df,hc,this.toBBox),Dd=(Lc=Gd,ud=od,Jd=void 0,Ee=void 0,Sd=void 0,De=void 0,Jd=Math.max(Lc.minX,ud.minX),Ee=Math.max(Lc.minY,ud.minY),Sd=Math.min(Lc.maxX,ud.maxX),De=Math.min(Lc.maxY,ud.maxY),
Math.max(0,Sd-Jd)*Math.max(0,De-Ee));Gd=gb(Gd)+gb(od);Dd<gf?(gf=Dd,Fc=df,Te=Gd<Te?Gd:Te):Dd===gf&&Gd<Te&&(Te=Gd,Fc=df)}return Fc||hc-kc},rc.prototype._chooseSplitAxis=function(Wb,kc,hc){var Fc=Wb.leaf?this.compareMinX:Sa,Lc=Wb.leaf?this.compareMinY:bb;this._allDistMargin(Wb,kc,hc,Fc)<this._allDistMargin(Wb,kc,hc,Lc)&&Wb.children.sort(Fc)},rc.prototype._allDistMargin=function(Wb,kc,hc,Fc){Wb.children.sort(Fc);Fc=this.toBBox;for(var Lc=ra(Wb,0,kc,Fc),ud=ra(Wb,hc-kc,hc,Fc),Jd=jb(Lc)+jb(ud),Ee=kc;Ee<
hc-kc;Ee++){var Sd=Wb.children[Ee];Ka(Lc,Wb.leaf?Fc(Sd):Sd);Jd+=jb(Lc)}for(hc=hc-kc-1;hc>=kc;hc--)Lc=Wb.children[hc],Ka(ud,Wb.leaf?Fc(Lc):Lc),Jd+=jb(ud);return Jd},rc.prototype._adjustParentBBoxes=function(Wb,kc,hc){for(;0<=hc;hc--)Ka(kc[hc],Wb)},rc.prototype._condense=function(Wb){for(var kc=Wb.length-1,hc=void 0;0<=kc;kc--)0===Wb[kc].children.length?0<kc?(hc=Wb[kc-1].children).splice(hc.indexOf(Wb[kc]),1):this.clear():ja(Wb[kc],this.toBBox)},rc})}}),AD=cr({["../../node_modules/fast-deep-equal/index.js"](a,
d){d.exports=function ja(K,da){if(K===da)return!0;if(K&&da&&"object"==typeof K&&"object"==typeof da){if(K.constructor!==da.constructor)return!1;var ra;if(Array.isArray(K)){var Ka=K.length;if(Ka!=da.length)return!1;for(ra=Ka;0!==ra--;)if(!ja(K[ra],da[ra]))return!1;return!0}if(K.constructor===RegExp)return K.source===da.source&&K.flags===da.flags;if(K.valueOf!==Object.prototype.valueOf)return K.valueOf()===da.valueOf();if(K.toString!==Object.prototype.toString)return K.toString()===da.toString();var Sa=
Object.keys(K);Ka=Sa.length;if(Ka!==Object.keys(da).length)return!1;for(ra=Ka;0!==ra--;)if(!Object.prototype.hasOwnProperty.call(da,Sa[ra]))return!1;for(ra=Ka;0!==ra--;)if(Ka=Sa[ra],!ja(K[Ka],da[Ka]))return!1;return!0}return K!==K&&da!==da}}}),BD=cr({["../../../node_modules/deepmerge/dist/cjs.js"](a,d){function l(jb,Jb){return!1!==Jb.clone&&Jb.isMergeableObject(jb)?Sa(Array.isArray(jb)?[]:{},jb,Jb):jb}function K(jb,Jb,Ob){return jb.concat(Jb).map(function(Lb){return l(Lb,Ob)})}function da(jb){return Object.getOwnPropertySymbols?
Object.getOwnPropertySymbols(jb).filter(function(Jb){return Object.propertyIsEnumerable.call(jb,Jb)}):[]}function ja(jb){return Object.keys(jb).concat(da(jb))}function ra(jb,Jb){try{return Jb in jb}catch(Ob){return!1}}function Ka(jb,Jb,Ob){var Lb={};Ob.isMergeableObject(jb)&&ja(jb).forEach(function(gc){Lb[gc]=l(jb[gc],Ob)});ja(Jb).forEach(function(gc){if(!ra(jb,gc)||Object.hasOwnProperty.call(jb,gc)&&Object.propertyIsEnumerable.call(jb,gc))if(ra(jb,gc)&&Ob.isMergeableObject(Jb[gc])){if(Ob.customMerge){var rc=
Ob.customMerge(gc);rc="function"===typeof rc?rc:Sa}else rc=Sa;Lb[gc]=rc(jb[gc],Jb[gc],Ob)}else Lb[gc]=l(Jb[gc],Ob)});return Lb}function Sa(jb,Jb,Ob){Ob=Ob||{};Ob.arrayMerge=Ob.arrayMerge||K;Ob.isMergeableObject=Ob.isMergeableObject||bb;Ob.cloneUnlessOtherwiseSpecified=l;var Lb=Array.isArray(Jb),gc=Array.isArray(jb);return Lb!==gc?l(Jb,Ob):Lb?Ob.arrayMerge(jb,Jb,Ob):Ka(jb,Jb,Ob)}var bb=function(jb){var Jb;if(Jb=!!jb&&"object"===typeof jb)Jb=Object.prototype.toString.call(jb),Jb=!("[object RegExp]"===
Jb||"[object Date]"===Jb||jb.$$typeof===gb);return Jb},gb="function"===typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;Sa.all=function(jb,Jb){if(!Array.isArray(jb))throw Error("first argument should be an array");return jb.reduce(function(Ob,Lb){return Sa(Ob,Lb,Jb)},{})};d.exports=Sa}}),CD=cr({["../../node_modules/tslib/tslib.js"](a,d){var l,K,da,ja,ra,Ka,Sa,bb,gb,jb,Jb,Ob,Lb,gc,rc,Wb,kc,hc,Fc,Lc,ud,Jd,Ee,Sd,De;(function(gf){function Te(Gd,od){Gd!==df&&("function"===typeof Object.create?
Object.defineProperty(Gd,"__esModule",{value:!0}):Gd.__esModule=!0);return function(Dd,jd){return Gd[Dd]=od?od(Dd,jd):jd}}var df="object"===typeof wa?wa:"object"===typeof self?self:"object"===typeof this?this:{};"function"===typeof define&&define.amd?define("tslib",["exports"],function(Gd){gf(Te(df,Te(Gd)))}):"object"===typeof d&&"object"===typeof d.exports?gf(Te(df,Te(d.exports))):gf(Te(df))})(function(gf){var Te=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Gd,od){Gd.__proto__=
od}||function(Gd,od){for(var Dd in od)Object.prototype.hasOwnProperty.call(od,Dd)&&(Gd[Dd]=od[Dd])};l=function(Gd,od){function Dd(){this.constructor=Gd}if("function"!==typeof od&&null!==od)throw new TypeError("Class extends value "+String(od)+" is not a constructor or null");Te(Gd,od);Gd.prototype=null===od?Object.create(od):(Dd.prototype=od.prototype,new Dd)};K=Object.assign||function(Gd){for(var od,Dd=1,jd=arguments.length;Dd<jd;Dd++){od=arguments[Dd];for(var Cd in od)Object.prototype.hasOwnProperty.call(od,
Cd)&&(Gd[Cd]=od[Cd])}return Gd};da=function(Gd,od){var Dd={},jd;for(jd in Gd)Object.prototype.hasOwnProperty.call(Gd,jd)&&0>od.indexOf(jd)&&(Dd[jd]=Gd[jd]);if(null!=Gd&&"function"===typeof Object.getOwnPropertySymbols){var Cd=0;for(jd=Object.getOwnPropertySymbols(Gd);Cd<jd.length;Cd++)0>od.indexOf(jd[Cd])&&Object.prototype.propertyIsEnumerable.call(Gd,jd[Cd])&&(Dd[jd[Cd]]=Gd[jd[Cd]])}return Dd};ja=function(Gd,od,Dd,jd){var Cd=arguments.length,Me=3>Cd?od:null===jd?jd=Object.getOwnPropertyDescriptor(od,
Dd):jd,af;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)Me=Reflect.decorate(Gd,od,Dd,jd);else for(var Nf=Gd.length-1;0<=Nf;Nf--)if(af=Gd[Nf])Me=(3>Cd?af(Me):3<Cd?af(od,Dd,Me):af(od,Dd))||Me;return 3<Cd&&Me&&Object.defineProperty(od,Dd,Me),Me};ra=function(Gd,od){return function(Dd,jd){od(Dd,jd,Gd)}};Ka=function(Gd,od){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(Gd,od)};Sa=function(Gd,od,Dd,jd){function Cd(Me){return Me instanceof Dd?
Me:new Dd(function(af){af(Me)})}return new (Dd||=Promise)(function(Me,af){function Nf(Eg){try{ef(jd.next(Eg))}catch(yf){af(yf)}}function bg(Eg){try{ef(jd["throw"](Eg))}catch(yf){af(yf)}}function ef(Eg){Eg.done?Me(Eg.value):Cd(Eg.value).then(Nf,bg)}ef((jd=jd.apply(Gd,od||[])).next())})};bb=function(Gd,od){function Dd(ef){return function(Eg){return jd([ef,Eg])}}function jd(ef){if(Me)throw new TypeError("Generator is already executing.");for(;Cd;)try{if(Me=1,af&&(Nf=ef[0]&2?af["return"]:ef[0]?af["throw"]||
((Nf=af["return"])&&Nf.call(af),0):af.next)&&!(Nf=Nf.call(af,ef[1])).done)return Nf;if(af=0,Nf)ef=[ef[0]&2,Nf.value];switch(ef[0]){case 0:case 1:Nf=ef;break;case 4:return Cd.label++,{value:ef[1],done:!1};case 5:Cd.label++;af=ef[1];ef=[0];continue;case 7:ef=Cd.ops.pop();Cd.trys.pop();continue;default:if(!(Nf=Cd.trys,Nf=0<Nf.length&&Nf[Nf.length-1])&&(6===ef[0]||2===ef[0])){Cd=0;continue}if(3===ef[0]&&(!Nf||ef[1]>Nf[0]&&ef[1]<Nf[3]))Cd.label=ef[1];else if(6===ef[0]&&Cd.label<Nf[1])Cd.label=Nf[1],Nf=
ef;else if(Nf&&Cd.label<Nf[2])Cd.label=Nf[2],Cd.ops.push(ef);else{Nf[2]&&Cd.ops.pop();Cd.trys.pop();continue}}ef=od.call(Gd,Cd)}catch(Eg){ef=[6,Eg],af=0}finally{Me=Nf=0}if(ef[0]&5)throw ef[1];return{value:ef[0]?ef[1]:void 0,done:!0}}var Cd={label:0,sent:function(){if(Nf[0]&1)throw Nf[1];return Nf[1]},trys:[],ops:[]},Me,af,Nf,bg;return bg={next:Dd(0),"throw":Dd(1),"return":Dd(2)},"function"===typeof Symbol&&(bg[Symbol.iterator]=function(){return this}),bg};gb=function(Gd,od){for(var Dd in Gd)"default"===
Dd||Object.prototype.hasOwnProperty.call(od,Dd)||De(od,Gd,Dd)};De=Object.create?function(Gd,od,Dd,jd){void 0===jd&&(jd=Dd);var Cd=Object.getOwnPropertyDescriptor(od,Dd);if(!Cd||("get"in Cd?!od.__esModule:Cd.writable||Cd.configurable))Cd={enumerable:!0,get:function(){return od[Dd]}};Object.defineProperty(Gd,jd,Cd)}:function(Gd,od,Dd,jd){void 0===jd&&(jd=Dd);Gd[jd]=od[Dd]};jb=function(Gd){var od="function"===typeof Symbol&&Symbol.iterator,Dd=od&&Gd[od],jd=0;if(Dd)return Dd.call(Gd);if(Gd&&"number"===
typeof Gd.length)return{next:function(){Gd&&jd>=Gd.length&&(Gd=void 0);return{value:Gd&&Gd[jd++],done:!Gd}}};throw new TypeError(od?"Object is not iterable.":"Symbol.iterator is not defined.");};Jb=function(Gd,od){var Dd="function"===typeof Symbol&&Gd[Symbol.iterator];if(!Dd)return Gd;Gd=Dd.call(Gd);var jd,Cd=[];try{for(;(void 0===od||0<od--)&&!(jd=Gd.next()).done;)Cd.push(jd.value)}catch(af){var Me={error:af}}finally{try{jd&&!jd.done&&(Dd=Gd["return"])&&Dd.call(Gd)}finally{if(Me)throw Me.error;}}return Cd};
Ob=function(){for(var Gd=[],od=0;od<arguments.length;od++)Gd=Gd.concat(Jb(arguments[od]));return Gd};Lb=function(){for(var Gd=0,od=0,Dd=arguments.length;od<Dd;od++)Gd+=arguments[od].length;Gd=Array(Gd);var jd=0;for(od=0;od<Dd;od++)for(var Cd=arguments[od],Me=0,af=Cd.length;Me<af;Me++,jd++)Gd[jd]=Cd[Me];return Gd};gc=function(Gd,od,Dd){if(Dd||2===arguments.length)for(var jd=0,Cd=od.length,Me;jd<Cd;jd++)!Me&&jd in od||(Me||=Array.prototype.slice.call(od,0,jd),Me[jd]=od[jd]);return Gd.concat(Me||Array.prototype.slice.call(od))};
rc=function(Gd){return this instanceof rc?(this.v=Gd,this):new rc(Gd)};Wb=function(Gd,od,Dd){function jd(yf){bg[yf]&&(ef[yf]=function(Fg){return new Promise(function(Gg,Bi){1<Eg.push([yf,Fg,Gg,Bi])||Cd(yf,Fg)})})}function Cd(yf,Fg){try{var Gg=bg[yf](Fg);Gg.value instanceof rc?Promise.resolve(Gg.value.v).then(Me,af):Nf(Eg[0][2],Gg)}catch(Bi){Nf(Eg[0][3],Bi)}}function Me(yf){Cd("next",yf)}function af(yf){Cd("throw",yf)}function Nf(yf,Fg){(yf(Fg),Eg.shift(),Eg.length)&&Cd(Eg[0][0],Eg[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");
var bg=Dd.apply(Gd,od||[]),ef,Eg=[];return ef={},jd("next"),jd("throw"),jd("return"),ef[Symbol.asyncIterator]=function(){return this},ef};kc=function(Gd){function od(Cd,Me){Dd[Cd]=Gd[Cd]?function(af){return(jd=!jd)?{value:rc(Gd[Cd](af)),done:"return"===Cd}:Me?Me(af):af}:Me}var Dd,jd;return Dd={},od("next"),od("throw",function(Cd){throw Cd;}),od("return"),Dd[Symbol.iterator]=function(){return this},Dd};hc=function(Gd){function od(Me){Cd[Me]=Gd[Me]&&function(af){return new Promise(function(Nf,bg){af=
Gd[Me](af);Dd(Nf,bg,af.done,af.value)})}}function Dd(Me,af,Nf,bg){Promise.resolve(bg).then(function(ef){Me({value:ef,done:Nf})},af)}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var jd=Gd[Symbol.asyncIterator],Cd;return jd?jd.call(Gd):(Gd="function"===typeof jb?jb(Gd):Gd[Symbol.iterator](),Cd={},od("next"),od("throw"),od("return"),Cd[Symbol.asyncIterator]=function(){return this},Cd)};Fc=function(Gd,od){Object.defineProperty?Object.defineProperty(Gd,"raw",{value:od}):
Gd.raw=od;return Gd};var df=Object.create?function(Gd,od){Object.defineProperty(Gd,"default",{enumerable:!0,value:od})}:function(Gd,od){Gd["default"]=od};Lc=function(Gd){if(Gd&&Gd.__esModule)return Gd;var od={};if(null!=Gd)for(var Dd in Gd)"default"!==Dd&&Object.prototype.hasOwnProperty.call(Gd,Dd)&&De(od,Gd,Dd);df(od,Gd);return od};ud=function(Gd){return Gd&&Gd.__esModule?Gd:{"default":Gd}};Jd=function(Gd,od,Dd,jd){if("a"===Dd&&!jd)throw new TypeError("Private accessor was defined without a getter");
if("function"===typeof od?Gd!==od||!jd:!od.has(Gd))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===Dd?jd:"a"===Dd?jd.call(Gd):jd?jd.value:od.get(Gd)};Ee=function(Gd,od,Dd,jd,Cd){if("m"===jd)throw new TypeError("Private method is not writable");if("a"===jd&&!Cd)throw new TypeError("Private accessor was defined without a setter");if("function"===typeof od?Gd!==od||!Cd:!od.has(Gd))throw new TypeError("Cannot write private member to an object whose class did not declare it");
return"a"===jd?Cd.call(Gd,Dd):Cd?Cd.value=Dd:od.set(Gd,Dd),Dd};Sd=function(Gd,od){if(null===od||"object"!==typeof od&&"function"!==typeof od)throw new TypeError("Cannot use 'in' operator on non-object");return"function"===typeof Gd?od===Gd:Gd.has(od)};gf("__extends",l);gf("__assign",K);gf("__rest",da);gf("__decorate",ja);gf("__param",ra);gf("__metadata",Ka);gf("__awaiter",Sa);gf("__generator",bb);gf("__exportStar",gb);gf("__createBinding",De);gf("__values",jb);gf("__read",Jb);gf("__spread",Ob);gf("__spreadArrays",
Lb);gf("__spreadArray",gc);gf("__await",rc);gf("__asyncGenerator",Wb);gf("__asyncDelegator",kc);gf("__asyncValues",hc);gf("__makeTemplateObject",Fc);gf("__importStar",Lc);gf("__importDefault",ud);gf("__classPrivateFieldGet",Jd);gf("__classPrivateFieldSet",Ee);gf("__classPrivateFieldIn",Sd)})}}),Xy={};((a,d)=>{for(var l in d)Ff(a,l,{get:d[l],enumerable:!0})})(Xy,{App:()=>Cp,PreviewManager:()=>nh,generateJSXFromModel:()=>Hw,generateSVGFromModel:()=>Gw});Pa.exports=(a=>Wy(Ff({},"__esModule",{value:!0}),
a))(Xy);var Iw=(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})(Iw||{}),as=(a=>{a.Box="box";a.Ellipse="ellipse";a.Polygon="polygon";return a})(as||{}),Ou,DD=new Uint8Array(16),ED=/^(?:[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,Ll=[];for(let a=0;256>a;++a)Ll.push((a+256).toString(16).slice(1));var Yy,Jw,Kw=0,Lw=0,qk=function(a,d,l){l=d&&l||0;const K=
d||Array(16);a=a||{};let da=a.node||Yy;var ja=void 0!==a.clockseq?a.clockseq:Jw;if(null==da||null==ja){var ra=a.random||(a.rng||w)();null==da&&(da=Yy=[ra[0]|1,ra[1],ra[2],ra[3],ra[4],ra[5]]);null==ja&&(ja=Jw=(ra[6]<<8|ra[7])&16383)}ra=void 0!==a.msecs?a.msecs:Date.now();let Ka=void 0!==a.nsecs?a.nsecs:Lw+1;const Sa=ra-Kw+(Ka-Lw)/1E4;0>Sa&&void 0===a.clockseq&&(ja=ja+1&16383);(0>Sa||ra>Kw)&&void 0===a.nsecs&&(Ka=0);if(1E4<=Ka)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");Kw=ra;Lw=
Ka;Jw=ja;ra+=122192928E5;a=(1E4*(ra&268435455)+Ka)%4294967296;K[l++]=a>>>24&255;K[l++]=a>>>16&255;K[l++]=a>>>8&255;K[l++]=a&255;a=ra/4294967296*1E4&268435455;K[l++]=a>>>8&255;K[l++]=a&255;K[l++]=a>>>24&15|16;K[l++]=a>>>16&255;K[l++]=ja>>>8|128;K[l++]=ja&255;for(ja=0;6>ja;++ja)K[l+ja]=da[ja];return d||Y(K)},mh=class{static clamp(a,d,l){return Math.max(d,"undefined"!==typeof l?Math.min(a,l):a)}static clampV(a,d,l){return a.map(K=>l?mh.clamp(K,d,l):mh.clamp(K,d))}static cross(a,d,l){return(d[0]-a[0])*
(l[1]-a[1])-(l[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]}},yd=mh;yd.neg=a=>[-a[0],-a[1]];yd.add=(a,d)=>[a[0]+d[0],a[1]+d[1]];yd.addScalar=(a,d)=>[a[0]+d,a[1]+d];yd.sub=(a,d)=>[a[0]-d[0],a[1]-d[1]];yd.subScalar=(a,d)=>[a[0]-d,a[1]-d];yd.vec=(a,d)=>[d[0]-a[0],d[1]-a[1]];yd.mul=(a,d)=>[a[0]*d,a[1]*d];yd.mulV=(a,d)=>[a[0]*d[0],a[1]*d[1]];yd.div=(a,d)=>[a[0]/d,a[1]/d];yd.divV=(a,d)=>[a[0]/d[0],a[1]/d[1]];yd.per=a=>[a[1],-a[0]];yd.dpr=(a,d)=>a[0]*d[0]+a[1]*
d[1];yd.cpr=(a,d)=>a[0]*d[1]-d[0]*a[1];yd.len2=a=>a[0]*a[0]+a[1]*a[1];yd.len=a=>Math.hypot(a[0],a[1]);yd.pry=(a,d)=>mh.dpr(a,d)/mh.len(d);yd.uni=a=>mh.div(a,mh.len(a));yd.normalize=a=>mh.uni(a);yd.tangent=(a,d)=>mh.uni(mh.sub(a,d));yd.dist2=(a,d)=>mh.len2(mh.sub(a,d));yd.dist=(a,d)=>Math.hypot(a[1]-d[1],a[0]-d[0]);yd.fastDist=(a,d)=>{a=[d[0]-a[0],d[1]-a[1]];d=[Math.abs(a[0]),Math.abs(a[1])];let l=1/Math.max(d[0],d[1]);l*=1.29289-(d[0]+d[1])*l*.29289;return[a[0]*l,a[1]*l]};yd.ang=(a,d)=>Math.atan2(mh.cpr(a,
d),mh.dpr(a,d));yd.angle=(a,d)=>Math.atan2(d[1]-a[1],d[0]-a[0]);yd.med=(a,d)=>mh.mul(mh.add(a,d),.5);yd.rot=(a,d=0)=>[a[0]*Math.cos(d)-a[1]*Math.sin(d),a[0]*Math.sin(d)+a[1]*Math.cos(d)];yd.rotWith=(a,d,l=0)=>{if(0===l)return a;const K=Math.sin(l);l=Math.cos(l);const da=a[0]-d[0];a=a[1]-d[1];return[da*l-a*K+d[0],da*K+a*l+d[1]]};yd.isEqual=(a,d)=>a[0]===d[0]&&a[1]===d[1];yd.lrp=(a,d,l)=>mh.add(a,mh.mul(mh.sub(d,a),l));yd.int=(a,d,l,K,da=1)=>{l=(mh.clamp(l,K)-l)/(K-l);return mh.add(mh.mul(a,1-l),mh.mul(d,
da))};yd.ang3=(a,d,l)=>{a=mh.vec(d,a);d=mh.vec(d,l);return mh.ang(a,d)};yd.abs=a=>[Math.abs(a[0]),Math.abs(a[1])];yd.rescale=(a,d)=>{const l=mh.len(a);return[d*a[0]/l,d*a[1]/l]};yd.isLeft=(a,d,l)=>(d[0]-a[0])*(l[1]-a[1])-(l[0]-a[0])*(d[1]-a[1]);yd.clockwise=(a,d,l)=>0<mh.isLeft(a,d,l);yd.toFixed=a=>a.map(d=>Math.round(100*d)/100);yd.nearestPointOnLineThroughPoint=(a,d,l)=>mh.add(a,mh.mul(d,mh.pry(mh.sub(l,a),d)));yd.distanceToLineThroughPoint=(a,d,l)=>mh.dist(l,mh.nearestPointOnLineThroughPoint(a,
d,l));yd.nearestPointOnLineSegment=(a,d,l,K=!0)=>{const da=mh.uni(mh.sub(d,a));l=mh.add(a,mh.mul(da,mh.pry(mh.sub(l,a),da)));if(K){if(l[0]<Math.min(a[0],d[0]))return a[0]<d[0]?a:d;if(l[0]>Math.max(a[0],d[0]))return a[0]>d[0]?a:d;if(l[1]<Math.min(a[1],d[1]))return a[1]<d[1]?a:d;if(l[1]>Math.max(a[1],d[1]))return a[1]>d[1]?a:d}return l};yd.distanceToLineSegment=(a,d,l,K=!0)=>mh.dist(l,mh.nearestPointOnLineSegment(a,d,l,K));yd.nudge=(a,d,l)=>mh.isEqual(a,d)?a:mh.add(a,mh.mul(mh.uni(mh.sub(d,a)),l));
yd.nudgeAtAngle=(a,d,l)=>[Math.cos(d)*l+a[0],Math.sin(d)*l+a[1]];yd.toPrecision=(a,d=4)=>[+a[0].toPrecision(d),+a[1].toPrecision(d)];yd.pointsBetween=(a,d,l=6)=>Array.from(Array(l)).map((K,da)=>{K=da/(l-1);da=Math.min(1,.5+Math.abs(.5-K));return[...mh.lrp(a,d,K),da]});yd.slope=(a,d)=>a[0]===d[0]?NaN:(a[1]-d[1])/(a[0]-d[0]);yd.toAngle=a=>{a=Math.atan2(a[1],a[0]);return 0>a?a+2*Math.PI:a};yd.max=(...a)=>[Math.max(...a.map(d=>d[0])),Math.max(...a.map(d=>d[1]))];yd.min=(...a)=>[Math.min(...a.map(d=>d[0])),
Math.min(...a.map(d=>d[1]))];var be=yd,sf=class{static getRectangleSides(a,d,l=0){const K=[a[0]+d[0]/2,a[1]+d[1]/2],da=yd.rotWith(a,K,l),ja=yd.rotWith(yd.add(a,[d[0],0]),K,l),ra=yd.rotWith(yd.add(a,d),K,l);a=yd.rotWith(yd.add(a,[0,d[1]]),K,l);return[["top",[da,ja]],["right",[ja,ra]],["bottom",[ra,a]],["left",[a,da]]]}static getBoundsSides(a){return sf.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 sf.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 l=Infinity,K=Infinity,da=
-Infinity,ja=-Infinity;if(2>a.length)K=l=0,ja=da=1;else for(const ra of a)l=Math.min(ra[0],l),K=Math.min(ra[1],K),da=Math.max(ra[0],da),ja=Math.max(ra[1],ja);return 0!==d?sf.getBoundsFromPoints(a.map(ra=>yd.rotWith(ra,[(l+da)/2,(K+ja)/2],d))):{minX:l,minY:K,maxX:da,maxY:ja,width:Math.max(1,da-l),height:Math.max(1,ja-K)}}static centerBounds(a,d){const l=sf.getBoundsCenter(a);return sf.translateBounds(a,[d[0]-l[0],d[1]-l[1]])}static snapBoundsToGrid(a,d){const l=Math.round(a.minX/d)*d,K=Math.round(a.minY/
d)*d,da=Math.round(a.maxX/d)*d;a=Math.round(a.maxY/d)*d;return{minX:l,minY:K,maxX:da,maxY:a,width:Math.max(1,da-l),height:Math.max(1,a-K)}}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 l=sf.getBoundsCenter(a);return sf.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},[l[0]*d,l[1]*d])}static divideBounds(a,d){const l=sf.getBoundsCenter(a);
return sf.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},[l[0]/d,l[1]/d])}static getRotatedBounds(a,d=0){a=sf.getRotatedCorners(a,d);let l=d=Infinity,K=-Infinity,da=-Infinity;for(const ja of a)d=Math.min(ja[0],d),l=Math.min(ja[1],l),K=Math.max(ja[0],K),da=Math.max(ja[1],da);return{minX:d,minY:l,maxX:K,maxY:da,width:Math.max(1,K-d),height:Math.max(1,da-l),rotation:0}}static getRotatedEllipseBounds(a,d,l,K,da=0){var ja=Math.cos(da);const ra=
Math.sin(da);da=Math.hypot(l*ja,K*ra);ja=Math.hypot(l*ra,K*ja);return{minX:a+l-da,minY:d+K-ja,maxX:a+l+da,maxY:d+K+ja,width:2*da,height:2*ja}}static getExpandedBounds(a,d){const l=Math.min(a.minX,d.minX),K=Math.min(a.minY,d.minY),da=Math.max(a.maxX,d.maxX);a=Math.max(a.maxY,d.maxY);return{minX:l,minY:K,maxX:da,maxY:a,width:Math.abs(da-l),height:Math.abs(a-K)}}static getCommonBounds(a){if(2>a.length)return a[0];let d=a[0];for(let l=1;l<a.length;l++)d=sf.getExpandedBounds(d,a[l]);return d}static getRotatedCorners(a,
d=0){const l=[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(K=>yd.rotWith(K,l,d)):a}static getTransformedBoundingBox(a,d,l,K=0,da=!1){const [ja,ra]=[a.minX,a.minY],[Ka,Sa]=[a.maxX,a.maxY];let [bb,gb]=[a.minX,a.minY],[jb,Jb]=[a.maxX,a.maxY];if("center"===d)return{minX:bb+l[0],minY:gb+l[1],maxX:jb+l[0],maxY:Jb+l[1],width:jb-bb,height:Jb-gb,scaleX:1,scaleY:1};const [Ob,Lb]=yd.rot(l,-K);switch(d){case "top_edge":case "top_left_corner":case "top_right_corner":gb+=
Lb;break;case "bottom_edge":case "bottom_left_corner":case "bottom_right_corner":Jb+=Lb}switch(d){case "left_edge":case "top_left_corner":case "bottom_left_corner":bb+=Ob;break;case "right_edge":case "top_right_corner":case "bottom_right_corner":jb+=Ob}var gc=Ka-ja;const rc=Sa-ra;var Wb=(jb-bb)/gc,kc=(Jb-gb)/rc;a=0>Wb;l=0>kc;var hc=Math.abs(jb-bb),Fc=Math.abs(Jb-gb);if(da)switch(da=gc/rc,gc=da<hc/Fc,kc=1/da*(0>kc?1:-1)*hc,Wb=Fc*(0>Wb?1:-1)*da,d){case "top_left_corner":gc?gb=Jb+kc:bb=jb+Wb;break;case "top_right_corner":gc?
gb=Jb+kc:jb=bb-Wb;break;case "bottom_right_corner":gc?Jb=gb-kc:jb=bb-Wb;break;case "bottom_left_corner":gc?Jb=gb-kc:bb=jb+Wb;break;case "bottom_edge":case "top_edge":hc=(bb+jb)/2;Fc*=da;bb=hc-Fc/2;jb=hc+Fc/2;break;case "left_edge":case "right_edge":Fc=(gb+Jb)/2,hc/=da,gb=Fc-hc/2,Jb=Fc+hc/2}if(0!==K%(2*Math.PI)){hc=[0,0];Fc=yd.med([ja,ra],[Ka,Sa]);Wb=yd.med([bb,gb],[jb,Jb]);switch(d){case "top_left_corner":hc=yd.sub(yd.rotWith([jb,Jb],Wb,K),yd.rotWith([Ka,Sa],Fc,K));break;case "top_right_corner":hc=
yd.sub(yd.rotWith([bb,Jb],Wb,K),yd.rotWith([ja,Sa],Fc,K));break;case "bottom_right_corner":hc=yd.sub(yd.rotWith([bb,gb],Wb,K),yd.rotWith([ja,ra],Fc,K));break;case "bottom_left_corner":hc=yd.sub(yd.rotWith([jb,gb],Wb,K),yd.rotWith([Ka,ra],Fc,K));break;case "top_edge":hc=yd.sub(yd.rotWith(yd.med([bb,Jb],[jb,Jb]),Wb,K),yd.rotWith(yd.med([ja,Sa],[Ka,Sa]),Fc,K));break;case "left_edge":hc=yd.sub(yd.rotWith(yd.med([jb,gb],[jb,Jb]),Wb,K),yd.rotWith(yd.med([Ka,ra],[Ka,Sa]),Fc,K));break;case "bottom_edge":hc=
yd.sub(yd.rotWith(yd.med([bb,gb],[jb,gb]),Wb,K),yd.rotWith(yd.med([ja,ra],[Ka,ra]),Fc,K));break;case "right_edge":hc=yd.sub(yd.rotWith(yd.med([bb,gb],[bb,Jb]),Wb,K),yd.rotWith(yd.med([ja,ra],[ja,Sa]),Fc,K))}[bb,gb]=yd.sub([bb,gb],hc);[jb,Jb]=yd.sub([jb,Jb],hc)}jb<bb&&([jb,bb]=[bb,jb]);Jb<gb&&([Jb,gb]=[gb,Jb]);return{minX:bb,minY:gb,maxX:jb,maxY:Jb,width:jb-bb,height:Jb-gb,scaleX:(jb-bb)/(Ka-ja||1)*(a?-1:1),scaleY:(Jb-gb)/(Sa-ra||1)*(l?-1:1)}}static getTransformAnchor(a,d,l){let K=a;switch(a){case "top_left_corner":K=
d&&l?"bottom_right_corner":d?"top_right_corner":l?"bottom_left_corner":"bottom_right_corner";break;case "top_right_corner":K=d&&l?"bottom_left_corner":d?"top_left_corner":l?"bottom_right_corner":"bottom_left_corner";break;case "bottom_right_corner":K=d&&l?"top_left_corner":d?"bottom_left_corner":l?"top_right_corner":"top_left_corner";break;case "bottom_left_corner":K=d&&l?"top_right_corner":d?"bottom_right_corner":l?"top_left_corner":"top_right_corner"}return K}static getRelativeTransformedBoundingBox(a,
d,l,K,da){K=a.minX+(K?d.maxX-l.maxX:l.minX-d.minX)/d.width*a.width;da=a.minY+(da?d.maxY-l.maxY:l.minY-d.minY)/d.height*a.height;const ja=l.width/d.width*a.width;a=l.height/d.height*a.height;return{minX:K,minY:da,maxX:K+ja,maxY:da+a,width:ja,height:a}}static getRotatedSize(a,d){const l=yd.div(a,2);a=[[0,0],[a[0],0],a,[0,a[1]]].map(K=>yd.rotWith(K,l,d));a=sf.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=
sf.getBoundsCenter(a);return ff(Zd({},a),{midX:d[0],midY:d[1]})}static getCommonTopLeft(a){const d=[Infinity,Infinity];a.forEach(l=>{d[0]=Math.min(d[0],l[0]);d[1]=Math.min(d[1],l[1])});return d}static getTLSnapPoints(a,d,l){const K=Zd({},a);a=[0,0];const da=[],ja={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}},ra=["midX","minX","maxX"],Ka=["midY","minY","maxY"];d=d.map(Jb=>
{const Ob=ra.flatMap((gc,rc)=>ra.map((Wb,kc)=>{const hc=K[gc]-Jb[Wb];return{f:gc,t:Wb,gap:hc,distance:Math.abs(hc),isCareful:0===rc||3===rc+kc}})),Lb=Ka.flatMap((gc,rc)=>Ka.map((Wb,kc)=>{const hc=K[gc]-Jb[Wb];return{f:gc,t:Wb,gap:hc,distance:Math.abs(hc),isCareful:0===rc||3===rc+kc}}));return[Jb,Ob,Lb]});let Sa=Infinity,bb=Infinity,gb=Infinity,jb=Infinity;d.forEach(([,Jb,Ob])=>{Jb.forEach(Lb=>{Lb.distance<l&&Lb.distance<gb&&(gb=Lb.distance,Sa=Lb.gap)});Ob.forEach(Lb=>{Lb.distance<l&&Lb.distance<jb&&
(jb=Lb.distance,bb=Lb.gap)})});d.forEach(([Jb,Ob,Lb])=>{Infinity!==Sa&&Ob.forEach(gc=>{2>Math.abs(gc.gap-Sa)&&(ja[gc.f]=ff(Zd({},ja[gc.f]),{isSnapped:!0,to:Jb[gc.t],B:Jb,distance:gc.distance}))});Infinity!==bb&&Lb.forEach(gc=>{2>Math.abs(gc.gap-bb)&&(ja[gc.f]=ff(Zd({},ja[gc.f]),{isSnapped:!0,to:Jb[gc.t],B:Jb,distance:gc.distance}))})});a[0]=Infinity===Sa?0:Sa;a[1]=Infinity===bb?0:bb;K.minX-=a[0];K.midX-=a[0];K.maxX-=a[0];K.minY-=a[1];K.midY-=a[1];K.maxY-=a[1];ra.forEach(Jb=>{Jb=ja[Jb];if(Jb.isSnapped){var {id:Ob,
B:Lb}=Jb;Jb=K[Ob];da.push("minX"===Ob?[[Jb,K.midY],[Jb,Lb.minY],[Jb,Lb.maxY]]:[[Jb,K.minY],[Jb,K.maxY],[Jb,Lb.minY],[Jb,Lb.maxY]])}});Ka.forEach(Jb=>{Jb=ja[Jb];if(Jb.isSnapped){var {id:Ob,B:Lb}=Jb;Jb=K[Ob];da.push("midY"===Ob?[[K.midX,Jb],[Lb.minX,Jb],[Lb.maxX,Jb]]:[[K.minX,Jb],[K.maxX,Jb],[Lb.minX,Jb],[Lb.maxX,Jb]])}});return{offset:a,snapLines:da}}static ensureRatio(a,d){const {width:l,height:K}=a,da=Zd({},a);l/K<d?(da.width=K*d,da.maxX+=l-a.width):(da.height=l/d,da.maxY+=K-a.height);return da}static getDistributions(a,
d){var l=a.map(ja=>{const ra=ja.getBounds();return{id:ja.id,point:[ra.minX,ra.minY],bounds:ra,center:ja.getCenter()}});a=l.length;var K=sf.getCommonBounds(l.map(({bounds:ja})=>ja));const da=[];switch(d){case "horizontal":d=l.reduce((ja,ra)=>ja+ra.bounds.width,0);if(d>K.width){const ja=l.sort((bb,gb)=>bb.bounds.minX-gb.bounds.minX)[0],ra=l.sort((bb,gb)=>gb.bounds.maxX-bb.bounds.maxX)[0];K=l.filter(bb=>bb!==ja&&bb!==ra).sort((bb,gb)=>bb.center[0]-gb.center[0]);const Ka=(ra.center[0]-ja.center[0])/(a-
1),Sa=ja.center[0]+Ka;K.forEach(({id:bb,point:gb,bounds:jb},Jb)=>{da.push({id:bb,prev:gb,next:[Sa+Ka*Jb-jb.width/2,jb.minY]})})}else{l=l.sort((Ka,Sa)=>Ka.center[0]-Sa.center[0]);let ja=K.minX;const ra=(K.width-d)/(a-1);l.forEach(({id:Ka,point:Sa,bounds:bb})=>{da.push({id:Ka,prev:Sa,next:[ja,bb.minY]});ja+=bb.width+ra})}break;case "vertical":if(d=l.reduce((ja,ra)=>ja+ra.bounds.height,0),d>K.height){const ja=l.sort((bb,gb)=>bb.bounds.minY-gb.bounds.minY)[0],ra=l.sort((bb,gb)=>gb.bounds.maxY-bb.bounds.maxY)[0];
K=l.filter(bb=>bb!==ja&&bb!==ra).sort((bb,gb)=>bb.center[1]-gb.center[1]);const Ka=(ra.center[1]-ja.center[1])/(a-1),Sa=ja.center[1]+Ka;K.forEach(({id:bb,point:gb,bounds:jb},Jb)=>{da.push({id:bb,prev:gb,next:[jb.minX,Sa+Ka*Jb-jb.height/2]})})}else{l=l.sort((Ka,Sa)=>Ka.center[1]-Sa.center[1]);let ja=K.minY;const ra=(K.height-d)/(a-1);l.forEach(({id:Ka,point:Sa,bounds:bb})=>{da.push({id:Ka,prev:Sa,next:[bb.minX,ja]});ja+=bb.height+ra})}}return da}static getPackedDistributions(a){const d=sf.getCommonBounds(a.map(({bounds:da})=>
da)),l=[d.minX,d.minY],K=Object.fromEntries(a.map(da=>[da.id,[da.bounds.minX,da.bounds.minY]]));a=a.filter(da=>{var ja,ra,Ka,Sa;return!((null==(ra=null==(ja=da.props.handles)?void 0:ja.start)?0:ra.bindingId)||(null==(Sa=null==(Ka=da.props.handles)?void 0:Ka.end)?0:Sa.bindingId))}).map(da=>{const ja=da.getBounds();return{id:da.id,w:ja.width+16,h:ja.height+16,x:ja.minX,y:ja.minY}});B(a);return a.map(({id:da,x:ja,y:ra})=>({id:da,prev:K[da],next:[ja+l[0],ra+l[1]]}))}},dr=class{static pointInCircle(a,
d,l){return yd.dist(a,d)<=l}static pointInEllipse(a,d,l,K,da=0){da=da||0;var ja=Math.cos(da);da=Math.sin(da);d=yd.sub(a,d);a=ja*d[0]+da*d[1];ja=da*d[0]-ja*d[1];return 1>=a*a/(l*l)+ja*ja/(K*K)}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 l=0;d.forEach((K,da)=>{da=d[(da+1)%d.length];K[1]<=a[1]?da[1]>a[1]&&0<yd.cross(K,da,a)&&(l+=1):da[1]<=a[1]&&0>yd.cross(K,da,a)&&--l});return 0!==l}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,l=3){for(let K=1;K<d.length;K++)if(yd.distanceToLineSegment(d[K-1],d[K],a)<l)return!0;return!1}static _getSqSegDist(a,d,l){let K=d[0];d=d[1];let da=l[0]-K,ja=l[1]-d;if(0!==da||0!==ja){const ra=((a[0]-K)*da+(a[1]-d)*ja)/(da*da+ja*ja);1<ra?(K=l[0],d=l[1]):0<ra&&(K+=da*ra,d+=ja*ra)}da=a[0]-K;ja=a[1]-d;return da*da+ja*ja}static _simplifyStep(a,d,l,K,da){let ja=K,ra=-1;for(let Ka=d+1;Ka<l;Ka++){const Sa=dr._getSqSegDist(a[Ka],a[d],a[l]);
Sa>ja&&(ra=Ka,ja=Sa)}-1<ra&&ja>K&&(1<ra-d&&dr._simplifyStep(a,d,ra,K,da),da.push(a[ra]),1<l-ra&&dr._simplifyStep(a,ra,l,K,da))}static simplify2(a,d=1){if(2>=a.length)return a;d*=d;var l=a[0],K=a[1];const da=[l];for(let ja=1,ra=a.length;ja<ra;ja++)K=a[ja],(K[0]-l[0])*(K[0]-l[0])+(K[1]-l[1])*(K[1]-l[1])>d&&(da.push(K),l=K);l!==K&&da.push(K);l=da.length-1;K=[da[0]];dr._simplifyStep(da,0,l,d,K);K.push(da[l],a[a.length-1]);return K}static pointNearToPolyline(a,d,l=8){const K=d.length;for(let da=1;da<K;da++)if(yd.distanceToLineSegment(d[da-
1],d[da],a)<l)return!0;return!1}},Fk=dr;hb(Fk,"simplify",(a,d=1)=>{var l=a.length;const K=a[0],da=a[l-1],[ja,ra]=K,[Ka,Sa]=da;if(2<l){let bb=0,gb=0;const jb=yd.len2([Sa-ra,Ka-ja]);for(let Jb=1;Jb<l-1;Jb++){const [Ob,Lb]=a[Jb],gc=Math.pow(Ob*(Sa-ra)+ja*(Lb-Sa)+Ka*(ra-Lb),2)/jb;bb>gc||(bb=gc,gb=Jb)}if(bb>d)return l=dr.simplify(a.slice(0,gb+1),d),a=dr.simplify(a.slice(gb+1),d),l.concat(a.slice(1))}return[K,da]});var Ln=Math.PI,Mo=Ln/2,el=2*Ln,Pu={},Qu={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"},Ml=class{static circleFromThreePoints(a,d,l){const [K,da]=a,[ja,ra]=d,[Ka,Sa]=l;d=K*(ra-Sa)-da*(ja-Ka)+ja*Sa-Ka*ra;a=-((K*K+da*da)*(Sa-ra)+(ja*ja+
ra*ra)*(da-Sa)+(Ka*Ka+Sa*Sa)*(ra-da))/(2*d);d=-((K*K+da*da)*(ja-Ka)+(ja*ja+ra*ra)*(Ka-K)+(Ka*Ka+Sa*Sa)*(K-ja))/(2*d);return[a,d,Math.hypot(a-K,d-da)]}static perimeterOfEllipse(a,d){const l=Math.pow(a-d,2)/Math.pow(a+d,2);return Ln*(a+d)*(1+3*l/(10+Math.sqrt(4-3*l)))}static shortAngleDist(a,d){a=(d-a)%el;return 2*a%el-a}static longAngleDist(a,d){return el-Ml.shortAngleDist(a,d)}static lerpAngles(a,d,l){return a+Ml.shortAngleDist(a,d)*l}static angleDelta(a,d){return Ml.shortAngleDist(a,d)}static getSweep(a,
d,l){return Ml.angleDelta(be.angle(a,d),be.angle(a,l))}static clampRadians(a){return(el+a)%el}static snapAngleToSegments(a,d){d=el/d;a=Math.floor((Ml.clampRadians(a)+d/2)/d)*d%el;a<Ln&&(a+=el);a>Ln&&(a-=el);return a}static isAngleBetween(a,d,l){if(l===a||l===d)return!0;d=(d-a+Mo)%Mo;return d<=Ln!==(l-a+Mo)%Mo>d}static degreesToRadians(a){return a*Ln/180}static radiansToDegrees(a){return 180*a/Ln}static getArcLength(a,d,l,K){a=Ml.getSweep(a,l,K);return a/el*el*d}static getSweepFlag(a,d,l){l=be.angle(a,
l);return 0<(be.angle(a,d)-l+3*Ln)%el-Ln?0:1}static getLargeArcFlag(a,d,l){a=be.angle(l,a);d=(be.angle(l,d)-a+3*Ln)%el-Ln;return Math.abs(d)>Mo?0:1}static getArcDashOffset(a,d,l,K,da){const ja=Ml.getSweepFlag(a,l,K);d=Ml.getArcLength(a,d,l,K);return-(0>ja?d:el*a[2]-d)/2+da}static getEllipseDashOffset(a,d){return-(el*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"}},Rk=class{static getPolygonCentroid(a){var d=
a.map(l=>l[0]);a=a.map(l=>l[1]);d=Math.min(...d)+Math.max(...d);a=Math.min(...a)+Math.max(...a);return[d?d/2:0,a?a/2:0]}};hb(Rk,"getEdges",a=>{const d=a.length;return a.map((l,K)=>[l,a[(K+1)%d]])});hb(Rk,"getEdgeOutwardNormal",(a,d)=>be.per(be.uni(be.sub(d,a))));hb(Rk,"getEdgeInwardNormal",(a,d)=>be.neg(Rk.getEdgeOutwardNormal(a,d)));hb(Rk,"getOffsetEdge",(a,d,l)=>{l=be.mul(be.per(be.uni(be.sub(d,a))),l);return[be.add(a,l),be.add(d,l)]});hb(Rk,"getOffsetEdges",(a,d)=>a.map(([l,K])=>Rk.getOffsetEdge(l,
K,d)));hb(Rk,"getOffsetPolygon",(a,d)=>{if(1>a.length)throw Error("Expected at least one point.");if(1===a.length)return a=a[0],[be.add(a,[-d,-d]),be.add(a,[d,-d]),be.add(a,[d,d]),be.add(a,[-d,d])];if(2===a.length){const [l,K]=a;return[...Rk.getOffsetEdge(l,K,d),...Rk.getOffsetEdge(K,l,d)]}return Rk.getOffsetEdges(Rk.getEdges(a),d).flatMap((l,K,da)=>{{K=da[(K+1)%da.length];const ja=yd.slope(l[0],l[1]);da=yd.slope(K[0],K[1]);ja!==da?Number.isNaN(ja)&&!Number.isNaN(da)?l=[l[0][0],(l[0][0]-K[0][0])*
da+K[0][1]]:Number.isNaN(da)&&!Number.isNaN(ja)?l=[K[0][0],(K[0][0]-l[0][0])*ja+l[0][1]]:(l=(ja*l[0][0]-da*K[0][0]+K[0][1]-l[0][1])/(ja-da),l=[l,da*(l-K[0][0])+K[0][1]]):l=void 0}if(void 0===l)throw Error("Expected an intersection");return l})});hb(Rk,"getPolygonVertices",(a,d,l=0,K=1)=>{a=be.div(a,2);const [da,ja]=[Math.max(1,a[0]-l),Math.max(1,a[1]-l)];l=[];for(let bb=0,gb=el/d;bb<d;bb++){var ra=(-Mo+bb*gb)%el,Ka=(-Mo+(bb+1)*gb)%el;ra=be.add(a,[da*Math.cos(ra),ja*Math.sin(ra)]);Ka=be.add(a,[da*
Math.cos(Ka),ja*Math.sin(Ka)]);var Sa=be.med(ra,Ka);Sa=be.nudge(Sa,a,be.dist(a,Sa)*(1-K));l.push(ra,Sa,Ka)}return l});hb(Rk,"getTriangleVertices",(a,d=0,l=1)=>{const [K,da]=a;var ja=1-l;a=[K/2,d/2];l=[K-d,da-d];d=[d/2,da-d];const ra=Rk.getPolygonCentroid([a,l,d]),Ka=be.med(a,l),Sa=be.med(l,d),bb=be.med(d,a),gb=be.dist(Ka,ra)*ja,jb=be.dist(Sa,ra)*ja;ja*=be.dist(bb,ra);return[a,gb?be.nudge(Ka,ra,gb):Ka,l,jb?be.nudge(Sa,ra,jb):Sa,d,ja?be.nudge(bb,ra,ja):bb]});hb(Rk,"getStarVertices",(a,d,l,K=1)=>{const da=
be.div(d,2),ja=be.mul(da,K/2),ra=el/l/2;return Array.from(Array(2*l)).map((Ka,Sa)=>{Ka=-Mo+Sa*ra;const [bb,gb]=Sa%2?ja:da;return be.add(a,[bb*Math.cos(Ka),gb*Math.sin(Ka)])})});var Mw=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"],l=a.length;for(let K=1;K<l;K++){const [da,ja]=a[K],[ra,Ka]=a[(K+1)%l];d.push(da,ja,(da+ra)/2,(ja+Ka)/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"],l=a.length;for(let K=1;K<l-1;K++){const [da,ja]=a[K],[ra,Ka]=a[K+1];d.push(da,ja,(da+ra)/2,(ja+Ka)/2)}return d.join(" ")}static getSvgPathFromStroke(a,d=!0){const l=a.length;if(4>l)return"";let K=a[0],da=a[1];var ja=a[2];ja=`M${K[0].toFixed(2)},${K[1].toFixed(2)} Q${da[0].toFixed(2)},${da[1].toFixed(2)} ${((da[0]+ja[0])/2).toFixed(2)},${((da[1]+ja[1])/2).toFixed(2)} T`;for(let ra=2,Ka=l-1;ra<
Ka;ra++)K=a[ra],da=a[ra+1],ja+=`${((K[0]+da[0])/2).toFixed(2)},${((K[1]+da[1])/2).toFixed(2)} `;d&&(ja+="Z");return ja}static getSvgPathFromStrokePoints(a,d=!1){const l=a.length;if(4>l)return"";let K=a[0].point,da=a[1].point;var ja=a[2].point;ja=`M${K[0].toFixed(2)},${K[1].toFixed(2)} Q${da[0].toFixed(2)},${da[1].toFixed(2)} ${((da[0]+ja[0])/2).toFixed(2)},${((da[1]+ja[1])/2).toFixed(2)} T`;for(let ra=2,Ka=l-1;ra<Ka;ra++)K=a[ra].point,da=a[ra+1].point,ja+=`${((K[0]+da[0])/2).toFixed(2)},${((K[1]+
da[1])/2).toFixed(2)} `;d&&(ja+="Z");return ja}};hb(Mw,"TRIM_NUMBERS",/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g);var FD={},GD=Object.assign,Ru=Object.getOwnPropertyDescriptor,jp=Object.defineProperty,pt=Object.prototype,Nw=[];Object.freeze(Nw);var Ow={};Object.freeze(Ow);var HD="undefined"!==typeof Proxy,ID=Object.toString(),bs=function(){},Zy="undefined"!==typeof Object.getOwnPropertySymbols,Su="undefined"!==typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:Zy?function(a){return Object.getOwnPropertyNames(a).concat(Object.getOwnPropertySymbols(a))}:
Object.getOwnPropertyNames,JD=Object.getOwnPropertyDescriptors||function(a){var d={};Su(a).forEach(function(l){d[l]=Ru(a,l)});return d},ko=Symbol("mobx-stored-annotations"),ih=Symbol("mobx administration"),qt=function(){function a(l){void 0===l&&(l="Atom");this.name_=void 0;this.isBeingObserved_=this.isPendingUnobservation_=!1;this.observers_=new Set;this.lastAccessedBy_=this.diffValue_=0;this.lowestObserverState_=Ti.NOT_TRACKING_;this.onBUOL=this.onBOL=void 0;this.name_=l}var d=a.prototype;d.onBO=
function(){this.onBOL&&this.onBOL.forEach(function(l){return l()})};d.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(l){return l()})};d.reportObserved=function(){return lb(this)};d.reportChanged=function(){Sc();Db(this);Ib()};d.toString=function(){return this.name_};return a}(),Pw=F("Atom",qt),cs={identity:function(a,d){return a===d},structural:function(a,d){return sa(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 sa(a,d,1)}},KD="override",LD=Wa(),rt={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(rt);var $y=ib("observable"),MD=ib("observable.ref",{enhancer:La}),ND=ib("observable.shallow",{enhancer:function(a,d,l){if(void 0===a||null===a||ve(a)||rd(a)||Vp(a)||gr(a))return a;if(Array.isArray(a))return yg.array(a,{name:l,deep:!1});if(L(a))return yg.object(a,void 0,{name:l,deep:!1});if(N(a))return yg.map(a,{name:l,deep:!1});if(M(a))return yg.set(a,{name:l,deep:!1})}}),OD=ib("observable.struct",
{enhancer:function(a,d){return sa(a,d)?d:a}}),az=xa($y);Object.assign($a,az);var PD={box:function(a,d){d=d||rt;return new er(a,Ra(d),d.name,!0,d.equals)},array:function(a,d){d=d||rt;return(!1===Af.useProxies||!1===d.proxy?Ab:kb)(a,Ra(d),d.name)},map:function(a,d){d=d||rt;return new kz(a,Ra(d),d.name)},set:function(a,d){d=d||rt;return new lz(a,Ra(d),d.name)},object:function(a,d,l){if(!1===Af.useProxies||!1===(null==l?void 0:l.proxy))l=Hd({},l);else{var K={},da,ja;C();K=Hd(K,l);l=null!=(ja=(da=K[ih]).proxy_)?
ja:da.proxy_=new Proxy(K,dE)}return je(l,a,d)},ref:xa(MD),shallow:xa(ND),deep:az,struct:xa(OD)},yg=GD($a,PD),bz=Ta("computed"),QD=Ta("computed.struct",{equals:cs.structural}),Dg=function(a,d){if(H(d))return Ha(a,d,bz);if(L(a))return xa(Ta("computed",a));d=L(d)?d:{};d.get=a;d.name||(d.name=a.name||"");return new st(d)};Object.assign(Dg,bz);Dg.struct=xa(QD);var cz,dz,Tu=0,RD=1,SD=null!=(cz=null==(dz=Ru(function(){},"name"))?void 0:dz.configurable)?cz:!1,ez={value:"action",configurable:!0,writable:!1,
enumerable:!1};var TD=Symbol.toPrimitive;var er=function(a){function d(K,da,ja,ra,Ka){void 0===ja&&(ja="ObservableValue");void 0===Ka&&(Ka=cs["default"]);ra=a.call(this,ja)||this;ra.enhancer=void 0;ra.hasUnreportedChange_=!1;ra.interceptors_=void 0;ra.changeListeners_=void 0;ra.value_=void 0;ra.dehancer=void 0;ra.enhancer=da;ra.name_=ja;ra.equals=Ka;ra.value_=da(K,void 0,ja);return ra}fa(d,a);var l=d.prototype;l.dehanceValue=function(K){return void 0!==this.dehancer?this.dehancer(K):K};l.set=function(K){K=
this.prepareNewValue_(K);K!==Af.UNCHANGED&&this.setNewValue_(K)};l.prepareNewValue_=function(K){if(wb(this)){K=Eb(this,{object:this,type:No,newValue:K});if(!K)return Af.UNCHANGED;K=K.newValue}K=this.enhancer(K,this.value_,this.name_);return this.equals(this.value_,K)?Af.UNCHANGED:K};l.setNewValue_=function(K){var da=this.value_;this.value_=K;this.reportChanged();hd(this)&&Td(this,{type:No,object:this,newValue:K,oldValue:da})};l.get=function(){this.reportObserved();return this.dehanceValue(this.value_)};
l.intercept_=function(K){return Bb(this,K)};l.observe_=function(K,da){da&&K({observableKind:"value",debugObjectName:this.name_,object:this,type:No,newValue:this.value_,oldValue:void 0});return Ud(this,K)};l.raw=function(){return this.value_};l.toJSON=function(){return this.get()};l.toString=function(){return this.name_+"["+this.value_+"]"};l.valueOf=function(){return ia(this.get())};l[TD]=function(){return this.valueOf()};return d}(qt),UD=F("ObservableValue",er);var VD=Symbol.toPrimitive;var st=function(){function a(l){this.dependenciesState_=
Ti.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_=Ti.UP_TO_DATE_;this.unboundDepsCount_=0;this.value_=new fr(null);this.triggeredBy_=this.name_=void 0;this.isRunningSetter_=this.isComputing_=!1;this.setter_=this.derivation=void 0;this.isTracing_=ds.NONE;this.onBUOL=this.onBOL=this.keepAlive_=this.requiresReaction_=this.equals_=this.scope_=
void 0;l.get||f(31);this.derivation=l.get;this.name_=l.name||"ComputedValue";l.set&&(this.setter_=Qa("ComputedValue-setter",l.set));this.equals_=l.equals||(l.compareStructural||l.struct?cs.structural:cs["default"]);this.scope_=l.context;this.requiresReaction_=l.requiresReaction;this.keepAlive_=!!l.keepAlive}var d=a.prototype;d.onBecomeStale_=function(){db(this)};d.onBO=function(){this.onBOL&&this.onBOL.forEach(function(l){return l()})};d.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(l){return l()})};
d.get=function(){this.isComputing_&&f(32,this.name_,this.derivation);if(0!==Af.inBatch||0!==this.observers_.size||this.keepAlive_){if(lb(this),mc(this)){var l=Af.trackingContext;this.keepAlive_&&!l&&(Af.trackingContext=this);this.trackAndCompute()&&Gb(this);Af.trackingContext=l}}else mc(this)&&(this.warnAboutUntrackedRead_(),Sc(),this.value_=this.computeValue_(!1),Ib());l=this.value_;if(l instanceof fr)throw l.cause;return l};d.set=function(l){if(this.setter_){this.isRunningSetter_&&f(33,this.name_);
this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,l)}finally{this.isRunningSetter_=!1}}else f(34,this.name_)};d.trackAndCompute=function(){var l=this.value_,K=this.dependenciesState_===Ti.NOT_TRACKING_,da=this.computeValue_(!0);if(l=K||l instanceof fr||da instanceof fr||!this.equals_(l,da))this.value_=da;return l};d.computeValue_=function(l){this.isComputing_=!0;var K=vc(!1);if(l)var da=oc(this,this.derivation,this.scope_);else if(!0===Af.disableErrorBoundaries)da=this.derivation.call(this.scope_);
else try{da=this.derivation.call(this.scope_)}catch(ja){da=new fr(ja)}Af.allowStateChanges=K;this.isComputing_=!1;return da};d.suspend_=function(){this.keepAlive_||(Cc(this),this.value_=void 0)};d.observe_=function(l,K){var da=this,ja=!0,ra=void 0;return ic(function(){var Ka=da.get();if(!ja||K){var Sa=dc();l({observableKind:"computed",debugObjectName:da.name_,type:No,object:da,newValue:Ka,oldValue:ra});Af.trackingDerivation=Sa}ja=!1;ra=Ka})};d.warnAboutUntrackedRead_=function(){};d.toString=function(){return this.name_+
"["+this.derivation.toString()+"]"};d.valueOf=function(){return ia(this.get())};d[VD]=function(){return this.valueOf()};return a}(),tt=F("ComputedValue",st),Ti;(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_"})(Ti||={});var ds;(function(a){a[a.NONE=0]="NONE";a[a.LOG=1]="LOG";a[a.BREAK=2]="BREAK"})(ds||={});var fr=function(a){this.cause=void 0;this.cause=a},Uu=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},Vu=!0,fz=!1,Af=function(){var a=E();0<a.__mobxInstanceCount&&!a.__mobxGlobals&&(Vu=!1);a.__mobxGlobals&&a.__mobxGlobals.version!==(new Uu).version&&(Vu=!1);if(Vu){if(a.__mobxGlobals)return a.__mobxInstanceCount+=1,a.__mobxGlobals.UNCHANGED||(a.__mobxGlobals.UNCHANGED={}),a.__mobxGlobals;a.__mobxInstanceCount=1;return a.__mobxGlobals=new Uu}setTimeout(function(){fz||f(35)},1);return new Uu}(),es=function(){function a(l,K,da,ja){void 0===l&&(l="Reaction");this.requiresObservable_=this.errorHandler_=
this.onInvalidate_=this.name_=void 0;this.observing_=[];this.newObserving_=[];this.dependenciesState_=Ti.NOT_TRACKING_;this.unboundDepsCount_=this.runId_=this.diffValue_=0;this.isRunning_=this.isTrackPending_=this.isScheduled_=this.isDisposed_=!1;this.isTracing_=ds.NONE;this.name_=l;this.onInvalidate_=K;this.errorHandler_=da;this.requiresObservable_=ja}var d=a.prototype;d.onBecomeStale_=function(){this.schedule_()};d.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,Af.pendingReactions.push(this),
0<Af.inBatch||Af.isRunningReactions||Wu(sb))};d.isScheduled=function(){return this.isScheduled_};d.runReaction_=function(){if(!this.isDisposed_){Sc();this.isScheduled_=!1;var l=Af.trackingContext;Af.trackingContext=this;if(mc(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(K){this.reportExceptionInDerivation_(K)}}Af.trackingContext=l;Ib()}};d.track=function(l){if(!this.isDisposed_){Sc();this.isRunning_=!0;var K=Af.trackingContext;Af.trackingContext=this;l=oc(this,l,void 0);Af.trackingContext=
K;this.isTrackPending_=this.isRunning_=!1;this.isDisposed_&&Cc(this);l instanceof fr&&this.reportExceptionInDerivation_(l.cause);Ib()}};d.reportExceptionInDerivation_=function(l){var K=this;if(this.errorHandler_)this.errorHandler_(l,this);else{if(Af.disableErrorBoundaries)throw l;Af.suppressReactionErrors||console.error("[mobx] uncaught error in '"+this+"'",l);Af.globalReactionErrorHandlers.forEach(function(da){return da(l,K)})}};d.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||
(Sc(),Cc(this),Ib()))};d.getDisposer_=function(){var l=this.dispose.bind(this);l[ih]=this;return l};d.toString=function(){return"Reaction["+this.name_+"]"};d.trace=function(l){void 0===l&&(l=!1);Zc(this,l)};return a}(),WD=100,Wu=function(a){return a()},Xu=F("Reaction",es),gz="action",hz=Ba(gz),XD=Ba("action.bound",{bound:!0}),iz=Ba("autoAction",{autoAction:!0}),YD=Ba("autoAction.bound",{autoAction:!0,bound:!0}),jg=Bc(!1);Object.assign(jg,hz);var ut=Bc(!0);Object.assign(ut,iz);jg.bound=xa(XD);ut.bound=
xa(YD);var ZD=function(a){return a()},$D="onBO",aE="onBUO",bE=0;qe.prototype=Object.create(Error.prototype);var jz=ma("flow"),cE=ma("flow.bound",{bound:!0}),vt=Object.assign(function(a,d){if(H(d))return Ha(a,d,jz);var l=a.name||"\x3cunnamed flow\x3e";d=function(){var K=arguments,da=++bE,ja=jg(l+" - runid: "+da+" - init",a).apply(this,K),ra,Ka=void 0;K=new Promise(function(Sa,bb){function gb(Lb){Ka=void 0;try{var gc=jg(l+" - runid: "+da+" - yield "+Ob++,ja.next).call(ja,Lb)}catch(rc){return bb(rc)}Jb(gc)}
function jb(Lb){Ka=void 0;try{var gc=jg(l+" - runid: "+da+" - yield "+Ob++,ja["throw"]).call(ja,Lb)}catch(rc){return bb(rc)}Jb(gc)}function Jb(Lb){if(W(null==Lb?void 0:Lb.then))Lb.then(Jb,bb);else{if(Lb.done)return Sa(Lb.value);Ka=Promise.resolve(Lb.value);return Ka.then(gb,jb)}}var Ob=0;ra=bb;gb(void 0)});K.cancel=jg(l+" - runid: "+da+" - cancel",function(){try{if(Ka){var Sa=Ka;W(Sa.cancel)&&Sa.cancel()}var bb=ja["return"](void 0),gb=Promise.resolve(bb.value);gb.then(bs,bs);W(gb.cancel)&&gb.cancel();
ra(new qe)}catch(jb){ra(jb)}});return K};d.isMobXFlow=!0;return d},jz);vt.bound=xa(cE);var dE={has:function(a,d){return a[ih].has_(d)},get:function(a,d){return a[ih].get_(d)},set:function(a,d,l){var K;return H(d)?null!=(K=a[ih].set_(d,l,!0))?K:!0:!1},deleteProperty:function(a,d){var l;return H(d)?null!=(l=a[ih].delete_(d,!0))?l:!0:!1},defineProperty:function(a,d,l){var K;return null!=(K=a[ih].defineProperty_(d,l))?K:!0},ownKeys:function(a){return a[ih].ownKeys_()},preventExtensions:function(a){f(13)}},
No="update",eE={get:function(a,d){var l=a[ih];return d===ih?l:"length"===d?l.getArrayLength_():"string"!==typeof d||isNaN(d)?U(Yu,d)?Yu[d]:a[d]:l.get_(parseInt(d))},set:function(a,d,l){var K=a[ih];"length"===d&&K.setArrayLength_(l);"symbol"===typeof d||isNaN(d)?a[d]=l:K.set_(parseInt(d),l);return!0},preventExtensions:function(){f(15)}},Qw=function(){function a(l,K,da,ja){void 0===l&&(l="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_=da;this.legacyMode_=ja;this.atom_=new qt(l);this.enhancer_=function(ra,Ka){return K(ra,Ka,"ObservableArray[..]")}}var d=a.prototype;d.dehanceValue_=function(l){return void 0!==this.dehancer?this.dehancer(l):l};d.dehanceValues_=function(l){return void 0!==this.dehancer&&0<l.length?l.map(this.dehancer):l};d.intercept_=function(l){return Bb(this,l)};d.observe_=function(l,K){void 0===K&&(K=!1);K&&l({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 Ud(this,l)};d.getArrayLength_=function(){this.atom_.reportObserved();return this.values_.length};d.setArrayLength_=function(l){("number"!==typeof l||isNaN(l)||0>l)&&f("Out of range: "+l);var K=this.values_.length;if(l!==K)if(l>K){for(var da=Array(l-K),ja=0;ja<l-K;ja++)da[ja]=void 0;this.spliceWithArray_(K,0,da)}else this.spliceWithArray_(l,
K-l)};d.updateArrayLength_=function(l,K){l!==this.lastKnownLength_&&f(16);this.lastKnownLength_+=K;this.legacyMode_&&0<K&&$d(l+K+1)};d.spliceWithArray_=function(l,K,da){var ja=this,ra=this.values_.length;void 0===l?l=0:l>ra?l=ra:0>l&&(l=Math.max(0,ra+l));K=1===arguments.length?ra-l:void 0===K||null===K?0:Math.max(0,Math.min(K,ra-l));void 0===da&&(da=Nw);if(wb(this)){var Ka=Eb(this,{object:this.proxy_,type:"splice",index:l,removedCount:K,added:da});if(!Ka)return Nw;K=Ka.removedCount;da=Ka.added}da=
0===da.length?da:da.map(function(Sa){return ja.enhancer_(Sa,void 0)});this.legacyMode_&&this.updateArrayLength_(ra,da.length-K);ra=this.spliceItemsIntoValues_(l,K,da);0===K&&0===da.length||this.notifyArraySplice_(l,da,ra);return this.dehanceValues_(ra)};d.spliceItemsIntoValues_=function(l,K,da){if(1E4>da.length){var ja;return(ja=this.values_).splice.apply(ja,[l,K].concat(da))}ja=this.values_.slice(l,l+K);var ra=this.values_.slice(l+K);this.values_.length+=da.length-K;for(K=0;K<da.length;K++)this.values_[l+
K]=da[K];for(K=0;K<ra.length;K++)this.values_[l+da.length+K]=ra[K];return ja};d.notifyArrayChildUpdate_=function(l,K,da){var ja=!this.owned_&&!1,ra=hd(this);l=ra||ja?{observableKind:"array",object:this.proxy_,type:No,debugObjectName:this.atom_.name_,index:l,newValue:K,oldValue:da}:null;this.atom_.reportChanged();ra&&Td(this,l)};d.notifyArraySplice_=function(l,K,da){var ja=!this.owned_&&!1,ra=hd(this);l=ra||ja?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",
index:l,removed:da,added:K,removedCount:da.length,addedCount:K.length}:null;this.atom_.reportChanged();ra&&Td(this,l)};d.get_=function(l){if(this.legacyMode_&&l>=this.values_.length)console.warn("[mobx] Out of bounds read: "+l);else return this.atom_.reportObserved(),this.dehanceValue_(this.values_[l])};d.set_=function(l,K){var da=this.values_;this.legacyMode_&&l>da.length&&f(17,l,da.length);if(l<da.length){var ja=da[l];if(wb(this)){K=Eb(this,{type:No,object:this.proxy_,index:l,newValue:K});if(!K)return;
K=K.newValue}K=this.enhancer_(K,ja);K!==ja&&(da[l]=K,this.notifyArrayChildUpdate_(l,K,ja))}else{l=Array(l+1-da.length);for(ja=0;ja<l.length-1;ja++)l[ja]=void 0;l[l.length-1]=K;this.spliceWithArray_(da.length,0,l)}};return a}(),Yu={clear:function(){return this.splice(0)},replace:function(a){var d=this[ih];return d.spliceWithArray_(0,d.values_.length,a)},toJSON:function(){return this.slice()},splice:function(a,d){for(var l=arguments.length,K=Array(2<l?l-2:0),da=2;da<l;da++)K[da-2]=arguments[da];l=this[ih];
switch(arguments.length){case 0:return[];case 1:return l.spliceWithArray_(a);case 2:return l.spliceWithArray_(a,d)}return l.spliceWithArray_(a,d,K)},spliceWithArray:function(a,d,l){return this[ih].spliceWithArray_(a,d,l)},push:function(){for(var a=this[ih],d=arguments.length,l=Array(d),K=0;K<d;K++)l[K]=arguments[K];a.spliceWithArray_(a.values_.length,0,l);return a.values_.length},pop:function(){return this.splice(Math.max(this[ih].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},
unshift:function(){for(var a=this[ih],d=arguments.length,l=Array(d),K=0;K<d;K++)l[K]=arguments[K];a.spliceWithArray_(0,0,l);return a.values_.length},reverse:function(){Af.trackingDerivation&&f(37,"reverse");this.replace(this.slice().reverse());return this},sort:function(){Af.trackingDerivation&&f(37,"sort");var a=this.slice();a.sort.apply(a,arguments);this.replace(a);return this},remove:function(a){var d=this[ih];a=d.dehanceValues_(d.values_).indexOf(a);return-1<a?(this.splice(a,1),!0):!1}};ub("concat",
ob);ub("flat",ob);ub("includes",ob);ub("indexOf",ob);ub("join",ob);ub("lastIndexOf",ob);ub("slice",ob);ub("toString",ob);ub("toLocaleString",ob);ub("every",Ub);ub("filter",Ub);ub("find",Ub);ub("findIndex",Ub);ub("flatMap",Ub);ub("forEach",Ub);ub("map",Ub);ub("some",Ub);ub("reduce",Tb);ub("reduceRight",Tb);var fE=F("ObservableArrayAdministration",Qw),gE={};var hE=Symbol.iterator;var iE=Symbol.toStringTag;var kz=function(){function a(l,K,da){var ja=this;void 0===K&&(K=Fa);void 0===da&&(da="ObservableMap");
this.name_=this.enhancer_=void 0;this[ih]=gE;this.dehancer=this.changeListeners_=this.interceptors_=this.keysAtom_=this.hasMap_=this.data_=void 0;this.enhancer_=K;this.name_=da;W(Map)||f(18);this.keysAtom_=Xa("ObservableMap.keys()");this.data_=new Map;this.hasMap_=new Map;Kb(!0,function(){ja.merge(l)})}var d=a.prototype;d.has_=function(l){return this.data_.has(l)};d.has=function(l){var K=this;if(!Af.trackingDerivation)return this.has_(l);var da=this.hasMap_.get(l);if(!da){var ja=da=new er(this.has_(l),
La,"ObservableMap.key?",!1);this.hasMap_.set(l,ja);pd(ja,function(){return K.hasMap_["delete"](l)})}return da.get()};d.set=function(l,K){var da=this.has_(l);if(wb(this)){K=Eb(this,{type:da?No:"add",object:this,newValue:K,name:l});if(!K)return this;K=K.newValue}da?this.updateValue_(l,K):this.addValue_(l,K);return this};d["delete"]=function(l){var K=this;if(wb(this)&&!Eb(this,{type:"delete",object:this,name:l}))return!1;if(this.has_(l)){var da=hd(this),ja=da?{observableKind:"map",debugObjectName:this.name_,
type:"delete",object:this,oldValue:this.data_.get(l).value_,name:l}:null;Gc(function(){var ra;K.keysAtom_.reportChanged();null==(ra=K.hasMap_.get(l))?void 0:ra.setNewValue_(!1);K.data_.get(l).setNewValue_(void 0);K.data_["delete"](l)});da&&Td(this,ja);return!0}return!1};d.updateValue_=function(l,K){var da=this.data_.get(l);K=da.prepareNewValue_(K);if(K!==Af.UNCHANGED){var ja=hd(this);l=ja?{observableKind:"map",debugObjectName:this.name_,type:No,object:this,oldValue:da.value_,name:l,newValue:K}:null;
da.setNewValue_(K);ja&&Td(this,l)}};d.addValue_=function(l,K){var da=this;Gc(function(){var Ka,Sa=new er(K,da.enhancer_,"ObservableMap.key",!1);da.data_.set(l,Sa);K=Sa.value_;null==(Ka=da.hasMap_.get(l))?void 0:Ka.setNewValue_(!0);da.keysAtom_.reportChanged()});var ja=hd(this),ra=ja?{observableKind:"map",debugObjectName:this.name_,type:"add",object:this,name:l,newValue:K}:null;ja&&Td(this,ra)};d.get=function(l){return this.has(l)?this.dehanceValue_(this.data_.get(l).get()):this.dehanceValue_(void 0)};
d.dehanceValue_=function(l){return void 0!==this.dehancer?this.dehancer(l):l};d.keys=function(){this.keysAtom_.reportObserved();return this.data_.keys()};d.values=function(){var l=this,K=this.keys();return Va({next:function(){var da=K.next(),ja=da.done;da=da.value;return{done:ja,value:ja?void 0:l.get(da)}}})};d.entries=function(){var l=this,K=this.keys();return Va({next:function(){var da=K.next(),ja=da.done;da=da.value;return{done:ja,value:ja?void 0:[da,l.get(da)]}}})};d[hE]=function(){return this.entries()};
d.forEach=function(l,K){for(var da=ta(this),ja;!(ja=da()).done;)ja=ja.value,l.call(K,ja[1],ja[0],this)};d.merge=function(l){var K=this;Vp(l)&&(l=new Map(l));Gc(function(){L(l)?I(l).forEach(function(da){return K.set(da,l[da])}):Array.isArray(l)?l.forEach(function(da){return K.set(da[0],da[1])}):N(l)?(l.constructor!==Map&&f(19,l),l.forEach(function(da,ja){return K.set(ja,da)})):null!==l&&void 0!==l&&f(20,l)});return this};d.clear=function(){var l=this;Gc(function(){bd(function(){for(var K=ta(l.keys()),
da;!(da=K()).done;)l["delete"](da.value)})})};d.replace=function(l){var K=this;Gc(function(){for(var da=td(l),ja=new Map,ra=!1,Ka=ta(K.data_.keys()),Sa;!(Sa=Ka()).done;)if(Sa=Sa.value,!da.has(Sa))if(K["delete"](Sa))ra=!0;else{var bb=K.data_.get(Sa);ja.set(Sa,bb)}for(da=ta(da.entries());!(Ka=da()).done;)Sa=Ka.value,Ka=Sa[0],bb=Sa[1],Sa=K.data_.has(Ka),K.set(Ka,bb),K.data_.has(Ka)&&(bb=K.data_.get(Ka),ja.set(Ka,bb),Sa||(ra=!0));if(!ra)if(K.data_.size!==ja.size)K.keysAtom_.reportChanged();else for(ra=
K.data_.keys(),da=ja.keys(),Ka=ra.next(),Sa=da.next();!Ka.done;){if(Ka.value!==Sa.value){K.keysAtom_.reportChanged();break}Ka=ra.next();Sa=da.next()}K.data_=ja});return this};d.toString=function(){return"[object ObservableMap]"};d.toJSON=function(){return Array.from(this)};d.observe_=function(l,K){return Ud(this,l)};d.intercept_=function(l){return Bb(this,l)};ba(a,[{key:"size",get:function(){this.keysAtom_.reportObserved();return this.data_.size}},{key:iE,get:function(){return"Map"}}]);return a}(),
Vp=F("ObservableMap",kz),jE={};var kE=Symbol.iterator;var lE=Symbol.toStringTag;var lz=function(){function a(l,K,da){void 0===K&&(K=Fa);void 0===da&&(da="ObservableSet");this.name_=void 0;this[ih]=jE;this.data_=new Set;this.enhancer_=this.dehancer=this.interceptors_=this.changeListeners_=this.atom_=void 0;this.name_=da;W(Set)||f(22);this.atom_=Xa(this.name_);this.enhancer_=function(ja,ra){return K(ja,ra,da)};l&&this.replace(l)}var d=a.prototype;d.dehanceValue_=function(l){return void 0!==this.dehancer?
this.dehancer(l):l};d.clear=function(){var l=this;Gc(function(){bd(function(){for(var K=ta(l.data_.values()),da;!(da=K()).done;)l["delete"](da.value)})})};d.forEach=function(l,K){for(var da=ta(this),ja;!(ja=da()).done;)ja=ja.value,l.call(K,ja,ja,this)};d.add=function(l){var K=this;if(wb(this)&&!Eb(this,{type:"add",object:this,newValue:l}))return this;if(!this.has(l)){Gc(function(){K.data_.add(K.enhancer_(l,void 0));K.atom_.reportChanged()});var da=hd(this),ja=da?{observableKind:"set",debugObjectName:this.name_,
type:"add",object:this,newValue:l}:null;da&&Td(this,ja)}return this};d["delete"]=function(l){var K=this;if(wb(this)&&!Eb(this,{type:"delete",object:this,oldValue:l}))return!1;if(this.has(l)){var da=hd(this),ja=da?{observableKind:"set",debugObjectName:this.name_,type:"delete",object:this,oldValue:l}:null;Gc(function(){K.atom_.reportChanged();K.data_["delete"](l)});da&&Td(this,ja);return!0}return!1};d.has=function(l){this.atom_.reportObserved();return this.data_.has(this.dehanceValue_(l))};d.entries=
function(){var l=0,K=Array.from(this.keys()),da=Array.from(this.values());return Va({next:function(){var ja=l;l+=1;return ja<da.length?{value:[K[ja],da[ja]],done:!1}:{done:!0}}})};d.keys=function(){return this.values()};d.values=function(){this.atom_.reportObserved();var l=this,K=0,da=Array.from(this.data_.values());return Va({next:function(){return K<da.length?{value:l.dehanceValue_(da[K++]),done:!1}:{done:!0}}})};d.replace=function(l){var K=this;gr(l)&&(l=new Set(l));Gc(function(){Array.isArray(l)?
(K.clear(),l.forEach(function(da){return K.add(da)})):M(l)?(K.clear(),l.forEach(function(da){return K.add(da)})):null!==l&&void 0!==l&&f("Cannot initialize set from "+l)});return this};d.observe_=function(l,K){return Ud(this,l)};d.intercept_=function(l){return Bb(this,l)};d.toJSON=function(){return Array.from(this)};d.toString=function(){return"[object ObservableSet]"};d[kE]=function(){return this.values()};ba(a,[{key:"size",get:function(){this.atom_.reportObserved();return this.data_.size}},{key:lE,
get:function(){return"Set"}}]);return a}(),gr=F("ObservableSet",lz),mz=Object.create(null),nz=function(){function a(l,K,da,ja){void 0===K&&(K=new Map);void 0===ja&&(ja=LD);this.pendingKeys_=this.appliedAnnotations_=this.isPlainObject_=this.proxy_=this.interceptors_=this.changeListeners_=this.keysAtom_=this.defaultAnnotation_=this.values_=this.target_=void 0;this.target_=l;this.values_=K;this.name_=da;this.defaultAnnotation_=ja;this.keysAtom_=new qt("ObservableObject.keys");this.isPlainObject_=L(this.target_)}
var d=a.prototype;d.getObservablePropValue_=function(l){return this.values_.get(l).get()};d.setObservablePropValue_=function(l,K){var da=this.values_.get(l);if(da instanceof st)return da.set(K),!0;if(wb(this)){K=Eb(this,{type:No,object:this.proxy_||this.target_,name:l,newValue:K});if(!K)return null;K=K.newValue}K=da.prepareNewValue_(K);if(K!==Af.UNCHANGED){var ja=hd(this);l=ja?{type:No,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:da.value_,name:l,newValue:K}:
null;da.setNewValue_(K);ja&&Td(this,l)}return!0};d.get_=function(l){Af.trackingDerivation&&!U(this.target_,l)&&this.has_(l);return this.target_[l]};d.set_=function(l,K,da){void 0===da&&(da=!1);if(U(this.target_,l)){if(this.values_.has(l))return this.setObservablePropValue_(l,K);if(da)return Reflect.set(this.target_,l,K);this.target_[l]=K;return!0}return this.extend_(l,{value:K,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,da)};d.has_=function(l){if(!Af.trackingDerivation)return l in
this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var K=this.pendingKeys_.get(l);K||(K=new er(l in this.target_,La,"ObservableObject.key?",!1),this.pendingKeys_.set(l,K));return K.get()};d.make_=function(l,K){!0===K&&(K=this.defaultAnnotation_);if(!1!==K){if(!(l in this.target_)){var da;if(null!=(da=this.target_[ko])&&da[l])return;f(1,K.annotationType_,this.name_+"."+l.toString())}for(da=this.target_;da&&da!==pt;){var ja=Ru(da,l);if(ja){ja=K.make_(this,l,ja,da);if(0===ja)return;if(1===ja)break}da=
Object.getPrototypeOf(da)}var ra;null==(ra=this.target_[ko])?!0:delete ra[l]}};d.extend_=function(l,K,da,ja){void 0===ja&&(ja=!1);!0===da&&(da=this.defaultAnnotation_);if(!1===da)return this.defineProperty_(l,K,ja);if(K=da.extend_(this,l,K,ja)){var ra;null==(ra=this.target_[ko])?!0:delete ra[l]}return K};d.defineProperty_=function(l,K,da){void 0===da&&(da=!1);try{Sc();var ja=this.delete_(l);if(!ja)return ja;if(wb(this)){var ra=Eb(this,{object:this.proxy_||this.target_,name:l,type:"add",newValue:K.value});
if(!ra)return null;var Ka=ra.newValue;K.value!==Ka&&(K=V({},K,{value:Ka}))}if(da){if(!Reflect.defineProperty(this.target_,l,K))return!1}else jp(this.target_,l,K);this.notifyPropertyAddition_(l,K.value)}finally{Ib()}return!0};d.defineObservableProperty_=function(l,K,da,ja){void 0===ja&&(ja=!1);try{Sc();var ra=this.delete_(l);if(!ra)return ra;if(wb(this)){var Ka=Eb(this,{object:this.proxy_||this.target_,name:l,type:"add",newValue:K});if(!Ka)return null;K=Ka.newValue}var Sa=te(l),bb={configurable:Af.safeDescriptors?
this.isPlainObject_:!0,enumerable:!0,get:Sa.get,set:Sa.set};if(ja){if(!Reflect.defineProperty(this.target_,l,bb))return!1}else jp(this.target_,l,bb);var gb=new er(K,da,"ObservableObject.key",!1);this.values_.set(l,gb);this.notifyPropertyAddition_(l,gb.value_)}finally{Ib()}return!0};d.defineComputedProperty_=function(l,K,da){void 0===da&&(da=!1);try{Sc();var ja=this.delete_(l);if(!ja)return ja;if(wb(this)&&!Eb(this,{object:this.proxy_||this.target_,name:l,type:"add",newValue:void 0}))return null;K.name||
(K.name="ObservableObject.key");K.context=this.proxy_||this.target_;var ra=te(l),Ka={configurable:Af.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:ra.get,set:ra.set};if(da){if(!Reflect.defineProperty(this.target_,l,Ka))return!1}else jp(this.target_,l,Ka);this.values_.set(l,new st(K));this.notifyPropertyAddition_(l,void 0)}finally{Ib()}return!0};d.delete_=function(l,K){void 0===K&&(K=!1);if(!U(this.target_,l))return!0;if(wb(this)&&!Eb(this,{object:this.proxy_||this.target_,name:l,type:"remove"}))return null;
try{var da,ja;Sc();var ra=hd(this),Ka=this.values_.get(l),Sa=void 0;if(!Ka&&ra){var bb;Sa=null==(bb=Ru(this.target_,l))?void 0:bb.value}if(K){if(!Reflect.deleteProperty(this.target_,l))return!1}else delete this.target_[l];Ka&&(this.values_["delete"](l),Ka instanceof er&&(Sa=Ka.value_),Db(Ka));this.keysAtom_.reportChanged();null==(da=this.pendingKeys_)?void 0:null==(ja=da.get(l))?void 0:ja.set(l in this.target_);if(ra){var gb={type:"remove",observableKind:"object",object:this.proxy_||this.target_,
debugObjectName:this.name_,oldValue:Sa,name:l};ra&&Td(this,gb)}}finally{Ib()}return!0};d.observe_=function(l,K){return Ud(this,l)};d.intercept_=function(l){return Bb(this,l)};d.notifyPropertyAddition_=function(l,K){var da,ja,ra=hd(this);ra&&(K=ra?{type:"add",observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:l,newValue:K}:null,ra&&Td(this,K));null==(da=this.pendingKeys_)?void 0:null==(ja=da.get(l))?void 0:ja.set(!0);this.keysAtom_.reportChanged()};d.ownKeys_=
function(){this.keysAtom_.reportObserved();return Su(this.target_)};d.keys_=function(){this.keysAtom_.reportObserved();return Object.keys(this.target_)};return a}(),mE=F("ObservableObjectAdministration",nz),nE=pe(0),Rw=0,oz=function(){};(function(a,d){Object.setPrototypeOf?Object.setPrototypeOf(a.prototype,d):void 0!==a.prototype.__proto__?a.prototype.__proto__=d:a.prototype=d})(oz,Array.prototype);var Sw=function(a,d,l){function K(ja,ra,Ka,Sa){void 0===Ka&&(Ka="ObservableArray");void 0===Sa&&(Sa=
!1);var bb=a.call(this)||this;ra=new Qw(Ka,ra,Sa,!0);ra.proxy_=ea(bb);G(ea(bb),ih,ra);ja&&ja.length&&(ra=vc(!0),bb.spliceWithArray(0,0,ja),Af.allowStateChanges=ra);Object.defineProperty(ea(bb),"0",nE);return bb}fa(K,a);var da=K.prototype;da.concat=function(){this[ih].atom_.reportObserved();for(var ja=arguments.length,ra=Array(ja),Ka=0;Ka<ja;Ka++)ra[Ka]=arguments[Ka];return Array.prototype.concat.apply(this.slice(),ra.map(function(Sa){return rd(Sa)?Sa.slice():Sa}))};da[l]=function(){var ja=this,ra=
0;return Va({next:function(){return ra<ja.length?{value:ja[ra++],done:!1}:{done:!0,value:void 0}}})};ba(K,[{key:"length",get:function(){return this[ih].getArrayLength_()},set:function(ja){this[ih].setArrayLength_(ja)}},{key:d,get:function(){return"Array"}}]);return K}(oz,Symbol.toStringTag,Symbol.iterator);Object.entries(Yu).forEach(function(a){var d=a[0];a=a[1];"concat"!==d&&R(Sw.prototype,d,a)});$d(1E3);var pz=pt.toString;["Symbol","Map","Set"].forEach(function(a){"undefined"===typeof E()[a]&&f("MobX requires global '"+
a+"' to be available or polyfilled")});"object"===typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:fc,extras:{getDebugName:Ya},$mobx:ih});var oE=aa(616),fl=class{constructor(a){hb(this,"props");hb(this,"aspectRatio");hb(this,"type");hb(this,"hideCloneHandles",!1);hb(this,"hideResizeHandles",!1);hb(this,"hideRotateHandle",!1);hb(this,"hideContextBar",!1);hb(this,"hideSelectionDetail",!1);hb(this,"hideSelection",!1);hb(this,"canChangeAspectRatio",!0);hb(this,"canUnmount",
!0);hb(this,"canResize",[!0,!0]);hb(this,"canScale",!0);hb(this,"canFlip",!0);hb(this,"canEdit",!1);hb(this,"canBind",!1);hb(this,"nonce");hb(this,"bindingDistance",4);hb(this,"isDirty",!1);hb(this,"lastSerialized");hb(this,"getCenter",()=>sf.getBoundsCenter(this.bounds));hb(this,"getRotatedBounds",()=>{const {bounds:ja,props:{rotation:ra}}=this;return ra?sf.getBoundsFromPoints(sf.getRotatedCorners(ja,ra)):ja});hb(this,"hitTestPoint",ja=>{var ra=this.rotatedBounds;if(!this.props.rotation)return Fk.pointInBounds(ja,
ra);ra=sf.getRotatedCorners(ra,this.props.rotation);return Fk.pointInPolygon(ja,ra)});hb(this,"hitTestLineSegment",(ja,ra)=>{const Ka=sf.getBoundsFromPoints([ja,ra]),{rotatedBounds:Sa,props:{rotation:bb=0}}=this;return sf.boundsContain(Sa,Ka)||bb?h(ja,ra,sf.getRotatedCorners(this.bounds)).didIntersect:0<r(Sa,ja,ra).length});hb(this,"hitTestBounds",ja=>{const {rotatedBounds:ra,props:{rotation:Ka=0}}=this,Sa=sf.getRotatedCorners(this.bounds,Ka);return sf.boundsContain(ja,ra)||0<v([ja.minX,ja.minY],
[ja.width,ja.height],Sa).length});hb(this,"getExpandedBounds",()=>sf.expandBounds(this.getBounds(),this.bindingDistance));hb(this,"getBindingPoint",(ja,ra,Ka,Sa)=>{var bb=this.getBounds(),gb=this.getExpandedBounds();if(Fk.pointInBounds(ja,gb)){var jb=z(ra,Ka,gb).filter(Jb=>Jb.didIntersect).map(Jb=>Jb.points[0]);if(jb.length)return Ka=this.getCenter(),jb=jb.sort((Jb,Ob)=>be.dist(Ob,ra)-be.dist(Jb,ra))[0],jb=be.med(ja,jb),Sa?(Sa=2>be.dist(ja,Ka)?Ka:ja,bb=0):(Sa=2>be.distanceToLineSegment(ja,jb,Ka)?
Ka:jb,bb=Fk.pointInBounds(ja,bb)?this.bindingDistance:Math.max(this.bindingDistance,sf.getBoundsSides(bb).map(Jb=>be.distanceToLineSegment(Jb[1][0],Jb[1][1],ja)).sort((Jb,Ob)=>Jb-Ob)[0])),gb=be.divV(be.sub(Sa,[gb.minX,gb.minY]),[gb.width,gb.height]),{point:be.clampV(gb,0,1),distance:bb}}});hb(this,"getSerialized",()=>jc(ff(Zd({},this.props),{type:this.type,nonce:this.nonce})));hb(this,"getCachedSerialized",()=>{!this.isDirty&&this.lastSerialized||Gc(()=>{this.setIsDirty(!1);this.setLastSerialized(this.getSerialized())});
if(this.lastSerialized)return this.lastSerialized;throw Error("Should not get here for getCachedSerialized");});hb(this,"validateProps",ja=>ja);hb(this,"update",(ja,ra=!1,Ka=!1)=>{ra||this.isDirty||this.setIsDirty(!0);ra||Ka||this.incNonce();Object.assign(this.props,this.validateProps(ja));return this});hb(this,"clone",()=>new this.constructor(this.serialized));hb(this,"onResetBounds",ja=>this);hb(this,"scale",[1,1]);hb(this,"onResizeStart",ja=>{var ra;this.scale=[...(null!=(ra=this.props.scale)?
ra:[1,1])];return this});hb(this,"onResize",(ja,ra)=>{const {bounds:Ka,rotation:Sa,scale:[bb,gb]}=ra;ja=[...this.scale];0>bb&&(ja[0]*=-1);0>gb&&(ja[1]*=-1);this.update({point:[Ka.minX,Ka.minY],scale:ja,rotation:Sa});return this});hb(this,"onHandleChange",(ja,{id:ra,delta:Ka})=>{if(void 0!==ja.handles){var Sa=ir(ja.handles);Sa[ra]=ff(Zd({},Sa[ra]),{point:be.add(Ka,ja.handles[ra].point)});var bb=sf.getCommonTopLeft(Object.values(Sa).map(gb=>gb.point));Object.values(Sa).forEach(gb=>{gb.point=be.sub(gb.point,
bb)});this.update({point:be.add(ja.point,bb),handles:Sa})}});var d,l;const K=this.constructor.id,da=null!=(d=this.constructor.defaultProps)?d:{};this.type=K;this.props=Zd(Zd({scale:[1,1]},da),a);this.nonce=null!=(l=a.nonce)?l:Date.now();Ue(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:l,strokeType:K,opacity:da,fill:ja,noFill:ra,borderRadius:Ka}=this.props;return(0,oE.jsx)("rect",{fill:ra?"none":sh(ja,"background"),stroke:sh(d,"stroke"),strokeWidth:null!=l?l:2,strokeDasharray:"dashed"===K?"8 2":void 0,fillOpacity:null!=da?da:.2,width:a.width,height:a.height,rx:Ka,ry:Ka})}};hb(fl,"type");fe([yg],fl.prototype,"props",2);fe([yg],fl.prototype,"canResize",2);fe([yg],fl.prototype,"nonce",2);fe([yg],fl.prototype,"isDirty",2);fe([yg],fl.prototype,
"lastSerialized",2);fe([Dg],fl.prototype,"id",1);fe([jg],fl.prototype,"setNonce",1);fe([jg],fl.prototype,"incNonce",1);fe([jg],fl.prototype,"setIsDirty",1);fe([jg],fl.prototype,"setLastSerialized",1);fe([Dg],fl.prototype,"center",1);fe([Dg],fl.prototype,"bounds",1);fe([Dg],fl.prototype,"rotatedBounds",1);fe([Dg],fl.prototype,"serialized",1);fe([jg],fl.prototype,"update",2);var fm=class extends fl{constructor(a={}){super(a);hb(this,"canBind",!0);hb(this,"getBounds",()=>{const [d,l]=this.props.point,
[K,da]=this.props.size;return{minX:d,minY:l,maxX:d+K,maxY:l+da,width:K,height:da}});hb(this,"getRotatedBounds",()=>sf.getBoundsFromPoints(sf.getRotatedCorners(this.bounds,this.props.rotation)));hb(this,"onResize",(d,l)=>{const {bounds:K,rotation:da,scale:[ja,ra]}=l;d=[...this.scale];0>ja&&(d[0]*=-1);0>ra&&(d[1]*=-1);this.update({point:[K.minX,K.minY],scale:d,rotation:da});return this.update({rotation:da,point:[K.minX,K.minY],size:[Math.max(1,K.width),Math.max(1,K.height)],scale:d})});hb(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});Ue(this)}};hb(fm,"id","box");hb(fm,"defaultProps",{id:"box",type:"box",parentId:"page",point:[0,0],size:[100,100]});var fs=class extends fl{constructor(a={}){super(a);hb(this,"getBounds",()=>{const {pointBounds:d,props:{point:l}}=this;return sf.translateBounds(d,l)});hb(this,"getRotatedBounds",()=>{const {props:{rotation:d,point:l},bounds:K,rotatedPoints:da}=this;return d?sf.translateBounds(sf.getBoundsFromPoints(da),
l):K});hb(this,"normalizedPoints",[]);hb(this,"isResizeFlippedX",!1);hb(this,"isResizeFlippedY",!1);hb(this,"onResizeStart",()=>{var d;const {bounds:l,props:{points:K}}=this;this.scale=[...(null!=(d=this.props.scale)?d:[1,1])];const da=[l.width,l.height];this.normalizedPoints=K.map(ja=>yd.divV(ja,da));return this});hb(this,"onResize",(d,l)=>{const {bounds:K,scale:[da,ja]}=l,ra=[K.width,K.height];d=[...this.scale];0>da&&(d[0]*=-1);0>ja&&(d[1]*=-1);return this.update(da||ja?{point:[K.minX,K.minY],points:this.normalizedPoints.map(Ka=>
yd.mulV(Ka,ra).concat(Ka[2])),scale:d}:{point:[K.minX,K.minY],points:this.normalizedPoints.map(Ka=>yd.mulV(Ka,ra).concat(Ka[2]))})});hb(this,"hitTestPoint",d=>{const {props:{points:l,point:K}}=this;return Fk.pointNearToPolyline(yd.sub(d,K),l)});hb(this,"hitTestLineSegment",(d,l)=>{const {bounds:K,props:{points:da,point:ja}}=this;if(Fk.pointInBounds(d,K)||Fk.pointInBounds(l,K)||0<r(K,d,l).length){const ra=yd.sub(d,ja),Ka=yd.sub(l,ja);return h(ra,Ka,da).didIntersect||!!da.find(Sa=>5>yd.dist(ra,Sa)||
5>yd.dist(Ka,Sa))}return!1});hb(this,"hitTestBounds",d=>{const {rotatedBounds:l,props:{points:K,point:da}}=this,ja=sf.translateBounds(d,yd.neg(da));return sf.boundsContain(d,l)||K.every(ra=>Fk.pointInBounds(ra,ja))||sf.boundsCollide(d,l)&&0<D([ja.minX,ja.minY],[ja.width,ja.height],K).length});Ue(this)}get pointBounds(){const {props:{points:a}}=this;return sf.getBoundsFromPoints(a)}get rotatedPoints(){const {props:{point:a,points:d,rotation:l},center:K}=this;if(!l)return d;const da=yd.sub(K,a);return d.map(ja=>
yd.rotWith(ja,da,l))}};hb(fs,"id","draw");hb(fs,"defaultProps",{id:"draw",type:"draw",parentId:"page",point:[0,0],points:[],isComplete:!1});fe([Dg],fs.prototype,"pointBounds",1);fe([Dg],fs.prototype,"rotatedPoints",1);var Tw=class extends fm{constructor(a={}){super(a);hb(this,"getBounds",()=>{const {props:{point:[d,l],size:[K,da]}}=this;return sf.getRotatedEllipseBounds(d,l,K/2,da/2,0)});hb(this,"getRotatedBounds",()=>{const {props:{point:[d,l],size:[K,da],rotation:ja}}=this;return sf.getRotatedEllipseBounds(d,
l,K/2,da/2,ja)});hb(this,"hitTestPoint",d=>{const {props:{size:l,rotation:K},center:da}=this;return Fk.pointInEllipse(d,da,l[0],l[1],K||0)});hb(this,"hitTestLineSegment",(d,l)=>{const {props:{size:[K,da],rotation:ja=0},center:ra}=this;return g(d,l,ra,K,da,ja).didIntersect});hb(this,"hitTestBounds",d=>{const {props:{size:[l,K],rotation:da=0},rotatedBounds:ja}=this;var ra;if(!(ra=sf.boundsContain(d,ja))){const {minX:Ka,minY:Sa,width:bb,height:gb}=d;ra=0<t(this.center,l/2,K/2,da,[Ka,Sa],[bb,gb]).length}return ra});
Ue(this)}};hb(Tw,"id","ellipse");hb(Tw,"defaultProps",{id:"ellipse",type:"ellipse",parentId:"page",point:[0,0],size:[100,100]});var Uw=class extends fm{constructor(a={}){super(a);hb(this,"onResetBounds",d=>{const {clipping:l,size:K,point:da}=this.props;if(l){const [ja,ra,Ka,Sa]=Array.isArray(l)?l:[l,l,l,l];return this.update({clipping:0,point:[da[0]-Sa,da[1]-ja],size:[K[0]+(Sa-ra),K[1]+(ja-Ka)]})}if(d.asset){const {size:[ja,ra]}=d.asset;this.update({clipping:0,point:[da[0]+K[0]/2-ja/2,da[1]+K[1]/
2-ra/2],size:[ja,ra]})}return this});hb(this,"onResize",(d,l)=>{const {bounds:K,clip:da,scale:ja}=l;({clipping:l}=this.props);const {clipping:ra}=d;if(da){const {point:[Ka,Sa],size:[bb,gb]}=d,[jb,Jb,Ob,Lb]=ra?Array.isArray(ra)?ra:[ra,ra,ra,ra]:[0,0,0,0];l=[jb+(K.minY-Sa),Jb+(K.maxX-(Ka+bb)),Ob+(K.maxY-(Sa+gb)),Lb+(K.minX-Ka)]}else void 0!==ra&&(l=Array.isArray(ra)?ra:[ra,ra,ra,ra],l=[l[0]*ja[1],l[1]*ja[0],l[2]*ja[1],l[3]*ja[0]]);if(l&&Array.isArray(l)){const Ka=l;Ka.every((Sa,bb)=>0===bb||Sa===Ka[bb-
1])&&(l=Ka[0])}return this.update({point:[K.minX,K.minY],size:[Math.max(1,K.width),Math.max(1,K.height)],clipping:l})});Ue(this)}};hb(Uw,"id","ellipse");hb(Uw,"defaultProps",{id:"ellipse",type:"ellipse",parentId:"page",point:[0,0],size:[100,100],clipping:0,objectFit:"none",assetId:""});var qz=class extends fl{constructor(a={}){super(a);hb(this,"getBounds",()=>{const {points:d,props:{point:l}}=this;return sf.translateBounds(sf.getBoundsFromPoints(d),l)});hb(this,"getRotatedBounds",()=>{const {rotatedPoints:d,
props:{point:l}}=this;return sf.translateBounds(sf.getBoundsFromPoints(d),l)});hb(this,"normalizedHandles",[]);hb(this,"onResizeStart",()=>{var d;const {props:{handles:l},bounds:K}=this;this.scale=[...(null!=(d=this.props.scale)?d:[1,1])];const da=[K.width,K.height];this.normalizedHandles=Object.values(l).map(ja=>yd.divV(ja.point,da));return this});hb(this,"onResize",(d,l)=>{const {bounds:K,scale:[da,ja]}=l,{props:{handles:ra},normalizedHandles:Ka}=this,Sa=[K.width,K.height];d=[...this.scale];0>da&&
(d[0]*=-1);0>ja&&(d[1]*=-1);return this.update({point:[K.minX,K.minY],handles:Object.values(ra).map((bb,gb)=>ff(Zd({},bb),{point:yd.mulV(Ka[gb],Sa)})),scale:d})});hb(this,"hitTestPoint",d=>{const {points:l}=this;return Fk.pointNearToPolyline(yd.sub(d,this.props.point),l)});hb(this,"hitTestLineSegment",(d,l)=>{const {bounds:K,points:da,props:{point:ja}}=this;if(Fk.pointInBounds(d,K)||Fk.pointInBounds(l,K)||0<r(K,d,l).length){const ra=yd.sub(d,ja),Ka=yd.sub(l,ja);return h(ra,Ka,da).didIntersect||!!da.find(Sa=>
5>yd.dist(ra,Sa)||5>yd.dist(Ka,Sa))}return!1});hb(this,"hitTestBounds",d=>{const {rotatedBounds:l,points:K,props:{point:da}}=this,ja=sf.translateBounds(d,yd.neg(da));return sf.boundsContain(d,l)||K.every(ra=>Fk.pointInBounds(ra,ja))||sf.boundsCollide(d,l)&&0<D([ja.minX,ja.minY],[ja.width,ja.height],K).length});hb(this,"validateProps",d=>{d.point&&(d.point=[0,0]);void 0!==d.handles&&1>Object.values(d.handles).length&&(d.handles=qz.defaultProps.handles);return d});Ue(this)}get points(){return Object.values(this.props.handles).map(a=>
a.point)}get centroid(){const {points:a}=this;return Rk.getPolygonCentroid(a)}get rotatedPoints(){const {centroid:a,props:{handles:d,rotation:l}}=this;return l?Object.values(d).map(K=>yd.rotWith(K.point,a,l)):this.points}},gs=qz;hb(gs,"id","polyline");hb(gs,"defaultProps",{id:"polyline",type:"polyline",parentId:"page",point:[0,0],handles:{}});fe([Dg],gs.prototype,"points",1);fe([Dg],gs.prototype,"centroid",1);fe([Dg],gs.prototype,"rotatedPoints",1);var rz=class extends gs{constructor(a={}){super(a);
hb(this,"hideResizeHandles",!0);hb(this,"hideRotateHandle",!0);hb(this,"validateProps",d=>{d.point&&(d.point=[0,0]);void 0!==d.handles&&1>Object.values(d.handles).length&&(d.handles=rz.defaultProps.handles);return d});hb(this,"getHandlesChange",(d,l)=>{var K=Vl(d.handles,l);K=Vl(K,{start:{point:be.toFixed(K.start.point)},end:{point:be.toFixed(K.end.point)}});if(!be.isEqual(K.start.point,K.end.point)){l={point:d.point,handles:ir(K)};d=d.point;K=sf.translateBounds(sf.getBoundsFromPoints(Object.values(K).map(ja=>
ja.point)),l.point);var da=be.sub([K.minX,K.minY],d);be.isEqual(da,[0,0])||(Object.values(l.handles).forEach(ja=>{ja.point=be.toFixed(be.sub(ja.point,da))}),l.point=be.toFixed(be.add(l.point,da)));return l}});Ue(this)}},wt=rz;hb(wt,"id","line");hb(wt,"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 Wp=class extends fm{constructor(a={}){super(a);hb(this,"getRotatedBounds",()=>{const {rotatedVertices:d,
props:{point:l},offset:K}=this;return sf.translateBounds(sf.getBoundsFromPoints(d),yd.add(l,K))});hb(this,"hitTestPoint",d=>{const {vertices:l}=this;return Fk.pointInPolygon(yd.add(d,this.props.point),l)});hb(this,"hitTestLineSegment",(d,l)=>{const {vertices:K,props:{point:da}}=this;return h(yd.sub(d,da),yd.sub(l,da),K).didIntersect});hb(this,"hitTestBounds",d=>{const {rotatedBounds:l,offset:K,rotatedVertices:da,props:{point:ja}}=this,ra=sf.translateBounds(d,yd.neg(yd.add(ja,K)));return sf.boundsContain(d,
l)||da.every(Ka=>Fk.pointInBounds(Ka,ra))||0<v([ra.minX,ra.minY],[ra.width,ra.height],da).length});hb(this,"validateProps",d=>{d.point&&(d.point=[0,0]);void 0!==d.sides&&3>d.sides&&(d.sides=3);return d});Ue(this)}get vertices(){return this.getVertices()}get pageVertices(){const {props:{point:a},vertices:d}=this;return d.map(l=>yd.add(l,a))}get centroid(){const {vertices:a}=this;return Rk.getPolygonCentroid(a)}get rotatedVertices(){const {vertices:a,centroid:d,props:{rotation:l}}=this;return l?a.map(K=>
yd.rotWith(K,d,l)):a}get offset(){const {props:{size:[a,d]}}=this,l=sf.getBoundsCenter(sf.getBoundsFromPoints(this.vertices));return yd.sub(yd.div([a,d],2),l)}getVertices(a=0){const {ratio:d,sides:l,size:K}=this.props;return 3===l?Rk.getTriangleVertices(K,a,d):Rk.getPolygonVertices(K,l,a,d)}};hb(Wp,"id","polygon");hb(Wp,"defaultProps",{id:"polygon",type:"polygon",parentId:"page",point:[0,0],size:[100,100],sides:5,ratio:1,isFlippedY:!1});fe([Dg],Wp.prototype,"vertices",1);fe([Dg],Wp.prototype,"pageVertices",
1);fe([Dg],Wp.prototype,"centroid",1);fe([Dg],Wp.prototype,"rotatedVertices",1);fe([Dg],Wp.prototype,"offset",1);var Vw=class extends fm{constructor(a={}){super(a);hb(this,"canEdit",!0);hb(this,"canFlip",!1);Ue(this)}};hb(Vw,"id","text");hb(Vw,"defaultProps",{id:"text",type:"text",parentId:"page",isSizeLocked:!0,point:[0,0],size:[16,32],text:""});var Zu=class extends fm{constructor(a={}){super(a);hb(this,"canEdit",!1);hb(this,"canFlip",!1);hb(this,"getBounds",()=>0===this.shapes.length?(mg().deleteShapes([this.id]),
{minX:0,minY:0,maxX:0,maxY:0,width:0,height:0}):sf.getCommonBounds(this.shapes.map(d=>d.getBounds())));Ue(this);this.canResize=[!1,!1]}getShapes(){throw Error("will be implemented other places");}get shapes(){return this.getShapes()}};hb(Zu,"id","group");hb(Zu,"defaultProps",{id:"group",type:"group",parentId:"page",point:[0,0],size:[0,0],children:[]});fe([Dg],Zu.prototype,"shapes",1);var hs=class{constructor(){hb(this,"_id");hb(this,"_initial");hb(this,"_states");hb(this,"_isActive",!1);hb(this,"cursor");
hb(this,"_disposables",[]);hb(this,"children",new Map([]));hb(this,"registerStates",l=>{l.forEach(K=>this.children.set(K.id,new K(this,this)));return this});hb(this,"deregisterStates",l=>{l.forEach(K=>{var da;null==(da=this.children.get(K.id))?void 0:da.dispose();this.children.delete(K.id)});return this});hb(this,"currentState",{});hb(this,"transition",(l,K={})=>{if(0===this.children.size)throw Error(`Tool ${this.id} has no states, cannot transition to ${l}.`);const da=this.children.get(l),ja=this.currentState;
if(!da)throw Error(`Could not find a state named ${l}.`);Gc(()=>{this.currentState?(ja._events.onExit(ff(Zd({},K),{toId:l})),ja.dispose(),this.setCurrentState(da),this._events.onTransition(ff(Zd({},K),{fromId:ja.id,toId:l})),da._events.onEnter(ff(Zd({},K),{fromId:ja.id}))):(this.currentState=da,da._events.onEnter(ff(Zd({},K),{fromId:""})))});return this});hb(this,"isIn",l=>{l=l.split(".").reverse();let K=this;for(;0<l.length;){const da=l.pop();if(!da)return!0;if(K.currentState.id===da){if(0===l.length)return!0;
K=K.currentState}else break}return!1});hb(this,"isInAny",(...l)=>l.some(this.isIn));hb(this,"forwardEvent",(l,...K)=>{var da,ja;(null==(ja=null==(da=this.currentState)?void 0:da._events)?0:ja[l])&&Gc(()=>{var ra;return null==(ra=this.currentState._events)?void 0:ra[l](...K)})});hb(this,"_events",{onTransition:l=>{var K;null==(K=this.onTransition)?void 0:K.call(this,l)},onEnter:l=>{var K;this._isActive=!0;this.initial&&this.transition(this.initial,l);null==(K=this.onEnter)?void 0:K.call(this,l)},onExit:l=>
{var K,da,ja;this._isActive=!1;null==(da=null==(K=this.currentState)?void 0:K.onExit)?void 0:da.call(K,{toId:"parent"});null==(ja=this.onExit)?void 0:ja.call(this,l)},onPointerDown:(l,K)=>{var da;null==(da=this.onPointerDown)?void 0:da.call(this,l,K);this.forwardEvent("onPointerDown",l,K)},onPointerUp:(l,K)=>{var da;null==(da=this.onPointerUp)?void 0:da.call(this,l,K);this.forwardEvent("onPointerUp",l,K)},onPointerMove:(l,K)=>{var da;null==(da=this.onPointerMove)?void 0:da.call(this,l,K);this.forwardEvent("onPointerMove",
l,K)},onPointerEnter:(l,K)=>{var da;null==(da=this.onPointerEnter)?void 0:da.call(this,l,K);this.forwardEvent("onPointerEnter",l,K)},onPointerLeave:(l,K)=>{var da;null==(da=this.onPointerLeave)?void 0:da.call(this,l,K);this.forwardEvent("onPointerLeave",l,K)},onDoubleClick:(l,K)=>{var da;null==(da=this.onDoubleClick)?void 0:da.call(this,l,K);this.forwardEvent("onDoubleClick",l,K)},onKeyDown:(l,K)=>{var da;this._events.onModifierKey(l,K);null==(da=this.onKeyDown)?void 0:da.call(this,l,K);this.forwardEvent("onKeyDown",
l,K)},onKeyUp:(l,K)=>{var da;this._events.onModifierKey(l,K);null==(da=this.onKeyUp)?void 0:da.call(this,l,K);this.forwardEvent("onKeyUp",l,K)},onPinchStart:(l,K)=>{var da;null==(da=this.onPinchStart)?void 0:da.call(this,l,K);this.forwardEvent("onPinchStart",l,K)},onPinch:(l,K)=>{var da;null==(da=this.onPinch)?void 0:da.call(this,l,K);this.forwardEvent("onPinch",l,K)},onPinchEnd:(l,K)=>{var da;null==(da=this.onPinchEnd)?void 0:da.call(this,l,K);this.forwardEvent("onPinchEnd",l,K)},onModifierKey:(l,
K)=>{switch(K.key){case "Shift":case "Alt":case "Ctrl":case "Meta":this._events.onPointerMove(l,K)}}});hb(this,"onEnter");hb(this,"onExit");hb(this,"onTransition");hb(this,"onPointerDown");hb(this,"onPointerUp");hb(this,"onPointerMove");hb(this,"onPointerEnter");hb(this,"onPointerLeave");hb(this,"onDoubleClick");hb(this,"onKeyDown");hb(this,"onKeyUp");hb(this,"onPinchStart");hb(this,"onPinch");hb(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}};hb(hs,"id");hb(hs,"shortcuts");fe([yg],hs.prototype,"currentState",2);fe([jg],hs.prototype,"setCurrentState",
1);var Ww=class extends hs{constructor(a,d){var l,K;super();hb(this,"_root");hb(this,"_parent");hb(this,"children",new Map([]));hb(this,"registerStates",da=>{da.forEach(ja=>this.children.set(ja.id,new ja(this,this._root)));return this});hb(this,"deregisterStates",da=>{da.forEach(ja=>{var ra;null==(ra=this.children.get(ja.id))?void 0:ra.dispose();this.children.delete(ja.id)});return this});this._parent=a;this._root=d;this.states&&0<this.states.length&&(this.registerStates(this.states),a=null!=(l=this.initial)?
l:this.states[0].id,l=this.children.get(a))&&(this.setCurrentState(l),null==(K=this.currentState)?void 0:K._events.onEnter({fromId:"initial"}));Ue(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]}};hb(Ww,"cursor");var Xp=class extends Ww{constructor(){super(...arguments);hb(this,"isLocked",!1);hb(this,"previous");hb(this,"onEnter",({fromId:a})=>{this.previous=
a;this.cursor&&this.app.cursors.setCursor(this.cursor)});hb(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}},Xh=class extends Ww{get app(){return this.root}get tool(){return this.parent}},sz=class extends Xh{constructor(){super(...arguments);hb(this,"cursor","crosshair");hb(this,"creatingShape");hb(this,"aspectRatio");hb(this,"initialBounds",
{});hb(this,"onEnter",()=>{const {currentPage:a,inputs:{originPoint:d,currentPoint:l}}=this.app;var {Shape:K}=this.tool;K=new K({id:qk(),type:K.id,parentId:a.id,point:[...d],fill:this.app.settings.color,stroke:this.app.settings.color,size:be.abs(be.sub(l,d))});this.initialBounds={minX:d[0],minY:d[1],maxX:d[0]+1,maxY:d[1]+1,width:1,height:1};K.canChangeAspectRatio||(K.aspectRatio?(this.aspectRatio=K.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=K;this.creatingShape.setScaleLevel(this.app.settings.scaleLevel);this.app.currentPage.addShapes(K);this.app.setSelectedShapes([K])});hb(this,"onPointerMove",a=>{if(!a.order){if(!this.creatingShape)throw Error("Expected a creating shape.");var {initialBounds:d}=this,{currentPoint:l,originPoint:K,shiftKey:da}=this.app.inputs;a=da||this.creatingShape.props.isAspectRatioLocked||
!this.creatingShape.canChangeAspectRatio;d=sf.getTransformedBoundingBox(d,"bottom_right_corner",be.sub(l,K),0,a);this.app.settings.snapToGrid&&!a&&(d=sf.snapBoundsToGrid(d,8));this.creatingShape.update({point:[d.minX,d.minY],size:[d.width,d.height]})}});hb(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()});hb(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")}})}};hb(sz,"id","creating");var tz=class extends Xh{constructor(){super(...arguments);hb(this,"onPointerDown",(a,d)=>{a.order||this.tool.transition("pointing")});hb(this,"onPinchStart",(...a)=>{var d,l;this.app.transition("select",{returnTo:this.app.currentState.id});null==(l=(d=this.app._events).onPinchStart)?void 0:l.call(d,...a)});
hb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}})}};hb(tz,"id","idle");var uz=class extends Xh{constructor(){super(...arguments);hb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&!this.app.readOnly&&(this.tool.transition("creating"),this.app.setSelectedShapes(this.app.currentPage.shapes))});hb(this,"onPointerUp",()=>{this.tool.transition("idle")})}};hb(uz,"id","pointing");var kp=class extends Xp{constructor(){super(...arguments);
hb(this,"cursor","crosshair")}};hb(kp,"id","box");hb(kp,"states",[tz,uz,sz]);hb(kp,"initial","idle");var vz=class extends Xh{constructor(){super(...arguments);hb(this,"shape",{});hb(this,"points",[[0,0,.5]]);hb(this,"persistDebounced",Xj(this.app.persist,200));hb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});hb(this,"onEnter",()=>{var a;const {Shape:d,previousShape:l}=this.tool;var {originPoint:K}=this.app.inputs;this.app.history.pause();if(this.app.inputs.shiftKey&&
l){this.shape=l;var {shape:da}=this;var ja=da.props.points[da.props.points.length-1];const Ka=yd.sub(K,da.props.point).concat(null!=(a=K[2])?a:.5);this.points=[...da.props.points,ja,ja];const Sa=Math.ceil(yd.dist(ja,K)/16);for(let bb=0,gb=bb/(Sa-1);bb<Sa;bb++){a=this.points;K=a.push;da=yd.lrp(ja,Ka,gb);var ra=ja[2];K.call(a,da.concat.call(da,ra+(Ka[2]-ra)*gb))}this.addNextPoint(Ka)}else this.tool.previousShape=void 0,this.points=[[0,0,null!=(ja=K[2])?ja:.5]],this.shape=new d({id:qk(),type:d.id,parentId:this.app.currentPage.id,
point:K.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)});hb(this,"onPointerMove",()=>{const {shape:a}=this,{currentPoint:d,previousPoint:l}=this.app.inputs;yd.isEqual(l,d)||this.addNextPoint(yd.sub(d,a.props.point).concat(d[2]))});hb(this,"onPointerUp",()=>{if(!this.shape)throw Error("Expected a creating shape.");this.app.history.resume();this.shape.update({isComplete:!0,
points:this.tool.simplify?Fk.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()});hb(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,l=yd.min(a,
[0,0]);this.points.push(a);0>l[0]||0>l[1]?(this.points=this.points.map(K=>yd.sub(K,l).concat(K[2])),d.update({point:yd.add(d.props.point,l),points:this.points})):d.update({points:this.points})}};hb(vz,"id","creating");var wz=class extends Xh{constructor(){super(...arguments);hb(this,"onPointerDown",(a,d)=>{a.order||this.app.readOnly||this.tool.transition("creating")});hb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});hb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}})}};
hb(wz,"id","idle");var xz=class extends Xh{constructor(){super(...arguments);hb(this,"origin",[0,0]);hb(this,"prevDelta",[0,0]);hb(this,"onEnter",a=>{this.prevDelta=a.info.delta;this.origin=a.info.point});hb(this,"onPinch",a=>{this.app.viewport.pinchZoom(a.point,a.delta,a.delta[2])});hb(this,"onPinchEnd",()=>{this.tool.transition("idle")})}};hb(xz,"id","pinching");var xt=class extends Xp{constructor(){super(...arguments);hb(this,"cursor","crosshair");hb(this,"simplify",!0);hb(this,"simplifyTolerance",
1);hb(this,"previousShape");hb(this,"onPinchStart",(a,d)=>{this.transition("pinching",{info:a,event:d})})}};hb(xt,"id","draw");hb(xt,"states",[wz,vz,xz]);hb(xt,"initial","idle");var yz=class extends Xh{constructor(){super(...arguments);hb(this,"points",[[0,0,.5]]);hb(this,"hitShapes",new Set);hb(this,"onEnter",()=>{const {originPoint:a}=this.app.inputs;this.points=[a];this.hitShapes.clear()});hb(this,"onPointerMove",()=>{const {currentPoint:a,previousPoint:d}=this.app.inputs;yd.isEqual(d,a)||(this.points.push(a),
this.app.shapesInViewport.filter(l=>l.hitTestLineSegment(d,a)).forEach(l=>this.hitShapes.add(l)),this.app.setErasingShapes(Array.from(this.hitShapes.values())))});hb(this,"onPointerUp",()=>{this.app.deleteShapes(Array.from(this.hitShapes.values()));this.tool.transition("idle")});hb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.setErasingShapes([]),this.tool.transition("idle")}})}};hb(yz,"id","erasing");var zz=class extends Xh{constructor(){super(...arguments);hb(this,"onPointerDown",
(a,d)=>{a.order||this.tool.transition("pointing")});hb(this,"onPinchStart",(...a)=>{var d,l;this.app.transition("select",{returnTo:this.app.currentState.id});null==(l=(d=this.app._events).onPinchStart)?void 0:l.call(d,...a)});hb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}})}};hb(zz,"id","idle");var Az=class extends Xh{constructor(){super(...arguments);hb(this,"onEnter",()=>{const {currentPoint:a}=this.app.inputs;this.app.setErasingShapes(this.app.shapesInViewport.filter(d=>
d.hitTestPoint(a)))});hb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&(this.tool.transition("erasing"),this.app.setSelectedShapes([]))});hb(this,"onPointerUp",()=>{const a=[...this.app.erasingShapes];this.app.setErasingShapes([]);this.app.deleteShapes(a);this.tool.transition("idle")})}};hb(Az,"id","pointing");var $u=class extends Xp{constructor(){super(...arguments);hb(this,"cursor","crosshair")}};hb($u,"id","erase");hb($u,"states",[zz,Az,yz]);hb($u,
"initial","idle");var Xw=class extends Xh{constructor(){super(...arguments);hb(this,"handle",{});hb(this,"handleId","end");hb(this,"currentShape",{});hb(this,"initialShape",{});hb(this,"bindableShapeIds",[]);hb(this,"startBindingShapeId");hb(this,"newStartBindingId","");hb(this,"draggedBindingId","");hb(this,"onPointerMove",()=>{const {inputs:{shiftKey:a,previousPoint:d,originPoint:l,currentPoint:K,modKey:da,altKey:ja},settings:{snapToGrid:ra}}=this.app;var Ka=this.app.getShapeById(this.initialShape.id),
{handles:Sa}=this.initialShape,bb=this.handleId,gb="start"===this.handleId?"end":"start";if(!be.isEqual(d,K)){var jb=be.sub(K,l);if(a){var Jb=Sa[gb].point,Ob=be.add(Sa[bb].point,jb),Lb=be.angle(Jb,Ob);Jb=be.rotWith(Ob,Jb,Ml.snapAngleToSegments(Lb,24)-Lb);jb=be.add(jb,be.sub(Jb,Ob))}jb=be.add(Sa[bb].point,jb);Sa={[bb]:ff(Zd({},Sa[bb]),{point:ra?be.snap(jb,8):be.toFixed(jb),bindingId:void 0})};var gc=this.currentShape.getHandlesChange(this.initialShape,Sa);if(gc){Sa=Vl(Ka.props,gc);var rc={},Wb;bb=
Sa.handles[bb];gb=Sa.handles[gb];if(this.startBindingShapeId){var kc;if(jb=this.app.getShapeById(this.startBindingShapeId)){Ob=jb.getCenter();Jb=Sa.handles.end;var hc=be.add(Sa.handles.start.point,Sa.point);be.isEqual(hc,Ob)&&hc[1]++;Lb=jb.hitTestPoint(K);hc=be.uni(be.sub(hc,Ob));const Fc=void 0!==this.app.currentPage.bindings[this.newStartBindingId];da||jb.hitTestPoint(be.add(Sa.point,Jb.point))||(kc=Hc(Ka.props,jb,"start",this.newStartBindingId,Ob,Ob,hc,Lb));kc&&!Fc?(rc[this.newStartBindingId]=
kc,Sa.handles.start.bindingId=kc.id):!kc&&Fc&&(console.log("removing start binding"),delete rc[this.newStartBindingId],Sa.handles.start.bindingId=void 0)}}if(!da){kc=be.add(gb.point,Sa.point);gb=be.add(bb.point,Sa.point);bb=be.uni(be.sub(gb,kc));const Fc=be.add(Sa.point,Sa.handles.start.point),Lc=be.add(Sa.point,Sa.handles.end.point);jb=this.bindableShapeIds.map(ud=>this.app.getShapeById(ud)).sort((ud,Jd)=>Jd.nonce-ud.nonce).filter(ud=>![Fc,Lc].every(Jd=>ud.hitTestPoint(Jd)));for(const ud of jb)if(Wb=
Hc(Ka.props,ud,this.handleId,this.draggedBindingId,gb,kc,bb,ja))break}Wb?(rc[this.draggedBindingId]=Wb,Sa=Vl(Sa,{handles:{[this.handleId]:{bindingId:this.draggedBindingId}}})):(Ka=Ka.props.handles[this.handleId].bindingId,void 0!==Ka&&(delete rc[Ka],Sa=Vl(Sa,{handles:{[this.handleId]:{bindingId:void 0}}})));gc=this.currentShape.getHandlesChange(Sa,Sa.handles);Gc(()=>{var Fc;if(gc){this.currentShape.update(gc);this.app.currentPage.updateBindings(rc);const Lc=Object.values(null!=(Fc=gc.handles)?Fc:
{}).map(ud=>ud.bindingId).map(ud=>this.app.currentPage.bindings[ud]).filter(Boolean).flatMap(ud=>[ud.toId,ud.fromId].filter(Boolean));this.app.setBindingShapes(Lc)}})}}});hb(this,"onPointerUp",()=>{this.tool.transition("idle");this.currentShape&&this.app.setSelectedShapes([this.currentShape]);this.app.transition("select");this.app.persist()});hb(this,"onExit",()=>{this.app.clearBindingShape();this.app.history.resume();this.app.persist()});hb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.deleteShapes([this.currentShape]),
this.tool.transition("idle")}})}};hb(Xw,"id","creating");var Bz=class extends Xw{constructor(){super(...arguments);hb(this,"onEnter",()=>{var a;this.app.history.pause();this.newStartBindingId=qk();this.draggedBindingId=qk();this.bindableShapeIds=this.app.currentPage.getBindableShapes();var {Shape:d}=this.tool;const {originPoint:l}=this.app.inputs;d=new d(ff(Zd({},d.defaultProps),{id:qk(),type:d.id,parentId:this.app.currentPage.id,point:this.app.settings.snapToGrid?be.snap(l,8):l,fill:this.app.settings.color,
stroke:this.app.settings.color,scaleLevel:this.app.settings.scaleLevel}));this.initialShape=jc(d.props);this.currentShape=d;this.app.currentPage.addShapes(d);this.app.setSelectedShapes([d]);if(this.startBindingShapeId=null==(a=this.bindableShapeIds.map(K=>this.app.getShapeById(K)).filter(K=>Fk.pointInBounds(l,K.bounds))[0])?void 0:a.id)this.bindableShapeIds.splice(this.bindableShapeIds.indexOf(this.startBindingShapeId),1),this.app.setBindingShapes([this.startBindingShapeId])})}};hb(Bz,"id","creating");
var Cz=class extends Xh{constructor(){super(...arguments);hb(this,"onPointerDown",(a,d)=>{a.order||this.tool.transition("pointing")});hb(this,"onPinchStart",(...a)=>{var d,l;this.app.transition("select",{returnTo:this.app.currentState.id});null==(l=(d=this.app._events).onPinchStart)?void 0:l.call(d,...a)});hb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}});hb(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)}});hb(this,"onPointerLeave",a=>{a.order||"shape"===a.type&&this.app.hoveredId&&this.app.setHoveredShape(void 0)})}};hb(Cz,"id","idle");var Dz=class extends Xh{constructor(){super(...arguments);hb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&!this.app.readOnly&&(this.tool.transition("creating"),this.app.setSelectedShapes(this.app.currentPage.shapes))})}};
hb(Dz,"id","pointing");var av=class extends Xp{constructor(){super(...arguments);hb(this,"cursor","crosshair")}};hb(av,"id","line");hb(av,"states",[Cz,Dz,Bz]);hb(av,"initial","idle");var Ez=class extends Xh{constructor(){super(...arguments);hb(this,"cursor","crosshair");hb(this,"creatingShape");hb(this,"aspectRatio");hb(this,"initialBounds",{});hb(this,"onEnter",()=>{const {currentPage:a,inputs:{originPoint:d}}=this.app,{Shape:l}=this.tool,K=new l({id:qk(),type:l.id,parentId:a.id,point:[...d],text:"",
size:[16,32],isSizeLocked:!0,fill:this.app.settings.color,stroke:this.app.settings.color});this.creatingShape=K;this.creatingShape.setScaleLevel(this.app.settings.scaleLevel);Gc(()=>{this.app.currentPage.addShapes(K);const da=this.app.settings.snapToGrid?be.snap([...d],8):d,{bounds:ja}=K;K.update({point:be.sub(da,[ja.width/2,ja.height/2])});this.app.transition("select");this.app.setSelectedShapes([K]);this.app.currentState.transition("editingShape",{type:"shape",shape:this.creatingShape,order:0})})})}};
hb(Ez,"id","creating");var Fz=class extends Xh{constructor(){super(...arguments);hb(this,"onPointerDown",(a,d)=>{a.order||this.app.readOnly||this.tool.transition("creating")});hb(this,"onPinchStart",(...a)=>{var d,l;this.app.transition("select",{returnTo:this.app.currentState.id});null==(l=(d=this.app._events).onPinchStart)?void 0:l.call(d,...a)});hb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}})}};hb(Fz,"id","idle");var bv=class extends Xp{constructor(){super(...arguments);
hb(this,"cursor","crosshair")}};hb(bv,"id","box");hb(bv,"states",[Fz,Ez]);hb(bv,"initial","idle");var pE=Kf(zD()),qE=class extends pE.default{constructor(){super(...arguments);hb(this,"toBBox",a=>a.rotatedBounds)}},Gz=class extends Xh{constructor(){super(...arguments);hb(this,"initialSelectedIds",[]);hb(this,"initialSelectedShapes",[]);hb(this,"tree",new qE);hb(this,"onEnter",()=>{const {selectedShapes:a,currentPage:d,selectedIds:l}=this.app;this.initialSelectedIds=Array.from(l.values());this.initialSelectedShapes=
Array.from(a.values());this.tree.load(d.shapes)});hb(this,"onExit",()=>{this.initialSelectedIds=[];this.tree.clear();this.app.setBrush(void 0)});hb(this,"onPointerMove",()=>{const {inputs:{shiftKey:a,ctrlKey:d,originPoint:l,currentPoint:K}}=this.app,da=sf.getBoundsFromPoints([K,l],0);this.app.setBrush(da);const ja=[...(new Set(this.tree.search(da).filter(ra=>d?sf.boundsContain(da,ra.rotatedBounds):ra.hitTestBounds(da)).filter(ra=>"group"!==ra.type).map(ra=>{var Ka;return null!=(Ka=this.app.getParentGroup(ra))?
Ka:ra})))];a?ja.every(ra=>this.initialSelectedShapes.includes(ra))?this.app.setSelectedShapes(this.initialSelectedShapes.filter(ra=>!ja.includes(ra))):this.app.setSelectedShapes([...(new Set([...this.initialSelectedShapes,...ja]))]):this.app.setSelectedShapes(ja);this.app.viewport.panToPointWhenNearBounds(K)});hb(this,"onPointerUp",()=>{this.app.setBrush(void 0);this.tool.transition("idle")});hb(this,"handleModifierKey",(a,d)=>{switch(d.key){case "Escape":this.app.setBrush(void 0),this.app.setSelectedShapes(this.initialSelectedIds),
this.tool.transition("idle")}})}};hb(Gz,"id","brushing");var Hz=class extends Xh{constructor(){super(...arguments);hb(this,"onEnter",a=>{var d;const {selectedIds:l,inputs:{shiftKey:K}}=this.app;if("shape"===a.type&&!l.has(a.shape.id)){const da=null!=(d=this.app.getParentGroup(a.shape))?d:a.shape;K?this.app.setSelectedShapes([...Array.from(l.values()),da.id]):this.app.setSelectedShapes([da])}});hb(this,"onPointerDown",()=>{this.tool.transition("idle")})}};hb(Hz,"id","contextMenu");var Iz=class extends Xh{constructor(){super(...arguments);
hb(this,"onEnter",a=>{"pinching"===a.fromId&&this.parent.returnTo&&this.app.transition(this.parent.returnTo)});hb(this,"onExit",()=>{});hb(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)}});hb(this,"onPointerDown",(a,d)=>{const {selectedShapes:l,inputs:{ctrlKey:K}}=this.app;
if(2===d.button)this.tool.transition("contextMenu",a);else if(K)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(l.has(a.shape))this.tool.transition("pointingSelectedShape",a);else{const {selectionBounds:da,inputs:ja}=this.app;
da&&Fk.pointInBounds(ja.currentPoint,da)?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",Zd(Zd({},d),a))}});hb(this,"onPointerLeave",a=>{a.order||"shape"===a.type&&this.app.hoveredId&&this.app.setHoveredShape(void 0)});hb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",
{info:a,event:d})});hb(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})}}});hb(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([])}})}};hb(Iz,"id","idle");var Jz=class extends Xh{constructor(){super(...arguments);hb(this,"onEnter",a=>{var d;const {selectedIds:l,inputs:{shiftKey:K}}=this.app,da=null!=(d=this.app.getParentGroup(a.shape))?d:a.shape;K?this.app.setSelectedShapes([...Array.from(l.values()),da.id]):this.app.setSelectedShapes([da])});hb(this,"onPointerMove",()=>{const {currentPoint:a,
originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&!this.app.readOnly&&this.tool.transition("translating")});hb(this,"onPointerUp",()=>{this.tool.transition("idle")});hb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};hb(Jz,"id","pointingShape");var Kz=class extends Xh{constructor(){super(...arguments);hb(this,"cursor","move");hb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&!this.app.readOnly&&this.tool.transition("translating")});
hb(this,"onPointerUp",()=>{this.app.setSelectedShapes([]);this.tool.transition("idle")});hb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};hb(Kz,"id","pointingBoundsBackground");var Lz=class extends Xh{constructor(){super(...arguments);hb(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())});hb(this,"onPointerMove",()=>{const {currentPoint:a,
originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&this.tool.transition("brushing")});hb(this,"onPointerUp",()=>{this.app.inputs.shiftKey||this.app.setSelectedShapes([]);this.tool.transition("idle")});hb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});hb(this,"onDoubleClick",()=>{this.app.notify("canvas-dbclick",{point:this.app.inputs.originPoint})})}};hb(Lz,"id","pointingCanvas");var Mz=class extends Xh{constructor(){super(...arguments);hb(this,"cursor","move");hb(this,
"isCloning",!1);hb(this,"didClone",!1);hb(this,"initialPoints",{});hb(this,"initialShapePoints",{});hb(this,"initialClonePoints",{});hb(this,"clones",[]);hb(this,"onEnter",()=>{var a;this.app.history.pause();const {allSelectedShapesArray:d,inputs:l}=this.app;this.initialPoints=this.initialShapePoints=Object.fromEntries(d.map(({id:K,props:{point:da}})=>[K,da.slice()]));document.querySelectorAll("input,textarea").forEach(K=>K.blur());null==(a=document.getSelection())?void 0:a.empty();l.altKey?this.startCloning():
this.moveSelectedShapesToPointer()});hb(this,"onExit",()=>{this.app.history.resume();this.isCloning=this.didClone=!1;this.clones=[];this.initialPoints={};this.initialShapePoints={};this.initialClonePoints={}});hb(this,"onPointerMove",()=>{const {inputs:{currentPoint:a}}=this.app;this.moveSelectedShapesToPointer();this.app.viewport.panToPointWhenNearBounds(a)});hb(this,"onPointerDown",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});hb(this,"onPointerUp",()=>{this.app.history.resume();
this.app.persist();this.tool.transition("idle")});hb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Alt":this.startCloning();break;case "Escape":this.app.allSelectedShapes.forEach(l=>{l.update({point:this.initialPoints[l.id]})}),this.tool.transition("idle")}});hb(this,"onKeyUp",(a,d)=>{switch(d.key){case "Alt":if(!this.isCloning)throw Error("Expected to be cloning.");const {currentPage:l,allSelectedShapes:K}=this.app;l.removeShapes(...K);this.initialPoints=this.initialShapePoints;this.app.setSelectedShapes(Object.keys(this.initialPoints));
this.moveSelectedShapesToPointer();this.isCloning=!1}})}moveSelectedShapesToPointer(){const {inputs:{shiftKey:a,originPoint:d,currentPoint:l}}=this.app,{initialPoints:K}=this,da=yd.sub(l,d);a&&(Math.abs(da[0])<Math.abs(da[1])?da[0]=0:da[1]=0);Gc(()=>{this.app.allSelectedShapesArray.filter(ja=>!ja.props.isLocked).forEach(ja=>{let ra=yd.add(K[ja.id],da);this.app.settings.snapToGrid&&(ra=yd.snap(ra,8));ja.update({point:ra})})})}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(ff(Zd({},a.serialized),{id:qk(),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}};hb(Mz,"id","translating");var Nz=class extends Xh{constructor(){super(...arguments);hb(this,"pointedSelectedShape");hb(this,"onEnter",a=>{this.pointedSelectedShape=a.shape});hb(this,"onExit",()=>{this.pointedSelectedShape=void 0});hb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&!this.app.readOnly&&this.tool.transition("translating")});
hb(this,"onPointerUp",()=>{const {shiftKey:a,currentPoint:d}=this.app.inputs;var {selectedShapesArray:l}=this.app;if(!this.pointedSelectedShape)throw Error("Expected a pointed selected shape");if(a)({selectedIds:l}=this.app),l=Array.from(l.values()),l.splice(l.indexOf(this.pointedSelectedShape.id),1),this.app.setSelectedShapes(l);else{if(1===l.length&&this.pointedSelectedShape.canEdit&&!this.app.readOnly&&!this.pointedSelectedShape.props.isLocked&&this.pointedSelectedShape instanceof fm&&Fk.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")});hb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};hb(Nz,"id","pointingSelectedShape");var Oz=class extends Xh{constructor(){super(...arguments);hb(this,"info",{});hb(this,"onEnter",a=>{this.info=a;this.updateCursor()});hb(this,"onExit",()=>{this.app.cursors.reset()});
hb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&this.tool.transition("resizing",this.info)});hb(this,"onPointerUp",()=>{this.tool.transition("hoveringSelectionHandle",this.info)});hb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}updateCursor(){this.app.cursors.setCursor(Qu[this.info.handle],this.app.selectionBounds.rotation)}};hb(Oz,"id","pointingResizeHandle");var Pz=class extends Xh{constructor(){super(...arguments);
hb(this,"isSingle",!1);hb(this,"handle","bottom_right_corner");hb(this,"snapshots",{});hb(this,"initialCommonBounds",{});hb(this,"selectionRotation",0);hb(this,"resizeType","corner");hb(this,"onEnter",a=>{var d,l;const {history:K,selectedShapesArray:da,selectionBounds:ja}=this.app;if(!ja)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(Pz.CURSORS[a.handle],null==(d=this.app.selectionBounds)?void 0:d.rotation);K.pause();const ra=sf.getBoundsFromPoints(da.map(Ka=>sf.getBoundsCenter(Ka.bounds)));this.selectionRotation=(this.isSingle=1===da.length)?null!=(l=da[0].props.rotation)?l:0:0;this.initialCommonBounds=Zd({},ja);this.snapshots=Object.fromEntries(da.map(Ka=>{const Sa=Zd({},Ka.bounds),[bb,gb]=sf.getBoundsCenter(Sa);return[Ka.id,{props:Ka.serialized,bounds:Sa,transformOrigin:[(bb-this.initialCommonBounds.minX)/
this.initialCommonBounds.width,(gb-this.initialCommonBounds.minY)/this.initialCommonBounds.height],innerTransformOrigin:[(bb-ra.minX)/ra.width,(gb-ra.minY)/ra.height],isAspectRatioLocked:Ka.props.isAspectRatioLocked||!(Ka.canChangeAspectRatio&&!Ka.props.rotation)}]}));da.forEach(Ka=>{var Sa;null==(Sa=Ka.onResizeStart)?void 0:Sa.call(Ka,{isSingle:this.isSingle})})});hb(this,"onExit",()=>{this.app.cursors.reset();this.snapshots={};this.initialCommonBounds={};this.selectionRotation=0;this.app.history.resume()});
hb(this,"onPointerMove",()=>{const {inputs:{altKey:a,shiftKey:d,ctrlKey:l,originPoint:K,currentPoint:da}}=this.app,{handle:ja,snapshots:ra,initialCommonBounds:Ka}=this;let Sa=yd.sub(da,K);a&&(Sa=yd.mul(Sa,2));const bb=this.app.selectedShapes.values().next().value;let gb=sf.getTransformedBoundingBox(Ka,ja,Sa,this.selectionRotation,d||this.isSingle&&(l?!("clipping"in bb.props):!bb.canChangeAspectRatio||bb.props.isAspectRatioLocked));a&&(gb=Zd(Zd({},gb),sf.centerBounds(gb,sf.getBoundsCenter(Ka))));const {scaleX:jb,
scaleY:Jb}=gb;this.app.selectedShapes.forEach(Ob=>{var Lb,gc;const {isAspectRatioLocked:rc,props:Wb,bounds:kc,transformOrigin:hc}=ra[Ob.id];let Fc=sf.getRelativeTransformedBoundingBox(gb,Ka,kc,0>jb,0>Jb);if(Ob.canResize.some(Jd=>Jd)||Ob.props.isSizeLocked||!this.isSingle){var Lc=[jb,Jb],ud=null!=(Lb=Wb.rotation)?Lb:0;Lb=sf.getBoundsCenter(Fc);Ob.canFlip||(Lc=yd.abs(Lc));Ob.canScale||(Lc=null!=(gc=Wb.scale)?gc:[1,1]);if(ud&&0>jb&&0<=Jb||0>Jb&&0<=jb)ud*=-1;this.app.settings.snapToGrid&&!rc&&(Fc=sf.snapBoundsToGrid(Fc,
8));Ob.onResize(Wb,{center:Lb,rotation:ud,scale:Lc,bounds:Fc,type:ja,clip:l,transformOrigin:hc})}});this.updateCursor(jb,Jb);this.app.viewport.panToPointWhenNearBounds(da)});hb(this,"onPointerUp",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});hb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.selectedShapes.forEach(l=>{l.update(Zd({},this.snapshots[l.id].props))}),this.tool.transition("idle")}})}updateCursor(a,d){var l,K,da,ja;const ra=0>a&&0<=d;a=0>
d&&0<=a;switch(this.handle){case "top_left_corner":case "bottom_right_corner":ra||a?"nwse-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nesw-resize",null==(l=this.app.selectionBounds)?void 0:l.rotation):"nesw-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nwse-resize",null==(K=this.app.selectionBounds)?void 0:K.rotation);break;case "top_right_corner":case "bottom_left_corner":ra||a?"nesw-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nwse-resize",null==
(da=this.app.selectionBounds)?void 0:da.rotation):"nwse-resize"===this.app.cursors.cursor&&this.app.cursors.setCursor("nesw-resize",null==(ja=this.app.selectionBounds)?void 0:ja.rotation)}}},Yw=Pz;hb(Yw,"id","resizing");hb(Yw,"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 Qz=class extends Xh{constructor(){super(...arguments);
hb(this,"cursor","rotate");hb(this,"handle","");hb(this,"onEnter",a=>{this.app.history.pause();this.handle=a.handle;this.updateCursor()});hb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&this.tool.transition("rotating",{handle:this.handle})});hb(this,"onPointerUp",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});hb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}updateCursor(){this.app.cursors.setCursor(Qu[this.handle],
this.app.selectionRotation)}};hb(Qz,"id","pointingRotateHandle");var Rz=class extends Xh{constructor(){super(...arguments);hb(this,"info",{});hb(this,"onEnter",a=>{this.info=a});hb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&!this.app.readOnly&&this.tool.transition("translating")});hb(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")});hb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};hb(Rz,"id","pointingShapeBehindBounds");var Zw=class extends Xh{constructor(){super(...arguments);hb(this,"cursor","rotate");hb(this,"snapshot",{});hb(this,"initialCommonCenter",[0,0]);hb(this,"initialCommonBounds",{});hb(this,"initialAngle",0);hb(this,"initialSelectionRotation",0);hb(this,"handle","");hb(this,"onEnter",a=>{const {history:d,selectedShapesArray:l,selectionBounds:K}=this.app;
if(!K)throw Error("Expected selected bounds.");d.pause();this.handle=a.handle;this.initialSelectionRotation=this.app.selectionRotation;this.initialCommonBounds=Zd({},K);this.initialCommonCenter=sf.getBoundsCenter(K);this.initialAngle=yd.angle(this.initialCommonCenter,this.app.inputs.currentPoint);this.snapshot=Object.fromEntries(l.map(da=>[da.id,{point:[...da.props.point],center:[...da.center],rotation:da.props.rotation,handles:"handles"in da?ir(da.handles):void 0}]));this.updateCursor()});hb(this,
"onExit",()=>{this.app.history.resume();this.snapshot={}});hb(this,"onPointerMove",()=>{const {selectedShapes:a,inputs:{shiftKey:d,currentPoint:l}}=this.app,{snapshot:K,initialCommonCenter:da,initialAngle:ja,initialSelectionRotation:ra}=this;let Ka=yd.angle(da,l)-ja;d&&(Ka=Ml.snapAngleToSegments(Ka,24));a.forEach(bb=>{var gb=K[bb.id];let jb=0;if(d){var {rotation:Jb=0}=gb;jb=Ml.snapAngleToSegments(Jb,24)-Jb}const Ob=yd.sub(gb.center,gb.point);Jb=yd.rotWith(gb.center,da,Ka);if("handles"in bb){gb=gb.handles;
const Lb=gb.map(rc=>yd.rotWith(rc.point,Ob,Ka)),gc=sf.getCommonTopLeft(Lb);bb.update({point:yd.add(gc,yd.sub(Jb,Ob)),handles:gb.map((rc,Wb)=>ff(Zd({},rc),{point:yd.sub(Lb[Wb],gc)}))})}else bb.update({point:yd.sub(Jb,Ob),rotation:Ml.clampRadians((gb.rotation||0)+Ka+jb)})});const Sa=Ml.clampRadians(ra+Ka);this.app.setSelectionRotation(d?Ml.snapAngleToSegments(Sa,24):Sa);this.updateCursor()});hb(this,"onPointerUp",()=>{this.app.history.resume();this.app.persist();this.tool.transition("idle")});hb(this,
"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.selectedShapes.forEach(l=>{l.update(this.snapshot[l.id])}),this.tool.transition("idle")}})}updateCursor(){this.app.cursors.setCursor(Qu[this.handle],this.app.selectionRotation)}};hb(Zw,"id","rotating");var Sz=class extends Xh{constructor(){super(...arguments);hb(this,"onPinch",(a,d)=>{this.app.viewport.pinchZoom(a.point,a.delta,a.delta[2])});hb(this,"onPinchEnd",()=>{this.tool.transition("idle")});hb(this,"onPointerDown",()=>{this.tool.transition("idle")})}};
hb(Sz,"id","pinching");var Tz=class extends Xw{constructor(){super(...arguments);hb(this,"cursor","grabbing");hb(this,"onEnter",a=>{this.app.history.pause();this.newStartBindingId=qk();this.draggedBindingId=qk();this.bindableShapeIds=this.app.currentPage.getBindableShapes();this.handleId=a.id;this.currentShape=a.shape;this.initialShape=jc(this.currentShape.props);this.app.setSelectedShapes([this.currentShape])})}};hb(Tz,"id","translatingHandle");var Uz=class extends Xh{constructor(){super(...arguments);
hb(this,"cursor","grabbing");hb(this,"info",{});hb(this,"onEnter",a=>{this.info=a});hb(this,"onPointerMove",()=>{const {currentPoint:a,originPoint:d}=this.app.inputs;5<yd.dist(a,d)&&this.tool.transition("translatingHandle",this.info)});hb(this,"onPointerUp",()=>{this.tool.transition("idle")});hb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};hb(Uz,"id","pointingHandle");var Vz=class extends Xh{constructor(){super(...arguments);hb(this,"handle");hb(this,"onEnter",
a=>{var d;this.app.cursors.setCursor(Qu[a.handle],null!=(d=this.app.selectionBounds.rotation)?d:0);this.handle=a.handle});hb(this,"onExit",()=>{this.app.cursors.reset()});hb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});hb(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)}}});hb(this,"onPointerLeave",()=>{this.tool.transition("idle")});hb(this,"onDoubleClick",a=>{var d;if(!a.order&&1===this.app.selectedShapes.size){var l=this.app.selectedShapes.values().next().value;if(!l.canEdit||this.app.readOnly||l.props.isLocked)l.onResetBounds({asset:l.props.assetId?this.app.assets[l.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=l.onResetBounds)?void 0:d.call(l,{zoom:this.app.viewport.camera.zoom}),1===this.app.selectedShapesArray.length&&this.tool.transition("editingShape",{type:"shape",target:l})}}})}};hb(Vz,"id","hoveringSelectionHandle");var Wz=class extends Xh{constructor(){super(...arguments);hb(this,"editingShape",{});hb(this,"onEnter",a=>{this.editingShape=a.shape;this.app.setEditingShape(a.shape)});hb(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()});hb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})});hb(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)}});hb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":Gc(()=>{d.stopPropagation();this.app.setSelectedShapes([this.editingShape]);this.tool.transition("idle")})}})}};hb(Wz,"id","editingShape");var Xz=class extends Xh{constructor(){super(...arguments);hb(this,"minimapZoom",1);hb(this,"minimapRect",{minX:0,minY:0,maxX:0,maxY:0,width:0,height:0});hb(this,"getCameraPoint",a=>{const d=document.querySelector(".tl-preview-minimap svg");
var l=document.querySelector(".tl-preview-minimap #minimap-camera-rect");if(d&&l){const K=d.getBoundingClientRect();this.minimapRect.height=K.height;this.minimapRect.width=K.width;this.minimapRect.minX=K.left;this.minimapRect.minY=K.top;this.minimapRect.maxX=K.right;this.minimapRect.maxY=K.bottom;this.minimapZoom=+d.dataset.commonBoundWidth/this.minimapRect.width;a=yd.sub(a,[this.minimapRect.minX,this.minimapRect.minY]);l=l.getBoundingClientRect();l=yd.mul(yd.sub(a,[l.left+l.width/2,l.top+l.height/
2]),this.minimapZoom);return yd.sub(this.app.viewport.camera.point,l)}});hb(this,"onEnter",a=>{(a=this.getCameraPoint([a.clientX,a.clientY]))?this.app.viewport.update({point:a}):this.tool.transition("idle")});hb(this,"onPointerMove",(a,d)=>{"clientX"in d&&(a=this.getCameraPoint([d.clientX,d.clientY]))&&this.app.viewport.update({point:a})});hb(this,"onPointerUp",()=>{this.tool.transition("idle")})}};hb(Xz,"id","pointingMinimap");var is=class extends Xp{constructor(){super(...arguments);hb(this,"returnTo",
"");hb(this,"onEnter",a=>{this.returnTo=null==a?void 0:a.returnTo})}};hb(is,"id","select");hb(is,"initial","idle");hb(is,"shortcut","whiteboard/select");hb(is,"states",[Iz,Gz,Hz,Lz,Jz,Rz,Nz,Kz,Vz,Oz,Qz,Xz,Uz,Tz,Mz,Yw,Zw,Zw,Sz,Wz]);var Yz=class extends Xh{constructor(){super(...arguments);hb(this,"cursor","grabbing");hb(this,"originalScreenPoint",[]);hb(this,"originalCameraPoint",[]);hb(this,"prevState","idle");hb(this,"onEnter",a=>{this.prevState=null==a?void 0:a.prevState;this.originalScreenPoint=
this.app.inputs.currentScreenPoint;this.originalCameraPoint=this.app.viewport.camera.point});hb(this,"onPointerMove",(a,d)=>{a=be.sub(this.originalScreenPoint,this.app.inputs.currentScreenPoint);this.app.viewport.update({point:be.sub(this.originalCameraPoint,be.div(a,this.app.viewport.camera.zoom))})});hb(this,"onPointerUp",()=>{var a;this.tool.transition(null!=(a=this.prevState)?a:"idle")})}};hb(Yz,"id","panning");var Zz=class extends Xh{constructor(){super(...arguments);hb(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)}))});hb(this,"onPointerDown",(a,d)=>{a.order||this.tool.transition("panning")})}};hb(Zz,"id","idle");var $z=class extends Xh{constructor(){super(...arguments);hb(this,"onPointerDown",(a,d)=>{a.order||this.tool.transition("panning",{prevState:"idleHold"})});hb(this,"onPinchStart",(a,d)=>{this.tool.transition("pinching",{info:a,event:d})})}};hb($z,
"id","idleHold");var aA=class extends Xh{constructor(){super(...arguments);hb(this,"origin",[0,0]);hb(this,"prevDelta",[0,0]);hb(this,"onEnter",a=>{this.prevDelta=a.info.delta;this.origin=a.info.point});hb(this,"onPinch",a=>{this.app.viewport.pinchZoom(a.point,a.delta,a.delta[2])});hb(this,"onPinchEnd",()=>{this.tool.transition("idle")})}};hb(aA,"id","pinching");var js=class extends Xp{constructor(){super(...arguments);hb(this,"cursor","grab");hb(this,"prevTool",null);hb(this,"onEnter",a=>{this.prevTool=
null==a?void 0:a.prevTool});hb(this,"onKeyDown",(a,d)=>{switch(d.key){case "Escape":this.app.transition("select")}});hb(this,"onPinchStart",(a,d)=>{this.transition("pinching",{info:a,event:d})})}};hb(js,"id","move");hb(js,"shortcut","whiteboard/pan");hb(js,"states",[Zz,$z,Yz,aA]);hb(js,"initial","idle");var gl=class{constructor(a,d={}){hb(this,"lastShapesNounces",null);hb(this,"app");hb(this,"id");hb(this,"name");hb(this,"shapes",[]);hb(this,"bindings",{});hb(this,"nonce",0);hb(this,"bringForward",
Ka=>{const Sa=this.parseShapesArg(Ka);Sa.sort((bb,gb)=>this.shapes.indexOf(gb)-this.shapes.indexOf(bb)).map(bb=>this.shapes.indexOf(bb)).forEach(bb=>{if(bb!==this.shapes.length-1&&!Sa.includes(this.shapes[bb+1])){var gb=this.shapes[bb];this.shapes[bb]=this.shapes[bb+1];this.shapes[bb+1]=gb}});this.app.persist();return this});hb(this,"sendBackward",Ka=>{const Sa=this.parseShapesArg(Ka);Sa.sort((bb,gb)=>this.shapes.indexOf(bb)-this.shapes.indexOf(gb)).map(bb=>this.shapes.indexOf(bb)).forEach(bb=>{if(0!==
bb&&!Sa.includes(this.shapes[bb-1])){var gb=this.shapes[bb];this.shapes[bb]=this.shapes[bb-1];this.shapes[bb-1]=gb}});this.app.persist();return this});hb(this,"bringToFront",Ka=>{const Sa=this.parseShapesArg(Ka);this.shapes=this.shapes.filter(bb=>!Sa.includes(bb)).concat(Sa);this.app.persist();return this});hb(this,"sendToBack",Ka=>{const Sa=this.parseShapesArg(Ka);this.shapes=Sa.concat(this.shapes.filter(bb=>!Sa.includes(bb)));this.app.persist();return this});hb(this,"flip",(Ka,Sa)=>{Ka=this.parseShapesArg(Ka);
const bb=sf.getCommonBounds(Ka.map(gb=>gb.bounds));Ka.forEach(gb=>{var jb;const Jb=sf.getRelativeTransformedBoundingBox(bb,bb,gb.bounds,"horizontal"===Sa,"vertical"===Sa);if(gb.serialized)gb.onResize(gb.serialized,{bounds:Jb,center:sf.getBoundsCenter(Jb),rotation:null!=(jb=gb.props.rotation)?jb:-0,type:"top_left_corner",scale:gb.canFlip&&gb.props.scale?"horizontal"===Sa?[-gb.props.scale[0],1]:[1,-gb.props.scale[1]]:[1,1],clip:!1,transformOrigin:[.5,.5]})});this.app.persist();return this});hb(this,
"getShapeById",Ka=>this.shapes.find(Sa=>Sa.id===Ka));hb(this,"cleanup",Ka=>{Ka=ac(this.bindings,Ka);const Sa=new Set;let bb=!1,gb=!1;const jb=ir(this.bindings);Ka.forEach(Jb=>{var Ob;if(this.bindings[Jb.id]){var Lb=this.getShapeById(Jb.toId),gc=this.getShapeById(Jb.fromId);Lb&&gc?Sa.has(gc.id)||(Jb=this.updateArrowBindings(gc),Sa.add(gc.id),Jb&&(Lb=Zd(Zd({},gc.props),Jb),bb=!0,null==(Ob=this.getShapeById(Lb.id))?void 0:Ob.update(Lb,!1,(0,HE.default)(null==Jb?void 0:Jb.handles,null==gc?void 0:gc.props.handles)))):
(delete jb[Jb.id],gb=!0)}});Object.keys(jb).forEach(Jb=>{const Ob=this.bindings[Jb];0===this.shapes.filter(Lb=>Lb.id===Ob.fromId||Lb.id===Ob.toId).length&&(delete jb[Jb],gb=!0)});gb&&this.update({bindings:jb});(bb||gb)&&this.app.persist(!0)});hb(this,"updateArrowBindings",Ka=>{var Sa,bb,gb,jb={start:ir(Ka.props.handles.start),end:ir(Ka.props.handles.end)},Jb={isBound:!1,handle:Ka.props.handles.start,point:be.add(Ka.props.handles.start.point,Ka.props.point)},Ob={isBound:!1,handle:Ka.props.handles.end,
point:be.add(Ka.props.handles.end.point,Ka.props.point)};if(Ka.props.handles.start.bindingId){var Lb=void 0!==(null==(Sa=Ka.props.decorations)?void 0:Sa.start);Sa=Ka.props.handles.start;var gc=this.bindings[Ka.props.handles.start.bindingId],rc=this.getShapeById(null==gc?void 0:gc.toId);if(rc){Jb=rc.getBounds();var Wb=rc.getExpandedBounds(),kc=sf.expandBounds(Jb,Lb?gc.distance:1);const {minX:hc,minY:Fc,width:Lc,height:ud}=Wb,Jd=be.add([hc,Fc],be.mulV([Lc,ud],be.rotWith(gc.point,[.5,.5],rc.props.rotation||
0)));Jb={isBound:!0,hasDecoration:Lb,binding:gc,handle:Sa,point:Jd,target:rc,bounds:Jb,expandedBounds:Wb,intersectBounds:kc,center:rc.getCenter()}}}if(Ka.props.handles.end.bindingId&&(Lb=void 0!==(null==(bb=Ka.props.decorations)?void 0:bb.end),bb=Ka.props.handles.end,Sa=this.bindings[Ka.props.handles.end.bindingId],gc=this.getShapeById(null==Sa?void 0:Sa.toId))){Ob=gc.getBounds();rc=gc.getExpandedBounds();Wb=Lb?sf.expandBounds(Ob,Sa.distance):Ob;const {minX:hc,minY:Fc,width:Lc,height:ud}=rc;kc=be.add([hc,
Fc],be.mulV([Lc,ud],be.rotWith(Sa.point,[.5,.5],gc.props.rotation||0)));Ob={isBound:!0,hasDecoration:Lb,binding:Sa,handle:bb,point:kc,target:gc,bounds:Ob,expandedBounds:rc,intersectBounds:Wb,center:gc.getCenter()}}for(const hc of["end","start"]){bb="start"===hc?Jb:Ob;const Fc="start"===hc?Ob:Jb;if(bb.isBound)if(bb.binding.distance){if(Lb=be.uni(be.sub(bb.point,Fc.point)),Sa=z(Fc.point,Lb,bb.intersectBounds,bb.target.props.rotation).filter(Lc=>Lc.didIntersect).map(Lc=>Lc.points[0]).sort((Lc,ud)=>be.dist(Lc,
Fc.point)-be.dist(ud,Fc.point)),Sa[0])if(gc=void 0,Fc.isBound&&(gc=z(Fc.point,Lb,Fc.intersectBounds,Fc.target.props.rotation).filter(Lc=>Lc.didIntersect).map(Lc=>Lc.points[0]).sort((Lc,ud)=>be.dist(Lc,Fc.point)-be.dist(ud,Fc.point))[0]),Fc.isBound&&(2>Sa.length||gc&&Sa[0]&&10>Math.ceil(be.dist(Sa[0],gc))||sf.boundsContain(bb.expandedBounds,Fc.expandedBounds)||sf.boundsCollide(bb.expandedBounds,Fc.expandedBounds)))Lb=be.uni(be.sub(Fc.point,bb.point)),Sa=z(bb.point,Lb,bb.bounds,bb.target.props.rotation).filter(Lc=>
Lc.didIntersect).map(Lc=>Lc.points[0]),Sa[0]&&(jb[hc].point=be.toFixed(be.sub(Sa[0],Ka.props.point)),jb["start"===hc?"end":"start"].point=be.toFixed(be.add(be.sub(Sa[0],Ka.props.point),be.mul(Lb,Math.min(be.dist(Sa[0],Fc.point),10*(sf.boundsContain(Fc.bounds,bb.intersectBounds)?-1:1))))));else{if(!Fc.isBound&&(Sa[0]&&10>be.dist(Sa[0],Fc.point)||Fk.pointInBounds(Fc.point,bb.intersectBounds)))return jb=be.uni(be.sub(bb.center,Fc.point)),null==(gb=Ka.getHandlesChange)?void 0:gb.call(Ka,Ka.props,{[hc]:ff(Zd({},
Ka.props.handles[hc]),{point:be.toFixed(be.add(be.sub(Fc.point,Ka.props.point),be.mul(jb,10)))})});Sa[0]&&(jb[hc].point=be.toFixed(be.sub(Sa[0],Ka.props.point)))}}else jb[hc].point=be.sub(bb.point,Ka.props.point)}return Ka.getHandlesChange(Ka.props,jb)});const {id:l,name:K,shapes:da=[],bindings:ja={},nonce:ra}=d;this.id=l;this.name=K;this.bindings=Object.assign({},ja);this.app=a;this.nonce=ra||0;this.addShapes(...da);Ue(this);ic(()=>{const Ka=0<this.shapes.length?Object.fromEntries(this.shapes.map(Sa=>
[Sa.id,Sa.nonce])):null;if(this.lastShapesNounces&&Ka){const Sa=this.lastShapesNounces,bb=[...(new Set([...Object.keys(Ka),...Object.keys(Sa)]))].filter(gb=>Sa[gb]!==Ka[gb]);requestAnimationFrame(()=>{this.cleanup(bb)})}Ka&&(this.lastShapesNounces=Ka)})}get serialized(){return{id:this.id,name:this.name,shapes:this.shapes.map(a=>a.serialized).filter(a=>!!a).map(a=>jc(a)),bindings:ir(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,l)=>a.indexOf(d.id)-a.indexOf(l.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(l=>!d.includes(l));return d}getBindableShapes(){return this.shapes.filter(a=>
a.canBind).sort((a,d)=>d.nonce-a.nonce).map(a=>a.id)}};fe([yg],gl.prototype,"id",2);fe([yg],gl.prototype,"name",2);fe([yg],gl.prototype,"shapes",2);fe([yg],gl.prototype,"bindings",2);fe([Dg],gl.prototype,"serialized",1);fe([Dg],gl.prototype,"shapesById",1);fe([yg],gl.prototype,"nonce",2);fe([jg],gl.prototype,"update",1);fe([jg],gl.prototype,"updateBindings",1);fe([jg],gl.prototype,"updateShapesIndex",1);fe([jg],gl.prototype,"addShapes",1);fe([jg],gl.prototype,"removeShapes",1);fe([jg],gl.prototype,
"bringForward",2);fe([jg],gl.prototype,"sendBackward",2);fe([jg],gl.prototype,"bringToFront",2);fe([jg],gl.prototype,"sendToBack",2);fe([jg],gl.prototype,"cleanup",2);var Kj=class{constructor(){hb(this,"shiftKey",!1);hb(this,"ctrlKey",!1);hb(this,"modKey",!1);hb(this,"altKey",!1);hb(this,"spaceKey",!1);hb(this,"isPinching",!1);hb(this,"currentScreenPoint",[0,0]);hb(this,"currentPoint",[0,0]);hb(this,"previousScreenPoint",[0,0]);hb(this,"previousPoint",[0,0]);hb(this,"originScreenPoint",[0,0]);hb(this,
"originPoint",[0,0]);hb(this,"pointerIds",new Set);hb(this,"state","idle");hb(this,"containerOffset",[0,0]);hb(this,"onPointerDown",(a,d)=>{this.pointerIds.add(d.pointerId);this.updateModifiers(d);this.originScreenPoint=this.currentScreenPoint;this.originPoint=a;this.state="pointing"});hb(this,"onPointerMove",(a,d)=>{"pinching"!==this.state&&("panning"===this.state&&(this.state="idle"),this.updateModifiers(d),this.previousPoint=this.currentPoint,this.currentPoint=a)});hb(this,"onPointerUp",(a,d)=>
{this.pointerIds.clear();this.updateModifiers(d);this.state="idle"});hb(this,"onKeyDown",a=>{this.updateModifiers(a);switch(a.key){case " ":this.spaceKey=!0}});hb(this,"onKeyUp",a=>{this.updateModifiers(a);switch(a.key){case " ":this.spaceKey=!1}});hb(this,"onPinchStart",(a,d)=>{this.updateModifiers(d);this.state="pinching"});hb(this,"onPinch",(a,d)=>{"pinching"===this.state&&this.updateModifiers(d)});hb(this,"onPinchEnd",(a,d)=>{"pinching"===this.state&&(this.updateModifiers(d),this.state="idle")});
Ue(this)}updateContainerOffset(a){Object.assign(this.containerOffset,a)}updateModifiers(a){a.isPrimary&&("clientX"in a&&(this.previousScreenPoint=this.currentScreenPoint,this.currentScreenPoint=be.sub([a.clientX,a.clientY],this.containerOffset)),"shiftKey"in a&&(this.shiftKey=a.shiftKey,this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.modKey=oh()?a.metaKey:a.ctrlKey))}};fe([yg],Kj.prototype,"shiftKey",2);fe([yg],Kj.prototype,"ctrlKey",2);fe([yg],Kj.prototype,"modKey",2);fe([yg],Kj.prototype,"altKey",
2);fe([yg],Kj.prototype,"spaceKey",2);fe([yg],Kj.prototype,"isPinching",2);fe([yg],Kj.prototype,"currentScreenPoint",2);fe([yg],Kj.prototype,"currentPoint",2);fe([yg],Kj.prototype,"previousScreenPoint",2);fe([yg],Kj.prototype,"previousPoint",2);fe([yg],Kj.prototype,"originScreenPoint",2);fe([yg],Kj.prototype,"originPoint",2);fe([yg],Kj.prototype,"state",2);fe([yg],Kj.prototype,"containerOffset",2);fe([jg],Kj.prototype,"updateContainerOffset",1);fe([jg],Kj.prototype,"updateModifiers",1);fe([jg],Kj.prototype,
"onPointerDown",2);fe([jg],Kj.prototype,"onPointerMove",2);fe([jg],Kj.prototype,"onPointerUp",2);fe([jg],Kj.prototype,"onKeyDown",2);fe([jg],Kj.prototype,"onKeyUp",2);fe([jg],Kj.prototype,"onPinchStart",2);fe([jg],Kj.prototype,"onPinch",2);fe([jg],Kj.prototype,"onPinchEnd",2);var rE=(a,d=100)=>-(Math.cos(Math.PI*yd.clamp(a/d,0,1))-1)/2,hr=class{constructor(){hb(this,"bounds",{minX:0,minY:0,maxX:1080,maxY:720,width:1080,height:720});hb(this,"camera",{point:[0,0],zoom:1});hb(this,"updateBounds",a=>
{this.bounds=a;return this});hb(this,"panCamera",a=>this.update({point:yd.sub(this.camera.point,yd.div(a,this.camera.zoom))}));hb(this,"panToPointWhenNearBounds",a=>{const d=yd.div([hr.panThreshold,hr.panThreshold],this.camera.zoom),l=yd.sub([this.currentView.maxX,this.currentView.maxY],yd.add(a,d));a=yd.sub([this.currentView.minX,this.currentView.minY],yd.sub(a,d));this.panCamera(yd.mul([0>l[0]?l[0]:0<a[0]?a[0]:0,0>l[1]?l[1]:0<a[1]?a[1]:0],-hr.panMultiplier*this.camera.zoom))});hb(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});hb(this,"getPagePoint",a=>{const {camera:d,bounds:l}=this;return yd.sub(yd.div(yd.sub(a,[l.minX,l.minY]),d.zoom),d.point)});hb(this,"getScreenPoint",a=>{const {camera:d}=this;return yd.mul(yd.add(a,d.point),d.zoom)});hb(this,"onZoom",(a,d,l=!1)=>this.pinchZoom(a,[0,0],d,l));hb(this,"pinchZoom",(a,d,l,K=!1)=>{var {camera:da}=this;d=yd.sub(da.point,
yd.div(d,da.zoom));l=yd.clamp(l,hr.minZoom,hr.maxZoom);da=yd.div(a,da.zoom);a=yd.div(a,l);a=yd.toFixed(yd.add(d,yd.sub(a,da)));K?this.animateCamera({point:a,zoom:l}):this.update({point:a,zoom:l});return this});hb(this,"setZoom",(a,d=!1)=>{const {bounds:l}=this;this.onZoom([l.width/2,l.height/2],a,d)});hb(this,"zoomIn",()=>{const {camera:a}=this;this.setZoom(a.zoom/.8,!0)});hb(this,"zoomOut",()=>{const {camera:a}=this;this.setZoom(.8*a.zoom,!0)});hb(this,"resetZoom",()=>{this.setZoom(1,!0);return this});
hb(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}));hb(this,"animateToViewport",a=>{const d=performance.now(),l=Zd({},this.currentView),K=()=>{var da=performance.now()-d;da=rE(da);var ja=l.minX+(a.minX-l.minX)*da;this.update({point:[-ja,-(l.minY+(a.minY-l.minY)*da)],zoom:this.bounds.width/(l.maxX+(a.maxX-l.maxX)*da-ja)});1>da&&requestAnimationFrame(K)};
K()});hb(this,"zoomToBounds",({width:a,height:d,minX:l,minY:K})=>{const {bounds:da,camera:ja}=this;let ra=Math.min((da.width-100)/a,(da.height-100)/d);ra=Math.min(1,Math.max(hr.minZoom,ja.zoom===ra||1>ja.zoom?Math.min(1,ra):ra));a=yd.add([-l,-K],[(da.width-a*ra)/2/ra,(da.height-d*ra)/2/ra]);this.animateCamera({point:a,zoom:ra})});Ue(this)}get currentView(){const {bounds:a,camera:{point:d,zoom:l}}=this,K=a.width/l,da=a.height/l;return{minX:-d[0],minY:-d[1],maxX:K-d[0],maxY:da-d[1],width:K,height:da}}},
Mn=hr;hb(Mn,"minZoom",.1);hb(Mn,"maxZoom",4);hb(Mn,"panMultiplier",.05);hb(Mn,"panThreshold",100);fe([yg],Mn.prototype,"bounds",2);fe([yg],Mn.prototype,"camera",2);fe([jg],Mn.prototype,"updateBounds",2);fe([jg],Mn.prototype,"update",2);fe([Dg],Mn.prototype,"currentView",1);var sE=class{constructor(a){hb(this,"app");hb(this,"editShape",d=>{(null==d?0:d.props.isLocked)||this.app.transition("select").selectedTool.transition("editingShape",{shape:d});return this});hb(this,"hoverShape",d=>{this.app.setHoveredShape(d);
return this});hb(this,"createShapes",(...d)=>{this.app.createShapes(d);return this});hb(this,"updateShapes",(...d)=>{this.app.updateShapes(d);return this});hb(this,"deleteShapes",(...d)=>{this.app.deleteShapes(d.length?d:this.app.selectedShapesArray);return this});hb(this,"selectShapes",(...d)=>{this.app.setSelectedShapes(d);return this});hb(this,"deselectShapes",(...d)=>{const l="string"===typeof d[0]?d:d.map(K=>K.id);this.app.setSelectedShapes(this.app.selectedShapesArray.filter(K=>!l.includes(K.id)));
return this});hb(this,"flipHorizontal",(...d)=>{this.app.flipHorizontal(d);return this});hb(this,"flipVertical",(...d)=>{this.app.flipVertical(d);return this});hb(this,"selectAll",()=>{this.app.setSelectedShapes(this.app.currentPage.shapes.filter(d=>!this.app.shapesInGroups().includes(d)));return this});hb(this,"deselectAll",()=>{this.app.setSelectedShapes([]);return this});hb(this,"zoomIn",()=>{this.app.viewport.zoomIn();return this});hb(this,"zoomOut",()=>{this.app.viewport.zoomOut();return this});
hb(this,"resetZoom",()=>{this.app.viewport.resetZoom();return this});hb(this,"zoomToFit",()=>{var {shapes:d}=this.app.currentPage;if(0===d.length)return this;d=sf.getCommonBounds(d.map(l=>l.bounds));this.app.viewport.zoomToBounds(d);return this});hb(this,"cameraToCenter",()=>{var {shapes:d}=this.app.currentPage;if(0===d.length)return this;d=sf.getCommonBounds(d.map(l=>l.bounds));this.app.viewport.update({point:be.add(be.neg(sf.getBoundsCenter(d)),[this.app.viewport.currentView.width/2,this.app.viewport.currentView.height/
2])});return this});hb(this,"zoomToSelection",()=>{const {selectionBounds:d}=this.app;if(!d)return this;this.app.viewport.zoomToBounds(d);return this});hb(this,"resetZoomToCursor",()=>{this.app.viewport.animateCamera({zoom:1,point:be.sub(this.app.inputs.originScreenPoint,this.app.inputs.originPoint)});return this});hb(this,"toggleGrid",()=>{const {settings:d}=this.app;d.update({showGrid:!d.showGrid});return this});hb(this,"toggleSnapToGrid",()=>{const {settings:d}=this.app;d.update({snapToGrid:!d.snapToGrid});
return this});hb(this,"togglePenMode",()=>{const {settings:d}=this.app;d.update({penMode:!d.penMode});return this});hb(this,"setColor",d=>{const {settings:l}=this.app;l.update({color:d});this.app.selectedShapesArray.forEach(K=>{K.props.isLocked||K.update({fill:d,stroke:d})});this.app.persist();return this});hb(this,"setScaleLevel",d=>{const {settings:l}=this.app;l.update({scaleLevel:d});this.app.selectedShapes.forEach(K=>{K.props.isLocked||K.setScaleLevel(d)});this.app.persist();return this});hb(this,
"undo",()=>{this.app.undo();return this});hb(this,"redo",()=>{this.app.redo();return this});hb(this,"persist",()=>{this.app.persist();return this});hb(this,"createNewLineBinding",(d,l)=>this.app.createNewLineBinding(d,l));hb(this,"clone",d=>{if(!this.app.readOnly&&1===this.app.selectedShapesArray.length&&Object.values(as).some(Jb=>Jb===this.app.selectedShapesArray[0].type)){var l=this.app.allSelectedShapesArray[0],K=this.app.getShapeClass(l.type),{minX:da,minY:ja,maxX:ra,maxY:Ka,width:Sa,height:bb}=
l.bounds,gb=[0,0];switch(d){case "down":gb=[da,Ka+100];break;case "up":gb=[da,ja-100-bb];break;case "left":gb=[da-100-Sa,ja];break;case "right":gb=[ra+100,ja]}var jb=new K(ff(Zd({},l.serialized),{id:qk(),nonce:Date.now(),refs:[],label:"",point:gb}));this.app.history.pause();this.app.currentPage.addShapes(jb);this.app.createNewLineBinding(l,jb);this.app.history.resume();this.app.persist();setTimeout(()=>this.editShape(jb))}});hb(this,"cloneShapes",({shapes:d,assets:l,bindings:K,point:da=[0,0]})=>{const ja=
sf.getCommonBounds(d.filter(Sa=>"group"!==Sa.type).map(Sa=>{var bb,gb,jb,Jb,Ob,Lb,gc,rc,Wb,kc,hc,Fc,Lc,ud,Jd,Ee;return{minX:null!=(gb=null==(bb=Sa.point)?void 0:bb[0])?gb:da[0],minY:null!=(Jb=null==(jb=Sa.point)?void 0:jb[1])?Jb:da[1],width:null!=(Lb=null==(Ob=Sa.size)?void 0:Ob[0])?Lb:4,height:null!=(rc=null==(gc=Sa.size)?void 0:gc[1])?rc:4,maxX:(null!=(kc=null==(Wb=Sa.point)?void 0:Wb[0])?kc:da[0])+(null!=(Fc=null==(hc=Sa.size)?void 0:hc[0])?Fc:4),maxY:(null!=(ud=null==(Lc=Sa.point)?void 0:Lc[1])?
ud:da[1])+(null!=(Ee=null==(Jd=Sa.size)?void 0:Jd[1])?Ee:4)}})),ra=d.map(Sa=>ff(Zd({},Sa),{id:qk(),point:[da[0]+Sa.point[0]-ja.minX,da[1]+Sa.point[1]-ja.minY]}));ra.forEach(Sa=>{var bb;Sa.children&&0<(null==(bb=Sa.children)?void 0:bb.length)&&(Sa.children=Sa.children.map(gb=>{var jb;return null==(jb=ra[d.findIndex(Jb=>Jb.id===gb)])?void 0:jb.id}).filter(cg))});const Ka=[];ra.flatMap(Sa=>{var bb;return Object.values(null!=(bb=Sa.handles)?bb:{})}).forEach(Sa=>{if(Sa.bindingId){var bb=K[Sa.bindingId];
if(bb){var gb=d.findIndex(Jb=>Jb.id===bb.fromId);const jb=d.findIndex(Jb=>Jb.id===bb.toId);bb&&-1!==gb&&-1!==jb?(gb=ff(Zd({},bb),{id:qk(),fromId:ra[gb].id,toId:ra[jb].id}),Ka.push(gb),Sa.bindingId=gb.id):Sa.bindingId=void 0}else console.warn("binding not found",Sa.bindingId)}});l=l.filter(Sa=>ra.some(bb=>bb.assetId===Sa.id));return{shapes:ra,assets:l,bindings:Ka}});hb(this,"getClonedShapesFromTldrString",(d,l)=>{try{{var K;const bb=null==(K=d.match(/<whiteboard-tldr>(.*)<\/whiteboard-tldr>/))?void 0:
K[1];if(bb){try{var da=JSON.parse(bb)}catch(gb){da=null}var ja=da}else ja=void 0}d=ja;if(!d)return null;const {shapes:ra,bindings:Ka,assets:Sa}=d;return this.cloneShapes({shapes:ra,bindings:Ka,assets:Sa,point:l})}catch(ra){console.log(ra)}return null});hb(this,"cloneShapesIntoCurrentPage",d=>{(d=this.cloneShapes(d))&&this.addClonedShapes(d);return this});hb(this,"addClonedShapes",d=>{const {shapes:l,assets:K,bindings:da}=d;0<K.length&&this.app.createAssets(K);0<l.length&&this.app.createShapes(l);
this.app.currentPage.updateBindings(Object.fromEntries(da.map(ja=>[ja.id,ja])));this.app.selectedTool.transition("idle");return this});hb(this,"addClonedShapesFromTldrString",(d,l)=>{(d=this.getClonedShapesFromTldrString(d,l))&&this.addClonedShapes(d);return this});hb(this,"doGroup",(d=this.app.allSelectedShapesArray)=>{if(!this.app.readOnly){var l=[...d.filter(K=>"group"===K.type),...d.map(K=>this.app.getParentGroup(K))].filter(cg);this.app.currentPage.removeShapes(...l);d=d.filter(K=>"group"!==
K.type);1<d.length&&(l=this.app.getShapeClass("group"),l=new l({id:qk(),type:l.id,parentId:this.app.currentPage.id,children:d.map(K=>K.id)}),this.app.currentPage.addShapes(l),this.app.setSelectedShapes([l]),this.app.bringForward(d));this.app.persist()}});hb(this,"unGroup",(d=this.app.allSelectedShapesArray)=>{if(!this.app.readOnly){d=[...d.filter(K=>"group"===K.type),...d.map(K=>this.app.getParentGroup(K))].filter(cg);var l=this.app.shapesInGroups(d);0<d.length&&(this.app.currentPage.removeShapes(...d),
this.app.persist(),this.app.setSelectedShapes(l))}});hb(this,"convertShapes",(d,l=this.app.allSelectedShapesArray)=>{const K=this.app.getShapeClass(d);this.app.currentPage.removeShapes(...l);l=l.map(da=>new K(ff(Zd({},da.serialized),{type:d,nonce:Date.now()})));this.app.currentPage.addShapes(...l);this.app.persist();this.app.setSelectedShapes(l)});hb(this,"setCollapsed",(d,l=this.app.allSelectedShapesArray)=>{l.forEach(K=>{"logseq-portal"===K.props.type&&K.setCollapsed(d)});this.app.persist()});this.app=
a}},ks=class{constructor(){hb(this,"cursor","default");hb(this,"rotation",0);hb(this,"reset",()=>{this.cursor="default"});hb(this,"setCursor",(a,d=0)=>{if(a!==this.cursor||d!==this.rotation)this.cursor=a,this.rotation=d});hb(this,"setRotation",a=>{a!==this.rotation&&(this.rotation=a)});Ue(this)}};fe([yg],ks.prototype,"cursor",2);fe([yg],ks.prototype,"rotation",2);fe([jg],ks.prototype,"reset",2);fe([jg],ks.prototype,"setCursor",2);fe([jg],ks.prototype,"setRotation",2);var ls=class{constructor(a){hb(this,
"app");hb(this,"stack",[]);hb(this,"isPaused",!0);hb(this,"pause",()=>{this.isPaused||(this.isPaused=!0)});hb(this,"resume",()=>{this.isPaused&&(this.isPaused=!1)});hb(this,"persist",(d=!1)=>{this.isPaused||this.creating||this.app.notify("persist",{replace:d})});hb(this,"undo",()=>{this.isPaused||"idle"===this.app.selectedTool.currentState.id&&this.app.appUndo&&this.app.appUndo()});hb(this,"redo",()=>{this.isPaused||"idle"===this.app.selectedTool.currentState.id&&this.app.appRedo&&this.app.appRedo()});
hb(this,"instantiateShape",d=>new (this.app.getShapeClass(d.type))(d));hb(this,"deserialize",d=>{Gc(()=>{var l,{pages:K}=d;const da=this.isPaused;this.pause();const ja=[...this.app.selectedIds];try{const ra=new Map(this.app.pages),Ka=[];for(const Sa of K){const bb=ra.get(Sa.id);if(void 0!==bb){const gb=new Map(bb.shapes.map(jb=>[jb.props.id,jb]));K=[];for(const jb of Sa.shapes){const Jb=gb.get(jb.id);void 0!==Jb?(Jb.nonce!==jb.nonce&&(Jb.update(jb,!0),Jb.nonce=jb.nonce,Jb.setLastSerialized(jb)),gb.delete(jb.id)):
K.push(this.instantiateShape(jb))}0<gb.size&&!this.app.selectedTool.isInAny("creating","editingShape")&&bb.removeShapes(...gb.values());0<K.length&&bb.addShapes(...K);ra.delete(Sa.id);bb.updateBindings(Sa.bindings);bb.nonce=null!=(l=Sa.nonce)?l:0}else{const {id:gb,name:jb,shapes:Jb,bindings:Ob,nonce:Lb}=Sa;Ka.push(new gl(this.app,{id:gb,name:jb,nonce:Lb,bindings:Ob,shapes:Jb.map(gc=>this.instantiateShape(gc))}))}}0<Ka.length&&this.app.addPages(Ka);0<ra.size&&this.app.removePages(Array.from(ra.values()));
this.app.setSelectedShapes(ja).setErasingShapes([])}catch(ra){console.warn(ra)}da||this.resume()})});this.app=a;Ue(this)}get creating(){return"creating"===this.app.selectedTool.currentState.id}};fe([yg],ls.prototype,"stack",2);fe([jg],ls.prototype,"persist",2);fe([jg],ls.prototype,"undo",2);fe([jg],ls.prototype,"redo",2);fe([jg],ls.prototype,"deserialize",2);var Yp=class{constructor(){hb(this,"mode","light");hb(this,"showGrid",!0);hb(this,"snapToGrid",!0);hb(this,"penMode",!1);hb(this,"scaleLevel",
"md");hb(this,"color","");Ue(this)}update(a){Object.assign(this,a)}};fe([yg],Yp.prototype,"mode",2);fe([yg],Yp.prototype,"showGrid",2);fe([yg],Yp.prototype,"snapToGrid",2);fe([yg],Yp.prototype,"penMode",2);fe([yg],Yp.prototype,"scaleLevel",2);fe([yg],Yp.prototype,"color",2);fe([jg],Yp.prototype,"update",1);var Vg=class extends hs{constructor(a,d,l,K){var da,ja;super();hb(this,"uuid",qk());hb(this,"readOnly");hb(this,"api");hb(this,"inputs",new Kj);hb(this,"cursors",new ks);hb(this,"viewport",new Mn);
hb(this,"settings",new Yp);hb(this,"Tools",[]);hb(this,"history",new ls(this));hb(this,"persist",this.history.persist);hb(this,"undo",this.history.undo);hb(this,"redo",this.history.redo);hb(this,"saving",!1);hb(this,"saveState",()=>{this.history.isPaused||(this.saving=!0,requestAnimationFrame(()=>{this.saving&&(this.persist(),this.saving=!1)}))});hb(this,"load",()=>{this.notify("load",null);return this});hb(this,"save",()=>{this.notify("save",null);return this});hb(this,"pages",new Map([["page",new gl(this,
{id:"page",name:"page",shapes:[],bindings:{}})]]));hb(this,"getPageById",ra=>{const Ka=this.pages.get(ra);if(!Ka)throw Error(`Could not find a page named ${ra}.`);return Ka});hb(this,"getShapeById",(ra,Ka=this.currentPage.id)=>{var Sa;return null==(Sa=this.getPageById(Ka))?void 0:Sa.shapesById[ra]});hb(this,"createShapes",ra=>{if(this.readOnly)return this;(ra=this.currentPage.addShapes(...ra))&&this.notify("create-shapes",ra);this.persist();return this});hb(this,"updateShapes",ra=>{if(this.readOnly)return this;
ra.forEach(Ka=>{const Sa=this.getShapeById(Ka.id);null==Sa?void 0:Sa.update(Ka);Ka.type!==(null==Sa?void 0:Sa.type)&&this.api.convertShapes(Ka.type,[Sa])});this.persist();return this});hb(this,"deleteShapes",ra=>{if(0===ra.length||this.readOnly)return this;ra=ra.map(gb=>"string"===typeof gb?this.getShapeById(gb):gb).filter(cg).filter(gb=>!gb.props.isLocked);const Ka=this.shapesInGroups(ra);ra.forEach(gb=>{this.getParentGroup(gb)&&Ka.push(gb)});let Sa=new Set([...ra,...Ka].map(gb=>gb.id));Ka.forEach(gb=>
{var jb;const Jb=this.getParentGroup(gb);if(Jb){const Ob=null==(jb=Jb.props.children)?void 0:jb.filter(Lb=>Lb!==gb.id);!Ob||1>=(null==Ob?void 0:Ob.length)?Sa.add(Jb.id):Jb.update({children:Ob})}});const bb=(gb,jb)=>{var Jb;[...Sa].includes(gb)&&"line"===(null==(Jb=this.getShapeById(jb))?void 0:Jb.type)&&Sa.add(jb)};this.currentPage.shapes.filter(gb=>!gb.props.isLocked).flatMap(gb=>{var jb;return Object.values(null!=(jb=gb.props.handles)?jb:{})}).flatMap(gb=>gb.bindingId).filter(cg).map(gb=>{var jb,
Jb;const Ob=null==(jb=this.currentPage.bindings[gb])?void 0:jb.toId;gb=null==(Jb=this.currentPage.bindings[gb])?void 0:Jb.fromId;Ob&&gb&&(bb(Ob,gb),bb(gb,Ob))});ra=[...Sa].map(gb=>this.getShapeById(gb));this.setSelectedShapes(this.selectedShapesArray.filter(gb=>!Sa.has(gb.id)));(ra=this.currentPage.removeShapes(...ra))&&this.notify("delete-shapes",ra);this.persist();return this});hb(this,"bringForward",(ra=this.selectedShapesArray)=>{0<ra.length&&!this.readOnly&&this.currentPage.bringForward(ra);
return this});hb(this,"sendBackward",(ra=this.selectedShapesArray)=>{0<ra.length&&!this.readOnly&&this.currentPage.sendBackward(ra);return this});hb(this,"sendToBack",(ra=this.selectedShapesArray)=>{0<ra.length&&!this.readOnly&&this.currentPage.sendToBack(ra);return this});hb(this,"bringToFront",(ra=this.selectedShapesArray)=>{0<ra.length&&!this.readOnly&&this.currentPage.bringToFront(ra);return this});hb(this,"flipHorizontal",(ra=this.selectedShapesArray)=>{this.currentPage.flip(ra,"horizontal");
return this});hb(this,"flipVertical",(ra=this.selectedShapesArray)=>{this.currentPage.flip(ra,"vertical");return this});hb(this,"align",(ra,Ka=this.selectedShapesArray)=>{if(2>Ka.length||this.readOnly)return this;const Sa=Ka.map(Ob=>{const Lb=Ob.getBounds();return{id:Ob.id,point:[Lb.minX,Lb.minY],bounds:Lb}}),bb=sf.getCommonBounds(Sa.map(({bounds:Ob})=>Ob)),gb=bb.minX+bb.width/2,jb=bb.minY+bb.height/2,Jb=Object.fromEntries(Sa.map(({id:Ob,point:Lb,bounds:gc})=>[Ob,{prev:Lb,next:{top:[Lb[0],bb.minY],
centerVertical:[Lb[0],jb-gc.height/2],bottom:[Lb[0],bb.maxY-gc.height],left:[bb.minX,Lb[1]],centerHorizontal:[gb-gc.width/2,Lb[1]],right:[bb.maxX-gc.width,Lb[1]]}[ra]}]));Ka.forEach(Ob=>{Jb[Ob.id]&&Ob.update({point:Jb[Ob.id].next})});this.persist();return this});hb(this,"distribute",(ra,Ka=this.selectedShapesArray)=>{if(2>Ka.length||this.readOnly)return this;const Sa=Object.fromEntries(sf.getDistributions(Ka,ra).map(bb=>[bb.id,bb]));Ka.forEach(bb=>{Sa[bb.id]&&bb.update({point:Sa[bb.id].next})});this.persist();
return this});hb(this,"packIntoRectangle",(ra=this.selectedShapesArray)=>{if(2>ra.length||this.readOnly)return this;const Ka=Object.fromEntries(sf.getPackedDistributions(ra).map(Sa=>[Sa.id,Sa]));ra.forEach(Sa=>{Ka[Sa.id]&&Sa.update({point:Ka[Sa.id].next})});this.persist();return this});hb(this,"setLocked",ra=>{if(0===this.selectedShapesArray.length||this.readOnly)return this;this.selectedShapesArray.forEach(Ka=>{Ka.update({isLocked:ra})});this.persist();return this});hb(this,"assets",{});hb(this,
"removeUnusedAssets",()=>{const ra=this.getCleanUpAssets();Object.keys(this.assets).forEach(Ka=>{ra.some(Sa=>Sa.id===Ka)||delete this.assets[Ka]});this.persist();return this});hb(this,"copy",()=>{if(0<this.selectedShapesArray.length&&!this.editingShape){const Ka=this.allSelectedShapesArray;var ra=JSON.stringify({shapes:Ka.map(bb=>bb.serialized),assets:this.getCleanUpAssets().filter(bb=>Ka.some(gb=>gb.props.assetId===bb.id)),bindings:jc(this.currentPage.bindings)});ra=encodeURIComponent(`<whiteboard-tldr>${ra}</whiteboard-tldr>`);
const Sa=this.selectedShapesArray.map(bb=>`((${bb.props.id}))`).join(" ");this.notify("copy",{text:Sa,html:ra})}});hb(this,"paste",(ra,Ka)=>{var Sa;this.editingShape||this.readOnly||this.notify("paste",{point:this.inputs.currentPoint,shiftKey:!!Ka,dataTransfer:null!=(Sa=null==ra?void 0:ra.clipboardData)?Sa:void 0})});hb(this,"cut",()=>{this.copy();this.api.deleteShapes()});hb(this,"drop",(ra,Ka)=>{this.notify("drop",{dataTransfer:ra,point:Ka?this.viewport.getPagePoint(Ka):sf.getBoundsCenter(this.viewport.currentView)})});
hb(this,"selectTool",(ra,Ka={})=>{this.readOnly&&!["select","move"].includes(ra)||this.transition(ra,Ka)});hb(this,"editingId");hb(this,"setEditingShape",ra=>{this.editingId="string"===typeof ra?ra:null==ra?void 0:ra.id;return this});hb(this,"clearEditingState",()=>{this.selectedTool.transition("idle");return this.setEditingShape()});hb(this,"hoveredId");hb(this,"setHoveredShape",ra=>{this.hoveredId="string"===typeof ra?ra:null==ra?void 0:ra.id;return this});hb(this,"selectedIds",new Set);hb(this,
"selectedShapes",new Set);hb(this,"selectionRotation",0);hb(this,"setSelectedShapes",ra=>{var Ka;const {selectedIds:Sa,selectedShapes:bb}=this;Sa.clear();bb.clear();ra[0]&&"string"===typeof ra[0]?ra.forEach(jb=>Sa.add(jb)):ra.forEach(jb=>Sa.add(jb.id));const gb=this.currentPage.shapes.filter(jb=>Sa.has(jb.id));gb.forEach(jb=>bb.add(jb));this.selectionRotation=1===gb.length?null!=(Ka=gb[0].props.rotation)?Ka:0:0;0===ra.length&&this.setEditingShape();return this});hb(this,"erasingIds",new Set);hb(this,
"erasingShapes",new Set);hb(this,"setErasingShapes",ra=>{const {erasingIds:Ka,erasingShapes:Sa}=this;Ka.clear();Sa.clear();ra[0]&&"string"===typeof ra[0]?ra.forEach(bb=>Ka.add(bb)):ra.forEach(bb=>Ka.add(bb.id));this.currentPage.shapes.filter(bb=>Ka.has(bb.id)).forEach(bb=>Sa.add(bb));return this});hb(this,"bindingIds");hb(this,"setBindingShapes",ra=>{this.bindingIds=ra;return this});hb(this,"clearBindingShape",()=>this.setBindingShapes());hb(this,"createNewLineBinding",(ra,Ka)=>{ra="string"===typeof ra?
this.getShapeById(ra):ra;Ka="string"===typeof Ka?this.getShapeById(Ka):Ka;if((null==ra?0:ra.canBind)&&(null==Ka?0:Ka.canBind)&&(Ka=Wc(ra,Ka))){const [Sa,bb]=Ka;this.createShapes([Sa]);this.currentPage.updateBindings(Object.fromEntries(bb.map(gb=>[gb.id,gb])));this.persist();return!0}return!1});hb(this,"brush");hb(this,"setBrush",ra=>{this.brush=ra;return this});hb(this,"setCamera",(ra,Ka)=>{this.viewport.update({point:ra,zoom:Ka});return this});hb(this,"getPagePoint",ra=>{const {camera:Ka}=this.viewport;
return yd.sub(yd.div(ra,Ka.zoom),Ka.point)});hb(this,"getScreenPoint",ra=>{const {camera:Ka}=this.viewport;return yd.mul(yd.add(ra,Ka.point),Ka.zoom)});hb(this,"Shapes",new Map);hb(this,"registerShapes",ra=>{ra.forEach(Ka=>{if("group"===Ka.id){const Sa=this;Ka.prototype.getShapes=function(){var bb,gb;return null!=(gb=null==(bb=this.props.children)?void 0:bb.map(jb=>Sa.getShapeById(jb)).filter(Boolean))?gb:[]}}return this.Shapes.set(Ka.id,Ka)})});hb(this,"deregisterShapes",ra=>{ra.forEach(Ka=>this.Shapes.delete(Ka.id))});
hb(this,"getShapeClass",ra=>{if(!ra)throw Error("No shape type provided.");const Ka=this.Shapes.get(ra);if(!Ka)throw Error(`Could not find shape class for ${ra}`);return Ka});hb(this,"wrapUpdate",ra=>{Gc(()=>{const Ka=!this.history.isPaused;Ka&&this.history.pause();ra();Ka&&(this.history.resume(),this.persist())})});hb(this,"subscriptions",new Set([]));hb(this,"subscribe",(ra,Ka)=>{if(void 0===Ka)throw Error("Callback is required.");const Sa={event:ra,callback:Ka};this.subscriptions.add(Sa);return()=>
this.unsubscribe(Sa)});hb(this,"unsubscribe",ra=>{this.subscriptions.delete(ra);return this});hb(this,"notify",(ra,Ka)=>{this.subscriptions.forEach(Sa=>{Sa.event===ra&&Sa.callback(this,Ka)});return this});hb(this,"onTransition",()=>{});hb(this,"onPointerDown",(ra,Ka)=>{if(!this.editingShape&&1===Ka.button&&!this.isIn("move"))this.temporaryTransitionToMove(Ka);else if(2===Ka.button&&!this.editingShape)Ka.preventDefault(),this.transition("select");else if("clientX"in Ka)this.inputs.onPointerDown([...this.viewport.getPagePoint([Ka.clientX,
Ka.clientY]),Ka.pressure],Ka)});hb(this,"onPointerUp",(ra,Ka)=>{if(!this.editingShape&&1===Ka.button&&this.isIn("move"))this.selectedTool.transition("idle",{exit:!0}),Ka.stopPropagation(),Ka.preventDefault();else if("clientX"in Ka)this.inputs.onPointerUp([...this.viewport.getPagePoint([Ka.clientX,Ka.clientY]),Ka.pressure],Ka)});hb(this,"onPointerMove",(ra,Ka)=>{if("clientX"in Ka)this.inputs.onPointerMove([...this.viewport.getPagePoint([Ka.clientX,Ka.clientY]),Ka.pressure],Ka)});hb(this,"onKeyDown",
(ra,Ka)=>{if(this.editingShape||" "!==Ka.key||this.isIn("move"))this.inputs.onKeyDown(Ka);else this.temporaryTransitionToMove(Ka)});hb(this,"onKeyUp",(ra,Ka)=>{if(!this.editingShape&&" "===Ka.key&&this.isIn("move"))this.selectedTool.transition("idle",{exit:!0}),Ka.stopPropagation(),Ka.preventDefault();else this.inputs.onKeyUp(Ka)});hb(this,"onPinchStart",(ra,Ka)=>{this.inputs.onPinchStart([...this.viewport.getPagePoint(ra.point),.5],Ka)});hb(this,"onPinch",(ra,Ka)=>{this.inputs.onPinch([...this.viewport.getPagePoint(ra.point),
.5],Ka)});hb(this,"onPinchEnd",(ra,Ka)=>{this.inputs.onPinchEnd([...this.viewport.getPagePoint(ra.point),.5],Ka)});this._states=[is,js];this.readOnly=K;this.history.pause();this.states&&0<this.states.length&&(this.registerStates(this.states),K=null!=(da=this.initial)?da:this.states[0].id,da=this.children.get(K))&&(this.currentState=da,null==(ja=this.currentState)?void 0:ja._events.onEnter({fromId:"initial"}));d&&this.registerShapes(d);l&&this.registerTools(l);this.history.resume();a&&this.history.deserialize(a);
this.api=new sE(this);Ue(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(cg).map(d=>this.getShapeById(d)).filter(cg)}getParentGroup(a){return this.shapes.find(d=>{var l;return null==(l=d.props.children)?void 0:l.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(l=>{l.props.assetId&&this.assets[l.props.assetId]&&
a.add(this.assets[l.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(l=>l.id===a):void 0}get hoveredShape(){const {hoveredId:a,currentPage:d}=this;return a?d.shapes.find(l=>l.id===a):void 0}get hoveredGroup(){const {hoveredShape:a}=
this;return a?this.shapes.find(d=>{var l;return"group"===d.type&&(null==(l=d.props.children)?void 0:l.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(K=>{var da;return Object.values(null!=(da=K.props.handles)?da:{})}).flatMap(K=>K.bindingId).filter(cg).flatMap(K=>{var da,ja;return[null==(da=this.currentPage.bindings[K])?void 0:da.fromId,null==(ja=this.currentPage.bindings[K])?void 0:ja.toId]}).filter(cg):[],l=[...(null!=(a=this.bindingIds)?a:[]),...d];return l?this.currentPage.shapes.filter(K=>null==l?void 0:l.includes(K.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:l}}=this;return d.shapes.filter(K=>!K.canUnmount||a.has(K)||sf.boundsContain(l,K.rotatedBounds)||sf.boundsCollide(l,K.rotatedBounds))}get selectionDirectionHint(){const {selectionBounds:a,viewport:{currentView:d}}=this;if(a&&!sf.boundsContain(d,a)&&!sf.boundsCollide(d,a)){var l=sf.getBoundsCenter(a);return yd.clampV([(l[0]-
d.minX-d.width/2)/d.width,(l[1]-d.minY-d.height/2)/d.height],-1,1)}}get selectionBounds(){const {selectedShapesArray:a}=this;if(0!==a.length)return 1===a.length?ff(Zd({},a[0].bounds),{rotation:a[0].props.rotation}):sf.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)}get showCloneHandles(){const {selectedShapesArray:a}=
this;return this.isInAny("select.idle","select.hoveringSelectionHandle","select.pointingShape","select.pointingSelectedShape")&&1===a.length&&Object.values(as).some(d=>d===this.selectedShapesArray[0].type)&&!this.readOnly}temporaryTransitionToMove(a){a.stopPropagation();a.preventDefault();this.transition("move",{prevTool:this.selectedTool});this.selectedTool.transition("idleHold")}};hb(Vg,"id","app");hb(Vg,"initial","select");fe([Dg],Vg.prototype,"serialized",1);fe([yg],Vg.prototype,"pages",2);fe([Dg],
Vg.prototype,"currentPageId",1);fe([Dg],Vg.prototype,"currentPage",1);fe([jg],Vg.prototype,"addPages",1);fe([jg],Vg.prototype,"removePages",1);fe([jg],Vg.prototype,"createShapes",2);fe([jg],Vg.prototype,"updateShapes",2);fe([jg],Vg.prototype,"deleteShapes",2);fe([yg],Vg.prototype,"assets",2);fe([jg],Vg.prototype,"addAssets",1);fe([jg],Vg.prototype,"removeAssets",1);fe([jg],Vg.prototype,"removeUnusedAssets",2);fe([Dg],Vg.prototype,"selectedTool",1);fe([yg],Vg.prototype,"editingId",2);fe([Dg],Vg.prototype,
"editingShape",1);fe([jg],Vg.prototype,"setEditingShape",2);fe([yg],Vg.prototype,"hoveredId",2);fe([Dg],Vg.prototype,"hoveredShape",1);fe([Dg],Vg.prototype,"hoveredGroup",1);fe([jg],Vg.prototype,"setHoveredShape",2);fe([yg],Vg.prototype,"selectedIds",2);fe([yg],Vg.prototype,"selectedShapes",2);fe([yg],Vg.prototype,"selectionRotation",2);fe([Dg],Vg.prototype,"selectedShapesArray",1);fe([Dg],Vg.prototype,"allSelectedShapes",1);fe([Dg],Vg.prototype,"allSelectedShapesArray",1);fe([jg],Vg.prototype,"setSelectedShapes",
2);fe([jg],Vg.prototype,"setSelectionRotation",1);fe([yg],Vg.prototype,"erasingIds",2);fe([yg],Vg.prototype,"erasingShapes",2);fe([Dg],Vg.prototype,"erasingShapesArray",1);fe([jg],Vg.prototype,"setErasingShapes",2);fe([yg],Vg.prototype,"bindingIds",2);fe([Dg],Vg.prototype,"bindingShapes",1);fe([jg],Vg.prototype,"setBindingShapes",2);fe([jg],Vg.prototype,"createNewLineBinding",2);fe([yg],Vg.prototype,"brush",2);fe([jg],Vg.prototype,"setBrush",2);fe([jg],Vg.prototype,"setCamera",2);fe([Dg],Vg.prototype,
"currentGrid",1);fe([Dg],Vg.prototype,"shapes",1);fe([Dg],Vg.prototype,"shapesInViewport",1);fe([Dg],Vg.prototype,"selectionDirectionHint",1);fe([Dg],Vg.prototype,"selectionBounds",1);fe([Dg],Vg.prototype,"showSelection",1);fe([Dg],Vg.prototype,"showSelectionDetail",1);fe([Dg],Vg.prototype,"showSelectionRotation",1);fe([Dg],Vg.prototype,"showContextBar",1);fe([Dg],Vg.prototype,"showRotateHandles",1);fe([Dg],Vg.prototype,"showResizeHandles",1);fe([Dg],Vg.prototype,"showCloneHandles",1);var tE=Function.prototype.toString,
$w=Object.create,uE=Object.prototype.toString,vE=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,l){this._keys.push(d);this._values.push(l)};return a}(),wE="undefined"!==typeof WeakMap?re:Wd,xE="g"===/test/g.flags?kf:Cf,yE="undefined"!==typeof Symbol?tf:Df,zE=Object.defineProperty,AE=Object.getOwnPropertyDescriptor,bA=Object.getOwnPropertyNames,
ax=Object.getOwnPropertySymbols,cA=Object.prototype,dA=cA.hasOwnProperty,BE=cA.propertyIsEnumerable,eA="function"===typeof ax,CE=eA?rg:bA,DE=Array.isArray,bx=Object.assign,EE=Object.getPrototypeOf,fA={array:function(a,d){var l=new d.Constructor;d.cache.set(a,l);for(var K=0,da=a.length;K<da;++K)l[K]=d.copier(a[K],d);return l},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:hi,map:jh,object:eA?hh:Uf,regExp:function(a,d){d=new d.Constructor(a.source,xE(a));d.lastIndex=a.lastIndex;return d},set:Rj},FE=bx({},fA,{array:function(a,d){var l=new d.Constructor;d.cache.set(a,l);return gh(a,l,d)},map:function(a,d){return gh(a,jh(a,d),d)},object:function(a,d){var l=xe(d.prototype);d.cache.set(a,l);return gh(a,l,d)},set:function(a,d){return gh(a,Rj(a,d),d)}});Lk(bx({},FE,{}));var GE=Lk({}),HE=Kf(AD()),IE=Kf(BD()),ir=GE,kn=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 l=a.ownerDocument,K=l.activeElement;K!==a&&a.focus();l.execCommand("insertText",!1,d)||kn.insertTextFirefox(a,d);K===l.body?a.blur():K instanceof HTMLElement&&K!==a&&K.focus()}static set(a,d){a.select();kn.insert(a,d)}static getSelection(a){const {selectionStart:d,selectionEnd:l}=a;return a.value.slice(d?d:void 0,l?l:void 0)}static wrapSelection(a,
d,l){const {selectionStart:K,selectionEnd:da}=a,ja=kn.getSelection(a);kn.insert(a,d+ja+(null!=l?l:d));a.selectionStart=(K||0)+d.length;a.selectionEnd=(da||0)+d.length}static replace(a,d,l){let K=0;a.value.replace(d,(...da)=>{const ja=K+da[da.length-2],ra=da[0].length;a.selectionStart=ja;a.selectionEnd=ja+ra;da="string"===typeof l?l:l(...da);kn.insert(a,da);a.selectionStart=ja;K+=da.length-ra;return da})}static findLineEnd(a,d){const l=a.lastIndexOf("\n",d-1)+1;return"\t"!==a.charAt(l)?d:l+1}static indent(a){var d;
const {selectionStart:l,selectionEnd:K,value:da}=a;var ja=da.slice(l,K);if((ja=null==(d=/\n/g.exec(ja))?void 0:d.length)&&0<ja){d=da.lastIndexOf("\n",l-1)+1;var ra=a.value.slice(d,K-1);ja=ra.replace(/^|\n/g,`$&${kn.INDENT}`);ra=ja.length-ra.length;a.setSelectionRange(d,K-1);kn.insert(a,ja);a.setSelectionRange(l+1,K+ra)}else kn.insert(a,kn.INDENT)}static unindent(a){const {selectionStart:d,selectionEnd:l,value:K}=a;var da=K.lastIndexOf("\n",d-1)+1;const ja=kn.findLineEnd(K,l);var ra=a.value.slice(da,
ja);const Ka=ra.replace(/(^|\n)(\t| {1,2})/g,"$1");ra=ra.length-Ka.length;a.setSelectionRange(da,ja);kn.insert(a,Ka);da=(da=/\t| {1,2}/.exec(K.slice(da,d)))?da[0].length:0;a.setSelectionRange(d-da,Math.max(d-da,l-ra))}static normalizeText(a){return a.replace(kn.fixNewLines,"\n")}},ms=kn;hb(ms,"fixNewLines",/\r?\n|\r/g);hb(ms,"INDENT","  ");var Zp;"undefined"!==typeof window&&(Zp=Wl());var cx=new Map,gA=oh()?"⌘":"ctrl",JE=class extends Vg{},hA=Kf(aa(0)),KE=()=>{};/^((?!chrome|android).)*safari/i.test(navigator.userAgent);
var iA=Kf(aa(0)),dx={},yt=Kf(aa(0)),LE=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},ex=Kf(aa(0)),fx=new Map,ME={accent:"var(--lx-accent-09, hsl(var(--primary)))",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-selectedStroke)",
selectFill:"var(--color-selectedFill)",binding:"var(--color-binding, rgba(65, 132, 244, 0.5))",background:"var(--ls-primary-background-color, hsl(var(--background)))",foreground:"var(--ls-primary-text-color, hsl(var(--foreground)))",grid:"var(--ls-quaternary-background-color, hsl(var(--secondary)))"},NE=((a,...d)=>a.reduce((l,K,da)=>l+K+(da<d.length?d[da]:""),""))`
  .tl-container {
    --tl-zoom: 1;
    --tl-scale: calc(1 / var(--tl-zoom));
    --tl-padding: calc(64px / var(--tl-zoom));;
    --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-clone-handle {
    stroke: var(--tl-selectStroke);
    fill: var(--tl-background);
    stroke-width: calc(1.5px * var(--tl-scale));
  }

  .tl-clone-handle:hover {
    fill: var(--tl-selectStroke);
    cursor: pointer;
  }

  .tl-clone-handle:hover line {
    stroke: var(--tl-background);
  }

  .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);
  }
`,jA=Kf(aa(0)),kA=Kf(aa(0)),gx={},Lj={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]}},lA={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"}},OE=["enter","leave"],PE=["gotpointercapture","lostpointercapture"],
mA=class{constructor(a,d,l){this.ctrl=a;this.args=d;this.key=l;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:l,args:K}=this;d[l]=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=K;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,l=this.config;d._active||(this.reset(),this.computeInitial(),
d._active=!0,d.target=a.target,d.currentTarget=a.currentTarget,d.lastOffset=l.from?ah(l.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:l,shared:K}=this;d.args=this.args;var da=0;if(a){d.event=a;l.preventDefault&&a.cancelable&&d.event.preventDefault();d.type=a.type;K.touches=this.ctrl.pointerIds.size||
this.ctrl.touchIds.size;K.locked=!!document.pointerLockElement;da=Object;var ja=da.assign,ra={};"buttons"in a&&(ra.buttons=a.buttons);if("shiftKey"in a){const {shiftKey:Fc,altKey:Lc,metaKey:ud,ctrlKey:Jd}=a;Object.assign(ra,{shiftKey:Fc,altKey:Lc,metaKey:ud,ctrlKey:Jd})}ja.call(da,K,ra);K.down=K.pressed=1===K.buttons%2||0<K.touches;da=a.timeStamp-d.timeStamp;d.timeStamp=a.timeStamp;d.elapsedTime=d.timeStamp-d.startTime}d._active&&(ja=d._delta.map(Math.abs),Lj.addTo(d._distance,ja));this.axisIntent&&
this.axisIntent(a);const [Ka,Sa]=d._movement,[bb,gb]=l.threshold,{_step:jb,values:Jb}=d;l.hasCustomTransform?(!1===jb[0]&&(jb[0]=Math.abs(Ka)>=bb&&Jb[0]),!1===jb[1]&&(jb[1]=Math.abs(Sa)>=gb&&Jb[1])):(!1===jb[0]&&(jb[0]=Math.abs(Ka)>=bb&&Math.sign(Ka)*bb),!1===jb[1]&&(jb[1]=Math.abs(Sa)>=gb&&Math.sign(Sa)*gb));d.intentional=!1!==jb[0]||!1!==jb[1];if(d.intentional){ja=[0,0];if(l.hasCustomTransform){const [Fc,Lc]=Jb;ja[0]=!1!==jb[0]?Fc-jb[0]:0;ja[1]=!1!==jb[1]?Lc-jb[1]:0}else ja[0]=!1!==jb[0]?Ka-jb[0]:
0,ja[1]=!1!==jb[1]?Sa-jb[1]:0;this.restrictToAxis&&!d._blocked&&this.restrictToAxis(ja);ra=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=K[this.ingKey]=d._active,a&&(d.first&&("bounds"in l&&(d._bounds=ah(l.bounds,d)),this.setup&&this.setup()),d.movement=ja,this.computeOffset()));var [Lb,gc]=d.offset,[[rc,Wb],[kc,hc]]=d._bounds;d.overflow=[Lb<rc?-1:Lb>Wb?1:0,gc<kc?-1:gc>hc?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=Zh(d._bounds,d.offset,d._active?l.rubberband||[0,0]:[0,0]);d.delta=Lj.sub(d.offset,ra);this.computeMovement();Ob&&(!d.last||32<da)&&(d.delta=Lj.sub(d.offset,ra),a=d.delta.map(Math.abs),Lj.addTo(d.distance,a),d.direction=d.delta.map(Math.sign),d._direction=d._delta.map(Math.sign),!d.first&&0<da&&(d.velocity=[a[0]/da,a[1]/da]))}}emit(){const a=this.state;var d=
this.shared;const l=this.config;a._active||this.clean();if(!a._blocked&&a.intentional||a._force||l.triggerAllEvents)d=this.handler(Tg(Tg(Tg({},d),a),{},{[this.aliasKey]:a.values})),void 0!==d&&(a.memo=d)}clean(){this.eventStore.clean();this.timeoutStore.clean()}},zt=class extends mA{constructor(...a){super(...a);ui(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=Lj.add(this.state.lastOffset,
this.state.movement)}computeMovement(){this.state.movement=Lj.sub(this.state.offset,this.state.lastOffset)}axisIntent(a){const d=this.state,l=this.config;!d.axis&&a&&(a="object"===typeof l.axisThreshold?l.axisThreshold[wh(a)]:l.axisThreshold,d.axis=Ak(d._movement,a));d._blocked=(l.lockDirection||!!l.axis)&&!d.axis||!!l.axis&&l.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}}},QE=a=>a,nA={enabled(a=!0){return a},
eventOptions(a,d,l){return Tg(Tg({},l.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 Lj.toVector(a)}},from(a){if("function"===typeof a)return a;if(null!=a)return Lj.toVector(a)},transform(a,d,l){a=a||l.shared.transform;this.hasCustomTransform=!!a;return a||QE},threshold(a){return Lj.toVector(a,0)}},jr=Tg(Tg({},nA),{},{axis(a,d,{axis:l}){this.lockDirection="lock"===l;if(!this.lockDirection)return l},
axisThreshold(a=0){return a},bounds(a={}){if("function"===typeof a)return ja=>jr.bounds(a(ja));if("current"in a)return()=>a.current;if("function"===typeof HTMLElement&&a instanceof HTMLElement)return a;const {left:d=-Infinity,right:l=Infinity,top:K=-Infinity,bottom:da=Infinity}=a;return[[d,l],[K,da]]}}),oA={ArrowRight:(a=1)=>[10*a,0],ArrowLeft:(a=1)=>[-10*a,0],ArrowUp:(a=1)=>[0,-10*a],ArrowDown:(a=1)=>[0,10*a]},RE=class extends zt{constructor(...a){super(...a);ui(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(),l=a.currentTarget.getBoundingClientRect();a._bounds=jr.bounds({left:d.left-l.left+a.offset[0],right:d.right-l.right+a.offset[0],top:d.top-l.top+a.offset[1],bottom:d.bottom-l.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,l=this.state;if(null==a.buttons||(Array.isArray(d.pointerButtons)?d.pointerButtons.includes(a.buttons):-1===d.pointerButtons||d.pointerButtons===a.buttons)){var K=this.ctrl.setEventIds(a);
d.pointerCapture&&a.target.setPointerCapture(a.pointerId);K&&1<K.size&&l._pointerActive||(this.start(a),this.setupPointer(a),l._pointerId=Zi(a),l._pointerActive=!0,this.computeValues(Mk(a)),this.computeInitial(),d.preventScrollAxis&&"mouse"!==wh(a)?(l._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,l=this.config;if(d._pointerActive&&(d.type!==a.type||a.timeStamp!==d.timeStamp)){var K=Zi(a);if(void 0===d._pointerId||K===d._pointerId)K=Mk(a),document.pointerLockElement===a.target?d._delta=[a.movementX,a.movementY]:(d._delta=Lj.sub(K,d._values),this.computeValues(K)),Lj.addTo(d._movement,d._delta),this.compute(a),d._delayed&&d.intentional?(this.timeoutStore.remove("dragDelay"),d.active=!1,this.startPointerDrag(a)):l.preventScrollAxis&&!d._preventScroll?
d.axis&&(d.axis===l.preventScrollAxis||"xy"===l.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(ra){}const d=this.state,l=this.config;if(d._active&&d._pointerActive){var K=Zi(a);if(void 0===d._pointerId||K===d._pointerId){this.state._pointerActive=!1;this.setActive();
this.compute(a);var [da,ja]=d._distance;d.tap=da<=l.tapsThreshold&&ja<=l.tapsThreshold;if(d.tap&&l.filterTaps)d._force=!0;else{const [ra,Ka]=d.direction,[Sa,bb]=d.velocity,[gb,jb]=d.movement,[Jb,Ob]=l.swipe.velocity,[Lb,gc]=l.swipe.distance;d.elapsedTime<l.swipe.duration&&(Math.abs(Sa)>Jb&&Math.abs(gb)>Lb&&(d.swipe[0]=ra),Math.abs(bb)>Ob&&Math.abs(jb)>gc&&(d.swipe[1]=Ka))}this.emit()}}}pointerClick(a){!this.state.tap&&0<a.detail&&(a.preventDefault(),a.stopPropagation())}setupPointer(a){const d=this.config,
l=d.device;d.pointerLock&&a.currentTarget.requestPointerLock();d.pointerCapture||(this.eventStore.add(this.sharedConfig.window,l,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,l,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,l,"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=oA[a.key];if(d){const l=this.state,K=a.shiftKey?10:a.altKey?.1:1;this.start(a);l._delta=d(K);l._keyboardActive=!0;Lj.addTo(l._movement,l._delta);this.compute(a);this.emit()}}keyUp(a){a.key in oA&&(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})}},kr="undefined"!==typeof window&&window.document&&window.document.createElement;try{var pA="constructor"in GestureEvent}catch(a){pA=!1}var SE=
pA,At=kr&&"ontouchstart"in window||kr&&1<window.navigator.maxTouchPoints,qA=kr&&"ontouchstart"in window||kr&&1<window.navigator.maxTouchPoints,rA=kr&&"onpointerdown"in window,TE=kr&&"exitPointerLock"in window.document,sA={mouse:0,touch:0,pen:8},UE=Tg(Tg({},jr),{},{device(a,d,{pointer:{touch:l=!1,lock:K=!1,mouse:da=!1}={}}){this.pointerLock=K&&TE;return At&&l?"touch":this.pointerLock?"mouse":rA&&!da?"pointer":At?"touch":"mouse"},preventScrollAxis(a,d,{preventScroll:l}){this.preventScrollDelay="number"===
typeof l?l:l||void 0===l&&a?250:void 0;if(qA&&!1!==l)return a?a:void 0!==l?"y":void 0},pointerCapture(a,d,{pointer:{capture:l=!0,buttons:K=1,keys:da=!0}={}}){this.pointerButtons=K;this.keys=da;return!this.pointerLock&&"pointer"===this.device&&l},threshold(a,d,{filterTaps:l=!1,tapsThreshold:K=3,axis:da}){a=Lj.toVector(a,l?K:da?1:0);this.filterTaps=l;this.tapsThreshold=K;return a},swipe({velocity:a=.5,distance:d=50,duration:l=250}={}){return{velocity:this.transform(Lj.toVector(a)),distance:this.transform(Lj.toVector(d)),
duration:l}},delay(a=0){switch(a){case !0:return 180;case !1:return 0;default:return a}},axisThreshold(a){return a?Tg(Tg({},sA),a):sA}}),VE=class extends mA{constructor(...a){super(...a);ui(this,"ingKey","pinching");ui(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:l}=
this.state;this.state.offset="wheel"===a?Lj.add(d,l):[(1+d[0])*l[0],d[1]+l[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,l]=a._movement;if(!a.axis){const K=30*Math.abs(d)-Math.abs(l);0>K?a.axis="angle":0<K&&(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 l=this.ctrl.touchIds;d._active&&d._touchIds.every(K=>l.has(K))||2>l.size||(this.start(a),d._touchIds=Array.from(l).slice(0,2),d=Oi(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,l=d._pointerEvents,K=this.ctrl.pointerIds;d._active&&Array.from(l.keys()).every(da=>K.has(da))||
(2>l.size&&l.set(a.pointerId,a),2>d._pointerEvents.size||(this.start(a),d=im(...Array.from(l.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=Oi(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=im(...Array.from(d.values())),this.pinchMove(a,
d))}pinchMove(a,d){const l=this.state,K=d.angle-l._values[1];let da=0;270<Math.abs(K)&&(da+=Math.sign(K));this.computeValues([d.distance,d.angle-360*da]);l.origin=d.origin;l.turns=da;l._movement=[l._values[0]/l._initial[0]-1,l._values[1]-l._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(l){}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 l=d._movement;d._movement=[a.scale-1,a.rotation];d._delta=Lj.sub(d._movement,l);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=[-Nk(a)[1]/100*d.offset[0],0];Lj.addTo(d._movement,d._delta);al(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})}},WE=Tg(Tg({},nA),{},{device(a,d,{shared:l,pointer:{touch:K=!1}={}}){if(l.target&&!At&&SE)return"gesture";if(At&&K)return"touch";if(qA){if(rA)return"pointer";if(At)return"touch"}},bounds(a,d,{scaleBounds:l={},angleBounds:K={}}){const da=ra=>{ra=ah(l,ra);ra=Object.assign({},{min:-Infinity,max:Infinity},ra||{});return[ra.min,ra.max]},ja=ra=>{ra=ah(K,ra);ra=Object.assign({},{min:-Infinity,max:Infinity},ra||{});return[ra.min,ra.max]};return"function"!==typeof l&&"function"!==typeof K?[da(),
ja()]:ra=>[da(ra),ja(ra)]},threshold(a,d,l){this.lockDirection="lock"===l.axis;return Lj.toVector(a,this.lockDirection?[.1,3]:0)},modifierKey(a){return void 0===a?"ctrlKey":a},pinchOnWheel(a=!0){return a}}),XE=class extends zt{constructor(...a){super(...a);ui(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(Mk(a));
this.compute(a);this.computeInitial();this.emit()}moveChange(a){if(this.state._active){var d=Mk(a),l=this.state;l._delta=Lj.sub(d,l._values);Lj.addTo(l._movement,l._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))}},YE=Tg(Tg({},jr),{},{mouseOnly:(a=!0)=>a}),ZE=class extends zt{constructor(...a){super(...a);ui(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 l,K;const {scrollX:da,scrollY:ja,scrollLeft:ra,scrollTop:Ka}=a.currentTarget;var Sa=[null!==(l=null!==da&&void 0!==da?da:ra)&&void 0!==l?l:0,null!==(K=null!==ja&&void 0!==ja?ja:Ka)&&void 0!==K?K:0];d._delta=Lj.sub(Sa,d._values);Lj.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))}},$E=jr,aF=class extends zt{constructor(...a){super(...a);ui(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=Nk(a);Lj.addTo(d._movement,d._delta);al(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))}},bF=jr,cF=class extends zt{constructor(...a){super(...a);ui(this,"ingKey","hovering")}enter(a){this.config.mouseOnly&&"mouse"!==a.pointerType||(this.start(a),this.computeValues(Mk(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 l=Mk(a);d._movement=d._delta=Lj.sub(l,d._values);this.computeValues(l);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))}},dF=Tg(Tg({},jr),{},{mouseOnly:(a=!0)=>a}),hx=new Map,ix=new Map,eF={key:"drag",engine:RE,resolver:UE},fF={key:"hover",engine:cF,resolver:dF},gF={key:"move",engine:XE,resolver:YE},hF={key:"pinch",engine:VE,resolver:WE},iF={key:"scroll",engine:ZE,resolver:$E},jF={key:"wheel",engine:aF,resolver:bF},jx=Kf(aa(0)),kF={target(a){if(a)return()=>"current"in a?a.current:a},enabled(a=
!0){return a},window(a=kr?window:void 0){return a},eventOptions({passive:a=!0,capture:d=!1}={}){return{passive:a,capture:d}},transform(a){return a}},lF=["target","eventOptions","window","enabled","transform"],tA=class{constructor(a,d){ui(this,"_listeners",new Set);this._ctrl=a;this._gestureKey=d}add(a,d,l,K,da){const ja=this._listeners,ra=Ni(d,l),Ka=Tg(Tg({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),da);a.addEventListener(ra,K,Ka);const Sa=()=>{a.removeEventListener(ra,
K,Ka);ja.delete(Sa)};ja.add(Sa);return Sa}clean(){this._listeners.forEach(a=>a());this._listeners.clear()}},mF=class{constructor(){ui(this,"_timeouts",new Map)}add(a,d,l=140,...K){this.remove(a);this._timeouts.set(a,window.setTimeout(d,l,...K))}remove(a){(a=this._timeouts.get(a))&&window.clearTimeout(a)}clean(){this._timeouts.forEach(a=>void window.clearTimeout(a));this._timeouts.clear()}},nF=class{constructor(a){ui(this,"gestures",new Set);ui(this,"_targetEventStore",new tA(this));ui(this,"gestureEventStores",
{});ui(this,"gestureTimeoutStores",{});ui(this,"handlers",{});ui(this,"config",{});ui(this,"pointerIds",new Set);ui(this,"touchIds",new Set);ui(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}});a.drag&&mi(this,"drag");a.wheel&&mi(this,"wheel");a.scroll&&mi(this,"scroll");a.move&&mi(this,"move");a.pinch&&mi(this,"pinch");a.hover&&mi(this,"hover")}setEventIds(a){if("touches"in a)return this.touchIds=new Set(Fj(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=Di(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 l={};let K;if(d.target&&
(K=d.target(),!K))return;if(d.enabled){for(const da of this.gestures){const ja=this.config[da],ra=uA(l,ja.eventOptions,!!K);ja.enabled&&(new (hx.get(da))(this,a,da)).bind(ra)}d=uA(l,d.eventOptions,!!K);for(const da in this.nativeHandlers)d(da,"",ja=>this.nativeHandlers[da](Tg(Tg({},this.state.shared),{},{event:ja,args:a})),void 0,!0)}for(const da in l)l[da]=Ph(...l[da]);if(!K)return l;for(const da in l){const {device:ja,capture:ra,passive:Ka}=Of(da);this._targetEventStore.add(K,ja,"",l[da],{capture:ra,
passive:Ka})}}},uA=(a,d,l)=>(K,da,ja,ra={},Ka=!1)=>{var Sa,bb;const gb=null!==(Sa=ra.capture)&&void 0!==Sa?Sa:d.capture;ra=null!==(bb=ra.passive)&&void 0!==bb?bb:d.passive;K=Ka?K:El(K,da,gb);l&&ra&&(K+="Passive");a[K]=a[K]||[];a[K].push(ja)},oF=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/,cv=Kf(aa(0)),kx=Kf(aa(0)),vA=Kf(aa(0)),wA=Kf(aa(0)),pF=Kf(aa(0)),qF=Kf(aa(0)),rF=Kf(aa(0)),sF=Kf(aa(0)),tF={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)=>Ed('\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)=>Ed("\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)=>Ed("\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)=>Ed("\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)=>Ed("\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)=>Ed("\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)=>Ed("\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)=>Ed("\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)=>Ed("\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)=>Ed('\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)=>Ed('\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)=>Ed('\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)=>Ed('\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)=>Ed('\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)},uF=Kf(aa(0));Kf(aa(0));var xA=aa(0),yA=Kf(aa(0));if(!aa(0).useState)throw Error("mobx-react-lite requires React with Hooks support");if(!Ue)throw Error("mobx-react-lite@3 requires mobx at least version 6 to be available");var vF=aa(1),Bt=Kf(aa(0)),zA="undefined"===typeof FinalizationRegistry?void 0:FinalizationRegistry,wF=1E4,xF=function(a){var d="function"===typeof Symbol&&Symbol.iterator,l=d&&a[d],K=0;if(l)return l.call(a);if(a&&"number"===typeof a.length)return{next:function(){a&&K>=
a.length&&(a=void 0);return{value:a&&a[K++],done:!a}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.");},AA=zA?Nd(zA):Le(),yF=AA.addReactionToTrack,zF=AA.recordReactionAsCommitted,BA=function(a,d){var l="function"===typeof Symbol&&a[Symbol.iterator];if(!l)return a;a=l.call(a);var K,da=[];try{for(;(void 0===d||0<d--)&&!(K=a.next()).done;)da.push(K.value)}catch(ra){var ja={error:ra}}finally{try{K&&!K.done&&(l=a["return"])&&l.call(a)}finally{if(ja)throw ja.error;}}return da},
AF=function(){return function(){}}(),ns=aa(0),CA="function"===typeof Symbol&&Symbol.for,DA=CA?Symbol.for("react.forward_ref"):"function"===typeof ns.forwardRef&&(0,ns.forwardRef)(function(a){return null}).$$typeof,EA=CA?Symbol.for("react.memo"):"function"===typeof ns.memo&&(0,ns.memo)(function(a){return null}).$$typeof,BF={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};rf.displayName="Observer";aa(0);aa(0);aa(0);(function(a){a||=se;xc({reactionScheduler:a})})(vF.unstable_batchedUpdates);
var CF=Kf(aa(0)),lx=aa(616),ln=CF.forwardRef(function(a,d){var {children:l,opacity:K,centered:da,className:ja=""}=a,ra=Jf(a,["children","opacity","centered","className"]);return(0,lx.jsx)(rf,{children:()=>(0,lx.jsx)("div",{ref:d,className:`tl-positioned-div ${ja}`,style:K?{opacity:K}:void 0,draggable:!1,children:(0,lx.jsx)("div",ff(Zd({className:`tl-positioned-inner ${da?"tl-centered":""}`},ra),{children:l}))})})}),DF=Kf(aa(0)),mx=aa(616),Nn=DF.forwardRef(function(a,d){var {id:l,className:K="",style:da,
children:ja}=a,ra=Jf(a,["id","className","style","children"]);return(0,mx.jsx)(rf,{children:()=>(0,mx.jsx)("svg",{ref:d,style:da,className:`tl-positioned-svg ${K}`,children:(0,mx.jsx)("g",ff(Zd({id:l,className:"tl-centered-g"},ra),{children:ja}))})})}),Ct=Kf(aa(0)),FA=Kf(aa(0)),dv=Kf(aa(0)),EF=aa(616),$p=ee(function(a){var {id:d,bounds:l,zIndex:K,rotation:da=0,className:ja="",children:ra}=a;a=Jf(a,"id bounds zIndex rotation className children".split(" "));const Ka=dv.useRef(null);dv.useLayoutEffect(()=>
{Ka.current.style.transform=`translate(
        calc(${l.minX}px - var(--tl-padding)),
        calc(${l.minY}px - var(--tl-padding)))
        rotate(${da+(l.rotation||0)}rad)`},[l.minX,l.minY,da,l.rotation]);dv.useLayoutEffect(()=>{const Sa=Ka.current;Sa.style.width=`calc(${Math.floor(l.width)}px + (var(--tl-padding) * 2))`;Sa.style.height=`calc(${Math.floor(l.height)}px + (var(--tl-padding) * 2))`},[l.width,l.height]);dv.useLayoutEffect(()=>{const Sa=Ka.current;void 0!==K&&(Sa.style.zIndex=K.toString())},[K]);return(0,EF.jsx)("div",ff(Zd({id:d,ref:Ka,className:`tl-positioned ${ja}`,"aria-label":"container"},a),{children:ra}))}),
FF=Kf(aa(0)),GA=aa(616),GF=ee(function({shapes:a,hidden:d,bounds:l,rotation:K=0}){const {components:{ContextBar:da},viewport:{bounds:ja,camera:{point:[ra,Ka],zoom:Sa}}}=dh(),bb=FF.useRef(null);var gb=sf.getRotatedBounds(l,K);gb=sf.multiplyBounds(gb,Sa);pb(bb,l,K,10005);if(!da)throw Error("Expected a ContextBar component.");const jb=sf.translateBounds(gb,[ra*Sa,Ka*Sa]);return(0,GA.jsx)("div",{ref:bb,className:"tl-counter-scaled-positioned","aria-label":"context-bar-container","data-html2canvas-ignore":"true",
children:(0,GA.jsx)(da,{hidden:d,shapes:a,bounds:l,offsets:{left:jb.minX,right:ja.width-jb.maxX,top:jb.minY,bottom:ja.height-jb.maxY,width:jb.width,height:jb.height},scaledBounds:gb,rotation:K})})}),HA=Kf(aa(0)),HF=aa(616),IA=ee(function({children:a}){const d=HA.useRef(null),{viewport:l}=dh(),K=d.current,{zoom:da,point:ja}=l.camera;HA.useEffect(()=>{K&&(K.style.transform=`scale(${da}) translate3d(${ja[0]}px, ${ja[1]}px, 0)`)},[da,ja,K]);return(0,HF.jsx)("div",{ref:d,className:"tl-absolute tl-layer",
children:a})}),ev=aa(616),JA=ee(function({shape:a,isHovered:d=!1,isSelected:l=!1,isBinding:K=!1,isEditing:da=!1,isLocked:ja=!1,meta:ra}){const {bounds:Ka,props:{scale:Sa,rotation:bb=0},ReactIndicator:gb}=a;return(0,ev.jsx)($p,{"data-type":"Indicator","data-html2canvas-ignore":"true",bounds:Ka,rotation:bb,scale:Sa,zIndex:da?1E3:1E4,children:(0,ev.jsx)(Nn,{children:(0,ev.jsx)("g",{className:`tl-indicator-container ${l?"tl-selected":"tl-hovered"} ${ja?"tl-locked":""}`,children:(0,ev.jsx)(gb,{isEditing:da,
isBinding:K,isHovered:d,isLocked:ja,isSelected:l,isErasing:!1,meta:ra})})})})}),KA=Kf(aa(0)),fv=aa(616),IF=ee(function({bounds:a,shape:d}){const {viewport:{camera:{zoom:l}},components:{QuickLinks:K}}=dh();var da=mg();const ja=Jg(d);if(!K)throw Error("Expected a QuickLinks component.");da=50>a.height*l||!da.selectedShapesArray.includes(d);return(0,fv.jsx)($p,{bounds:a,className:"tl-quick-links-container","data-html2canvas-ignore":"true",children:(0,fv.jsx)(ln,{children:(0,fv.jsx)("span",ff(Zd({style:{position:"absolute",
top:"100%",pointerEvents:"all",transformOrigin:"left top",paddingTop:"8px",transform:"scale(var(--tl-scale))",minWidth:"320px"}},ja),{onPointerDown:ra=>ra.stopPropagation(),children:(0,fv.jsx)(K,{className:"tl-backlinks-count "+(da?"tl-backlinks-count-rounded":""),id:d.id,shape:d})}))})})}),gv=aa(616),JF=ee(function({bounds:a,shape:d}){const {viewport:{camera:{zoom:l}},components:{BacklinksCount:K}}=dh();var da=mg();if(!K)throw Error("Expected a BacklinksCount component.");const ja=ra=>ra.stopPropagation();
da=50>a.height*l||!da.selectedShapesArray.includes(d)||d.hideSelection;return(0,gv.jsx)($p,{bounds:a,className:"tl-backlinks-count-container",children:(0,gv.jsx)(ln,{children:(0,gv.jsx)("span",{style:{position:"absolute",left:"100%",pointerEvents:"all",transformOrigin:"left top",transform:"translateY(6px) scale(var(--tl-scale))"},onPointerDown:ja,onWheelCapture:ja,onKeyDown:ja,title:"Shape Backlinks",children:(0,gv.jsx)(K,{className:"tl-backlinks-count "+(da?"tl-backlinks-count-rounded":""),id:d.id,
shape:d})})})})}),KF=Kf(aa(0)),LA=aa(616),LF=ee(function({bounds:a,hidden:d,shapes:l,rotation:K=0,detail:da="size"}){const {components:{SelectionDetail:ja},viewport:{camera:{zoom:ra}}}=dh(),Ka=KF.useRef(null),Sa=sf.multiplyBounds(a,ra);pb(Ka,a,K,10003);if(!ja)throw Error("Expected a SelectionDetail component.");return(0,LA.jsx)("div",{ref:Ka,className:`tl-counter-scaled-positioned ${d?"tl-fade-out":""}`,"aria-label":"bounds-detail-container","data-html2canvas-ignore":"true",children:(0,LA.jsx)(ja,
{shapes:l,bounds:a,scaledBounds:Sa,zoom:ra,rotation:K,detail:da})})}),MA=aa(616),MF=ee(function({shape:a,isHovered:d=!1,isSelected:l=!1,isBinding:K=!1,isErasing:da=!1,isEditing:ja=!1,onEditingEnd:ra,asset:Ka,meta:Sa,zIndex:bb}){const {bounds:gb,props:{rotation:jb,scale:Jb},ReactComponent:Ob}=a,Lb=mg(),gc=Jg(a);var rc=Lb.getParentGroup(a);rc=Lb.selectedIds.has(null==rc?void 0:rc.id);return(0,MA.jsx)($p,{"data-shape-id":a.id,"data-html2canvas-ignore":!l&&!rc&&0!==Lb.selectedShapes.size||null,zIndex:bb,
"data-type":"Shape",bounds:gb,rotation:jb,scale:Jb,children:(0,MA.jsx)(Ob,{meta:Sa,isEditing:ja,isBinding:K,isHovered:d,isSelected:l,isErasing:da,events:gc,asset:Ka,onEditingEnd:ra})})}),os=aa(616),NA=[[-1,.15,64],[.05,.375,16],[.15,1,4],[.7,2.5,1]],NF=ee(function({size:a}){const {viewport:{camera:{point:d,zoom:l}}}=dh();return(0,os.jsxs)("svg",{className:"tl-grid",version:"1.1",xmlns:"http://www.w3.org/2000/svg","data-html2canvas-ignore":"true",children:[(0,os.jsx)("defs",{children:NA.map(([K,da,
ja],ra)=>{ja=ja*a*l;var Ka=d[0]*l,Sa=d[1]*l;Ka=0<Ka?Ka%ja:ja+Ka%ja;Sa=0<Sa?Sa%ja:ja+Sa%ja;K=jk(l,[K,da],[0,1]);return(0,os.jsx)("pattern",{id:`grid-${ra}`,width:ja,height:ja,patternUnits:"userSpaceOnUse",children:!(2<K||.1>K)&&(0,os.jsx)("circle",{className:"tl-grid-dot",cx:Ka,cy:Sa,r:1.5,opacity:Math.max(0,Math.min(K,1))})},`grid-pattern-${ra}`)})}),NA.map((K,da)=>(0,os.jsx)("rect",{width:"100%",height:"100%",fill:`url(#grid-${da})`},`grid-rect-${da}`))]})}),OA=ee(function({size:a}){return(0,os.jsx)(NF,
{size:a})}),PA=aa(616),QA=ee(function({bounds:a}){const d=kk("background");return(0,PA.jsx)(Nn,ff(Zd({"data-html2canvas-ignore":"true"},d),{children:(0,PA.jsx)("rect",{className:"tl-bounds-bg",width:Math.max(1,a.width),height:Math.max(1,a.height),pointerEvents:"all",rx:8,ry:8})}))});aa(0);var RA=aa(616),SA=ee(function({scaledBounds:a,shapes:d,detail:l="size",rotation:K=0}){var da;const ja=1===d.length?K:null!=(da=a.rotation)?da:0;return(0,RA.jsx)(ln,{centered:!0,children:(0,RA.jsx)("div",{className:"tl-bounds-detail",
style:{transform:ja<Mo||ja>3*Mo?`rotate(${ja}rad) translateY(${a.height/2+24}px)`:`rotate(${Math.PI+ja}rad) translateY(${a.height/2+32}px)`,padding:"2px 3px",borderRadius:"1px"},children:1===d.length&&"line"===d[0].type?`${be.dist(d[0].props.handles.start.point,d[0].props.handles.end.point).toFixed()}`:"size"===l?`${a.width.toFixed()} \xD7 ${a.height.toFixed()}`:`\u2220${Ml.radiansToDegrees(Ml.clampRadians(K)).toFixed()}\xB0`})})}),nx=aa(616),OF={top_left_corner:"tl-cursor-nwse",top_right_corner:"tl-cursor-nesw",
bottom_right_corner:"tl-cursor-nwse",bottom_left_corner:"tl-cursor-nesw"},hv=ee(function({cx:a,cy:d,size:l,targetSize:K,corner:da,isHidden:ja}){const ra=kk(da);return(0,nx.jsxs)("g",ff(Zd({opacity:ja?0:1},ra),{children:[(0,nx.jsx)("rect",{className:"tl-transparent "+(ja?"":OF[da]),"aria-label":`${da} target`,x:a-1.25*K,y:d-1.25*K,width:2.5*K,height:2.5*K,pointerEvents:ja?"none":"all"}),(0,nx.jsx)("rect",{className:"tl-corner-handle","aria-label":`${da} handle`,x:a-l/2,y:d-l/2,width:l,height:l,pointerEvents:"none"})]}))}),
iv=aa(616),ox=ee(function({cx:a,cy:d,size:l,direction:K,isHidden:da}){const ja=mg();return(0,iv.jsxs)("g",{className:"tl-clone-handle",opacity:da?0:1,children:[(0,iv.jsx)("circle",{"aria-label":`${K} handle`,pointerEvents:"all",onPointerDown:ra=>ja.api.clone(K),cx:a,cy:d,r:l}),(0,iv.jsx)("line",{x1:a-l/2,y1:d,x2:a+l/2,y2:d}),(0,iv.jsx)("line",{x1:a,y1:d-l/2,x2:a,y2:d+l/2})]})}),PF=aa(616),QF={top_edge:"tl-cursor-ns",right_edge:"tl-cursor-ew",bottom_edge:"tl-cursor-ns",left_edge:"tl-cursor-ew"},jv=
ee(function({x:a,y:d,width:l,height:K,targetSize:da,edge:ja,disabled:ra,isHidden:Ka}){const Sa=kk(ja);return(0,PF.jsx)("rect",Zd({pointerEvents:Ka||ra?"none":"all",className:"tl-transparent tl-edge-handle "+(Ka?"":QF[ja]),"aria-label":`${ja} target`,opacity:Ka?0:1,x:a-da,y:d-da,width:Math.max(1,l+2*da),height:Math.max(1,K+2*da)},Sa))}),px=aa(616);ee(function({cx:a,cy:d,size:l,targetSize:K,isHidden:da}){const ja=kk("rotate");return(0,px.jsxs)("g",ff(Zd({opacity:da?0:1},ja),{children:[(0,px.jsx)("circle",
{className:"tl-transparent ","aria-label":"rotate target",cx:a,cy:d,r:K,pointerEvents:da?"none":"all"}),(0,px.jsx)("circle",{className:"tl-rotate-handle","aria-label":"rotate handle",cx:a,cy:d,r:l/2,pointerEvents:"none"})]}))});aa(0);var TA=aa(616),kv=ee(function({cx:a,cy:d,targetSize:l,corner:K,isHidden:da}){const ja=kk(K);return(0,TA.jsx)("g",ff(Zd({opacity:da?0:1},ja),{children:(0,TA.jsx)("rect",{className:"tl-transparent","aria-label":`${K} target`,x:a-2.5*l,y:d-2.5*l,width:3*l,height:3*l,pointerEvents:da?
"none":"all"})}))}),Gk=aa(616),UA=ee(function({bounds:a,showResizeHandles:d,showRotateHandles:l,showCloneHandles:K,shapes:da}){var ja,ra;const Ka=mg();let {width:Sa,height:bb}=a;var gb=Ka.viewport.camera.zoom;a=8/gb;const jb=6/gb;gb=30/gb;const Jb=2*a,Ob=1===da.length?da[0].canResize:[!0,!0],Lb=null!=(ra=null==(ja=Ka.editingShape)?void 0:ja.props.borderRadius)?ra:0;return(0,Gk.jsx)(Gk.Fragment,{children:0<da.length&&(0,Gk.jsxs)(Nn,{children:[!Ka.editingShape&&(0,Gk.jsx)("rect",{className:"tl-bounds-fg",
width:Math.max(Sa,1),height:Math.max(bb,1),rx:Lb,ry:Lb,pointerEvents:"none"}),(0,Gk.jsx)(jv,{x:2*jb,y:0,width:Sa-4*jb,height:0,targetSize:jb,edge:"top_edge",disabled:!Ob[1],isHidden:!d}),(0,Gk.jsx)(jv,{x:Sa,y:2*jb,width:0,height:bb-4*jb,targetSize:jb,edge:"right_edge",disabled:!Ob[0],isHidden:!d}),(0,Gk.jsx)(jv,{x:2*jb,y:bb,width:Sa-4*jb,height:0,targetSize:jb,edge:"bottom_edge",disabled:!Ob[1],isHidden:!d}),(0,Gk.jsx)(jv,{x:0,y:2*jb,width:0,height:bb-4*jb,targetSize:jb,edge:"left_edge",disabled:!Ob[0],
isHidden:!d}),(0,Gk.jsx)(kv,{cx:0,cy:0,targetSize:jb,corner:"top_left_resize_corner",isHidden:!l}),(0,Gk.jsx)(kv,{cx:Sa+2*jb,cy:0,targetSize:jb,corner:"top_right_resize_corner",isHidden:!l}),(0,Gk.jsx)(kv,{cx:Sa+2*jb,cy:bb+2*jb,targetSize:jb,corner:"bottom_right_resize_corner",isHidden:!l}),(0,Gk.jsx)(kv,{cx:0,cy:bb+2*jb,targetSize:jb,corner:"bottom_left_resize_corner",isHidden:!l}),(0,Gk.jsx)(ox,{cx:-gb,cy:bb/2,size:Jb,direction:"left",isHidden:!K}),(0,Gk.jsx)(ox,{cx:Sa+gb,cy:bb/2,size:Jb,direction:"right",
isHidden:!K}),(0,Gk.jsx)(ox,{cx:Sa/2,cy:bb+gb,size:Jb,direction:"down",isHidden:!K}),(null==Ob?void 0:Ob.every(gc=>gc))&&(0,Gk.jsxs)(Gk.Fragment,{children:[(0,Gk.jsx)(hv,{cx:0,cy:0,size:a,targetSize:jb,corner:"top_left_corner",isHidden:!d}),(0,Gk.jsx)(hv,{cx:Sa,cy:0,size:a,targetSize:jb,corner:"top_right_corner",isHidden:!d}),(0,Gk.jsx)(hv,{cx:Sa,cy:bb,size:a,targetSize:jb,corner:"bottom_right_corner",isHidden:!d}),(0,Gk.jsx)(hv,{cx:0,cy:bb,size:a,targetSize:jb,corner:"bottom_left_corner",isHidden:!d})]})]})})}),
qx=aa(616),VA=ee(function({bounds:a}){return(0,qx.jsx)($p,{bounds:a,zIndex:10001,children:(0,qx.jsx)(Nn,{children:(0,qx.jsx)("rect",{className:"tl-brush",x:0,y:0,width:a.width,height:a.height})})})}),WA=aa(616);ee(function(){return(0,WA.jsx)(WA.Fragment,{})});var rx=aa(616),XA=ee(function({shape:a,handle:d,id:l}){a=ld(a,l);const [K,da]=d.point;return(0,rx.jsxs)("g",ff(Zd({className:"tl-handle","aria-label":"handle"},a),{transform:`translate(${K}, ${da})`,children:[(0,rx.jsx)("circle",{className:"tl-handle-bg",
pointerEvents:"all"}),(0,rx.jsx)("circle",{className:"tl-counter-scaled tl-handle",pointerEvents:"none",r:4})]}))}),YA=Kf(aa(0)),sx=aa(616),tx=ee(function({direction:a}){const {viewport:{bounds:d}}=dh(),l=YA.useRef(null);YA.useLayoutEffect(()=>{const K=l.current;if(K){var da=[d.width/2,d.height/2],ja=sf.getRectangleSides([12,12],[d.width-24,d.height-24]);for(const [,[ra,Ka]]of ja)ja=u(da,a,ra,Ka),ja.didIntersect&&(ja=ja.points[0],K.style.transform=`translate(${ja[0]-6}px,${ja[1]-6}px) rotate(${be.toAngle(a)}rad)`)}},
[a,d]);return(0,sx.jsx)("div",{ref:l,className:"tl-direction-indicator","data-html2canvas-ignore":"true",children:(0,sx.jsx)("svg",{height:12,width:12,children:(0,sx.jsx)("polygon",{points:"0,0 12,6 0,12"})})})}),Mj=aa(616),RF=ee(function({id:a,className:d,brush:l,shapes:K,assets:da,bindingShapes:ja,editingShape:ra,hoveredShape:Ka,hoveredGroup:Sa,selectionBounds:bb,selectedShapes:gb,erasingShapes:jb,selectionDirectionHint:Jb,cursor:Ob="default",cursorRotation:Lb=0,selectionRotation:gc=0,showSelection:rc=
!0,showHandles:Wb=!0,showSelectionRotation:kc=!1,showResizeHandles:hc=!0,showRotateHandles:Fc=!0,showCloneHandles:Lc=!0,showSelectionDetail:ud=!0,showContextBar:Jd=!0,showGrid:Ee=!0,gridSize:Sd=8,onEditingEnd:De=KE,theme:gf=Pu,children:Te}){var df;const Gd=Ct.useRef(null),{viewport:od,components:Dd,meta:jd}=dh(),Cd=mg(),Me=Ct.useCallback(ef=>{Cd.inputs.updateContainerOffset([ef.minX,ef.minY])},[]);$k(gf,a);$c(Gd);mj(Gd,od,Me);$i(Gd);ie();Xd(Gd,Ob,Lb);oe(Gd);sg(Gd);a=hg();const af=(Ob=1===(null==gb?
void 0:gb.length)&&gb[0])&&"handles"in Ob.props?null==gb?void 0:gb[0]:void 0,Nf=Ct.useMemo(()=>new Set(gb||[]),[gb]),bg=Ct.useMemo(()=>new Set(jb||[]),[jb]);Ob=1===(null==gb?void 0:gb.length)?gb[0]:void 0;Sa=[...(new Set([Sa,Ka]))].filter(cg);return(0,Mj.jsxs)("div",{ref:Gd,className:`tl-container ${null!=d?d:""}`,children:[(0,Mj.jsxs)("div",ff(Zd({tabIndex:-1,className:"tl-absolute tl-canvas"},a),{children:[Ee&&Dd.Grid&&(0,Mj.jsx)(Dd.Grid,{size:Sd}),(0,Mj.jsxs)(IA,{children:[Dd.SelectionBackground&&
gb&&bb&&rc&&(0,Mj.jsx)($p,{"data-type":"SelectionBackground",bounds:bb,zIndex:2,"data-html2canvas-ignore":"true",children:(0,Mj.jsx)(Dd.SelectionBackground,{shapes:gb,bounds:bb,showResizeHandles:hc,showRotateHandles:Fc})}),K&&K.map((ef,Eg)=>(0,Mj.jsx)(MF,{shape:ef,asset:da&&ef.props.assetId?da[ef.props.assetId]:void 0,isEditing:ef===ra,isHovered:ef===Ka,isBinding:null==ja?void 0:ja.includes(ef),isSelected:Nf.has(ef),isErasing:bg.has(ef),meta:jd,zIndex:1E3+Eg,onEditingEnd:De},"shape_"+ef.id)),!Cd.isIn("select.pinching")&&
(null==gb?void 0:gb.map(ef=>(0,Mj.jsx)(JA,{shape:ef,isEditing:ef===ra,isHovered:!1,isBinding:!1,isSelected:!0,isLocked:ef.props.isLocked},"selected_indicator_"+ef.id))),Sa.map(ef=>ef!==ra&&(0,Mj.jsx)(JA,{shape:ef},"hovered_indicator_"+ef.id)),Ob&&Dd.BacklinksCount&&(0,Mj.jsx)(JF,{hidden:!1,bounds:Ob.bounds,shape:Ob}),Ka&&Ka!==Ob&&Dd.QuickLinks&&(0,Mj.jsx)(IF,{hidden:!1,bounds:Ka.bounds,shape:Ka}),l&&Dd.Brush&&(0,Mj.jsx)(Dd.Brush,{bounds:l}),gb&&bb&&(0,Mj.jsxs)(Mj.Fragment,{children:[rc&&Dd.SelectionForeground&&
(0,Mj.jsx)($p,{"data-type":"SelectionForeground","data-html2canvas-ignore":"true",bounds:bb,zIndex:ra&&gb.includes(ra)?1002:10002,children:(0,Mj.jsx)(Dd.SelectionForeground,{shapes:gb.filter(ef=>!ef.props.isLocked),bounds:bb,showResizeHandles:hc,showRotateHandles:Fc,showCloneHandles:Lc})}),Wb&&af&&Dd.Handle&&(0,Mj.jsx)($p,{"data-type":"onlySelectedShapeWithHandles","data-html2canvas-ignore":"true",bounds:bb,zIndex:10003,children:(0,Mj.jsx)(Nn,{children:Object.entries(null!=(df=af.props.handles)?df:
{}).map(([ef,Eg])=>Ct.createElement(Dd.Handle,{key:`${Eg.id}_handle_${Eg.id}`,shape:af,handle:Eg,id:ef}))})}),gb&&Dd.SelectionDetail&&(0,Mj.jsx)(LF,{"data-html2canvas-ignore":"true",shapes:gb,bounds:bb,detail:kc?"rotation":"size",hidden:!ud,rotation:gc},"detail"+gb.map(ef=>ef.id).join(""))]})]}),Jb&&bb&&gb&&(0,Mj.jsx)(tx,{direction:Jb,bounds:bb,shapes:gb}),(0,Mj.jsx)("div",{id:"tl-dev-tools-canvas-anchor","data-html2canvas-ignore":"true"})]})),(0,Mj.jsx)(IA,{children:gb&&bb&&(0,Mj.jsx)(Mj.Fragment,
{children:gb&&Dd.ContextBar&&(0,Mj.jsx)(GF,{shapes:gb.filter(ef=>!ef.props.isLocked),hidden:!Jd,bounds:Ob?Ob.bounds:bb,rotation:Ob?Ob.props.rotation:0},"context"+gb.map(ef=>ef.id).join(""))})}),Te]})}),ZA=Kf(aa(0)),$A=Kf(aa(0)),aB=aa(616);ee(function({children:a}){const d=$A.useRef(null),{viewport:l}=dh();$A.useEffect(()=>ic(()=>{const K=d.current;if(K){var {zoom:da,point:ja}=l.camera;K.style.transform=`scale(${da}) translateX(${ja[0]}px) translateY(${ja[1]}px)`}}),[]);return(0,aB.jsx)("svg",{className:"tl-absolute tl-overlay",
pointerEvents:"none",children:(0,aB.jsx)("g",{ref:d,pointerEvents:"none",children:a})})});var SF=aa(616),TF=ee(function(a){const d=yc(a),l=Ej(a.id);Tc(d,a);nc(d,a);return(0,SF.jsx)(l.Provider,{value:d,children:a.children})}),UF=aa(616),VF=ee(function({id:a="noid",viewport:d,inputs:l,callbacks:K=Pu,meta:da=Pu,components:ja=Pu,children:ra}){const [Ka,Sa]=ZA.useState(()=>{const {Brush:gb,ContextBar:jb,DirectionIndicator:Jb,Grid:Ob,Handle:Lb,SelectionBackground:gc,SelectionDetail:rc,SelectionForeground:Wb}=
ja,kc=Jf(ja,"Brush ContextBar DirectionIndicator Grid Handle SelectionBackground SelectionDetail SelectionForeground".split(" "));return{id:a,viewport:d,inputs:l,callbacks:K,meta:da,components:ff(Zd({},kc),{Brush:null===gb?void 0:VA,ContextBar:jb,DirectionIndicator:null===Jb?void 0:tx,Grid:null===Ob?void 0:OA,Handle:null===Lb?void 0:XA,SelectionBackground:null===gc?void 0:QA,SelectionDetail:null===rc?void 0:SA,SelectionForeground:null===Wb?void 0:UA})}});ZA.useLayoutEffect(()=>{const {Brush:gb,ContextBar:jb,
DirectionIndicator:Jb,Grid:Ob,Handle:Lb,SelectionBackground:gc,SelectionDetail:rc,SelectionForeground:Wb}=ja,kc=Jf(ja,"Brush ContextBar DirectionIndicator Grid Handle SelectionBackground SelectionDetail SelectionForeground".split(" "));return ic(()=>{Sa({id:a,viewport:d,inputs:l,callbacks:K,meta:da,components:ff(Zd({},kc),{Brush:null===gb?void 0:VA,ContextBar:jb,DirectionIndicator:null===Jb?void 0:tx,Grid:null===Ob?void 0:OA,Handle:null===Lb?void 0:XA,SelectionBackground:null===gc?void 0:QA,SelectionDetail:null===
rc?void 0:SA,SelectionForeground:null===Wb?void 0:UA})})})},[]);const bb=ll(a);return(0,UF.jsx)(bb.Provider,{value:Ka,children:ra})}),bB=aa(616),WF=aa(616),XF=ee(function(a){const d=mg();return(0,WF.jsx)(Mg,Zd({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,showCloneHandles:d.showCloneHandles,showSelectionDetail:d.showSelectionDetail,showContextBar:d.showContextBar,cursor:d.cursors.cursor,cursorRotation:d.cursors.rotation,selectionRotation:d.selectionRotation,onEditingEnd:d.clearEditingState},
a))});aa(616);var ps=Kf(aa(0)),aq=Kf(aa(0)),YF=aa(616),ZF="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(" "),Qg=a=>{var {name:d,className:l}=a;a=Jf(a,["name","className"]);const K=ZF.includes(d)?"tie tie-":"ti ti-";return(0,YF.jsx)("i",Zd({className:[K+d,l].join(" ")},
a))},Yg=aa(0),$F=aa(0),lr=aa(0),Mm=aa(0),ux=aa(0),aG=aa(1),Nl=aa(0),Oo=(0,Nl.forwardRef)((a,d)=>{var {children:l}=a;a=Jf(a,["children"]);const K=Nl.Children.toArray(l),da=K.find(ug);if(da){const ja=da.props.children;l=K.map(ra=>ra===da?1<Nl.Children.count(ja)?Nl.Children.only(null):(0,Nl.isValidElement)(ja)?ja.props.children:null:ra);return(0,Nl.createElement)(vx,Oe({},a,{ref:d}),(0,Nl.isValidElement)(ja)?(0,Nl.cloneElement)(ja,void 0,l):null)}return(0,Nl.createElement)(vx,Oe({},a,{ref:d}),l)});Oo.displayName=
"Slot";var vx=(0,Nl.forwardRef)((a,d)=>{const {children:l}=a;a=Jf(a,["children"]);return(0,Nl.isValidElement)(l)?(0,Nl.cloneElement)(l,ff(Zd({},Zl(a,l.props)),{ref:vg(d,l.ref)})):1<Nl.Children.count(l)?Nl.Children.only(null):null});vx.displayName="SlotClone";var cB=({children:a})=>(0,Nl.createElement)(Nl.Fragment,null,a),rk="a button div h2 h3 img label li nav ol p span svg ul".split(" ").reduce((a,d)=>{const l=(0,ux.forwardRef)((K,da)=>{var {asChild:ja}=K;K=Jf(K,["asChild"]);ja=ja?Oo:d;(0,ux.useEffect)(()=>
{window[Symbol.for("radix-ui")]=!0},[]);return(0,ux.createElement)(ja,Oe({},K,{ref:da}))});l.displayName=`Primitive.${d}`;return ff(Zd({},a),{[d]:l})},{}),wx=aa(0),bG=aa(0),dB,cG=(0,Mm.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),xx=(0,Mm.forwardRef)((a,d)=>{var l;const {disableOutsidePointerEvents:K=!1,onEscapeKeyDown:da,onPointerDownOutside:ja,onFocusOutside:ra,onInteractOutside:Ka,onDismiss:Sa}=a,bb=Jf(a,"disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside onDismiss".split(" ")),
gb=(0,Mm.useContext)(cG),[jb,Jb]=(0,Mm.useState)(null),Ob=null!==(l=null===jb||void 0===jb?void 0:jb.ownerDocument)&&void 0!==l?l:null===globalThis||void 0===globalThis?void 0:globalThis.document,[,Lb]=(0,Mm.useState)({});d=$g(d,hc=>Jb(hc));l=Array.from(gb.layers);var [gc]=[...gb.layersWithOutsidePointerEventsDisabled].slice(-1);gc=l.indexOf(gc);const rc=jb?l.indexOf(jb):-1;l=0<gb.layersWithOutsidePointerEventsDisabled.size;const Wb=rc>=gc;gc=Il(hc=>{const Fc=hc.target,Lc=[...gb.branches].some(ud=>
ud.contains(Fc));Wb&&!Lc&&(null===ja||void 0===ja||ja(hc),null===Ka||void 0===Ka||Ka(hc),hc.defaultPrevented||null===Sa||void 0===Sa||Sa())},Ob);const kc=sl(hc=>{const Fc=hc.target;[...gb.branches].some(Lc=>Lc.contains(Fc))||(null===ra||void 0===ra||ra(hc),null===Ka||void 0===Ka||Ka(hc),hc.defaultPrevented||null===Sa||void 0===Sa||Sa())},Ob);rl(hc=>{rc===gb.layers.size-1&&(null===da||void 0===da||da(hc),!hc.defaultPrevented&&Sa&&(hc.preventDefault(),Sa()))},Ob);(0,Mm.useEffect)(()=>{if(jb)return K&&
(0===gb.layersWithOutsidePointerEventsDisabled.size&&(dB=Ob.body.style.pointerEvents,Ob.body.style.pointerEvents="none"),gb.layersWithOutsidePointerEventsDisabled.add(jb)),gb.layers.add(jb),Jn(),()=>{K&&1===gb.layersWithOutsidePointerEventsDisabled.size&&(Ob.body.style.pointerEvents=dB)}},[jb,Ob,K,gb]);(0,Mm.useEffect)(()=>()=>{jb&&(gb.layers.delete(jb),gb.layersWithOutsidePointerEventsDisabled.delete(jb),Jn())},[jb,gb]);(0,Mm.useEffect)(()=>{const hc=()=>Lb({});document.addEventListener("dismissableLayer.update",
hc);return()=>document.removeEventListener("dismissableLayer.update",hc)},[]);return(0,Mm.createElement)(rk.div,Oe({},bb,{ref:d,style:Zd({pointerEvents:l?Wb?"auto":"none":void 0},a.style),onFocusCapture:Wf(a.onFocusCapture,kc.onFocusCapture),onBlurCapture:Wf(a.onBlurCapture,kc.onBlurCapture),onPointerDownCapture:Wf(a.onPointerDownCapture,gc.onPointerDownCapture)}))}),eB=Kf(aa(0)),dG=aa(0),vl=(null===globalThis||void 0===globalThis?0:globalThis.document)?dG.useLayoutEffect:()=>{},eG=eB["useId".toString()]||
(()=>{}),fG=0,Sk=aa(0),gG=(a,d,l)=>Oh(void 0,null,function*(){const {placement:K="bottom",strategy:da="absolute",middleware:ja=[],platform:ra}=l,Ka=yield null==ra.isRTL?void 0:ra.isRTL(d);let Sa=yield ra.getElementRects({reference:a,floating:d,strategy:da}),{x:bb,y:gb}=Ck(Sa,K,Ka),jb=K,Jb={},Ob=0;for(let Lb=0;Lb<ja.length;Lb++){const {name:gc,fn:rc}=ja[Lb],{x:Wb,y:kc,data:hc,reset:Fc}=yield rc({x:bb,y:gb,initialPlacement:K,placement:jb,strategy:da,middlewareData:Jb,rects:Sa,platform:ra,elements:{reference:a,
floating:d}});bb=null!=Wb?Wb:bb;gb=null!=kc?kc:gb;Jb=ff(Zd({},Jb),{[gc]:Zd(Zd({},Jb[gc]),hc)});Fc&&50>=Ob&&(Ob++,"object"==typeof Fc&&(Fc.placement&&(jb=Fc.placement),Fc.rects&&(Sa=!0===Fc.rects?yield ra.getElementRects({reference:a,floating:d,strategy:da}):Fc.rects),{x:bb,y:gb}=Ck(Sa,jb,Ka)),Lb=-1)}return{x:bb,y:gb,placement:jb,strategy:da,middlewareData:Jb}}),yx=Math.min,lp=Math.max,fB=a=>({name:"arrow",options:a,fn(d){return Oh(this,null,function*(){const {element:l,padding:K=0}=null!=a?a:{},{x:da,
y:ja,placement:ra,rects:Ka,platform:Sa}=d;if(null==l)return{};const bb=mm(K),gb={x:da,y:ja},jb=cl(ra),Jb=ra.split("-")[1],Ob=$l(jb);var Lb=yield Sa.getDimensions(l);const gc="y"===jb?"top":"left",rc="y"===jb?"bottom":"right";var Wb=Ka.reference[Ob]+Ka.reference[jb]-gb[jb]-Ka.floating[Ob];const kc=gb[jb]-Ka.reference[jb];var hc=yield null==Sa.getOffsetParent?void 0:Sa.getOffsetParent(l);let Fc=hc?"y"===jb?hc.clientHeight||0:hc.clientWidth||0:0;0===Fc&&(Fc=Ka.floating[Ob]);hc=bb[gc];const Lc=Fc-Lb[Ob]-
bb[rc];Lb=Fc/2-Lb[Ob]/2+(Wb/2-kc/2);Wb=lp(hc,yx(Lb,Lc));return{[jb]:gb[jb]-(0<("start"===Jb?bb[gc]:bb[rc])&&Lb!==Wb&&Ka.reference[Ob]<=Ka.floating[Ob]?Lb<hc?hc-Lb:Lc-Lb:0),data:{[jb]:Wb,centerOffset:Lb-Wb}}})}}),hG={left:"right",right:"left",bottom:"top",top:"bottom"},iG={start:"end",end:"start"},gB=["top","right","bottom","left"];gB.reduce((a,d)=>a.concat(d,d+"-start",d+"-end"),[]);var hB=function(a){return void 0===a&&(a={}),{name:"flip",options:a,fn(d){return Oh(this,null,function*(){var l;const {placement:K,
middlewareData:da,rects:ja,initialPlacement:ra,platform:Ka,elements:Sa}=d;var bb=a;const {mainAxis:gb=!0,crossAxis:jb=!0,fallbackPlacements:Jb,fallbackStrategy:Ob="bestFit",flipAlignment:Lb=!0}=bb;bb=Jf(bb,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","flipAlignment"]);const gc=Ih(K);var rc=Jb||(gc!==ra&&Lb?function(ud){const Jd=dl(ud);return[xi(ud),Jd,xi(Jd)]}(ra):[dl(ra)]);rc=[ra,...rc];const Wb=yield Jl(d,bb),kc=[];bb=(null==(l=da.flip)?void 0:l.overflows)||[];if(gb&&kc.push(Wb[gc]),
jb){const {main:ud,cross:Jd}=tl(K,ja,yield null==Ka.isRTL?void 0:Ka.isRTL(Sa.floating));kc.push(Wb[ud],Wb[Jd])}if(bb=[...bb,{placement:K,overflows:kc}],!kc.every(ud=>0>=ud)){var hc,Fc;l=(null!=(hc=null==(Fc=da.flip)?void 0:Fc.index)?hc:0)+1;if(hc=rc[l])return{data:{index:l,overflows:bb},reset:{placement:hc}};hc="bottom";switch(Ob){case "bestFit":var Lc;(Fc=null==(Lc=bb.map(ud=>[ud,ud.overflows.filter(Jd=>0<Jd).reduce((Jd,Ee)=>Jd+Ee,0)]).sort((ud,Jd)=>ud[1]-Jd[1])[0])?void 0:Lc[0].placement)&&(hc=
Fc);break;case "initialPlacement":hc=ra}if(K!==hc)return{reset:{placement:hc}}}return{}})}}},iB=function(a){a=void 0===a?{}:a;let {strategy:d="referenceHidden"}=a,l=Jf(a,["strategy"]);return{name:"hide",fn(K){return Oh(this,null,function*(){var {rects:da}=K;switch(d){case "referenceHidden":return da=dk(yield Jl(K,ff(Zd({},l),{elementContext:"reference"})),da.reference),{data:{referenceHiddenOffsets:da,referenceHidden:ek(da)}};case "escaped":return da=dk(yield Jl(K,ff(Zd({},l),{altBoundary:!0})),da.floating),
{data:{escapedOffsets:da,escaped:ek(da)}};default:return{}}})}}},jB=function(a){return void 0===a&&(a=0),{name:"offset",options:a,fn(d){return Oh(this,null,function*(){const {x:l,y:K}=d,da=yield function(ja,ra){return Oh(this,null,function*(){const {placement:Ka,platform:Sa,elements:bb}=ja;var gb=yield null==Sa.isRTL?void 0:Sa.isRTL(bb.floating),jb=Ih(Ka);const Jb=Ka.split("-")[1],Ob="x"===cl(Ka);jb=["left","top"].includes(jb)?-1:1;gb=gb&&Ob?-1:1;const Lb="function"==typeof ra?ra(ja):ra;let {mainAxis:gc,
crossAxis:rc,alignmentAxis:Wb}="number"==typeof Lb?{mainAxis:Lb,crossAxis:0,alignmentAxis:null}:Zd({mainAxis:0,crossAxis:0,alignmentAxis:null},Lb);return Jb&&"number"==typeof Wb&&(rc="end"===Jb?-1*Wb:Wb),Ob?{x:rc*gb,y:gc*jb}:{x:gc*jb,y:rc*gb}})}(d,a);return{x:l+da.x,y:K+da.y,data:da}})}}},kB=function(a){return void 0===a&&(a={}),{name:"shift",options:a,fn(d){return Oh(this,null,function*(){const {x:l,y:K,placement:da}=d;var ja=a;const {mainAxis:ra=!0,crossAxis:Ka=!1,limiter:Sa={fn:Ob=>{let {x:Lb,
y:gc}=Ob;return{x:Lb,y:gc}}}}=ja;var bb=Jf(ja,["mainAxis","crossAxis","limiter"]);ja={x:l,y:K};bb=yield Jl(d,bb);const gb=cl(Ih(da)),jb="x"===gb?"y":"x";let Jb=ja[gb];ja=ja[jb];ra&&(Jb=lp(Jb+bb["y"===gb?"top":"left"],yx(Jb,Jb-bb["y"===gb?"bottom":"right"])));Ka&&(ja=lp(ja+bb["y"===jb?"top":"left"],yx(ja,ja-bb["y"===jb?"bottom":"right"])));ja=Sa.fn(ff(Zd({},d),{[gb]:Jb,[jb]:ja}));return ff(Zd({},ja),{data:{x:ja.x-l,y:ja.y-K}})})}}},lB=function(a){return void 0===a&&(a={}),{options:a,fn(d){const {x:l,
y:K,placement:da,rects:ja,middlewareData:ra}=d,{offset:Ka=0,mainAxis:Sa=!0,crossAxis:bb=!0}=a;var gb={x:l,y:K};d=cl(da);const jb="x"===d?"y":"x";let Jb=gb[d];gb=gb[jb];var Ob="function"==typeof Ka?Ka(ff(Zd({},ja),{placement:da})):Ka;Ob="number"==typeof Ob?{mainAxis:Ob,crossAxis:0}:Zd({mainAxis:0,crossAxis:0},Ob);if(Sa){var Lb="y"===d?"height":"width",gc=ja.reference[d]-ja.floating[Lb]+Ob.mainAxis;Lb=ja.reference[d]+ja.reference[Lb]-Ob.mainAxis;Jb<gc?Jb=gc:Jb>Lb&&(Jb=Lb)}if(bb){var rc,Wb,kc,hc;const Fc=
"y"===d?"width":"height";gc=["top","left"].includes(Ih(da));Lb=ja.reference[jb]-ja.floating[Fc]+(gc&&null!=(rc=null==(Wb=ra.offset)?void 0:Wb[jb])?rc:0)+(gc?0:Ob.crossAxis);rc=ja.reference[jb]+ja.reference[Fc]+(gc?0:null!=(kc=null==(hc=ra.offset)?void 0:hc[jb])?kc:0)-(gc?Ob.crossAxis:0);gb<Lb?gb=Lb:gb>rc&&(gb=rc)}return{[d]:Jb,[jb]:gb}}}},jG=function(a){return void 0===a&&(a={}),{name:"size",options:a,fn(d){return Oh(this,null,function*(){const {placement:l,rects:K,platform:da,elements:ja}=d;var ra=
a,{apply:Ka}=ra;ra=Jf(ra,["apply"]);ra=yield Jl(d,ra);var Sa=Ih(l),bb=l.split("-")[1],gb,jb;"top"===Sa||"bottom"===Sa?(gb=Sa,jb=bb===((yield null==da.isRTL?void 0:da.isRTL(ja.floating))?"start":"end")?"left":"right"):(jb=Sa,gb="end"===bb?"top":"bottom");Sa=lp(ra.left,0);bb=lp(ra.right,0);const Jb=lp(ra.top,0),Ob=lp(ra.bottom,0);jb={availableHeight:K.floating.height-(["left","right"].includes(l)?2*(0!==Jb||0!==Ob?Jb+Ob:lp(ra.top,ra.bottom)):ra[gb]),availableWidth:K.floating.width-(["top","bottom"].includes(l)?
2*(0!==Sa||0!==bb?Sa+bb:lp(ra.left,ra.right)):ra[jb])};gb=yield da.getDimensions(ja.floating);null==Ka||Ka(Zd(Zd({},d),jb));Ka=yield da.getDimensions(ja.floating);return gb.width!==Ka.width||gb.height!==Ka.height?{reset:{rects:!0}}:{}})}}},mB=Math.min,Dt=Math.max,lv=Math.round,kG={getClippingRect:function(a){let {element:d,boundary:l,rootBoundary:K,strategy:da}=a;a=[...("clippingAncestors"===l?gp(d):[].concat(l)),K];a=a.reduce((ja,ra)=>{ra=co(d,ra,da);return ja.top=Dt(ra.top,ja.top),ja.right=mB(ra.right,
ja.right),ja.bottom=mB(ra.bottom,ja.bottom),ja.left=Dt(ra.left,ja.left),ja},co(d,a[0],da));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(a){let {rect:d,offsetParent:l,strategy:K}=a;var da=rj(l);const ja=Cj(l);if(l===ja)return d;a={scrollLeft:0,scrollTop:0};var ra=0,Ka=0;(da||!da&&"fixed"!==K)&&(("body"!==Ci(l)||Ji(ja))&&(a=bm(l)),rj(l))&&(da=ik(l,!0),ra=da.x+l.clientLeft,Ka=da.y+l.clientTop);return ff(Zd({},d),{x:d.x-
a.scrollLeft+ra,y:d.y-a.scrollTop+Ka})},isElement:xk,getDimensions:Ul,getOffsetParent:bj,getDocumentElement:Cj,getElementRects:a=>{let {reference:d,floating:l,strategy:K}=a;a=bj(l);var da=rj(a);const ja=Cj(a);var ra;if(ra=da)ra=ik(a),ra=lv(ra.width)!==a.offsetWidth||lv(ra.height)!==a.offsetHeight;ra=ik(d,ra,"fixed"===K);let Ka={scrollLeft:0,scrollTop:0};var Sa=0,bb=0;if(da||!da&&"fixed"!==K)(("body"!==Ci(a)||Ji(ja))&&(Ka=bm(a)),rj(a))?(da=ik(a,!0),Sa=da.x+a.clientLeft,bb=da.y+a.clientTop):ja&&(Sa=
yn(ja));return{reference:{x:ra.left+Ka.scrollLeft-Sa,y:ra.top+Ka.scrollTop-bb,width:ra.width,height:ra.height},floating:ff(Zd({},Ul(l)),{x:0,y:0})}},getClientRects:a=>Array.from(a.getClientRects()),isRTL:a=>"rtl"===Ri(a).direction},lG=(a,d,l)=>gG(a,d,Zd({platform:kG},l)),mn=Kf(aa(0),1),nB=aa(0),mG=Kf(aa(1),1),zx="undefined"!==typeof document?nB.useLayoutEffect:nB.useEffect,oB=a=>{const {element:d,padding:l}=a;return{name:"arrow",options:a,fn(K){if(Object.prototype.hasOwnProperty.call(d,"current")){if(null!=
d.current)return fB({element:d.current,padding:l}).fn(K)}else if(d)return fB({element:d,padding:l}).fn(K);return{}}}},Ax=aa(0),nG=(0,Ax.forwardRef)((a,d)=>{const {children:l,width:K=10,height:da=5}=a,ja=Jf(a,["children","width","height"]);return(0,Ax.createElement)(rk.svg,Oe({},ja,{ref:d,width:K,height:da,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),a.asChild?l:(0,Ax.createElement)("polygon",{points:"0,0 30,0 15,10"}))}),oG=aa(0),[Bx,qs]=Gh("Popper"),[pG,pB]=Bx("Popper"),Cx=(0,Sk.forwardRef)((a,
d)=>{const {__scopePopper:l,virtualRef:K}=a;a=Jf(a,["__scopePopper","virtualRef"]);const da=pB("PopperAnchor",l),ja=(0,Sk.useRef)(null);d=$g(d,ja);(0,Sk.useEffect)(()=>{da.onAnchorChange((null===K||void 0===K?void 0:K.current)||ja.current)});return K?null:(0,Sk.createElement)(rk.div,Oe({},a,{ref:d}))}),[qG,rG]=Bx("PopperContent"),[sG,tG]=Bx("PopperContent",{hasParent:!1,positionUpdateFns:new Set}),Dx=(0,Sk.forwardRef)((a,d)=>{var l,K,da,ja,ra,Ka,Sa,bb;const {__scopePopper:gb,side:jb="bottom",sideOffset:Jb=
0,align:Ob="center",alignOffset:Lb=0,arrowPadding:gc=0,collisionBoundary:rc=[],collisionPadding:Wb=0,sticky:kc="partial",hideWhenDetached:hc=!1,avoidCollisions:Fc=!0}=a;a=Jf(a,"__scopePopper side sideOffset align alignOffset arrowPadding collisionBoundary collisionPadding sticky hideWhenDetached avoidCollisions".split(" "));const Lc=pB("PopperContent",gb),[ud,Jd]=(0,Sk.useState)(null);d=$g(d,Fi=>Jd(Fi));const [Ee,Sd]=(0,Sk.useState)(null);var De=tb(Ee),gf=null!==(l=null===De||void 0===De?void 0:De.width)&&
void 0!==l?l:0;l=null!==(K=null===De||void 0===De?void 0:De.height)&&void 0!==K?K:0;K=jb+("center"!==Ob?"-"+Ob:"");De="number"===typeof Wb?Wb:Zd({top:0,right:0,bottom:0,left:0},Wb);const Te=Array.isArray(rc)?rc:[rc],df=0<Te.length;De={padding:De,boundary:Te.filter(Qb),altBoundary:df};const {reference:Gd,floating:od,strategy:Dd,x:jd,y:Cd,placement:Me,middlewareData:af,update:Nf}=Xb({strategy:"fixed",placement:K,whileElementsMounted:Sb,middleware:[jB({mainAxis:Jb+l,alignmentAxis:Lb}),Fc?kB(Zd({mainAxis:!0,
crossAxis:!1,limiter:"partial"===kc?lB():void 0},De)):void 0,Ee?oB({element:Ee,padding:gc}):void 0,Fc?hB(Zd({},De)):void 0,vG({arrowWidth:gf,arrowHeight:l}),hc?iB({strategy:"referenceHidden"}):void 0].filter(cc)});vl(()=>{Gd(Lc.anchor)},[Gd,Lc.anchor]);const bg=null!==jd&&null!==Cd,[ef,Eg]=zb(Me);gf=null===(da=af.arrow)||void 0===da?void 0:da.x;da=null===(ja=af.arrow)||void 0===ja?void 0:ja.y;ja=0!==(null===(ra=af.arrow)||void 0===ra?void 0:ra.centerOffset);const [yf,Fg]=(0,Sk.useState)();vl(()=>
{ud&&Fg(window.getComputedStyle(ud).zIndex)},[ud]);const {hasParent:Gg,positionUpdateFns:Bi}=tG("PopperContent",gb),Bj=!Gg;(0,Sk.useLayoutEffect)(()=>{if(!Bj)return Bi.add(Nf),()=>{Bi.delete(Nf)}},[Bj,Bi,Nf]);(0,Sk.useLayoutEffect)(()=>{Bj&&bg&&Array.from(Bi).reverse().forEach(Fi=>requestAnimationFrame(Fi))},[Bj,bg,Bi]);ra=ff(Zd({"data-side":ef,"data-align":Eg},a),{ref:d,style:ff(Zd({},a.style),{animation:bg?void 0:"none",opacity:null!==(Ka=af.hide)&&void 0!==Ka&&Ka.referenceHidden?0:void 0})});return(0,Sk.createElement)("div",
{ref:od,"data-radix-popper-content-wrapper":"",style:{position:Dd,left:0,top:0,transform:bg?`translate3d(${Math.round(jd)}px, ${Math.round(Cd)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:yf,["--radix-popper-transform-origin"]:[null===(Sa=af.transformOrigin)||void 0===Sa?void 0:Sa.x,null===(bb=af.transformOrigin)||void 0===bb?void 0:bb.y].join(" ")}},(0,Sk.createElement)(qG,{scope:gb,placedSide:ef,onArrowChange:Sd,arrowX:gf,arrowY:da,shouldHideArrow:ja},Bj?(0,Sk.createElement)(sG,
{scope:gb,hasParent:!0,positionUpdateFns:Bi},(0,Sk.createElement)(rk.div,ra)):(0,Sk.createElement)(rk.div,ra)))}),uG={top:"bottom",right:"left",bottom:"top",left:"right"},qB=(0,Sk.forwardRef)(function(a,d){var {__scopePopper:l}=a;a=Jf(a,["__scopePopper"]);l=rG("PopperArrow",l);return(0,Sk.createElement)("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[uG[l.placedSide]]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",
right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0}},(0,Sk.createElement)(nG,Oe({},a,{ref:d,style:ff(Zd({},a.style),{display:"block"})})))}),vG=a=>({name:"transformOrigin",options:a,fn(d){var l,K,da,ja,ra;const {placement:Ka,rects:Sa,middlewareData:bb}=d,gb=(d=0!==(null===(l=bb.arrow)||void 0===l?void 0:l.centerOffset))?0:a.arrowWidth;l=d?0:a.arrowHeight;const [jb,
Jb]=zb(Ka),Ob={start:"0%",center:"50%",end:"100%"}[Jb],Lb=(null!==(K=null===(da=bb.arrow)||void 0===da?void 0:da.x)&&void 0!==K?K:0)+gb/2;K=(null!==(ja=null===(ra=bb.arrow)||void 0===ra?void 0:ra.y)&&void 0!==ja?ja:0)+l/2;ra=ja="";"bottom"===jb?(ja=d?Ob:`${Lb}px`,ra=`${-l}px`):"top"===jb?(ja=d?Ob:`${Lb}px`,ra=`${Sa.floating.height+l}px`):"right"===jb?(ja=`${-l}px`,ra=d?Ob:`${K}px`):"left"===jb&&(ja=`${Sa.floating.width+l}px`,ra=d?Ob:`${K}px`);return{data:{x:ja,y:ra}}}}),Ex=a=>{const {__scopePopper:d,
children:l}=a,[K,da]=(0,Sk.useState)(null);return(0,Sk.createElement)(pG,{scope:d,anchor:K,onAnchorChange:da},l)},rB=aa(0),wG=Kf(aa(1)),xG=(0,rB.forwardRef)((a,d)=>{var l;const {container:K=null===globalThis||void 0===globalThis?void 0:null===(l=globalThis.document)||void 0===l?void 0:l.body}=a;a=Jf(a,["container"]);return K?wG.default.createPortal((0,rB.createElement)(rk.div,Oe({},a,{ref:d})),K):null}),mp=aa(0),yG=aa(1),Et=a=>{const {present:d,children:l}=a;a=Zb(d);const K="function"===typeof l?
l({present:a.isPresent}):mp.Children.only(l),da=$g(a.ref,K.ref);return"function"===typeof l||a.isPresent?(0,mp.cloneElement)(K,{ref:da}):null};Et.displayName="Presence";var mv=aa(0),sB=aa(0),zG=(0,sB.forwardRef)((a,d)=>(0,sB.createElement)(rk.span,Oe({},a,{ref:d,style:Zd({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)}))),[nv]=Gh("Tooltip",[qs]),ov=qs(),[AG,Fx]=nv("TooltipProvider"),[BG,Ft]=
nv("Tooltip"),CG=(0,Yg.forwardRef)((a,d)=>{var {__scopeTooltip:l}=a;const K=Jf(a,["__scopeTooltip"]),da=Ft("TooltipTrigger",l),ja=Fx("TooltipTrigger",l);l=ov(l);const ra=(0,Yg.useRef)(null);d=$g(d,ra,da.onTriggerChange);const Ka=(0,Yg.useRef)(!1),Sa=(0,Yg.useRef)(!1),bb=(0,Yg.useCallback)(()=>Ka.current=!1,[]);(0,Yg.useEffect)(()=>()=>document.removeEventListener("pointerup",bb),[bb]);return(0,Yg.createElement)(Cx,Oe({asChild:!0},l),(0,Yg.createElement)(rk.button,Oe({"aria-describedby":da.open?da.contentId:
void 0,"data-state":da.stateAttribute},K,{ref:d,onPointerMove:Wf(a.onPointerMove,gb=>{"touch"===gb.pointerType||Sa.current||ja.isPointerInTransitRef.current||(da.onTriggerEnter(),Sa.current=!0)}),onPointerLeave:Wf(a.onPointerLeave,()=>{da.onTriggerLeave();Sa.current=!1}),onPointerDown:Wf(a.onPointerDown,()=>{Ka.current=!0;document.addEventListener("pointerup",bb,{once:!0})}),onFocus:Wf(a.onFocus,()=>{if(!Ka.current)da.onOpen()}),onBlur:Wf(a.onBlur,da.onClose),onClick:Wf(a.onClick,da.onClose)})))}),
[DG,EG]=nv("TooltipPortal",{forceMount:void 0}),FG=(0,Yg.forwardRef)((a,d)=>{var l=EG("TooltipContent",a.__scopeTooltip);const {forceMount:K=l.forceMount,side:da="top"}=a;l=Jf(a,["forceMount","side"]);a=Ft("TooltipContent",a.__scopeTooltip);return(0,Yg.createElement)(Et,{present:K||a.open},a.disableHoverableContent?(0,Yg.createElement)(tB,Oe({side:da},l,{ref:d})):(0,Yg.createElement)(GG,Oe({side:da},l,{ref:d})))}),GG=(0,Yg.forwardRef)((a,d)=>{const l=Ft("TooltipContent",a.__scopeTooltip),K=Fx("TooltipContent",
a.__scopeTooltip),da=(0,Yg.useRef)(null);d=$g(d,da);const [ja,ra]=(0,Yg.useState)(null),{trigger:Ka,onClose:Sa}=l,bb=da.current,{onPointerInTransitChange:gb}=K,jb=(0,Yg.useCallback)(()=>{ra(null);gb(!1)},[gb]),Jb=(0,Yg.useCallback)((Ob,Lb)=>{const gc=ed({x:Ob.clientX,y:Ob.clientY},Ob.currentTarget.getBoundingClientRect()),rc="right"===gc||"bottom"===gc?-5:5;Ob="right"===gc||"left"===gc?{x:Ob.clientX+rc,y:Ob.clientY}:{x:Ob.clientX,y:Ob.clientY+rc};Lb=Lb.getBoundingClientRect();const {top:Wb,right:kc,
bottom:hc,left:Fc}=Lb;Lb=nd([Ob,{x:Fc,y:Wb},{x:kc,y:Wb},{x:kc,y:hc},{x:Fc,y:hc}]);ra(Lb);gb(!0)},[gb]);(0,Yg.useEffect)(()=>()=>jb(),[jb]);(0,Yg.useEffect)(()=>{if(Ka&&bb){const Ob=gc=>Jb(gc,bb),Lb=gc=>Jb(gc,Ka);Ka.addEventListener("pointerleave",Ob);bb.addEventListener("pointerleave",Lb);return()=>{Ka.removeEventListener("pointerleave",Ob);bb.removeEventListener("pointerleave",Lb)}}},[Ka,bb,Jb,jb]);(0,Yg.useEffect)(()=>{if(ja){const Ob=Lb=>{var gc=Lb.target;Lb={x:Lb.clientX,y:Lb.clientY};gc=(null===
Ka||void 0===Ka?void 0:Ka.contains(gc))||(null===bb||void 0===bb?void 0:bb.contains(gc));const {x:rc,y:Wb}=Lb;Lb=!1;for(let kc=0,hc=ja.length-1;kc<ja.length;hc=kc++){const Fc=ja[kc].x,Lc=ja[kc].y,ud=ja[hc].x,Jd=ja[hc].y;Lc>Wb!==Jd>Wb&&rc<(ud-Fc)*(Wb-Lc)/(Jd-Lc)+Fc&&(Lb=!Lb)}Lb=!Lb;gc?jb():Lb&&(jb(),Sa())};document.addEventListener("pointermove",Ob);return()=>document.removeEventListener("pointermove",Ob)}},[Ka,bb,ja,Sa,jb]);return(0,Yg.createElement)(tB,Oe({},a,{ref:d}))}),[HG,IG]=nv("Tooltip",{isInside:!1}),
tB=(0,Yg.forwardRef)((a,d)=>{const {__scopeTooltip:l,children:K,"aria-label":da,onEscapeKeyDown:ja,onPointerDownOutside:ra}=a;a=Jf(a,["__scopeTooltip","children","aria-label","onEscapeKeyDown","onPointerDownOutside"]);const Ka=Ft("TooltipContent",l),Sa=ov(l),{onClose:bb}=Ka;(0,Yg.useEffect)(()=>{document.addEventListener("tooltip.open",bb);return()=>document.removeEventListener("tooltip.open",bb)},[bb]);(0,Yg.useEffect)(()=>{if(Ka.trigger){const gb=jb=>{jb=jb.target;null!==jb&&void 0!==jb&&jb.contains(Ka.trigger)&&
bb()};window.addEventListener("scroll",gb,{capture:!0});return()=>window.removeEventListener("scroll",gb,{capture:!0})}},[Ka.trigger,bb]);return(0,Yg.createElement)(xx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:ja,onPointerDownOutside:ra,onFocusOutside:gb=>gb.preventDefault(),onDismiss:bb},(0,Yg.createElement)(Dx,Oe({"data-state":Ka.stateAttribute},Sa,a,{ref:d,style:ff(Zd({},a.style),{["--radix-tooltip-content-transform-origin"]:"var(--radix-popper-transform-origin)"})}),(0,Yg.createElement)(cB,
null,K),(0,Yg.createElement)(HG,{scope:l,isInside:!0},(0,Yg.createElement)(zG,{id:Ka.contentId,role:"tooltip"},da||K))))}),JG=(0,Yg.forwardRef)((a,d)=>{const {__scopeTooltip:l}=a;a=Jf(a,["__scopeTooltip"]);const K=ov(l);return IG("TooltipArrow",l).isInside?null:(0,Yg.createElement)(qB,Oe({},K,a,{ref:d}))}),KG=a=>{const {__scopeTooltip:d,delayDuration:l=700,skipDelayDuration:K=300,disableHoverableContent:da=!1,children:ja}=a,[ra,Ka]=(0,Yg.useState)(!0),Sa=(0,Yg.useRef)(!1),bb=(0,Yg.useRef)(0);(0,Yg.useEffect)(()=>
{const gb=bb.current;return()=>window.clearTimeout(gb)},[]);return(0,Yg.createElement)(AG,{scope:d,isOpenDelayed:ra,delayDuration:l,onOpen:(0,Yg.useCallback)(()=>{window.clearTimeout(bb.current);Ka(!1)},[]),onClose:(0,Yg.useCallback)(()=>{window.clearTimeout(bb.current);bb.current=window.setTimeout(()=>Ka(!0),K)},[K]),isPointerInTransitRef:Sa,onPointerInTransitChange:(0,Yg.useCallback)(gb=>{Sa.current=gb},[]),disableHoverableContent:da},ja)},LG=a=>{const {__scopeTooltip:d,children:l,open:K,defaultOpen:da=
!1,onOpenChange:ja,disableHoverableContent:ra,delayDuration:Ka}=a,Sa=Fx("Tooltip",a.__scopeTooltip);a=ov(d);const [bb,gb]=(0,Yg.useState)(null),jb=Ei(),Jb=(0,Yg.useRef)(0),Ob=null!==ra&&void 0!==ra?ra:Sa.disableHoverableContent,Lb=null!==Ka&&void 0!==Ka?Ka:Sa.delayDuration,gc=(0,Yg.useRef)(!1),[rc=!1,Wb]=Dc({prop:K,defaultProp:da,onChange:ud=>{if(ud)Sa.onOpen(),document.dispatchEvent(new CustomEvent("tooltip.open"));else Sa.onClose();null===ja||void 0===ja||ja(ud)}}),kc=(0,Yg.useMemo)(()=>rc?gc.current?
"delayed-open":"instant-open":"closed",[rc]),hc=(0,Yg.useCallback)(()=>{window.clearTimeout(Jb.current);gc.current=!1;Wb(!0)},[Wb]),Fc=(0,Yg.useCallback)(()=>{window.clearTimeout(Jb.current);Wb(!1)},[Wb]),Lc=(0,Yg.useCallback)(()=>{window.clearTimeout(Jb.current);Jb.current=window.setTimeout(()=>{gc.current=!0;Wb(!0)},Lb)},[Lb,Wb]);(0,Yg.useEffect)(()=>()=>window.clearTimeout(Jb.current),[]);return(0,Yg.createElement)(Ex,a,(0,Yg.createElement)(BG,{scope:d,contentId:jb,open:rc,stateAttribute:kc,trigger:bb,
onTriggerChange:gb,onTriggerEnter:(0,Yg.useCallback)(()=>{Sa.isOpenDelayed?Lc():hc()},[Sa.isOpenDelayed,Lc,hc]),onTriggerLeave:(0,Yg.useCallback)(()=>{Ob?Fc():window.clearTimeout(Jb.current)},[Fc,Ob]),onOpen:hc,onClose:Fc,disableHoverableContent:Ob},l))},MG=CG,NG=a=>{const {__scopeTooltip:d,forceMount:l,children:K,container:da}=a;a=Ft("TooltipPortal",d);return(0,Yg.createElement)(DG,{scope:d,forceMount:l},(0,Yg.createElement)(Et,{present:l||a.open},(0,Yg.createElement)(xG,{asChild:!0,container:da},
K)))},OG=FG,PG=JG,bq=aa(616),uB=aa(616),Gx=aa(616),QG=({style:a,icon:d,onClick:l})=>(0,Gx.jsx)("button",{"data-html2canvas-ignore":"true",style:a,className:"tl-circle-button",onPointerDown:l,children:(0,Gx.jsx)("div",{className:"tl-circle-button-icons-wrapper",children:(0,Gx.jsx)(Qg,{name:d})})}),vB=aa(0),wB=(0,vB.forwardRef)((a,d)=>{const {pressed:l,defaultPressed:K=!1,onPressedChange:da}=a,ja=Jf(a,["pressed","defaultPressed","onPressedChange"]),[ra=!1,Ka]=Dc({prop:l,onChange:da,defaultProp:K});
return(0,vB.createElement)(rk.button,Oe({type:"button","aria-pressed":ra,"data-state":ra?"on":"off","data-disabled":a.disabled?"":void 0},ja,{ref:d,onClick:Wf(a.onClick,()=>{a.disabled||Ka(!ra)})}))}),RG=wB,Hx=aa(616),On=aa(0),Wg=aa(0),Po=Kf(aa(0)),xB=aa(0),SG=(0,xB.createContext)(void 0),TG=aa(0),Ix=0,cq=aa(0),yB={bubbles:!1,cancelable:!0},zB=(0,cq.forwardRef)((a,d)=>{const {loop:l=!1,trapped:K=!1,onMountAutoFocus:da,onUnmountAutoFocus:ja}=a;a=Jf(a,["loop","trapped","onMountAutoFocus","onUnmountAutoFocus"]);
const [ra,Ka]=(0,cq.useState)(null),Sa=Qi(da),bb=Qi(ja),gb=(0,cq.useRef)(null);d=$g(d,Ob=>Ka(Ob));const jb=(0,cq.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,cq.useEffect)(()=>{if(K){let Ob=function(gc){!jb.paused&&ra&&(gc=gc.target,ra.contains(gc)?gb.current=gc:hf(gb.current,{select:!0}))},Lb=function(gc){!jb.paused&&ra&&(ra.contains(gc.relatedTarget)||hf(gb.current,{select:!0}))};document.addEventListener("focusin",Ob);document.addEventListener("focusout",Lb);
return()=>{document.removeEventListener("focusin",Ob);document.removeEventListener("focusout",Lb)}}},[K,ra,jb.paused]);(0,cq.useEffect)(()=>{if(ra){AB.add(jb);const Ob=document.activeElement;if(!ra.contains(Ob)){const Lb=new CustomEvent("focusScope.autoFocusOnMount",yB);ra.addEventListener("focusScope.autoFocusOnMount",Sa);ra.dispatchEvent(Lb);Lb.defaultPrevented||(nf(xh(Ze(ra)),{select:!0}),document.activeElement===Ob&&hf(ra))}return()=>{ra.removeEventListener("focusScope.autoFocusOnMount",Sa);setTimeout(()=>
{const Lb=new CustomEvent("focusScope.autoFocusOnUnmount",yB);ra.addEventListener("focusScope.autoFocusOnUnmount",bb);ra.dispatchEvent(Lb);Lb.defaultPrevented||hf(null!==Ob&&void 0!==Ob?Ob:document.body,{select:!0});ra.removeEventListener("focusScope.autoFocusOnUnmount",bb);AB.remove(jb)},0)}}},[ra,Sa,bb,jb]);const Jb=(0,cq.useCallback)(Ob=>{if((l||K)&&!jb.paused){var Lb=document.activeElement;if("Tab"===Ob.key&&!Ob.altKey&&!Ob.ctrlKey&&!Ob.metaKey&&Lb){const rc=Ob.currentTarget;var gc=rc;const Wb=
Ze(gc),kc=xg(Wb,gc);gc=xg(Wb.reverse(),gc);const [hc,Fc]=[kc,gc];hc&&Fc?Ob.shiftKey||Lb!==Fc?Ob.shiftKey&&Lb===hc&&(Ob.preventDefault(),l&&hf(Fc,{select:!0})):(Ob.preventDefault(),l&&hf(hc,{select:!0})):Lb===rc&&Ob.preventDefault()}}},[l,K,jb.paused]);return(0,cq.createElement)(rk.div,Oe({tabIndex:-1},a,{ref:d,onKeyDown:Jb}))}),AB=function(){let a=[];return{add(d){const l=a[0];d===l||null!==l&&void 0!==l&&l.pause();a=th(a,d);a.unshift(d)},remove(d){var l;a=th(a,d);null===(l=a[0])||void 0===l||l.resume()}}}(),
Tk=aa(0),UG={bubbles:!1,cancelable:!0},[Jx,BB,VG]=ag("RovingFocusGroup"),[WG,pv]=Gh("RovingFocusGroup",[VG]),[XG,YG]=WG("RovingFocusGroup"),CB=(0,Tk.forwardRef)((a,d)=>(0,Tk.createElement)(Jx.Provider,{scope:a.__scopeRovingFocusGroup},(0,Tk.createElement)(Jx.Slot,{scope:a.__scopeRovingFocusGroup},(0,Tk.createElement)(ZG,Oe({},a,{ref:d}))))),ZG=(0,Tk.forwardRef)((a,d)=>{const {__scopeRovingFocusGroup:l,orientation:K,loop:da=!1,dir:ja,currentTabStopId:ra,defaultCurrentTabStopId:Ka,onCurrentTabStopIdChange:Sa,
onEntryFocus:bb}=a,gb=Jf(a,"__scopeRovingFocusGroup orientation loop dir currentTabStopId defaultCurrentTabStopId onCurrentTabStopIdChange onEntryFocus".split(" ")),jb=(0,Tk.useRef)(null);d=$g(d,jb);const Jb=pg(ja),[Ob=null,Lb]=Dc({prop:ra,defaultProp:Ka,onChange:Sa}),[gc,rc]=(0,Tk.useState)(!1),Wb=Qi(bb),kc=BB(l),hc=(0,Tk.useRef)(!1),[Fc,Lc]=(0,Tk.useState)(0);(0,Tk.useEffect)(()=>{const ud=jb.current;if(ud)return ud.addEventListener("rovingFocusGroup.onEntryFocus",Wb),()=>ud.removeEventListener("rovingFocusGroup.onEntryFocus",
Wb)},[Wb]);return(0,Tk.createElement)(XG,{scope:l,orientation:K,dir:Jb,loop:da,currentTabStopId:Ob,onItemFocus:(0,Tk.useCallback)(ud=>Lb(ud),[Lb]),onItemShiftTab:(0,Tk.useCallback)(()=>rc(!0),[]),onFocusableItemAdd:(0,Tk.useCallback)(()=>Lc(ud=>ud+1),[]),onFocusableItemRemove:(0,Tk.useCallback)(()=>Lc(ud=>ud-1),[])},(0,Tk.createElement)(rk.div,Oe({tabIndex:gc||0===Fc?-1:0,"data-orientation":K},gb,{ref:d,style:Zd({outline:"none"},a.style),onMouseDown:Wf(a.onMouseDown,()=>{hc.current=!0}),onFocus:Wf(a.onFocus,
ud=>{var Jd=!hc.current;if(ud.target===ud.currentTarget&&Jd&&!gc&&(Jd=new CustomEvent("rovingFocusGroup.onEntryFocus",UG),ud.currentTarget.dispatchEvent(Jd),!Jd.defaultPrevented)){ud=kc().filter(Sd=>Sd.focusable);Jd=ud.find(Sd=>Sd.active);const Ee=ud.find(Sd=>Sd.id===Ob);ud=[Jd,Ee,...ud].filter(Boolean).map(Sd=>Sd.ref.current);Hg(ud)}hc.current=!1}),onBlur:Wf(a.onBlur,()=>rc(!1))})))}),DB=(0,Tk.forwardRef)((a,d)=>{const {__scopeRovingFocusGroup:l,focusable:K=!0,active:da=!1}=a,ja=Jf(a,["__scopeRovingFocusGroup",
"focusable","active"]),ra=Ei(),Ka=YG("RovingFocusGroupItem",l),Sa=Ka.currentTabStopId===ra,bb=BB(l),{onFocusableItemAdd:gb,onFocusableItemRemove:jb}=Ka;(0,Tk.useEffect)(()=>{if(K)return gb(),()=>jb()},[K,gb,jb]);return(0,Tk.createElement)(Jx.ItemSlot,{scope:l,id:ra,focusable:K,active:da},(0,Tk.createElement)(rk.span,Oe({tabIndex:Sa?0:-1,"data-orientation":Ka.orientation},ja,{ref:d,onMouseDown:Wf(a.onMouseDown,Jb=>{if(K)Ka.onItemFocus(ra);else Jb.preventDefault()}),onFocus:Wf(a.onFocus,()=>Ka.onItemFocus(ra)),
onKeyDown:Wf(a.onKeyDown,Jb=>{if("Tab"===Jb.key&&Jb.shiftKey)Ka.onItemShiftTab();else if(Jb.target===Jb.currentTarget){var Ob=Qh(Jb,Ka.orientation,Ka.dir);if(void 0!==Ob){Jb.preventDefault();let Lb=bb().filter(gc=>gc.focusable).map(gc=>gc.ref.current);if("last"===Ob)Lb.reverse();else if("prev"===Ob||"next"===Ob)"prev"===Ob&&Lb.reverse(),Jb=Lb.indexOf(Jb.currentTarget),Lb=Ka.loop?tg(Lb,Jb+1):Lb.slice(Jb+1);setTimeout(()=>Hg(Lb))}}})})))}),$G={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",
PageUp:"first",Home:"first",PageDown:"last",End:"last"},aH=function(a){return"undefined"===typeof document?null:(Array.isArray(a)?a[0]:a).ownerDocument.body},rs=new WeakMap,qv=new WeakMap,rv={},Kx=0,Lx=function(a,d,l){void 0===d&&(d=aH(a));void 0===l&&(l="data-aria-hidden");var K=Array.isArray(a)?a:[a];rv[l]||(rv[l]=new WeakMap);var da=rv[l],ja=[],ra=new Set,Ka=function(bb){bb&&!ra.has(bb)&&(ra.add(bb),Ka(bb.parentNode))};K.forEach(Ka);var Sa=function(bb){!bb||0<=K.indexOf(bb)||Array.prototype.forEach.call(bb.children,
function(gb){if(ra.has(gb))Sa(gb);else{var jb=gb.getAttribute("aria-hidden");jb=null!==jb&&"false"!==jb;var Jb=(rs.get(gb)||0)+1,Ob=(da.get(gb)||0)+1;rs.set(gb,Jb);da.set(gb,Ob);ja.push(gb);1===Jb&&jb&&qv.set(gb,!0);1===Ob&&gb.setAttribute(l,"true");jb||gb.setAttribute("aria-hidden","true")}})};Sa(d);ra.clear();Kx++;return function(){ja.forEach(function(bb){var gb=rs.get(bb)-1,jb=da.get(bb)-1;rs.set(bb,gb);da.set(bb,jb);gb||(qv.has(bb)||bb.removeAttribute("aria-hidden"),qv.delete(bb));jb||bb.removeAttribute(l)});
Kx--;Kx||(rs=new WeakMap,rs=new WeakMap,qv=new WeakMap,rv={})}},bH=Kf(CD(),1),{__assign:dq,__rest:EB,__spreadArray:lo}=bH.default,FB=Kf(aa(0)),np=Kf(aa(0)),cH=aa(0),GB=Kf(aa(0)),Dl=function(a){var d=a.sideCar;a=EB(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 GB.createElement(d,dq({},a))};Dl.isSideCarExport=!0;var Nm=function(a){void 0===a&&(a={});var d=Xl(null);d.options=dq({async:!0,
ssr:!1},a);return d}(),Ws=function(){},Eu=np.forwardRef(function(a,d){var l=np.useRef(null),K=np.useState({onScrollCapture:Ws,onWheelCapture:Ws,onTouchMoveCapture:Ws}),da=K[0];K=K[1];var ja=a.forwardProps,ra=a.children,Ka=a.className,Sa=a.removeScrollBar,bb=a.enabled,gb=a.shards,jb=a.sideCar,Jb=a.noIsolation,Ob=a.inert,Lb=a.allowPinchZoom,gc=a.as;gc=void 0===gc?"div":gc;a=EB(a,"forwardProps children className removeScrollBar enabled shards sideCar noIsolation inert allowPinchZoom as".split(" "));
d=Gj([l,d]);da=dq(dq({},a),da);return np.createElement(np.Fragment,null,bb&&np.createElement(jb,{sideCar:Nm,removeScrollBar:Sa,shards:gb,noIsolation:Jb,inert:Ob,setCallbacks:K,allowPinchZoom:!!Lb,lockRef:l}),ja?np.cloneElement(np.Children.only(ra),dq(dq({},da),{ref:d})):np.createElement(gc,dq({},da,{className:Ka,ref:d}),ra))});Eu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Eu.classNames={fullWidth:"width-before-scroll-bar",zeroRight:"right-scroll-bar-position"};var Yk=Kf(aa(0)),sw=Kf(aa(0)),
yD=Kf(aa(0)),Hr=function(){var a=0,d=null;return{add:function(l){if(0==a){if(document){var K=document.createElement("style");K.type="text/css";var da="undefined"!==typeof __webpack_nonce__?__webpack_nonce__:void 0;da&&K.setAttribute("nonce",da)}else K=null;if(d=K)K=d,K.styleSheet?K.styleSheet.cssText=l:K.appendChild(document.createTextNode(l)),l=d,(document.head||document.getElementsByTagName("head")[0]).appendChild(l)}a++},remove:function(){a--;!a&&d&&(d.parentNode&&d.parentNode.removeChild(d),d=
null)}}},tw=function(){var a=Hr();return function(d,l){yD.useEffect(function(){a.add(d);return function(){a.remove()}},[d&&l])}},HB=function(){var a=tw();return function(d){a(d.styles,d.dynamic);return null}},IB={left:0,top:0,right:0,gap:0},JB=HB(),KB=function(a,d,l,K){var da=a.left,ja=a.top,ra=a.right;a=a.gap;void 0===l&&(l="margin");return"\n  .".concat("with-scroll-bars-hidden"," {\n   overflow: hidden ").concat(K,";\n   padding-right: ").concat(a,"px ").concat(K,";\n  }\n  body {\n    overflow: hidden ").concat(K,
";\n    overscroll-behavior: contain;\n    ").concat([d&&"position: relative ".concat(K,";"),"margin"===l&&"\n    padding-left: ".concat(da,"px;\n    padding-top: ").concat(ja,"px;\n    padding-right: ").concat(ra,"px;\n    margin-left:0;\n    margin-top:0;\n    margin-right: ").concat(a,"px ").concat(K,";\n    "),"padding"===l&&"padding-right: ".concat(a,"px ").concat(K,";")].filter(Boolean).join(""),"\n  }\n  \n  .").concat("right-scroll-bar-position"," {\n    right: ").concat(a,"px ").concat(K,
";\n  }\n  \n  .").concat("width-before-scroll-bar"," {\n    margin-right: ").concat(a,"px ").concat(K,";\n  }\n  \n  .").concat("right-scroll-bar-position"," .").concat("right-scroll-bar-position"," {\n    right: 0 ").concat(K,";\n  }\n  \n  .").concat("width-before-scroll-bar"," .").concat("width-before-scroll-bar"," {\n    margin-right: 0 ").concat(K,";\n  }\n  \n  body {\n    ").concat("--removed-body-scroll-bar-size",": ").concat(a,"px;\n  }\n")},LB=function(a){var d=a.noRelative,l=a.noImportant;
a=a.gapMode;var K=void 0===a?"margin":a;a=sw.useMemo(function(){var da=K;void 0===da&&(da="margin");if("undefined"===typeof window)da=IB;else{var ja=window.getComputedStyle(document.body),ra=ja["padding"===da?"paddingTop":"marginTop"],Ka=ja["padding"===da?"paddingRight":"marginRight"];da=[parseInt(ja["padding"===da?"paddingLeft":"marginLeft"]||"",10)||0,parseInt(ra||"",10)||0,parseInt(Ka||"",10)||0];da={left:da[0],top:da[1],right:da[2],gap:Math.max(0,window.innerWidth-document.documentElement.clientWidth+
da[2]-da[0])}}return da},[K]);return sw.createElement(JB,{styles:KB(a,!d,K,l?"":"!important")})},uw=!1;if("undefined"!==typeof window)try{var Wq=Object.defineProperty({},"passive",{get:function(){return uw=!0}});window.addEventListener("test",Wq,Wq);window.removeEventListener("test",Wq,Wq)}catch(a){uw=!1}var Xq=uw?{passive:!1}:!1,vw=function(a,d){var l=window.getComputedStyle(a);return"hidden"!==l[d]&&!(l.overflowY===l.overflowX&&"TEXTAREA"!==a.tagName&&"visible"===l[d])},MB=function(a,d){do{"undefined"!==
typeof ShadowRoot&&d instanceof ShadowRoot&&(d=d.host);if(NB(a,d)){var l=OB(a,d);if(l[1]>l[2])return!0}d=d.parentNode}while(d&&d!==document.body);return!1},NB=function(a,d){return"v"===a?vw(d,"overflowY"):vw(d,"overflowX")},OB=function(a,d){return"v"===a?[d.scrollTop,d.scrollHeight,d.clientHeight]:[d.scrollLeft,d.scrollWidth,d.clientWidth]},Gt=function(a){return"changedTouches"in a?[a.changedTouches[0].clientX,a.changedTouches[0].clientY]:[0,0]},sv=function(a){return a&&"current"in a?a.current:a},
Nj=function(a){return"\n  .block-interactivity-".concat(a," {pointer-events: none;}\n  .allow-interactivity-").concat(a," {pointer-events: all;}\n")},mo=0,ij=[];Nm.useMedium(function(a){var d=Yk.useRef([]),l=Yk.useRef([0,0]),K=Yk.useRef(),da=Yk.useState(mo++)[0],ja=Yk.useState(function(){return HB()})[0],ra=Yk.useRef(a);Yk.useEffect(function(){ra.current=a},[a]);Yk.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(da));var Lb=lo([a.lockRef.current],(a.shards||
[]).map(sv),!0).filter(Boolean);Lb.forEach(function(gc){return gc.classList.add("allow-interactivity-".concat(da))});return function(){document.body.classList.remove("block-interactivity-".concat(da));Lb.forEach(function(gc){return gc.classList.remove("allow-interactivity-".concat(da))})}}},[a.inert,a.lockRef.current,a.shards]);var Ka=Yk.useCallback(function(Lb,gc){if("touches"in Lb&&2===Lb.touches.length)return!ra.current.allowPinchZoom;var rc=Gt(Lb),Wb=l.current,kc="deltaX"in Lb?Lb.deltaX:Wb[0]-
rc[0];Wb="deltaY"in Lb?Lb.deltaY:Wb[1]-rc[1];var hc=Lb.target,Fc=Math.abs(kc)>Math.abs(Wb)?"h":"v";if("touches"in Lb&&"h"===Fc&&"range"===hc.type)return!1;var Lc=MB(Fc,hc);if(!Lc)return!0;Lc?rc=Fc:(rc="v"===Fc?"h":"v",Lc=MB(Fc,hc));if(!Lc)return!1;!K.current&&"changedTouches"in Lb&&(kc||Wb)&&(K.current=rc);if(!rc)return!0;rc=K.current||rc;Wb="h"===rc?kc:Wb;kc=window.getComputedStyle(gc).direction;kc="h"===rc&&"rtl"===kc?-1:1;Fc=kc*Wb;Lb=Lb.target;Wb=gc.contains(Lb);hc=!1;Fc=0<Fc;var ud=Lc=0;do{var Jd=
OB(rc,Lb),Ee=Jd[0];Jd=Jd[1]-Jd[2]-kc*Ee;(Ee||Jd)&&NB(rc,Lb)&&(Lc+=Jd,ud+=Ee);Lb=Lb.parentNode}while(!Wb&&Lb!==document.body||Wb&&(gc.contains(Lb)||gc===Lb));Fc&&0===Lc?hc=!0:Fc||0!==ud||(hc=!0);return hc},[]),Sa=Yk.useCallback(function(Lb){if(ij.length&&ij[ij.length-1]===ja){var gc="deltaY"in Lb?[Lb.deltaX,Lb.deltaY]:Gt(Lb),rc=d.current.filter(function(Wb){var kc;if(kc=Wb.name===Lb.type&&Wb.target===Lb.target)Wb=Wb.delta,kc=Wb[0]===gc[0]&&Wb[1]===gc[1];return kc})[0];rc&&rc.should?Lb.cancelable&&
Lb.preventDefault():rc||(rc=(ra.current.shards||[]).map(sv).filter(Boolean).filter(function(Wb){return Wb.contains(Lb.target)}),(0<rc.length?Ka(Lb,rc[0]):!ra.current.noIsolation)&&Lb.cancelable&&Lb.preventDefault())}},[]),bb=Yk.useCallback(function(Lb,gc,rc,Wb){var kc={name:Lb,delta:gc,target:rc,should:Wb};d.current.push(kc);setTimeout(function(){d.current=d.current.filter(function(hc){return hc!==kc})},1)},[]),gb=Yk.useCallback(function(Lb){l.current=Gt(Lb);K.current=void 0},[]),jb=Yk.useCallback(function(Lb){bb(Lb.type,
[Lb.deltaX,Lb.deltaY],Lb.target,Ka(Lb,a.lockRef.current))},[]),Jb=Yk.useCallback(function(Lb){bb(Lb.type,Gt(Lb),Lb.target,Ka(Lb,a.lockRef.current))},[]);Yk.useEffect(function(){ij.push(ja);a.setCallbacks({onScrollCapture:jb,onWheelCapture:jb,onTouchMoveCapture:Jb});document.addEventListener("wheel",Sa,Xq);document.addEventListener("touchmove",Sa,Xq);document.addEventListener("touchstart",gb,Xq);return function(){ij=ij.filter(function(Lb){return Lb!==ja});document.removeEventListener("wheel",Sa,Xq);
document.removeEventListener("touchmove",Sa,Xq);document.removeEventListener("touchstart",gb,Xq)}},[]);var Ob=a.removeScrollBar;return Yk.createElement(Yk.Fragment,null,a.inert?Yk.createElement(ja,{styles:Nj(da)}):null,Ob?Yk.createElement(LB,{gapMode:"margin"}):null)});var Qo=FB.forwardRef(function(a,d){return FB.createElement(Eu,dq({},a,{ref:d,sideCar:Dl}))});Qo.classNames=Eu.classNames;var Uk=["Enter"," "],Om=["ArrowUp","PageDown","End"],Ai=["ArrowDown","PageUp","Home",...Om];[...Uk];[...Uk];var [tv,
uv,vv]=ag("Menu"),[op,Mx]=Gh("Menu",[vv,qs,pv]),Ht=qs(),ri=pv(),[Nx,ss]=op("Menu"),[Ox,eq]=op("Menu"),PB=(0,Wg.forwardRef)((a,d)=>{var {__scopeMenu:l}=a;a=Jf(a,["__scopeMenu"]);l=Ht(l);return(0,Wg.createElement)(Cx,Oe({},l,a,{ref:d}))}),[,mr]=op("MenuPortal",{forceMount:void 0}),[dH,It]=op("MenuContent"),wv=(0,Wg.forwardRef)((a,d)=>{var l=mr("MenuContent",a.__scopeMenu);({forceMount:l=l.forceMount}=a);const K=Jf(a,["forceMount"]),da=ss("MenuContent",a.__scopeMenu),ja=eq("MenuContent",a.__scopeMenu);
return(0,Wg.createElement)(tv.Provider,{scope:a.__scopeMenu},(0,Wg.createElement)(Et,{present:l||da.open},(0,Wg.createElement)(tv.Slot,{scope:a.__scopeMenu},ja.modal?(0,Wg.createElement)(Px,Oe({},K,{ref:d})):(0,Wg.createElement)(Jt,Oe({},K,{ref:d})))))}),Px=(0,Wg.forwardRef)((a,d)=>{const l=ss("MenuContent",a.__scopeMenu),K=(0,Wg.useRef)(null);d=$g(d,K);(0,Wg.useEffect)(()=>{const da=K.current;if(da)return Lx(da)},[]);return(0,Wg.createElement)(xv,Oe({},a,{ref:d,trapFocus:l.open,disableOutsidePointerEvents:l.open,
disableOutsideScroll:!0,onFocusOutside:Wf(a.onFocusOutside,da=>da.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>l.onOpenChange(!1)}))}),Jt=(0,Wg.forwardRef)((a,d)=>{const l=ss("MenuContent",a.__scopeMenu);return(0,Wg.createElement)(xv,Oe({},a,{ref:d,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>l.onOpenChange(!1)}))}),xv=(0,Wg.forwardRef)((a,d)=>{const {__scopeMenu:l,loop:K=!1,trapFocus:da,onOpenAutoFocus:ja,onCloseAutoFocus:ra,disableOutsidePointerEvents:Ka,
onEscapeKeyDown:Sa,onPointerDownOutside:bb,onFocusOutside:gb,onInteractOutside:jb,onDismiss:Jb,disableOutsideScroll:Ob}=a,Lb=Jf(a,"__scopeMenu loop trapFocus onOpenAutoFocus onCloseAutoFocus disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside onDismiss disableOutsideScroll".split(" ")),gc=ss("MenuContent",l),rc=eq("MenuContent",l),Wb=Ht(l),kc=ri(l),hc=uv(l),[Fc,Lc]=(0,Wg.useState)(null),ud=(0,Wg.useRef)(null);d=$g(d,ud,gc.onContentChange);const Jd=(0,Wg.useRef)(0),
Ee=(0,Wg.useRef)(""),Sd=(0,Wg.useRef)(0),De=(0,Wg.useRef)(null),gf=(0,Wg.useRef)("right"),Te=(0,Wg.useRef)(0),df=Ob?Qo:Wg.Fragment,Gd=Ob?{as:Oo,allowPinchZoom:!0}:void 0,od=jd=>{var Cd,Me;jd=Ee.current+jd;const af=hc().filter(yf=>!yf.disabled),Nf=document.activeElement,bg=null===(Cd=af.find(yf=>yf.ref.current===Nf))||void 0===Cd?void 0:Cd.textValue;Cd=af.map(yf=>yf.textValue);const ef=pj(Cd,jd,bg),Eg=null===(Me=af.find(yf=>yf.textValue===ef))||void 0===Me?void 0:Me.ref.current;(function Gg(Fg){Ee.current=
Fg;window.clearTimeout(Jd.current);""!==Fg&&(Jd.current=window.setTimeout(()=>Gg(""),1E3))})(jd);Eg&&setTimeout(()=>Eg.focus())};(0,Wg.useEffect)(()=>()=>window.clearTimeout(Jd.current),[]);Gf();const Dd=(0,Wg.useCallback)(jd=>{var Cd,Me,af;if(af=gf.current===(null===(Cd=De.current)||void 0===Cd?void 0:Cd.side)){if(Cd=null===(Me=De.current)||void 0===Me?void 0:Me.area){const {x:Nf,y:bg}={x:jd.clientX,y:jd.clientY};jd=!1;for(let ef=0,Eg=Cd.length-1;ef<Cd.length;Eg=ef++){Me=Cd[ef].x;af=Cd[ef].y;const yf=
Cd[Eg].x,Fg=Cd[Eg].y;af>bg!==Fg>bg&&Nf<(yf-Me)*(bg-af)/(Fg-af)+Me&&(jd=!jd)}Cd=jd}else Cd=!1;af=Cd}return af},[]);return(0,Wg.createElement)(dH,{scope:l,searchRef:Ee,onItemEnter:(0,Wg.useCallback)(jd=>{Dd(jd)&&jd.preventDefault()},[Dd]),onItemLeave:(0,Wg.useCallback)(jd=>{var Cd;Dd(jd)||(null===(Cd=ud.current)||void 0===Cd||Cd.focus(),Lc(null))},[Dd]),onTriggerLeave:(0,Wg.useCallback)(jd=>{Dd(jd)&&jd.preventDefault()},[Dd]),pointerGraceTimerRef:Sd,onPointerGraceIntentChange:(0,Wg.useCallback)(jd=>
{De.current=jd},[])},(0,Wg.createElement)(df,Gd,(0,Wg.createElement)(zB,{asChild:!0,trapped:da,onMountAutoFocus:Wf(ja,jd=>{var Cd;jd.preventDefault();null===(Cd=ud.current)||void 0===Cd||Cd.focus()}),onUnmountAutoFocus:ra},(0,Wg.createElement)(xx,{asChild:!0,disableOutsidePointerEvents:Ka,onEscapeKeyDown:Sa,onPointerDownOutside:bb,onFocusOutside:gb,onInteractOutside:jb,onDismiss:Jb},(0,Wg.createElement)(CB,Oe({asChild:!0},kc,{dir:rc.dir,orientation:"vertical",loop:K,currentTabStopId:Fc,onCurrentTabStopIdChange:Lc,
onEntryFocus:jd=>{rc.isUsingKeyboardRef.current||jd.preventDefault()}}),(0,Wg.createElement)(Dx,Oe({role:"menu","aria-orientation":"vertical","data-state":gc.open?"open":"closed","data-radix-menu-content":"",dir:rc.dir},Wb,Lb,{ref:d,style:Zd({outline:"none"},Lb.style),onKeyDown:Wf(Lb.onKeyDown,jd=>{var Cd=jd.target.closest("[data-radix-menu-content]")===jd.currentTarget;const Me=jd.ctrlKey||jd.altKey||jd.metaKey,af=1===jd.key.length;Cd&&("Tab"===jd.key&&jd.preventDefault(),!Me&&af&&od(jd.key));jd.target===
ud.current&&Ai.includes(jd.key)&&(jd.preventDefault(),Cd=hc().filter(Nf=>!Nf.disabled).map(Nf=>Nf.ref.current),Om.includes(jd.key)&&Cd.reverse(),yo(Cd))}),onBlur:Wf(a.onBlur,jd=>{jd.currentTarget.contains(jd.target)||(window.clearTimeout(Jd.current),Ee.current="")}),onPointerMove:Wf(a.onPointerMove,zo(jd=>{const Cd=Te.current!==jd.clientX;jd.currentTarget.contains(jd.target)&&Cd&&(gf.current=jd.clientX>Te.current?"right":"left",Te.current=jd.clientX)}))})))))))}),Kt=(0,Wg.forwardRef)((a,d)=>{const {disabled:l=
!1,onSelect:K}=a,da=Jf(a,["disabled","onSelect"]),ja=(0,Wg.useRef)(null),ra=eq("MenuItem",a.__scopeMenu),Ka=It("MenuItem",a.__scopeMenu);d=$g(d,ja);const Sa=(0,Wg.useRef)(!1);return(0,Wg.createElement)(QB,Oe({},da,{ref:d,disabled:l,onClick:Wf(a.onClick,()=>{const bb=ja.current;if(!l&&bb){const gb=new CustomEvent("menu.itemSelect",{bubbles:!0,cancelable:!0});bb.addEventListener("menu.itemSelect",jb=>null===K||void 0===K?void 0:K(jb),{once:!0});ql(bb,gb);if(gb.defaultPrevented)Sa.current=!1;else ra.onClose()}}),
onPointerDown:bb=>{var gb;null===(gb=a.onPointerDown)||void 0===gb||gb.call(a,bb);Sa.current=!0},onPointerUp:Wf(a.onPointerUp,bb=>{var gb;Sa.current||null===(gb=bb.currentTarget)||void 0===gb||gb.click()}),onKeyDown:Wf(a.onKeyDown,bb=>{const gb=""!==Ka.searchRef.current;l||gb&&" "===bb.key||!Uk.includes(bb.key)||(bb.currentTarget.click(),bb.preventDefault())})}))}),QB=(0,Wg.forwardRef)((a,d)=>{const {__scopeMenu:l,disabled:K=!1,textValue:da}=a,ja=Jf(a,["__scopeMenu","disabled","textValue"]),ra=It("MenuItem",
l),Ka=ri(l),Sa=(0,Wg.useRef)(null);d=$g(d,Sa);const [bb,gb]=(0,Wg.useState)(!1),[jb,Jb]=(0,Wg.useState)("");(0,Wg.useEffect)(()=>{const Ob=Sa.current;if(Ob){var Lb;Jb((null!==(Lb=Ob.textContent)&&void 0!==Lb?Lb:"").trim())}},[ja.children]);return(0,Wg.createElement)(tv.ItemSlot,{scope:l,disabled:K,textValue:null!==da&&void 0!==da?da:jb},(0,Wg.createElement)(DB,Oe({asChild:!0},Ka,{focusable:!K}),(0,Wg.createElement)(rk.div,Oe({role:"menuitem","data-highlighted":bb?"":void 0,"aria-disabled":K||void 0,
"data-disabled":K?"":void 0},ja,{ref:d,onPointerMove:Wf(a.onPointerMove,zo(Ob=>{if(K)ra.onItemLeave(Ob);else ra.onItemEnter(Ob),Ob.defaultPrevented||Ob.currentTarget.focus()})),onPointerLeave:Wf(a.onPointerLeave,zo(Ob=>ra.onItemLeave(Ob))),onFocus:Wf(a.onFocus,()=>gb(!0)),onBlur:Wf(a.onBlur,()=>gb(!1))}))))});op("MenuRadioGroup",{value:void 0,onValueChange:()=>{}});op("MenuItemIndicator",{checked:!1});op("MenuSub");var RB=a=>{const {__scopeMenu:d,open:l=!1,children:K,dir:da,onOpenChange:ja,modal:ra=
!0}=a;a=Ht(d);const [Ka,Sa]=(0,Wg.useState)(null),bb=(0,Wg.useRef)(!1),gb=Qi(ja),jb=pg(da);(0,Wg.useEffect)(()=>{const Jb=()=>{bb.current=!0;document.addEventListener("pointerdown",Ob,{capture:!0,once:!0});document.addEventListener("pointermove",Ob,{capture:!0,once:!0})},Ob=()=>bb.current=!1;document.addEventListener("keydown",Jb,{capture:!0});return()=>{document.removeEventListener("keydown",Jb,{capture:!0});document.removeEventListener("pointerdown",Ob,{capture:!0});document.removeEventListener("pointermove",
Ob,{capture:!0})}},[]);return(0,Wg.createElement)(Ex,a,(0,Wg.createElement)(Nx,{scope:d,open:l,onOpenChange:gb,content:Ka,onContentChange:Sa},(0,Wg.createElement)(Ox,{scope:d,onClose:(0,Wg.useCallback)(()=>gb(!1),[gb]),isUsingKeyboardRef:bb,dir:jb,modal:ra},K)))},[eH]=Gh("DropdownMenu",[Mx]),pp=Mx(),[Lt,Mt]=eH("DropdownMenu"),yv=(0,On.forwardRef)((a,d)=>{const {__scopeDropdownMenu:l,disabled:K=!1}=a,da=Jf(a,["__scopeDropdownMenu","disabled"]),ja=Mt("DropdownMenuTrigger",l),ra=pp(l);return(0,On.createElement)(PB,
Oe({asChild:!0},ra),(0,On.createElement)(rk.button,Oe({type:"button",id:ja.triggerId,"aria-haspopup":"menu","aria-expanded":ja.open,"aria-controls":ja.open?ja.contentId:void 0,"data-state":ja.open?"open":"closed","data-disabled":K?"":void 0,disabled:K},da,{ref:vg(d,ja.triggerRef),onPointerDown:Wf(a.onPointerDown,Ka=>{K||0!==Ka.button||!1!==Ka.ctrlKey||(ja.onOpenToggle(),ja.open||Ka.preventDefault())}),onKeyDown:Wf(a.onKeyDown,Ka=>{if(!K){if(["Enter"," "].includes(Ka.key))ja.onOpenToggle();if("ArrowDown"===
Ka.key)ja.onOpenChange(!0);["Enter"," ","ArrowDown"].includes(Ka.key)&&Ka.preventDefault()}})})))}),SB=(0,On.forwardRef)((a,d)=>{var {__scopeDropdownMenu:l}=a;const K=Jf(a,["__scopeDropdownMenu"]),da=Mt("DropdownMenuContent",l);l=pp(l);const ja=(0,On.useRef)(!1);return(0,On.createElement)(wv,Oe({id:da.contentId,"aria-labelledby":da.triggerId},l,K,{ref:d,onCloseAutoFocus:Wf(a.onCloseAutoFocus,ra=>{var Ka;ja.current||null===(Ka=da.triggerRef.current)||void 0===Ka||Ka.focus();ja.current=!1;ra.preventDefault()}),
onInteractOutside:Wf(a.onInteractOutside,ra=>{ra=ra.detail.originalEvent;const Ka=0===ra.button&&!0===ra.ctrlKey;ra=2===ra.button||Ka;if(!da.modal||ra)ja.current=!0}),style:ff(Zd({},a.style),{["--radix-dropdown-menu-content-transform-origin"]:"var(--radix-popper-transform-origin)"})}))}),fq=(0,On.forwardRef)((a,d)=>{var {__scopeDropdownMenu:l}=a;a=Jf(a,["__scopeDropdownMenu"]);l=pp(l);return(0,On.createElement)(Kt,Oe({},l,a,{ref:d}))}),fH=a=>{const {__scopeDropdownMenu:d,children:l,dir:K,open:da,
defaultOpen:ja,onOpenChange:ra,modal:Ka=!0}=a;a=pp(d);const Sa=(0,On.useRef)(null),[bb=!1,gb]=Dc({prop:da,defaultProp:ja,onChange:ra});return(0,On.createElement)(Lt,{scope:d,triggerId:Ei(),triggerRef:Sa,contentId:Ei(),open:bb,onOpenChange:gb,onOpenToggle:(0,On.useCallback)(()=>gb(jb=>!jb),[gb]),modal:Ka},(0,On.createElement)(RB,Oe({},a,{open:bb,onOpenChange:gb,dir:K,modal:Ka}),l))},ji=Kf(aa(0)).default.createContext({}),gH=Kf(aa(0)),Qx=aa(616),hl=a=>{var {action:d,shortcut:l,opts:K}=a;a=Jf(a,["action",
"shortcut","opts"]);var {renderers:da}=gH.useContext(ji);da=null==da?void 0:da.KeyboardShortcut;return(0,Qx.jsx)("div",ff(Zd({className:"tl-menu-right-slot"},a),{children:(0,Qx.jsx)(da,{action:d,shortcut:l,opts:K})}))};aa(0);var Ol=aa(616),nr=ee(function(){const a=mg(),d=l=>{l.preventDefault()};return(0,Ol.jsxs)(fH,{children:[(0,Ol.jsx)(yv,{className:"tl-button text-sm px-2 important",id:"tl-zoom",children:(100*a.viewport.camera.zoom).toFixed(0)+"%"}),(0,Ol.jsxs)(SB,{onCloseAutoFocus:l=>l.preventDefault(),
className:"tl-menu",id:"zoomPopup",sideOffset:12,children:[(0,Ol.jsxs)(fq,{className:"tl-menu-item",onSelect:d,onClick:a.api.zoomToFit,children:["Zoom to drawing",(0,Ol.jsx)(hl,{action:"whiteboard/zoom-to-fit"})]}),(0,Ol.jsxs)(fq,{className:"tl-menu-item",onSelect:d,onClick:a.api.zoomToSelection,disabled:0===a.selectedShapesArray.length,children:["Zoom to fit selection",(0,Ol.jsx)(hl,{action:"whiteboard/zoom-to-selection"})]}),(0,Ol.jsxs)(fq,{className:"tl-menu-item",onSelect:d,onClick:a.api.zoomIn,
children:["Zoom in",(0,Ol.jsx)(hl,{action:"whiteboard/zoom-in"})]}),(0,Ol.jsxs)(fq,{className:"tl-menu-item",onSelect:d,onClick:a.api.zoomOut,children:["Zoom out",(0,Ol.jsx)(hl,{action:"whiteboard/zoom-out"})]}),(0,Ol.jsxs)(fq,{className:"tl-menu-item",onSelect:d,onClick:a.api.resetZoom,children:["Reset zoom",(0,Ol.jsx)(hl,{action:"whiteboard/reset-zoom"})]})]})]})}),Rx=aa(0),zv=["horizontal","vertical"],gq=(0,Rx.forwardRef)((a,d)=>{const {decorative:l,orientation:K="horizontal"}=a;a=Jf(a,["decorative",
"orientation"]);const da=zv.includes(K)?K:"horizontal";return(0,Rx.createElement)(rk.div,Oe({"data-orientation":da},l?{role:"none"}:{"aria-orientation":"vertical"===da?da:void 0,role:"separator"},a,{ref:d}))});gq.propTypes={orientation(a,d,l){a=a[d];d=String(a);return a&&!zv.includes(a)?Error(`Invalid prop \`orientation\` of value \`${d}\` supplied to \`${l}\`, expected one of:
  - horizontal
  - vertical

Defaulting to \`${"horizontal"}\`.`):null}};var Wj=aa(616),TB=ee(function(){const a=mg(),{handlers:{t:d}}=aq.useContext(ji),l=aq.useCallback(()=>{a.api.undo()},[a]),K=aq.useCallback(()=>{a.api.redo()},[a]),da=aq.useCallback(()=>{a.api.zoomIn()},[a]),ja=aq.useCallback(()=>{a.api.zoomOut()},[a]),ra=aq.useCallback(()=>{a.api.toggleGrid()},[a]),Ka=aq.useCallback(()=>{a.api.toggleSnapToGrid()},[a]),Sa=aq.useCallback(()=>{a.api.togglePenMode()},[a]);return(0,Wj.jsxs)("div",{className:"tl-action-bar","data-html2canvas-ignore":"true",
children:[!a.readOnly&&(0,Wj.jsxs)("div",{className:"tl-toolbar tl-history-bar mr-2 mb-2",children:[(0,Wj.jsx)(Yd,{tooltip:d("whiteboard/undo"),onClick:l,children:(0,Wj.jsx)(Qg,{name:"arrow-back-up"})}),(0,Wj.jsx)(Yd,{tooltip:d("whiteboard/redo"),onClick:K,children:(0,Wj.jsx)(Qg,{name:"arrow-forward-up"})})]}),(0,Wj.jsxs)("div",{className:"tl-toolbar tl-zoom-bar mr-2 mb-2",children:[(0,Wj.jsx)(Yd,{tooltip:d("whiteboard/zoom-in"),onClick:da,id:"tl-zoom-in",children:(0,Wj.jsx)(Qg,{name:"plus"})}),(0,Wj.jsx)(Yd,
{tooltip:d("whiteboard/zoom-out"),onClick:ja,id:"tl-zoom-out",children:(0,Wj.jsx)(Qg,{name:"minus"})}),(0,Wj.jsx)(gq,{className:"tl-toolbar-separator",orientation:"vertical"}),(0,Wj.jsx)(nr,{})]}),(0,Wj.jsxs)("div",{className:"tl-toolbar tl-grid-bar mr-2 mb-2",children:[(0,Wj.jsx)(Ne,{tooltip:d("whiteboard/toggle-grid"),className:"tl-button",pressed:a.settings.showGrid,id:"tl-show-grid",onPressedChange:ra,children:(0,Wj.jsx)(Qg,{name:"grid-dots"})}),!a.readOnly&&(0,Wj.jsx)(Ne,{tooltip:d("whiteboard/snap-to-grid"),
className:"tl-button",pressed:a.settings.snapToGrid,id:"tl-snap-to-grid",onPressedChange:Ka,children:(0,Wj.jsx)(Qg,{name:a.settings.snapToGrid?"magnet":"magnet-off"})})]}),!a.readOnly&&(0,Wj.jsx)("div",{className:"tl-toolbar tl-pen-mode-bar mb-2",children:(0,Wj.jsx)(Ne,{tooltip:d("whiteboard/toggle-pen-mode"),className:"tl-button",pressed:a.settings.penMode,id:"tl-toggle-pen-mode",onPressedChange:Sa,children:(0,Wj.jsx)(Qg,{name:a.settings.penMode?"pencil":"pencil-off"})})})]})}),Av=Kf(aa(0)),Nt=Kf(aa(1)),
Ot=aa(616),Pt=a=>`[${a.map(d=>{var l;return null!=(l=null==d?void 0:d.toFixed(2))?l:"-"}).join(", ")}]`,nn=ee(()=>{var a;const {viewport:{bounds:d,camera:{point:l,zoom:K}},inputs:da}=dh(),ja=Av.default.useRef();Av.default.useEffect(()=>{const Ka=document.getElementById("tl-statusbar-anchor");ja.current=Ka},[]);const ra=[["Z",null!=(a=null==K?void 0:K.toFixed(2))?a:"null"],["MP",Pt(da.currentPoint)],["MS",Pt(da.currentScreenPoint)],["VP",Pt(l)],["VBR",Pt([d.maxX,d.maxY])]].map(Ka=>Ka.join("")).join("|");
a=ja.current?Nt.default.createPortal((0,Ot.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center"},children:ra}),ja.current):null;return(0,Ot.jsx)(Ot.Fragment,{children:a})}),il=Kf(aa(0)),on=aa(616),no=ee(a=>{var {id:d,icon:l,tooltip:K,tooltipSide:da="left",handleClick:ja}=a;a=Jf(a,["id","icon","tooltip","tooltipSide","handleClick"]);var ra;const Ka=mg(),Sa=null==(ra=[...Ka.Tools,is,js])?void 0:ra.find(bb=>bb.id===d);ra=(ra=null==Sa?void 0:Sa.shortcut)&&K?(0,on.jsxs)("div",{className:"flex",
children:[K,(0,on.jsx)(hl,{action:ra})]}):K;return(0,on.jsx)(Yd,ff(Zd({},a),{tooltipSide:da,tooltip:ra,"data-tool":d,"data-selected":d===Ka.selectedTool.id,onClick:ja,children:"string"===typeof l?(0,on.jsx)(Qg,{name:l}):l}))}),Xi=aa(0),[Sx]=Gh("Popover",[qs]),Qt=qs(),[Tx,or]=Sx("Popover"),Bv=(0,Xi.forwardRef)((a,d)=>{var {__scopePopover:l}=a;const K=Jf(a,["__scopePopover"]),da=or("PopoverTrigger",l);l=Qt(l);d=$g(d,da.triggerRef);a=(0,Xi.createElement)(rk.button,Oe({type:"button","aria-haspopup":"dialog",
"aria-expanded":da.open,"aria-controls":da.contentId,"data-state":da.open?"open":"closed"},K,{ref:d,onClick:Wf(a.onClick,da.onOpenToggle)}));return da.hasCustomAnchor?a:(0,Xi.createElement)(Cx,Oe({asChild:!0},l),a)}),[,UB]=Sx("PopoverPortal",{forceMount:void 0}),Cv=(0,Xi.forwardRef)((a,d)=>{var l=UB("PopoverContent",a.__scopePopover);({forceMount:l=l.forceMount}=a);const K=Jf(a,["forceMount"]);a=or("PopoverContent",a.__scopePopover);return(0,Xi.createElement)(Et,{present:l||a.open},a.modal?(0,Xi.createElement)(VB,
Oe({},K,{ref:d})):(0,Xi.createElement)(ts,Oe({},K,{ref:d})))}),VB=(0,Xi.forwardRef)((a,d)=>{const l=or("PopoverContent",a.__scopePopover),K=(0,Xi.useRef)(null);d=$g(d,K);const da=(0,Xi.useRef)(!1);(0,Xi.useEffect)(()=>{const ja=K.current;if(ja)return Lx(ja)},[]);return(0,Xi.createElement)(Qo,{as:Oo,allowPinchZoom:!0},(0,Xi.createElement)(Ux,Oe({},a,{ref:d,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Wf(a.onCloseAutoFocus,ja=>{var ra;ja.preventDefault();da.current||null===(ra=l.triggerRef.current)||
void 0===ra||ra.focus()}),onPointerDownOutside:Wf(a.onPointerDownOutside,ja=>{ja=ja.detail.originalEvent;const ra=0===ja.button&&!0===ja.ctrlKey;da.current=2===ja.button||ra},{checkForDefaultPrevented:!1}),onFocusOutside:Wf(a.onFocusOutside,ja=>ja.preventDefault(),{checkForDefaultPrevented:!1})})))}),ts=(0,Xi.forwardRef)((a,d)=>{const l=or("PopoverContent",a.__scopePopover),K=(0,Xi.useRef)(!1);return(0,Xi.createElement)(Ux,Oe({},a,{ref:d,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:da=>
{var ja;null===(ja=a.onCloseAutoFocus)||void 0===ja||ja.call(a,da);if(!da.defaultPrevented){var ra;K.current||null===(ra=l.triggerRef.current)||void 0===ra||ra.focus();da.preventDefault()}K.current=!1},onInteractOutside:da=>{var ja,ra;null===(ja=a.onInteractOutside)||void 0===ja||ja.call(a,da);da.defaultPrevented||(K.current=!0);ja=da.target;(null===(ra=l.triggerRef.current)||void 0===ra?0:ra.contains(ja))&&da.preventDefault()}}))}),Ux=(0,Xi.forwardRef)((a,d)=>{const {__scopePopover:l,trapFocus:K,
onOpenAutoFocus:da,onCloseAutoFocus:ja,disableOutsidePointerEvents:ra,onEscapeKeyDown:Ka,onPointerDownOutside:Sa,onFocusOutside:bb,onInteractOutside:gb}=a;a=Jf(a,"__scopePopover trapFocus onOpenAutoFocus onCloseAutoFocus disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside".split(" "));const jb=or("PopoverContent",l),Jb=Qt(l);Gf();return(0,Xi.createElement)(zB,{asChild:!0,loop:!0,trapped:K,onMountAutoFocus:da,onUnmountAutoFocus:ja},(0,Xi.createElement)(xx,
{asChild:!0,disableOutsidePointerEvents:ra,onInteractOutside:gb,onEscapeKeyDown:Ka,onPointerDownOutside:Sa,onFocusOutside:bb,onDismiss:()=>jb.onOpenChange(!1)},(0,Xi.createElement)(Dx,Oe({"data-state":jb.open?"open":"closed",role:"dialog",id:jb.contentId},Jb,a,{ref:d,style:ff(Zd({},a.style),{["--radix-popover-content-transform-origin"]:"var(--radix-popper-transform-origin)"})}))))}),WB=(0,Xi.forwardRef)((a,d)=>{var {__scopePopover:l}=a;a=Jf(a,["__scopePopover"]);l=Qt(l);return(0,Xi.createElement)(qB,
Oe({},l,a,{ref:d}))}),pr=a=>{const {__scopePopover:d,children:l,open:K,defaultOpen:da,onOpenChange:ja,modal:ra=!1}=a;a=Qt(d);const Ka=(0,Xi.useRef)(null),[Sa,bb]=(0,Xi.useState)(!1),[gb=!1,jb]=Dc({prop:K,defaultProp:da,onChange:ja});return(0,Xi.createElement)(Ex,a,(0,Xi.createElement)(Tx,{scope:d,contentId:Ei(),triggerRef:Ka,open:gb,onOpenChange:jb,onOpenToggle:(0,Xi.useCallback)(()=>jb(Jb=>!Jb),[jb]),hasCustomAnchor:Sa,onCustomAnchorAdd:(0,Xi.useCallback)(()=>bb(!0),[]),onCustomAnchorRemove:(0,Xi.useCallback)(()=>
bb(!1),[]),modal:ra},l))},Vx=Kf(aa(0)),Ro=aa(616),Wx=ee(function(a){var {popoverSide:d="left",setGeometry:l,activeGeometry:K,chevron:da=!0}=a;a=Jf(a,["popoverSide","setGeometry","activeGeometry","chevron"]);var {handlers:{t:ja}}=Vx.default.useContext(ji);const ra=[{id:"box",icon:"square",tooltip:ja("whiteboard/rectangle")},{id:"ellipse",icon:"circle",tooltip:ja("whiteboard/circle")},{id:"polygon",icon:"triangle",tooltip:ja("whiteboard/triangle")}];ja={id:"shapes",icon:"triangle-square-circle",tooltip:ja("whiteboard/shape")};
ja=K?ra.find(Ka=>Ka.id===K):ja;return(0,Ro.jsxs)(pr,{children:[(0,Ro.jsx)(Bv,{asChild:!0,children:(0,Ro.jsxs)("div",ff(Zd({},a),{className:"tl-geometry-tools-pane-anchor",children:[(0,Ro.jsx)(no,ff(Zd({},ja),{tooltipSide:d})),da&&(0,Ro.jsx)(Qg,{"data-selected":K,className:"tl-popover-indicator",name:"chevron-down-left"})]}))}),(0,Ro.jsxs)(Cv,{className:"tl-popover-content",side:d,sideOffset:15,children:[(0,Ro.jsx)("div",{className:`tl-toolbar tl-geometry-toolbar ${["left","right"].includes(d)?"flex-col":
"flex-row"}`,children:ra.map(Ka=>(0,Ro.jsx)(no,{id:Ka.id,icon:Ka.icon,tooltip:K?Ka.tooltip:"",handleClick:l,tooltipSide:d},Ka.id))}),(0,Ro.jsx)(WB,{className:"tl-popover-arrow"})]})]})}),Mh=aa(0),Xx=aa(0),Yx=["PageUp","PageDown"],Zx=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Rt={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},
[Dv,hH,iH]=ag("Slider"),[$x]=Gh("Slider",[iH]),[qp,Pn]=$x("Slider"),us=(0,Mh.forwardRef)((a,d)=>{function l(Te){const df=Xs(Sd,Te);ja(Te,df)}function K(Te){ja(Te,ud.current)}function da(){Sd[ud.current]!==gf.current[ud.current]&&rc(Sd)}function ja(Te,df,{commit:Gd}={commit:!1}){const od=(String(bb).split(".")[1]||"").length;Te=Io(Math.round((Te-Ka)/bb)*bb+Ka,od);const Dd=$o(Te,[Ka,Sa]);De((jd=[])=>{const Cd=Zm(jd,Dd,df);var Me=Jb*bb;if(0<Me){const af=dn(Cd);Me=Math.min(...af)>=Me}else Me=!0;return Me?
(ud.current=Cd.indexOf(Dd),(Me=String(Cd)!==String(jd))&&Gd&&rc(Cd),Me?Cd:jd):jd})}const {name:ra,min:Ka=0,max:Sa=100,step:bb=1,orientation:gb="horizontal",disabled:jb=!1,minStepsBetweenThumbs:Jb=0,defaultValue:Ob=[Ka],value:Lb,onValueChange:gc=()=>{},onValueCommit:rc=()=>{},inverted:Wb=!1}=a,kc=Jf(a,"name min max step orientation disabled minStepsBetweenThumbs defaultValue value onValueChange onValueCommit inverted".split(" ")),[hc,Fc]=(0,Mh.useState)(null);d=$g(d,Te=>Fc(Te));const Lc=(0,Mh.useRef)(new Set),
ud=(0,Mh.useRef)(0);var Jd="horizontal"===gb;const Ee=hc?!!hc.closest("form"):!0;Jd=Jd?jH:kH;const [Sd=[],De]=Dc({prop:Lb,defaultProp:Ob,onChange:Te=>{var df;null===(df=[...Lc.current][ud.current])||void 0===df||df.focus();gc(Te)}}),gf=(0,Mh.useRef)(Sd);return(0,Mh.createElement)(qp,{scope:a.__scopeSlider,disabled:jb,min:Ka,max:Sa,valueIndexToChangeRef:ud,thumbs:Lc.current,values:Sd,orientation:gb},(0,Mh.createElement)(Dv.Provider,{scope:a.__scopeSlider},(0,Mh.createElement)(Dv.Slot,{scope:a.__scopeSlider},
(0,Mh.createElement)(Jd,Oe({"aria-disabled":jb,"data-disabled":jb?"":void 0},kc,{ref:d,onPointerDown:Wf(kc.onPointerDown,()=>{jb||(gf.current=Sd)}),min:Ka,max:Sa,inverted:Wb,onSlideStart:jb?void 0:l,onSlideMove:jb?void 0:K,onSlideEnd:jb?void 0:da,onHomeKeyDown:()=>!jb&&ja(Ka,0,{commit:!0}),onEndKeyDown:()=>!jb&&ja(Sa,Sd.length-1,{commit:!0}),onStepKeyDown:({event:Te,direction:df})=>{if(!jb){Te=Yx.includes(Te.key)||Te.shiftKey&&Zx.includes(Te.key);const Gd=ud.current;ja(Sd[Gd]+bb*(Te?10:1)*df,Gd,{commit:!0})}}})))),
Ee&&Sd.map((Te,df)=>(0,Mh.createElement)(pn,{key:df,name:ra?ra+(1<Sd.length?"[]":""):void 0,value:Te})))}),[hq,ay]=$x("Slider",{startEdge:"left",endEdge:"right",size:"width",direction:1}),jH=(0,Mh.forwardRef)((a,d)=>{function l(kc){const hc=Lb.current||Jb.getBoundingClientRect(),Fc=cn([0,hc.width],Wb?[K,da]:[da,K]);Lb.current=hc;return Fc(kc-hc.left)}const {min:K,max:da,dir:ja,inverted:ra,onSlideStart:Ka,onSlideMove:Sa,onSlideEnd:bb,onStepKeyDown:gb}=a,jb=Jf(a,"min max dir inverted onSlideStart onSlideMove onSlideEnd onStepKeyDown".split(" ")),
[Jb,Ob]=(0,Mh.useState)(null);d=$g(d,kc=>Ob(kc));const Lb=(0,Mh.useRef)(),gc=pg(ja),rc="ltr"===gc,Wb=rc&&!ra||!rc&&ra;return(0,Mh.createElement)(hq,{scope:a.__scopeSlider,startEdge:Wb?"left":"right",endEdge:Wb?"right":"left",direction:Wb?1:-1,size:"width"},(0,Mh.createElement)(by,Oe({dir:gc,"data-orientation":"horizontal"},jb,{ref:d,style:ff(Zd({},jb.style),{["--radix-slider-thumb-transform"]:"translateX(-50%)"}),onSlideStart:kc=>{kc=l(kc.clientX);null===Ka||void 0===Ka||Ka(kc)},onSlideMove:kc=>{kc=
l(kc.clientX);null===Sa||void 0===Sa||Sa(kc)},onSlideEnd:()=>{Lb.current=void 0;null===bb||void 0===bb||bb()},onStepKeyDown:kc=>{const hc=Rt[Wb?"from-left":"from-right"].includes(kc.key);null===gb||void 0===gb||gb({event:kc,direction:hc?-1:1})}})))}),kH=(0,Mh.forwardRef)((a,d)=>{function l(Lb){const gc=Jb.current||jb.current.getBoundingClientRect(),rc=cn([0,gc.height],Ob?[da,K]:[K,da]);Jb.current=gc;return rc(Lb-gc.top)}const {min:K,max:da,inverted:ja,onSlideStart:ra,onSlideMove:Ka,onSlideEnd:Sa,
onStepKeyDown:bb}=a,gb=Jf(a,"min max inverted onSlideStart onSlideMove onSlideEnd onStepKeyDown".split(" ")),jb=(0,Mh.useRef)(null);d=$g(d,jb);const Jb=(0,Mh.useRef)(),Ob=!ja;return(0,Mh.createElement)(hq,{scope:a.__scopeSlider,startEdge:Ob?"bottom":"top",endEdge:Ob?"top":"bottom",size:"height",direction:Ob?1:-1},(0,Mh.createElement)(by,Oe({"data-orientation":"vertical"},gb,{ref:d,style:ff(Zd({},gb.style),{["--radix-slider-thumb-transform"]:"translateY(50%)"}),onSlideStart:Lb=>{Lb=l(Lb.clientY);null===
ra||void 0===ra||ra(Lb)},onSlideMove:Lb=>{Lb=l(Lb.clientY);null===Ka||void 0===Ka||Ka(Lb)},onSlideEnd:()=>{Jb.current=void 0;null===Sa||void 0===Sa||Sa()},onStepKeyDown:Lb=>{const gc=Rt[Ob?"from-bottom":"from-top"].includes(Lb.key);null===bb||void 0===bb||bb({event:Lb,direction:gc?-1:1})}})))}),by=(0,Mh.forwardRef)((a,d)=>{const {__scopeSlider:l,onSlideStart:K,onSlideMove:da,onSlideEnd:ja,onHomeKeyDown:ra,onEndKeyDown:Ka,onStepKeyDown:Sa}=a,bb=Jf(a,"__scopeSlider onSlideStart onSlideMove onSlideEnd onHomeKeyDown onEndKeyDown onStepKeyDown".split(" ")),
gb=Pn("Slider",l);return(0,Mh.createElement)(rk.span,Oe({},bb,{ref:d,onKeyDown:Wf(a.onKeyDown,jb=>{"Home"===jb.key?(ra(jb),jb.preventDefault()):"End"===jb.key?(Ka(jb),jb.preventDefault()):Yx.concat(Zx).includes(jb.key)&&(Sa(jb),jb.preventDefault())}),onPointerDown:Wf(a.onPointerDown,jb=>{const Jb=jb.target;Jb.setPointerCapture(jb.pointerId);jb.preventDefault();gb.thumbs.has(Jb)?Jb.focus():K(jb)}),onPointerMove:Wf(a.onPointerMove,jb=>{jb.target.hasPointerCapture(jb.pointerId)&&da(jb)}),onPointerUp:Wf(a.onPointerUp,
jb=>{const Jb=jb.target;Jb.hasPointerCapture(jb.pointerId)&&(Jb.releasePointerCapture(jb.pointerId),ja(jb))})}))}),We=(0,Mh.forwardRef)((a,d)=>{var {__scopeSlider:l}=a;a=Jf(a,["__scopeSlider"]);l=Pn("SliderTrack",l);return(0,Mh.createElement)(rk.span,Oe({"data-disabled":l.disabled?"":void 0,"data-orientation":l.orientation},a,{ref:d}))}),Zf=(0,Mh.forwardRef)((a,d)=>{var {__scopeSlider:l}=a;const K=Jf(a,["__scopeSlider"]),da=Pn("SliderRange",l);l=ay("SliderRange",l);var ja=(0,Mh.useRef)(null);d=$g(d,
ja);var ra=da.values.length;ja=da.values.map(Ka=>wi(Ka,da.min,da.max));ra=1<ra?Math.min(...ja):0;ja=100-Math.max(...ja);return(0,Mh.createElement)(rk.span,Oe({"data-orientation":da.orientation,"data-disabled":da.disabled?"":void 0},K,{ref:d,style:ff(Zd({},a.style),{[l.startEdge]:ra+"%",[l.endEdge]:ja+"%"})}))}),Ye=(0,Mh.forwardRef)((a,d)=>{const l=hH(a.__scopeSlider),[K,da]=(0,Mh.useState)(null);d=$g(d,ra=>da(ra));const ja=(0,Mh.useMemo)(()=>K?l().findIndex(ra=>ra.ref.current===K):-1,[l,K]);return(0,Mh.createElement)(Hf,
Oe({},a,{ref:d,index:ja}))}),Hf=(0,Mh.forwardRef)((a,d)=>{const {__scopeSlider:l,index:K}=a,da=Jf(a,["__scopeSlider","index"]),ja=Pn("SliderThumb",l),ra=ay("SliderThumb",l),[Ka,Sa]=(0,Mh.useState)(null);d=$g(d,Ob=>Sa(Ob));var bb=tb(Ka);const gb=ja.values[K],jb=void 0===gb?0:wi(gb,ja.min,ja.max),Jb=ol(K,ja.values.length);bb=(bb=null===bb||void 0===bb?void 0:bb[ra.size])?Yl(bb,jb,ra.direction):0;(0,Mh.useEffect)(()=>{if(Ka)return ja.thumbs.add(Ka),()=>{ja.thumbs.delete(Ka)}},[Ka,ja.thumbs]);return(0,Mh.createElement)("span",
{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[ra.startEdge]:`calc(${jb}% + ${bb}px)`}},(0,Mh.createElement)(Dv.ItemSlot,{scope:a.__scopeSlider},(0,Mh.createElement)(rk.span,Oe({role:"slider","aria-label":a["aria-label"]||Jb,"aria-valuemin":ja.min,"aria-valuenow":gb,"aria-valuemax":ja.max,"aria-orientation":ja.orientation,"data-orientation":ja.orientation,"data-disabled":ja.disabled?"":void 0,tabIndex:ja.disabled?void 0:0},da,{ref:d,style:void 0===gb?{display:"none"}:
a.style,onFocus:Wf(a.onFocus,()=>{ja.valueIndexToChangeRef.current=K})}))))}),pn=a=>{const {value:d}=a;a=Jf(a,["value"]);const l=(0,Mh.useRef)(null),K=Yn(d);(0,Mh.useEffect)(()=>{const da=l.current,ja=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;if(K!==d&&ja){const ra=new Event("input",{bubbles:!0});ja.call(da,d);da.dispatchEvent(ra)}},[K,d]);return(0,Mh.createElement)("input",Oe({style:{display:"none"}},a,{ref:l,defaultValue:d}))},sk=us,St=We,vj=Zf,So=Ye,Je=Kf(aa(0)),
Lf=aa(616),qm=ee(a=>{var {side:d,align:l,alignOffset:K,label:da,arrow:ja,children:ra,border:Ka}=a;a=Jf(a,"side align alignOffset label arrow children border".split(" "));const Sa=Je.useRef(null),[bb,gb]=Je.useState(!1),{viewport:{bounds:jb,camera:{point:Jb,zoom:Ob}}}=mg(),[Lb,gc]=Je.useState(0);Je.useEffect(()=>{if(Sa.current&&bb){var rc=Sa.current.getBoundingClientRect();sf.boundsContain(jb,{minX:rc.x,minY:rc.y,maxX:rc.right,maxY:rc.bottom,width:rc.width,height:rc.height})||gc(Wb=>Wb+1)}},[Jb[0],
Jb[1],Ob,bb]);return(0,Lf.jsxs)(pr,{onOpenChange:rc=>gb(rc),children:[(0,Lf.jsx)(Bv,ff(Zd({},a),{"data-border":Ka,className:"tl-button tl-popover-trigger-button",children:da})),(0,Lf.jsxs)(Cv,{ref:Sa,className:"tl-popover-content",align:l,alignOffset:K,side:d,sideOffset:15,collisionBoundary:document.querySelector(".logseq-tldraw"),children:[ra,ja&&(0,Lf.jsx)(WB,{className:"tl-popover-arrow"})]},"popover-content-"+Lb)]})}),He=Kf(aa(0)),Oj=aa(616),XB=Kf(aa(0)),mf=aa(0),vs=aa(1),hk=Kf(aa(0)),Hk=aa(0),
Tt=aa(0),rm=aa(1),tk="a button div form h2 h3 img input label li nav ol p span svg ul".split(" ").reduce((a,d)=>{const l=(0,Tt.forwardRef)((K,da)=>{var {asChild:ja}=K;K=Jf(K,["asChild"]);ja=ja?Oo:d;(0,Tt.useEffect)(()=>{window[Symbol.for("radix-ui")]=!0},[]);return(0,Tt.createElement)(ja,Oe({},K,{ref:da}))});l.displayName=`Primitive.${d}`;return ff(Zd({},a),{[d]:l})},{}),rp,oo=(0,Hk.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zg=(0,Hk.forwardRef)((a,
d)=>{var l;const {disableOutsidePointerEvents:K=!1,onEscapeKeyDown:da,onPointerDownOutside:ja,onFocusOutside:ra,onInteractOutside:Ka,onDismiss:Sa}=a,bb=Jf(a,"disableOutsidePointerEvents onEscapeKeyDown onPointerDownOutside onFocusOutside onInteractOutside onDismiss".split(" ")),gb=(0,Hk.useContext)(oo),[jb,Jb]=(0,Hk.useState)(null),Ob=null!==(l=null===jb||void 0===jb?void 0:jb.ownerDocument)&&void 0!==l?l:null===globalThis||void 0===globalThis?void 0:globalThis.document,[,Lb]=(0,Hk.useState)({});
d=$g(d,hc=>Jb(hc));l=Array.from(gb.layers);var [gc]=[...gb.layersWithOutsidePointerEventsDisabled].slice(-1);gc=l.indexOf(gc);const rc=jb?l.indexOf(jb):-1;l=0<gb.layersWithOutsidePointerEventsDisabled.size;const Wb=rc>=gc;gc=dp(hc=>{const Fc=hc.target,Lc=[...gb.branches].some(ud=>ud.contains(Fc));Wb&&!Lc&&(null===ja||void 0===ja||ja(hc),null===Ka||void 0===Ka||Ka(hc),hc.defaultPrevented||null===Sa||void 0===Sa||Sa())},Ob);const kc=$m(hc=>{const Fc=hc.target;[...gb.branches].some(Lc=>Lc.contains(Fc))||
(null===ra||void 0===ra||ra(hc),null===Ka||void 0===Ka||Ka(hc),hc.defaultPrevented||null===Sa||void 0===Sa||Sa())},Ob);rl(hc=>{rc===gb.layers.size-1&&(null===da||void 0===da||da(hc),!hc.defaultPrevented&&Sa&&(hc.preventDefault(),Sa()))},Ob);(0,Hk.useEffect)(()=>{if(jb)return K&&(0===gb.layersWithOutsidePointerEventsDisabled.size&&(rp=Ob.body.style.pointerEvents,Ob.body.style.pointerEvents="none"),gb.layersWithOutsidePointerEventsDisabled.add(jb)),gb.layers.add(jb),Bn(),()=>{K&&1===gb.layersWithOutsidePointerEventsDisabled.size&&
(Ob.body.style.pointerEvents=rp)}},[jb,Ob,K,gb]);(0,Hk.useEffect)(()=>()=>{jb&&(gb.layers.delete(jb),gb.layersWithOutsidePointerEventsDisabled.delete(jb),Bn())},[jb,gb]);(0,Hk.useEffect)(()=>{const hc=()=>Lb({});document.addEventListener("dismissableLayer.update",hc);return()=>document.removeEventListener("dismissableLayer.update",hc)},[]);return(0,Hk.createElement)(tk.div,Oe({},bb,{ref:d,style:Zd({pointerEvents:l?Wb?"auto":"none":void 0},a.style),onFocusCapture:Wf(a.onFocusCapture,kc.onFocusCapture),
onBlurCapture:Wf(a.onBlurCapture,kc.onBlurCapture),onPointerDownCapture:Wf(a.onPointerDownCapture,gc.onPointerDownCapture)}))}),uk=aa(0),To={bubbles:!1,cancelable:!0},YB=(0,uk.forwardRef)((a,d)=>{const {loop:l=!1,trapped:K=!1,onMountAutoFocus:da,onUnmountAutoFocus:ja}=a;a=Jf(a,["loop","trapped","onMountAutoFocus","onUnmountAutoFocus"]);const [ra,Ka]=(0,uk.useState)(null),Sa=Qi(da),bb=Qi(ja),gb=(0,uk.useRef)(null);d=$g(d,Ob=>Ka(Ob));const jb=(0,uk.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=
!1}}).current;(0,uk.useEffect)(()=>{if(K){let Ob=function(gc){!jb.paused&&ra&&(gc=gc.target,ra.contains(gc)?gb.current=gc:Em(gb.current,{select:!0}))},Lb=function(gc){!jb.paused&&ra&&(ra.contains(gc.relatedTarget)||Em(gb.current,{select:!0}))};document.addEventListener("focusin",Ob);document.addEventListener("focusout",Lb);return()=>{document.removeEventListener("focusin",Ob);document.removeEventListener("focusout",Lb)}}},[K,ra,jb.paused]);(0,uk.useEffect)(()=>{if(ra){iq.add(jb);const Ob=document.activeElement;
if(!ra.contains(Ob)){const Lb=new CustomEvent("focusScope.autoFocusOnMount",To);ra.addEventListener("focusScope.autoFocusOnMount",Sa);ra.dispatchEvent(Lb);Lb.defaultPrevented||(Rq(Fp(Go(ra)),{select:!0}),document.activeElement===Ob&&Em(ra))}return()=>{ra.removeEventListener("focusScope.autoFocusOnMount",Sa);setTimeout(()=>{const Lb=new CustomEvent("focusScope.autoFocusOnUnmount",To);ra.addEventListener("focusScope.autoFocusOnUnmount",bb);ra.dispatchEvent(Lb);Lb.defaultPrevented||Em(null!==Ob&&void 0!==
Ob?Ob:document.body,{select:!0});ra.removeEventListener("focusScope.autoFocusOnUnmount",bb);iq.remove(jb)},0)}}},[ra,Sa,bb,jb]);const Jb=(0,uk.useCallback)(Ob=>{if((l||K)&&!jb.paused){var Lb=document.activeElement;if("Tab"===Ob.key&&!Ob.altKey&&!Ob.ctrlKey&&!Ob.metaKey&&Lb){const rc=Ob.currentTarget;var gc=rc;const Wb=Go(gc),kc=Hn(Wb,gc);gc=Hn(Wb.reverse(),gc);const [hc,Fc]=[kc,gc];hc&&Fc?Ob.shiftKey||Lb!==Fc?Ob.shiftKey&&Lb===hc&&(Ob.preventDefault(),l&&Em(Fc,{select:!0})):(Ob.preventDefault(),l&&
Em(hc,{select:!0})):Lb===rc&&Ob.preventDefault()}}},[l,K,jb.paused]);return(0,uk.createElement)(tk.div,Oe({tabIndex:-1},a,{ref:d,onKeyDown:Jb}))}),iq=function(){let a=[];return{add(d){const l=a[0];d===l||null!==l&&void 0!==l&&l.pause();a=Zn(a,d);a.unshift(d)},remove(d){var l;a=Zn(a,d);null===(l=a[0])||void 0===l||l.resume()}}}(),Xf=aa(0),[Ev,Uo]=Gh("Popper"),[Lg,ws]=Ev("Popper"),jj=(0,Xf.forwardRef)((a,d)=>{const {__scopePopper:l,virtualRef:K}=a;a=Jf(a,["__scopePopper","virtualRef"]);const da=ws("PopperAnchor",
l),ja=(0,Xf.useRef)(null);d=$g(d,ja);(0,Xf.useEffect)(()=>{da.onAnchorChange((null===K||void 0===K?void 0:K.current)||ja.current)});return K?null:(0,Xf.createElement)(tk.div,Oe({},a,{ref:d}))}),[vk]=Ev("PopperContent"),[xs,Ut]=Ev("PopperContent",{hasParent:!1,positionUpdateFns:new Set}),cy=(0,Xf.forwardRef)((a,d)=>{var l,K,da,ja,ra,Ka,Sa,bb;const {__scopePopper:gb,side:jb="bottom",sideOffset:Jb=0,align:Ob="center",alignOffset:Lb=0,arrowPadding:gc=0,collisionBoundary:rc=[],collisionPadding:Wb=0,sticky:kc=
"partial",hideWhenDetached:hc=!1,avoidCollisions:Fc=!0,onPlaced:Lc}=a,ud=Jf(a,"__scopePopper side sideOffset align alignOffset arrowPadding collisionBoundary collisionPadding sticky hideWhenDetached avoidCollisions onPlaced".split(" ")),Jd=ws("PopperContent",gb),[Ee,Sd]=(0,Xf.useState)(null);d=$g(d,Am=>Sd(Am));const [De,gf]=(0,Xf.useState)(null);var Te=tb(De),df=null!==(l=null===Te||void 0===Te?void 0:Te.width)&&void 0!==l?l:0;l=null!==(K=null===Te||void 0===Te?void 0:Te.height)&&void 0!==K?K:0;K=
jb+("center"!==Ob?"-"+Ob:"");Te="number"===typeof Wb?Wb:Zd({top:0,right:0,bottom:0,left:0},Wb);const Gd=Array.isArray(rc)?rc:[rc],od=0<Gd.length;Te={padding:Te,boundary:Gd.filter(Og),altBoundary:od};const {reference:Dd,floating:jd,strategy:Cd,x:Me,y:af,placement:Nf,middlewareData:bg,update:ef}=Xb({strategy:"fixed",placement:K,whileElementsMounted:Sb,middleware:[ys(),jB({mainAxis:Jb+l,alignmentAxis:Lb}),Fc?kB(Zd({mainAxis:!0,crossAxis:!1,limiter:"partial"===kc?lB():void 0},Te)):void 0,De?oB({element:De,
padding:gc}):void 0,Fc?hB(Zd({},Te)):void 0,jG(ff(Zd({},Te),{apply:({elements:Am,availableWidth:jw,availableHeight:zu})=>{Am.floating.style.setProperty("--radix-popper-available-width",`${jw}px`);Am.floating.style.setProperty("--radix-popper-available-height",`${zu}px`)}})),Vk({arrowWidth:df,arrowHeight:l}),hc?iB({strategy:"referenceHidden"}):void 0].filter(ap)});vl(()=>{Dd(Jd.anchor)},[Dd,Jd.anchor]);const Eg=null!==Me&&null!==af,[yf,Fg]=ep(Nf),Gg=Qi(Lc);vl(()=>{Eg&&(null===Gg||void 0===Gg||Gg())},
[Eg,Gg]);df=null===(da=bg.arrow)||void 0===da?void 0:da.x;da=null===(ja=bg.arrow)||void 0===ja?void 0:ja.y;ja=0!==(null===(ra=bg.arrow)||void 0===ra?void 0:ra.centerOffset);const [Bi,Bj]=(0,Xf.useState)();vl(()=>{Ee&&Bj(window.getComputedStyle(Ee).zIndex)},[Ee]);const {hasParent:Fi,positionUpdateFns:Xm}=Ut("PopperContent",gb),Dp=!Fi;(0,Xf.useLayoutEffect)(()=>{if(!Dp)return Xm.add(ef),()=>{Xm.delete(ef)}},[Dp,Xm,ef]);vl(()=>{Dp&&Eg&&Array.from(Xm).reverse().forEach(Am=>requestAnimationFrame(Am))},
[Dp,Eg,Xm]);ra=ff(Zd({"data-side":yf,"data-align":Fg},ud),{ref:d,style:ff(Zd({},ud.style),{animation:Eg?void 0:"none",opacity:null!==(Ka=bg.hide)&&void 0!==Ka&&Ka.referenceHidden?0:void 0})});return(0,Xf.createElement)("div",{ref:jd,"data-radix-popper-content-wrapper":"",style:{position:Cd,left:0,top:0,transform:Eg?`translate3d(${Math.round(Me)}px, ${Math.round(af)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:Bi,["--radix-popper-transform-origin"]:[null===(Sa=bg.transformOrigin)||
void 0===Sa?void 0:Sa.x,null===(bb=bg.transformOrigin)||void 0===bb?void 0:bb.y].join(" ")},dir:a.dir},(0,Xf.createElement)(vk,{scope:gb,placedSide:yf,onArrowChange:gf,arrowX:df,arrowY:da,shouldHideArrow:ja},Dp?(0,Xf.createElement)(xs,{scope:gb,hasParent:!0,positionUpdateFns:Xm},(0,Xf.createElement)(tk.div,ra)):(0,Xf.createElement)(tk.div,ra)))}),ys=()=>({name:"anchorCssProperties",fn(a){const {rects:d,elements:l}=a,{width:K,height:da}=d.reference;l.floating.style.setProperty("--radix-popper-anchor-width",
`${K}px`);l.floating.style.setProperty("--radix-popper-anchor-height",`${da}px`);return{}}}),Vk=a=>({name:"transformOrigin",options:a,fn(d){var l,K,da,ja,ra;const {placement:Ka,rects:Sa,middlewareData:bb}=d,gb=(d=0!==(null===(l=bb.arrow)||void 0===l?void 0:l.centerOffset))?0:a.arrowWidth;l=d?0:a.arrowHeight;const [jb,Jb]=ep(Ka),Ob={start:"0%",center:"50%",end:"100%"}[Jb],Lb=(null!==(K=null===(da=bb.arrow)||void 0===da?void 0:da.x)&&void 0!==K?K:0)+gb/2;K=(null!==(ja=null===(ra=bb.arrow)||void 0===
ra?void 0:ra.y)&&void 0!==ja?ja:0)+l/2;ra=ja="";"bottom"===jb?(ja=d?Ob:`${Lb}px`,ra=`${-l}px`):"top"===jb?(ja=d?Ob:`${Lb}px`,ra=`${Sa.floating.height+l}px`):"right"===jb?(ja=`${-l}px`,ra=d?Ob:`${K}px`):"left"===jb&&(ja=`${Sa.floating.width+l}px`,ra=d?Ob:`${K}px`);return{data:{x:ja,y:ra}}}}),ZB=a=>{const {__scopePopper:d,children:l}=a,[K,da]=(0,Xf.useState)(null);return(0,Xf.createElement)(Lg,{scope:d,anchor:K,onAnchorChange:da},l)},$B=aa(0),lH=Kf(aa(1)),mH=(0,$B.forwardRef)((a,d)=>{var l;const {container:K=
null===globalThis||void 0===globalThis?void 0:null===(l=globalThis.document)||void 0===l?void 0:l.body}=a;a=Jf(a,["container"]);return K?lH.default.createPortal((0,$B.createElement)(tk.div,Oe({},a,{ref:d})),K):null}),sp=aa(0),jq=(0,sp.forwardRef)((a,d)=>(0,sp.createElement)(tk.span,Oe({},a,{ref:d,style:Zd({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)}))),ej=[" ","Enter","ArrowUp","ArrowDown"],
aC=[" ","Enter"],[zs,Fv,kq]=function(a){var d=a+"CollectionProvider";const [l,K]=Gh(d),[da,ja]=l(d,{collectionRef:{current:null},itemMap:new Map}),ra=gb=>{const {scope:jb,children:Jb}=gb;gb=hk.default.useRef(null);const Ob=hk.default.useRef(new Map).current;return hk.default.createElement(da,{scope:jb,itemMap:Ob,collectionRef:gb},Jb)};Object.assign(ra,{displayName:d});const Ka=a+"CollectionSlot";d=hk.default.forwardRef((gb,jb)=>{const {scope:Jb,children:Ob}=gb;gb=ja(Ka,Jb);jb=$g(jb,gb.collectionRef);
return hk.default.createElement(Oo,{ref:jb},Ob)});Object.assign(d,{displayName:Ka});const Sa=a+"CollectionItemSlot",bb=hk.default.forwardRef((gb,jb)=>{const {scope:Jb,children:Ob}=gb,Lb=Jf(gb,["scope","children"]),gc=hk.default.useRef(null);gb=$g(jb,gc);const rc=ja(Sa,Jb);hk.default.useEffect(()=>{rc.itemMap.set(gc,Zd({ref:gc},Lb));return()=>void rc.itemMap.delete(gc)});return hk.default.createElement(Oo,{["data-radix-collection-item"]:"",ref:gb},Ob)});Object.assign(bb,{displayName:Sa});return[{Provider:ra,
Slot:d,ItemSlot:bb},function(gb){const jb=ja(a+"CollectionConsumer",gb);return hk.default.useCallback(()=>{const Jb=jb.collectionRef.current;if(!Jb)return[];const Ob=Array.from(Jb.querySelectorAll("[data-radix-collection-item]"));return Array.from(jb.itemMap.values()).sort((Lb,gc)=>Ob.indexOf(Lb.ref.current)-Ob.indexOf(gc.ref.current))},[jb.collectionRef,jb.itemMap])},K]}("Select"),[As]=Gh("Select",[kq,Uo]),Bs=Uo(),[nH,Vo]=As("Select"),[dy,ey]=As("Select"),fy=(0,mf.forwardRef)((a,d)=>{const {__scopeSelect:l,
disabled:K=!1}=a;a=Jf(a,["__scopeSelect","disabled"]);const da=Bs(l),ja=Vo("SelectTrigger",l),ra=ja.disabled||K;d=$g(d,ja.onTriggerChange);const Ka=Fv(l),[Sa,bb,gb]=fp(jb=>{const Jb=Ka().filter(Lb=>!Lb.disabled),Ob=Jb.find(Lb=>Lb.value===ja.value);jb=In(Jb,jb,Ob);if(void 0!==jb)ja.onValueChange(jb.value)});return(0,mf.createElement)(jj,Oe({asChild:!0},da),(0,mf.createElement)(tk.button,Oe({type:"button",role:"combobox","aria-controls":ja.contentId,"aria-expanded":ja.open,"aria-required":ja.required,
"aria-autocomplete":"none",dir:ja.dir,"data-state":ja.open?"open":"closed",disabled:ra,"data-disabled":ra?"":void 0,"data-placeholder":void 0===ja.value?"":void 0},a,{ref:d,onClick:Wf(a.onClick,jb=>{jb.currentTarget.focus()}),onPointerDown:Wf(a.onPointerDown,jb=>{const Jb=jb.target;Jb.hasPointerCapture(jb.pointerId)&&Jb.releasePointerCapture(jb.pointerId);0===jb.button&&!1===jb.ctrlKey&&(ra||(ja.onOpenChange(!0),gb()),ja.triggerPointerDownPosRef.current={x:Math.round(jb.pageX),y:Math.round(jb.pageY)},
jb.preventDefault())}),onKeyDown:Wf(a.onKeyDown,jb=>{const Jb=""!==Sa.current;jb.ctrlKey||jb.altKey||jb.metaKey||1!==jb.key.length||bb(jb.key);Jb&&" "===jb.key||!ej.includes(jb.key)||(ra||(ja.onOpenChange(!0),gb()),jb.preventDefault())})})))}),bC=(0,mf.forwardRef)((a,d)=>{const {__scopeSelect:l,children:K,placeholder:da}=a;a=Jf(a,["__scopeSelect","className","style","children","placeholder"]);const ja=Vo("SelectValue",l),{onValueNodeHasChildrenChange:ra}=ja,Ka=void 0!==K;d=$g(d,ja.onValueNodeChange);
vl(()=>{ra(Ka)},[ra,Ka]);return(0,mf.createElement)(tk.span,Oe({},a,{ref:d,style:{pointerEvents:"none"}}),void 0===ja.value&&void 0!==da?da:K)}),cC=(0,mf.forwardRef)((a,d)=>{const {children:l}=a;a=Jf(a,["__scopeSelect","children"]);return(0,mf.createElement)(tk.span,Oe({"aria-hidden":!0},a,{ref:d}),l||"▼")}),dC=(0,mf.forwardRef)((a,d)=>{const l=Vo("SelectContent",a.__scopeSelect),[K,da]=(0,mf.useState)();vl(()=>{da(new DocumentFragment)},[]);return l.open?(0,mf.createElement)(gy,Oe({},a,{ref:d})):
K?(0,vs.createPortal)((0,mf.createElement)(lq,{scope:a.__scopeSelect},(0,mf.createElement)(zs.Slot,{scope:a.__scopeSelect},(0,mf.createElement)("div",null,a.children))),K):null}),[lq,qn]=As("SelectContent"),gy=(0,mf.forwardRef)((a,d)=>{const {__scopeSelect:l,position:K="item-aligned",onCloseAutoFocus:da,onEscapeKeyDown:ja,onPointerDownOutside:ra,side:Ka,sideOffset:Sa,align:bb,alignOffset:gb,arrowPadding:jb,collisionBoundary:Jb,collisionPadding:Ob,sticky:Lb,hideWhenDetached:gc,avoidCollisions:rc}=
a;a=Jf(a,"__scopeSelect position onCloseAutoFocus onEscapeKeyDown onPointerDownOutside side sideOffset align alignOffset arrowPadding collisionBoundary collisionPadding sticky hideWhenDetached avoidCollisions".split(" "));const Wb=Vo("SelectContent",l),[kc,hc]=(0,mf.useState)(null),[Fc,Lc]=(0,mf.useState)(null);d=$g(d,yf=>hc(yf));const [ud,Jd]=(0,mf.useState)(null),[Ee,Sd]=(0,mf.useState)(null),De=Fv(l),[gf,Te]=(0,mf.useState)(!1),df=(0,mf.useRef)(!1);(0,mf.useEffect)(()=>{if(kc)return Lx(kc)},[kc]);
Gf();const Gd=(0,mf.useCallback)(yf=>{const [Fg,...Gg]=De().map(Fi=>Fi.ref.current),[Bi]=Gg.slice(-1),Bj=document.activeElement;for(const Fi of yf){if(Fi===Bj)break;null===Fi||void 0===Fi||Fi.scrollIntoView({block:"nearest"});Fi===Fg&&Fc&&(Fc.scrollTop=0);Fi===Bi&&Fc&&(Fc.scrollTop=Fc.scrollHeight);null===Fi||void 0===Fi||Fi.focus();if(document.activeElement!==Bj)break}},[De,Fc]),od=(0,mf.useCallback)(()=>Gd([ud,kc]),[Gd,ud,kc]);(0,mf.useEffect)(()=>{gf&&od()},[gf,od]);const {onOpenChange:Dd,triggerPointerDownPosRef:jd}=
Wb;(0,mf.useEffect)(()=>{if(kc){var yf=0,Fg=0;const Gg=Bj=>{var Fi,Xm,Dp,Am;yf=Math.abs(Math.round(Bj.pageX)-(null!==(Fi=null===(Xm=jd.current)||void 0===Xm?void 0:Xm.x)&&void 0!==Fi?Fi:0));Fg=Math.abs(Math.round(Bj.pageY)-(null!==(Dp=null===(Am=jd.current)||void 0===Am?void 0:Am.y)&&void 0!==Dp?Dp:0))},Bi=Bj=>{10>=yf&&10>=Fg?Bj.preventDefault():kc.contains(Bj.target)||Dd(!1);document.removeEventListener("pointermove",Gg);jd.current=null};null!==jd.current&&(document.addEventListener("pointermove",
Gg),document.addEventListener("pointerup",Bi,{capture:!0,once:!0}));return()=>{document.removeEventListener("pointermove",Gg);document.removeEventListener("pointerup",Bi,{capture:!0})}}},[kc,Dd,jd]);(0,mf.useEffect)(()=>{const yf=()=>Dd(!1);window.addEventListener("blur",yf);window.addEventListener("resize",yf);return()=>{window.removeEventListener("blur",yf);window.removeEventListener("resize",yf)}},[Dd]);const [Cd,Me]=fp(yf=>{const Fg=De().filter(Bj=>!Bj.disabled),Gg=Fg.find(Bj=>Bj.ref.current===
document.activeElement),Bi=In(Fg,yf,Gg);Bi&&setTimeout(()=>Bi.ref.current.focus())}),af=(0,mf.useCallback)((yf,Fg,Gg)=>{Gg=!df.current&&!Gg;if(void 0!==Wb.value&&Wb.value===Fg||Gg)Jd(yf),Gg&&(df.current=!0)},[Wb.value]),Nf=(0,mf.useCallback)(()=>null===kc||void 0===kc?void 0:kc.focus(),[kc]),bg=(0,mf.useCallback)((yf,Fg,Gg)=>{Gg=!df.current&&!Gg;(void 0!==Wb.value&&Wb.value===Fg||Gg)&&Sd(yf)},[Wb.value]),ef="popper"===K?hy:eC,Eg=ef===hy?{side:Ka,sideOffset:Sa,align:bb,alignOffset:gb,arrowPadding:jb,
collisionBoundary:Jb,collisionPadding:Ob,sticky:Lb,hideWhenDetached:gc,avoidCollisions:rc}:{};return(0,mf.createElement)(lq,{scope:l,content:kc,viewport:Fc,onViewportChange:Lc,itemRefCallback:af,selectedItem:ud,onItemLeave:Nf,itemTextRefCallback:bg,focusSelectedItem:od,selectedItemText:Ee,position:K,isPositioned:gf,searchRef:Cd},(0,mf.createElement)(Qo,{as:Oo,allowPinchZoom:!0},(0,mf.createElement)(YB,{asChild:!0,trapped:Wb.open,onMountAutoFocus:yf=>{yf.preventDefault()},onUnmountAutoFocus:Wf(da,
yf=>{var Fg;null===(Fg=Wb.trigger)||void 0===Fg||Fg.focus({preventScroll:!0});yf.preventDefault()})},(0,mf.createElement)(zg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:ja,onPointerDownOutside:ra,onFocusOutside:yf=>yf.preventDefault(),onDismiss:()=>Wb.onOpenChange(!1)},(0,mf.createElement)(ef,Oe({role:"listbox",id:Wb.contentId,"data-state":Wb.open?"open":"closed",dir:Wb.dir,onContextMenu:yf=>yf.preventDefault()},a,Eg,{onPlaced:()=>Te(!0),ref:d,style:Zd({display:"flex",flexDirection:"column",
outline:"none"},a.style),onKeyDown:Wf(a.onKeyDown,yf=>{var Fg=yf.ctrlKey||yf.altKey||yf.metaKey;"Tab"===yf.key&&yf.preventDefault();Fg||1!==yf.key.length||Me(yf.key);if(["ArrowUp","ArrowDown","Home","End"].includes(yf.key)){let Gg=De().filter(Bi=>!Bi.disabled).map(Bi=>Bi.ref.current);["ArrowUp","End"].includes(yf.key)&&(Gg=Gg.slice().reverse());["ArrowUp","ArrowDown"].includes(yf.key)&&(Fg=Gg.indexOf(yf.target),Gg=Gg.slice(Fg+1));setTimeout(()=>Gd(Gg));yf.preventDefault()}})}))))))}),eC=(0,mf.forwardRef)((a,
d)=>{const {__scopeSelect:l,onPlaced:K}=a;a=Jf(a,["__scopeSelect","onPlaced"]);const da=Vo("SelectContent",l);var ja=qn("SelectContent",l);const [ra,Ka]=(0,mf.useState)(null),[Sa,bb]=(0,mf.useState)(null);d=$g(d,Fc=>bb(Fc));const gb=Fv(l),jb=(0,mf.useRef)(!1),Jb=(0,mf.useRef)(!0),{viewport:Ob,selectedItem:Lb,selectedItemText:gc,focusSelectedItem:rc}=ja,Wb=(0,mf.useCallback)(()=>{if(da.trigger&&da.valueNode&&ra&&Sa&&Ob&&Lb&&gc){var Fc=da.trigger.getBoundingClientRect(),Lc=Sa.getBoundingClientRect(),
ud=da.valueNode.getBoundingClientRect(),Jd=gc.getBoundingClientRect();"rtl"!==da.dir?(Jd=ud.left-(Jd.left-Lc.left),ud=Fc.width+(Fc.left-Jd),Lc=$o(Jd,[10,window.innerWidth-10-Math.max(ud,Lc.width)]),ra.style.minWidth=ud+"px",ra.style.left=Lc+"px"):(Jd=window.innerWidth-ud.right-(Lc.right-Jd.right),ud=Fc.width+(window.innerWidth-Fc.right-Jd),Lc=$o(Jd,[10,window.innerWidth-10-Math.max(ud,Lc.width)]),ra.style.minWidth=ud+"px",ra.style.right=Lc+"px");const df=gb();Lc=window.innerHeight-20;var Ee=Ob.scrollHeight,
Sd=window.getComputedStyle(Sa);ud=parseInt(Sd.borderTopWidth,10);var De=parseInt(Sd.paddingTop,10);Jd=parseInt(Sd.borderBottomWidth,10);Sd=parseInt(Sd.paddingBottom,10);var gf=ud+De+Ee+Sd+Jd;Ee=Math.min(5*Lb.offsetHeight,gf);var Te=window.getComputedStyle(Ob);Sd=parseInt(Te.paddingTop,10);Te=parseInt(Te.paddingBottom,10);const Gd=Fc.top+Fc.height/2-10,od=Lc-Gd;Fc=Lb.offsetHeight/2;De=ud+De+(Lb.offsetTop+Fc);gf-=De;De<=Gd?(ud=Lb===df[df.length-1].ref.current,ra.style.bottom="0px",ra.style.height=De+
Math.max(od,Fc+(ud?Te:0)+(Sa.clientHeight-Ob.offsetTop-Ob.offsetHeight)+Jd)+"px"):(Jd=Lb===df[0].ref.current,ra.style.top="0px",ra.style.height=Math.max(Gd,ud+Ob.offsetTop+(Jd?Sd:0)+Fc)+gf+"px",Ob.scrollTop=De-Gd+Ob.offsetTop);ra.style.margin="10px 0";ra.style.minHeight=Ee+"px";ra.style.maxHeight=Lc+"px";null===K||void 0===K||K();requestAnimationFrame(()=>jb.current=!0)}},[gb,da.trigger,da.valueNode,ra,Sa,Ob,Lb,gc,da.dir,K]);vl(()=>Wb(),[Wb]);const [kc,hc]=(0,mf.useState)();vl(()=>{Sa&&hc(window.getComputedStyle(Sa).zIndex)},
[Sa]);ja=(0,mf.useCallback)(Fc=>{Fc&&!0===Jb.current&&(Wb(),null===rc||void 0===rc||rc(),Jb.current=!1)},[Wb,rc]);return(0,mf.createElement)(Cs,{scope:l,contentWrapper:ra,shouldExpandOnScrollRef:jb,onScrollButtonChange:ja},(0,mf.createElement)("div",{ref:Ka,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:kc}},(0,mf.createElement)(tk.div,Oe({},a,{ref:d,style:Zd({boxSizing:"border-box",maxHeight:"100%"},a.style)}))))}),hy=(0,mf.forwardRef)((a,d)=>{const {__scopeSelect:l,align:K=
"start",collisionPadding:da=10}=a;a=Jf(a,["__scopeSelect","align","collisionPadding"]);const ja=Bs(l);return(0,mf.createElement)(cy,Oe({},ja,a,{ref:d,align:K,collisionPadding:da,style:ff(Zd({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)"})}))}),[Cs,mq]=As("SelectContent",{}),Vt=(0,mf.forwardRef)((a,d)=>{const {__scopeSelect:l}=a;a=Jf(a,["__scopeSelect"]);const K=qn("SelectViewport",l),da=mq("SelectViewport",l);d=$g(d,K.onViewportChange);const ja=(0,mf.useRef)(0);return(0,mf.createElement)(mf.Fragment,null,(0,mf.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,mf.createElement)(zs.Slot,{scope:l},(0,mf.createElement)(tk.div,Oe({"data-radix-select-viewport":"",role:"presentation"},a,{ref:d,style:Zd({position:"relative",flex:1,overflow:"auto"},a.style),onScroll:Wf(a.onScroll,ra=>{ra=ra.currentTarget;const {contentWrapper:Ka,shouldExpandOnScrollRef:Sa}=da;if(null!==Sa&&void 0!==Sa&&Sa.current&&Ka){var bb=Math.abs(ja.current-ra.scrollTop);if(0<bb){var gb=window.innerHeight-20,jb=parseFloat(Ka.style.minHeight);const Jb=parseFloat(Ka.style.height);jb=Math.max(jb,
Jb);jb<gb&&(bb=jb+bb,gb=Math.min(gb,bb),bb-=gb,Ka.style.height=gb+"px","0px"===Ka.style.bottom&&(ra.scrollTop=0<bb?bb:0,Ka.style.justifyContent="flex-end"))}}ja.current=ra.scrollTop})}))))});As("SelectGroup");var [Wt,Xt]=As("SelectItem"),nq=(0,mf.forwardRef)((a,d)=>{const {__scopeSelect:l,value:K,disabled:da=!1,textValue:ja}=a;a=Jf(a,["__scopeSelect","value","disabled","textValue"]);const ra=Vo("SelectItem",l),Ka=qn("SelectItem",l),Sa=ra.value===K,[bb,gb]=(0,mf.useState)(null!==ja&&void 0!==ja?ja:
""),[jb,Jb]=(0,mf.useState)(!1);d=$g(d,gc=>{var rc;return null===(rc=Ka.itemRefCallback)||void 0===rc?void 0:rc.call(Ka,gc,K,da)});const Ob=Ei(),Lb=()=>{da||(ra.onValueChange(K),ra.onOpenChange(!1))};return(0,mf.createElement)(Wt,{scope:l,value:K,disabled:da,textId:Ob,isSelected:Sa,onItemTextChange:(0,mf.useCallback)(gc=>{gb(rc=>{var Wb;return rc||(null!==(Wb=null===gc||void 0===gc?void 0:gc.textContent)&&void 0!==Wb?Wb:"").trim()})},[])},(0,mf.createElement)(zs.ItemSlot,{scope:l,value:K,disabled:da,
textValue:bb},(0,mf.createElement)(tk.div,Oe({role:"option","aria-labelledby":Ob,"data-highlighted":jb?"":void 0,"aria-selected":Sa&&jb,"data-state":Sa?"checked":"unchecked","aria-disabled":da||void 0,"data-disabled":da?"":void 0,tabIndex:da?void 0:-1},a,{ref:d,onFocus:Wf(a.onFocus,()=>Jb(!0)),onBlur:Wf(a.onBlur,()=>Jb(!1)),onPointerUp:Wf(a.onPointerUp,Lb),onPointerMove:Wf(a.onPointerMove,gc=>{if(da){var rc;null===(rc=Ka.onItemLeave)||void 0===rc||rc.call(Ka)}else gc.currentTarget.focus({preventScroll:!0})}),
onPointerLeave:Wf(a.onPointerLeave,gc=>{if(gc.currentTarget===document.activeElement){var rc;null===(rc=Ka.onItemLeave)||void 0===rc||rc.call(Ka)}}),onKeyDown:Wf(a.onKeyDown,gc=>{var rc;if(""===(null===(rc=Ka.searchRef)||void 0===rc?void 0:rc.current)||" "!==gc.key)aC.includes(gc.key)&&Lb()," "===gc.key&&gc.preventDefault()})}))))}),Qn=(0,mf.forwardRef)((a,d)=>{var {__scopeSelect:l}=a;a=Jf(a,["__scopeSelect","className","style"]);const K=Vo("SelectItemText",l),da=qn("SelectItemText",l),ja=Xt("SelectItemText",
l);l=ey("SelectItemText",l);const [ra,Ka]=(0,mf.useState)(null);d=$g(d,Jb=>Ka(Jb),ja.onItemTextChange,Jb=>{var Ob;return null===(Ob=da.itemTextRefCallback)||void 0===Ob?void 0:Ob.call(da,Jb,ja.value,ja.disabled)});const Sa=null===ra||void 0===ra?void 0:ra.textContent,bb=(0,mf.useMemo)(()=>(0,mf.createElement)("option",{key:ja.value,value:ja.value,disabled:ja.disabled},Sa),[ja.disabled,ja.value,Sa]),{onNativeOptionAdd:gb,onNativeOptionRemove:jb}=l;vl(()=>{gb(bb);return()=>jb(bb)},[gb,jb,bb]);return(0,mf.createElement)(mf.Fragment,
null,(0,mf.createElement)(tk.span,Oe({id:ja.textId},a,{ref:d})),ja.isSelected&&K.valueNode&&!K.valueNodeHasChildren?(0,vs.createPortal)(a.children,K.valueNode):null)}),fC=(0,mf.forwardRef)((a,d)=>{const l=qn("SelectScrollUpButton",a.__scopeSelect),K=mq("SelectScrollUpButton",a.__scopeSelect),[da,ja]=(0,mf.useState)(!1);d=$g(d,K.onScrollButtonChange);vl(()=>{if(l.viewport&&l.isPositioned){let ra=function(){ja(0<Ka.scrollTop)};const Ka=l.viewport;ra();Ka.addEventListener("scroll",ra);return()=>Ka.removeEventListener("scroll",
ra)}},[l.viewport,l.isPositioned]);return da?(0,mf.createElement)(qr,Oe({},a,{ref:d,onAutoScroll:()=>{const {viewport:ra,selectedItem:Ka}=l;ra&&Ka&&(ra.scrollTop-=Ka.offsetHeight)}})):null}),rn=(0,mf.forwardRef)((a,d)=>{const l=qn("SelectScrollDownButton",a.__scopeSelect),K=mq("SelectScrollDownButton",a.__scopeSelect),[da,ja]=(0,mf.useState)(!1);d=$g(d,K.onScrollButtonChange);vl(()=>{if(l.viewport&&l.isPositioned){let ra=function(){ja(Math.ceil(Ka.scrollTop)<Ka.scrollHeight-Ka.clientHeight)};const Ka=
l.viewport;ra();Ka.addEventListener("scroll",ra);return()=>Ka.removeEventListener("scroll",ra)}},[l.viewport,l.isPositioned]);return da?(0,mf.createElement)(qr,Oe({},a,{ref:d,onAutoScroll:()=>{const {viewport:ra,selectedItem:Ka}=l;ra&&Ka&&(ra.scrollTop+=Ka.offsetHeight)}})):null}),qr=(0,mf.forwardRef)((a,d)=>{const {__scopeSelect:l,onAutoScroll:K}=a;a=Jf(a,["__scopeSelect","onAutoScroll"]);const da=qn("SelectScrollButton",l),ja=(0,mf.useRef)(null),ra=Fv(l),Ka=(0,mf.useCallback)(()=>{null!==ja.current&&
(window.clearInterval(ja.current),ja.current=null)},[]);(0,mf.useEffect)(()=>()=>Ka(),[Ka]);vl(()=>{var Sa;const bb=ra().find(gb=>gb.ref.current===document.activeElement);null===bb||void 0===bb||null===(Sa=bb.ref.current)||void 0===Sa||Sa.scrollIntoView({block:"nearest"})},[ra]);return(0,mf.createElement)(tk.div,Oe({"aria-hidden":!0},a,{ref:d,style:Zd({flexShrink:0},a.style),onPointerMove:Wf(a.onPointerMove,()=>{var Sa;null===(Sa=da.onItemLeave)||void 0===Sa||Sa.call(da);null===ja.current&&(ja.current=
window.setInterval(K,50))}),onPointerLeave:Wf(a.onPointerLeave,()=>{Ka()})}))}),Yt=(0,mf.forwardRef)((a,d)=>{const {value:l}=a;a=Jf(a,["value"]);const K=(0,mf.useRef)(null);d=$g(d,K);const da=Yn(l);(0,mf.useEffect)(()=>{const ja=K.current,ra=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(da!==l&&ra){const Ka=new Event("change",{bubbles:!0});ra.call(ja,l);ja.dispatchEvent(Ka)}},[da,l]);return(0,mf.createElement)(jq,{asChild:!0},(0,mf.createElement)("select",Oe({},
a,{ref:d,defaultValue:l})))});Yt.displayName="BubbleSelect";var oq=a=>{const {__scopeSelect:d,children:l,open:K,defaultOpen:da,onOpenChange:ja,value:ra,defaultValue:Ka,onValueChange:Sa,dir:bb,name:gb,autoComplete:jb,disabled:Jb,required:Ob}=a,Lb=Bs(d),[gc,rc]=(0,mf.useState)(null),[Wb,kc]=(0,mf.useState)(null),[hc,Fc]=(0,mf.useState)(!1),Lc=pg(bb),[ud=!1,Jd]=Dc({prop:K,defaultProp:da,onChange:ja}),[Ee,Sd]=Dc({prop:ra,defaultProp:Ka,onChange:Sa}),De=(0,mf.useRef)(null),gf=gc?!!gc.closest("form"):!0,
[Te,df]=(0,mf.useState)(new Set),Gd=Array.from(Te).map(od=>od.props.value).join(";");return(0,mf.createElement)(ZB,Lb,(0,mf.createElement)(nH,{required:Ob,scope:d,trigger:gc,onTriggerChange:rc,valueNode:Wb,onValueNodeChange:kc,valueNodeHasChildren:hc,onValueNodeHasChildrenChange:Fc,contentId:Ei(),value:Ee,onValueChange:Sd,open:ud,onOpenChange:Jd,dir:Lc,triggerPointerDownPosRef:De,disabled:Jb},(0,mf.createElement)(zs.Provider,{scope:d},(0,mf.createElement)(dy,{scope:a.__scopeSelect,onNativeOptionAdd:(0,mf.useCallback)(od=>
{df(Dd=>(new Set(Dd)).add(od))},[]),onNativeOptionRemove:(0,mf.useCallback)(od=>{df(Dd=>{Dd=new Set(Dd);Dd.delete(od);return Dd})},[])},l)),gf?(0,mf.createElement)(Yt,{key:Gd,"aria-hidden":!0,required:Ob,tabIndex:-1,name:gb,autoComplete:jb,value:Ee,onChange:od=>Sd(od.target.value),disabled:Jb},void 0===Ee?(0,mf.createElement)("option",{value:""}):null,Array.from(Te)):null))},gC=fy,iC=bC,jC=cC,wl=a=>(0,mf.createElement)(mH,Oe({asChild:!0},a)),iy=dC,hC=Vt,Pm=nq,zd=Qn,kC=fC,Ah=rn,Rg=aa(616),lC=Kf(aa(0)),
Zt=aa(616),xl=aa(616),mC=ee(function(){const a=mg(),{handlers:{t:d}}=il.useContext(ji),l=il.useCallback(ra=>{a.api.setColor(ra)},[]),K=il.useCallback(ra=>{(ra=ra.currentTarget.dataset.tool)&&a.selectTool(ra)},[]),[da,ja]=il.useState(()=>{var ra;return null!=(ra=Object.values(as).find(Ka=>Ka===a.selectedTool.id))?ra:Object.values(as)[0]});il.useEffect(()=>{ja(ra=>{var Ka;return null!=(Ka=Object.values(as).find(Sa=>Sa===a.selectedTool.id))?Ka:ra})},[a.selectedTool.id]);return(0,xl.jsx)("div",{className:"tl-primary-tools",
"data-html2canvas-ignore":"true",children:(0,xl.jsxs)("div",{className:"tl-toolbar tl-tools-floating-panel",children:[(0,xl.jsx)(no,{handleClick:()=>a.selectTool("select"),tooltip:d("whiteboard/select"),id:"select",icon:"select-cursor"}),(0,xl.jsx)(no,{handleClick:()=>a.selectTool("move"),tooltip:d("whiteboard/pan"),id:"move",icon:a.isIn("move.panning")?"hand-grab":"hand-stop"}),(0,xl.jsx)(gq,{className:"tl-toolbar-separator",orientation:"horizontal"}),(0,xl.jsx)(no,{handleClick:()=>a.selectTool("logseq-portal"),
tooltip:d("whiteboard/add-block-or-page"),id:"logseq-portal",icon:"circle-plus"}),(0,xl.jsx)(no,{handleClick:()=>a.selectTool("pencil"),tooltip:d("whiteboard/draw"),id:"pencil",icon:"ballpen"}),(0,xl.jsx)(no,{handleClick:()=>a.selectTool("highlighter"),tooltip:d("whiteboard/highlight"),id:"highlighter",icon:"highlight"}),(0,xl.jsx)(no,{handleClick:()=>a.selectTool("erase"),tooltip:d("whiteboard/eraser"),id:"erase",icon:"eraser"}),(0,xl.jsx)(no,{handleClick:()=>a.selectTool("line"),tooltip:d("whiteboard/connector"),
id:"line",icon:"connector"}),(0,xl.jsx)(no,{handleClick:()=>a.selectTool("text"),tooltip:d("whiteboard/text"),id:"text",icon:"text"}),(0,xl.jsx)(Wx,{activeGeometry:da,setGeometry:K}),(0,xl.jsx)(gq,{className:"tl-toolbar-separator",orientation:"horizontal",style:{margin:"0 -4px"}}),(0,xl.jsx)(km,{popoverSide:"left",color:a.settings.color,setColor:l}),(0,xl.jsx)(Jr,{scaleLevel:a.settings.scaleLevel,popoverSide:"left",compact:!0})]})})}),jy=aa(616),Gv=ee(function(){const a=mg();return(0,jy.jsxs)("div",
{className:"tl-statusbar","data-html2canvas-ignore":"true",children:[a.selectedTool.id," | ",a.selectedTool.currentState.id,(0,jy.jsx)("div",{style:{flex:1}}),(0,jy.jsx)("div",{id:"tl-statusbar-anchor",className:"flex gap-1"})]})}),rr=aa(616),nC=ee(function(){const a=mg();return(0,rr.jsxs)(rr.Fragment,{children:[wf()&&(0,rr.jsx)(Gv,{}),wf()&&(0,rr.jsx)(nn,{}),!a.readOnly&&(0,rr.jsx)(mC,{}),(0,rr.jsx)(TB,{})]})}),sn=Kf(aa(0)),Wk=Kf(aa(0)),ky=Kf(aa(0)),oC=Kf(aa(0)),tp=aa(616),ly=({id:a,showReferenceContent:d=
!1})=>{var l;const {handlers:{isWhiteboardPage:K,redirectToPage:da,sidebarAddBlock:ja,queryBlockByUUID:ra},renderers:{Breadcrumb:Ka,PageName:Sa}}=oC.default.useContext(ji);var bb="";let gb=Dj(a)?"B":"P",jb="";if(Dj(a)){bb=ra(a);if(!bb)return(0,tp.jsx)("span",{className:"p-2",children:"Invalid reference. Did you remove it?"});jb=bb.content;bb="whiteboard-shape"===(null==(l=bb.properties)?void 0:l["ls-type"])?"link-to-whiteboard":"link-to-block"}else bb=K(a)?"link-to-whiteboard":"link-to-page";l=jb&&
23<jb.length?jb.slice(0,20)+"...":jb;return(0,tp.jsxs)("button",{className:"inline-flex gap-1 items-center w-full",onPointerDown:Jb=>{Jb.stopPropagation();Jb.shiftKey?ja(a,"B"===gb?"block":"page"):da(a)},children:[(0,tp.jsx)(Qg,{name:bb}),(0,tp.jsx)("span",{className:"pointer-events-none block-link-reference-row",children:"P"===gb?(0,tp.jsx)(Sa,{pageName:a}):(0,tp.jsxs)(tp.Fragment,{children:[(0,tp.jsx)(Ka,{levelLimit:1,blockId:a,endSeparator:d}),d&&l]})})]})},Pj=Kf(aa(0)),sm=aa(0),pC=["children"],
Ds="undefined"!==typeof document?sm.useLayoutEffect:sm.useEffect,Zg=Kf(aa(0)),qh=aa(0),qC=aa(1),$t,Ik,oH="undefined"!=typeof document?qh.useLayoutEffect:qh.useEffect;!function(a){a[a.DEBUG=0]="DEBUG";a[a.INFO=1]="INFO";a[a.WARN=2]="WARN";a[a.ERROR=3]="ERROR"}(Ik||={});var rC=(($t={})[Ik.DEBUG]="debug",$t[Ik.INFO]="log",$t[Ik.WARN]="warn",$t[Ik.ERROR]="error",$t),up=Vh(function(){var a=Rf(Ik.ERROR);return{log:Rf(function(d,l,K){var da;void 0===K&&(K=Ik.INFO);K>=(null!=(da=("undefined"==typeof globalThis?
window:globalThis).VIRTUOSO_LOG_LEVEL)?da:a(4))&&console[rC[K]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",d,l)}),logLevel:a}},[],{singleton:!0}),tm=Vh(function(){var a=Cg(),d=Cg(),l=Rf(0),K=Cg(),da=Rf(0),ja=Cg(),ra=Cg(),Ka=Rf(0),Sa=Rf(0),bb=Rf(0),gb=Rf(0),jb=Cg(),Jb=Cg(),Ob=Rf(!1),Lb=Rf(!1);return Kg(xf(a,qg(function(gc){return gc.scrollTop})),d),Kg(xf(a,qg(function(gc){return gc.scrollHeight})),ra),Kg(d,da),{scrollContainerState:a,scrollTop:d,viewportHeight:ja,
headerHeight:Ka,fixedHeaderHeight:Sa,fixedFooterHeight:bb,footerHeight:gb,scrollHeight:ra,smoothScrollTargetReached:K,react18ConcurrentRendering:Lb,scrollTo:jb,scrollBy:Jb,statefulScrollTop:da,deviation:l,scrollingInProgress:Ob}},[],{singleton:!0}),gi={lvl:0},my=Vh(function(){return{recalcInProgress:Rf(!1)}},[],{singleton:!0}),pH={offsetHeight:"height",offsetWidth:"width"},vp=Vh(function(a){var d=a[0].log,l=a[1].recalcInProgress;a=Cg();var K=Cg(),da=Uj(K,0),ja=Cg(),ra=Cg(),Ka=Rf(0),Sa=Rf([]),bb=Rf(void 0),
gb=Rf(void 0),jb=Rf(function(kc,hc){return ii(kc,pH[hc])}),Jb=Rf(void 0),Ob=Rf(0),Lb={offsetTree:[],sizeTree:gi,groupOffsetTree:gi,lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},gc=Uj(xf(a,vh(Sa,d,Ob),fk(pi,Lb),Sh()),Lb);Kg(xf(Sa,lg(function(kc){return 0<kc.length}),vh(gc,Ob),qg(function(kc){var hc=kc[0],Fc=kc[1],Lc=kc[2];kc=hc.reduce(function(ud,Jd,Ee){return ya(ud,Jd,Th(Jd,Fc.offsetTree,Lc)||Ee)},gi);return bh({},Fc,{groupIndices:hc,groupOffsetTree:kc})})),gc);Kg(xf(K,vh(gc),lg(function(kc){return kc[0]<
kc[1].lastIndex}),qg(function(kc){var hc=kc[1];return[{startIndex:kc[0],endIndex:hc.lastIndex,size:hc.lastSize}]})),a);Kg(bb,gb);var rc=Uj(xf(bb,qg(function(kc){return void 0===kc})),!0);Kg(xf(gb,lg(function(kc){return void 0!==kc&&gc(4).sizeTree===gi}),qg(function(kc){return[{startIndex:0,endIndex:0,size:kc}]})),a);Lb=nk(xf(a,vh(gc),fk(function(kc,hc){hc=hc[1];return{changed:hc!==kc.sizes,sizes:hc}},{changed:!1,sizes:Lb}),qg(function(kc){return kc.changed})));fh(xf(Ka,fk(function(kc,hc){return{diff:kc.prev-
hc,prev:hc}},{diff:0,prev:0}),qg(function(kc){return kc.diff})),function(kc){0<kc?(l(0,!0),ja(0,kc)):0>kc&&ra(0,kc)});fh(xf(Ka,vh(d)),function(kc){0>kc[0]&&(0,kc[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:Ka},Ik.ERROR)});d=nk(ja);Kg(xf(ja,vh(gc),qg(function(kc){var hc=kc[0];kc=kc[1];if(0<kc.groupIndices.length)throw Error("Virtuoso: prepending items does not work with groups");return Ia(kc.sizeTree).reduce(function(Fc,
Lc){var ud=Lc.k;Lc=Lc.v;return{ranges:[].concat(Fc.ranges,[{startIndex:Fc.prevIndex,endIndex:ud+hc-1,size:Fc.prevSize}]),prevIndex:ud+hc,prevSize:Lc}},{ranges:[],prevIndex:0,prevSize:kc.lastSize}).ranges})),a);var Wb=nk(xf(ra,vh(gc,Ob),qg(function(kc){return Th(-kc[0],kc[1].offsetTree,kc[2])})));return Kg(xf(ra,vh(gc,Ob),qg(function(kc){var hc=kc[0],Fc=kc[1];kc=kc[2];if(0<Fc.groupIndices.length)throw Error("Virtuoso: shifting items does not work with groups");var Lc=Ia(Fc.sizeTree).reduce(function(ud,
Jd){return ya(ud,Math.max(0,Jd.k+hc),Jd.v)},gi);return bh({},Fc,{sizeTree:Lc},yi(Fc.offsetTree,0,Lc,kc))})),gc),{data:Jb,totalCount:K,sizeRanges:a,groupIndices:Sa,defaultItemSize:gb,fixedItemSize:bb,unshiftWith:ja,shiftWith:ra,shiftWithOffset:Wb,beforeUnshiftWith:d,firstItemIndex:Ka,gap:Ob,sizes:gc,listRefresh:Lb,statefulTotalCount:da,trackItemSizes:rc,itemSize:jb}},Si(up,my),{singleton:!0}),qH="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style,au=Vh(function(a){function d(){rc&&
(rc(),rc=null);kc&&(kc(),kc=null);Wb&&(clearTimeout(Wb),Wb=null);Ka(0,!1)}var l=a[0],K=l.sizes,da=l.totalCount,ja=l.listRefresh;l=l.gap;var ra=a[1],Ka=ra.scrollingInProgress,Sa=ra.viewportHeight,bb=ra.scrollTo,gb=ra.smoothScrollTargetReached,jb=ra.headerHeight,Jb=ra.footerHeight,Ob=ra.fixedHeaderHeight;ra=ra.fixedFooterHeight;a=a[2].log;var Lb=Cg(),gc=Rf(0),rc=null,Wb=null,kc=null;return Kg(xf(Lb,vh(K,Sa,da,gc,jb,Jb,a),vh(l,Ob,ra),qg(function(hc){var Fc=hc[0],Lc=Fc[0],ud=Fc[1],Jd=Fc[2],Ee=Fc[3],Sd=
Fc[4],De=Fc[5],gf=Fc[6],Te=Fc[7],df=hc[1];Fc=hc[2];hc=hc[3];var Gd=Uh(Lc),od=Gd.align,Dd=Gd.behavior,jd=Gd.offset;--Ee;Gd=zi(Gd,ud,Ee);De=Th(Gd,ud.offsetTree,df)+De;"end"===od?(De+=Fc+ca(ud.sizeTree,Gd)[1]-Jd+hc,Gd===Ee&&(De+=gf)):"center"===od?De+=(Fc+ca(ud.sizeTree,Gd)[1]-Jd+hc)/2:De-=Sd;jd&&(De+=jd);var Cd=function(af){d();af?(Te("retrying to scroll to",{location:Lc},Ik.DEBUG),Lb(0,Lc)):Te("list did not change, scroll successful",{},Ik.DEBUG)};if(d(),"smooth"===Dd){var Me=!1;kc=fh(ja,function(af){Me=
Me||af});rc=Fm(gb,function(){Cd(Me)})}else rc=Fm(xf(ja,function(af){var Nf=setTimeout(function(){af(!1)},150);return function(bg){bg&&(af(!0),clearTimeout(Nf))}}),Cd);Wb=setTimeout(function(){d()},1200);Ka(0,!0);return Te("scrolling from index to",{index:Gd,top:De,behavior:Dd},Ik.DEBUG),{top:De,behavior:Dd}})),bb),{scrollToIndex:Lb,topListHeight:gc}},Si(vp,tm,up),{singleton:!0}),rH={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},
bu=Vh(function(a){var d=a[0],l=d.scrollContainerState;a=d.scrollTop;var K=d.viewportHeight,da=d.headerHeight,ja=d.footerHeight,ra=d.scrollBy;d=Rf(!1);var Ka=Rf(!0),Sa=Cg(),bb=Cg(),gb=Rf(4),jb=Rf(0),Jb=Uj(xf(Qp(xf(kh(a),cm(1),en(!0)),xf(kh(a),cm(1),en(!1),Jj(100))),Sh()),!1),Ob=Uj(xf(Qp(xf(ra,en(!0)),xf(ra,en(!1),Jj(200))),Sh()),!1);Kg(xf(sj(kh(a),kh(jb)),qg(function(Lb){return Lb[0]<=Lb[1]}),Sh()),Ka);Kg(xf(Ka,go(50)),bb);K=nk(xf(sj(l,kh(K),kh(da),kh(ja),kh(gb)),fk(function(Lb,gc){var rc,Wb,kc=gc[0],
hc=kc.scrollTop;kc=kc.scrollHeight;var Fc=gc[1],Lc={viewportHeight:Fc,scrollTop:hc,scrollHeight:kc};return hc+Fc-kc>-gc[4]?(hc>Lb.state.scrollTop?(rc="SCROLLED_DOWN",Wb=Lb.state.scrollTop-hc):(rc="SIZE_DECREASED",Wb=Lb.state.scrollTop-hc||Lb.scrollTopDelta),{atBottom:!0,state:Lc,atBottomBecause:rc,scrollTopDelta:Wb}):{atBottom:!1,notAtBottomBecause:Lc.scrollHeight>Lb.state.scrollHeight?"SIZE_INCREASED":Fc<Lb.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":hc<Lb.state.scrollTop?"SCROLLING_UPWARDS":
"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:Lc}},rH),Sh(function(Lb,gc){return Lb&&Lb.atBottom===gc.atBottom})));da=Uj(xf(l,fk(function(Lb,gc){var rc=gc.scrollTop,Wb=gc.scrollHeight;gc=gc.viewportHeight;return 1.01>Math.abs(Lb.scrollHeight-Wb)?{scrollTop:rc,scrollHeight:Wb,jump:0,changed:!1}:Lb.scrollTop!==rc&&1>Wb-(rc+gc)?{scrollHeight:Wb,scrollTop:rc,jump:Lb.scrollTop-rc,changed:!0}:{scrollHeight:Wb,scrollTop:rc,jump:0,changed:!0}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),lg(function(Lb){return Lb.changed}),
qg(function(Lb){return Lb.jump})),0);Kg(xf(K,qg(function(Lb){return Lb.atBottom})),d);Kg(xf(d,go(50)),Sa);ja=Rf("down");Kg(xf(l,qg(function(Lb){return Lb.scrollTop}),Sh(),fk(function(Lb,gc){return Ob(4)?{direction:Lb.direction,prevScrollTop:gc}:{direction:gc<Lb.prevScrollTop?"up":"down",prevScrollTop:gc}},{direction:"down",prevScrollTop:0}),qg(function(Lb){return Lb.direction})),ja);Kg(xf(l,go(50),en("none")),ja);l=Rf(0);return Kg(xf(Jb,lg(function(Lb){return!Lb}),en(0)),l),Kg(xf(a,go(100),vh(Jb),
lg(function(Lb){return!!Lb[1]}),fk(function(Lb,gc){return[Lb[1],gc[0]]},[0,0]),qg(function(Lb){return Lb[1]-Lb[0]})),l),{isScrolling:Jb,isAtTop:Ka,isAtBottom:d,atBottomState:K,atTopStateChange:bb,atBottomStateChange:Sa,scrollDirection:ja,atBottomThreshold:gb,atTopThreshold:jb,scrollVelocity:l,lastJumpDueToItemResize:da}},Si(tm)),sr=Vh(function(a){var d=a[0].log;a=Rf(!1);var l=nk(xf(a,lg(function(K){return K}),Sh()));return fh(a,function(K){K&&d(4)("props updated",{},Ik.DEBUG)}),{propsReady:a,didMount:l}},
Si(up),{singleton:!0}),Hv=Vh(function(a){var d=a[0],l=d.sizes,K=d.listRefresh;d=d.defaultItemSize;var da=a[1].scrollTop,ja=a[2].scrollToIndex;a=a[3].didMount;var ra=Rf(!0),Ka=Rf(0);return Kg(xf(a,vh(Ka),lg(function(Sa){return!!Sa[1]}),en(!1)),ra),fh(xf(sj(K,a),vh(ra,l,d),lg(function(Sa){var bb=Sa[1],gb=Sa[3];return Sa[0][1]&&(Sa[2].sizeTree!==gi||void 0!==gb)&&!bb}),vh(Ka)),function(Sa){var bb=Sa[1];setTimeout(function(){Fm(da,function(){ra(0,!0)});ja(0,bb)})}),{scrolledToInitialItem:ra,initialTopMostItemIndex:Ka}},
Si(vp,tm,au,sr),{singleton:!0}),sC=Vh(function(a){function d(gc){Sa(0,{index:"LAST",align:"end",behavior:gc})}function l(gc){var rc=Fm(Ka,function(Wb){!gc||Wb.atBottom||"SIZE_INCREASED"!==Wb.notAtBottomBecause||Lb||(jb(4)("scrolling to bottom due to increased size",{},Ik.DEBUG),d("auto"))});setTimeout(rc,100)}var K=a[0],da=K.totalCount,ja=K.listRefresh,ra=a[1];K=ra.isAtBottom;var Ka=ra.atBottomState,Sa=a[2].scrollToIndex;ra=a[3].scrolledToInitialItem;var bb=a[4],gb=bb.propsReady;bb=bb.didMount;var jb=
a[5].log;a=a[6].scrollingInProgress;var Jb=Rf(!1),Ob=Cg(),Lb=null;return fh(xf(sj(xf(kh(da),cm(1)),bb),vh(kh(Jb),K,ra,a),qg(function(gc){var rc=gc[0],Wb=rc[0];rc=rc[1]&&gc[3];var kc="auto";rc&&(kc=gc[1],gc=gc[2]||gc[4],kc="function"==typeof kc?Wh(kc(gc)):gc&&Wh(kc),rc=rc&&!!kc);return{totalCount:Wb,shouldFollow:rc,followOutputBehavior:kc}}),lg(function(gc){return gc.shouldFollow})),function(gc){var rc=gc.totalCount,Wb=gc.followOutputBehavior;Lb&&(Lb(),Lb=null);Lb=Fm(ja,function(){jb(4)("following output to ",
{totalCount:rc},Ik.DEBUG);d(Wb);Lb=null})}),fh(xf(sj(kh(Jb),da,gb),lg(function(gc){return gc[0]&&gc[2]}),fk(function(gc,rc){rc=rc[1];return{refreshed:gc.value===rc,value:rc}},{refreshed:!1,value:0}),lg(function(gc){return gc.refreshed}),vh(Jb,da)),function(gc){l(!1!==gc[1])}),fh(Ob,function(){l(!1!==Jb(4))}),fh(sj(kh(Jb),Ka),function(gc){var rc=gc[1];gc[0]&&!rc.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===rc.notAtBottomBecause&&d("auto")}),{followOutput:Jb,autoscrollToBottom:Ob}},Si(vp,bu,au,Hv,sr,up,
tm)),ny=Vh(function(a){var d=a[0],l=d.totalCount,K=d.groupIndices;d=d.sizes;var da=a[1];a=da.scrollTop;da=da.headerHeight;var ja=Cg(),ra=Cg(),Ka=nk(xf(ja,qg(qi)));return Kg(xf(Ka,qg(function(Sa){return Sa.totalCount})),l),Kg(xf(Ka,qg(function(Sa){return Sa.groupIndices})),K),Kg(xf(sj(a,d,da),lg(function(Sa){return Sa[1].groupOffsetTree!==gi}),qg(function(Sa){return ca(Sa[1].groupOffsetTree,Math.max(Sa[0]-Sa[2],0),"v")[0]}),Sh(),qg(function(Sa){return[Sa]})),ra),{groupCounts:ja,topItemsIndexes:ra}},
Si(vp,tm)),oy=Vh(function(a){var d=a[0];a=d.scrollTop;var l=d.viewportHeight,K=d.deviation,da=d.headerHeight,ja=d.fixedHeaderHeight;d=Cg();var ra=Rf(0),Ka=Rf(0),Sa=Rf(0);a=Uj(xf(sj(kh(a),kh(l),kh(da),kh(d,uj),kh(Sa),kh(ra),kh(ja),kh(K),kh(Ka)),qg(function(bb){var gb=bb[0],jb=bb[1],Jb=bb[2],Ob=bb[3],Lb=Ob[0];Ob=Ob[1];var gc=bb[4],rc=bb[6],Wb=bb[7],kc=bb[8],hc=gb-Wb;bb=bb[5]+rc;var Fc=Math.max(Jb-hc,0),Lc="none",ud="number"==typeof kc?kc:kc.top||0;kc="number"==typeof kc?kc:kc.bottom||0;return Lb-=Wb,
Ob+=Jb+rc,Lb+(Jb+rc)>gb+bb-ud&&(Lc="up"),Ob-Wb<gb-Fc+jb+kc&&(Lc="down"),"none"!==Lc?[Math.max(hc-Jb-ul(gc,"top",Lc)-ud,0),hc-Fc-rc+jb+ul(gc,"bottom",Lc)+kc]:null}),lg(function(bb){return null!=bb}),Sh(uj)),[0,0]);return{listBoundary:d,overscan:Sa,topListHeight:ra,increaseViewportBy:Ka,visibleRange:a}},Si(tm),{singleton:!0}),tC={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0},Es=Vh(function(a){var d=a[0],l=d.sizes,K=d.totalCount,da=d.data,
ja=d.firstItemIndex,ra=d.gap,Ka=a[1],Sa=a[2],bb=Sa.visibleRange;d=Sa.listBoundary;Sa=Sa.topListHeight;var gb=a[3],jb=gb.scrolledToInitialItem,Jb=gb.initialTopMostItemIndex;gb=a[4].topListHeight;var Ob=a[5],Lb=a[6].didMount,gc=a[7].recalcInProgress;a=Rf([]);var rc=Cg();Kg(Ka.topItemsIndexes,a);l=Uj(xf(sj(Lb,gc,kh(bb,uj),kh(K),kh(l),kh(Jb),jb,kh(a),kh(ja),kh(ra),da),lg(function(Wb){return Wb[0]&&!Wb[1]}),qg(function(Wb){var kc=Wb[2],hc=kc[0],Fc=kc[1];kc=Wb[3];var Lc=Wb[5],ud=Wb[6],Jd=Wb[7],Ee=Wb[8],
Sd=Wb[9],De=Wb[10];Wb=Wb[4];var gf=Wb.sizeTree,Te=Wb.offsetTree;if(0===kc||0===hc&&0===Fc)return bh({},tC,{totalCount:kc});if(gf===gi)return Jm(function(bg,ef,Eg){return ef.groupOffsetTree!==gi?(bg=zh(bg,ef),[{index:ca(ef.groupOffsetTree,bg)[0],size:0,offset:0},{index:bg,size:0,offset:0,data:Eg&&Eg[0]}]):[{index:bg,size:0,offset:0,data:Eg&&Eg[0]}]}("number"==typeof Lc?Lc:"LAST"===Lc.index?kc-1:Lc.index,Wb,De),[],kc,Sd,Wb,Ee);Lc=[];if(0<Jd.length){var df,Gd=Jd[0],od=Jd[Jd.length-1],Dd=0;for(gf=em(Pc(gf,
Gd,od));!(df=gf()).done;){var jd=df.value;df=jd.value;var Cd=Math.min(jd.end,od);for(jd=Math.max(jd.start,Gd);jd<=Cd;jd++)Lc.push({index:jd,size:df,offset:Dd,data:De&&De[jd]}),Dd+=df}}if(!ud)return Jm([],Lc,kc,Sd,Wb,Ee);var Me=0<Jd.length?Jd[Jd.length-1]+1:0,af=function(bg,ef,Eg,yf){return void 0===yf&&(yf=0),0<yf&&(ef=Math.max(ef,bg[Ce(bg,yf,Pg)].offset)),wd((Gg=Eg,Bj=Ce(Fg=bg,ef,Bi=Vj),Fi=Ce(Fg,Gg,Bi,Bj),Fg.slice(Bj,Fi+1)),Ag);var Fg,Gg,Bi,Bj,Fi}(Te,hc,Fc,Me);if(0===af.length)return null;var Nf=
kc-1;return Jm(Wi([],function(bg){for(var ef,Eg=em(af);!(ef=Eg()).done;){var yf=ef.value,Fg=yf.value;ef=Fg.offset;var Gg=yf.start,Bi=Fg.size;Fg.offset<hc&&(Fg=(Gg+=Math.floor((hc-Fg.offset+Sd)/(Bi+Sd)))-yf.start,ef+=Fg*Bi+Fg*Sd);Gg<Me&&(ef+=(Me-Gg)*Bi,Gg=Me);for(yf=Math.min(yf.end,Nf);Gg<=yf&&!(ef>=Fc);Gg++)bg.push({index:Gg,size:Bi,offset:ef,data:De&&De[Gg]}),ef+=Bi+Sd}}),Lc,kc,Sd,Wb,Ee)}),lg(function(Wb){return null!==Wb}),Sh()),tC);return Kg(xf(da,lg(function(Wb){return void 0!==Wb}),qg(function(Wb){return Wb.length})),
K),Kg(xf(l,qg(function(Wb){return Wb.topListHeight})),gb),Kg(gb,Sa),Kg(xf(l,qg(function(Wb){return[Wb.top,Wb.bottom]})),d),Kg(xf(l,qg(function(Wb){return Wb.items})),rc),bh({listState:l,topItemsIndexes:a,endReached:nk(xf(l,lg(function(Wb){return 0<Wb.items.length}),vh(K,da),lg(function(Wb){var kc=Wb[0].items;return kc[kc.length-1].originalIndex===Wb[1]-1}),qg(function(Wb){return[Wb[1]-1,Wb[2]]}),Sh(uj),qg(function(Wb){return Wb[0]}))),startReached:nk(xf(l,go(200),lg(function(Wb){var kc=Wb.items;return 0<
kc.length&&kc[0].originalIndex===Wb.topItems.length}),qg(function(Wb){return Wb.items[0].index}),Sh())),rangeChanged:nk(xf(l,lg(function(Wb){return 0<Wb.items.length}),qg(function(Wb){Wb=Wb.items;for(var kc=0,hc=Wb.length-1;"group"===Wb[kc].type&&kc<hc;)kc++;for(;"group"===Wb[hc].type&&hc>kc;)hc--;return{startIndex:Wb[kc].index,endIndex:Wb[hc].index}}),Sh(Dk))),itemsRendered:rc},Ob)},Si(vp,ny,oy,Hv,au,bu,sr,my),{singleton:!0}),sH=Vh(function(a){var d=a[0],l=d.sizes,K=d.firstItemIndex,da=d.data;d=
d.gap;var ja=a[1].listState;a=a[2].didMount;var ra=Rf(0);return Kg(xf(a,vh(ra),lg(function(Ka){return 0!==Ka[1]}),vh(l,K,d,da),qg(function(Ka){var Sa=Ka[0][1],bb=Ka[1],gb=Ka[2],jb=Ka[3];Ka=Ka[4];var Jb=void 0===Ka?[]:Ka;Ka=0;if(0<bb.groupIndices.length)for(var Ob,Lb=em(bb.groupIndices);!((Ob=Lb()).done||Ob.value-Ka>=Sa);)Ka++;Sa+=Ka;return Jm(Array.from({length:Sa}).map(function(gc,rc){return{index:rc,size:0,offset:0,data:Jb[rc]}}),[],Sa,jb,bb,gb)})),ja),{initialItemCount:ra}},Si(vp,Es,sr),{singleton:!0}),
Wo=Vh(function(a){a=a[0].scrollVelocity;var d=Rf(!1),l=Cg(),K=Rf(!1);return Kg(xf(a,vh(K,d,l),lg(function(da){return!!da[1]}),qg(function(da){var ja=da[0],ra=da[1],Ka=da[2];da=da[3];var Sa=ra.enter;if(Ka){if((0,ra.exit)(ja,da))return!1}else if(Sa(ja,da))return!0;return Ka}),Sh()),d),fh(xf(sj(d,a,l),vh(K)),function(da){var ja=da[0];da=da[1];return ja[0]&&da&&da.change&&da.change(ja[1],ja[2])}),{isSeeking:d,scrollSeekConfiguration:K,scrollVelocity:a,scrollSeekRangeChanged:l}},Si(bu),{singleton:!0}),
py=Vh(function(a){a=a[0].topItemsIndexes;var d=Rf(0);return Kg(xf(d,lg(function(l){return 0<l}),qg(function(l){return Array.from({length:l}).map(function(K,da){return da})})),a),{topItemCount:d}},Si(Es)),Fs=Vh(function(a){var d=a[0],l=d.footerHeight,K=d.headerHeight,da=d.fixedHeaderHeight;d=d.fixedFooterHeight;var ja=a[1].listState;a=Cg();l=Uj(xf(sj(l,d,K,da,ja),qg(function(ra){var Ka=ra[4];return ra[0]+ra[1]+ra[2]+ra[3]+Ka.offsetBottom+Ka.bottom})),0);return Kg(kh(l),a),{totalListHeight:l,totalListHeightChanged:a}},
Si(tm,Es),{singleton:!0}),Iv=Km(function(){return/iP(ad|hone|od).+Version\/[\d.]+.*Safari/i.test(navigator.userAgent)}),qy=Vh(function(a){function d(rc){0<rc?(K(0,{top:-rc,behavior:"auto"}),ja(0,0)):(ja(0,0),K(0,{top:-rc,behavior:"auto"}))}var l=a[0],K=l.scrollBy,da=l.scrollTop,ja=l.deviation,ra=l.scrollingInProgress,Ka=a[1];l=Ka.isScrolling;var Sa=Ka.isAtBottom,bb=Ka.scrollDirection,gb=a[3],jb=gb.beforeUnshiftWith,Jb=gb.shiftWithOffset,Ob=gb.sizes;gb=gb.gap;var Lb=a[4].log,gc=a[5].recalcInProgress;
a=nk(xf(a[2].listState,vh(Ka.lastJumpDueToItemResize),fk(function(rc,Wb){var kc=rc[1],hc=Wb[0],Fc=hc.items,Lc=hc.totalCount;hc=hc.bottom+hc.offsetBottom;var ud=0;return rc[2]===Lc&&0<kc.length&&0<Fc.length&&(0===Fc[0].originalIndex&&0===kc[0].originalIndex||0!=(ud=hc-rc[3])&&(ud+=Wb[1])),[ud,Fc,Lc,hc]},[0,[],0,0]),lg(function(rc){return 0!==rc[0]}),vh(da,bb,ra,Sa,Lb),lg(function(rc){return!rc[3]&&0!==rc[1]&&"up"===rc[2]}),qg(function(rc){var Wb=rc[0][0];return(0,rc[5])("Upward scrolling compensation",
{amount:Wb},Ik.DEBUG),Wb})));return fh(xf(a,vh(ja,l)),function(rc){var Wb=rc[0],kc=rc[1];rc[2]&&Iv()?ja(0,kc-Wb):d(-Wb)}),fh(xf(sj(Uj(l,!1),ja,gc),lg(function(rc){return!rc[0]&&!rc[2]&&0!==rc[1]}),qg(function(rc){return rc[1]}),go(1)),d),Kg(xf(Jb,qg(function(rc){return{top:-rc}})),K),fh(xf(jb,vh(Ob,gb),qg(function(rc){var Wb=rc[0];return Wb*rc[1].lastSize+Wb*rc[2]})),function(rc){ja(0,rc);requestAnimationFrame(function(){Ur(K,{top:rc});requestAnimationFrame(function(){ja(0,0);gc(0,!1)})})}),{deviation:ja}},
Si(tm,bu,Es,vp,up,my)),uC=Vh(function(a){var d=a[0].totalListHeight,l=a[1].didMount,K=a[2].scrollTo;a=Rf(0);return fh(xf(l,vh(a),lg(function(da){return 0!==da[1]}),qg(function(da){return{top:da[1]}})),function(da){Fm(xf(d,lg(function(ja){return 0!==ja})),function(){setTimeout(function(){K(0,da)})})}),{initialScrollTop:a}},Si(Fs,sr,tm),{singleton:!0}),ry=Vh(function(a){var d=a[0].viewportHeight;a=a[1].totalListHeight;var l=Rf(!1);return{alignToBottom:l,paddingTopAddition:Uj(xf(sj(l,d,a),lg(function(K){return K[0]}),
qg(function(K){return Math.max(0,K[1]-K[2])}),Sh()),0)}},Si(tm,Fs),{singleton:!0}),Jv=Vh(function(a){var d=a[0];a=d.scrollTo;d=d.scrollContainerState;var l=Cg(),K=Cg(),da=Cg(),ja=Rf(!1),ra=Rf(void 0);return Kg(xf(sj(l,K),qg(function(Ka){var Sa=Ka[0];return{scrollTop:Math.max(0,Sa.scrollTop-Ka[1].offsetTop),scrollHeight:Sa.scrollHeight,viewportHeight:Sa.viewportHeight}})),d),Kg(xf(a,vh(K),qg(function(Ka){var Sa=Ka[0];return bh({},Sa,{top:Sa.top+Ka[1].offsetTop})})),da),{useWindowScroll:ja,customScrollParent:ra,
windowScrollContainerState:l,windowViewportRect:K,windowScrollTo:da}},Si(tm)),tr=["done","behavior","align"],pq=Vh(function(a){var d=a[0],l=d.sizes,K=d.totalCount;d=d.gap;var da=a[1],ja=da.scrollTop,ra=da.viewportHeight,Ka=da.headerHeight,Sa=da.fixedHeaderHeight,bb=da.fixedFooterHeight,gb=da.scrollingInProgress;a=a[2].scrollToIndex;da=Cg();return Kg(xf(da,vh(l,ra,K,Ka,Sa,bb,ja),vh(d),qg(function(jb){var Jb=jb[0],Ob=Jb[0],Lb=Jb[1],gc=Jb[2],rc=Jb[3],Wb=Jb[4],kc=Jb[5],hc=Jb[6];Jb=Jb[7];var Fc=jb[1];
jb=Ob.done;var Lc=Ob.behavior,ud=Ob.align,Jd=dm(Ob,tr),Ee=null;Ob=zi(Ob,Lb,rc-1);Wb=Th(Ob,Lb.offsetTree,Fc)+Wb+kc;return Wb<Jb+kc?Ee=bh({},Jd,{behavior:Lc,align:null!=ud?ud:"start"}):Wb+ca(Lb.sizeTree,Ob)[1]>Jb+gc-hc&&(Ee=bh({},Jd,{behavior:Lc,align:null!=ud?ud:"end"})),Ee?jb&&Fm(xf(gb,cm(1),lg(function(Sd){return!1===Sd})),jb):jb&&jb(),Ee}),lg(function(jb){return null!==jb})),a),{scrollIntoView:da}},Si(vp,tm,au,Es,up),{singleton:!0}),sy=["listState","topItemsIndexes"],vC=Vh(function(a){return bh({},
a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])},Si(oy,sH,sr,Wo,Fs,uC,ry,Jv,pq)),Gs=Vh(function(a){var d=a[0],l=d.totalCount,K=d.sizeRanges,da=d.fixedItemSize,ja=d.defaultItemSize,ra=d.trackItemSizes,Ka=d.itemSize,Sa=d.data,bb=d.firstItemIndex,gb=d.groupIndices,jb=d.statefulTotalCount;d=d.gap;var Jb=a[1],Ob=Jb.initialTopMostItemIndex;Jb=Jb.scrolledToInitialItem;var Lb=a[2],gc=a[3],rc=a[4],Wb=rc.listState,kc=rc.topItemsIndexes;rc=dm(rc,sy);var hc=a[5].scrollToIndex,Fc=a[7].topItemCount,Lc=a[8].groupCounts,
ud=a[9];a=a[10];return Kg(rc.rangeChanged,ud.scrollSeekRangeChanged),Kg(xf(ud.windowViewportRect,qg(function(Jd){return Jd.visibleHeight})),Lb.viewportHeight),bh({totalCount:l,data:Sa,firstItemIndex:bb,sizeRanges:K,initialTopMostItemIndex:Ob,scrolledToInitialItem:Jb,topItemsIndexes:kc,topItemCount:Fc,groupCounts:Lc,fixedItemHeight:da,defaultItemHeight:ja,gap:d},gc,{statefulTotalCount:jb,listState:Wb,scrollToIndex:hc,trackItemSizes:ra,itemSize:Ka,groupIndices:gb},rc,ud,Lb,a)},Si(vp,Hv,tm,sC,Es,au,
qy,py,ny,vC,up)),wC=Km(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"}),cu=Zg.createContext(void 0),po=Zg.createContext(void 0),xC=["placeholder"],ty=["style","children"],yC=["style","children"],zC=Vh(function(){var a=Rf(function(Sa){return"Item "+Sa}),d=Rf(null),l=Rf(function(Sa){return"Group "+Sa}),K=Rf({}),da=Rf(ct),ja=Rf("div"),ra=Rf(fi),Ka=function(Sa,
bb){return void 0===bb&&(bb=null),Uj(xf(K,qg(function(gb){return gb[Sa]}),Sh()),bb)};return{context:d,itemContent:a,groupContent:l,components:K,computeItemKey:da,headerFooterTag:ja,scrollerRef:ra,FooterComponent:Ka("Footer"),HeaderComponent:Ka("Header"),TopItemListComponent:Ka("TopItemList"),ListComponent:Ka("List","div"),ItemComponent:Ka("Item","div"),GroupComponent:Ka("Group","div"),ScrollerComponent:Ka("Scroller","div"),EmptyPlaceholder:Ka("EmptyPlaceholder"),ScrollSeekPlaceholder:Ka("ScrollSeekPlaceholder")}}),
Kv=Vh(function(a){function d(da,ja,ra){Kg(xf(da,vh(K.components),qg(function(Ka){var Sa,bb=Ka[0];Ka=Ka[1];return console.warn("react-virtuoso: "+ra+" property is deprecated. Pass components."+ja+" instead."),bh({},Ka,((Sa={})[ja]=bb,Sa))})),K.components)}var l=a[0],K=a[1];a={item:om(K.itemContent,"Rename the %citem%c prop to %citemContent."),group:om(K.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:om(l.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:om(l.fixedItemHeight,
"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:om(l.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:Cg(),maxHeightCacheSize:Cg(),footer:Cg(),header:Cg(),HeaderContainer:Cg(),FooterContainer:Cg(),ItemContainer:Cg(),ScrollContainer:Cg(),GroupContainer:Cg(),ListContainer:Cg(),emptyComponent:Cg(),scrollSeek:Cg()};return fh(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;")}),fh(a.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),fh(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.")}),fh(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.")}),
fh(a.scrollSeek,function(da){var ja=da.placeholder;da=dm(da,xC);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead.");ja=bh({},(0,K.components)(4),{ScrollSeekPlaceholder:ja});(0,K.components)(0,ja);(0,l.scrollSeekConfiguration)(0,da)}),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"),bh({},l,K,a)},Si(Gs,zC)),AC=function(a){return Zg.createElement("div",{style:{height:a.height}})},um={position:wC(),zIndex:1,overflowAnchor:"none"},tH={overflowAnchor:"none"},Hs=Zg.memo(function(a){a=a.showTopList;a=void 0!==a&&a;var d=Jh("listState"),l=Qm("sizeRanges"),K=Jh("useWindowScroll"),da=Jh("customScrollParent"),ja=Qm("windowScrollContainerState"),ra=Qm("scrollContainerState");
K=da||K?ja:ra;var Ka=Jh("itemContent"),Sa=Jh("context"),bb=Jh("groupContent");ja=Jh("trackItemSizes");ra=Jh("itemSize");var gb=Jh("log"),jb=Qm("gap");l=oi(l,ra,ja,a?fi:K,gb,jb,da).callbackRef;da=Zg.useState(0);var Jb=da[0],Ob=da[1];si("deviation",function(Fc){Jb!==Fc&&Ob(Fc)});da=Jh("EmptyPlaceholder");var Lb=Jh("ScrollSeekPlaceholder")||AC;K=Jh("ListComponent");var gc=Jh("ItemComponent"),rc=Jh("GroupComponent"),Wb=Jh("computeItemKey"),kc=Jh("isSeeking"),hc=0<Jh("groupIndices").length;ja=Jh("paddingTopAddition");
ja=a?{}:{boxSizing:"border-box",paddingTop:d.offsetTop+ja,paddingBottom:d.offsetBottom,marginTop:Jb};return!a&&0===d.totalCount&&da?(0,qh.createElement)(da,gk(da,Sa)):(0,qh.createElement)(K,bh({},gk(K,Sa),{ref:l,style:ja,"data-test-id":a?"virtuoso-top-item-list":"virtuoso-item-list"}),(a?d.topItems:d.items).map(function(Fc){var Lc=Fc.originalIndex,ud=Wb(Lc+d.firstItemIndex,Fc.data,Sa);return kc?(0,qh.createElement)(Lb,bh({},gk(Lb,Sa),{key:ud,index:Fc.index,height:Fc.size,type:Fc.type||"item"},"group"===
Fc.type?{}:{groupIndex:Fc.groupIndex})):"group"===Fc.type?(0,qh.createElement)(rc,bh({},gk(rc,Sa),{key:ud,"data-index":Lc,"data-known-size":Fc.size,"data-item-index":Fc.index,style:um}),bb(Fc.index)):(0,qh.createElement)(gc,bh({},gk(gc,Sa),{key:ud,"data-index":Lc,"data-known-size":Fc.size,"data-item-index":Fc.index,"data-item-group-index":Fc.groupIndex,style:tH}),hc?Ka(Fc.index,Fc.groupIndex,Fc.data,Sa):Ka(Fc.index,Fc.data,Sa))}))}),uH={height:"100%",outline:"none",overflowY:"auto",position:"relative",
WebkitOverflowScrolling:"touch"},Is={width:"100%",height:"100%",position:"absolute",top:0},BC={width:"100%",position:wC(),top:0},Lv=Zg.memo(function(){var a=Jh("HeaderComponent"),d=Qm("headerHeight"),l=Jh("headerFooterTag"),K=hj(function(ja){return d(ii(ja,"height"))}),da=Jh("context");return a?(0,qh.createElement)(l,{ref:K},(0,qh.createElement)(a,gk(a,da))):null}),Mv=Zg.memo(function(){var a=Jh("FooterComponent"),d=Qm("footerHeight"),l=Jh("headerFooterTag"),K=hj(function(ja){return d(ii(ja,"height"))}),
da=Jh("context");return a?(0,qh.createElement)(l,{ref:K},(0,qh.createElement)(a,gk(a,da))):null}),vH=function(a){a=a.children;var d=(0,qh.useContext)(cu),l=Qm("viewportHeight"),K=Qm("fixedItemHeight"),da=hj(bo(l,function(ja){return ii(ja,"height")}));return Zg.useEffect(function(){d&&(l(d.viewportHeight),K(d.itemHeight))},[d,l,K]),Zg.createElement("div",{style:Is,ref:da,"data-viewport-type":"element"},a)},CC=function(a){a=a.children;var d=(0,qh.useContext)(cu),l=Qm("windowViewportRect"),K=Qm("fixedItemHeight"),
da=Jh("customScrollParent");da=ph(l,da);return Zg.useEffect(function(){d&&(K(d.itemHeight),l({offsetTop:0,visibleHeight:d.viewportHeight,visibleWidth:100}))},[d,l,K]),Zg.createElement("div",{ref:da,style:Is,"data-viewport-type":"window"},a)},DC=function(a){a=a.children;var d=Jh("TopItemListComponent"),l=Jh("headerHeight");l=bh({},BC,{marginTop:l+"px"});var K=Jh("context");return(0,qh.createElement)(d||"div",{style:l,context:K},a)},du=tj(Kv,{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"}},Zg.memo(function(a){var d=Jh("useWindowScroll"),l=0<Jh("topItemsIndexes").length,K=Jh("customScrollParent"),da=K||d?CC:vH;return Zg.createElement(K||d?eu:qq,bh({},a),Zg.createElement(da,null,Zg.createElement(Lv,null),Zg.createElement(Hs,null),Zg.createElement(Mv,
null)),l&&Zg.createElement(DC,null,Zg.createElement(Hs,{showTopList:!0})))})),uy=du.Component,Qm=du.usePublisher,Jh=du.useEmitterValue,si=du.useEmitter,qq=Xr({usePublisher:Qm,useEmitterValue:Jh,useEmitter:si}),eu=Zq({usePublisher:Qm,useEmitterValue:Jh,useEmitter:si}),fu={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Rm={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},vy=Math.round,Nv=Math.ceil,gu=Math.floor,wy=Math.min,ki=Math.max,
Js=Vh(function(a){var d=a[0],l=d.overscan,K=d.visibleRange,da=d.listBoundary,ja=a[1];d=ja.scrollTop;var ra=ja.viewportHeight,Ka=ja.scrollBy,Sa=ja.scrollTo,bb=ja.smoothScrollTargetReached,gb=ja.scrollContainerState,jb=ja.footerHeight;ja=ja.headerHeight;var Jb=a[2],Ob=a[3],Lb=a[4],gc=Lb.propsReady,rc=Lb.didMount,Wb=a[5];Lb=Wb.windowViewportRect;var kc=Wb.windowScrollTo,hc=Wb.useWindowScroll,Fc=Wb.customScrollParent;Wb=Wb.windowScrollContainerState;a=a[6];var Lc=Rf(0),ud=Rf(0),Jd=Rf(fu),Ee=Rf({height:0,
width:0}),Sd=Rf({height:0,width:0}),De=Cg(),gf=Cg(),Te=Rf(0),df=Rf(void 0),Gd=Rf({row:0,column:0});Kg(xf(sj(rc,ud,df),lg(function(od){return 0!==od[1]}),qg(function(od){return{items:Yr(0,od[1]-1,od[2]),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),Jd);Kg(xf(sj(kh(Lc),K,kh(Gd,Tp),kh(Sd,function(od,Dd){return od&&od.width===Dd.width&&od.height===Dd.height}),df),vh(Ee),qg(function(od){var Dd=od[0],jd=Dd[0],Cd=Dd[1],Me=Cd[0],af=Cd[1],Nf=Dd[2],bg=Dd[3],ef=Dd[4],Eg=od[1];od=Nf.row;
var yf=Nf.column;Dd=bg.height;Cd=bg.width;var Fg=Eg.width;if(0===jd||0===Fg)return fu;if(0===Cd)return bh({},Rm,{items:Yr(0,0,ef)});yf=ki(1,gu((Fg+yf)/(Cd+yf)));Me=yf*gu((Me+od)/(Dd+od));af=yf*Nv((af+od)/(Dd+od))-1;af=wy(jd-1,ki(af,yf-1));Me=Yr(wy(af,ki(0,Me)),af,ef);bg=Fu(Eg,Nf,bg,Me);Nf=bg.top;bg=bg.bottom;jd=Nv(jd/yf);return{items:Me,offsetTop:Nf,offsetBottom:jd*Dd+(jd-1)*od-bg,top:Nf,bottom:bg,itemHeight:Dd,itemWidth:Cd}})),Jd);Kg(xf(df,lg(function(od){return void 0!==od}),qg(function(od){return od.length})),
Lc);Kg(xf(Ee,qg(function(od){return od.height})),ra);Kg(xf(sj(Ee,Sd,Jd,Gd),qg(function(od){od=Fu(od[0],od[3],od[1],od[2].items);return[od.top,od.bottom]}),Sh(uj)),da);K=nk(xf(kh(Jd),lg(function(od){return 0<od.items.length}),vh(Lc),lg(function(od){var Dd=od[0].items;return Dd[Dd.length-1].index===od[1]-1}),qg(function(od){return od[1]-1}),Sh()));da=nk(xf(kh(Jd),lg(function(od){od=od.items;return 0<od.length&&0===od[0].index}),en(0),Sh()));ra=nk(xf(kh(Jd),lg(function(od){return 0<od.items.length}),
qg(function(od){od=od.items;return{startIndex:od[0].index,endIndex:od[od.length-1].index}}),Sh(Dk)));Kg(ra,Ob.scrollSeekRangeChanged);Kg(xf(De,vh(Ee,Sd,Lc,Gd),qg(function(od){var Dd=od[1],jd=od[2],Cd=od[3],Me=od[4],af=Uh(od[0]);od=af.align;var Nf=af.behavior,bg=af.offset;af=af.index;"LAST"===af&&(af=Cd-1);Cd=dt(Dd,Me,jd,ki(0,af,wy(Cd-1,af)));return"end"===od?Cd=vy(Cd-Dd.height+jd.height):"center"===od&&(Cd=vy(Cd-Dd.height/2+jd.height/2)),bg&&(Cd+=bg),{top:Cd,behavior:Nf}})),Sa);rc=Uj(xf(Jd,qg(function(od){return od.offsetBottom+
od.bottom})),0);return Kg(xf(Lb,qg(function(od){return{width:od.visibleWidth,height:od.visibleHeight}})),Ee),bh({data:df,totalCount:Lc,viewportDimensions:Ee,itemDimensions:Sd,scrollTop:d,scrollHeight:gf,overscan:l,scrollBy:Ka,scrollTo:Sa,scrollToIndex:De,smoothScrollTargetReached:bb,windowViewportRect:Lb,windowScrollTo:kc,useWindowScroll:hc,customScrollParent:Fc,windowScrollContainerState:Wb,deviation:Te,scrollContainerState:gb,footerHeight:jb,headerHeight:ja,initialItemCount:ud,gap:Gd},Ob,{gridState:Jd,
totalListHeight:rc},Jb,{startReached:da,endReached:K,rangeChanged:ra,propsReady:gc},a)},Si(oy,tm,bu,Wo,sr,Jv,up)),hu=["placeholder"],wH=Vh(function(){var a=Rf(function(bb){return"Item "+bb}),d=Rf({}),l=Rf(null),K=Rf("virtuoso-grid-item"),da=Rf("virtuoso-grid-list"),ja=Rf(ct),ra=Rf("div"),Ka=Rf(fi),Sa=function(bb,gb){return void 0===gb&&(gb=null),Uj(xf(d,qg(function(jb){return jb[bb]}),Sh()),gb)};return{context:l,itemContent:a,components:d,computeItemKey:ja,itemClassName:K,listClassName:da,headerFooterTag:ra,
scrollerRef:Ka,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(da,ja,ra){Kg(xf(da,vh(K.components),qg(function(Ka){var Sa,bb=Ka[0];Ka=Ka[1];return console.warn("react-virtuoso: "+ra+" property is deprecated. Pass components."+ja+" instead."),bh({},Ka,((Sa={})[ja]=bb,Sa))})),K.components)}var l=a[0],K=
a[1];a={item:om(K.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:Cg(),ScrollContainer:Cg(),ListContainer:Cg(),emptyComponent:Cg(),scrollSeek:Cg()};return fh(a.scrollSeek,function(da){var ja=da.placeholder;da=dm(da,hu);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead.");ja=bh({},(0,K.components)(4),{ScrollSeekPlaceholder:ja});(0,K.components)(0,ja);(0,l.scrollSeekConfiguration)(0,
da)}),d(a.ItemContainer,"Item","ItemContainer"),d(a.ListContainer,"List","ListContainer"),d(a.ScrollContainer,"Scroller","ScrollContainer"),bh({},l,K,a)},Si(Js,wH)),ur=Zg.memo(function(){var a=xj("gridState"),d=xj("listClassName"),l=xj("itemClassName"),K=xj("itemContent"),da=xj("computeItemKey"),ja=xj("isSeeking"),ra=Pl("scrollHeight"),Ka=xj("ItemComponent"),Sa=xj("ListComponent"),bb=xj("ScrollSeekPlaceholder"),gb=xj("context"),jb=Pl("itemDimensions"),Jb=Pl("gap"),Ob=xj("log"),Lb=hj(function(gc){ra(gc.parentElement.parentElement.scrollHeight);
var rc=gc.firstChild;rc&&jb(rc.getBoundingClientRect());Jb({row:Gu("row-gap",getComputedStyle(gc).rowGap,Ob),column:Gu("column-gap",getComputedStyle(gc).columnGap,Ob)})});return(0,qh.createElement)(Sa,bh({ref:Lb,className:d},gk(Sa,gb),{style:{paddingTop:a.offsetTop,paddingBottom:a.offsetBottom}}),a.items.map(function(gc){var rc=da(gc.index,gc.data,gb);return ja?(0,qh.createElement)(bb,bh({key:rc},gk(bb,gb),{index:gc.index,height:a.itemHeight,width:a.itemWidth})):(0,qh.createElement)(Ka,bh({},gk(Ka,
gb),{className:l,"data-index":gc.index,key:rc}),K(gc.index,gc.data,gb))}))}),EC=Zg.memo(function(){var a=xj("HeaderComponent"),d=Pl("headerHeight"),l=xj("headerFooterTag"),K=hj(function(ja){return d(ii(ja,"height"))}),da=xj("context");return a?(0,qh.createElement)(l,{ref:K},(0,qh.createElement)(a,gk(a,da))):null}),FC=Zg.memo(function(){var a=xj("FooterComponent"),d=Pl("footerHeight"),l=xj("headerFooterTag"),K=hj(function(ja){return d(ii(ja,"height"))}),da=xj("context");return a?(0,qh.createElement)(l,
{ref:K},(0,qh.createElement)(a,gk(a,da))):null}),Sg=function(a){a=a.children;var d=(0,qh.useContext)(po),l=Pl("itemDimensions"),K=Pl("viewportDimensions"),da=hj(function(ja){K(ja.getBoundingClientRect())});return Zg.useEffect(function(){d&&(K({height:d.viewportHeight,width:d.viewportWidth}),l({height:d.itemHeight,width:d.itemWidth}))},[d,K,l]),Zg.createElement("div",{style:Is,ref:da},a)},Ov=function(a){a=a.children;var d=(0,qh.useContext)(po),l=Pl("windowViewportRect"),K=Pl("itemDimensions"),da=xj("customScrollParent");
da=ph(l,da);return Zg.useEffect(function(){d&&(K({height:d.itemHeight,width:d.itemWidth}),l({offsetTop:0,visibleHeight:d.viewportHeight,visibleWidth:d.viewportWidth}))},[d,l,K]),Zg.createElement("div",{ref:da,style:Is},a)},Sm=tj(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"}},Zg.memo(function(a){a=bh({},a);var d=xj("useWindowScroll"),l=xj("customScrollParent"),K=l||d?Ov:Sg;return Zg.createElement(l||d?Ks:GC,bh({},a),Zg.createElement(K,null,Zg.createElement(EC,null),Zg.createElement(ur,null),Zg.createElement(FC,null)))})),Pl=Sm.usePublisher,xj=Sm.useEmitterValue,Pv=Sm.useEmitter,GC=Xr({usePublisher:Pl,useEmitterValue:xj,useEmitter:Pv}),Ks=Zq({usePublisher:Pl,useEmitterValue:xj,useEmitter:Pv}),Qv=Vh(function(){var a=Rf(function(Sa){return Zg.createElement("td",
null,"Item $",Sa)}),d=Rf(null),l=Rf(null),K=Rf(null),da=Rf({}),ja=Rf(ct),ra=Rf(fi),Ka=function(Sa,bb){return void 0===bb&&(bb=null),Uj(xf(da,qg(function(gb){return gb[Sa]}),Sh()),bb)};return{context:d,itemContent:a,fixedHeaderContent:l,fixedFooterContent:K,components:da,computeItemKey:ja,scrollerRef:ra,TableComponent:Ka("Table","table"),TableHeadComponent:Ka("TableHead","thead"),TableFooterComponent:Ka("TableFoot","tfoot"),TableBodyComponent:Ka("TableBody","tbody"),TableRowComponent:Ka("TableRow",
"tr"),ScrollerComponent:Ka("Scroller","div"),EmptyPlaceholder:Ka("EmptyPlaceholder"),ScrollSeekPlaceholder:Ka("ScrollSeekPlaceholder"),FillerRow:Ka("FillerRow")}}),Ls=Vh(function(a){return bh({},a[0],a[1])},Si(Gs,Qv)),HC=function(a){return Zg.createElement("tr",null,Zg.createElement("td",{style:{height:a.height}}))},IC=function(a){return Zg.createElement("tr",null,Zg.createElement("td",{style:{height:a.height,padding:0,border:0}}))},vm=Zg.memo(function(){var a=Yi("listState"),d=Rn("sizeRanges"),l=
Yi("useWindowScroll"),K=Yi("customScrollParent"),da=Rn("windowScrollContainerState"),ja=Rn("scrollContainerState");l=K||l?da:ja;var ra=Yi("itemContent");da=Yi("trackItemSizes");K=oi(d,Yi("itemSize"),da,l,Yi("log"),void 0,K);d=K.callbackRef;var Ka=K.ref;K=Zg.useState(0);var Sa=K[0],bb=K[1];Sv("deviation",function(Wb){Sa!==Wb&&(Ka.current.style.marginTop=Wb+"px",bb(Wb))});da=Yi("EmptyPlaceholder");var gb=Yi("ScrollSeekPlaceholder")||HC;l=Yi("FillerRow")||IC;K=Yi("TableBodyComponent");var jb=Yi("TableRowComponent"),
Jb=Yi("computeItemKey"),Ob=Yi("isSeeking");ja=Yi("paddingTopAddition");var Lb=Yi("firstItemIndex"),gc=Yi("statefulTotalCount"),rc=Yi("context");if(0===gc&&da)return(0,qh.createElement)(da,gk(da,rc));da=a.offsetTop+ja+Sa;ja=a.offsetBottom;da=0<da?Zg.createElement(l,{height:da,key:"padding-top"}):null;l=0<ja?Zg.createElement(l,{height:ja,key:"padding-bottom"}):null;a=a.items.map(function(Wb){var kc=Wb.originalIndex,hc=Jb(kc+Lb,Wb.data,rc);return Ob?(0,qh.createElement)(gb,bh({},gk(gb,rc),{key:hc,index:Wb.index,
height:Wb.size,type:Wb.type||"item"})):(0,qh.createElement)(jb,bh({},gk(jb,rc),{key:hc,"data-index":kc,"data-known-size":Wb.size,"data-item-index":Wb.index,style:{overflowAnchor:"none"}}),ra(Wb.index,Wb.data,rc))});return(0,qh.createElement)(K,bh({ref:d,"data-test-id":"virtuoso-item-list"},gk(K,rc)),[da].concat(a,[l]))}),Rv=function(a){a=a.children;var d=(0,qh.useContext)(cu),l=Rn("viewportHeight"),K=Rn("fixedItemHeight"),da=hj(bo(l,function(ja){return ii(ja,"height")}));return Zg.useEffect(function(){d&&
(l(d.viewportHeight),K(d.itemHeight))},[d,l,K]),Zg.createElement("div",{style:Is,ref:da,"data-viewport-type":"element"},a)},xy=function(a){a=a.children;var d=(0,qh.useContext)(cu),l=Rn("windowViewportRect"),K=Rn("fixedItemHeight"),da=Yi("customScrollParent");da=ph(l,da);return Zg.useEffect(function(){d&&(K(d.itemHeight),l({offsetTop:0,visibleHeight:d.viewportHeight,visibleWidth:100}))},[d,l,K]),Zg.createElement("div",{ref:da,style:Is,"data-viewport-type":"window"},a)},iu=tj(Ls,{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"}},Zg.memo(function(a){var d=Yi("useWindowScroll"),l=Yi("customScrollParent"),K=Rn("fixedHeaderHeight"),da=Rn("fixedFooterHeight"),ja=Yi("fixedHeaderContent"),ra=Yi("fixedFooterContent"),Ka=Yi("context");
K=hj(bo(K,function(jb){return ii(jb,"height")}));var Sa=hj(bo(da,function(jb){return ii(jb,"height")}));da=l||d?JC:xH;d=l||d?xy:Rv;l=Yi("TableComponent");var bb=Yi("TableHeadComponent"),gb=Yi("TableFooterComponent");ja=ja?Zg.createElement(bb,bh({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:K},gk(bb,Ka)),ja()):null;ra=ra?Zg.createElement(gb,bh({key:"TableFoot",style:{zIndex:1,position:"sticky",bottom:0},ref:Sa},gk(gb,Ka)),ra()):null;return Zg.createElement(da,bh({},a),Zg.createElement(d,
null,Zg.createElement(l,bh({style:{borderSpacing:0}},gk(l,Ka)),[ja,Zg.createElement(vm,{key:"TableBody"}),ra])))})),Rn=iu.usePublisher,Yi=iu.useEmitterValue,Sv=iu.useEmitter,xH=Xr({usePublisher:Rn,useEmitterValue:Yi,useEmitter:Sv}),JC=Zq({usePublisher:Rn,useEmitterValue:Yi,useEmitter:Sv}),Ms=Kf(aa(0)),Ql=function(a){function d(l){l=a.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+l+" for more information.")||this;if(void 0===
l)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return l}Zr(d,a);return d}(gt(Error)),Tv={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"},KC=/^#[a-fA-F0-9]{6}$/,LC=/^#[a-fA-F0-9]{8}$/,yy=/^#[a-fA-F0-9]{3}$/,tn=/^#[a-fA-F0-9]{4}$/,vr=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,
jl=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,Uv=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,ju=/^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,Tm=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},Ui=it(jt,jt.length,[]),Ns=
aa(616),yl=Kf(aa(0)),Um=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 l=a.ownerDocument,K=l.activeElement;K!==a&&a.focus();l.execCommand("insertText",!1,d)||Um.insertTextFirefox(a,d);K===l.body?a.blur():K instanceof HTMLElement&&K!==a&&K.focus()}static set(a,d){a.select();Um.insert(a,d)}static getSelection(a){const {selectionStart:d,selectionEnd:l}=
a;return a.value.slice(d?d:void 0,l?l:void 0)}static wrapSelection(a,d,l){const {selectionStart:K,selectionEnd:da}=a,ja=Um.getSelection(a);Um.insert(a,d+ja+(null!=l?l:d));a.selectionStart=(K||0)+d.length;a.selectionEnd=(da||0)+d.length}static replace(a,d,l){let K=0;a.value.replace(d,(...da)=>{const ja=K+da[da.length-2],ra=da[0].length;a.selectionStart=ja;a.selectionEnd=ja+ra;da="string"===typeof l?l:l(...da);Um.insert(a,da);a.selectionStart=ja;K+=da.length-ra;return da})}static findLineEnd(a,d){const l=
a.lastIndexOf("\n",d-1)+1;return"\t"!==a.charAt(l)?d:l+1}static indent(a){var d;const {selectionStart:l,selectionEnd:K,value:da}=a;var ja=da.slice(l,K);if((ja=null==(d=/\n/g.exec(ja))?void 0:d.length)&&0<ja){d=da.lastIndexOf("\n",l-1)+1;var ra=a.value.slice(d,K-1);ja=ra.replace(/^|\n/g,"$\x26  ");ra=ja.length-ra.length;a.setSelectionRange(d,K-1);Um.insert(a,ja);a.setSelectionRange(l+1,K+ra)}else Um.insert(a,"  ")}static unindent(a){const {selectionStart:d,selectionEnd:l,value:K}=a;var da=K.lastIndexOf("\n",
d-1)+1;const ja=Um.findLineEnd(K,l);var ra=a.value.slice(da,ja);const Ka=ra.replace(/(^|\n)(\t| {1,2})/g,"$1");ra=ra.length-Ka.length;a.setSelectionRange(da,ja);Um.insert(a,Ka);da=(da=/\t| {1,2}/.exec(K.slice(da,d)))?da[0].length:0;a.setSelectionRange(d-da,Math.max(d-da,l-ra))}},Vv=aa(616),Os=a=>a.stopPropagation(),Ps=yl.memo(function({font:a,text:d,color:l,fontStyle:K,fontSize:da,fontWeight:ja,offsetX:ra=0,offsetY:Ka=0,scale:Sa=1,isEditing:bb=!1,pointerEvents:gb=!1,onBlur:jb,onChange:Jb}){const Ob=
yl.useRef(null),Lb=yl.useRef(!1),gc=yl.useCallback(Lc=>{Jb(ms.normalizeText(Lc.currentTarget.value))},[Jb]),rc=yl.useCallback(Lc=>{if("Escape"!==Lc.key)if("Tab"===Lc.key&&0===d.length)Lc.preventDefault();else{if("Meta"!==Lc.key&&!Lc.metaKey)Lc.stopPropagation();else if("z"===Lc.key&&Lc.metaKey){document.execCommand(Lc.shiftKey?"redo":"undo",!1);Lc.stopPropagation();Lc.preventDefault();return}"Tab"===Lc.key&&(Lc.preventDefault(),Lc.shiftKey?Um.unindent(Lc.currentTarget):Um.indent(Lc.currentTarget),
null==Jb?void 0:Jb(ms.normalizeText(Lc.currentTarget.value)))}},[Jb]),Wb=yl.useCallback(Lc=>{bb&&(Lc.currentTarget.setSelectionRange(0,0),null==jb?void 0:jb())},[jb]),kc=yl.useCallback(Lc=>{bb&&Lb.current&&document.activeElement===Lc.currentTarget&&Lc.currentTarget.select()},[bb]),hc=yl.useCallback(Lc=>{bb&&Lc.stopPropagation()},[bb]);yl.useEffect(()=>{bb&&requestAnimationFrame(()=>{Lb.current=!0;const Lc=Ob.current;Lc&&(Lc.focus(),Lc.select())})},[bb,jb]);const Fc=yl.useRef(null);yl.useLayoutEffect(()=>
{const Lc=Fc.current;if(Lc){var ud=Mi(d||"Enter text",{fontFamily:"var(--ls-font-family)",fontSize:da,lineHeight:1,fontWeight:ja},4);Lc.style.transform=`scale(${Sa}, ${Sa}) translate(${ra}px, ${Ka}px)`;Lc.style.width=ud[0]+1+"px";Lc.style.height=ud[1]+1+"px"}},[d,ja,da,Ka,ra,Sa]);return(0,Vv.jsx)("div",{className:"tl-text-label-wrapper",children:(0,Vv.jsxs)("div",{className:"tl-text-label-inner-wrapper",ref:Fc,style:{font:a,fontStyle:K,fontSize:da,fontWeight:ja,color:l,pointerEvents:gb?"all":"none",
userSelect:bb?"text":"none"},children:[bb?(0,Vv.jsx)("textarea",{ref:Ob,style:{font:a,color:l,fontStyle:K,fontSize:da,fontWeight:ja},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:l,onFocus:kc,onChange:gc,onKeyDown:rc,onBlur:Wb,onPointerDown:hc,onContextMenu:Os,onCopy:Os,onPaste:Os,onCut:Os}):
d,"​"]})})}),Sn=aa(616),Vm={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},wm=class extends fm{constructor(){super(...arguments);hb(this,"canEdit",!0);hb(this,"ReactComponent",ee(({events:a,isErasing:d,isBinding:l,isSelected:K,isEditing:da,onEditingEnd:ja})=>{const {props:{size:[ra,Ka],stroke:Sa,fill:bb,noFill:gb,strokeWidth:jb,strokeType:Jb,borderRadius:Ob,opacity:Lb,label:gc,italic:rc,fontWeight:Wb,fontSize:kc}}=this;var hc=gc||da?Mi(gc,{fontFamily:"var(--ls-font-family)",fontSize:kc,lineHeight:1,fontWeight:Wb},
4):[0,0];const Fc=be.mul(this.props.size,.5);hc=Math.max(.5,Math.min(1,ra/hc[0],Ka/hc[1]));const Lc=this.getBounds(),ud=Ms.useMemo(()=>be.sub(Fc,be.toFixed([Lc.width/2,Lc.height/2])),[Lc,hc,Fc]),Jd=Ms.useCallback(Ee=>{var Sd;null==(Sd=this.update)?void 0:Sd.call(this,{label:Ee})},[gc]);return(0,Sn.jsxs)("div",ff(Zd({},a),{style:{width:"100%",height:"100%",overflow:"hidden"},className:"tl-box-container",children:[(0,Sn.jsx)(Ps,{font:"20px / 1 var(--ls-font-family)",text:gc,color:sh(Sa,"text"),offsetX:ud[0],
offsetY:ud[1],fontSize:kc,scale:hc,isEditing:da,onChange:Jd,onBlur:ja,fontStyle:rc?"italic":"normal",fontWeight:Wb,pointerEvents:!!gc}),(0,Sn.jsxs)(Nn,{opacity:d?.2:Lb,children:[l&&(0,Sn.jsx)(kt,{mode:"svg",strokeWidth:jb,size:[ra,Ka]}),(0,Sn.jsx)("rect",{className:K||!gb?"tl-hitarea-fill":"tl-hitarea-stroke",x:jb/2,y:jb/2,rx:Ob,ry:Ob,width:Math.max(.01,ra-jb),height:Math.max(.01,Ka-jb),pointerEvents:"all"}),(0,Sn.jsx)("rect",{x:jb/2,y:jb/2,rx:Ob,ry:Ob,width:Math.max(.01,ra-jb),height:Math.max(.01,
Ka-jb),strokeWidth:jb,stroke:sh(Sa,"stroke"),strokeDasharray:"dashed"===Jb?"8 2":void 0,fill:gb?"none":sh(bb,"background")})]})]}))}));hb(this,"setScaleLevel",a=>Oh(this,null,function*(){this.update({scaleLevel:a,fontSize:Vm[null!=a?a:"md"],strokeWidth:Vm[null!=a?a:"md"]/10});this.onResetBounds()}));hb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,d],borderRadius:l,isLocked:K}}=this;return(0,Sn.jsx)("g",{children:(0,Sn.jsx)("rect",{width:a,height:d,rx:l,ry:l,fill:"transparent",strokeDasharray:K?
"8 2":void 0})})}));hb(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 fn(this,a)})}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}};hb(wm,"id","box");hb(wm,"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:""});fe([Dg],wm.prototype,"scaleLevel",1);fe([jg],wm.prototype,"setScaleLevel",2);var Wv=Kf(aa(0)),Tn=aa(616),ku={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},wr=class extends Tw{constructor(){super(...arguments);hb(this,"canEdit",!0);hb(this,"ReactComponent",ee(({isSelected:a,isErasing:d,events:l,isEditing:K,onEditingEnd:da})=>{const {size:[ja,ra],stroke:Ka,fill:Sa,noFill:bb,strokeWidth:gb,strokeType:jb,opacity:Jb,label:Ob,italic:Lb,fontWeight:gc,fontSize:rc}=this.props;var Wb=Ob||K?Mi(Ob,
{fontFamily:"var(--ls-font-family)",fontSize:rc,lineHeight:1,fontWeight:gc},4):[0,0];const kc=be.mul(this.props.size,.5);Wb=Math.max(.5,Math.min(1,ja/Wb[0],ra/Wb[1]));const hc=this.getBounds(),Fc=Wv.useMemo(()=>be.sub(kc,be.toFixed([hc.width/2,hc.height/2])),[hc,Wb,kc]),Lc=Wv.useCallback(ud=>{var Jd;null==(Jd=this.update)?void 0:Jd.call(this,{label:ud})},[Ob]);return(0,Tn.jsxs)("div",ff(Zd({},l),{style:{width:"100%",height:"100%",overflow:"hidden"},className:"tl-ellipse-container",children:[(0,Tn.jsx)(Ps,
{font:"18px / 1 var(--ls-font-family)",text:Ob,color:sh(Ka,"text"),offsetX:Fc[0],offsetY:Fc[1],scale:Wb,isEditing:K,onChange:Lc,onBlur:da,fontStyle:Lb?"italic":"normal",fontSize:rc,fontWeight:gc,pointerEvents:!!Ob}),(0,Tn.jsxs)(Nn,ff(Zd({},l),{opacity:d?.2:Jb,children:[(0,Tn.jsx)("ellipse",{className:a||!bb?"tl-hitarea-fill":"tl-hitarea-stroke",cx:ja/2,cy:ra/2,rx:Math.max(.01,(ja-gb)/2),ry:Math.max(.01,(ra-gb)/2)}),(0,Tn.jsx)("ellipse",{cx:ja/2,cy:ra/2,rx:Math.max(.01,(ja-gb)/2),ry:Math.max(.01,(ra-
gb)/2),strokeWidth:gb,stroke:sh(Ka,"stroke"),strokeDasharray:"dashed"===jb?"8 2":void 0,fill:bb?"none":sh(Sa,"background")})]}))]}))}));hb(this,"setScaleLevel",a=>Oh(this,null,function*(){this.update({scaleLevel:a,fontSize:ku[null!=a?a:"md"],strokeWidth:ku[null!=a?a:"md"]/10});this.onResetBounds()}));hb(this,"ReactIndicator",ee(()=>{const {size:[a,d],isLocked:l}=this.props;return(0,Tn.jsx)("g",{children:(0,Tn.jsx)("ellipse",{cx:a/2,cy:d/2,rx:a/2,ry:d/2,strokeWidth:2,fill:"transparent",strokeDasharray:l?
"8 2":"undefined"})})}));hb(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 fn(this,a)})}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx(a){const {size:[d,l],stroke:K,fill:da,noFill:ja,strokeWidth:ra,strokeType:Ka,opacity:Sa}=this.props;return(0,Tn.jsxs)("g",{opacity:Sa,children:[(0,Tn.jsx)("ellipse",{className:ja?"tl-hitarea-stroke":"tl-hitarea-fill",cx:d/2,cy:l/2,rx:Math.max(.01,(d-ra)/2),ry:Math.max(.01,
(l-ra)/2)}),(0,Tn.jsx)("ellipse",{cx:d/2,cy:l/2,rx:Math.max(.01,(d-ra)/2),ry:Math.max(.01,(l-ra)/2),strokeWidth:ra,stroke:sh(K,"stroke"),strokeDasharray:"dashed"===Ka?"8 2":void 0,fill:ja?"none":sh(da,"background")})]})}};hb(wr,"id","ellipse");hb(wr,"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:""});fe([Dg],wr.prototype,"scaleLevel",1);fe([jg],wr.prototype,
"setScaleLevel",2);var rq=aa(616),Xv=class extends Zu{constructor(){super(...arguments);hb(this,"ReactComponent",ee(({events:a})=>{const d=this.getBounds(),l=mg(),K=l.selectedShapesArray.some(ja=>l.shapesInGroups([this]).includes(ja)),da=this.ReactIndicator;return(0,rq.jsxs)(Nn,ff(Zd({},a),{className:"tl-group-container",children:[(0,rq.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"}),K&&(0,rq.jsx)("g",{stroke:"var(--color-selectedFill)",
children:(0,rq.jsx)(da,{})})]}))}));hb(this,"ReactIndicator",ee(()=>{const a=this.getBounds();return(0,rq.jsx)("rect",{strokeDasharray:"8 2",x:-8,y:-8,rx:4,ry:4,width:a.width+16,height:a.height+16,fill:"transparent"})}))}};hb(Xv,"id","group");hb(Xv,"defaultProps",{id:"group",type:"group",parentId:"page",point:[0,0],size:[0,0],children:[]});var lu=aa(616),zy={xs:1,sm:1.6,md:2,lg:3.2,xl:4.8,xxl:6},sq=class extends fs{constructor(a={}){super(a);hb(this,"ReactComponent",ee(({events:d,isErasing:l})=>{const {pointsPath:K,
props:{stroke:da,strokeWidth:ja,opacity:ra}}=this;return(0,lu.jsx)(Nn,ff(Zd({},d),{opacity:l?.2:1,children:(0,lu.jsx)("path",{d:K,strokeWidth:16*ja,stroke:sh(da,"stroke"),fill:"none",pointerEvents:"all",strokeLinejoin:"round",strokeLinecap:"round",opacity:ra})}))}));hb(this,"setScaleLevel",d=>Oh(this,null,function*(){this.update({scaleLevel:d,strokeWidth:zy[null!=d?d:"md"]});this.onResetBounds()}));hb(this,"ReactIndicator",ee(()=>{const {pointsPath:d,props:l}=this;return(0,lu.jsx)("path",{d,fill:"none",
strokeDasharray:l.isLocked?"8 2":"undefined"})}));hb(this,"validateProps",d=>{d=fn(this,d);void 0!==d.strokeWidth&&(d.strokeWidth=Math.max(d.strokeWidth,1));return d});Ue(this)}get pointsPath(){const {points:a}=this.props;return Mw.getCurvedPathForPoints(a)}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx(){const {pointsPath:a,props:{stroke:d,strokeWidth:l,opacity:K}}=this;return(0,lu.jsx)("path",{d:a,strokeWidth:16*l,stroke:sh(d,"stroke"),fill:"none",pointerEvents:"all",
strokeLinejoin:"round",strokeLinecap:"round",opacity:K})}};hb(sq,"id","highlighter");hb(sq,"defaultProps",{id:"highlighter",parentId:"page",type:"highlighter",point:[0,0],points:[],isComplete:!1,stroke:"",fill:"",noFill:!0,strokeType:"line",strokeWidth:2,opacity:.5});fe([Dg],sq.prototype,"pointsPath",1);fe([Dg],sq.prototype,"scaleLevel",1);fe([jg],sq.prototype,"setScaleLevel",2);var xr=Kf(aa(0)),$e=aa(616),Ig={xs:.5,sm:.8,md:1,lg:1.5,xl:2,xxl:3},qo=class extends fm{constructor(){super(...arguments);
hb(this,"canChangeAspectRatio",!0);hb(this,"canFlip",!1);hb(this,"canEdit",!0);hb(this,"htmlAnchorRef",xr.createRef());hb(this,"setScaleLevel",a=>Oh(this,null,function*(){var d;const l=be.mul(this.props.size,Ig[null!=a?a:"md"]/Ig[null!=(d=this.props.scaleLevel)?d:"md"]);this.update({scaleLevel:a});yield zk();this.update({size:l})}));hb(this,"onResetBounds",a=>{var d;if(this.htmlAnchorRef.current){const l=this.htmlAnchorRef.current.getBoundingClientRect(),[K,da]=be.div([l.width,l.height],null!=(d=
null==a?void 0:a.zoom)?d:1);this.update({size:[Math.max(Math.min(K||400,1400),10),Math.max(Math.min(da||400,1400),10)]})}return this});hb(this,"ReactComponent",ee(({events:a,isErasing:d,isEditing:l})=>{const {props:{html:K,scaleLevel:da}}=this,ja=$r(),ra=mg(),Ka=ra.selectedIds.has(this.id),Sa=ja||Ka&&!l||"select"!==ra.selectedTool.id,bb=xr.useCallback(jb=>{Sa||jb.stopPropagation()},[Sa]),gb=Ig[null!=da?da:"md"];xr.useEffect(()=>{0===this.props.size[1]&&(this.onResetBounds({zoom:ra.viewport.camera.zoom}),
ra.persist(!0))},[]);return(0,$e.jsx)(ln,ff(Zd({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:1}},a),{children:(0,$e.jsx)("div",{onWheelCapture:bb,onPointerDown:bb,onPointerUp:bb,className:"tl-html-container",style:{pointerEvents:ja||!l&&!Ka?"none":"all",overflow:l?"auto":"hidden",width:`calc(100% / ${gb})`,height:`calc(100% / ${gb})`,transform:`scale(${gb})`},children:(0,$e.jsx)("div",{ref:this.htmlAnchorRef,className:"tl-html-anchor",dangerouslySetInnerHTML:{__html:K.trim()}})})}))}));
hb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,d],isLocked:l}}=this;return(0,$e.jsx)("rect",{width:a,height:d,fill:"transparent",strokeDasharray:l?"8 2":"undefined"})}));hb(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 fn(this,a)})}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}};hb(qo,"id","html");hb(qo,"defaultProps",{id:"html",type:"html",parentId:"page",point:[0,0],size:[600,0],html:""});fe([Dg],
qo.prototype,"scaleLevel",1);fe([jg],qo.prototype,"setScaleLevel",2);var Ay=Kf(aa(0)),Qs=aa(616),tq=class extends fm{constructor(){super(...arguments);hb(this,"frameRef",Ay.createRef());hb(this,"canEdit",!0);hb(this,"onIFrameSourceChange",a=>{this.update({url:a})});hb(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)});hb(this,"ReactComponent",ee(({events:a,isErasing:d,isEditing:l})=>{Ay.useRef(null);const K=
mg();return(0,Qs.jsx)(ln,ff(Zd({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:1}},a),{children:(0,Qs.jsx)("div",{className:"tl-iframe-container",style:{pointerEvents:l||K.readOnly?"all":"none",userSelect:"none"},children:this.props.url&&(0,Qs.jsx)("div",{style:{overflow:"hidden",position:"relative",height:"100%"},children:(0,Qs.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"})})})}))}));
hb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,d],isLocked:l}}=this;return(0,Qs.jsx)("rect",{width:a,height:d,fill:"transparent",rx:8,ry:8,strokeDasharray:l?"8 2":"undefined"})}))}};hb(tq,"id","iframe");hb(tq,"defaultProps",{id:"iframe",type:"iframe",parentId:"page",point:[0,0],size:[853,480],url:""});fe([jg],tq.prototype,"onIFrameSourceChange",2);fe([jg],tq.prototype,"reload",2);var By=Kf(aa(0)),yr=aa(616),mu=class extends Uw{constructor(){super(...arguments);hb(this,"ReactComponent",ee(({events:a,
isErasing:d,isBinding:l,asset:K})=>{const {props:{opacity:da,objectFit:ja,clipping:ra,size:[Ka,Sa]}}=this,[bb,gb,jb,Jb]=Array.isArray(ra)?ra:[ra,ra,ra,ra],{handlers:Ob}=By.useContext(ji);return(0,yr.jsxs)(ln,ff(Zd({},a),{opacity:d?.2:da,children:[l&&(0,yr.jsx)(kt,{mode:"html",strokeWidth:4,size:[Ka,Sa]}),(0,yr.jsx)("div",{"data-asset-loaded":!!K,className:"tl-image-shape-container",children:K?(0,yr.jsx)("img",{src:Ob?Ob.makeAssetUrl(K.src):K.src,draggable:!1,style:{position:"relative",top:-bb,left:-Jb,
width:Ka+(Jb-gb),height:Sa+(bb-jb),objectFit:ja}}):"Asset is missing"})]}))}));hb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,d],isLocked:l}}=this;return(0,yr.jsx)("rect",{width:a,height:d,fill:"transparent",strokeDasharray:l?"8 2":"undefined"})}))}getShapeSVGJsx({assets:a}){var d,l;const K=this.getBounds(),{assetId:da,clipping:ja}=this.props;if(a=a.find(ra=>ra.id===da)){Array.isArray(ja);const ra=null==(l=null==(d=window.logseq)?void 0:d.api)?void 0:l.make_asset_url;return(0,yr.jsx)("image",
{width:K.width,height:K.height,href:ra?ra(a.src):a.src})}return super.getShapeSVGJsx({})}};hb(mu,"id","image");hb(mu,"defaultProps",{id:"image1",parentId:"page",type:"image",point:[0,0],size:[100,100],opacity:1,assetId:"",clipping:0,objectFit:"fill",isAspectRatioLocked:!0});var li=Kf(aa(0)),MC=Kf(aa(0)),Yv=aa(616),wp=aa(616),NC={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},Rs=MC.memo(function({style:a,start:d,end:l,decorationStart:K,decorationEnd:da,scaleLevel:ja}){const ra=be.dist(d,l);if(2>ra)return null;
const {strokeWidth:Ka}=a,Sa=1+Ka*NC[null!=ja?ja:"md"]/10,bb="M"+be.toFixed(d)+"L"+be.toFixed(l);ja=Math.min(ra/3,Ka*NC[null!=ja?ja:"md"]);K=K?lt(d,l,ja):null;da=da?lt(l,d,ja):null;return(0,wp.jsxs)(wp.Fragment,{children:[(0,wp.jsx)("path",{className:"tl-stroke-hitarea",d:bb}),(0,wp.jsx)("path",{d:bb,strokeWidth:Sa,stroke:a.stroke,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"dashed"===a.strokeType?"8 4":void 0,pointerEvents:"stroke"}),K&&(0,wp.jsx)(Iu,{left:K.left,middle:d,right:K.right,
stroke:a.stroke,strokeWidth:Sa}),da&&(0,wp.jsx)(Iu,{left:da.left,middle:l,right:da.right,stroke:a.stroke,strokeWidth:Sa})]})}),nu=aa(616),xm=aa(616),uq={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},zr=class extends wt{constructor(){super(...arguments);hb(this,"hideSelection",!0);hb(this,"canEdit",!0);hb(this,"ReactComponent",ee(({events:a,isErasing:d,isEditing:l,onEditingEnd:K})=>{const {stroke:da,handles:{start:ja,end:ra},opacity:Ka,label:Sa,italic:bb,fontWeight:gb,fontSize:jb,id:Jb}=this.props,Ob=Sa||
l?Mi(Sa||"Enter text",{fontFamily:"var(--ls-font-family)",fontSize:jb,lineHeight:1,fontWeight:gb},6):[0,0],Lb=be.med(ja.point,ra.point);var gc=be.dist(ja.point,ra.point);gc=Math.max(.5,Math.min(1,Math.max(gc/(Ob[1]+128),gc/(Ob[0]+128))));const rc=this.getBounds(),Wb=li.useMemo(()=>be.sub(Lb,be.toFixed([rc.width/2,rc.height/2])),[rc,gc,Lb]),kc=li.useCallback(hc=>{var Fc;null==(Fc=this.update)?void 0:Fc.call(this,{label:hc})},[Sa]);return(0,xm.jsxs)("div",ff(Zd({},a),{style:{width:"100%",height:"100%",
overflow:"hidden"},className:"tl-line-container",children:[(0,xm.jsx)(Ps,{font:"20px / 1 var(--ls-font-family)",text:Sa,fontSize:jb,color:sh(da,"text"),offsetX:Wb[0],offsetY:Wb[1],scale:gc,isEditing:l,onChange:kc,onBlur:K,fontStyle:bb?"italic":"normal",fontWeight:gb,pointerEvents:!!Sa}),(0,xm.jsxs)(Nn,{opacity:d?.2:Ka,id:Jb+"_svg",children:[(0,xm.jsx)(mt,{id:Jb,bounds:rc,labelSize:Ob,offset:Wb,scale:gc}),(0,xm.jsx)("g",{pointerEvents:"none",mask:Sa||l?`url(#${Jb}_clip)`:"",children:this.getShapeSVGJsx({preview:!1})})]})]}))}));
hb(this,"setScaleLevel",a=>Oh(this,null,function*(){this.update({scaleLevel:a,fontSize:uq[null!=a?a:"md"]});this.onResetBounds()}));hb(this,"ReactIndicator",ee(({isEditing:a})=>{const {id:d,decorations:l,label:K,strokeWidth:da,fontSize:ja,fontWeight:ra,handles:{start:Ka,end:Sa},isLocked:bb}=this.props,gb=this.getBounds(),jb=K||a?Mi(K,{fontFamily:"var(--ls-font-family)",fontSize:ja,lineHeight:1,fontWeight:ra},6):[0,0],Jb=be.med(Ka.point,Sa.point);var Ob=be.dist(Ka.point,Sa.point);Ob=Math.max(.5,Math.min(1,
Math.max(Ob/(jb[1]+128),Ob/(jb[0]+128))));const Lb=li.useMemo(()=>be.sub(Jb,be.toFixed([gb.width/2,gb.height/2])),[gb,Ob,Jb]);return(0,xm.jsxs)("g",{children:[(0,xm.jsx)("path",{mask:K?`url(#${d}_clip)`:"",d:Aw({strokeWidth:da},Ka.point,Sa.point,null==l?void 0:l.start,null==l?void 0:l.end),strokeDasharray:bb?"8 2":"undefined"}),K&&!a&&(0,xm.jsx)("rect",{x:gb.width/2-jb[0]/2*Ob+Lb[0],y:gb.height/2-jb[1]/2*Ob+Lb[1],width:jb[0]*Ob,height:jb[1]*Ob,rx:4*Ob,ry:4*Ob,fill:"transparent"})]})}));hb(this,"validateProps",
a=>fn(this,a))}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx({preview:a}){const {stroke:d,fill:l,strokeWidth:K,strokeType:da,decorations:ja,label:ra,scaleLevel:Ka,handles:{start:Sa,end:bb}}=this.props,gb=be.med(Sa.point,bb.point);return(0,xm.jsxs)(xm.Fragment,{children:[(0,xm.jsx)(Rs,{style:{stroke:sh(d,"text"),fill:l,strokeWidth:K,strokeType:da},scaleLevel:Ka,start:Sa.point,end:bb.point,decorationStart:null==ja?void 0:ja.start,decorationEnd:null==ja?void 0:ja.end}),
a&&(0,xm.jsx)(xm.Fragment,{children:(0,xm.jsx)("text",{style:{transformOrigin:"top left"},fontFamily:"Inter",fontSize:20,transform:`translate(${gb[0]}, ${gb[1]})`,textAnchor:"middle",fill:sh(d,"text"),stroke:sh(d,"text"),children:ra})})]})}};hb(zr,"id","line");hb(zr,"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:""});fe([Dg],zr.prototype,"scaleLevel",1);fe([jg],zr.prototype,"setScaleLevel",2);var ym=Kf(aa(0)),Ki=aa(616),Un={xs:.5,sm:.8,md:1,lg:1.5,xl:2,xxl:3},ro=ee(({type:a,fill:d,opacity:l,children:K})=>{const da="var(--ls-secondary-background-color)"!==d?sh(d,"background"):"var(--ls-tertiary-background-color)";d=d&&"var(--ls-secondary-background-color)"!==d?Gi(d)?`var(--ls-highlight-color-${d})`:d:"var(--ls-secondary-background-color)";return(0,Ki.jsxs)("div",
{className:`tl-logseq-portal-header tl-logseq-portal-header-${"P"===a?"page":"block"}`,children:[(0,Ki.jsx)("div",{className:"absolute inset-0 tl-logseq-portal-header-bg",style:{opacity:l,background:"P"===a?da:`linear-gradient(0deg, ${d}, ${da})`}}),(0,Ki.jsx)("div",{className:"relative",children:K})]})}),Qj=class extends fm{constructor(a={}){var d;super(a);hb(this,"hideRotateHandle",!0);hb(this,"canChangeAspectRatio",!0);hb(this,"canFlip",!0);hb(this,"canEdit",!0);hb(this,"persist",null);hb(this,
"initialHeightCalculated",!0);hb(this,"getInnerHeight",null);hb(this,"setCollapsed",l=>Oh(this,null,function*(){var K;if("B"===this.props.blockType){if(this.update({compact:l}),this.canResize[1]=!l,!l)this.onResetBounds()}else{const da=this.props.size[1];this.canResize[1]=!l;this.update({isAutoResizing:!l,collapsed:l,size:[this.props.size[0],l?this.getHeaderHeight():this.props.collapsedHeight],collapsedHeight:l?da:this.props.collapsedHeight})}null==(K=this.persist)?void 0:K.call(this)}));hb(this,
"setScaleLevel",l=>Oh(this,null,function*(){var K;const da=be.mul(this.props.size,Un[null!=l?l:"md"]/Un[null!=(K=this.props.scaleLevel)?K:"md"]);this.update({scaleLevel:l});yield zk();this.update({size:da})}));hb(this,"onResetBounds",l=>{l=this.getAutoResizeHeight();null!==l&&1<Math.abs(l-this.props.size[1])&&(this.update({size:[this.props.size[0],l]}),this.initialHeightCalculated=!0);return this});hb(this,"onResize",(l,K)=>{var da;const {bounds:ja,rotation:ra,scale:[Ka,Sa]}=K;l=[...this.scale];0>
Ka&&(l[0]*=-1);0>Sa&&(l[1]*=-1);K=ja.height;this.props.isAutoResizing&&(K=null!=(da=this.getAutoResizeHeight())?da:K);return this.update({point:[ja.minX,ja.minY],size:[Math.max(1,ja.width),Math.max(1,K)],scale:l,rotation:ra})});hb(this,"PortalComponent",ee(({})=>{const {props:{pageId:l,fill:K,opacity:da}}=this,{renderers:ja}=ym.useContext(ji),ra=mg(),Ka=ym.useRef(null),[,Sa]=this.useComponentSize(Ka,this.props.compact?".tl-logseq-cp-container \x3e .single-block":".tl-logseq-cp-container \x3e .page");
if(null==ja||!ja.Page)return null;const {Page:bb,Block:gb}=ja,[jb,Jb]=ym.useState(!1);ym.useEffect(()=>{var Ob,Lb;if(this.props.isAutoResizing){const gc=(null!=(Lb=null==(Ob=this.getInnerHeight)?void 0:Ob.call(this))?Lb:Sa)+this.getHeaderHeight();Sa&&1<Math.abs(gc-this.props.size[1])&&(this.update({size:[this.props.size[0],gc]}),jb&&ra.persist(!0))}},[Sa,this.props.isAutoResizing]);ym.useEffect(()=>{this.initialHeightCalculated||setTimeout(()=>{this.onResetBounds();ra.persist(!0)})},[this.initialHeightCalculated]);
ym.useEffect(()=>{setTimeout(function(){Jb(!0)})},[]);return(0,Ki.jsxs)(Ki.Fragment,{children:[(0,Ki.jsx)("div",{className:"absolute inset-0 tl-logseq-cp-container-bg",style:{textRendering:.5>ra.viewport.camera.zoom?"optimizeSpeed":"auto",background:K&&"var(--ls-secondary-background-color)"!==K?Gi(K)?`var(--ls-highlight-color-${K})`:K:"var(--ls-secondary-background-color)",opacity:da}}),(0,Ki.jsx)("div",{ref:Ka,className:"relative tl-logseq-cp-container",style:{overflow:this.props.isAutoResizing?
"visible":"auto"},children:(jb||!this.initialHeightCalculated)&&("B"===this.props.blockType&&this.props.compact?(0,Ki.jsx)(gb,{blockId:l}):(0,Ki.jsx)(bb,{pageName:l}))})]})}));hb(this,"ReactComponent",ee(l=>{var K;const {events:da,isErasing:ja,isEditing:ra,isBinding:Ka}=l,{props:{opacity:Sa,pageId:bb,fill:gb,scaleLevel:jb,strokeWidth:Jb,size:Ob}}=this,Lb=mg(),{renderers:gc,handlers:rc}=ym.useContext(ji);this.persist=()=>Lb.persist();const Wb=$r(),kc=Lb.selectedIds.has(this.id)&&1===Lb.selectedIds.size,
hc=Lb.isIn("logseq-portal.creating")&&!bb,Fc=(Wb||kc&&!ra||"select"!==Lb.selectedTool.id)&&!hc,Lc=ym.useCallback(od=>{Fc||od.stopPropagation()},[Fc]),ud=1===Lb.selectedShapesArray.length&&Lb.selectedShapesArray.some(od=>"logseq-portal"===od.type&&od.props.id!==this.props.id&&bb&&od.props.pageId===bb),Jd=Un[null!=jb?jb:"md"];ym.useEffect(()=>this.props.collapsed&&ra?(this.update({size:[this.props.size[0],this.props.collapsedHeight]}),()=>{this.update({size:[this.props.size[0],this.getHeaderHeight()]})}):
()=>{},[ra,this.props.collapsed]);ym.useEffect(()=>{if(hc){const od=[Lb.viewport.bounds.width,Lb.viewport.bounds.height],Dd=Lb.viewport.getScreenPoint([this.bounds.minX,this.bounds.minY]);(Dd[0]>od[0]-400||Dd[1]>od[1]-240||1.5<Lb.viewport.camera.zoom||.5>Lb.viewport.camera.zoom)&&Lb.viewport.zoomToBounds(ff(Zd({},this.bounds),{minY:this.bounds.maxY+25}))}},[Lb.viewport.bounds.height.toFixed(2)]);const Ee=ym.useCallback(od=>{this.initialHeightCalculated=!1;const Dd=Dj(od)?"B":"P";this.update({pageId:od,
size:[400,320],blockType:Dd,compact:"B"===Dd});Lb.selectTool("select");Lb.history.resume();Lb.history.persist()},[]),Sd=this.PortalComponent;var De=ym.useMemo(()=>{var od;if(bb&&"B"===this.props.blockType)return null==(od=null==rc?void 0:rc.queryBlockByUUID(bb))?void 0:od.content},[null==rc?void 0:rc.queryBlockByUUID,bb]);De="B"===this.props.blockType&&"string"!==typeof De;const gf=(!this.props.collapsed||ra)&&!De;if(null==gc||!gc.Page)return null;const {Breadcrumb:Te,PageName:df}=gc,Gd={width:`calc(100% / ${Jd})`,
height:`calc(100% / ${Jd})`,opacity:ja?.2:1};1!==Jd&&(Gd.transform=`scale(${Jd})`);return(0,Ki.jsxs)(ln,ff(Zd({style:{pointerEvents:"all"}},da),{children:[Ka&&(0,Ki.jsx)(kt,{mode:"html",strokeWidth:Jb,size:Ob}),(0,Ki.jsx)("div",{"data-inner-events":!Fc,onWheelCapture:Lc,onPointerDown:Lc,onPointerUp:Lc,style:{width:"100%",height:"100%",pointerEvents:Wb||!ra&&!kc?"none":"all"},children:hc?(0,Ki.jsx)(Er,{onChange:Ee,onAddBlock:od=>{setTimeout(()=>{var Dd,jd,Cd;Lb.api.editShape(this);null==(Cd=null==
(jd=null==(Dd=window.logseq)?void 0:Dd.api)?void 0:jd.edit_block)?void 0:Cd.call(jd,od)})},placeholder:"Create or search your graph..."}):(0,Ki.jsxs)("div",{className:"tl-logseq-portal-container","data-collapsed":this.collapsed,"data-page-id":bb,"data-portal-selected":ud,"data-editing":ra,style:Gd,children:[!this.props.compact&&!De&&(0,Ki.jsx)(ro,{type:null!=(K=this.props.blockType)?K:"P",fill:gb,opacity:Sa,children:"P"===this.props.blockType?(0,Ki.jsx)(df,{pageName:bb}):(0,Ki.jsx)(Te,{blockId:bb})}),
De&&(0,Ki.jsx)("div",{className:"tl-target-not-found",children:"Target not found"}),gf&&(0,Ki.jsx)(Sd,Zd({},l))]})})]}))}));hb(this,"ReactIndicator",ee(()=>{const l=this.getBounds();return(0,Ki.jsx)("rect",{width:l.width,height:l.height,fill:"transparent",rx:8,ry:8,strokeDasharray:this.props.isLocked?"8 2":"undefined"})}));hb(this,"validateProps",l=>{var K;if(void 0!==l.size){const da=Un[null!=(K=this.props.scaleLevel)?K:"md"];l.size[0]=Math.max(l.size[0],60*da);l.size[1]=Math.max(l.size[1],40*da)}return fn(this,
l)});Ue(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 [l,K]=ym.useState([0,0]),da=mg();ym.useEffect(()=>{setTimeout(()=>{if(null==a?0:a.current){const ja=
d?a.current.querySelector(d):a.current;if(ja){const ra=()=>{const {width:Sa,height:bb}=ja.getBoundingClientRect(),gb=be.div([Sa,bb],da.viewport.camera.zoom);K(gb);return gb};ra();this.getInnerHeight=()=>ra()[1];const Ka=new ResizeObserver(()=>{ra()});Ka.observe(ja);return()=>{Ka.disconnect()}}}return()=>{}},10)},[a,d]);return l}getHeaderHeight(){var a;const d=Un[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,l;const K=this.getBounds();return(0,Ki.jsxs)(Ki.Fragment,{children:[(0,Ki.jsx)("rect",{fill:this.props.fill&&"var(--ls-secondary-background-color)"!==this.props.fill?Gi(this.props.fill)?`var(--ls-highlight-color-${this.props.fill})`:this.props.fill:"var(--ls-secondary-background-color)",stroke:sh(this.props.fill,"background"),strokeWidth:null!=(a=this.props.strokeWidth)?a:2,fillOpacity:null!=(d=this.props.opacity)?d:.2,width:K.width,rx:8,ry:8,
height:K.height}),!this.props.compact&&(0,Ki.jsx)("rect",{fill:this.props.fill&&"var(--ls-secondary-background-color)"!==this.props.fill?sh(this.props.fill,"background"):"var(--ls-tertiary-background-color)",fillOpacity:null!=(l=this.props.opacity)?l:.2,x:1,y:1,width:K.width-2,height:38,rx:8,ry:8}),(0,Ki.jsx)("text",{style:{transformOrigin:"top left"},transform:`translate(${K.width/2}, ${10+K.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:""})]})}};hb(Qj,"id","logseq-portal");hb(Qj,"defaultSearchQuery","");hb(Qj,"defaultSearchFilter",null);hb(Qj,"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});fe([Dg],Qj.prototype,"collapsed",
1);fe([jg],Qj.prototype,"setCollapsed",2);fe([Dg],Qj.prototype,"scaleLevel",1);fe([jg],Qj.prototype,"setScaleLevel",2);var {min:so,PI:OC}=Math,xp=OC+1E-4,ou=aa(616),to={xs:1,sm:1.6,md:2,lg:3.2,xl:4.8,xxl:6},Ar={easing:a=>Math.sin(a*Math.PI/2),simulatePressure:!0},Cy={easing:a=>a*a,simulatePressure:!1},ng=class extends fs{constructor(a={}){super(a);hb(this,"ReactComponent",ee(({events:d,isErasing:l})=>{const {props:{opacity:K}}=this;return(0,ou.jsx)(Nn,ff(Zd({},d),{opacity:l?.2:K,children:this.getShapeSVGJsx()}))}));
hb(this,"setScaleLevel",d=>Oh(this,null,function*(){this.update({scaleLevel:d,strokeWidth:to[null!=d?d:"md"]});this.onResetBounds()}));hb(this,"ReactIndicator",ee(()=>{const {pointsPath:d}=this;return(0,ou.jsx)("path",{d,strokeDasharray:this.props.isLocked?"8 2":"undefined"})}));hb(this,"validateProps",d=>{d=fn(this,d);void 0!==d.strokeWidth&&(d.strokeWidth=Math.max(d.strokeWidth,1));return d});Ue(this)}get pointsPath(){var a=this.props;if(2>a.points.length)var d="";else d=ff(Zd({size:1+1.5*a.strokeWidth,
thinning:.65,streamline:.65,smoothing:.65},.5===a.points[1][2]?Ar:Cy),{last:a.isComplete}),a=Fw(a.points,d),d=Mw.getSvgPathFromStroke(Ew(a,d));return d}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx(){const {pointsPath:a,props:{stroke:d,strokeWidth:l,strokeType:K}}=this;return(0,ou.jsx)("path",{pointerEvents:"all",d:a,strokeWidth:l/2,strokeLinejoin:"round",strokeLinecap:"round",stroke:sh(d,"text"),fill:sh(d,"text"),strokeDasharray:"dashed"===K?"12 4":void 0})}};
hb(ng,"id","pencil");hb(ng,"defaultProps",{id:"pencil",parentId:"page",type:"pencil",point:[0,0],points:[],isComplete:!1,stroke:"",fill:"",noFill:!0,strokeType:"line",strokeWidth:2,opacity:1});fe([Dg],ng.prototype,"pointsPath",1);fe([Dg],ng.prototype,"scaleLevel",1);fe([jg],ng.prototype,"setScaleLevel",2);var pu=Kf(aa(0)),un=aa(616),yp={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},vn=class extends Wp{constructor(){super(...arguments);hb(this,"canEdit",!0);hb(this,"ReactComponent",ee(({events:a,isErasing:d,
isSelected:l,isEditing:K,onEditingEnd:da})=>{const {offset:[ja,ra],props:{stroke:Ka,fill:Sa,noFill:bb,strokeWidth:gb,opacity:jb,strokeType:Jb,label:Ob,italic:Lb,fontWeight:gc,fontSize:rc}}=this,Wb=this.getVertices(gb/2).join();var kc=Ob||K?Mi(Ob,{fontFamily:"var(--ls-font-family)",fontSize:rc,lineHeight:1,fontWeight:gc},4):[0,0];const hc=[this.props.size[0]/2,2*this.props.size[1]/3];kc=Math.max(.5,Math.min(1,this.props.size[0]/(2*kc[0]),this.props.size[1]/(2*kc[1])));const Fc=this.getBounds(),Lc=
pu.useMemo(()=>be.sub(hc,be.toFixed([Fc.width/2,Fc.height/2])),[Fc,kc,hc]),ud=pu.useCallback(Jd=>{var Ee;null==(Ee=this.update)?void 0:Ee.call(this,{label:Jd})},[Ob]);return(0,un.jsxs)("div",ff(Zd({},a),{style:{width:"100%",height:"100%",overflow:"hidden"},children:[(0,un.jsx)(Ps,{font:"20px / 1 var(--ls-font-family)",text:Ob,fontSize:rc,color:sh(Ka,"text"),offsetX:Lc[0],offsetY:Lc[1]/kc,scale:kc,isEditing:K,onChange:ud,onBlur:da,fontStyle:Lb?"italic":"normal",fontWeight:gc,pointerEvents:!!Ob}),(0,un.jsx)(Nn,
{opacity:d?.2:jb,children:(0,un.jsxs)("g",{transform:`translate(${ja}, ${ra})`,children:[(0,un.jsx)("polygon",{className:l||!bb?"tl-hitarea-fill":"tl-hitarea-stroke",points:Wb}),(0,un.jsx)("polygon",{points:Wb,stroke:sh(Ka,"stroke"),fill:bb?"none":sh(Sa,"background"),strokeWidth:gb,rx:2,ry:2,strokeLinejoin:"round",strokeDasharray:"dashed"===Jb?"8 2":void 0})]})})]}))}));hb(this,"setScaleLevel",a=>Oh(this,null,function*(){this.update({scaleLevel:a,fontSize:yp[null!=a?a:"md"],strokeWidth:yp[null!=a?
a:"md"]/10});this.onResetBounds()}));hb(this,"ReactIndicator",ee(()=>{const {offset:[a,d],props:{strokeWidth:l,isLocked:K}}=this;return(0,un.jsx)("g",{children:(0,un.jsx)("polygon",{transform:`translate(${a}, ${d})`,points:this.getVertices(l/2).join(),strokeDasharray:K?"8 2":"undefined"})})}));hb(this,"validateProps",a=>{void 0!==a.sides&&(a.sides=Math.max(a.sides,3));return fn(this,a)})}get scaleLevel(){var a;return null!=(a=this.props.scaleLevel)?a:"md"}getShapeSVGJsx(a){const {offset:[d,l],props:{stroke:K,
fill:da,noFill:ja,strokeWidth:ra,opacity:Ka,strokeType:Sa}}=this;a=this.getVertices(ra/2).join();return(0,un.jsxs)("g",{transform:`translate(${d}, ${l})`,opacity:Ka,children:[(0,un.jsx)("polygon",{className:ja?"tl-hitarea-stroke":"tl-hitarea-fill",points:a}),(0,un.jsx)("polygon",{points:a,stroke:sh(K,"stroke"),fill:ja?"none":sh(da,"background"),strokeWidth:ra,rx:2,ry:2,strokeLinejoin:"round",strokeDasharray:"dashed"===Sa?"8 2":void 0})]})}};hb(vn,"id","polygon");hb(vn,"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:""});fe([Dg],vn.prototype,"scaleLevel",1);fe([jg],vn.prototype,"setScaleLevel",2);var Vn=Kf(aa(0)),zl=aa(616),PC={xs:10,sm:16,md:20,lg:32,xl:48,xxl:60},Rl=class extends Vw{constructor(){super(...arguments);hb(this,"ReactComponent",ee(({events:a,isErasing:d,isEditing:l,onEditingEnd:K})=>{const {props:{opacity:da,
fontFamily:ja,fontSize:ra,fontWeight:Ka,italic:Sa,lineHeight:bb,text:gb,stroke:jb,padding:Jb}}=this,Ob=Vn.useRef(null),Lb=Vn.useRef(!1),gc=Vn.useRef(null),rc=Vn.useCallback(Lc=>{const {isSizeLocked:ud}=this.props;Lc=ms.normalizeText(Lc.currentTarget.value);ud?this.update({text:Lc,size:this.getAutoSizedBoundingBox({text:Lc})}):this.update({text:Lc})},[]),Wb=Vn.useCallback(Lc=>{if("Escape"!==Lc.key)if("Tab"===Lc.key&&0===gb.length)Lc.preventDefault();else{if("Meta"!==Lc.key&&!Lc.metaKey)Lc.stopPropagation();
else if("z"===Lc.key&&Lc.metaKey){Lc.shiftKey?document.execCommand("redo",!1):document.execCommand("undo",!1);Lc.stopPropagation();Lc.preventDefault();return}"Tab"===Lc.key&&(Lc.preventDefault(),Lc.shiftKey?Um.unindent(Lc.currentTarget):Um.indent(Lc.currentTarget),this.update({text:ms.normalizeText(Lc.currentTarget.value)}))}},[]),kc=Vn.useCallback(Lc=>{l&&(null==K?void 0:K())},[K]),hc=Vn.useCallback(Lc=>{l&&Lb.current&&document.activeElement===Lc.currentTarget&&Lc.currentTarget.select()},[l]),Fc=
Vn.useCallback(Lc=>{l&&Lc.stopPropagation()},[l]);Vn.useEffect(()=>{l&&requestAnimationFrame(()=>{Lb.current=!0;const Lc=Ob.current;Lc&&(Lc.focus(),Lc.select())})},[l,K]);Vn.useLayoutEffect(()=>{if(0===this.props.size[0]||0===this.props.size[1])this.onResetBounds()},[]);return(0,zl.jsx)(ln,ff(Zd({},a),{opacity:d?.2:da,children:(0,zl.jsx)("div",{ref:gc,className:"tl-text-shape-wrapper","data-hastext":!!gb,"data-isediting":l,style:{fontFamily:ja,fontStyle:Sa?"italic":"normal",fontSize:ra,fontWeight:Ka,
padding:Jb,lineHeight:bb,color:sh(jb,"text")},children:l?(0,zl.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:gb,onFocus:hc,onChange:rc,onKeyDown:Wb,onBlur:kc,onPointerDown:Fc}):(0,zl.jsxs)(zl.Fragment,{children:[gb,"​"]})})}))}));hb(this,"setScaleLevel",a=>Oh(this,null,function*(){this.update({scaleLevel:a,
fontSize:PC[null!=a?a:"md"]});this.onResetBounds()}));hb(this,"ReactIndicator",ee(({isEditing:a})=>{const {props:{borderRadius:d,isLocked:l},bounds:K}=this;return a?null:(0,zl.jsx)("rect",{width:K.width,height:K.height,rx:d,ry:d,fill:"transparent",strokeDasharray:l?"8 2":"undefined"})}));hb(this,"validateProps",a=>fn(this,a));hb(this,"getBounds",()=>{const [a,d]=this.props.point,[l,K]=this.props.size;return{minX:a,minY:d,maxX:a+l,maxY:d+K,width:l,height:K}});hb(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})});hb(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:l=this.props.fontFamily,fontSize:K=this.props.fontSize,fontWeight:da=this.props.fontWeight,lineHeight:ja=this.props.lineHeight,padding:ra=
this.props.padding}=a,[Ka,Sa]=Mi(d,{fontFamily:l,fontSize:K,lineHeight:ja,fontWeight:da},ra);return[Ka,Sa]}getShapeSVGJsx(){var a=window.navigator.userAgent.toLowerCase();if(a.includes("webkit")&&!a.includes("chrome"))return super.getShapeSVGJsx(null);const {props:{text:d,stroke:l,fontSize:K,fontFamily:da}}=this;a=this.getBounds();return(0,zl.jsx)("foreignObject",{width:a.width,height:a.height,children:(0,zl.jsx)("div",{style:{color:sh(l,"text"),fontSize:K,fontFamily:da,display:"contents"},children:d})})}};
hb(Rl,"id","text");hb(Rl,"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});fe([Dg],Rl.prototype,"scaleLevel",1);fe([jg],Rl.prototype,"setScaleLevel",2);var Br=Kf(aa(0)),Ss=aa(616),vq=class extends fm{constructor(){super(...arguments);hb(this,"canFlip",!1);hb(this,"canEdit",
!0);hb(this,"canChangeAspectRatio",!1);hb(this,"ReactComponent",ee(({events:a,isErasing:d,asset:l,isEditing:K})=>{const {props:{opacity:da}}=this,ja=$r();var ra=mg();const Ka=ra.selectedIds.has(this.id),Sa=ja||Ka&&!K||"select"!==ra.selectedTool.id;ra=Br.useCallback(gb=>{Sa||gb.stopPropagation()},[Sa]);const {handlers:bb}=Br.useContext(ji);return(0,Ss.jsx)(ln,ff(Zd({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:da}},a),{children:(0,Ss.jsx)("div",{onWheelCapture:ra,onPointerDown:ra,onPointerUp:ra,
className:"tl-video-container",style:{pointerEvents:ja||!K&&!Ka?"none":"all",overflow:K?"auto":"hidden"},children:l&&(0,Ss.jsx)("video",{controls:!0,src:bb?bb.makeAssetUrl(l.src):l.src})})}))}));hb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,d],isLocked:l}}=this;return(0,Ss.jsx)("rect",{width:a,height:d,fill:"transparent",strokeDasharray:l?"8 2":"undefined"})}))}};hb(vq,"id","video");hb(vq,"defaultProps",{id:"video1",parentId:"page",type:"video",point:[0,0],size:[100,100],opacity:1,assetId:"",
clipping:0,isAspectRatioLocked:!0});var Xk=aa(616),qu=/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/,Zv=class extends fm{constructor(){super(...arguments);hb(this,"aspectRatio",480/853);hb(this,"canChangeAspectRatio",!1);hb(this,"canFlip",!1);hb(this,"canEdit",!0);hb(this,"onYoutubeLinkChange",a=>{this.update({url:a,size:Zv.defaultProps.size})});hb(this,"ReactComponent",ee(({events:a,isErasing:d,isEditing:l})=>{const K=mg();return(0,Xk.jsx)(ln,
ff(Zd({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:1}},a),{children:(0,Xk.jsx)("div",{className:"rounded-lg w-full h-full relative overflow-hidden shadow-xl tl-youtube-container",style:{pointerEvents:l||K.readOnly?"all":"none",userSelect:"none",background:`url('https://img.youtube.com/vi/${this.embedId}/mqdefault.jpg') no-repeat center/cover`},children:this.embedId?(0,Xk.jsx)("div",{style:{overflow:"hidden",position:"relative",height:"100%"},children:(0,Xk.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,Xk.jsx)("div",{className:"w-full h-full flex items-center justify-center p-4",style:{backgroundColor:"var(--ls-primary-background-color)"},children:(0,Xk.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 502 210.649",height:"210.65",width:"128",children:(0,Xk.jsxs)("g",
{children:[(0,Xk.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,Xk.jsx)("g",{children:(0,Xk.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,Xk.jsxs)("g",{fill:"#fff",children:[(0,Xk.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,Xk.jsx)("path",{d:"M268.763 169.537h-19.956V54.77h-20.956V35.835l62.869-.024v18.96h-21.957v114.766z"})]})]})})})})}))}));hb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,d],isLocked:l}}=this;return(0,Xk.jsx)("rect",{width:a,height:d,fill:"transparent",rx:8,ry:8,strokeDasharray:l?"8 2":"undefined"})}));hb(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 fn(this,a)})}get embedId(){var a,d;const l=this.props.url,
K=l.match(qu);return null!=(d=null!=(a=null==K?void 0:K[1])?a:l)?d:""}getShapeSVGJsx(){const a=this.getBounds(),d=this.embedId;return d?(0,Xk.jsxs)("g",{children:[(0,Xk.jsx)("image",{width:a.width,height:a.height,href:`https://img.youtube.com/vi/${d}/mqdefault.jpg`,className:"grayscale-[50%]"}),(0,Xk.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,Xk.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({})}},zp=Zv;hb(zp,"id","youtube");hb(zp,"defaultProps",{id:"youtube",type:"youtube",parentId:"page",point:[0,0],size:[853,480],url:""});fe([Dg],zp.prototype,"embedId",1);fe([jg],zp.prototype,"onYoutubeLinkChange",2);var wq=Kf(aa(0)),Xo=aa(616),$v=/https?:\/\/(x|twitter).com\/[0-9a-zA-Z_]{1,20}\/status\/([0-9]*)/,Dy=class extends fm{constructor(){super(...arguments);hb(this,"canFlip",!1);hb(this,"canEdit",!0);hb(this,
"initialHeightCalculated",!0);hb(this,"getInnerHeight",null);hb(this,"onTwitterLinkChange",a=>{this.update({url:a,size:Dy.defaultProps.size})});hb(this,"ReactComponent",ee(({events:a,isErasing:d,isEditing:l})=>{const {renderers:{Tweet:K}}=wq.useContext(ji),da=mg(),ja=wq.useRef(null),[,ra]=this.useComponentSize(ja);wq.useEffect(()=>{var Ka,Sa;const bb=null!=(Sa=null==(Ka=this.getInnerHeight)?void 0:Ka.call(this))?Sa:ra;ra&&1<Math.abs(bb-this.props.size[1])&&(this.update({size:[this.props.size[0],bb]}),
da.persist(!0))},[ra]);wq.useEffect(()=>{this.initialHeightCalculated||setTimeout(()=>{this.onResetBounds();da.persist(!0)})},[this.initialHeightCalculated]);return(0,Xo.jsx)(ln,ff(Zd({style:{overflow:"hidden",pointerEvents:"all",opacity:d?.2:1}},a),{children:(0,Xo.jsx)("div",{className:"rounded-xl w-full h-full relative shadow-xl tl-tweet-container",style:{pointerEvents:l||da.readOnly?"all":"none",userSelect:"none"},children:this.embedId?(0,Xo.jsx)("div",{ref:ja,children:(0,Xo.jsx)(K,{tweetId:this.embedId})}):
null})}))}));hb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,d],isLocked:l}}=this;return(0,Xo.jsx)("rect",{width:a,height:d,fill:"transparent",rx:8,ry:8,strokeDasharray:l?"8 2":"undefined"})}));hb(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});hb(this,"onResize",(a,d)=>{var l;const {bounds:K,rotation:da,scale:[ja,ra]}=d;a=[...this.scale];0>ja&&(a[0]*=
-1);0>ra&&(a[1]*=-1);d=null!=(l=this.getAutoResizeHeight())?l:K.height;return this.update({point:[K.minX,K.minY],size:[Math.max(1,K.width),Math.max(1,d)],scale:a,rotation:da})});hb(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 fn(this,a)})}get embedId(){var a,d;const l=this.props.url,K=l.match($v);return null!=(d=null!=(a=null==K?void 0:K[1])?a:l)?d:""}useComponentSize(a,d=""){const [l,K]=wq.useState([0,0]),da=mg();
wq.useEffect(()=>{if(null==a?0:a.current){const ja=d?a.current.querySelector(d):a.current;if(ja){const ra=()=>{const {width:Sa,height:bb}=ja.getBoundingClientRect(),gb=be.div([Sa,bb],da.viewport.camera.zoom);K(gb);return gb};ra();this.getInnerHeight=()=>ra()[1];const Ka=new ResizeObserver(()=>{ra()});Ka.observe(ja);return()=>{Ka.disconnect()}}}return()=>{}},[a,d]);return l}getAutoResizeHeight(){return this.getInnerHeight?this.getInnerHeight():null}getShapeSVGJsx(){const a=this.getBounds();return this.embedId?
(0,Xo.jsxs)("g",{children:[(0,Xo.jsx)("rect",{width:a.width,height:a.height,fill:"#15202b",rx:8,ry:8}),(0,Xo.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,Xo.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({})}},Cr=Dy;hb(Cr,"id","tweet");hb(Cr,"defaultProps",{id:"tweet",type:"tweet",parentId:"page",point:[0,0],size:[331,290],url:""});fe([Dg],Cr.prototype,"embedId",1);fe([jg],Cr.prototype,"onTwitterLinkChange",2);var aw=Kf(aa(0)),ru=aa(616),uo=class extends fm{constructor(){super(...arguments);hb(this,"frameRef",aw.createRef());hb(this,"canChangeAspectRatio",!0);hb(this,"canFlip",!0);hb(this,"canEdit",!0);hb(this,"ReactComponent",
ee(({events:a,asset:d,isErasing:l,isEditing:K})=>{aw.useRef(null);const {handlers:da}=aw.useContext(ji);mg();const ja=$r();return(0,ru.jsx)(ln,ff(Zd({style:{overflow:"hidden",pointerEvents:"all",opacity:l?.2:1}},a),{children:d?(0,ru.jsx)("embed",{src:da?da.inflateAsset(d.src).url:d.src,className:"relative tl-pdf-container",onWheelCapture:stop,onPointerDown:stop,onPointerUp:stop,style:{width:"100%",height:"100%",pointerEvents:!ja&&K?"all":"none"}}):null}))}));hb(this,"ReactIndicator",ee(()=>{const {props:{size:[a,
d],isLocked:l}}=this;return(0,ru.jsx)("rect",{width:a,height:d,fill:"transparent",rx:8,ry:8,strokeDasharray:l?"8 2":"undefined"})}))}};hb(uo,"id","pdf");hb(uo,"defaultProps",{id:"pdf",type:"pdf",parentId:"page",point:[0,0],size:[595,842],assetId:""});aa(616);var bw=[wm,wr,sq,mu,vq,zr,ng,vn,Rl,zp,Cr,tq,qo,uo,Qj,Xv],Al=class extends kp{constructor(){super(...arguments);hb(this,"Shape",wm)}};hb(Al,"id","box");hb(Al,"shortcut","whiteboard/rectangle");var Dr=class extends kp{constructor(){super(...arguments);
hb(this,"Shape",wr)}};hb(Dr,"id","ellipse");hb(Dr,"shortcut","whiteboard/ellipse");var Sl=class extends $u{};hb(Sl,"id","erase");hb(Sl,"shortcut","whiteboard/eraser");var Ey=class extends xt{constructor(){super(...arguments);hb(this,"Shape",sq);hb(this,"simplify",!0);hb(this,"simplifyTolerance",.618)}};hb(Ey,"id","highlighter");hb(Ey,"shortcut","whiteboard/highlighter");var Bl=class extends av{constructor(){super(...arguments);hb(this,"Shape",zr)}};hb(Bl,"id","line");hb(Bl,"shortcut","whiteboard/connector");
var Wn=class extends xt{constructor(){super(...arguments);hb(this,"Shape",ng);hb(this,"simplify",!1)}};hb(Wn,"id","pencil");hb(Wn,"shortcut","whiteboard/pencil");var Fy=class extends kp{constructor(){super(...arguments);hb(this,"Shape",vn)}};hb(Fy,"id","polygon");var Gy=class extends bv{constructor(){super(...arguments);hb(this,"Shape",Rl)}};hb(Gy,"id","text");hb(Gy,"shortcut","whiteboard/text");var QC=class extends kp{constructor(){super(...arguments);hb(this,"Shape",zp)}};hb(QC,"id","youtube");
var wk=class extends Xh{constructor(){super(...arguments);hb(this,"creatingShape");hb(this,"offset",[0,0]);hb(this,"onEnter",()=>{this.app.history.pause();Gc(()=>{var a=be.sub(this.app.inputs.originPoint,this.offset);this.app.settings.snapToGrid&&(a=be.snap(a,8));this.creatingShape=a=new Qj({id:qk(),parentId:this.app.currentPage.id,point:a,size:Qj.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])})});
hb(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")}});hb(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)})}};hb(wk,"id","creating");var Ap=class extends Xh{constructor(){super(...arguments);
hb(this,"cursor","crosshair");hb(this,"onPointerDown",a=>{this.tool.transition("creating")})}};hb(Ap,"id","idle");var gm=class extends Xp{constructor(){super(...arguments);hb(this,"Shape",Qj);hb(this,"onPinch",a=>{this.app.viewport.pinchZoom(a.point,a.delta,a.delta[2])})}};hb(gm,"id","logseq-portal");hb(gm,"shortcut","whiteboard/portal");hb(gm,"states",[Ap,wk]);hb(gm,"initial","idle");var cw=class extends kp{constructor(){super(...arguments);hb(this,"Shape",qo)}};hb(cw,"id","youtube");var rh=class extends kp{constructor(){super(...arguments);
hb(this,"Shape",tq)}};hb(rh,"id","iframe");var yH=Kf(aa(619)),Xn=aa(616),RC=new Map(bw.map(a=>[a.id,a])),nh=class{constructor(a){hb(this,"shapes");hb(this,"pageId");hb(this,"assets");a&&this.load(a)}load(a){var d;const l=null==(d=null==a?void 0:a.pages)?void 0:d[0];this.pageId=null==l?void 0:l.id;this.assets=a.assets;this.shapes=null==l?void 0:l.shapes.map(K=>{var da=K.type;if(!da)throw Error("No shape type provided.");const ja=RC.get(da);if(!ja)throw Error(`Could not find shape class for ${da}`);
return new ja(K)}).filter(K=>"group"!==K.type)}generatePreviewJsx(a,d){var l,K;const da=[...(null!=(l=this.shapes)?l:[]).map(bb=>bb.getRotatedBounds())];(l=null==a?void 0:a.currentView)&&da.push(l);let ja=sf.getCommonBounds(da);if(!ja)return null;ja=sf.expandBounds(ja,16);ja=d?sf.ensureRatio(ja,d):ja;const ra=bb=>[(bb[0]-ja.minX).toFixed(2),(bb[1]-ja.minY).toFixed(2)],[Ka,Sa]=l?ra([l.minX,l.minY]):[0,0];return ja&&(0,Xn.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg","data-common-bound-x":ja.minX.toFixed(2),
"data-common-bound-y":ja.minY.toFixed(2),"data-common-bound-width":ja.width.toFixed(2),"data-common-bound-height":ja.height.toFixed(2),viewBox:[0,0,ja.width,ja.height].join(" "),children:[(0,Xn.jsx)("defs",{children:l&&(0,Xn.jsxs)(Xn.Fragment,{children:[(0,Xn.jsx)("rect",{id:this.pageId+"-camera-rect",transform:`translate(${Ka}, ${Sa})`,width:l.width,height:l.height}),(0,Xn.jsxs)("mask",{id:this.pageId+"-camera-mask",children:[(0,Xn.jsx)("rect",{width:ja.width,height:ja.height,fill:"white"}),(0,Xn.jsx)("use",
{href:`#${this.pageId}-camera-rect`,fill:"black"})]})]})}),(0,Xn.jsx)("g",{id:this.pageId+"-preview-shapes",children:null==(K=this.shapes)?void 0:K.map(bb=>{var gb,jb;const {bounds:Jb,props:{rotation:Ob}}=bb,[Lb,gc]=ra([Jb.minX,Jb.minY]),rc=+(180*((null!=Ob?Ob:0)+(null!=(gb=Jb.rotation)?gb:0))/Math.PI).toFixed(2),[Wb,kc]=[(Jb.width/2).toFixed(2),(Jb.height/2).toFixed(2)];return(0,Xn.jsx)("g",{transform:[`translate(${Lb}, ${gc})`,`rotate(${rc}, ${Wb}, ${kc})`].join(" "),children:bb.getShapeSVGJsx({assets:null!=
(jb=this.assets)?jb:[]})},bb.id)})}),(0,Xn.jsx)("rect",{mask:l?`url(#${this.pageId}-camera-mask)`:"",width:ja.width,height:ja.height,fill:"transparent"}),l&&(0,Xn.jsx)("use",{id:"minimap-camera-rect","data-x":Ka,"data-y":Sa,"data-width":l.width,"data-height":l.height,href:`#${this.pageId}-camera-rect`,fill:"transparent",stroke:"red",strokeWidth:4/a.camera.zoom})]})}exportAsSVG(a){return(a=this.generatePreviewJsx(void 0,a))?yH.default.renderToString(a):""}},Ts=Kf(aa(0)),wn=aa(616),vo=Ts.forwardRef((a,
d)=>{var {value:l,className:K}=a;a=Jf(a,["autoResize","value","className"]);return(0,wn.jsx)("div",{className:"tl-input"+(K?" "+K:""),children:(0,wn.jsxs)("div",{className:"tl-input-sizer",children:[(0,wn.jsx)("div",{className:"tl-input-hidden",children:l}),(0,wn.jsx)("input",Zd({ref:d,value:l,className:"tl-text-input",type:"text"},a))]})})}),Bh=aa(616),wo=({type:a,active:d})=>(0,Bh.jsx)("span",{className:"tl-type-tag","data-active":d,children:(0,Bh.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]}`})}),SC=(a,d)=>(0,Bh.jsx)("span",{children:a.split(new RegExp(`(${d.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$\x26")})`,"gi")).map((l,K)=>1===K%2?(0,Bh.jsx)("mark",{className:"tl-highlighted",children:l}):l).map((l,K)=>(0,Bh.jsx)(Pj.default.Fragment,{children:l},K))}),zH=(a,d)=>{const {handlers:l}=Pj.default.useContext(ji),[K,da]=Pj.default.useState(null),ja=ye(a,200);Pj.default.useEffect(()=>{let ra=
!1;if(0<ja.length){const Ka={"pages?":!0,"blocks?":!0,"files?":!1};"B"===d?Ka["pages?"]=!1:"P"===d&&(Ka["blocks?"]=!1);l.search(ja,Ka).then(Sa=>{ra||da(Sa)})}else da(null);return()=>{ra=!0}},[ja,null==l?void 0:l.search]);return K},Er=ee(({className:a,style:d,placeholder:l,onChange:K,onBlur:da,onAddBlock:ja})=>{const [ra,Ka]=Pj.default.useState(Qj.defaultSearchQuery),[Sa,bb]=Pj.default.useState(Qj.defaultSearchFilter),gb=Pj.default.useRef(null),{handlers:jb,renderers:Jb}=Pj.default.useContext(ji),
Ob=jb.t,Lb=Pj.default.useCallback(Sd=>{var De;setTimeout(()=>K(Sd));null==(De=gb.current)?void 0:De.blur();Sd&&(Qj.defaultSearchQuery="",Qj.defaultSearchFilter=null)},[]),gc=Pj.default.useCallback(Sd=>{if(Sd=null==jb?void 0:jb.addNewBlock(Sd))Lb(Sd),null==ja?void 0:ja(Sd);return Sd},[ja]),rc=Pj.default.useRef(null),[Wb,kc]=Pj.default.useState(0),hc=zH(ra,Sa),[Fc,Lc]=Pj.default.useState("circle-plus"),[ud,Jd]=Pj.default.useState(!1);Pj.default.useEffect(()=>{setTimeout(()=>{var Sd;null==(Sd=gb.current)?
void 0:Sd.focus()})},[Sa]);Pj.default.useEffect(()=>{Qj.defaultSearchQuery=ra;Qj.defaultSearchFilter=Sa},[ra,Sa]);const Ee=Pj.default.useMemo(()=>{var Sd;const De=[],gf=null==Jb?void 0:Jb.Breadcrumb;if(!gf||!jb)return[];ja&&De.push({actionIcon:"circle-plus",onChosen:()=>!!gc(ra),element:(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Bh.jsx)(wo,{active:!0,type:"BA"}),0<ra.length?(0,Bh.jsxs)(Bh.Fragment,{children:[(0,Bh.jsx)("strong",{children:Ob("whiteboard/new-block")}),ra]}):
(0,Bh.jsx)("strong",{children:Ob("whiteboard/new-block-no-colon")})]})});(null==(Sd=null==hc?void 0:hc.pages)?0:Sd.some(Te=>Te.toLowerCase()===ra.toLowerCase()))||!ra||De.push({actionIcon:"circle-plus",onChosen:()=>{Lb(ra);return!0},element:(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Bh.jsx)(wo,{active:!0,type:"PA"}),(0,Bh.jsx)("strong",{children:Ob("whiteboard/new-page")}),ra]})},{actionIcon:"circle-plus",onChosen:()=>{null==jb?void 0:jb.addNewWhiteboard(ra);Lb(ra);return!0},
element:(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Bh.jsx)(wo,{active:!0,type:"WA"}),(0,Bh.jsx)("strong",{children:Ob("whiteboard/new-whiteboard")}),ra]})});0===ra.length&&null===Sa&&De.push({actionIcon:"search",onChosen:()=>{bb("B");return!0},element:(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Bh.jsx)(wo,{type:"BS"}),Ob("whiteboard/search-only-blocks")]})},{actionIcon:"search",onChosen:()=>{bb("P");return!0},element:(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",
children:[(0,Bh.jsx)(wo,{type:"PS"}),Ob("whiteboard/search-only-pages")]})});Sa&&"P"!==Sa||!hc||!hc.pages||De.push(...hc.pages.map(Te=>({actionIcon:"search",onChosen:()=>{Lb(Te);return!0},element:(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Bh.jsx)(wo,{type:jb.isWhiteboardPage(Te)?"WP":"P"}),SC(Te,ra)]})})));Sa&&"B"!==Sa||!hc||!hc.blocks||De.push(...hc.blocks.filter(Te=>Te.content&&Te.uuid).map(({content:Te,uuid:df})=>{const Gd=jb.queryBlockByUUID(df);return{actionIcon:"search",
onChosen:()=>{var od,Dd,jd;return Gd?(Lb(df),null==(jd=null==(Dd=null==(od=window.logseq)?void 0:od.api)?void 0:Dd.set_blocks_id)?void 0:jd.call(Dd,[df]),!0):!1},element:Gd?(0,Bh.jsxs)(Bh.Fragment,{children:[(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Bh.jsx)(wo,{type:"B"}),(0,Bh.jsx)("div",{className:"tl-quick-search-option-breadcrumb",children:(0,Bh.jsx)(gf,{blockId:df})})]}),(0,Bh.jsxs)("div",{className:"tl-quick-search-option-row",children:[(0,Bh.jsx)("div",{className:"tl-quick-search-option-placeholder"}),
SC(Te,ra)]})]}):(0,Bh.jsx)("div",{className:"tl-quick-search-option-row",children:Ob("whiteboard/cache-outdated")})}}));return De},[ra,Sa,hc,null==Jb?void 0:Jb.Breadcrumb,jb]);Pj.default.useEffect(()=>{const Sd=De=>{var gf,Te;let df=Wb;"ArrowDown"===De.key?df=Math.min(Ee.length-1,Wb+1):"ArrowUp"===De.key?df=Math.max(0,Wb-1):"Enter"===De.key?(null==(gf=Ee[Wb])?void 0:gf.onChosen(),De.stopPropagation(),De.preventDefault()):"Backspace"===De.key&&0===ra.length?bb(null):"Escape"===De.key&&Lb("");df!==
Wb&&(gf=Ee[df],kc(df),Lc(gf.actionIcon),De.stopPropagation(),De.preventDefault(),(De=null==(Te=rc.current)?void 0:Te.querySelector(".tl-quick-search-option:nth-child("+(df+1)+")"))&&(null==De?void 0:De.scrollIntoViewIfNeeded(!1)))};document.addEventListener("keydown",Sd,!0);return()=>{document.removeEventListener("keydown",Sd,!0)}},[Ee,Wb,ra]);return(0,Bh.jsxs)("div",{className:"tl-quick-search "+(null!=a?a:""),style:d,children:[(0,Bh.jsx)(QG,{icon:Fc,onClick:()=>{var Sd;null==(Sd=Ee[Wb])?void 0:
Sd.onChosen()}}),(0,Bh.jsxs)("div",{className:"tl-quick-search-input-container",children:[Sa&&(0,Bh.jsxs)("div",{className:"tl-quick-search-input-filter",children:[(0,Bh.jsx)(wo,{type:Sa}),"B"===Sa?"Search blocks":"Search pages",(0,Bh.jsx)("div",{className:"tl-quick-search-input-filter-remove",onClick:()=>bb(null),children:(0,Bh.jsx)(Qg,{name:"x"})})]}),(0,Bh.jsx)(vo,{ref:gb,type:"text",value:ra,className:"tl-quick-search-input",placeholder:null!=l?l:"Create or search your graph...",onChange:Sd=>
Ka(Sd.target.value),onKeyDown:Sd=>{"Enter"===Sd.key&&Lb(ra);Sd.stopPropagation()},onFocus:()=>{Jd(!0)},onBlur:()=>{Jd(!1);null==da?void 0:da()}})]}),0<Ee.length&&(0,Bh.jsx)("div",{onWheelCapture:Sd=>Sd.stopPropagation(),className:"tl-quick-search-options",ref:rc,style:{visibility:ud?"visible":"hidden",pointerEvents:ud?"all":"none"},children:(0,Bh.jsx)(uy,{style:{height:40*Math.min(Math.max(1,Ee.length),12)},totalCount:Ee.length,itemContent:Sd=>{const {actionIcon:De,onChosen:gf,element:Te}=Ee[Sd];
return(0,Bh.jsx)("div",{"data-focused":Sd===Wb,className:"tl-quick-search-option",tabIndex:0,onMouseEnter:()=>{Lc(De);kc(Sd)},onPointerDownCapture:df=>{gf()&&(df.stopPropagation(),df.preventDefault())},children:Te},Sd)}})})]})}),Yh=aa(616),dw=ee(function(a){var {pageId:d,portalType:l,refs:K,side:da,onRefsChange:ja}=a;a=Jf(a,"pageId portalType shapeType refs side onRefsChange".split(" "));const {handlers:{t:ra}}=ky.default.useContext(ji),Ka=K.length+(d?1:0),Sa=0===K.length,bb=jb=>{jb&&!K.includes(jb)&&
Sa&&ja([...K,jb])},gb=!(!d||!l);return(0,Yh.jsx)(qm,ff(Zd({},a),{side:da,align:"start",alignOffset:-6,label:(0,Yh.jsx)(ce,{content:ra("whiteboard/link"),sideOffset:14,children:(0,Yh.jsxs)("div",{className:"flex gap-1 relative items-center justify-center px-1",children:[(0,Yh.jsx)(Qg,{name:0<Ka?"link":"add-link"}),0<Ka&&(0,Yh.jsx)("div",{className:"tl-shape-links-count",children:Ka})]})}),children:(0,Yh.jsxs)("div",{className:"color-level rounded-lg","data-show-reference-panel":gb,children:[gb&&(0,Yh.jsxs)("div",
{className:"tl-shape-links-reference-panel",children:[(0,Yh.jsxs)("div",{className:"text-base inline-flex gap-1 items-center",children:[(0,Yh.jsx)(Qg,{className:"opacity-50",name:"internal-link"}),ra("whiteboard/references")]}),(0,Yh.jsx)(Nu,{type:l,id:d})]}),(0,Yh.jsxs)("div",{className:"tl-shape-links-panel color-level",children:[(0,Yh.jsxs)("div",{className:"text-base inline-flex gap-1 items-center",children:[(0,Yh.jsx)(Qg,{className:"opacity-50",name:"add-link"}),ra("whiteboard/link-to-any-page-or-block")]}),
Sa&&(0,Yh.jsx)(Er,{style:{width:"calc(100% - 46px)",marginLeft:"46px"},placeholder:ra("whiteboard/start-typing-to-search"),onChange:bb}),0<K.length&&(0,Yh.jsx)("div",{className:"flex flex-col items-stretch gap-2",children:K.map((jb,Jb)=>(0,Yh.jsx)(Nu,{id:jb,type:Dj(jb)?"B":"P",onRemove:()=>{ja(K.filter((Ob,Lb)=>Jb!==Lb))},showContent:!0},jb))})]})]})}))}),yj=Kf(aa(0)),[su]=Gh("ToggleGroup",[pv]),tu=pv(),TC=yj.default.forwardRef((a,d)=>{const {type:l}=a;a=Jf(a,["type"]);if("single"===l)return yj.default.createElement(AH,
Oe({},a,{ref:d}));if("multiple"===l)return yj.default.createElement(BH,Oe({},a,{ref:d}));throw Error("Missing prop `type` expected on `ToggleGroup`");}),[Hy,xo]=su("ToggleGroup"),AH=yj.default.forwardRef((a,d)=>{const {value:l,defaultValue:K,onValueChange:da=()=>{}}=a,ja=Jf(a,["value","defaultValue","onValueChange"]),[ra,Ka]=Dc({prop:l,defaultProp:K,onChange:da});return yj.default.createElement(Hy,{scope:a.__scopeToggleGroup,type:"single",value:ra?[ra]:[],onItemActivate:Ka,onItemDeactivate:yj.default.useCallback(()=>
Ka(""),[Ka])},yj.default.createElement(VC,Oe({},ja,{ref:d})))}),BH=yj.default.forwardRef((a,d)=>{const {value:l,defaultValue:K,onValueChange:da=()=>{}}=a,ja=Jf(a,["value","defaultValue","onValueChange"]),[ra=[],Ka]=Dc({prop:l,defaultProp:K,onChange:da}),Sa=yj.default.useCallback(gb=>Ka((jb=[])=>[...jb,gb]),[Ka]),bb=yj.default.useCallback(gb=>Ka((jb=[])=>jb.filter(Jb=>Jb!==gb)),[Ka]);return yj.default.createElement(Hy,{scope:a.__scopeToggleGroup,type:"multiple",value:ra,onItemActivate:Sa,onItemDeactivate:bb},
yj.default.createElement(VC,Oe({},ja,{ref:d})))}),[CH,UC]=su("ToggleGroup"),VC=yj.default.forwardRef((a,d)=>{const {__scopeToggleGroup:l,disabled:K=!1,rovingFocus:da=!0,orientation:ja,dir:ra,loop:Ka=!0}=a;var Sa=Jf(a,"__scopeToggleGroup disabled rovingFocus orientation dir loop".split(" "));a=tu(l);const bb=pg(ra);Sa=Zd({role:"group",dir:bb},Sa);return yj.default.createElement(CH,{scope:l,rovingFocus:da,disabled:K},da?yj.default.createElement(CB,Oe({asChild:!0},a,{orientation:ja,dir:bb,loop:Ka}),
yj.default.createElement(rk.div,Oe({},Sa,{ref:d}))):yj.default.createElement(rk.div,Oe({},Sa,{ref:d})))}),uu=yj.default.forwardRef((a,d)=>{var l=xo("ToggleGroupItem",a.__scopeToggleGroup);const K=UC("ToggleGroupItem",a.__scopeToggleGroup),da=tu(a.__scopeToggleGroup);l=l.value.includes(a.value);const ja=K.disabled||a.disabled;a=ff(Zd({},a),{pressed:l,disabled:ja});const ra=yj.default.useRef(null);return K.rovingFocus?yj.default.createElement(DB,Oe({asChild:!0},da,{focusable:!ja,active:l,ref:ra}),yj.default.createElement(WC,
Oe({},a,{ref:d}))):yj.default.createElement(WC,Oe({},a,{ref:d}))}),WC=yj.default.forwardRef((a,d)=>{const {__scopeToggleGroup:l,value:K}=a,da=Jf(a,["__scopeToggleGroup","value"]),ja=xo("ToggleGroupItem",l);a={role:"radio","aria-checked":a.pressed,"aria-pressed":void 0};return yj.default.createElement(wB,Oe({},"single"===ja.type?a:void 0,da,{ref:d,onPressedChange:ra=>{if(ra)ja.onItemActivate(K);else ja.onItemDeactivate(K)}}))}),XC=TC,YC=uu,Bp=aa(616),Eh=aa(616),vu="EditPdf LogseqPortalViewMode Geometry AutoResizing Swatch NoFill StrokeType ScaleLevel TextStyle YoutubeLink TwitterLink IFrameSource ArrowMode Links".split(" "),
ZC=["YoutubeLink","TwitterLink","IFrameSource","Links","EditPdf"],zm=new Map,Iy={"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"]},DH=Object.entries(Iy).filter(([,a])=>a.includes("NoFill")&&a.includes("Swatch")).map(([a])=>a),EH=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji),l=Za("AutoResizing"),K=l.every(da=>
da.props.isAutoResizing);return(0,Eh.jsx)(Ne,{tooltip:d("whiteboard/auto-resize"),toggle:l.every(da=>"logseq-portal"===da.props.type),className:"tl-button",pressed:K,onPressedChange:da=>{l.forEach(ja=>{if("logseq-portal"===ja.props.type)ja.update({isAutoResizing:da});else ja.onResetBounds({zoom:a.viewport.camera.zoom})});a.persist()},children:(0,Eh.jsx)(Qg,{name:"dimensions"})})}),FH=ee(()=>{const a=mg();var {handlers:{t:d}}=Wk.default.useContext(ji);const l=Za("LogseqPortalViewMode"),K=l.every(da=>
da.collapsed);if(!K&&!l.every(da=>!da.collapsed))return null;d=(0,Eh.jsxs)("div",{className:"flex",children:[K?d("whiteboard/expand"):d("whiteboard/collapse"),(0,Eh.jsx)(hl,{action:K?"editor/expand-block-children":"editor/collapse-block-children"})]});return(0,Eh.jsx)(Ne,{tooltip:d,toggle:l.every(da=>"logseq-portal"===da.props.type),className:"tl-button",pressed:K,onPressedChange:()=>a.api.setCollapsed(!K),children:(0,Eh.jsx)(Qg,{name:K?"object-expanded":"object-compact"})})}),GH=ee(()=>{const {handlers:{isMobile:a}}=
Wk.default.useContext(ji);var d=Za("ScaleLevel");d=1<(new Set(d.map(l=>l.scaleLevel))).size?"":d[0].scaleLevel;return(0,Eh.jsx)(Jr,{scaleLevel:d,compact:a()})}),HH=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji),l=Za("IFrameSource")[0],K=Wk.default.useCallback(ja=>{l.onIFrameSourceChange(ja.target.value.trim().toLowerCase());a.persist()},[]),da=Wk.default.useCallback(()=>{l.reload()},[]);return(0,Eh.jsxs)("span",{className:"flex gap-3",children:[(0,Eh.jsx)(Yd,{tooltip:d("whiteboard/reload"),
type:"button",onClick:da,children:(0,Eh.jsx)(Qg,{name:"refresh"})}),(0,Eh.jsx)(vo,{title:d("whiteboard/website-url"),className:"tl-iframe-src",value:`${l.props.url}`,onChange:K}),(0,Eh.jsx)(Yd,{tooltip:d("whiteboard/open-website-url"),type:"button",onClick:()=>window.open(l.props.url),children:(0,Eh.jsx)(Qg,{name:"external-link"})})]})}),Yo=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji),l=Za("YoutubeLink")[0],K=Wk.default.useCallback(da=>{l.onYoutubeLinkChange(da.target.value);a.persist()},
[]);return(0,Eh.jsxs)("span",{className:"flex gap-3",children:[(0,Eh.jsx)(vo,{title:d("whiteboard/youtube-url"),className:"tl-youtube-link",value:`${l.props.url}`,onChange:K}),(0,Eh.jsx)(Yd,{tooltip:d("whiteboard/open-youtube-url"),type:"button",onClick:()=>{var da,ja,ra;return null==(ra=null==(ja=null==(da=window.logseq)?void 0:da.api)?void 0:ja.open_external_link)?void 0:ra.call(ja,l.props.url)},children:(0,Eh.jsx)(Qg,{name:"external-link"})})]})}),IH=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji),
l=Za("TwitterLink")[0],K=Wk.default.useCallback(da=>{l.onTwitterLinkChange(da.target.value);a.persist()},[]);return(0,Eh.jsxs)("span",{className:"flex gap-3",children:[(0,Eh.jsx)(vo,{title:d("whiteboard/twitter-url"),className:"tl-twitter-link",value:`${l.props.url}`,onChange:K}),(0,Eh.jsx)(Yd,{tooltip:d("whiteboard/open-twitter-url"),type:"button",onClick:()=>{var da,ja,ra;return null==(ra=null==(ja=null==(da=window.logseq)?void 0:da.api)?void 0:ja.open_external_link)?void 0:ra.call(ja,l.props.url)},
children:(0,Eh.jsx)(Qg,{name:"external-link"})})]})}),JH=ee(()=>{const a=mg(),{handlers:{t:d,setCurrentPdf:l}}=Wk.default.useContext(ji),K=a.selectedShapesArray[0];return(0,Eh.jsx)(Yd,{tooltip:d("whiteboard/edit-pdf"),type:"button",onClick:()=>l(a.assets[K.props.assetId].src),children:(0,Eh.jsx)(Qg,{name:"edit"})})}),KH=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji);var l=Za("NoFill");const K=Wk.default.useCallback(da=>{a.selectedShapesArray.forEach(ja=>ja.update({noFill:da}));a.persist()},
[]);l=l.every(da=>da.props.noFill);return(0,Eh.jsx)(Ne,{tooltip:d("whiteboard/fill"),className:"tl-button",pressed:l,onPressedChange:K,children:(0,Eh.jsx)(Qg,{name:l?"droplet-off":"droplet"})})}),LH=ee(()=>{const a=mg(),d=Za("Swatch"),l=Wk.default.useCallback(da=>{a.selectedShapesArray.forEach(ja=>{ja.update({fill:da,stroke:da})});a.persist()},[]),K=Wk.default.useCallback(da=>{a.selectedShapesArray.forEach(ja=>{ja.update({opacity:da})});a.persist()},[]);return(0,Eh.jsx)(km,{popoverSide:"top",color:d[0].props.noFill?
d[0].props.stroke:d[0].props.fill,opacity:d[0].props.opacity,setOpacity:K,setColor:l})}),MH=ee(()=>{const a=mg(),d=Wk.default.useCallback(l=>{a.api.convertShapes(l.currentTarget.dataset.tool)},[]);return(0,Eh.jsx)(Wx,{popoverSide:"top",chevron:!1,setGeometry:d})}),NH=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji),l=Za("StrokeType"),K=l.every(da=>"dashed"===da.props.strokeType)?"dashed":l.every(da=>"line"===da.props.strokeType)?"line":"mixed";return(0,Eh.jsx)(ha,{title:d("whiteboard/stroke-type"),
options:[{value:"line",icon:"circle",tooltip:"Solid"},{value:"dashed",icon:"circle-dashed",tooltip:"Dashed"}],value:K,onValueChange:da=>{l.forEach(ja=>{ja.update({strokeType:da})});a.persist()}})}),$C=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji),l=Za("ArrowMode");var K=l.every(ja=>{var ra;return"arrow"===(null==(ra=ja.props.decorations)?void 0:ra.start)});const da=l.every(ja=>{var ra;return"arrow"===(null==(ra=ja.props.decorations)?void 0:ra.end)});K=[K?"start":null,da?"end":null].filter(cg);
return(0,Eh.jsx)(Aa,{title:d("whiteboard/arrow-head"),options:[{value:"start",icon:"arrow-narrow-left"},{value:"end",icon:"arrow-narrow-right"}],value:K,onValueChange:ja=>{l.forEach(ra=>{var Ka=ra.update;var Sa={start:ja.includes("start")?"arrow":null,end:ja.includes("end")?"arrow":null};Ka.call(ra,{decorations:Sa})});a.persist()}})}),OH=ee(()=>{const a=mg(),{handlers:{t:d}}=Wk.default.useContext(ji),l=Za("TextStyle"),K=l.every(ja=>500<ja.props.fontWeight),da=l.every(ja=>ja.props.italic);return(0,Eh.jsxs)("span",
{className:"flex gap-1",children:[(0,Eh.jsx)(Ne,{tooltip:d("whiteboard/bold"),className:"tl-button",pressed:K,onPressedChange:ja=>{l.forEach(ra=>{ra.update({fontWeight:ja?700:400});ra.onResetBounds()});a.persist()},children:(0,Eh.jsx)(Qg,{name:"bold"})}),(0,Eh.jsx)(Ne,{tooltip:d("whiteboard/italic"),className:"tl-button",pressed:da,onPressedChange:ja=>{l.forEach(ra=>{ra.update({italic:ja});ra.onResetBounds()});a.persist()},children:(0,Eh.jsx)(Qg,{name:"italic"})})]})}),PH=ee(()=>{var a;const d=mg(),
l=d.selectedShapesArray[0];return(0,Eh.jsx)(dw,{onRefsChange:K=>{l.update({refs:K});d.persist()},refs:null!=(a=l.props.refs)?a:[],shapeType:l.props.type,side:"right",pageId:"logseq-portal"===l.props.type?l.props.pageId:void 0,portalType:"logseq-portal"===l.props.type?l.props.blockType:void 0})});zm.set("Geometry",MH);zm.set("AutoResizing",EH);zm.set("LogseqPortalViewMode",FH);zm.set("ScaleLevel",GH);zm.set("YoutubeLink",Yo);zm.set("TwitterLink",IH);zm.set("IFrameSource",HH);zm.set("NoFill",KH);zm.set("Swatch",
LH);zm.set("StrokeType",NH);zm.set("ArrowMode",$C);zm.set("TextStyle",OH);zm.set("Links",PH);zm.set("EditPdf",JH);var aD=a=>{var d;return(null!=(d=Iy[a])?d:[]).filter(cg)},bD=a=>{const d=a.map(K=>K.props.type),l=new Set(0<a.length?aD(d[0]):[]);for(let K=1;K<d.length&&0<l.size;K++){const da=aD(d[K]);l.forEach(ja=>{da.includes(ja)||l.delete(ja)})}1<a.length&&ZC.forEach(K=>{l.has(K)&&l.delete(K)});return Array.from(l).sort((K,da)=>vu.indexOf(K)-vu.indexOf(da)).map(K=>zm.get(K))},wu=aa(616),QH=ee(({shapes:a,
offsets:d,hidden:l})=>{const K=mg(),da=sn.useRef(null),ja=sn.useRef(null);sn.useLayoutEffect(()=>{setTimeout(()=>{const Ka=ja.current;if(Ka){var {offsetWidth:Sa,offsetHeight:bb}=Ka;da.current=[Sa,bb]}})});sn.useLayoutEffect(()=>{var Ka;const Sa=ja.current;if(Sa){var bb=null!=(Ka=da.current)?Ka:[0,0];Ka=0;if(116>d.top){var gb=d.height/2+40;140>d.bottom&&(gb+=d.bottom-140)}else gb=-(d.height/2+40);16>d.left+d.width/2-bb[0]/2?Ka+=-(d.left+d.width/2-bb[0]/2-16):16>d.right+d.width/2-bb[0]/2&&(Ka+=d.right+
d.width/2-bb[0]/2-16);var [jb,Jb]=[Ka,gb];Sa.style.transform=`translateX(${jb}px) translateY(${Jb}px)`}},[d]);if(!K)return null;const ra=bD(a);return(0,wu.jsx)(ln,{centered:!0,children:0<ra.length&&(0,wu.jsx)("div",{ref:ja,className:"tl-toolbar tl-context-bar",style:{visibility:l?"hidden":"visible",pointerEvents:l?"none":"all"},children:ra.map((Ka,Sa)=>(0,wu.jsxs)(sn.Fragment,{children:[(0,wu.jsx)(Ka,{}),Sa<ra.length-1&&(0,wu.jsx)(gq,{className:"tl-toolbar-separator",orientation:"vertical"})]},Sa))})})}),
ew=Kf(aa(0)),vf=aa(616),Vi=window.LSUI,cD=ee(function({children:a,collisionRef:d}){var l,K,da,ja,ra,Ka,Sa,bb,gb,jb,Jb,Ob,Lb,gc,rc,Wb,kc;const hc=mg(),{handlers:Fc}=ew.useContext(ji),Lc=Fc.t,ud=ew.useRef(null),Jd=Sd=>{Sd();hc.transition("select")},Ee=ew.useMemo(()=>wf(),[]);return(0,vf.jsxs)(Vi.ContextMenu,{onOpenChange:Sd=>{Sd&&!hc.isIn("select.contextMenu")?hc.transition("select").selectedTool.transition("contextMenu"):!Sd&&hc.isIn("select.contextMenu")&&hc.selectedTool.transition("idle")},children:[(0,vf.jsx)(Vi.ContextMenuTrigger,
{disabled:hc.editingShape&&0!==Object.keys(hc.editingShape).length,children:a}),(0,vf.jsx)(Vi.ContextMenuContent,{className:"tl-menu tl-context-menu",ref:ud,onEscapeKeyDown:()=>hc.transition("select"),collisionBoundary:d.current,asChild:!0,tabIndex:-1,children:(0,vf.jsxs)("div",{children:[1<(null==(l=hc.selectedShapes)?void 0:l.size)&&!hc.readOnly&&(null==(K=hc.selectedShapesArray)?void 0:K.some(Sd=>!Sd.props.isLocked))&&(0,vf.jsxs)(vf.Fragment,{children:[(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-button-row-wrap",
children:[(0,vf.jsxs)("div",{className:"tl-menu-button-row pb-0",children:[(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/align-left"),onClick:()=>Jd(()=>hc.align("left")),children:(0,vf.jsx)(Qg,{name:"layout-align-left"})}),(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/align-center-horizontally"),onClick:()=>Jd(()=>hc.align("centerHorizontal")),children:(0,vf.jsx)(Qg,{name:"layout-align-center"})}),(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/align-right"),onClick:()=>Jd(()=>hc.align("right")),children:(0,vf.jsx)(Qg,{name:"layout-align-right"})}),
(0,vf.jsx)(gq,{className:"tl-toolbar-separator",orientation:"vertical"}),(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/distribute-horizontally"),onClick:()=>Jd(()=>hc.distribute("horizontal")),children:(0,vf.jsx)(Qg,{name:"layout-distribute-vertical"})})]}),(0,vf.jsxs)("div",{className:"tl-menu-button-row pt-0",children:[(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/align-top"),onClick:()=>Jd(()=>hc.align("top")),children:(0,vf.jsx)(Qg,{name:"layout-align-top"})}),(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/align-center-vertically"),
onClick:()=>Jd(()=>hc.align("centerVertical")),children:(0,vf.jsx)(Qg,{name:"layout-align-middle"})}),(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/align-bottom"),onClick:()=>Jd(()=>hc.align("bottom")),children:(0,vf.jsx)(Qg,{name:"layout-align-bottom"})}),(0,vf.jsx)(gq,{className:"tl-toolbar-separator",orientation:"vertical"}),(0,vf.jsx)(Yd,{tooltip:Lc("whiteboard/distribute-vertically"),onClick:()=>Jd(()=>hc.distribute("vertical")),children:(0,vf.jsx)(Qg,{name:"layout-distribute-horizontal"})})]})]}),(0,vf.jsx)(Vi.ContextMenuSeparator,
{className:"menu-separator"}),(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.packIntoRectangle),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"layout-grid"}),Lc("whiteboard/pack-into-rectangle")]}),(0,vf.jsx)(Vi.ContextMenuSeparator,{className:"menu-separator"})]}),0<(null==(da=hc.selectedShapes)?void 0:da.size)&&(0,vf.jsxs)(vf.Fragment,{children:[(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.api.zoomToSelection),children:[(0,vf.jsx)(Qg,
{className:"tl-menu-icon",name:"circle-dotted"}),Lc("whiteboard/zoom-to-fit"),(0,vf.jsx)(hl,{action:"whiteboard/zoom-to-fit"})]}),(0,vf.jsx)(Vi.ContextMenuSeparator,{className:"menu-separator"})]}),(hc.selectedShapesArray.some(Sd=>"group"===Sd.type||hc.getParentGroup(Sd))||1<hc.selectedShapesArray.length)&&(null==(ja=hc.selectedShapesArray)?void 0:ja.some(Sd=>!Sd.props.isLocked))&&!hc.readOnly&&(0,vf.jsxs)(vf.Fragment,{children:[hc.selectedShapesArray.some(Sd=>"group"===Sd.type||hc.getParentGroup(Sd))&&
(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.api.unGroup),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"ungroup"}),Lc("whiteboard/ungroup"),(0,vf.jsx)(hl,{action:"whiteboard/ungroup"})]}),1<hc.selectedShapesArray.length&&(null==(ra=hc.selectedShapesArray)?void 0:ra.some(Sd=>!Sd.props.isLocked))&&(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.api.doGroup),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"group"}),Lc("whiteboard/group"),
(0,vf.jsx)(hl,{action:"whiteboard/group"})]}),(0,vf.jsx)(Vi.ContextMenuSeparator,{className:"menu-separator"})]}),0<(null==(Ka=hc.selectedShapes)?void 0:Ka.size)&&(null==(Sa=hc.selectedShapesArray)?void 0:Sa.some(Sd=>!Sd.props.isLocked))&&(0,vf.jsxs)(vf.Fragment,{children:[!hc.readOnly&&(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.cut),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"cut"}),Lc("whiteboard/cut")]}),(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",
onClick:()=>Jd(hc.copy),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"copy"}),Lc("whiteboard/copy"),(0,vf.jsx)(hl,{action:"editor/copy"})]})]}),!hc.readOnly&&(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.paste),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"clipboard"}),Lc("whiteboard/paste"),(0,vf.jsx)(hl,{shortcut:`${gA}+v`})]}),1===(null==(bb=hc.selectedShapes)?void 0:bb.size)&&!hc.readOnly&&(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",
onClick:()=>Jd(()=>hc.paste(void 0,!0)),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"circle-dotted"}),Lc("whiteboard/paste-as-link"),(0,vf.jsx)(hl,{shortcut:`${gA}+\u21E7+v`})]}),0<(null==(gb=hc.selectedShapes)?void 0:gb.size)&&(0,vf.jsxs)(vf.Fragment,{children:[(0,vf.jsx)(Vi.ContextMenuSeparator,{className:"menu-separator"}),(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(()=>{var Sd,De;return Fc.exportToImage(hc.currentPageId,{x:hc.selectionBounds.minX+hc.viewport.camera.point[0]-
8,y:hc.selectionBounds.minY+hc.viewport.camera.point[1]-8,width:(null==(Sd=hc.selectionBounds)?void 0:Sd.width)+16,height:(null==(De=hc.selectionBounds)?void 0:De.height)+16,zoom:hc.viewport.camera.zoom})}),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"file-export"}),Lc("whiteboard/export"),(0,vf.jsx)("div",{className:"tl-menu-right-slot",children:(0,vf.jsx)("span",{className:"keyboard-shortcut"})})]})]}),(0,vf.jsx)(Vi.ContextMenuSeparator,{className:"menu-separator"}),(0,vf.jsxs)(Vi.ContextMenuItem,
{className:"tl-menu-item",onClick:()=>Jd(hc.api.selectAll),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"circle-dotted"}),Lc("whiteboard/select-all"),(0,vf.jsx)(hl,{action:"editor/select-parent"})]}),1<(null==(jb=hc.selectedShapes)?void 0:jb.size)&&(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.api.deselectAll),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"circle-dotted"}),Lc("whiteboard/deselect-all")]}),!hc.readOnly&&0<(null==(Jb=hc.selectedShapes)?
void 0:Jb.size)&&(null==(Ob=hc.selectedShapesArray)?void 0:Ob.some(Sd=>!Sd.props.isLocked))&&(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(()=>hc.setLocked(!0)),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"lock"}),Lc("whiteboard/lock"),(0,vf.jsx)(hl,{action:"whiteboard/lock"})]}),!hc.readOnly&&0<(null==(Lb=hc.selectedShapes)?void 0:Lb.size)&&(null==(gc=hc.selectedShapesArray)?void 0:gc.some(Sd=>Sd.props.isLocked))&&(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",
onClick:()=>Jd(()=>hc.setLocked(!1)),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"lock-open"}),Lc("whiteboard/unlock"),(0,vf.jsx)(hl,{action:"whiteboard/unlock"})]}),0<(null==(rc=hc.selectedShapes)?void 0:rc.size)&&!hc.readOnly&&(null==(Wb=hc.selectedShapesArray)?void 0:Wb.some(Sd=>!Sd.props.isLocked))&&(0,vf.jsxs)(vf.Fragment,{children:[(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.api.deleteShapes),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"backspace"}),
Lc("whiteboard/delete"),(0,vf.jsx)(hl,{action:"editor/delete"})]}),1<(null==(kc=hc.selectedShapes)?void 0:kc.size)&&!hc.readOnly&&(0,vf.jsxs)(vf.Fragment,{children:[(0,vf.jsx)(Vi.ContextMenuSeparator,{className:"menu-separator"}),(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.flipHorizontal),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"flip-horizontal"}),Lc("whiteboard/flip-horizontally")]}),(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>
Jd(hc.flipVertical),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"flip-vertical"}),Lc("whiteboard/flip-vertically")]})]}),!hc.readOnly&&(0,vf.jsxs)(vf.Fragment,{children:[(0,vf.jsx)(Vi.ContextMenuSeparator,{className:"menu-separator"}),(0,vf.jsxs)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>Jd(hc.bringToFront),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"circle-dotted"}),Lc("whiteboard/move-to-front"),(0,vf.jsx)(hl,{action:"whiteboard/bring-to-front"})]}),(0,vf.jsxs)(Vi.ContextMenuItem,
{className:"tl-menu-item",onClick:()=>Jd(hc.sendToBack),children:[(0,vf.jsx)(Qg,{className:"tl-menu-icon",name:"circle-dotted"}),Lc("whiteboard/move-to-back"),(0,vf.jsx)(hl,{action:"whiteboard/send-to-back"})]})]}),Ee&&(0,vf.jsx)(Vi.ContextMenuItem,{className:"tl-menu-item",onClick:()=>{1===hc.selectedShapesArray.length?console.log(jc(hc.selectedShapesArray[0].serialized)):console.log(hc.selectedShapesArray.map(Sd=>jc(Sd.serialized)))},children:Lc("whiteboard/dev-print-shape-props")})]})]})})]})}),
Jy=Kf(aa(0)),Fr=aa(616),xu=ee(({shape:a})=>{const d=mg(),{handlers:l}=Jy.default.useContext(ji),K=l.t,da=Jy.default.useMemo(()=>{var ja;const ra=[...(null!=(ja=a.props.refs)?ja:[])].map(Ka=>[Ka,!0]);"logseq-portal"===a.props.type&&a.props.pageId&&ra.unshift([a.props.pageId,!1]);return ra.filter(Ka=>Ka[0].toLowerCase()!==d.currentPage.name&&l.getBlockPageName(Ka[0])!==d.currentPage.name)},[a.props.id,a.props.type,a.props.parentId,a.props.refs]);return 0===da.length?null:(0,Fr.jsx)("div",{className:"tl-quick-links",
title:K("whiteboard/shape-quick-links"),children:da.map(([ja,ra])=>(0,Fr.jsx)("div",{className:"tl-quick-links-row",children:(0,Fr.jsx)(ly,{id:ja,showReferenceContent:ra})},ja))})}),Ky=Kf(aa(0)),fw=Kf(aa(0)),dD={image:[".png",".svg",".jpg",".jpeg",".gif"],video:[".mp4",".webm",".ogg"],pdf:[".pdf"]},RH=(a,d,l)=>Oh(void 0,[a,d,l],function*(K,{point:da,shiftKey:ja,dataTransfer:ra,fromDrop:Ka},Sa){function bb(jd,Cd){return Oh(this,null,function*(){const Me=Object.values(K.assets).find(af=>af.src===jd);
return Me?Me:{id:qk(),type:Cd,src:jd,size:yield lj(Sa.makeAssetUrl(jd),Cd)}})}function gb(jd){return Oh(this,null,function*(){const Cd=jd.filter(Me=>"unknown"!==Rb(Me.name)).map(Me=>Oh(this,null,function*(){try{const af=yield Sa.saveAsset(Me);return yield bb(af,Rb(Me.name))}catch(af){console.error(af)}return null}));return(yield Promise.all(Cd)).filter(cg)})}function jb(jd){return[ff(Zd({},qo.defaultProps),{html:jd,point:[da[0],da[1]]})]}function Jb(jd){return Oh(this,null,function*(){return tc(Lb,
gc,kc,Wb,hc,rc,Ee)(jd)})}function Ob(){return Oh(this,null,function*(){const jd=yield navigator.clipboard.read(),Cd=tc(hc,rc,Ee);return(yield Promise.all(jd.map(Me=>Cd(Me)))).flat().filter(cg)})}function Lb(jd){return Oh(this,null,function*(){var Cd=jd.getData("file");if(!Cd)return null;const Me=yield bb(Cd,"pdf");K.addAssets([Me]);Cd=ff(Zd({},uo.defaultProps),{id:qk(),assetId:Me.id,url:Cd,opacity:1});Me.size&&Object.assign(Cd,{point:[da[0]-Me.size[0]/4+16,da[1]-Me.size[1]/4+16],size:be.div(Me.size,
2)});return[Cd]})}function gc(jd){return Oh(this,null,function*(){var Cd=Array.from(jd.files);return 0<Cd.length?(gf=Cd=yield gb(Cd),Cd.map((Me,af)=>{switch(Me.type){case "video":var Nf=vq.defaultProps;break;case "image":Nf=mu.defaultProps;break;case "pdf":Nf=uo.defaultProps;break;default:return null}Nf=ff(Zd({},Nf),{id:qk(),assetId:Me.id,opacity:1});Me.size&&Object.assign(Nf,{point:[da[0]-Me.size[0]/4+16*af,da[1]-Me.size[1]/4+16*af],size:be.div(Me.size,2)});return Nf})):null})}function rc(jd){return Oh(this,
null,function*(){if(jd.types.includes("text/plain")&&(ja||Ka))return null;const Cd=yield Kc(jd,"text/html");return Cd?tc(Fc,jb)(Cd):null})}function Wb(jd){return Oh(this,null,function*(){var Cd,Me,af,Nf,bg,ef,Eg=jd.getData("block-uuid");if(Eg){Eg=Eg.trim();const yf=null==(af=null==(Me=null==(Cd=window.logseq)?void 0:Cd.api)?void 0:Me.get_selected_blocks)?void 0:af.call(Me);Cd=yf&&1<(null==yf?void 0:yf.length)?yf.map(Fg=>Fg.uuid):[Eg];null==(ef=null==(bg=null==(Nf=window.logseq)?void 0:Nf.api)?void 0:
bg.set_blocks_id)?void 0:ef.call(bg,Cd);Nf=Cd.map(Fg=>Jd(`((${Fg}))`));return(yield Promise.all(Nf)).flat().filter(cg).map((Fg,Gg)=>ff(Zd({},Fg),{point:[da[0]+(Qj.defaultProps.size[0]+16)*Gg,da[1]]}))}return null})}function kc(jd){return Oh(this,null,function*(){var Cd=jd.getData("page-name");return Cd?(Cd=Cd.trim(),Jd(`[[${Cd}]]`)):null})}function hc(jd){return Oh(this,null,function*(){var Cd=yield Kc(jd,"text/plain");return Cd?(Cd=Cd.trim(),tc(Lc,ud)(Cd)):null})}function Fc(jd){if(jd=K.api.getClonedShapesFromTldrString(decodeURIComponent(jd),
da)){const {shapes:Cd,assets:Me,bindings:af}=jd;Te.push(...Me);df.push(...af);return Cd}return null}function Lc(jd){return Oh(this,null,function*(){try{const Me=new URL(jd);var Cd=Me.host&&["http:","https:"].includes(Me.protocol)}catch(Me){Cd=!1}return Cd&&!ja?qu.test(jd)?[ff(Zd({},zp.defaultProps),{url:jd,point:[da[0],da[1]]})]:$v.test(jd)?[ff(Zd({},Cr.defaultProps),{url:jd,point:[da[0],da[1]]})]:[ff(Zd({},tq.defaultProps),{url:jd,point:[da[0],da[1]]})]:null})}function ud(jd){return jd.startsWith("\x3ciframe")?
[ff(Zd({},qo.defaultProps),{html:jd,point:[da[0],da[1]]})]:null}function Jd(jd){return Oh(this,null,function*(){if(/^\(\(.*\)\)$/.test(jd)&&40===jd.length){var Cd=jd.slice(2,-2);if(Dj(Cd))return[ff(Zd({},Qj.defaultProps),{point:[da[0],da[1]],size:[400,0],pageId:Cd,fill:K.settings.color,stroke:K.settings.color,scaleLevel:K.settings.scaleLevel,blockType:"B"})]}else if(/^\[\[.*\]\]$/.test(jd))return Cd=jd.slice(2,-2),[ff(Zd({},Qj.defaultProps),{point:[da[0],da[1]],size:[400,0],pageId:Cd,fill:K.settings.color,
stroke:K.settings.color,scaleLevel:K.settings.scaleLevel,blockType:"P"})];return null})}function Ee(jd){return Oh(this,null,function*(){var Cd=yield Kc(jd,"text/plain");return Cd&&(Cd=Cd.trim(),Cd=null==Sa?void 0:Sa.addNewBlock(Cd))?[ff(Zd({},Qj.defaultProps),{size:[400,0],point:[da[0],da[1]],pageId:Cd,fill:K.settings.color,stroke:K.settings.color,scaleLevel:K.settings.scaleLevel,blockType:"B",compact:!0})]:null})}var Sd,De;let gf=[],Te=[];const df=[];K.cursors.setCursor("progress");let Gd=[];try{ra?
Gd.push(...(null!=(Sd=yield Jb(ra))?Sd:[])):Gd.push(...(null!=(De=yield Ob())?De:[]))}catch(jd){console.error(jd)}const od=Gd.map(jd=>ff(Zd({},jd),{parentId:K.currentPageId,isLocked:!1,id:Dj(jd.id)?jd.id:qk()})),Dd=null==ra?void 0:ra.types.every(jd=>"Files"===jd);K.wrapUpdate(()=>{var jd=[...gf,...Te];0<jd.length&&K.createAssets(jd);0<od.length&&K.createShapes(od);K.currentPage.updateBindings(Object.fromEntries(df.map(Cd=>[Cd.id,Cd])));if(1===K.selectedShapesArray.length&&1===od.length&&Ka){jd=K.selectedShapesArray[0];
const Cd=K.getShapeById(od[0].id);K.createNewLineBinding(jd,Cd)}K.setSelectedShapes(od.map(Cd=>Cd.id));K.selectedTool.transition("idle");K.cursors.setCursor("default");(Ka||Dd)&&K.packIntoRectangle()})}),Ly=Kf(aa(0)),xq=Kf(aa(0)),Tl=aa(616),eD=[Al,Dr,Fy,Sl,Ey,Bl,Wn,Gy,QC,rh,cw,gm],fD=a=>{const {renderers:d}=ps.useContext(ji);return(0,Tl.jsx)(d.BacklinksCount,ff(Zd({},a),{options:{"portal?":!1}}))},SH=()=>{const a=ps.useRef(null),d=mg(),l=ps.useMemo(()=>({ContextBar:QH,BacklinksCount:fD,QuickLinks:xu}),
[]);return(0,Tl.jsx)(cD,{collisionRef:a,children:(0,Tl.jsx)("div",{ref:a,className:"logseq-tldraw logseq-tldraw-wrapper","data-tlapp":d.uuid,children:(0,Tl.jsx)(XF,{components:l,children:(0,Tl.jsx)(nC,{})})})})},TH=a=>{var {onPersist:d,readOnly:l,model:K}=a;a=Jf(a,["onPersist","readOnly","model"]);const da=Md(),ja=xd(),ra=de(),Ka=l?null:Be(),Sa=ps.useCallback((bb,gb)=>{null==d?void 0:d(bb,gb)},[K]);return(0,Tl.jsx)(TF,ff(Zd({Shapes:bw,Tools:eD,onDrop:da,onPaste:ja,onCopy:ra,readOnly:l,onCanvasDBClick:Ka,
onPersist:Sa,model:K},a),{children:(0,Tl.jsx)(SH,{})}))},Cp=function(a){var {renderers:d,handlers:l}=a;a=Jf(a,["renderers","handlers"]);const K={renderers:ps.useMemo(()=>Object.fromEntries(Object.entries(d).map(([da,ja])=>[da,ps.memo(ja)])),[]),handlers:l};return(0,Tl.jsx)(ji.Provider,{value:K,children:(0,Tl.jsx)(TH,Zd({},a))})}};
'use strict';
var $frontend$handler$whiteboard$cleanup_BANG_$$ = function($tl_page$jscomp$2$$) {
  $tl_page$jscomp$2$$.cleanup($APP.$cljs$core$map$$.$cljs$core$IFn$_invoke$arity$2$(function($p1__88114_SHARP_$$) {
    return $p1__88114_SHARP_$$.id;
  }, $tl_page$jscomp$2$$.shapes));
}, $frontend$handler$whiteboard$js__GT_clj_keywordize$$ = function($obj$jscomp$195$$) {
  return $APP.$cljs$core$js__GT_clj$$.$cljs$core$IFn$_invoke$arity$variadic$($obj$jscomp$195$$, $APP.$cljs$core$prim_seq$cljs$0core$0IFn$0_invoke$0arity$02$$([$APP.$cljs$cst$keyword$keywordize_DASH_keys$$, !0]));
}, $frontend$handler$whiteboard$get_onboard_whiteboard_edn$$ = function() {
  return $APP.$promesa$core$bind$cljs$0core$0IFn$0_invoke$0arity$02$$(null, function() {
    return $APP.$promesa$core$bind$cljs$0core$0IFn$0_invoke$0arity$02$$(fetch("./whiteboard/onboarding.edn"), function($res$jscomp$67$$) {
      return $APP.$promesa$core$bind$cljs$0core$0IFn$0_invoke$0arity$02$$($res$jscomp$67$$.text(), function($text$jscomp$75$$) {
        return $APP.$promesa$core$bind$cljs$0core$0IFn$0_invoke$0arity$02$$($APP.$logseq$graph_parser$util$safe_read_string$cljs$0core$0IFn$0_invoke$0arity$02$$($APP.$cljs$core$PersistentArrayMap$EMPTY$$, $text$jscomp$75$$), function($edn$$) {
          return $APP.$promesa$protocols$_promise$$($edn$$);
        });
      });
    });
  });
}, $frontend$handler$whiteboard$build_page_block$$ = function($page_name$jscomp$84$$, $JSCompiler_temp_const$jscomp$12238_tldraw_page$$, $JSCompiler_temp_const$jscomp$12237_assets$jscomp$3$$, $shapes_index$jscomp$1$$) {
  var $JSCompiler_inline_result$jscomp$12239_or__5043__auto__$jscomp$inline_15422_page_entity$jscomp$5$$ = $APP.$frontend$db$model$get_page$$($page_name$jscomp$84$$);
  $JSCompiler_temp_const$jscomp$12238_tldraw_page$$ = new $APP.$cljs$core$PersistentArrayMap$$(null, 2, [$APP.$cljs$cst$keyword$ls_DASH_type$$, $APP.$cljs$cst$keyword$whiteboard_DASH_page$$, $APP.$cljs$cst$keyword$logseq_DOT_tldraw_DOT_page$$, new $APP.$cljs$core$PersistentArrayMap$$(null, 6, [$APP.$cljs$cst$keyword$id$$, $APP.$module$contents$goog$object_get$$($JSCompiler_temp_const$jscomp$12238_tldraw_page$$, "id"), $APP.$cljs$cst$keyword$name$$, $APP.$module$contents$goog$object_get$$($JSCompiler_temp_const$jscomp$12238_tldraw_page$$, 
  "name"), $APP.$cljs$cst$keyword$bindings$$, $frontend$handler$whiteboard$js__GT_clj_keywordize$$($APP.$module$contents$goog$object_get$$($JSCompiler_temp_const$jscomp$12238_tldraw_page$$, "bindings")), $APP.$cljs$cst$keyword$nonce$$, $APP.$module$contents$goog$object_get$$($JSCompiler_temp_const$jscomp$12238_tldraw_page$$, "nonce"), $APP.$cljs$cst$keyword$assets$$, $frontend$handler$whiteboard$js__GT_clj_keywordize$$($JSCompiler_temp_const$jscomp$12237_assets$jscomp$3$$), $APP.$cljs$cst$keyword$shapes_DASH_index$$, 
  $shapes_index$jscomp$1$$], null)], null);
  $JSCompiler_temp_const$jscomp$12237_assets$jscomp$3$$ = $APP.$frontend$util$time_ms$$();
  $JSCompiler_inline_result$jscomp$12239_or__5043__auto__$jscomp$inline_15422_page_entity$jscomp$5$$ = $APP.$cljs$cst$keyword$block_SLASH_created_DASH_at$$.$cljs$core$IFn$_invoke$arity$1$($JSCompiler_inline_result$jscomp$12239_or__5043__auto__$jscomp$inline_15422_page_entity$jscomp$5$$);
  $JSCompiler_inline_result$jscomp$12239_or__5043__auto__$jscomp$inline_15422_page_entity$jscomp$5$$ = $APP.$cljs$core$truth_$$($JSCompiler_inline_result$jscomp$12239_or__5043__auto__$jscomp$inline_15422_page_entity$jscomp$5$$) ? $JSCompiler_inline_result$jscomp$12239_or__5043__auto__$jscomp$inline_15422_page_entity$jscomp$5$$ : $APP.$frontend$util$time_ms$$();
  return new $APP.$cljs$core$PersistentArrayMap$$(null, 5, [$APP.$cljs$cst$keyword$block_SLASH_name$$, $page_name$jscomp$84$$, $APP.$cljs$cst$keyword$block_SLASH_type$$, "whiteboard", $APP.$cljs$cst$keyword$block_SLASH_properties$$, $JSCompiler_temp_const$jscomp$12238_tldraw_page$$, $APP.$cljs$cst$keyword$block_SLASH_updated_DASH_at$$, $JSCompiler_temp_const$jscomp$12237_assets$jscomp$3$$, $APP.$cljs$cst$keyword$block_SLASH_created_DASH_at$$, $JSCompiler_inline_result$jscomp$12239_or__5043__auto__$jscomp$inline_15422_page_entity$jscomp$5$$], 
  null);
}, $frontend$handler$whiteboard$compute_tx$$ = function($app$jscomp$3_assets$jscomp$4$$, $tl_page$$, $created_shapes_new_id_nonces$$, $db_id_nonces_deleted_shapes_old_ids$$, $page_name$jscomp$85$$, $replace_QMARK_$$) {
  $app$jscomp$3_assets$jscomp$4$$ = $frontend$handler$whiteboard$js__GT_clj_keywordize$$($app$jscomp$3_assets$jscomp$4$$.getCleanUpAssets());
  var $new_shapes_upsert_shapes$$ = $tl_page$$.shapes, $shapes_index$jscomp$2$$ = $APP.$cljs$core$map$$.$cljs$core$IFn$_invoke$arity$2$(function($p1__88013_SHARP_$$) {
    return $APP.$module$contents$goog$object_get$$($p1__88013_SHARP_$$, "id");
  }, $new_shapes_upsert_shapes$$), $shape_id__GT_index$jscomp$1$$ = $APP.$cljs$core$zipmap$$($shapes_index$jscomp$2$$, $APP.$cljs$core$range$$.$cljs$core$IFn$_invoke$arity$1$($new_shapes_upsert_shapes$$.length));
  $new_shapes_upsert_shapes$$ = $APP.$cljs$core$set$$($APP.$cljs$core$map$$.$cljs$core$IFn$_invoke$arity$2$(function($id$jscomp$222_map__88019__$1_p__88018$$) {
    $id$jscomp$222_map__88019__$1_p__88018$$ = $APP.$cljs$core$__destructure_map$$($id$jscomp$222_map__88019__$1_p__88018$$);
    $id$jscomp$222_map__88019__$1_p__88018$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($id$jscomp$222_map__88019__$1_p__88018$$, $APP.$cljs$cst$keyword$id$$);
    return $APP.$cljs$core$assoc$$.$cljs$core$IFn$_invoke$arity$3$($frontend$handler$whiteboard$js__GT_clj_keywordize$$($tl_page$$.getShapeById($id$jscomp$222_map__88019__$1_p__88018$$).serialized), $APP.$cljs$cst$keyword$index$$, $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($shape_id__GT_index$jscomp$1$$, $id$jscomp$222_map__88019__$1_p__88018$$));
  }, $APP.$clojure$set$difference$$.$cljs$core$IFn$_invoke$arity$2$($created_shapes_new_id_nonces$$, $db_id_nonces_deleted_shapes_old_ids$$)));
  $db_id_nonces_deleted_shapes_old_ids$$ = $APP.$cljs$core$set$$($APP.$cljs$core$map$$.$cljs$core$IFn$_invoke$arity$2$($APP.$cljs$cst$keyword$id$$, $db_id_nonces_deleted_shapes_old_ids$$));
  var $deleted_shapes_tx_new_ids$$ = $APP.$cljs$core$set$$($APP.$cljs$core$map$$.$cljs$core$IFn$_invoke$arity$2$($APP.$cljs$cst$keyword$id$$, $created_shapes_new_id_nonces$$)), $created_ids$$ = $APP.$cljs$core$set$$($APP.$cljs$core$remove$$.$cljs$core$IFn$_invoke$arity$2$($APP.$clojure$string$blank_QMARK_$$, $APP.$clojure$set$difference$$.$cljs$core$IFn$_invoke$arity$2$($deleted_shapes_tx_new_ids$$, $db_id_nonces_deleted_shapes_old_ids$$)));
  $created_shapes_new_id_nonces$$ = $APP.$cljs$core$set$$($APP.$cljs$core$filter$$.$cljs$core$IFn$_invoke$arity$2$(function($G__88020_p1__88014_SHARP_$$) {
    $G__88020_p1__88014_SHARP_$$ = $APP.$cljs$cst$keyword$id$$.$cljs$core$IFn$_invoke$arity$1$($G__88020_p1__88014_SHARP_$$);
    return $created_ids$$.$cljs$core$IFn$_invoke$arity$1$ ? $created_ids$$.$cljs$core$IFn$_invoke$arity$1$($G__88020_p1__88014_SHARP_$$) : $created_ids$$.call(null, $G__88020_p1__88014_SHARP_$$);
  }, $new_shapes_upsert_shapes$$));
  var $deleted_ids$$ = $APP.$cljs$core$remove$$.$cljs$core$IFn$_invoke$arity$2$($APP.$clojure$string$blank_QMARK_$$, $APP.$clojure$set$difference$$.$cljs$core$IFn$_invoke$arity$2$($db_id_nonces_deleted_shapes_old_ids$$, $deleted_shapes_tx_new_ids$$)), $repo$jscomp$345$$ = $APP.$frontend$state$get_current_repo$$();
  $db_id_nonces_deleted_shapes_old_ids$$ = $APP.$cljs$core$seq$$($deleted_ids$$) ? $APP.$cljs$core$map$$.$cljs$core$IFn$_invoke$arity$2$(function($b$jscomp$350$$) {
    return $APP.$cljs$core$get_in$$.$cljs$core$IFn$_invoke$arity$2$($b$jscomp$350$$, new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$block_SLASH_properties$$, $APP.$cljs$cst$keyword$logseq_DOT_tldraw_DOT_shape$$], null));
  }, function() {
    var $G__88026$$ = new $APP.$cljs$core$PersistentVector$$(null, 1, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$symbol$_STAR_$$], null), $G__88027$$ = $APP.$cljs$core$mapv$$.$cljs$core$IFn$_invoke$arity$2$(function($id$jscomp$223$$) {
      return new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$block_SLASH_uuid$$, $APP.$cljs$core$uuid$$($id$jscomp$223$$)], null);
    }, $deleted_ids$$);
    return $APP.$frontend$db$utils$pull_many$cljs$0core$0IFn$0_invoke$0arity$03$$ ? $APP.$frontend$db$utils$pull_many$cljs$0core$0IFn$0_invoke$0arity$03$$($repo$jscomp$345$$, $G__88026$$, $G__88027$$) : $APP.$frontend$db$utils$pull_many$$.call(null, $repo$jscomp$345$$, $G__88026$$, $G__88027$$);
  }()) : null;
  $deleted_shapes_tx_new_ids$$ = $APP.$cljs$core$mapv$$.$cljs$core$IFn$_invoke$arity$2$(function($id$jscomp$224$$) {
    return new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$db_SLASH_retractEntity$$, new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$block_SLASH_uuid$$, $APP.$cljs$core$uuid$$($id$jscomp$224$$)], null)], null);
  }, $deleted_ids$$);
  var $changed_shapes$$ = $APP.$clojure$set$difference$$.$cljs$core$IFn$_invoke$arity$2$($new_shapes_upsert_shapes$$, $created_shapes_new_id_nonces$$), $prev_changed_blocks$$ = $APP.$cljs$core$seq$$($changed_shapes$$) ? function() {
    var $G__88031$$ = new $APP.$cljs$core$PersistentVector$$(null, 1, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$symbol$_STAR_$$], null), $G__88032$$ = $APP.$cljs$core$mapv$$.$cljs$core$IFn$_invoke$arity$2$(function($shape$jscomp$5$$) {
      return new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$block_SLASH_uuid$$, $APP.$cljs$core$uuid$$($APP.$cljs$cst$keyword$id$$.$cljs$core$IFn$_invoke$arity$1$($shape$jscomp$5$$))], null);
    }, $changed_shapes$$);
    return $APP.$frontend$db$utils$pull_many$cljs$0core$0IFn$0_invoke$0arity$03$$ ? $APP.$frontend$db$utils$pull_many$cljs$0core$0IFn$0_invoke$0arity$03$$($repo$jscomp$345$$, $G__88031$$, $G__88032$$) : $APP.$frontend$db$utils$pull_many$$.call(null, $repo$jscomp$345$$, $G__88031$$, $G__88032$$);
  }() : null;
  return new $APP.$cljs$core$PersistentArrayMap$$(null, 4, [$APP.$cljs$cst$keyword$page_DASH_block$$, $frontend$handler$whiteboard$build_page_block$$($page_name$jscomp$85$$, $tl_page$$, $app$jscomp$3_assets$jscomp$4$$, $shapes_index$jscomp$2$$), $APP.$cljs$cst$keyword$upserted_DASH_blocks$$, $APP.$cljs$core$map$$.$cljs$core$IFn$_invoke$arity$2$(function($block$jscomp$242$$) {
    return $APP.$cljs$core$contains_QMARK_$$($created_ids$$, $APP.$cljs$core$str$$.$cljs$core$IFn$_invoke$arity$1$($APP.$cljs$cst$keyword$block_SLASH_uuid$$.$cljs$core$IFn$_invoke$arity$1$($block$jscomp$242$$))) ? $APP.$cljs$core$assoc$$.$cljs$core$IFn$_invoke$arity$3$($block$jscomp$242$$, $APP.$cljs$cst$keyword$block_SLASH_updated_DASH_at$$, $APP.$frontend$util$time_ms$$()) : $APP.$frontend$modules$outliner$core$block_with_timestamps$$($block$jscomp$242$$);
  }, $APP.$cljs$core$map$$.$cljs$core$IFn$_invoke$arity$2$(function($block$jscomp$inline_11702_p1__88015_SHARP__properties$jscomp$inline_11701$$) {
    $block$jscomp$inline_11702_p1__88015_SHARP__properties$jscomp$inline_11701$$ = new $APP.$cljs$core$PersistentArrayMap$$(null, 2, [$APP.$cljs$cst$keyword$ls_DASH_type$$, $APP.$cljs$cst$keyword$whiteboard_DASH_shape$$, $APP.$cljs$cst$keyword$logseq_DOT_tldraw_DOT_shape$$, $block$jscomp$inline_11702_p1__88015_SHARP__properties$jscomp$inline_11701$$], null);
    $block$jscomp$inline_11702_p1__88015_SHARP__properties$jscomp$inline_11701$$ = new $APP.$cljs$core$PersistentArrayMap$$(null, 3, [$APP.$cljs$cst$keyword$block_SLASH_page$$, new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$block_SLASH_name$$, $APP.$logseq$graph_parser$util$page_name_sanity_lc$$.$cljs$core$IFn$_invoke$arity$1$ ? $APP.$logseq$graph_parser$util$page_name_sanity_lc$$.$cljs$core$IFn$_invoke$arity$1$($page_name$jscomp$85$$) : $APP.$logseq$graph_parser$util$page_name_sanity_lc$$.call(null, 
    $page_name$jscomp$85$$)], null), $APP.$cljs$cst$keyword$block_SLASH_parent$$, new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$block_SLASH_name$$, $page_name$jscomp$85$$], null), $APP.$cljs$cst$keyword$block_SLASH_properties$$, $block$jscomp$inline_11702_p1__88015_SHARP__properties$jscomp$inline_11701$$], null);
    var $additional_props$jscomp$inline_11703$$ = $APP.$logseq$graph_parser$whiteboard$with_whiteboard_block_props$$($block$jscomp$inline_11702_p1__88015_SHARP__properties$jscomp$inline_11701$$, $page_name$jscomp$85$$);
    return $APP.$cljs$core$merge$$.$cljs$core$IFn$_invoke$arity$variadic$($APP.$cljs$core$prim_seq$cljs$0core$0IFn$0_invoke$0arity$02$$([$block$jscomp$inline_11702_p1__88015_SHARP__properties$jscomp$inline_11701$$, $additional_props$jscomp$inline_11703$$]));
  }, $new_shapes_upsert_shapes$$)), $APP.$cljs$cst$keyword$delete_DASH_blocks$$, $deleted_shapes_tx_new_ids$$, $APP.$cljs$cst$keyword$metadata$$, new $APP.$cljs$core$PersistentArrayMap$$(null, 3, [$APP.$cljs$cst$keyword$whiteboard_SLASH_transact_QMARK_$$, $APP.$cljs$core$not$$($replace_QMARK_$$), $APP.$cljs$cst$keyword$replace_QMARK_$$, $replace_QMARK_$$, $APP.$cljs$cst$keyword$data$$, new $APP.$cljs$core$PersistentArrayMap$$(null, 5, [$APP.$cljs$cst$keyword$page_DASH_name$$, $page_name$jscomp$85$$, 
  $APP.$cljs$cst$keyword$deleted_DASH_shapes$$, $db_id_nonces_deleted_shapes_old_ids$$, $APP.$cljs$cst$keyword$new_DASH_shapes$$, $created_shapes_new_id_nonces$$, $APP.$cljs$cst$keyword$changed_DASH_shapes$$, $changed_shapes$$, $APP.$cljs$cst$keyword$prev_DASH_changed_DASH_blocks$$, $prev_changed_blocks$$], null)], null)], null);
}, $frontend$handler$whiteboard$get_whiteboard_blocks$$ = function($blocks$jscomp$129_page_name$jscomp$90$$) {
  $blocks$jscomp$129_page_name$jscomp$90$$ = $APP.$frontend$db$model$get_page_blocks_no_cache$$.$cljs$core$IFn$_invoke$arity$1$($blocks$jscomp$129_page_name$jscomp$90$$);
  return $APP.$cljs$core$remove$$.$cljs$core$IFn$_invoke$arity$2$($APP.$logseq$graph_parser$whiteboard$shape_block_QMARK_$$, $blocks$jscomp$129_page_name$jscomp$90$$);
}, $frontend$handler$whiteboard$get_last_root_block$$ = function($blocks$jscomp$130_blocks_with_no_next_page_name$jscomp$91_root_blocks$$) {
  var $page_id$jscomp$38$$ = $APP.$cljs$cst$keyword$db_SLASH_id$$.$cljs$core$IFn$_invoke$arity$1$($APP.$frontend$db$model$get_page$$($blocks$jscomp$130_blocks_with_no_next_page_name$jscomp$91_root_blocks$$));
  $blocks$jscomp$130_blocks_with_no_next_page_name$jscomp$91_root_blocks$$ = $frontend$handler$whiteboard$get_whiteboard_blocks$$($blocks$jscomp$130_blocks_with_no_next_page_name$jscomp$91_root_blocks$$);
  $blocks$jscomp$130_blocks_with_no_next_page_name$jscomp$91_root_blocks$$ = $APP.$cljs$core$filter$$.$cljs$core$IFn$_invoke$arity$2$(function($block$jscomp$243$$) {
    return $APP.$cljs$core$_EQ_$$.$cljs$core$IFn$_invoke$arity$2$($page_id$jscomp$38$$, $APP.$cljs$cst$keyword$db_SLASH_id$$.$cljs$core$IFn$_invoke$arity$1$($APP.$cljs$cst$keyword$block_SLASH_parent$$.$cljs$core$IFn$_invoke$arity$1$($block$jscomp$243$$)));
  }, $blocks$jscomp$130_blocks_with_no_next_page_name$jscomp$91_root_blocks$$);
  var $root_block_left_ids$$ = $APP.$cljs$core$set$$($APP.$cljs$core$remove$$.$cljs$core$IFn$_invoke$arity$2$($APP.$cljs$core$nil_QMARK_$$, $APP.$cljs$core$map$$.$cljs$core$IFn$_invoke$arity$2$(function($block$jscomp$244$$) {
    return $APP.$cljs$core$get_in$$.$cljs$core$IFn$_invoke$arity$3$($block$jscomp$244$$, new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$block_SLASH_left$$, $APP.$cljs$cst$keyword$db_SLASH_id$$], null), null);
  }, $blocks$jscomp$130_blocks_with_no_next_page_name$jscomp$91_root_blocks$$)));
  $blocks$jscomp$130_blocks_with_no_next_page_name$jscomp$91_root_blocks$$ = $APP.$cljs$core$remove$$.$cljs$core$IFn$_invoke$arity$2$(function($G__88074_p1__88070_SHARP_$$) {
    $G__88074_p1__88070_SHARP_$$ = $APP.$cljs$cst$keyword$db_SLASH_id$$.$cljs$core$IFn$_invoke$arity$1$($G__88074_p1__88070_SHARP_$$);
    return $root_block_left_ids$$.$cljs$core$IFn$_invoke$arity$1$ ? $root_block_left_ids$$.$cljs$core$IFn$_invoke$arity$1$($G__88074_p1__88070_SHARP_$$) : $root_block_left_ids$$.call(null, $G__88074_p1__88070_SHARP_$$);
  }, $blocks$jscomp$130_blocks_with_no_next_page_name$jscomp$91_root_blocks$$);
  return $APP.$cljs$core$seq$$($blocks$jscomp$130_blocks_with_no_next_page_name$jscomp$91_root_blocks$$) ? $APP.$cljs$core$first$$($blocks$jscomp$130_blocks_with_no_next_page_name$jscomp$91_root_blocks$$) : null;
}, $frontend$db$model$get_whiteboard_id_nonces$$ = function($repo$jscomp$99$$, $page_name$jscomp$22$$) {
  return $APP.$cljs$core$map$$.$cljs$core$IFn$_invoke$arity$2$(function($p__49512_uuid$jscomp$7$$) {
    var $map__49513__$1_properties$jscomp$74$$ = $APP.$cljs$core$__destructure_map$$($p__49512_uuid$jscomp$7$$);
    $p__49512_uuid$jscomp$7$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($map__49513__$1_properties$jscomp$74$$, $APP.$cljs$cst$keyword$block_SLASH_uuid$$);
    $map__49513__$1_properties$jscomp$74$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($map__49513__$1_properties$jscomp$74$$, $APP.$cljs$cst$keyword$block_SLASH_properties$$);
    return new $APP.$cljs$core$PersistentArrayMap$$(null, 2, [$APP.$cljs$cst$keyword$id$$, $APP.$cljs$core$str$$.$cljs$core$IFn$_invoke$arity$1$($p__49512_uuid$jscomp$7$$), $APP.$cljs$cst$keyword$nonce$$, $APP.$cljs$core$get_in$$.$cljs$core$IFn$_invoke$arity$2$($map__49513__$1_properties$jscomp$74$$, new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$logseq_DOT_tldraw_DOT_shape$$, $APP.$cljs$cst$keyword$nonce$$], null))], null);
  }, $APP.$cljs$core$filter$$.$cljs$core$IFn$_invoke$arity$2$(function($p1__49510_SHARP_$$) {
    return $APP.$cljs$cst$keyword$logseq_DOT_tldraw_DOT_shape$$.$cljs$core$IFn$_invoke$arity$1$($APP.$cljs$cst$keyword$block_SLASH_properties$$.$cljs$core$IFn$_invoke$arity$1$($p1__49510_SHARP_$$));
  }, $APP.$frontend$db$model$get_page_blocks_no_cache$$.$cljs$core$IFn$_invoke$arity$3$($repo$jscomp$99$$, $page_name$jscomp$22$$, new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$keys$$, new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$block_SLASH_uuid$$, $APP.$cljs$cst$keyword$block_SLASH_properties$$], null)], null))));
}, $frontend$handler$whiteboard$transact_tldr_delta_BANG_$$ = function($page_name$jscomp$86$$, $app$jscomp$4_map__88039_metadata_SINGLEQUOTE___$1_upserted_blocks$$, $delete_blocks$jscomp$5_replace_QMARK_$jscomp$1_tx_data_SINGLEQUOTE_$jscomp$1$$) {
  var $page_block__$1$jscomp$2_tl_page$jscomp$1_tx_data$jscomp$32$$ = $APP.$cljs$core$second$$($APP.$cljs$core$first$$($app$jscomp$4_map__88039_metadata_SINGLEQUOTE___$1_upserted_blocks$$.pages)), $metadata_SINGLEQUOTE__SINGLEQUOTE__new_id_nonces$jscomp$1_pending_tx_data_shapes$jscomp$1$$ = $page_block__$1$jscomp$2_tl_page$jscomp$1_tx_data$jscomp$32$$.shapes, $db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$ = $APP.$frontend$db$model$get_page$$($page_name$jscomp$86$$);
  $db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$ = $APP.$cljs$core$get_in$$.$cljs$core$IFn$_invoke$arity$2$($db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$, new $APP.$cljs$core$PersistentVector$$(null, 3, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$block_SLASH_properties$$, $APP.$cljs$cst$keyword$logseq_DOT_tldraw_DOT_page$$, $APP.$cljs$cst$keyword$shapes_DASH_index$$], null));
  var $shape_id__GT_prev_index$$ = $APP.$cljs$core$zipmap$$($db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$, $APP.$cljs$core$range$$.$cljs$core$IFn$_invoke$arity$1$($APP.$cljs$core$count$$($db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$)));
  $metadata_SINGLEQUOTE__SINGLEQUOTE__new_id_nonces$jscomp$1_pending_tx_data_shapes$jscomp$1$$ = $APP.$cljs$core$set$$($APP.$cljs$core$map_indexed$$.$cljs$core$IFn$_invoke$arity$2$(function($idx$jscomp$156$$, $shape$jscomp$6$$) {
    var $id$jscomp$225$$ = $shape$jscomp$6$$.id;
    return new $APP.$cljs$core$PersistentArrayMap$$(null, 2, [$APP.$cljs$cst$keyword$id$$, $id$jscomp$225$$, $APP.$cljs$cst$keyword$nonce$$, $APP.$cljs$core$_EQ_$$.$cljs$core$IFn$_invoke$arity$2$($idx$jscomp$156$$, $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($shape_id__GT_prev_index$$, $id$jscomp$225$$)) ? $shape$jscomp$6$$.nonce : Date.now()], null);
  }, $metadata_SINGLEQUOTE__SINGLEQUOTE__new_id_nonces$jscomp$1_pending_tx_data_shapes$jscomp$1$$));
  var $repo$jscomp$346$$ = $APP.$frontend$state$get_current_repo$$();
  $db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$ = function() {
    var $or__5043__auto__$jscomp$914$$ = $APP.$cljs$core$get_in$$.$cljs$core$IFn$_invoke$arity$2$($APP.$cljs$core$_deref$$($APP.$frontend$handler$whiteboard$_STAR_last_shapes_nonce$$), new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$repo$jscomp$346$$, $page_name$jscomp$86$$], null));
    return $APP.$cljs$core$truth_$$($or__5043__auto__$jscomp$914$$) ? $or__5043__auto__$jscomp$914$$ : $APP.$cljs$core$set$$($APP.$cljs$core$map$$.$cljs$core$IFn$_invoke$arity$2$(function($p1__88033_SHARP_$$) {
      return $APP.$cljs$core$update$$.$cljs$core$IFn$_invoke$arity$3$($p1__88033_SHARP_$$, $APP.$cljs$cst$keyword$id$$, $APP.$cljs$core$str$$);
    }, $frontend$db$model$get_whiteboard_id_nonces$$($repo$jscomp$346$$, $page_name$jscomp$86$$)));
  }();
  $app$jscomp$4_map__88039_metadata_SINGLEQUOTE___$1_upserted_blocks$$ = $frontend$handler$whiteboard$compute_tx$$($app$jscomp$4_map__88039_metadata_SINGLEQUOTE___$1_upserted_blocks$$, $page_block__$1$jscomp$2_tl_page$jscomp$1_tx_data$jscomp$32$$, $metadata_SINGLEQUOTE__SINGLEQUOTE__new_id_nonces$jscomp$1_pending_tx_data_shapes$jscomp$1$$, $db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$, $page_name$jscomp$86$$, $delete_blocks$jscomp$5_replace_QMARK_$jscomp$1_tx_data_SINGLEQUOTE_$jscomp$1$$);
  $db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$ = $APP.$cljs$core$__destructure_map$$($app$jscomp$4_map__88039_metadata_SINGLEQUOTE___$1_upserted_blocks$$);
  $page_block__$1$jscomp$2_tl_page$jscomp$1_tx_data$jscomp$32$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$, $APP.$cljs$cst$keyword$page_DASH_block$$);
  $app$jscomp$4_map__88039_metadata_SINGLEQUOTE___$1_upserted_blocks$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$, $APP.$cljs$cst$keyword$upserted_DASH_blocks$$);
  $delete_blocks$jscomp$5_replace_QMARK_$jscomp$1_tx_data_SINGLEQUOTE_$jscomp$1$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$, $APP.$cljs$cst$keyword$delete_DASH_blocks$$);
  $db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$, $APP.$cljs$cst$keyword$metadata$$);
  $page_block__$1$jscomp$2_tl_page$jscomp$1_tx_data$jscomp$32$$ = $APP.$cljs$core$concat$$.$cljs$core$IFn$_invoke$arity$variadic$($delete_blocks$jscomp$5_replace_QMARK_$jscomp$1_tx_data_SINGLEQUOTE_$jscomp$1$$, new $APP.$cljs$core$PersistentVector$$(null, 1, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$page_block__$1$jscomp$2_tl_page$jscomp$1_tx_data$jscomp$32$$], null), $APP.$cljs$core$prim_seq$cljs$0core$0IFn$0_invoke$0arity$02$$([$app$jscomp$4_map__88039_metadata_SINGLEQUOTE___$1_upserted_blocks$$]));
  var $metadata_SINGLEQUOTE__new_shapes$jscomp$1$$ = $APP.$cljs$core$get_in$$.$cljs$core$IFn$_invoke$arity$2$($db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$, new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$data$$, $APP.$cljs$cst$keyword$new_DASH_shapes$$], null)), $deleted_shapes$jscomp$1$$ = $APP.$cljs$core$get_in$$.$cljs$core$IFn$_invoke$arity$2$($db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$, 
  new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$data$$, $APP.$cljs$cst$keyword$deleted_DASH_shapes$$], null));
  $metadata_SINGLEQUOTE__new_shapes$jscomp$1$$ = $APP.$cljs$core$truth_$$($APP.$cljs$core$some$$(function($p1__88034_SHARP_$$) {
    return $APP.$cljs$core$_EQ_$$.$cljs$core$IFn$_invoke$arity$2$("group", $APP.$cljs$cst$keyword$type$$.$cljs$core$IFn$_invoke$arity$1$($p1__88034_SHARP_$$));
  }, $metadata_SINGLEQUOTE__new_shapes$jscomp$1$$)) ? $APP.$cljs$core$assoc$$.$cljs$core$IFn$_invoke$arity$3$($db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$, $APP.$cljs$cst$keyword$whiteboard_SLASH_op$$, $APP.$cljs$cst$keyword$group$$) : $APP.$cljs$core$truth_$$(function() {
    var $and__5041__auto__$jscomp$808$$ = $APP.$cljs$core$not_empty$$($deleted_shapes$jscomp$1$$);
    return $APP.$cljs$core$truth_$$($and__5041__auto__$jscomp$808$$) ? $APP.$cljs$core$every_QMARK_$$(function($p1__88035_SHARP_$$) {
      return $APP.$cljs$core$_EQ_$$.$cljs$core$IFn$_invoke$arity$2$("group", $APP.$cljs$cst$keyword$type$$.$cljs$core$IFn$_invoke$arity$1$($p1__88035_SHARP_$$));
    }, $deleted_shapes$jscomp$1$$) : $and__5041__auto__$jscomp$808$$;
  }()) ? $APP.$cljs$core$assoc$$.$cljs$core$IFn$_invoke$arity$3$($db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$, $APP.$cljs$cst$keyword$whiteboard_SLASH_op$$, $APP.$cljs$cst$keyword$un_DASH_group$$) : $APP.$cljs$core$truth_$$($APP.$cljs$core$some$$(function($p1__88037_SHARP_$$) {
    return $APP.$cljs$core$_EQ_$$.$cljs$core$IFn$_invoke$arity$2$("line", $APP.$cljs$cst$keyword$type$$.$cljs$core$IFn$_invoke$arity$1$($p1__88037_SHARP_$$)) && $APP.$cljs$core$_EQ_$$.$cljs$core$IFn$_invoke$arity$2$("arrow ", $APP.$cljs$cst$keyword$end$$.$cljs$core$IFn$_invoke$arity$1$($APP.$cljs$cst$keyword$decorations$$.$cljs$core$IFn$_invoke$arity$1$($p1__88037_SHARP_$$)));
  }, $metadata_SINGLEQUOTE__new_shapes$jscomp$1$$)) ? $APP.$cljs$core$assoc$$.$cljs$core$IFn$_invoke$arity$3$($db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$, $APP.$cljs$cst$keyword$whiteboard_SLASH_op$$, $APP.$cljs$cst$keyword$new_DASH_arrow$$) : $db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$;
  $app$jscomp$4_map__88039_metadata_SINGLEQUOTE___$1_upserted_blocks$$ = $APP.$cljs$core$seq$$($APP.$cljs$core$concat$$.$cljs$core$IFn$_invoke$arity$2$($app$jscomp$4_map__88039_metadata_SINGLEQUOTE___$1_upserted_blocks$$, $delete_blocks$jscomp$5_replace_QMARK_$jscomp$1_tx_data_SINGLEQUOTE_$jscomp$1$$)) ? $metadata_SINGLEQUOTE__new_shapes$jscomp$1$$ : $APP.$cljs$core$assoc$$.$cljs$core$IFn$_invoke$arity$3$($db_id_nonces$jscomp$1_map__88039__$1_metadata$jscomp$5_page_block$jscomp$8_prev_shapes_index$$, 
  $APP.$cljs$cst$keyword$undo_QMARK_$$, !0);
  $APP.$cljs$core$swap_BANG_$$.$cljs$core$IFn$_invoke$arity$4$($APP.$frontend$handler$whiteboard$_STAR_last_shapes_nonce$$, $APP.$cljs$core$assoc_in$$, new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$repo$jscomp$346$$, $page_name$jscomp$86$$], null), $metadata_SINGLEQUOTE__SINGLEQUOTE__new_id_nonces$jscomp$1_pending_tx_data_shapes$jscomp$1$$);
  if ($APP.$cljs$core$contains_QMARK_$$(new $APP.$cljs$core$PersistentHashSet$$(null, new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$new_DASH_arrow$$, null], null), null), $APP.$cljs$cst$keyword$whiteboard_SLASH_op$$.$cljs$core$IFn$_invoke$arity$1$($app$jscomp$4_map__88039_metadata_SINGLEQUOTE___$1_upserted_blocks$$))) {
    return $APP.$frontend$state$set_state_BANG_$$($APP.$cljs$cst$keyword$whiteboard_SLASH_pending_DASH_tx_DASH_data$$, new $APP.$cljs$core$PersistentArrayMap$$(null, 2, [$APP.$cljs$cst$keyword$tx_DASH_data$$, $page_block__$1$jscomp$2_tl_page$jscomp$1_tx_data$jscomp$32$$, $APP.$cljs$cst$keyword$metadata$$, $app$jscomp$4_map__88039_metadata_SINGLEQUOTE___$1_upserted_blocks$$], null));
  }
  $metadata_SINGLEQUOTE__SINGLEQUOTE__new_id_nonces$jscomp$1_pending_tx_data_shapes$jscomp$1$$ = $APP.$cljs$cst$keyword$whiteboard_SLASH_pending_DASH_tx_DASH_data$$.$cljs$core$IFn$_invoke$arity$1$($APP.$cljs$core$_deref$$($APP.$frontend$state$state$$));
  $delete_blocks$jscomp$5_replace_QMARK_$jscomp$1_tx_data_SINGLEQUOTE_$jscomp$1$$ = $APP.$cljs$core$concat$$.$cljs$core$IFn$_invoke$arity$2$($APP.$cljs$cst$keyword$tx_DASH_data$$.$cljs$core$IFn$_invoke$arity$1$($metadata_SINGLEQUOTE__SINGLEQUOTE__new_id_nonces$jscomp$1_pending_tx_data_shapes$jscomp$1$$), $page_block__$1$jscomp$2_tl_page$jscomp$1_tx_data$jscomp$32$$);
  $metadata_SINGLEQUOTE__SINGLEQUOTE__new_id_nonces$jscomp$1_pending_tx_data_shapes$jscomp$1$$ = $APP.$cljs$core$merge$$.$cljs$core$IFn$_invoke$arity$variadic$($APP.$cljs$core$prim_seq$cljs$0core$0IFn$0_invoke$0arity$02$$([$app$jscomp$4_map__88039_metadata_SINGLEQUOTE___$1_upserted_blocks$$, $APP.$cljs$cst$keyword$metadata$$.$cljs$core$IFn$_invoke$arity$1$($metadata_SINGLEQUOTE__SINGLEQUOTE__new_id_nonces$jscomp$1_pending_tx_data_shapes$jscomp$1$$)]));
  $APP.$frontend$state$set_state_BANG_$$($APP.$cljs$cst$keyword$whiteboard_SLASH_pending_DASH_tx_DASH_data$$, $APP.$cljs$core$PersistentArrayMap$EMPTY$$);
  return $APP.$frontend$db$utils$transact_BANG_$cljs$0core$0IFn$0_invoke$0arity$03$$($repo$jscomp$346$$, $delete_blocks$jscomp$5_replace_QMARK_$jscomp$1_tx_data_SINGLEQUOTE_$jscomp$1$$, $metadata_SINGLEQUOTE__SINGLEQUOTE__new_id_nonces$jscomp$1_pending_tx_data_shapes$jscomp$1$$);
}, $frontend$handler$whiteboard$populate_onboarding_whiteboard$$ = function($api$jscomp$3$$) {
  return null != $api$jscomp$3$$ ? $APP.$promesa$core$catch$0$cljs$0core$0IFn$0_invoke$0arity$02$$($APP.$promesa$core$bind$cljs$0core$0IFn$0_invoke$0arity$02$$(null, function() {
    return $APP.$promesa$core$bind$cljs$0core$0IFn$0_invoke$0arity$02$$($frontend$handler$whiteboard$get_onboard_whiteboard_edn$$(), function($JSCompiler_inline_result$jscomp$2405_edn$jscomp$2_pages$jscomp$inline_15429_shapes$jscomp$inline_15432$$) {
      var $assets$jscomp$inline_15434_blocks$jscomp$inline_15430_map__88088__$1$jscomp$inline_15428$$ = $APP.$cljs$core$__destructure_map$$($JSCompiler_inline_result$jscomp$2405_edn$jscomp$2_pages$jscomp$inline_15429_shapes$jscomp$inline_15432$$);
      $JSCompiler_inline_result$jscomp$2405_edn$jscomp$2_pages$jscomp$inline_15429_shapes$jscomp$inline_15432$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($assets$jscomp$inline_15434_blocks$jscomp$inline_15430_map__88088__$1$jscomp$inline_15428$$, $APP.$cljs$cst$keyword$pages$$);
      $assets$jscomp$inline_15434_blocks$jscomp$inline_15430_map__88088__$1$jscomp$inline_15428$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($assets$jscomp$inline_15434_blocks$jscomp$inline_15430_map__88088__$1$jscomp$inline_15428$$, $APP.$cljs$cst$keyword$blocks$$);
      var $bindings$jscomp$inline_15435_page_block$jscomp$inline_15431_tldr_page$jscomp$inline_15433$$ = $APP.$cljs$core$first$$($JSCompiler_inline_result$jscomp$2405_edn$jscomp$2_pages$jscomp$inline_15429_shapes$jscomp$inline_15432$$);
      $JSCompiler_inline_result$jscomp$2405_edn$jscomp$2_pages$jscomp$inline_15429_shapes$jscomp$inline_15432$$ = $APP.$frontend$handler$whiteboard$build_shapes$$($bindings$jscomp$inline_15435_page_block$jscomp$inline_15431_tldr_page$jscomp$inline_15433$$, $assets$jscomp$inline_15434_blocks$jscomp$inline_15430_map__88088__$1$jscomp$inline_15428$$);
      $bindings$jscomp$inline_15435_page_block$jscomp$inline_15431_tldr_page$jscomp$inline_15433$$ = $APP.$logseq$graph_parser$whiteboard$page_block__GT_tldr_page$$($bindings$jscomp$inline_15435_page_block$jscomp$inline_15431_tldr_page$jscomp$inline_15433$$);
      $assets$jscomp$inline_15434_blocks$jscomp$inline_15430_map__88088__$1$jscomp$inline_15428$$ = $APP.$cljs$cst$keyword$assets$$.$cljs$core$IFn$_invoke$arity$1$($bindings$jscomp$inline_15435_page_block$jscomp$inline_15431_tldr_page$jscomp$inline_15433$$);
      $bindings$jscomp$inline_15435_page_block$jscomp$inline_15431_tldr_page$jscomp$inline_15433$$ = $APP.$cljs$cst$keyword$bindings$$.$cljs$core$IFn$_invoke$arity$1$($bindings$jscomp$inline_15435_page_block$jscomp$inline_15431_tldr_page$jscomp$inline_15433$$);
      $api$jscomp$3$$.cloneShapesIntoCurrentPage($APP.$cljs$core$clj__GT_js$$(new $APP.$cljs$core$PersistentArrayMap$$(null, 3, [$APP.$cljs$cst$keyword$shapes$$, $JSCompiler_inline_result$jscomp$2405_edn$jscomp$2_pages$jscomp$inline_15429_shapes$jscomp$inline_15432$$, $APP.$cljs$cst$keyword$assets$$, $assets$jscomp$inline_15434_blocks$jscomp$inline_15430_map__88088__$1$jscomp$inline_15428$$, $APP.$cljs$cst$keyword$bindings$$, $bindings$jscomp$inline_15435_page_block$jscomp$inline_15431_tldr_page$jscomp$inline_15433$$], 
      null)));
      $JSCompiler_inline_result$jscomp$2405_edn$jscomp$2_pages$jscomp$inline_15429_shapes$jscomp$inline_15432$$ = $APP.$frontend$state$set_onboarding_whiteboard_BANG_$$();
      return $APP.$promesa$protocols$_promise$$($JSCompiler_inline_result$jscomp$2405_edn$jscomp$2_pages$jscomp$inline_15429_shapes$jscomp$inline_15432$$);
    });
  }), function($e$jscomp$520$$) {
    return console.warn("Failed to populate onboarding whiteboard", $e$jscomp$520$$);
  }) : null;
}, $frontend$handler$whiteboard$should_populate_onboarding_whiteboard_QMARK_$$ = function($page_name$jscomp$93$$) {
  var $whiteboards$$ = $APP.$frontend$db$model$get_all_whiteboards$$();
  return ($APP.$cljs$core$empty_QMARK_$$($whiteboards$$) || $APP.$cljs$core$_EQ_$$.$cljs$core$IFn$_invoke$arity$2$(1, $APP.$cljs$core$count$$($whiteboards$$)) && $APP.$cljs$core$_EQ_$$.$cljs$core$IFn$_invoke$arity$2$($page_name$jscomp$93$$, $APP.$cljs$cst$keyword$block_SLASH_name$$.$cljs$core$IFn$_invoke$arity$1$($APP.$cljs$core$first$$($whiteboards$$)))) && $APP.$cljs$core$not$$($APP.$cljs$core$get_in$$.$cljs$core$IFn$_invoke$arity$2$($APP.$cljs$core$_deref$$($APP.$frontend$state$state$$), new $APP.$cljs$core$PersistentVector$$(null, 
  1, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$whiteboard_SLASH_onboarding_DASH_whiteboard_QMARK_$$], null)));
}, $frontend$extensions$tldraw$search_handler$$ = function($q$jscomp$229$$, $filters$jscomp$107_map__105630_map__105630__$1$$) {
  $filters$jscomp$107_map__105630_map__105630__$1$$ = $APP.$cljs$core$js__GT_clj$$.$cljs$core$IFn$_invoke$arity$variadic$($filters$jscomp$107_map__105630_map__105630__$1$$, $APP.$cljs$core$prim_seq$cljs$0core$0IFn$0_invoke$0arity$02$$([new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$keywordize_DASH_keys$$, !0], null)]));
  $filters$jscomp$107_map__105630_map__105630__$1$$ = $APP.$cljs$core$__destructure_map$$($filters$jscomp$107_map__105630_map__105630__$1$$);
  var $pages_QMARK_$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($filters$jscomp$107_map__105630_map__105630__$1$$, $cljs$cst$keyword$pages_QMARK_$$), $blocks_QMARK_$jscomp$6$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($filters$jscomp$107_map__105630_map__105630__$1$$, $APP.$cljs$cst$keyword$blocks_QMARK_$$), $files_QMARK_$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($filters$jscomp$107_map__105630_map__105630__$1$$, $cljs$cst$keyword$files_QMARK_$$), $repo$jscomp$483$$ = 
  $APP.$frontend$state$get_current_repo$$();
  return $APP.$promesa$core$bind$cljs$0core$0IFn$0_invoke$0arity$02$$(null, function() {
    return $APP.$promesa$core$bind$cljs$0core$0IFn$0_invoke$0arity$02$$($APP.$cljs$core$truth_$$($blocks_QMARK_$jscomp$6$$) ? $APP.$frontend$search$block_search$$($repo$jscomp$483$$, $q$jscomp$229$$, new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$limit$$, 100], null)) : null, function($blocks$jscomp$171$$) {
      return $APP.$promesa$core$bind$cljs$0core$0IFn$0_invoke$0arity$02$$($APP.$cljs$core$truth_$$($pages_QMARK_$$) ? $APP.$frontend$search$page_search$cljs$0core$0IFn$0_invoke$0arity$02$$($q$jscomp$229$$) : null, function($pages$jscomp$46$$) {
        return $APP.$promesa$core$bind$cljs$0core$0IFn$0_invoke$0arity$02$$($APP.$cljs$core$truth_$$($files_QMARK_$$) ? $APP.$frontend$search$file_search$cljs$0core$0IFn$0_invoke$0arity$02$$($q$jscomp$229$$, 100) : null, function($files$jscomp$65$$) {
          return $APP.$promesa$protocols$_promise$$($APP.$cljs$core$clj__GT_js$$(new $APP.$cljs$core$PersistentArrayMap$$(null, 3, [$APP.$cljs$cst$keyword$pages$$, $pages$jscomp$46$$, $APP.$cljs$cst$keyword$blocks$$, $blocks$jscomp$171$$, $APP.$cljs$cst$keyword$files$$, $files$jscomp$65$$], null)));
        });
      });
    });
  });
}, $frontend$extensions$tldraw$save_asset_handler$$ = function($file$jscomp$142$$) {
  return $APP.$promesa$core$then$cljs$0core$0IFn$0_invoke$0arity$02$$($APP.$frontend$handler$editor$save_assets_BANG_$cljs$0core$0IFn$0_invoke$0arity$02$$($APP.$frontend$state$get_current_repo$$(), new $APP.$cljs$core$PersistentVector$$(null, 1, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$core$js__GT_clj$$.$cljs$core$IFn$_invoke$arity$1$($file$jscomp$142$$)], null)), function($asset_file_name$jscomp$2_res$jscomp$80$$) {
    var $and__5041__auto__$jscomp$inline_15437_full_file_path_temp__5804__auto__$jscomp$1517$$ = ($and__5041__auto__$jscomp$inline_15437_full_file_path_temp__5804__auto__$jscomp$1517$$ = $APP.$cljs$core$seq$$($asset_file_name$jscomp$2_res$jscomp$80$$)) ? $APP.$cljs$core$first$$($asset_file_name$jscomp$2_res$jscomp$80$$) : $and__5041__auto__$jscomp$inline_15437_full_file_path_temp__5804__auto__$jscomp$1517$$;
    return $APP.$cljs$core$truth_$$($and__5041__auto__$jscomp$inline_15437_full_file_path_temp__5804__auto__$jscomp$1517$$) ? ($asset_file_name$jscomp$2_res$jscomp$80$$ = $APP.$cljs$core$nth$$.$cljs$core$IFn$_invoke$arity$3$($and__5041__auto__$jscomp$inline_15437_full_file_path_temp__5804__auto__$jscomp$1517$$, 0, null), $APP.$cljs$core$nth$$.$cljs$core$IFn$_invoke$arity$3$($and__5041__auto__$jscomp$inline_15437_full_file_path_temp__5804__auto__$jscomp$1517$$, 1, null), $and__5041__auto__$jscomp$inline_15437_full_file_path_temp__5804__auto__$jscomp$1517$$ = 
    $APP.$cljs$core$nth$$.$cljs$core$IFn$_invoke$arity$3$($and__5041__auto__$jscomp$inline_15437_full_file_path_temp__5804__auto__$jscomp$1517$$, 2, null), $APP.$frontend$handler$editor$resolve_relative_path$$($APP.$cljs$core$truth_$$($and__5041__auto__$jscomp$inline_15437_full_file_path_temp__5804__auto__$jscomp$1517$$) ? $and__5041__auto__$jscomp$inline_15437_full_file_path_temp__5804__auto__$jscomp$1517$$ : $asset_file_name$jscomp$2_res$jscomp$80$$)) : null;
  });
}, $frontend$extensions$tldraw$undo$$ = function() {
  return $APP.$frontend$handler$history$undo_BANG_$$(null);
}, $frontend$extensions$tldraw$redo$$ = function() {
  return $APP.$frontend$handler$history$redo_BANG_$$(null);
}, $frontend$extensions$tldraw$get_tldraw_handlers$$ = function($current_whiteboard_name$$) {
  return $APP.$cljs$core$PersistentHashMap$fromArrays$$([$cljs$cst$keyword$getBlockPageName$$, $cljs$cst$keyword$inflateAsset$$, $cljs$cst$keyword$getRedirectPageName$$, $cljs$cst$keyword$setCurrentPdf$$, $cljs$cst$keyword$addNewWhiteboard$$, $cljs$cst$keyword$isMobile$$, $cljs$cst$keyword$insertFirstPageBlock$$, $cljs$cst$keyword$isWhiteboardPage$$, $APP.$cljs$cst$keyword$search$$, $cljs$cst$keyword$saveAsset$$, $cljs$cst$keyword$makeAssetUrl$$, $cljs$cst$keyword$copyToClipboard$$, $cljs$cst$keyword$addNewBlock$$, 
  $APP.$cljs$cst$keyword$t$$, $cljs$cst$keyword$exportToImage$$, $cljs$cst$keyword$sidebarAddBlock$$, $cljs$cst$keyword$redirectToPage$$, $cljs$cst$keyword$queryBlockByUUID$$], [function($G__105650$jscomp$inline_11711_JSCompiler_inline_result$jscomp$2410_p1__105645_SHARP_$$) {
    if ($APP.$frontend$util$uuid_string_QMARK_$$($G__105650$jscomp$inline_11711_JSCompiler_inline_result$jscomp$2410_p1__105645_SHARP_$$)) {
      var $JSCompiler_temp$jscomp$2407_JSCompiler_temp_const$jscomp$2408$$ = $APP.$cljs$cst$keyword$block_SLASH_name$$.$cljs$core$IFn$_invoke$arity$1$($APP.$frontend$db$model$get_block_page$$($APP.$frontend$state$get_current_repo$$(), $APP.$cljs$core$parse_uuid$$($G__105650$jscomp$inline_11711_JSCompiler_inline_result$jscomp$2410_p1__105645_SHARP_$$)));
    } else {
      $JSCompiler_temp$jscomp$2407_JSCompiler_temp_const$jscomp$2408$$ = $APP.$cljs$cst$keyword$block_SLASH_name$$.$cljs$core$IFn$_invoke$arity$1$, $G__105650$jscomp$inline_11711_JSCompiler_inline_result$jscomp$2410_p1__105645_SHARP_$$ = new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$block_SLASH_name$$, $APP.$logseq$graph_parser$util$page_name_sanity_lc$$.$cljs$core$IFn$_invoke$arity$1$ ? $APP.$logseq$graph_parser$util$page_name_sanity_lc$$.$cljs$core$IFn$_invoke$arity$1$($G__105650$jscomp$inline_11711_JSCompiler_inline_result$jscomp$2410_p1__105645_SHARP_$$) : 
      $APP.$logseq$graph_parser$util$page_name_sanity_lc$$.call(null, $G__105650$jscomp$inline_11711_JSCompiler_inline_result$jscomp$2410_p1__105645_SHARP_$$)], null), $G__105650$jscomp$inline_11711_JSCompiler_inline_result$jscomp$2410_p1__105645_SHARP_$$ = $APP.$frontend$db$utils$entity$$.$cljs$core$IFn$_invoke$arity$1$ ? $APP.$frontend$db$utils$entity$$.$cljs$core$IFn$_invoke$arity$1$($G__105650$jscomp$inline_11711_JSCompiler_inline_result$jscomp$2410_p1__105645_SHARP_$$) : $APP.$frontend$db$utils$entity$$.call(null, 
      $G__105650$jscomp$inline_11711_JSCompiler_inline_result$jscomp$2410_p1__105645_SHARP_$$), $JSCompiler_temp$jscomp$2407_JSCompiler_temp_const$jscomp$2408$$ = $JSCompiler_temp$jscomp$2407_JSCompiler_temp_const$jscomp$2408$$.call($APP.$cljs$cst$keyword$block_SLASH_name$$, $G__105650$jscomp$inline_11711_JSCompiler_inline_result$jscomp$2410_p1__105645_SHARP_$$);
    }
    return $JSCompiler_temp$jscomp$2407_JSCompiler_temp_const$jscomp$2408$$;
  }, function($src$jscomp$58$$) {
    return $APP.$cljs$core$clj__GT_js$$($APP.$frontend$extensions$pdf$assets$inflate_asset$$($src$jscomp$58$$));
  }, function($page_name_or_uuid$jscomp$6$$) {
    return $APP.$frontend$db$model$get_redirect_page_name$cljs$0core$0IFn$0_invoke$0arity$02$$($page_name_or_uuid$jscomp$6$$, !1);
  }, function($src$jscomp$59$$) {
    return $APP.$frontend$state$set_current_pdf_BANG_$$($APP.$cljs$core$truth_$$($src$jscomp$59$$) ? $APP.$frontend$extensions$pdf$assets$inflate_asset$$($src$jscomp$59$$) : null);
  }, function($page_name$jscomp$165$$) {
    return $APP.$frontend$handler$whiteboard$create_new_whiteboard_page_BANG_$cljs$0core$0IFn$0_invoke$0arity$01$$($page_name$jscomp$165$$);
  }, $APP.$frontend$util$mobile_QMARK_$$, function($page_name$jscomp$166$$) {
    return $APP.$frontend$handler$editor$insert_first_page_block_if_not_exists_BANG_$cljs$0core$0IFn$0_invoke$0arity$02$$($page_name$jscomp$166$$, new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$redirect_QMARK_$$, !1], null));
  }, $APP.$frontend$db$model$whiteboard_page_QMARK_$$, $frontend$extensions$tldraw$search_handler$$, $frontend$extensions$tldraw$save_asset_handler$$, $APP.$frontend$handler$editor$make_asset_url$$, function($text$jscomp$182$$, $html$jscomp$46$$) {
    return $APP.$frontend$util$copy_to_clipboard_BANG_$cljs$0core$0IFn$0_invoke$0arity$0variadic$$($text$jscomp$182$$, $APP.$cljs$core$prim_seq$cljs$0core$0IFn$0_invoke$0arity$02$$([$APP.$cljs$cst$keyword$html$$, $html$jscomp$46$$]));
  }, function($content$jscomp$383_tx$jscomp$inline_16098$$) {
    var $JSCompiler_temp_const$jscomp$15518$$ = $APP.$cljs$core$str$$, $JSCompiler_temp_const$jscomp$15517$$ = $JSCompiler_temp_const$jscomp$15518$$.$cljs$core$IFn$_invoke$arity$1$, $uuid$jscomp$inline_16094$$ = $APP.$datascript$util$squuid$cljs$0core$0IFn$0_invoke$0arity$00$$ ? $APP.$datascript$util$squuid$cljs$0core$0IFn$0_invoke$0arity$00$$() : $APP.$datascript$util$squuid$$.call(null), $page_entity$jscomp$inline_16095$$ = $APP.$frontend$db$model$get_page$$($current_whiteboard_name$$), $or__5043__auto__$jscomp$inline_16097$$ = 
    $frontend$handler$whiteboard$get_last_root_block$$($current_whiteboard_name$$);
    $content$jscomp$383_tx$jscomp$inline_16098$$ = new $APP.$cljs$core$PersistentArrayMap$$(null, 6, [$APP.$cljs$cst$keyword$block_SLASH_left$$, $APP.$cljs$core$select_keys$$($APP.$cljs$core$truth_$$($or__5043__auto__$jscomp$inline_16097$$) ? $or__5043__auto__$jscomp$inline_16097$$ : $page_entity$jscomp$inline_16095$$, new $APP.$cljs$core$PersistentVector$$(null, 1, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$db_SLASH_id$$], null)), $APP.$cljs$cst$keyword$block_SLASH_uuid$$, 
    $uuid$jscomp$inline_16094$$, $APP.$cljs$cst$keyword$block_SLASH_content$$, $APP.$cljs$core$truth_$$($content$jscomp$383_tx$jscomp$inline_16098$$) ? $content$jscomp$383_tx$jscomp$inline_16098$$ : "", $APP.$cljs$cst$keyword$block_SLASH_format$$, $APP.$cljs$cst$keyword$markdown$$, $APP.$cljs$cst$keyword$block_SLASH_page$$, new $APP.$cljs$core$PersistentArrayMap$$(null, 2, [$APP.$cljs$cst$keyword$block_SLASH_name$$, $APP.$logseq$graph_parser$util$page_name_sanity_lc$$.$cljs$core$IFn$_invoke$arity$1$ ? 
    $APP.$logseq$graph_parser$util$page_name_sanity_lc$$.$cljs$core$IFn$_invoke$arity$1$($current_whiteboard_name$$) : $APP.$logseq$graph_parser$util$page_name_sanity_lc$$.call(null, $current_whiteboard_name$$), $APP.$cljs$cst$keyword$block_SLASH_original_DASH_name$$, $current_whiteboard_name$$], null), $APP.$cljs$cst$keyword$block_SLASH_parent$$, new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$block_SLASH_name$$, $current_whiteboard_name$$], null)], null);
    $APP.$frontend$db$utils$transact_BANG_$cljs$0core$0IFn$0_invoke$0arity$01$$(new $APP.$cljs$core$PersistentVector$$(null, 1, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$content$jscomp$383_tx$jscomp$inline_16098$$], null));
    return $JSCompiler_temp_const$jscomp$15517$$.call($JSCompiler_temp_const$jscomp$15518$$, $uuid$jscomp$inline_16094$$);
  }, function($key$jscomp$518$$) {
    return $APP.$frontend$context$i18n$t$$.$cljs$core$IFn$_invoke$arity$variadic$($APP.$cljs$core$prim_seq$cljs$0core$0IFn$0_invoke$0arity$02$$([$APP.$cljs$core$keyword$$.$cljs$core$IFn$_invoke$arity$1$($key$jscomp$518$$)]));
  }, function($page_name$jscomp$167$$, $options$jscomp$444$$) {
    return $APP.$frontend$state$set_modal_BANG_$cljs$0core$0IFn$0_invoke$0arity$01$$(function() {
      return (0,$APP.$frontend$components$export$0$export_blocks$$)($page_name$jscomp$167$$, $APP.$cljs$core$merge$$.$cljs$core$IFn$_invoke$arity$variadic$($APP.$cljs$core$prim_seq$cljs$0core$0IFn$0_invoke$0arity$02$$([$APP.$cljs$core$js__GT_clj$$.$cljs$core$IFn$_invoke$arity$variadic$($options$jscomp$444$$, $APP.$cljs$core$prim_seq$cljs$0core$0IFn$0_invoke$0arity$02$$([$APP.$cljs$cst$keyword$keywordize_DASH_keys$$, !0])), new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$whiteboard_QMARK_$$, 
      !0], null)])));
    });
  }, function($uuid$jscomp$79$$, $type$jscomp$443$$) {
    return $APP.$frontend$state$sidebar_add_block_BANG_$$($APP.$frontend$state$get_current_repo$$(), $APP.$cljs$cst$keyword$db_SLASH_id$$.$cljs$core$IFn$_invoke$arity$1$($APP.$frontend$db$model$get_page$$($uuid$jscomp$79$$)), $APP.$cljs$core$keyword$$.$cljs$core$IFn$_invoke$arity$1$($type$jscomp$443$$));
  }, function($page_name_or_uuid$jscomp$7$$) {
    var $or__5043__auto__$jscomp$inline_11713_page_name$jscomp$168$$ = $APP.$frontend$util$uuid_string_QMARK_$$($page_name_or_uuid$jscomp$7$$) ? $APP.$cljs$cst$keyword$block_SLASH_name$$.$cljs$core$IFn$_invoke$arity$1$($APP.$frontend$db$model$get_block_page$$($APP.$frontend$state$get_current_repo$$(), $APP.$cljs$core$parse_uuid$$($page_name_or_uuid$jscomp$7$$))) : null;
    $or__5043__auto__$jscomp$inline_11713_page_name$jscomp$168$$ = $APP.$cljs$core$truth_$$($or__5043__auto__$jscomp$inline_11713_page_name$jscomp$168$$) ? $or__5043__auto__$jscomp$inline_11713_page_name$jscomp$168$$ : $page_name_or_uuid$jscomp$7$$;
    var $page_exists_QMARK_$jscomp$4$$ = $APP.$frontend$db$model$page_exists_QMARK_$$($or__5043__auto__$jscomp$inline_11713_page_name$jscomp$168$$), $whiteboard_QMARK_$jscomp$18$$ = $APP.$frontend$db$model$whiteboard_page_QMARK_$$($or__5043__auto__$jscomp$inline_11713_page_name$jscomp$168$$);
    return $APP.$cljs$core$truth_$$($page_exists_QMARK_$jscomp$4$$) ? $APP.$cljs$core$truth_$$($whiteboard_QMARK_$jscomp$18$$) ? $APP.$frontend$handler$route$redirect_to_whiteboard_BANG_$cljs$0core$0IFn$0_invoke$0arity$02$$($or__5043__auto__$jscomp$inline_11713_page_name$jscomp$168$$, new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$block_DASH_id$$, $page_name_or_uuid$jscomp$7$$], null)) : $APP.$frontend$handler$route$redirect_to_page_BANG_$cljs$0core$0IFn$0_invoke$0arity$01$$($APP.$frontend$db$model$get_redirect_page_name$cljs$0core$0IFn$0_invoke$0arity$02$$($page_name_or_uuid$jscomp$7$$, 
    !1)) : null;
  }, function($block_uuid$jscomp$62$$) {
    return $APP.$cljs$core$clj__GT_js$$($APP.$frontend$db$model$query_block_by_uuid$$($APP.$cljs$core$parse_uuid$$($block_uuid$jscomp$62$$)));
  }]);
}, $cljs$cst$keyword$queryBlockByUUID$$ = new $APP.$cljs$core$Keyword$$(null, "queryBlockByUUID", "queryBlockByUUID", 2091812895), $cljs$cst$keyword$exportToImage$$ = new $APP.$cljs$core$Keyword$$(null, "exportToImage", "exportToImage", -154356643), $cljs$cst$keyword$addNewBlock$$ = new $APP.$cljs$core$Keyword$$(null, "addNewBlock", "addNewBlock", 1426762680), $cljs$cst$keyword$KeyboardShortcut$$ = new $APP.$cljs$core$Keyword$$(null, "KeyboardShortcut", "KeyboardShortcut", 1250004264), $cljs$cst$keyword$files_QMARK_$$ = 
new $APP.$cljs$core$Keyword$$(null, "files?", "files?", -1267491104), $cljs$cst$keyword$getBlockPageName$$ = new $APP.$cljs$core$Keyword$$(null, "getBlockPageName", "getBlockPageName", -1656908032), $cljs$cst$keyword$renderers$$ = new $APP.$cljs$core$Keyword$$(null, "renderers", "renderers", -1460292282), $cljs$cst$keyword$model$$ = new $APP.$cljs$core$Keyword$$(null, "model", "model", 331153215), $cljs$cst$keyword$getRedirectPageName$$ = new $APP.$cljs$core$Keyword$$(null, "getRedirectPageName", 
"getRedirectPageName", -1858136925), $cljs$cst$keyword$isMobile$$ = new $APP.$cljs$core$Keyword$$(null, "isMobile", "isMobile", -2043133877), $cljs$cst$keyword$setCurrentPdf$$ = new $APP.$cljs$core$Keyword$$(null, "setCurrentPdf", "setCurrentPdf", -63289336), $cljs$cst$keyword$onMount$$ = new $APP.$cljs$core$Keyword$$(null, "onMount", "onMount", -876858467), $cljs$cst$keyword$insertFirstPageBlock$$ = new $APP.$cljs$core$Keyword$$(null, "insertFirstPageBlock", "insertFirstPageBlock", -1676658548), 
$cljs$cst$keyword$makeAssetUrl$$ = new $APP.$cljs$core$Keyword$$(null, "makeAssetUrl", "makeAssetUrl", 217779988), $cljs$cst$keyword$onPersist$$ = new $APP.$cljs$core$Keyword$$(null, "onPersist", "onPersist", -1848738852), $cljs$cst$keyword$Breadcrumb$$ = new $APP.$cljs$core$Keyword$$(null, "Breadcrumb", "Breadcrumb", -1351298906), $cljs$cst$keyword$copyToClipboard$$ = new $APP.$cljs$core$Keyword$$(null, "copyToClipboard", "copyToClipboard", 1092115063), $cljs$cst$keyword$redirectToPage$$ = new $APP.$cljs$core$Keyword$$(null, 
"redirectToPage", "redirectToPage", 87147838), $cljs$cst$keyword$addNewWhiteboard$$ = new $APP.$cljs$core$Keyword$$(null, "addNewWhiteboard", "addNewWhiteboard", 554297706), $cljs$cst$keyword$saveAsset$$ = new $APP.$cljs$core$Keyword$$(null, "saveAsset", "saveAsset", -668047853), $cljs$cst$keyword$BacklinksCount$$ = new $APP.$cljs$core$Keyword$$(null, "BacklinksCount", "BacklinksCount", 364670631), $cljs$cst$keyword$Block$$ = new $APP.$cljs$core$Keyword$$(null, "Block", "Block", -1959785792), $cljs$cst$keyword$sidebarAddBlock$$ = 
new $APP.$cljs$core$Keyword$$(null, "sidebarAddBlock", "sidebarAddBlock", -1204903203), $cljs$cst$keyword$Page$$ = new $APP.$cljs$core$Keyword$$(null, "Page", "Page", -1267059506), $cljs$cst$keyword$pages_QMARK_$$ = new $APP.$cljs$core$Keyword$$(null, "pages?", "pages?", -2065014049), $cljs$cst$keyword$PageName$$ = new $APP.$cljs$core$Keyword$$(null, "PageName", "PageName", -164991013), $cljs$cst$keyword$Tweet$$ = new $APP.$cljs$core$Keyword$$(null, "Tweet", "Tweet", -452258680), $cljs$cst$keyword$isWhiteboardPage$$ = 
new $APP.$cljs$core$Keyword$$(null, "isWhiteboardPage", "isWhiteboardPage", -134150579), $cljs$cst$keyword$BlockReference$$ = new $APP.$cljs$core$Keyword$$(null, "BlockReference", "BlockReference", -120254741), $cljs$cst$keyword$inflateAsset$$ = new $APP.$cljs$core$Keyword$$(null, "inflateAsset", "inflateAsset", -1449040639);
$APP.$JSCompiler_StaticMethods_beforeLoadModuleCode$$("tldraw");
var $module$frontend$tldraw_logseq$$ = $APP.$shadow$js$require$$(620);
var $frontend$extensions$tldraw$tldraw$$, $frontend$extensions$tldraw$tldraw_renderers$$;
$APP.$frontend$extensions$tldraw$$ = {};
$frontend$extensions$tldraw$tldraw$$ = $APP.$frontend$rum$adapt_class$cljs$0core$0IFn$0_invoke$0arity$02$$($APP.$module$contents$goog$object_get$$($module$frontend$tldraw_logseq$$, "App"));
$APP.$frontend$extensions$tldraw$generate_preview$$ = $APP.$module$contents$goog$object_get$$($module$frontend$tldraw_logseq$$, "generateJSXFromModel");
$frontend$extensions$tldraw$tldraw_renderers$$ = new $APP.$cljs$core$PersistentArrayMap$$(null, 8, [$cljs$cst$keyword$Page$$, $APP.$rum$core$lazy_build$$($APP.$rum$core$build_defc$$, function($props$jscomp$42$$) {
  return (0,$APP.$frontend$components$page$page$$)(new $APP.$cljs$core$PersistentArrayMap$$(null, 2, [$APP.$cljs$cst$keyword$page_DASH_name$$, $APP.$frontend$db$model$get_redirect_page_name$cljs$0core$0IFn$0_invoke$0arity$02$$($APP.$module$contents$goog$object_get$$($props$jscomp$42$$, "pageName"), !1), $APP.$cljs$cst$keyword$whiteboard_QMARK_$$, !0], null));
}, null, "frontend.extensions.tldraw/page-cp"), $cljs$cst$keyword$Block$$, $APP.$rum$core$lazy_build$$($APP.$rum$core$build_defc$$, function($G__105626$jscomp$inline_11708_JSCompiler_inline_result$jscomp$2406_props$jscomp$43$$) {
  $G__105626$jscomp$inline_11708_JSCompiler_inline_result$jscomp$2406_props$jscomp$43$$ = $APP.$cljs$core$uuid$$($APP.$module$contents$goog$object_get$$($G__105626$jscomp$inline_11708_JSCompiler_inline_result$jscomp$2406_props$jscomp$43$$, "blockId"));
  var $fexpr__105625$jscomp$inline_11709$$ = $APP.$frontend$state$get_component$$($APP.$cljs$cst$keyword$block_SLASH_single_DASH_block$$);
  $G__105626$jscomp$inline_11708_JSCompiler_inline_result$jscomp$2406_props$jscomp$43$$ = $fexpr__105625$jscomp$inline_11709$$.$cljs$core$IFn$_invoke$arity$1$ ? $fexpr__105625$jscomp$inline_11709$$.$cljs$core$IFn$_invoke$arity$1$($G__105626$jscomp$inline_11708_JSCompiler_inline_result$jscomp$2406_props$jscomp$43$$) : $fexpr__105625$jscomp$inline_11709$$.call(null, $G__105626$jscomp$inline_11708_JSCompiler_inline_result$jscomp$2406_props$jscomp$43$$);
  return $APP.$daiquiri$interpreter$interpret$$($G__105626$jscomp$inline_11708_JSCompiler_inline_result$jscomp$2406_props$jscomp$43$$);
}, null, "frontend.extensions.tldraw/block-cp"), $cljs$cst$keyword$Breadcrumb$$, $APP.$rum$core$lazy_build$$($APP.$rum$core$build_defc$$, function($props$jscomp$44$$) {
  return $APP.$daiquiri$interpreter$interpret$$($APP.$frontend$components$block$breadcrumb$$(new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$preview_QMARK_$$, !0], null), $APP.$frontend$state$get_current_repo$$(), $APP.$cljs$core$uuid$$($APP.$module$contents$goog$object_get$$($props$jscomp$44$$, "blockId")), new $APP.$cljs$core$PersistentArrayMap$$(null, 2, [$APP.$cljs$cst$keyword$end_DASH_separator_QMARK_$$, $APP.$module$contents$goog$object_get$$($props$jscomp$44$$, "endSeparator"), 
  $APP.$cljs$cst$keyword$level_DASH_limit$$, $APP.$module$contents$goog$object_get$$($props$jscomp$44$$, "levelLimit", 3)], null)));
}, null, "frontend.extensions.tldraw/breadcrumb"), $cljs$cst$keyword$Tweet$$, $APP.$rum$core$lazy_build$$($APP.$rum$core$build_defc$$, function($props$jscomp$45$$) {
  return (0,$APP.$frontend$ui$tweet_embed$$)($APP.$module$contents$goog$object_get$$($props$jscomp$45$$, "tweetId"));
}, null, "frontend.extensions.tldraw/tweet"), $cljs$cst$keyword$PageName$$, $APP.$rum$core$lazy_build$$($APP.$rum$core$build_defc$$, function($props$jscomp$47$$) {
  return (0,$APP.$frontend$components$block$page_cp$$)(new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$preview_QMARK_$$, !0], null), new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$block_SLASH_name$$, $APP.$module$contents$goog$object_get$$($props$jscomp$47$$, "pageName")], null));
}, null, "frontend.extensions.tldraw/page-name-link"), $cljs$cst$keyword$BacklinksCount$$, function($props$jscomp$48$$) {
  return $APP.$cljs$core$apply$$.$cljs$core$IFn$_invoke$arity$2$($APP.$frontend$components$whiteboard$references_count$$, $APP.$cljs$core$map$$.$cljs$core$IFn$_invoke$arity$2$(function($k$jscomp$874$$) {
    return $APP.$cljs$core$js__GT_clj$$.$cljs$core$IFn$_invoke$arity$variadic$($APP.$module$contents$goog$object_get$$($props$jscomp$48$$, $k$jscomp$874$$), $APP.$cljs$core$prim_seq$cljs$0core$0IFn$0_invoke$0arity$02$$([new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$keywordize_DASH_keys$$, !0], null)]));
  }, new $APP.$cljs$core$PersistentVector$$(null, 3, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, ["id", "className", "options"], null)));
}, $cljs$cst$keyword$BlockReference$$, $APP.$rum$core$lazy_build$$($APP.$rum$core$build_defc$$, function($props$jscomp$46$$) {
  return (0,$APP.$frontend$components$block$block_reference$$)($APP.$cljs$core$PersistentArrayMap$EMPTY$$, $APP.$module$contents$goog$object_get$$($props$jscomp$46$$, "blockId"), null);
}, null, "frontend.extensions.tldraw/block-reference"), $cljs$cst$keyword$KeyboardShortcut$$, $APP.$rum$core$lazy_build$$($APP.$rum$core$build_defc$$, function($props$jscomp$49$$) {
  return $APP.$daiquiri$interpreter$interpret$$(function() {
    var $action$jscomp$36_shortcut__$1_temp__5804__auto__$jscomp$1518$$ = $APP.$cljs_bean$core$__GT_clj$$($props$jscomp$49$$);
    if ($APP.$cljs$core$truth_$$($action$jscomp$36_shortcut__$1_temp__5804__auto__$jscomp$1518$$)) {
      var $map__105641__$1_opts$jscomp$483$$ = $APP.$cljs$core$__destructure_map$$($action$jscomp$36_shortcut__$1_temp__5804__auto__$jscomp$1518$$);
      $action$jscomp$36_shortcut__$1_temp__5804__auto__$jscomp$1518$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($map__105641__$1_opts$jscomp$483$$, $APP.$cljs$cst$keyword$action$$);
      var $shortcut$jscomp$16$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($map__105641__$1_opts$jscomp$483$$, $APP.$cljs$cst$keyword$shortcut$$);
      $map__105641__$1_opts$jscomp$483$$ = $APP.$cljs$core$get$$.$cljs$core$IFn$_invoke$arity$2$($map__105641__$1_opts$jscomp$483$$, $APP.$cljs$cst$keyword$opts$$);
      $action$jscomp$36_shortcut__$1_temp__5804__auto__$jscomp$1518$$ = "string" === typeof $action$jscomp$36_shortcut__$1_temp__5804__auto__$jscomp$1518$$ ? $APP.$frontend$ui$keyboard_shortcut_from_config$$($APP.$cljs$core$keyword$$.$cljs$core$IFn$_invoke$arity$1$($action$jscomp$36_shortcut__$1_temp__5804__auto__$jscomp$1518$$)) : $shortcut$jscomp$16$$;
      var $opts__$1$jscomp$33$$ = $APP.$cljs$core$merge$$.$cljs$core$IFn$_invoke$arity$variadic$($APP.$cljs$core$prim_seq$cljs$0core$0IFn$0_invoke$0arity$02$$([new $APP.$cljs$core$PersistentArrayMap$$(null, 1, [$APP.$cljs$cst$keyword$interactive_QMARK_$$, !1], null), $map__105641__$1_opts$jscomp$483$$]));
      return "string" === typeof $action$jscomp$36_shortcut__$1_temp__5804__auto__$jscomp$1518$$ ? $APP.$frontend$ui$render_keyboard_shortcut$cljs$0core$0IFn$0_invoke$0arity$0variadic$$($action$jscomp$36_shortcut__$1_temp__5804__auto__$jscomp$1518$$, $APP.$cljs$core$prim_seq$cljs$0core$0IFn$0_invoke$0arity$02$$([$opts__$1$jscomp$33$$])) : $APP.$cljs$core$interpose$$.$cljs$core$IFn$_invoke$arity$2$(" | ", $APP.$cljs$core$map$$.$cljs$core$IFn$_invoke$arity$2$(function($p1__105637_SHARP_$$) {
        return $APP.$frontend$ui$render_keyboard_shortcut$cljs$0core$0IFn$0_invoke$0arity$0variadic$$($p1__105637_SHARP_$$, $APP.$cljs$core$prim_seq$cljs$0core$0IFn$0_invoke$0arity$02$$([$opts__$1$jscomp$33$$]));
      }, $action$jscomp$36_shortcut__$1_temp__5804__auto__$jscomp$1518$$));
    }
    return null;
  }());
}, null, "frontend.extensions.tldraw/keyboard-shortcut")], null);
$APP.$frontend$extensions$tldraw$tldraw_app$$ = $APP.$rum$core$lazy_build$$($APP.$rum$core$build_defc$$, function($page_name$jscomp$169$$, $block_id$jscomp$109$$) {
  function $on_mount$$($tln$jscomp$1$$) {
    if ($APP.$cljs$core$truth_$$($tln$jscomp$1$$)) {
      $tln$jscomp$1$$.appUndo = $frontend$extensions$tldraw$undo$$;
      $tln$jscomp$1$$.appRedo = $frontend$extensions$tldraw$redo$$;
      var $temp__5804__auto__$jscomp$1519$$ = $APP.$module$contents$goog$object_get$$($tln$jscomp$1$$, "api");
      return $APP.$cljs$core$truth_$$($temp__5804__auto__$jscomp$1519$$) ? $APP.$promesa$core$then$cljs$0core$0IFn$0_invoke$0arity$02$$($populate_onboarding_QMARK_$$ ? $frontend$handler$whiteboard$populate_onboarding_whiteboard$$($temp__5804__auto__$jscomp$1519$$) : null, function() {
        $frontend$handler$whiteboard$cleanup_BANG_$$($tln$jscomp$1$$.currentPage);
        $APP.$frontend$state$focus_whiteboard_shape$cljs$0core$0IFn$0_invoke$0arity$02$$($tln$jscomp$1$$, $block_id$jscomp$109$$);
        return $set_loaded_app$$.$cljs$core$IFn$_invoke$arity$1$ ? $set_loaded_app$$.$cljs$core$IFn$_invoke$arity$1$($tln$jscomp$1$$) : $set_loaded_app$$.call(null, $tln$jscomp$1$$);
      }) : null;
    }
    return null;
  }
  var $populate_onboarding_QMARK_$$ = $frontend$handler$whiteboard$should_populate_onboarding_whiteboard_QMARK_$$($page_name$jscomp$169$$), $data$jscomp$258$$ = $APP.$frontend$handler$whiteboard$page_name__GT_tldr_BANG_$$($page_name$jscomp$169$$), $vec__105668$$ = $APP.$rum$core$use_state$$(null), $loaded_app$$ = $APP.$cljs$core$nth$$.$cljs$core$IFn$_invoke$arity$3$($vec__105668$$, 0, null), $set_loaded_app$$ = $APP.$cljs$core$nth$$.$cljs$core$IFn$_invoke$arity$3$($vec__105668$$, 1, null);
  $APP.$rum$core$use_effect_BANG_$cljs$0core$0IFn$0_invoke$0arity$02$$(function() {
    $APP.$cljs$core$truth_$$($APP.$cljs$core$truth_$$($loaded_app$$) ? $block_id$jscomp$109$$ : $loaded_app$$) && $APP.$frontend$state$focus_whiteboard_shape$cljs$0core$0IFn$0_invoke$0arity$02$$($loaded_app$$, $block_id$jscomp$109$$);
    return function() {
      return $APP.$cljs$core$List$EMPTY$$;
    };
  }, new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$block_id$jscomp$109$$, $loaded_app$$], null));
  return $APP.$cljs$core$truth_$$($data$jscomp$258$$) ? $APP.$daiquiri$core$create_element$$("div", {style:{overscrollBehavior:"none"}, onBlur:function($G__105674$jscomp$inline_11715_JSCompiler_inline_result$jscomp$2411_e$jscomp$880$$) {
    $G__105674$jscomp$inline_11715_JSCompiler_inline_result$jscomp$2411_e$jscomp$880$$ = $APP.$module$contents$goog$object_get$$($G__105674$jscomp$inline_11715_JSCompiler_inline_result$jscomp$2411_e$jscomp$880$$, "target").tagName;
    var $fexpr__105673$jscomp$inline_11716$$ = new $APP.$cljs$core$PersistentHashSet$$(null, new $APP.$cljs$core$PersistentArrayMap$$(null, 2, ["INPUT", null, "TEXTAREA", null], null), null);
    $G__105674$jscomp$inline_11715_JSCompiler_inline_result$jscomp$2411_e$jscomp$880$$ = $fexpr__105673$jscomp$inline_11716$$.$cljs$core$IFn$_invoke$arity$1$ ? $fexpr__105673$jscomp$inline_11716$$.$cljs$core$IFn$_invoke$arity$1$($G__105674$jscomp$inline_11715_JSCompiler_inline_result$jscomp$2411_e$jscomp$880$$) : $fexpr__105673$jscomp$inline_11716$$.call(null, $G__105674$jscomp$inline_11715_JSCompiler_inline_result$jscomp$2411_e$jscomp$880$$);
    return $APP.$cljs$core$truth_$$($G__105674$jscomp$inline_11715_JSCompiler_inline_result$jscomp$2411_e$jscomp$880$$) ? $APP.$frontend$state$clear_edit_BANG_$$() : null;
  }, onWheel:$APP.$frontend$util$stop_propagation$$, className:"draw tldraw whiteboard relative w-full h-full"}, [$populate_onboarding_QMARK_$$ && $APP.$cljs$core$not$$($loaded_app$$) ? $APP.$daiquiri$core$create_element$$("div", {style:{zIndex:200}, className:"absolute inset-0 flex items-center justify-center"}, [$APP.$daiquiri$interpreter$interpret$$($APP.$frontend$ui$loading$cljs$0core$0IFn$0_invoke$0arity$01$$("Loading onboarding whiteboard ..."))]) : null, $APP.$daiquiri$interpreter$interpret$$(function() {
    var $G__105676$$ = new $APP.$cljs$core$PersistentArrayMap$$(null, 6, [$cljs$cst$keyword$renderers$$, $frontend$extensions$tldraw$tldraw_renderers$$, $APP.$cljs$cst$keyword$handlers$$, $frontend$extensions$tldraw$get_tldraw_handlers$$($page_name$jscomp$169$$), $cljs$cst$keyword$onMount$$, $on_mount$$, $APP.$cljs$cst$keyword$readOnly$$, !1, $cljs$cst$keyword$onPersist$$, function($app$jscomp$7_res__40590__auto__$jscomp$16$$, $info$jscomp$19$$) {
      $APP.$frontend$state$set_state_BANG_$$(new $APP.$cljs$core$PersistentVector$$(null, 2, 5, $APP.$cljs$core$PersistentVector$EMPTY_NODE$$, [$APP.$cljs$cst$keyword$whiteboard_SLASH_last_DASH_persisted_DASH_at$$, $APP.$frontend$state$get_current_repo$$()], null), $APP.$frontend$util$time_ms$$());
      return $APP.$cljs$core$truth_$$(!1) ? (console.time("tldraw persist"), $app$jscomp$7_res__40590__auto__$jscomp$16$$ = $frontend$handler$whiteboard$transact_tldr_delta_BANG_$$($page_name$jscomp$169$$, $app$jscomp$7_res__40590__auto__$jscomp$16$$, $info$jscomp$19$$.replace), console.timeEnd("tldraw persist"), $app$jscomp$7_res__40590__auto__$jscomp$16$$) : $frontend$handler$whiteboard$transact_tldr_delta_BANG_$$($page_name$jscomp$169$$, $app$jscomp$7_res__40590__auto__$jscomp$16$$, $info$jscomp$19$$.replace);
    }, $cljs$cst$keyword$model$$, $data$jscomp$258$$], null);
    return $frontend$extensions$tldraw$tldraw$$.$cljs$core$IFn$_invoke$arity$1$ ? $frontend$extensions$tldraw$tldraw$$.$cljs$core$IFn$_invoke$arity$1$($G__105676$$) : $frontend$extensions$tldraw$tldraw$$.call(null, $G__105676$$);
  }())]) : null;
}, null, "frontend.extensions.tldraw/tldraw-app");
$APP.$module$contents$shadow$loader_mm$$.$setLoaded$();

}).call(this);
//# sourceMappingURL=tldraw.js.map
