@linkurious/ogma-annotations-react 1.1.18 → 1.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +36 -35
  2. package/dist/index.mjs +1913 -2178
  3. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1,53 +1,54 @@
1
- (function(H,X){typeof exports=="object"&&typeof module<"u"?X(exports,require("react"),require("@linkurious/ogma-react")):typeof define=="function"&&define.amd?define(["exports","react","@linkurious/ogma-react"],X):(H=typeof globalThis<"u"?globalThis:H||self,X((H["/home/jenkins/agent/workspace/_ogma-annotations-control_master/packages/ogma-annotations-react/src/index"]=H["/home/jenkins/agent/workspace/_ogma-annotations-control_master/packages/ogma-annotations-react/src/index"]||{},H["/home/jenkins/agent/workspace/_ogma-annotations-control_master/packages/ogma-annotations-react/src/index"].ts={}),H.React,H.OgmaReact))})(this,function(H,X,Gr){"use strict";var Ue={exports:{}},Gt={};/**
1
+ (function(Y,Q){typeof exports=="object"&&typeof module<"u"?Q(exports,require("react"),require("@linkurious/ogma-react")):typeof define=="function"&&define.amd?define(["exports","react","@linkurious/ogma-react"],Q):(Y=typeof globalThis<"u"?globalThis:Y||self,Q((Y["/home/jenkins/agent/workspace/_ogma-annotations-control_master/packages/ogma-annotations-react/src/index"]=Y["/home/jenkins/agent/workspace/_ogma-annotations-control_master/packages/ogma-annotations-react/src/index"]||{},Y["/home/jenkins/agent/workspace/_ogma-annotations-control_master/packages/ogma-annotations-react/src/index"].ts={}),Y.React,Y.OgmaReact))})(this,function(Y,Q,Yr){"use strict";var pe={exports:{}},ee={};/**
2
2
  * @license React
3
- * react-jsx-runtime.production.min.js
3
+ * react-jsx-runtime.production.js
4
4
  *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var yr;function qr(){if(yr)return Gt;yr=1;var h=X,e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function g(y,f,m){var v,k={},C=null,_=null;m!==void 0&&(C=""+m),f.key!==void 0&&(C=""+f.key),f.ref!==void 0&&(_=f.ref);for(v in f)i.call(f,v)&&!c.hasOwnProperty(v)&&(k[v]=f[v]);if(y&&y.defaultProps)for(v in f=y.defaultProps,f)k[v]===void 0&&(k[v]=f[v]);return{$$typeof:e,type:y,key:C,ref:_,props:k,_owner:l.current}}return Gt.Fragment=s,Gt.jsx=g,Gt.jsxs=g,Gt}var qt={};/**
9
+ */var or;function Gr(){if(or)return ee;or=1;var a=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(r,o,u){var d=null;if(u!==void 0&&(d=""+u),o.key!==void 0&&(d=""+o.key),"key"in o){u={};for(var f in o)f!=="key"&&(u[f]=o[f])}else u=o;return o=u.ref,{$$typeof:a,type:r,key:d,ref:o!==void 0?o:null,props:u}}return ee.Fragment=t,ee.jsx=i,ee.jsxs=i,ee}var re={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var vr;function Xr(){return vr||(vr=1,process.env.NODE_ENV!=="production"&&function(){var h=X,e=Symbol.for("react.element"),s=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),y=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),_=Symbol.for("react.offscreen"),R=Symbol.iterator,T="@@iterator";function M(t){if(t===null||typeof t!="object")return null;var u=R&&t[R]||t[T];return typeof u=="function"?u:null}var L=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(t){{for(var u=arguments.length,d=new Array(u>1?u-1:0),p=1;p<u;p++)d[p-1]=arguments[p];W("error",t,d)}}function W(t,u,d){{var p=L.ReactDebugCurrentFrame,b=p.getStackAddendum();b!==""&&(u+="%s",d=d.concat([b]));var w=d.map(function(A){return String(A)});w.unshift("Warning: "+u),Function.prototype.apply.call(console[t],console,w)}}var U=!1,lt=!1,kt=!1,Zt=!1,Qt=!1,_e;_e=Symbol.for("react.module.reference");function Dt(t){return!!(typeof t=="string"||typeof t=="function"||t===i||t===c||Qt||t===l||t===m||t===v||Zt||t===_||U||lt||kt||typeof t=="object"&&t!==null&&(t.$$typeof===C||t.$$typeof===k||t.$$typeof===g||t.$$typeof===y||t.$$typeof===f||t.$$typeof===_e||t.getModuleId!==void 0))}function Mt(t,u,d){var p=t.displayName;if(p)return p;var b=u.displayName||u.name||"";return b!==""?d+"("+b+")":d}function ke(t){return t.displayName||"Context"}function rt(t){if(t==null)return null;if(typeof t.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case i:return"Fragment";case s:return"Portal";case c:return"Profiler";case l:return"StrictMode";case m:return"Suspense";case v:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case y:var u=t;return ke(u)+".Consumer";case g:var d=t;return ke(d._context)+".Provider";case f:return Mt(t,t.render,"ForwardRef");case k:var p=t.displayName||null;return p!==null?p:rt(t.type)||"Memo";case C:{var b=t,w=b._payload,A=b._init;try{return rt(A(w))}catch{return null}}}return null}var z=Object.assign,ht=0,K,ct,$t,Se,te,Te,Ce;function St(){}St.__reactDisabledLog=!0;function Oe(){{if(ht===0){K=console.log,ct=console.info,$t=console.warn,Se=console.error,te=console.group,Te=console.groupCollapsed,Ce=console.groupEnd;var t={configurable:!0,enumerable:!0,value:St,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}ht++}}function rr(){{if(ht--,ht===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},t,{value:K}),info:z({},t,{value:ct}),warn:z({},t,{value:$t}),error:z({},t,{value:Se}),group:z({},t,{value:te}),groupCollapsed:z({},t,{value:Te}),groupEnd:z({},t,{value:Ce})})}ht<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ee=L.ReactCurrentDispatcher,re;function zt(t,u,d){{if(re===void 0)try{throw Error()}catch(b){var p=b.stack.trim().match(/\n( *(at )?)/);re=p&&p[1]||""}return`
18
- `+re+t}}var ne=!1,Tt;{var nr=typeof WeakMap=="function"?WeakMap:Map;Tt=new nr}function ie(t,u){if(!t||ne)return"";{var d=Tt.get(t);if(d!==void 0)return d}var p;ne=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var w;w=ee.current,ee.current=null,Oe();try{if(u){var A=function(){throw Error()};if(Object.defineProperty(A.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(A,[])}catch(D){p=D}Reflect.construct(t,[],A)}else{try{A.call()}catch(D){p=D}t.call(A.prototype)}}else{try{throw Error()}catch(D){p=D}t()}}catch(D){if(D&&p&&typeof D.stack=="string"){for(var E=D.stack.split(`
19
- `),O=p.stack.split(`
20
- `),P=E.length-1,I=O.length-1;P>=1&&I>=0&&E[P]!==O[I];)I--;for(;P>=1&&I>=0;P--,I--)if(E[P]!==O[I]){if(P!==1||I!==1)do if(P--,I--,I<0||E[P]!==O[I]){var B=`
21
- `+E[P].replace(" at new "," at ");return t.displayName&&B.includes("<anonymous>")&&(B=B.replace("<anonymous>",t.displayName)),typeof t=="function"&&Tt.set(t,B),B}while(P>=1&&I>=0);break}}}finally{ne=!1,ee.current=w,rr(),Error.prepareStackTrace=b}var $=t?t.displayName||t.name:"",j=$?zt($):"";return typeof t=="function"&&Tt.set(t,j),j}function ir(t,u,d){return ie(t,!1)}function or(t){var u=t.prototype;return!!(u&&u.isReactComponent)}function Nt(t,u,d){if(t==null)return"";if(typeof t=="function")return ie(t,or(t));if(typeof t=="string")return zt(t);switch(t){case m:return zt("Suspense");case v:return zt("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case f:return ir(t.render);case k:return Nt(t.type,u,d);case C:{var p=t,b=p._payload,w=p._init;try{return Nt(w(b),u,d)}catch{}}}return""}var xt=Object.prototype.hasOwnProperty,Pe={},Re=L.ReactDebugCurrentFrame;function Bt(t){if(t){var u=t._owner,d=Nt(t.type,t._source,u?u.type:null);Re.setExtraStackFrame(d)}else Re.setExtraStackFrame(null)}function sr(t,u,d,p,b){{var w=Function.call.bind(xt);for(var A in t)if(w(t,A)){var E=void 0;try{if(typeof t[A]!="function"){var O=Error((p||"React class")+": "+d+" type `"+A+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[A]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw O.name="Invariant Violation",O}E=t[A](u,A,p,d,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(P){E=P}E&&!(E instanceof Error)&&(Bt(b),S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",p||"React class",d,A,typeof E),Bt(null)),E instanceof Error&&!(E.message in Pe)&&(Pe[E.message]=!0,Bt(b),S("Failed %s type: %s",d,E.message),Bt(null))}}}var ar=Array.isArray;function oe(t){return ar(t)}function V(t){{var u=typeof Symbol=="function"&&Symbol.toStringTag,d=u&&t[Symbol.toStringTag]||t.constructor.name||"Object";return d}}function lr(t){try{return Ie(t),!1}catch{return!0}}function Ie(t){return""+t}function se(t){if(lr(t))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",V(t)),Ie(t)}var ut=L.ReactCurrentOwner,Le={key:!0,ref:!0,__self:!0,__source:!0},Ht,je,ae;ae={};function le(t){if(xt.call(t,"ref")){var u=Object.getOwnPropertyDescriptor(t,"ref").get;if(u&&u.isReactWarning)return!1}return t.ref!==void 0}function ur(t){if(xt.call(t,"key")){var u=Object.getOwnPropertyDescriptor(t,"key").get;if(u&&u.isReactWarning)return!1}return t.key!==void 0}function hr(t,u){if(typeof t.ref=="string"&&ut.current&&u&&ut.current.stateNode!==u){var d=rt(ut.current.type);ae[d]||(S('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',rt(ut.current.type),t.ref),ae[d]=!0)}}function cr(t,u){{var d=function(){Ht||(Ht=!0,S("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",u))};d.isReactWarning=!0,Object.defineProperty(t,"key",{get:d,configurable:!0})}}function ue(t,u){{var d=function(){je||(je=!0,S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",u))};d.isReactWarning=!0,Object.defineProperty(t,"ref",{get:d,configurable:!0})}}var Fe=function(t,u,d,p,b,w,A){var E={$$typeof:e,type:t,key:u,ref:d,props:A,_owner:w};return E._store={},Object.defineProperty(E._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(E,"_self",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.defineProperty(E,"_source",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.freeze&&(Object.freeze(E.props),Object.freeze(E)),E};function Ct(t,u,d,p,b){{var w,A={},E=null,O=null;d!==void 0&&(se(d),E=""+d),ur(u)&&(se(u.key),E=""+u.key),le(u)&&(O=u.ref,hr(u,b));for(w in u)xt.call(u,w)&&!Le.hasOwnProperty(w)&&(A[w]=u[w]);if(t&&t.defaultProps){var P=t.defaultProps;for(w in P)A[w]===void 0&&(A[w]=P[w])}if(E||O){var I=typeof t=="function"?t.displayName||t.name||"Unknown":t;E&&cr(A,I),O&&ue(A,I)}return Fe(t,E,O,b,p,ut.current,A)}}var he=L.ReactCurrentOwner,De=L.ReactDebugCurrentFrame;function dt(t){if(t){var u=t._owner,d=Nt(t.type,t._source,u?u.type:null);De.setExtraStackFrame(d)}else De.setExtraStackFrame(null)}var Z;Z=!1;function vt(t){return typeof t=="object"&&t!==null&&t.$$typeof===e}function Ut(){{if(he.current){var t=rt(he.current.type);if(t)return`
22
-
23
- Check the render method of \``+t+"`."}return""}}function dr(t){return""}var ce={};function Me(t){{var u=Ut();if(!u){var d=typeof t=="string"?t:t.displayName||t.name;d&&(u=`
24
-
25
- Check the top-level render call using <`+d+">.")}return u}}function $e(t,u){{if(!t._store||t._store.validated||t.key!=null)return;t._store.validated=!0;var d=Me(u);if(ce[d])return;ce[d]=!0;var p="";t&&t._owner&&t._owner!==he.current&&(p=" It was passed a child from "+rt(t._owner.type)+"."),dt(t),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',d,p),dt(null)}}function Wt(t,u){{if(typeof t!="object")return;if(oe(t))for(var d=0;d<t.length;d++){var p=t[d];vt(p)&&$e(p,u)}else if(vt(t))t._store&&(t._store.validated=!0);else if(t){var b=M(t);if(typeof b=="function"&&b!==t.entries)for(var w=b.call(t),A;!(A=w.next()).done;)vt(A.value)&&$e(A.value,u)}}}function fr(t){{var u=t.type;if(u==null||typeof u=="string")return;var d;if(typeof u=="function")d=u.propTypes;else if(typeof u=="object"&&(u.$$typeof===f||u.$$typeof===k))d=u.propTypes;else return;if(d){var p=rt(u);sr(d,t.props,"prop",p,t)}else if(u.PropTypes!==void 0&&!Z){Z=!0;var b=rt(u);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof u.getDefaultProps=="function"&&!u.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ze(t){{for(var u=Object.keys(t.props),d=0;d<u.length;d++){var p=u[d];if(p!=="children"&&p!=="key"){dt(t),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",p),dt(null);break}}t.ref!==null&&(dt(t),S("Invalid attribute `ref` supplied to `React.Fragment`."),dt(null))}}var de={};function Ne(t,u,d,p,b,w){{var A=Dt(t);if(!A){var E="";(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(E+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var O=dr();O?E+=O:E+=Ut();var P;t===null?P="null":oe(t)?P="array":t!==void 0&&t.$$typeof===e?(P="<"+(rt(t.type)||"Unknown")+" />",E=" Did you accidentally export a JSX literal instead of a component?"):P=typeof t,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",P,E)}var I=Ct(t,u,d,b,w);if(I==null)return I;if(A){var B=u.children;if(B!==void 0)if(p)if(oe(B)){for(var $=0;$<B.length;$++)Wt(B[$],t);Object.freeze&&Object.freeze(B)}else S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Wt(B,t)}if(xt.call(u,"key")){var j=rt(t),D=Object.keys(u).filter(function(J){return J!=="key"}),N=D.length>0?"{key: someKey, "+D.join(": ..., ")+": ...}":"{key: someKey}";if(!de[j+N]){var Q=D.length>0?"{"+D.join(": ..., ")+": ...}":"{}";S(`A props object containing a "key" prop is being spread into JSX:
17
+ */var ar;function Xr(){return ar||(ar=1,process.env.NODE_ENV!=="production"&&function(){function a(h){if(h==null)return null;if(typeof h=="function")return h.$$typeof===oe?null:h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case rt:return"Fragment";case ot:return"Portal";case Jt:return"Profiler";case Vt:return"StrictMode";case se:return"Suspense";case Pt:return"SuspenseList"}if(typeof h=="object")switch(typeof h.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),h.$$typeof){case Ht:return(h.displayName||"Context")+".Provider";case ke:return(h._context.displayName||"Context")+".Consumer";case Dt:var E=h.render;return h=h.displayName,h||(h=E.displayName||E.name||"",h=h!==""?"ForwardRef("+h+")":"ForwardRef"),h;case U:return E=h.displayName||null,E!==null?E:a(h.type)||"Memo";case St:E=h._payload,h=h._init;try{return a(h(E))}catch{}}return null}function t(h){return""+h}function i(h){try{t(h);var E=!1}catch{E=!0}if(E){E=console;var v=E.error,z=typeof Symbol=="function"&&Symbol.toStringTag&&h[Symbol.toStringTag]||h.constructor.name||"Object";return v.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",z),t(h)}}function r(){}function o(){if(Rt===0){Se=console.log,_e=console.info,Ce=console.warn,Te=console.error,Oe=console.group,le=console.groupCollapsed,je=console.groupEnd;var h={configurable:!0,enumerable:!0,value:r,writable:!0};Object.defineProperties(console,{info:h,log:h,warn:h,error:h,group:h,groupCollapsed:h,groupEnd:h})}Rt++}function u(){if(Rt--,Rt===0){var h={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Ct({},h,{value:Se}),info:Ct({},h,{value:_e}),warn:Ct({},h,{value:Ce}),error:Ct({},h,{value:Te}),group:Ct({},h,{value:Oe}),groupCollapsed:Ct({},h,{value:le}),groupEnd:Ct({},h,{value:je})})}0>Rt&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function d(h){if(Zt===void 0)try{throw Error()}catch(v){var E=v.stack.trim().match(/\n( *(at )?)/);Zt=E&&E[1]||"",Le=-1<v.stack.indexOf(`
18
+ at`)?" (<anonymous>)":-1<v.stack.indexOf("@")?"@unknown:0:0":""}return`
19
+ `+Zt+h+Le}function f(h,E){if(!h||he)return"";var v=ue.get(h);if(v!==void 0)return v;he=!0,v=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var z=null;z=_t.H,_t.H=null,o();try{var tt={DetermineComponentFrameRoot:function(){try{if(E){var bt=function(){throw Error()};if(Object.defineProperty(bt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(bt,[])}catch(yt){var Kt=yt}Reflect.construct(h,[],bt)}else{try{bt.call()}catch(yt){Kt=yt}h.call(bt.prototype)}}else{try{throw Error()}catch(yt){Kt=yt}(bt=h())&&typeof bt.catch=="function"&&bt.catch(function(){})}}catch(yt){if(yt&&Kt&&typeof yt.stack=="string")return[yt.stack,Kt.stack]}return[null,null]}};tt.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var W=Object.getOwnPropertyDescriptor(tt.DetermineComponentFrameRoot,"name");W&&W.configurable&&Object.defineProperty(tt.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var L=tt.DetermineComponentFrameRoot(),pt=L[0],wt=L[1];if(pt&&wt){var et=pt.split(`
20
+ `),Tt=wt.split(`
21
+ `);for(L=W=0;W<et.length&&!et[W].includes("DetermineComponentFrameRoot");)W++;for(;L<Tt.length&&!Tt[L].includes("DetermineComponentFrameRoot");)L++;if(W===et.length||L===Tt.length)for(W=et.length-1,L=Tt.length-1;1<=W&&0<=L&&et[W]!==Tt[L];)L--;for(;1<=W&&0<=L;W--,L--)if(et[W]!==Tt[L]){if(W!==1||L!==1)do if(W--,L--,0>L||et[W]!==Tt[L]){var Ot=`
22
+ `+et[W].replace(" at new "," at ");return h.displayName&&Ot.includes("<anonymous>")&&(Ot=Ot.replace("<anonymous>",h.displayName)),typeof h=="function"&&ue.set(h,Ot),Ot}while(1<=W&&0<=L);break}}}finally{he=!1,_t.H=z,u(),Error.prepareStackTrace=v}return et=(et=h?h.displayName||h.name:"")?d(et):"",typeof h=="function"&&ue.set(h,et),et}function g(h){if(h==null)return"";if(typeof h=="function"){var E=h.prototype;return f(h,!(!E||!E.isReactComponent))}if(typeof h=="string")return d(h);switch(h){case se:return d("Suspense");case Pt:return d("SuspenseList")}if(typeof h=="object")switch(h.$$typeof){case Dt:return h=f(h.render,!1),h;case U:return g(h.type);case St:E=h._payload,h=h._init;try{return g(h(E))}catch{}}return""}function p(){var h=_t.A;return h===null?null:h.getOwner()}function m(h){if(ae.call(h,"key")){var E=Object.getOwnPropertyDescriptor(h,"key").get;if(E&&E.isReactWarning)return!1}return h.key!==void 0}function C(h,E){function v(){De||(De=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",E))}v.isReactWarning=!0,Object.defineProperty(h,"key",{get:v,configurable:!0})}function S(){var h=a(this.type);return Pe[h]||(Pe[h]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),h=this.props.ref,h!==void 0?h:null}function A(h,E,v,z,tt,W){return v=W.ref,h={$$typeof:B,type:h,key:E,props:W,_owner:tt},(v!==void 0?v:null)!==null?Object.defineProperty(h,"ref",{enumerable:!1,get:S}):Object.defineProperty(h,"ref",{enumerable:!1,value:null}),h._store={},Object.defineProperty(h._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(h,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(h.props),Object.freeze(h)),h}function _(h,E,v,z,tt,W){if(typeof h=="string"||typeof h=="function"||h===rt||h===Jt||h===Vt||h===se||h===Pt||h===at||typeof h=="object"&&h!==null&&(h.$$typeof===St||h.$$typeof===U||h.$$typeof===Ht||h.$$typeof===ke||h.$$typeof===Dt||h.$$typeof===Qe||h.getModuleId!==void 0)){var L=E.children;if(L!==void 0)if(z)if(Nt(L)){for(z=0;z<L.length;z++)x(L[z],h);Object.freeze&&Object.freeze(L)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else x(L,h)}else L="",(h===void 0||typeof h=="object"&&h!==null&&Object.keys(h).length===0)&&(L+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),h===null?z="null":Nt(h)?z="array":h!==void 0&&h.$$typeof===B?(z="<"+(a(h.type)||"Unknown")+" />",L=" Did you accidentally export a JSX literal instead of a component?"):z=typeof h,console.error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",z,L);if(ae.call(E,"key")){L=a(h);var pt=Object.keys(E).filter(function(et){return et!=="key"});z=0<pt.length?"{key: someKey, "+pt.join(": ..., ")+": ...}":"{key: someKey}",Ne[L+z]||(pt=0<pt.length?"{"+pt.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
26
23
  let props = %s;
27
24
  <%s {...props} />
28
25
  React keys must be passed directly to JSX without using spread:
29
26
  let props = %s;
30
- <%s key={someKey} {...props} />`,N,j,Q,j),de[j+N]=!0}}return t===i?ze(I):fr(I),I}}function r(t,u,d){return Ne(t,u,d,!0)}function n(t,u,d){return Ne(t,u,d,!1)}var a=n,o=r;qt.Fragment=i,qt.jsx=a,qt.jsxs=o}()),qt}process.env.NODE_ENV==="production"?Ue.exports=qr():Ue.exports=Xr();var Jr=Ue.exports,Kr=Object.defineProperty,Zr=(h,e,s)=>e in h?Kr(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s,x=(h,e,s)=>(Zr(h,typeof e!="symbol"?e+"":e,s),s);let pe=(h=21)=>crypto.getRandomValues(new Uint8Array(h)).reduce((e,s)=>(s&=63,s<36?e+=s.toString(36):s<62?e+=(s-26).toString(36).toUpperCase():s>62?e+="-":e+="_",e),"");const Xt={strokeType:"plain",strokeColor:"black",strokeWidth:1,head:"none",tail:"none"},mr={id:0,type:"Feature",properties:{type:"arrow",style:{...Xt}},geometry:{type:"LineString",coordinates:[[0,0],[100,100]]}},Qr=(h=0,e=0,s=0,i=0,l={...Xt})=>({id:pe(),type:"Feature",properties:{type:"arrow",style:{...Xt,...l}},geometry:{type:"LineString",coordinates:[[h,e],[s,i]]}}),tn="http://www.w3.org/2000/svg";function Jt(h){return document.createElementNS(tn,h)}function br(h){return h.geometry.bbox||en(h),h.geometry.bbox}function gt(h){const e=br(h);return{width:e[2]-e[0],height:e[3]-e[1]}}function pt(h){const e=br(h);return{x:e[0],y:e[1]}}function en(h){const[e,s]=h.geometry.coordinates[0][0],[i,l]=h.geometry.coordinates[0][2];h.geometry.bbox=[e,s,i,l]}function rn(h,e,s,i,l){h.geometry.bbox=[e,s,e+i,s+l],h.geometry.coordinates=[[[e,s],[e+i,s],[e+i,s+l],[e,s+l],[e,s]]]}function Kt(h){const[e,s]=h.geometry.coordinates[0];return{x:e,y:s}}function ye(h,e){const[s,i]=h.geometry.coordinates[e==="start"?0:1];return{x:s,y:i}}function ve(h){const[e,s]=h.geometry.coordinates[1];return{x:e,y:s}}function wr(h,e,s){h.geometry.coordinates[0]=[e,s]}function xr(h,e,s){h.geometry.coordinates[1]=[e,s]}function me(h){return{start:Kt(h),end:ve(h)}}function Rt(h,e,s,i){e==="start"?wr(h,s,i):xr(h,s,i)}const Ar=h=>parseInt(h.getAttribute("data-handle-id")||"-1");function nn(h){return Array.isArray(h)&&h.length===2&&h.every(isFinite)}function on(h,e,s,i){for(let l=0;l<h.coordinates.length;l++){const c=h.coordinates[l];if(nn(c))c[0]=s+(c[0]-s)*e,c[1]=i+(c[1]-i)*e;else for(let g=0;g<c.length;g++){const y=c[g];y[0]=s+(y[0]-s)*e,y[1]=i+(y[1]-i)*e}}return h}function be(h,e,s){const i=Math.atan2(h.y-e.y,h.x-e.x);return{x:e.x+s*Math.cos(i),y:e.y+s*Math.sin(i)}}function we(h,e){if(!e)return{x:h.clientX,y:h.clientY};const s=e.getBoundingClientRect();return{x:h.clientX-s.left-e.clientLeft,y:h.clientY-s.top-e.clientTop}}const _t=(h,e)=>({x:h.x-e.x,y:h.y-e.y}),It=h=>Math.sqrt(h.x*h.x+h.y*h.y),Er=h=>({x:-h.x,y:-h.y}),_r=h=>{const e=It(h);return e===0?{x:0,y:0}:{x:h.x/e,y:h.y/e}},Lt=(h,e)=>({x:h.x+e.x,y:h.y+e.y}),kr=(h,e)=>({x:h.x*e,y:h.y*e}),xe=(h,e)=>({x:h.x*e.x,y:h.y*e.y}),st=(h,e)=>{const s=Math.sin(e),i=Math.cos(e);return{x:h.x*i-h.y*s,y:h.x*s+h.y*i}},sn=(h,e)=>({x:h.x/e,y:h.y/e}),Sr=(h,e)=>h.x*e.x+h.y*e.y;function Tr(h,e=5,s=30){var i;const{start:l,end:c}=me(h),g=_t(c,l),y=h.properties.style&&h.properties.style.strokeWidth?(i=h.properties.style)==null?void 0:i.strokeWidth:0;return Math.min(s,Math.max(3*y,It(g)*.1,e))}function Cr(h,e,s,i){const l=kr(Er(_r(e)),i);if(!s||s==="none")return"";const c=Lt(h,st(l,Math.PI/8)),g=Lt(h,st(l,-Math.PI/8)),y=`${h.x} ${h.y}`;return`M ${c.x} ${c.y} L ${y} ${g.x} ${g.y} ${s==="arrow"?"":`${c.x} ${c.y}`}`}function an(h,e,s,i,l){const{start:c,end:g}=me(h),{tail:y,head:f,strokeColor:m,strokeWidth:v}=h.properties.style||s,k=_t(g,c),C=Tr(h,i,l),_=Jt("path");_.setAttribute("data-annotation",`${h.id}`),_.setAttribute("data-annotation-type","arrow");const R=f==="arrow-plain"||y==="arrow";_.setAttribute("stroke",m||"none"),_.setAttribute("stroke-width",`${v}`),_.setAttribute("fill",R?m||"":"none"),_.setAttribute("stroke-linecap","round"),_.setAttribute("stroke-linejoin","round");const T=Cr(c,Er(k),y,C),M=Cr(g,k,f,C),L=T+`M ${c.x} ${c.y} ${g.x} ${g.y}`+M;_.setAttribute("d",L),e.appendChild(_)}const G=-1,Ae="dragging",Ee="dragstart",jt="dragend",We="select",Ve="unselect",ln="hover",un="unhover",Ye="remove",Ge="add",hn="cancelDrawing",qe="update",cn="link";var dn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Or(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}var Pr={exports:{}};(function(h){var e=Object.prototype.hasOwnProperty,s="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(s=!1));function l(f,m,v){this.fn=f,this.context=m,this.once=v||!1}function c(f,m,v,k,C){if(typeof v!="function")throw new TypeError("The listener must be a function");var _=new l(v,k||f,C),R=s?s+m:m;return f._events[R]?f._events[R].fn?f._events[R]=[f._events[R],_]:f._events[R].push(_):(f._events[R]=_,f._eventsCount++),f}function g(f,m){--f._eventsCount===0?f._events=new i:delete f._events[m]}function y(){this._events=new i,this._eventsCount=0}y.prototype.eventNames=function(){var f=[],m,v;if(this._eventsCount===0)return f;for(v in m=this._events)e.call(m,v)&&f.push(s?v.slice(1):v);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(m)):f},y.prototype.listeners=function(f){var m=s?s+f:f,v=this._events[m];if(!v)return[];if(v.fn)return[v.fn];for(var k=0,C=v.length,_=new Array(C);k<C;k++)_[k]=v[k].fn;return _},y.prototype.listenerCount=function(f){var m=s?s+f:f,v=this._events[m];return v?v.fn?1:v.length:0},y.prototype.emit=function(f,m,v,k,C,_){var R=s?s+f:f;if(!this._events[R])return!1;var T=this._events[R],M=arguments.length,L,S;if(T.fn){switch(T.once&&this.removeListener(f,T.fn,void 0,!0),M){case 1:return T.fn.call(T.context),!0;case 2:return T.fn.call(T.context,m),!0;case 3:return T.fn.call(T.context,m,v),!0;case 4:return T.fn.call(T.context,m,v,k),!0;case 5:return T.fn.call(T.context,m,v,k,C),!0;case 6:return T.fn.call(T.context,m,v,k,C,_),!0}for(S=1,L=new Array(M-1);S<M;S++)L[S-1]=arguments[S];T.fn.apply(T.context,L)}else{var W=T.length,U;for(S=0;S<W;S++)switch(T[S].once&&this.removeListener(f,T[S].fn,void 0,!0),M){case 1:T[S].fn.call(T[S].context);break;case 2:T[S].fn.call(T[S].context,m);break;case 3:T[S].fn.call(T[S].context,m,v);break;case 4:T[S].fn.call(T[S].context,m,v,k);break;default:if(!L)for(U=1,L=new Array(M-1);U<M;U++)L[U-1]=arguments[U];T[S].fn.apply(T[S].context,L)}}return!0},y.prototype.on=function(f,m,v){return c(this,f,m,v,!1)},y.prototype.once=function(f,m,v){return c(this,f,m,v,!0)},y.prototype.removeListener=function(f,m,v,k){var C=s?s+f:f;if(!this._events[C])return this;if(!m)return g(this,C),this;var _=this._events[C];if(_.fn)_.fn===m&&(!k||_.once)&&(!v||_.context===v)&&g(this,C);else{for(var R=0,T=[],M=_.length;R<M;R++)(_[R].fn!==m||k&&!_[R].once||v&&_[R].context!==v)&&T.push(_[R]);T.length?this._events[C]=T.length===1?T[0]:T:g(this,C)}return this},y.prototype.removeAllListeners=function(f){var m;return f?(m=s?s+f:f,this._events[m]&&g(this,m)):(this._events=new i,this._eventsCount=0),this},y.prototype.off=y.prototype.removeListener,y.prototype.addListener=y.prototype.on,y.prefixed=s,y.EventEmitter=y,h.exports=y})(Pr);var fn=Pr.exports;const Rr=Or(fn);class Ir extends Rr{constructor(e,s){super(),x(this,"ogma"),x(this,"elements"),x(this,"layer"),x(this,"editor"),x(this,"selectedId",G),x(this,"hoveredId",G),x(this,"ogmaOptions"),x(this,"shouldDetect"),x(this,"isDragging"),x(this,"showeditorOnHover"),x(this,"_onKeyUp",i=>{i.code===27&&this.selectedId!==G?this.unselect():(i.code===46||i.code===8)&&this.selectedId!==G&&this._canRemove()&&this.remove(this.selectedId)}),x(this,"_onClickMouseMove",i=>{if(!i.domEvent||this.isDragging||!this.shouldDetect||i.domEvent.type!=="mousemove"&&i.domEvent.target&&i.domEvent.target.tagName==="a")return;const l=this.ogma.view.screenToGraphCoordinates(i),c=this.shouldDetect||!this.shouldDetect&&+this.selectedId>-1?this.detect(l,0):void 0;i.domEvent.type==="mousemove"?c?this.hover(c.id):this.hoveredId!==G&&this.unhover():c?this.select(c.id):this.selectedId!==G&&this.unselect()}),this.ogma=e,this.elements=[],this.shouldDetect=!0,this.isDragging=!1,this.showeditorOnHover=!0,this.ogmaOptions=e.getOptions(),e.events.on(["click","mousemove"],this._onClickMouseMove).on("keyup",this._onKeyUp).on("frame",()=>{this.refreshEditor(),this.refreshDrawing()}),this.layer=e.layers.addSVGLayer({draw:i=>this.draw(i)}),this.layer.moveToTop(),this.editor=e.layers.addLayer(s),this.editor.hide()}_canRemove(){return!0}add(e){const s=this.getDefaultOptions(),i=Object.assign(e,{id:e.id===void 0?pe():e.id,type:e.type,properties:{...s.properties,...e.properties||{},style:{...s.properties.style,...e.properties.style||{}}},geometry:{...s.geometry,...e.geometry}});return this.elements.push(i),this.layer.refresh(),this.emit(Ge,i),i}updateStyle(e,s){this.updateAnnotation(e,{properties:{style:s}})}updateGeometry(e,s){this.updateAnnotation(e,{geometry:s})}scale(e,s,i,l){this.updateGeometry(e,on(e.geometry,s,i,l))}update(e,s){const i=this.getById(e);this.updateAnnotation(i,s)}updateAnnotation(e,s){if(!e)return;const i=e.id;Object.keys(s).forEach(l=>{if(l!=="id")if(l==="properties"){const c=s.properties||{style:{}};e.properties={...e.properties||{},...c||{},style:{...e.properties.style||{},...c.style||{}}}}else l==="geometry"?e.geometry={...e.geometry,...s.geometry}:e[l]=s[l]}),i===this.selectedId&&this.refreshEditor(),this.layer.refresh()}getById(e){const s=Number(e);for(let i=0;i<this.elements.length;i++){const l=this.elements[i];if(!(l.id!==e&&l.id!==s))return l}}select(e){const s=this.getById(e);s&&(this.editor.show(),this.selectedId=e,this.refreshEditor(),this.layer.refresh(),this.emit(We,s))}hover(e){const s=this.getById(e);s&&(this.showeditorOnHover&&this.editor.show(),this.hoveredId=e,this.refreshEditor(),this.layer.refresh(),this.emit(ln,s))}getSelectedFeature(){return this.selectedId===G?null:this.getById(this.selectedId)}unselect(){const e=this.getById(this.selectedId);return e&&this.emit(Ve,e),this.selectedId=G,this.hoveredId===G&&this.editor.hide(),this.layer.refresh(),this}unhover(){const e=this.getById(this.hoveredId);return this.emit(un,e),this.hoveredId=G,this.selectedId===G&&this.editor.hide(),this.layer.refresh(),this}remove(e){const s=this.getById(e);e===this.hoveredId&&this.unhover(),e===this.selectedId&&this.unselect(),this.elements=this.elements.filter(i=>i.id!==e),s&&this.emit(Ye,s),this.layer.refresh()}disableDragging(){this.ogma.setOptions({interactions:{drag:{enabled:!1},pan:{enabled:!1}},detect:{nodes:!1,edges:!1,nodeTexts:!1,edgeTexts:!1}})}restoreDragging(){this.ogma.setOptions(this.ogmaOptions)}enableDetection(){this.shouldDetect=!0}disableDetection(){this.shouldDetect=!1}refreshLayer(){this.layer.refresh()}refreshDrawing(){}getElements(){return[...this.elements]}destroy(){this.ogma.events.off(this._onClickMouseMove).off(this._onKeyUp),this.layer.destroy()}}const Lr="handle-line",jr="handle-start",Fr="handle-end";class gn extends Ir{constructor(e,s={}){super(e,`
27
+ <%s key={someKey} {...props} />`,z,L,pt,L),Ne[L+z]=!0)}if(L=null,v!==void 0&&(i(v),L=""+v),m(E)&&(i(E.key),L=""+E.key),"key"in E){v={};for(var wt in E)wt!=="key"&&(v[wt]=E[wt])}else v=E;return L&&C(v,typeof h=="function"?h.displayName||h.name||"Unknown":h),A(h,L,W,tt,p(),v)}function x(h,E){if(typeof h=="object"&&h&&h.$$typeof!==Me){if(Nt(h))for(var v=0;v<h.length;v++){var z=h[v];M(z)&&I(z,E)}else if(M(h))h._store&&(h._store.validated=1);else if(h===null||typeof h!="object"?v=null:(v=vt&&h[vt]||h["@@iterator"],v=typeof v=="function"?v:null),typeof v=="function"&&v!==h.entries&&(v=v.call(h),v!==h))for(;!(h=v.next()).done;)M(h.value)&&I(h.value,E)}}function M(h){return typeof h=="object"&&h!==null&&h.$$typeof===B}function I(h,E){if(h._store&&!h._store.validated&&h.key==null&&(h._store.validated=1,E=T(E),!Re[E])){Re[E]=!0;var v="";h&&h._owner!=null&&h._owner!==p()&&(v=null,typeof h._owner.tag=="number"?v=a(h._owner.type):typeof h._owner.name=="string"&&(v=h._owner.name),v=" It was passed a child from "+v+".");var z=_t.getCurrentStack;_t.getCurrentStack=function(){var tt=g(h.type);return z&&(tt+=z()||""),tt},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',E,v),_t.getCurrentStack=z}}function T(h){var E="",v=p();return v&&(v=a(v.type))&&(E=`
28
+
29
+ Check the render method of \``+v+"`."),E||(h=a(h))&&(E=`
30
+
31
+ Check the top-level render call using <`+h+">."),E}var H=Q,B=Symbol.for("react.transitional.element"),ot=Symbol.for("react.portal"),rt=Symbol.for("react.fragment"),Vt=Symbol.for("react.strict_mode"),Jt=Symbol.for("react.profiler"),ke=Symbol.for("react.consumer"),Ht=Symbol.for("react.context"),Dt=Symbol.for("react.forward_ref"),se=Symbol.for("react.suspense"),Pt=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),St=Symbol.for("react.lazy"),at=Symbol.for("react.offscreen"),vt=Symbol.iterator,oe=Symbol.for("react.client.reference"),_t=H.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=Object.prototype.hasOwnProperty,Ct=Object.assign,Qe=Symbol.for("react.client.reference"),Nt=Array.isArray,Rt=0,Se,_e,Ce,Te,Oe,le,je;r.__reactDisabledLog=!0;var Zt,Le,he=!1,ue=new(typeof WeakMap=="function"?WeakMap:Map),Me=Symbol.for("react.client.reference"),De,Pe={},Ne={},Re={};re.Fragment=rt,re.jsx=function(h,E,v,z,tt){return _(h,E,v,!1,z,tt)},re.jsxs=function(h,E,v,z,tt){return _(h,E,v,!0,z,tt)}}()),re}var lr;function Vr(){return lr||(lr=1,process.env.NODE_ENV==="production"?pe.exports=Gr():pe.exports=Xr()),pe.exports}var Jr=Vr(),Zr=Object.defineProperty,Kr=(a,t,i)=>t in a?Zr(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i,w=(a,t,i)=>Kr(a,typeof t!="symbol"?t+"":t,i);let me=(a=21)=>crypto.getRandomValues(new Uint8Array(a)).reduce((t,i)=>(i&=63,i<36?t+=i.toString(36):i<62?t+=(i-26).toString(36).toUpperCase():i>62?t+="-":t+="_",t),"");const ne={strokeType:"plain",strokeColor:"#202020",strokeWidth:1,head:"none",tail:"none"},hr={id:0,type:"Feature",properties:{type:"arrow",style:{...ne}},geometry:{type:"LineString",coordinates:[[0,0],[100,100]]}},Qr=(a=0,t=0,i=0,r=0,o={...ne})=>({id:me(),type:"Feature",properties:{type:"arrow",style:{...ne,...o}},geometry:{type:"LineString",coordinates:[[a,t],[i,r]]}}),tn="http://www.w3.org/2000/svg";function $t(a){return document.createElementNS(tn,a)}function ur(a){return a.geometry.bbox||en(a),a.geometry.bbox}function At(a){const t=ur(a);return{width:t[2]-t[0],height:t[3]-t[1]}}function Et(a){const t=ur(a);return{x:t[0],y:t[1]}}function en(a){const[t,i]=a.geometry.coordinates[0][0],[r,o]=a.geometry.coordinates[0][2];a.geometry.bbox=[t,i,r,o]}function rn(a,t,i,r,o){a.geometry.bbox=[t,i,t+r,i+o],a.geometry.coordinates=[[[t,i],[t+r,i],[t+r,i+o],[t,i+o],[t,i]]]}function ie(a){const[t,i]=a.geometry.coordinates[0];return{x:t,y:i}}function ye(a,t){const[i,r]=a.geometry.coordinates[t==="start"?0:1];return{x:i,y:r}}function ve(a){const[t,i]=a.geometry.coordinates[1];return{x:t,y:i}}function cr(a,t,i){a.geometry.coordinates[0]=[t,i]}function dr(a,t,i){a.geometry.coordinates[1]=[t,i]}function we(a){return{start:ie(a),end:ve(a)}}function qt(a,t,i,r){t==="start"?cr(a,i,r):dr(a,i,r)}const fr=a=>parseInt(a.getAttribute("data-handle-id")||"-1");function nn(a){return Array.isArray(a)&&a.length===2&&a.every(isFinite)}function sn(a,t,i,r){for(let o=0;o<a.coordinates.length;o++){const u=a.coordinates[o];if(nn(u))u[0]=i+(u[0]-i)*t,u[1]=r+(u[1]-r)*t;else for(let d=0;d<u.length;d++){const f=u[d];f[0]=i+(f[0]-i)*t,f[1]=r+(f[1]-r)*t}}return a}function be(a,t,i){const r=Math.atan2(a.y-t.y,a.x-t.x);return{x:t.x+i*Math.cos(r),y:t.y+i*Math.sin(r)}}function $e(a,t){if(!t)return{x:a.clientX,y:a.clientY};const i=t.getBoundingClientRect();return{x:a.clientX-i.left-t.clientLeft,y:a.clientY-i.top-t.clientTop}}function on(a,t){return a.startsWith("#")?ln(a,t):a.startsWith("rgb")?hn(a,t):a}function an(a){return a.length===4?a.split("").map(t=>t+t).join(""):a}function ln(a,t){const[i,r,o]=an(a).match(/\w\w/g).map(u=>parseInt(u,16));return`rgba(${i}, ${r}, ${o}, ${t})`}function hn(a,t){const[i,r,o]=a.match(/\d+/g).map(u=>parseInt(u,10));return`rgba(${i}, ${r}, ${o}, ${t})`}const Ft=(a,t)=>({x:a.x-t.x,y:a.y-t.y}),Ut=a=>Math.sqrt(a.x*a.x+a.y*a.y),gr=a=>({x:-a.x,y:-a.y}),pr=a=>{const t=Ut(a);return t===0?{x:0,y:0}:{x:a.x/t,y:a.y/t}},Yt=(a,t)=>({x:a.x+t.x,y:a.y+t.y}),mr=(a,t)=>({x:a.x*t,y:a.y*t}),xe=(a,t)=>({x:a.x*t.x,y:a.y*t.y}),dt=(a,t)=>{const i=Math.sin(t),r=Math.cos(t);return{x:a.x*r-a.y*i,y:a.x*i+a.y*r}},un=(a,t)=>({x:a.x/t,y:a.y/t}),yr=(a,t)=>a.x*t.x+a.y*t.y,cn=.5;function vr(a,t=5,i=30){var r;const{start:o,end:u}=we(a),d=Ft(u,o),f=a.properties.style&&a.properties.style.strokeWidth?(r=a.properties.style)==null?void 0:r.strokeWidth:0;return Math.min(i,Math.max(3*f,Ut(d)*.01,t))}function wr(a,t,i,r){const o=mr(gr(pr(t)),r);if(!i||i!=="arrow"&&i!=="arrow-plain")return"";const u=Yt(a,dt(o,Math.PI/10)),d=Yt(a,dt(o,-Math.PI/10)),f=`${a.x} ${a.y}`;return`M ${u.x} ${u.y} L ${f} ${d.x} ${d.y} ${i==="arrow"?"":`${u.x} ${u.y}`}`}function dn(a,t,i,r,o){const{start:u,end:d}=we(a),{tail:f,head:g,strokeColor:p,strokeWidth:m=0}=a.properties.style||i,C=Ft(d,u),S=vr(a,r,o),A=$t("g"),_=$t("path");A.setAttribute("data-annotation",`${a.id}`),A.setAttribute("data-annotation-type","arrow");const x=g==="arrow-plain"||f==="arrow",M=p||"none";_.setAttribute("stroke",M),_.setAttribute("stroke-width",`${m}`),_.setAttribute("fill",x?p||"":"none"),_.setAttribute("stroke-linecap","round"),_.setAttribute("stroke-linejoin","round");const I=wr(u,gr(C),f,S),T=wr(d,C,g,S),H=I+`M ${u.x} ${u.y} ${d.x} ${d.y}`+T;_.setAttribute("d",H),A.appendChild(_),br(A,u,M,f,m),br(A,d,M,g,m),t.appendChild(A)}function br(a,t,i,r,o){r==="halo-dot"&&xr(a,t,fn(i),o*4),(r==="dot"||r==="halo-dot")&&xr(a,t,i,o*2)}function fn(a){return a==="none"?"none":on(a,cn)}function xr(a,t,i,r){const o=$t("circle");o.setAttribute("cx",`${t.x}`),o.setAttribute("cy",`${t.y}`),o.setAttribute("r",`${r}`),o.setAttribute("fill",i),a.appendChild(o)}const Z=-1,Ae="dragging",Ee="dragstart",Gt="dragend",Fe="select",He="unselect",gn="hover",pn="unhover",Be="remove",We="add",mn="cancelDrawing",qe="update",yn="link";function Ar(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Er={exports:{}},kr;function vn(){return kr||(kr=1,function(a){var t=Object.prototype.hasOwnProperty,i="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(i=!1));function o(g,p,m){this.fn=g,this.context=p,this.once=m||!1}function u(g,p,m,C,S){if(typeof m!="function")throw new TypeError("The listener must be a function");var A=new o(m,C||g,S),_=i?i+p:p;return g._events[_]?g._events[_].fn?g._events[_]=[g._events[_],A]:g._events[_].push(A):(g._events[_]=A,g._eventsCount++),g}function d(g,p){--g._eventsCount===0?g._events=new r:delete g._events[p]}function f(){this._events=new r,this._eventsCount=0}f.prototype.eventNames=function(){var g=[],p,m;if(this._eventsCount===0)return g;for(m in p=this._events)t.call(p,m)&&g.push(i?m.slice(1):m);return Object.getOwnPropertySymbols?g.concat(Object.getOwnPropertySymbols(p)):g},f.prototype.listeners=function(g){var p=i?i+g:g,m=this._events[p];if(!m)return[];if(m.fn)return[m.fn];for(var C=0,S=m.length,A=new Array(S);C<S;C++)A[C]=m[C].fn;return A},f.prototype.listenerCount=function(g){var p=i?i+g:g,m=this._events[p];return m?m.fn?1:m.length:0},f.prototype.emit=function(g,p,m,C,S,A){var _=i?i+g:g;if(!this._events[_])return!1;var x=this._events[_],M=arguments.length,I,T;if(x.fn){switch(x.once&&this.removeListener(g,x.fn,void 0,!0),M){case 1:return x.fn.call(x.context),!0;case 2:return x.fn.call(x.context,p),!0;case 3:return x.fn.call(x.context,p,m),!0;case 4:return x.fn.call(x.context,p,m,C),!0;case 5:return x.fn.call(x.context,p,m,C,S),!0;case 6:return x.fn.call(x.context,p,m,C,S,A),!0}for(T=1,I=new Array(M-1);T<M;T++)I[T-1]=arguments[T];x.fn.apply(x.context,I)}else{var H=x.length,B;for(T=0;T<H;T++)switch(x[T].once&&this.removeListener(g,x[T].fn,void 0,!0),M){case 1:x[T].fn.call(x[T].context);break;case 2:x[T].fn.call(x[T].context,p);break;case 3:x[T].fn.call(x[T].context,p,m);break;case 4:x[T].fn.call(x[T].context,p,m,C);break;default:if(!I)for(B=1,I=new Array(M-1);B<M;B++)I[B-1]=arguments[B];x[T].fn.apply(x[T].context,I)}}return!0},f.prototype.on=function(g,p,m){return u(this,g,p,m,!1)},f.prototype.once=function(g,p,m){return u(this,g,p,m,!0)},f.prototype.removeListener=function(g,p,m,C){var S=i?i+g:g;if(!this._events[S])return this;if(!p)return d(this,S),this;var A=this._events[S];if(A.fn)A.fn===p&&(!C||A.once)&&(!m||A.context===m)&&d(this,S);else{for(var _=0,x=[],M=A.length;_<M;_++)(A[_].fn!==p||C&&!A[_].once||m&&A[_].context!==m)&&x.push(A[_]);x.length?this._events[S]=x.length===1?x[0]:x:d(this,S)}return this},f.prototype.removeAllListeners=function(g){var p;return g?(p=i?i+g:g,this._events[p]&&d(this,p)):(this._events=new r,this._eventsCount=0),this},f.prototype.off=f.prototype.removeListener,f.prototype.addListener=f.prototype.on,f.prefixed=i,f.EventEmitter=f,a.exports=f}(Er)),Er.exports}var wn=vn();const Sr=Ar(wn);class _r extends Sr{constructor(t,i){super(),w(this,"ogma"),w(this,"elements"),w(this,"layer"),w(this,"editor"),w(this,"selectedId",Z),w(this,"hoveredId",Z),w(this,"ogmaOptions"),w(this,"shouldDetect"),w(this,"isDragging"),w(this,"showeditorOnHover"),w(this,"_onKeyUp",r=>{r.code===27&&this.selectedId!==Z?this.unselect():(r.code===46||r.code===8)&&this.selectedId!==Z&&this._canRemove()&&this.remove(this.selectedId)}),w(this,"_onClickMouseMove",r=>{if(!r.domEvent||this.isDragging||!this.shouldDetect||r.domEvent.type!=="mousemove"&&r.domEvent.target&&r.domEvent.target.tagName==="a")return;const o=this.ogma.view.screenToGraphCoordinates(r),u=this.shouldDetect||!this.shouldDetect&&+this.selectedId>-1?this.detect(o,0):void 0;r.domEvent.type==="mousemove"?u?this.hover(u.id):this.hoveredId!==Z&&this.unhover():u?this.select(u.id):this.selectedId!==Z&&this.unselect()}),this.ogma=t,this.elements=[],this.shouldDetect=!0,this.isDragging=!1,this.showeditorOnHover=!0,this.ogmaOptions=t.getOptions(),t.events.on(["click","mousemove"],this._onClickMouseMove).on("keyup",this._onKeyUp).on("frame",()=>{this.refreshEditor(),this.refreshDrawing()}),this.layer=t.layers.addSVGLayer({draw:r=>this.draw(r)}),this.layer.moveToTop(),this.editor=t.layers.addLayer(i),this.editor.hide()}_canRemove(){return!0}add(t){const i=this.getDefaultOptions(),r=Object.assign(t,{id:t.id===void 0?me():t.id,type:t.type,properties:{...i.properties,...t.properties||{},style:{...i.properties.style,...t.properties.style||{}}},geometry:{...i.geometry,...t.geometry}});return this.elements.push(r),this.layer.refresh(),this.emit(We,r),r}updateStyle(t,i){this.updateAnnotation(t,{properties:{style:i}})}updateGeometry(t,i){this.updateAnnotation(t,{geometry:i})}scale(t,i,r,o){this.updateGeometry(t,sn(t.geometry,i,r,o))}update(t,i){const r=this.getById(t);this.updateAnnotation(r,i)}updateAnnotation(t,i){if(!t)return;const r=t.id;Object.keys(i).forEach(o=>{if(o!=="id")if(o==="properties"){const u=i.properties||{style:{}};t.properties={...t.properties||{},...u||{},style:{...t.properties.style||{},...u.style||{}}}}else o==="geometry"?t.geometry={...t.geometry,...i.geometry}:t[o]=i[o]}),r===this.selectedId&&this.refreshEditor(),this.layer.refresh()}getById(t){const i=Number(t);for(let r=0;r<this.elements.length;r++){const o=this.elements[r];if(!(o.id!==t&&o.id!==i))return o}}select(t){const i=this.getById(t);i&&(this.editor.show(),this.selectedId=t,this.refreshEditor(),this.layer.refresh(),this.emit(Fe,i))}hover(t){const i=this.getById(t);i&&(this.showeditorOnHover&&this.editor.show(),this.hoveredId=t,this.refreshEditor(),this.layer.refresh(),this.emit(gn,i))}getSelectedFeature(){return this.selectedId===Z?null:this.getById(this.selectedId)}unselect(){const t=this.getById(this.selectedId);return t&&this.emit(He,t),this.selectedId=Z,this.hoveredId===Z&&this.editor.hide(),this.layer.refresh(),this}unhover(){const t=this.getById(this.hoveredId);return this.emit(pn,t),this.hoveredId=Z,this.selectedId===Z&&this.editor.hide(),this.layer.refresh(),this}remove(t){const i=this.getById(t);t===this.hoveredId&&this.unhover(),t===this.selectedId&&this.unselect(),this.elements=this.elements.filter(r=>r.id!==t),i&&this.emit(Be,i),this.layer.refresh()}disableDragging(){this.ogma.setOptions({interactions:{drag:{enabled:!1},pan:{enabled:!1}},detect:{nodes:!1,edges:!1,nodeTexts:!1,edgeTexts:!1}})}restoreDragging(){this.ogma.setOptions(this.ogmaOptions)}enableDetection(){this.shouldDetect=!0}disableDetection(){this.shouldDetect=!1}refreshLayer(){this.layer.refresh()}refreshDrawing(){}getElements(){return[...this.elements]}destroy(){this.ogma.events.off(this._onClickMouseMove).off(this._onKeyUp),this.layer.destroy()}}const Cr="handle-line",Tr="handle-start",Or="handle-end";class bn extends _r{constructor(t,i={}){super(t,`
31
32
  <div class="arrow-handle">
32
- <div id="${Lr}" data-handle-id="0" class="handle line"></div>
33
- <div id="${jr}" data-handle-id="1" class="handle point"></div>
34
- <div id="${Fr}" data-handle-id="2" class="handle point"></div>
33
+ <div id="${Cr}" data-handle-id="0" class="handle line"></div>
34
+ <div id="${Tr}" data-handle-id="1" class="handle point"></div>
35
+ <div id="${Or}" data-handle-id="2" class="handle point"></div>
35
36
  </div>
36
- `),x(this,"draggedHandle",G),x(this,"start",{x:0,y:0}),x(this,"end",{x:0,y:0}),x(this,"arrow",{...mr}),x(this,"startX",0),x(this,"startY",0),x(this,"minArrowHeight",0),x(this,"maxArrowHeight",0),x(this,"handles",[]),x(this,"onHandleMouseDown",i=>{const l=this.getById(this.selectedId)||this.getById(this.hoveredId);if(!l)return;const{x:c,y:g}=we(i,this.ogma.getContainer());this.startDragging(l,c,g),this.draggedHandle=Ar(i.target)}),x(this,"onMouseUp",()=>{this.draggedHandle!==-1&&(this.restoreDragging(),this.isDragging=!1,this.draggedHandle=G,this.emit(jt,this.arrow))}),x(this,"onMouseMove",i=>{if(!this.isDragging||this.draggedHandle===G)return;const l=this.handles[this.draggedHandle],c=this.ogma.view.getAngle(),g=we(i,this.ogma.getContainer()),{x:y,y:f}=st(sn({x:g.x-this.startX,y:g.y-this.startY},this.ogma.view.getZoom()),c),m=l.id===Lr,v=l.id===jr,k=l.id===Fr;(m||v)&&wr(this.arrow,this.start.x+y,this.start.y+f),(m||k)&&xr(this.arrow,this.end.x+y,this.end.y+f),this.emit(Ae,this.arrow,m?"line":v?"start":"end"),this.refreshEditor(),this.layer.refresh()}),this.minArrowHeight=s.minArrowHeight||0,this.maxArrowHeight=s.maxArrowHeight||1e6,this.handles=Array.prototype.slice.call(this.editor.element.querySelectorAll(".arrow-handle>.handle")),this.handles.forEach(i=>i.addEventListener("mousedown",this.onHandleMouseDown)),document.addEventListener("mousemove",this.onMouseMove,!0),document.addEventListener("mouseup",this.onMouseUp)}startDrawing(e,s,i=Qr(e,s,e,s,Xt)){var l;this.disableDragging(),this.add(i),this.hoveredId=i.id;const c=this.ogma.view.graphToScreenCoordinates({x:e,y:s}),g=((l=this.ogma.getContainer())==null?void 0:l.getBoundingClientRect())||{left:0,top:0};this.startDragging(this.getById(i.id),c.x+(g==null?void 0:g.left),c.y+g.top),this.draggedHandle=2}cancelDrawing(){this.isDragging&&(this.remove(this.arrow.id),this.emit(jt,this.arrow),this.restoreDragging(),this.isDragging=!1,this.draggedHandle=G)}startDragging(e,s,i){this.selectedId!==e.id&&this.select(this.hoveredId),this.arrow=e,this.startX=s,this.startY=i,this.start=Kt(this.arrow),this.end=ve(this.arrow),this.disableDragging(),this.emit(Ee,this.arrow),this.isDragging=!0}detect(e,s=0){return this.elements.find(i=>{const{start:l,end:c}=me(i),g=_t(e,{x:(l.x+c.x)/2,y:(l.y+c.y)/2}),y=_t(c,l),f=It(y),m=_r(y),v=Tr(i);return Math.abs(Sr(m,g))<f/2+s&&Math.abs(Sr(st(m,Math.PI/2),g))<v/2+s})}refreshEditor(){if(+this.selectedId<0&&+this.hoveredId<0)return;const e=this.selectedId!==G?this.getById(this.selectedId):this.getById(this.hoveredId),s=me(e),i=this.ogma.view.graphToScreenCoordinates(s.start),l=this.ogma.view.graphToScreenCoordinates(s.end),[c,g,y]=Array.prototype.slice.call(this.editor.element.querySelectorAll(".handle"));g.style.transform=`translate(${i.x}px, ${i.y}px) translate(-50%, -50%)`,y.style.transform=`translate(${l.x}px, ${l.y}px) translate(-50%, -50%)`;const f={x:(l.x+i.x)/2,y:(l.y+i.y)/2},m=_t(l,i),v=kr(m,1/It(m)),k=Math.atan2(v.y,v.x);c.style.width=`${It(m)}px`,c.style.left=`${f.x}px`,c.style.top=`${f.y}px`,c.style.transform=`translate(-50%, -50%) rotate(${k}rad)`}getDefaultOptions(){return mr}draw(e){e.innerHTML="";const s=Jt("g"),i=this.ogma.view.getAngle();s.setAttribute("transform",`rotate(${-i*(180/Math.PI)})`),this.elements.forEach(l=>an(l,s,Xt,this.minArrowHeight,this.maxArrowHeight)),e.appendChild(s)}refreshDrawing(){const e=this.ogma.view.getAngle();this.layer.element!==null&&this.layer.element.children[0].setAttribute("transform",`rotate(${-e*(180/Math.PI)})`)}destroy(){super.destroy(),document.removeEventListener("mousemove",this.onMouseMove,!0),document.removeEventListener("mouseup",this.onMouseUp)}}const Ft={font:"sans-serif",fontSize:12,color:"black",background:"",strokeWidth:1,strokeColor:"#000",strokeType:"plain"},Xe={id:0,type:"Feature",properties:{type:"text",content:"",style:{...Ft}},geometry:{type:"Polygon",coordinates:[[[0,0],[100,0],[100,50],[0,50],[0,0]]]}},Dr={handleSize:3.5,placeholder:"Your text..."},pn=(h=0,e=0,s=100,i=50,l="",c={...Ft})=>({id:pe(),type:"Feature",properties:{type:"text",content:l,style:{...Ft,...c}},geometry:{type:"Polygon",coordinates:[[[h,e],[h+s,e],[h+s,e+i],[h,e+i],[h,e]]]}});var Mr={exports:{}};(function(h,e){(function(s,i){h.exports=i()})(dn,()=>(()=>{var s={d:(r,n)=>{for(var a in n)s.o(n,a)&&!s.o(r,a)&&Object.defineProperty(r,a,{enumerable:!0,get:n[a]})},o:(r,n)=>Object.prototype.hasOwnProperty.call(r,n)},i={};function l(r){return l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},l(r)}s.d(i,{default:()=>Ne});var c=/^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/,g=/\bsmall-caps\b/,y=/\b(?:italic|oblique)\b/,f=/\bbold(?:er)?\b/,m=13.3333333,v={"xx-small":9,"x-small":10,smaller:13.3333,small:13,medium:16,large:18,larger:19.2,"x-large":24,"xx-large":32};function k(r){var n="",a=this;return a.style&&a.style!=="normal"&&(n+=a.style),a.variant&&a.variant!=="normal"&&(n+=(n?" ":"")+a.variant),a.weight&&a.weight!=="normal"&&(n+=(n?" ":"")+a.weight),a.size&&(n+=(n?" ":"")+a.size+"px",a.height!==a.size&&(n+="/"+a.height+"px")),a.family&&(n+=(n?" ":"")+a.family),r&&(n+="::"+a.baseline),r&&(n+="::"+a.color),n}var C={id:"",family:"sans-serif",height:14,size:12,variant:"",style:"",weight:"",baseline:"",color:null,toString:k,valueOf:k};function _(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=c.exec(r);n.family=(a[6]||"").trim();var o=v[a[2]]||parseFloat(a[2]);a[3]==="%"?o*=.16:a[3]==="em"?o*=16:a[3]==="pt"&&(o*=m),n.size=o;var t=parseFloat(a[4]);if(t!=="normal"&&t!=="inherit"&&t?a[5]&&a[5]!=="em"?a[5]==="pt"?n.height=t*m:a[5]==="%"?n.height=.01*o:n.height=t:n.height=t*o:n.height=Math.round(o*(7/6)),g.test(a[1])&&(n.variant="small-caps"),y.test(a[1])&&(n.style="italic"),f.test(a[1]))n.weight="bold";else{var u=parseInt(/\b(\d+)\b/.exec(a[1]),10);u>=100&&u!==400&&(n.weight=u)}return n}function R(){var r,n,a,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"12px/14px sans-serif",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=14,d=12,p=null,b=null,w="";if(o&&o.nodeType){var A=o&&(o.ownerDocument&&o.ownerDocument.defaultView||o.document&&o||o.defaultView),E=A.getComputedStyle(o,null);r=E.getPropertyValue("font-family")||"",d=parseFloat(E.getPropertyValue("font-size")),u=E.getPropertyValue("line-height"),p=E.getPropertyValue("font-weight"),b=E.getPropertyValue("font-style"),w=E.getPropertyValue("font-variant")||""}else if(typeof o=="string"){var O=_(o);r=O.family,d=O.size,u=O.height,w=O.variant,b=O.style,p=O.weight}else l(o)==="object"&&(r=o.family,d=o.size,u=o.height,w=o.variant,p=o.weight,b=o.style,n=o.baseline,a=o.color);t.size&&t.size<3&&(d*=t.size),u=u!=="normal"&&u?parseFloat(u):d*(7/6),t.height&&t.height<3&&(u*=t.height);var P=Object.create(C);return P.family=t.family||r||"sans-serif",P.height=u??14,P.size=d??12,P.variant=t.variant||w||"",P.style=t.style||b||"",P.weight=t.weight||p||"",P.baseline=n||0,t.baseline!=null&&(P.baseline=t.baseline),P.color=t.color||a||"",P.id=k.call(P,!0),P}const T={"\n":.28,"\r":.28," ":.28," ":.28," ":.28,"᠎":0," ":.5," ":1," ":.5," ":1," ":.33," ":.25," ":.16," ":.56," ":.28," ":.2," ":.15,"​":0," ":.16," ":.22," ":1,"\uFEFF":0};var M,L=function(r){var n=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(100,100)||r&&r.createElement("canvas");if(n&&n.getContext){var a=n.getContext("2d");if(a&&typeof a.measureText=="function")return function(o,t){return a.font=String(t),a.measureText(o).width}}}(typeof document<"u"?document:null)||(M={},function(r,n){if(!M[n]){var a=R(n);M[n]=a,/\bmonospace\b/.test(a.family)?a.size*=.6:(a.size*=.45,a.weight&&(a.size*=1.18))}return r.length*M[n].size}),S={},W={trim:!0,collapse:!0};function U(r,n,a){var o=Object.assign({},W,a),t=String(r);if(!t)return 0;if(t in T){var u=n.id+"/"+t;return u in S||(S[u]=L("_".concat(t,"_"),n)-L("__",n)),S[u]}return o.trim&&o.collapse?o.trim?t=t.trim():o.collapse&&(t=t.replace(/\s+/g," ")):t=t.replace(/\n/g," "),L(t,n)+n.size*(r.tracking||0)}function lt(r){return lt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},lt(r)}function kt(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(n&&n.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),n&&Zt(r,n)}function Zt(r,n){return Zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,o){return a.__proto__=o,a},Zt(r,n)}function Qt(r){var n=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var a,o=Dt(r);if(n){var t=Dt(this).constructor;a=Reflect.construct(o,arguments,t)}else a=o.apply(this,arguments);return _e(this,a)}}function _e(r,n){if(n&&(lt(n)==="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}(r)}function Dt(r){return Dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Dt(r)}function Mt(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}function ke(r,n){for(var a=0;a<n.length;a++){var o=n[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(r,(t=function(u,d){if(lt(u)!=="object"||u===null)return u;var p=u[Symbol.toPrimitive];if(p!==void 0){var b=p.call(u,d);if(lt(b)!=="object")return b;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(u)}(o.key,"string"),lt(t)==="symbol"?t:String(t)),o)}var t}function rt(r,n,a){return n&&ke(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r}var z=function(){function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";Mt(this,r),this.value=n,this.weight=null,this.style=null,this.font=null,this.href=null,this.sub=!1,this.sup=!1}return rt(r,[{key:"clone",value:function(){var n=new r(this.value);return n.value=this.value,n.weight=this.weight,n.style=this.style,n.font=this.font,n.href=this.href,n.sub=this.sub,n.sup=this.sup,n}},{key:"valueOf",value:function(){return this.value}},{key:"toString",value:function(){return this.value}}]),r}(),ht=function(r){kt(a,r);var n=Qt(a);function a(){return Mt(this,a),n.apply(this,arguments)}return rt(a)}(z),K=function(r){kt(a,r);var n=Qt(a);function a(){return Mt(this,a),n.apply(this,arguments)}return rt(a)}(z),ct=function(r){kt(a,r);var n=Qt(a);function a(){return Mt(this,a),n.apply(this,arguments)}return rt(a)}(z),$t=/^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/,Se=/^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/,te=/^[\xA0\u2011\u202F\u2060\uFEFF]/,Te=/^(?:[;\xAD%?…]|,(?!\d))/,Ce=/^[´±°¢£¤$¥\u2212]/;function St(r,n){n!==!1&&(r=r.trim());for(var a,o,t=[],u=r.charAt(0),d=0,p=1,b=r.length;p<b;p++){a=r.charAt(p),o=r.charAt(p+1);var w=$t.test(u),A=$t.test(a),E=A||w,O=void 0;if((Ce.test(a)&&!te.test(u)||Te.test(u+o)&&!te.test(a))&&(E=!0),u!=="-"&&u!=="‐"&&u!=="–"&&u!=="—"||((O=$t.test(r.charAt(p-2)))&&!A&&(E=!1),!O&&Se.test(a+o)&&(E=!0)),E){var P=r.slice(d,p);/\u00AD$/.test(P)?(t.push(new z(P.slice(0,-1))),t.push(new ct)):(t.push(new z(P)),t.push(new ht)),d=p}u=a}return t.push(new z(r.slice(d))),t}const Oe={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"⊥",or:"⊦",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›"};var rr=/^[\n\r\x20\u2000-\u200B\u205F\u3000]/,ee=/^<\/([a-zA-Z0-9]+)([^>]*)>/,re=/^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/,zt=/^<!--(.+?)-->/,ne=/&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g,Tt={b:function(r){r.weight="bold"},strong:function(r){r.weight="bold"},i:function(r){r.style="italic"},em:function(r){r.style="italic"},dfn:function(r){r.style="italic"},cite:function(r){r.style="italic"},code:function(r){r.family="monospace"},kbd:function(r){r.family="monospace"},samp:function(r){r.family="monospace"},var:function(r){r.family="monospace"},tt:function(r){r.family="monospace"},sub:function(r){r.sub=!0},sup:function(r){r.sup=!0}},nr={div:1,li:1,blockquote:2,h1:2,h2:2,h3:2,h4:2,h5:2,h6:2,ul:2,ol:2,hr:2,p:2};function ie(r){return r.replace(ne,function(n,a,o,t){if(a||o){var u=a?10:16;return String.fromCharCode(parseInt(a||o,u))}return t in Oe?Oe[t]:n})}function ir(r){return r&&r.length>1&&(r[0]==='"'&&r[r.length-1]==='"'||r[0]==="'"&&r[r.length-1]==="'")?r.slice(1,-1):r}var or=/^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;function Nt(r){var n,a={};if(r){do if(n=or.exec(r)){var o=ie(ir(n[2]||"")).replace(/[ \r\n\t]+/g," ").trim();if(a[n[1]]=o,(r=r.slice(n[0].length)).length&&/^\S/.test(r[0]))throw new Error("Attribute error")}while(n&&r.length);if(/\S/.test(r))throw new Error("Attribute error")}return a}const xt={copyright:"©",textcopyright:"©",dag:"†",textdagger:"†",ddag:"‡",textdaggerdbl:"‡",guillemotleft:"«",guillemotright:"»",guilsinglleft:"‹",guilsinglright:"›",ldots:"…",dots:"…",textellipsis:"…",lq:"‘",P:"¶",textparagraph:"¶",pounds:"£",textsterling:"£",quotedblbase:"„",quotesinglbase:"‚",rq:"’",S:"§",sim:"~",textasciicircum:"^",textasciitilde:"˜",texttildelow:"~",textasteriskcentered:"*",textbackslash:"'",textbar:"|",textbardbl:"╎",textbigcircle:"◯",textbraceleft:"{",textbraceright:"}",textbullet:"•",textdollar:"$",textemdash:"—",textendash:"—",texteuro:"€",eurosym:"€",euro:"€",textexclamdown:"¡",textgreater:">",textless:"<",textordfeminine:"ª",textordmasculine:"º",textperiodcentered:"·",cdot:"·",textquestiondown:"¿",textquotedblleft:"“",textquotedblright:"”",textquoteleft:"‘",textquoteright:"’",textquotestraightbase:"‚",textquotestraightdblbase:"„",textregistered:"®",textthreequartersemdash:"-",texttrademark:"™",texttwelveudash:"-",textunderscore:"_",textvisiblespace:"␣",gets:"←",textleftarrow:"←",to:"→",textrightarrow:"→",textdegree:"°",infty:"∞",triangle:"△",triangledown:"▽",blacktriangle:"▲",blacktriangledown:"▼",angle:"∠",sphericalangle:"∢",aleph:"ℵ",hbar:"ħ",imath:"𝚤",jmath:"𝚥",ell:"ℓ",wp:"℘",Re:"ℜ",Im:"ℑ",mho:"℧",prime:"′",emptyset:"∅",nabla:"∇",surd:"√",partial:"∂",top:"⟙",bot:"⟂",vdash:"⟝",dashv:"⟞",forall:"∀",exists:"∃",nexists:"∄",neg:"¬",lnot:"¬",flat:"♭",natural:"♮",sharp:"♯",backslash:"\\",Box:"□",Diamond:"♢",clubsuit:"♣",diamondsuit:"♦",heartsuit:"♥",spadesuit:"♠",Join:"⨝",blacksquare:"■",bigstar:"★",diagdown:"╲",diagup:"╱",blacklozenge:"⧫",rfloor:"⌋",lfloor:"⌊",rceil:"⌉",lceil:"⌈",rangle:"⟩",langle:"⟨",sum:"∑",int:"∫",oint:"∮",prod:"∏",coprod:"∏",bigcap:"∩",bigcup:"∪",bigsqcup:"⊔",bigvee:"∨",bigwedge:"∧",bigodot:"⊙",bigotimes:"⊗",bigoplus:"⊕",biguplus:"⊎",alpha:"α",beta:"β",chi:"χ",delta:"δ",epsilon:"ε",eta:"η",gamma:"γ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",omega:"ω",phi:"φ",pi:"π",psi:"ψ",rho:"ρ",sigma:"σ",tau:"τ",theta:"θ",upsilon:"υ",xi:"ξ",zeta:"ζ",Alpha:"Α",Beta:"Β",Chi:"Χ",Delta:"Δ",Epsilon:"Ε",Eta:"Η",Gamma:"Γ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Omega:"Ω",Phi:"Φ",Pi:"Π",Psi:"Ψ",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Theta:"Θ",Upsilon:"Υ",Xi:"Ξ",Zeta:"Ζ",aa:"å",AA:"Å",ae:"æ",AE:"Æ",dh:"ð",DH:"Ð",dj:"đ",DJ:"Đ",ij:"ij",IJ:"IJ",l:"ł",L:"Ł",ng:"ŋ",NG:"Ŋ",o:"ø",O:"Ø",oe:"œ",OE:"Œ",ss:"ß",SS:"SS",th:"þ",TH:"Þ"};var Pe=/^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/,Re=/^%[^\n]+(?:\n|$)/,Bt=/^[^#$%&~_^\\{}]+/,sr=/^\\([&{}$%#_])/,ar=/(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g,oe={"---":"—","--":"–","!`":"¡","?`":"¿","``":"“",",,":"„","''":"”","`":"‘","'":"’","<<":"«",">>":"»","~":" ","\\-":"­","\\,":" ","\\;":" ","\\:":" ","\\!":" ","\\@":"\uFEFF","\\\\":"\\newline{}"},V={bf:function(r){r.weight="bold"},it:function(r){r.style="italic"},sl:function(r){r.style="italic"},color:function(r,n){r.color=n},href:function(r,n){r.href=n},"^":function(r){r.sup=!0},_:function(r){r.sub=!0},par:function(r){this.tokens.push(new K,new K)},newline:function(r){this.tokens.push(new K)},url:function(r,n){this.open_context().href=n,this.add_token(new z(n)),this.close_context()}};V.textsuperscript=V["^"],V.textsubscript=V._,V.textsl=V.sl,V.mathbf=V.bf,V.mathit=V.it,V.textbf=V.bf,V.textit=V.it,V.textcolor=V.color;var lr=/[\r\n\xA0]+/g;function Ie(r,n){r.sup&&(r.baseline=.45,r.size=.7),r.sub&&(r.baseline=-.3,r.size=.7);var a=n;return(r.style||r.weight||r.baseline||r.color||r.size||r.family)&&(a=R(n,r)),a}function se(r,n,a){for(var o,t,u=r.width;u+a.width>n&&r.length;)t=(o=r[r.length-1]).width,o.width>a.width?(o.value=o.value.slice(0,-1),o.width=U(o,o.font),u+=o.width):r.pop(),u-=t;r[r.length-1]instanceof ct&&r.pop(),o=r[r.length-1]||o||{},a.font=R(a.font,o.bold,o.italic,""),a.href=r.length?o.href:null,a.rel=r.length?o.rel:null,a.target=r.length?o.target:null,r.push(a)}function ut(r){return Math.round(1e6*r)/1e6}function Le(r){return function(n){if(Array.isArray(n))return Ht(n)}(r)||function(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}(r)||function(n,a){if(n){if(typeof n=="string")return Ht(n,a);var o=Object.prototype.toString.call(n).slice(8,-1);return o==="Object"&&n.constructor&&(o=n.constructor.name),o==="Map"||o==="Set"?Array.from(n):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?Ht(n,a):void 0}}(r)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
37
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Ht(r,n){(n==null||n>r.length)&&(n=r.length);for(var a=0,o=new Array(n);a<n;a++)o[a]=r[a];return o}var je={center:"middle",right:"end"},ae={middle:.5,center:.5,bottom:1,end:1},le=function(r,n){return!r&&!n||r===n};function ur(r,n){var a=[],o=n.font(),t=o.size,u=o.family,d=n.align(),p=n.createElement();if(r.length){var b=o.height,w=n.valign(),A=n.height()(),E=n.width()(0),O=!isFinite(E)&&r.length===1,P=O?null:n.x(),I=ut(b/t),B=O?null:ut(b/(1.15*t+(b-t)/2));if(ae[w]&&isFinite(A)){var $=w==="bottom"?1:.5;B+=(A*$-b*r.length*$)/t}var j=d==="justify",D=0;d==="right"?D=E:d==="center"&&(D=E/2);for(var N=[],Q="tspan",J=null,Y="",F=function(){if(Y){var Ot=p(Q,J,Y);N.push(Ot)}Q="tspan",J=null,Y=""},ot=0,it=r.length;ot<it;ot++){var mt="",At="",ft=0,bt=r[ot];if(bt.length){N=[];for(var Vt=0,fe=0,wt=void 0,tt=0,Be=bt.length;tt<Be;tt++){var q=bt[tt],et=q.font;q.whitespace&&Vt++,fe+=q.width,tt&&!q.tracking&&!ft&&le(et.id,mt)&&le(q.class,At)&&le(wt,q.href)?Y+=q.value:(F(),Y=q.value,J={fontFamily:et.family!==u?et.family:null,fontSize:et.size!==t?et.size:null,fontWeight:et.weight||null,fontStyle:et.style||null,fontVariant:et.variant!=="normal"&&et.variant||null,fill:et.color||null,baselineShift:et.baseline?100*et.baseline+"%":null,className:q.class||null},ft&&(J.dx=ut(ft),ft=0),q.tracking&&(ft=et.size*q.tracking),q.href&&!wt?(wt=q.href,Q="a",J.href=wt,J.rel=q.rel,J.target=q.target):wt=null,mt=et.id,At=q.class)}if(F(),O)a.push.apply(a,Le(N));else{var He=null,ge=ot===it-1||bt[bt.length-1]instanceof K;j&&bt.length>1&&!ge&&(He=ut((E-fe)/Vt)),a.push(p.apply(void 0,["tspan",{wordSpacing:He,x:P(ot)+D,dy:ut(ot?I:B)+"em"}].concat(Le(N))))}}else a.push(p("tspan",{x:P(ot),dy:ut(ot?I:B)+"em"}," "))}}return p.apply(void 0,["text",{fontFamily:u,fontSize:t,textAnchor:je[d]||"start"}].concat(a))}var hr={middle:.5,center:.5,bottom:1,end:1};function cr(r,n,a){if(r.length){a.textBaseline="middle";var o=n.font(),t=o.height,u=o.size,d=n.valign(),p=n.height()(),b=n.width()(0),w=n.align(),A=w==="justify",E=.5*t,O=hr[d];if(O&&isFinite(p)){var P=r.length*t;E+=p*O-P*O}r.forEach(function(I,B){var $=n.x()(B),j=B*t+E,D=0,N=0;I.forEach(function(Y){Y.whitespace&&D++,N+=Y.width});var Q=0,J=B===r.length-1||I[I.length-1]instanceof K;A&&I.length>1&&!J&&(Q=(b-N)/D),I.forEach(function(Y){a.font=Y.font;var F=Y.font,ot=F.baseline?u*-F.baseline+.15*u:0;a.fillStyle=function(At,ft){return At.color?At.color:ft.href?"#00C":"#000"}(F,Y);var it=0;if(w==="right"?it+=b-N:w==="center"?it+=b/2-N/2:w==="justify"&&(Y.whitespace||Y instanceof K)&&($+=Q),a.fillText(Y.value,$+it,j+ot),Y.href){a.beginPath(),a.strokeStyle=a.fillStyle;var mt=Math.floor(j+.45*u)+.5;a.moveTo($+it,mt),a.lineTo($+it+Y.width,mt),a.stroke()}$+=Y.width})})}}function ue(r){return ue=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},ue(r)}function Fe(r){for(var n={},a=0;a<r.length;a++){var o=r[a];typeof o!="number"&&o!=null&&(typeof o=="string"?n.text=o:typeof o=="function"?n.fn=o:ue(o)==="object"&&o._groups?n.d3=o:o&&o.nodeType&&o.getContext?n.ctx=o.getContext("2d"):o&&o.fillText&&o.beginPath?n.ctx=o:o&&(n.text=o))}return n}function Ct(r){return Ct=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Ct(r)}function he(r,n){for(var a=0;a<n.length;a++){var o=n[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(r,(t=function(u,d){if(Ct(u)!=="object"||u===null)return u;var p=u[Symbol.toPrimitive];if(p!==void 0){var b=p.call(u,d);if(Ct(b)!=="object")return b;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(u)}(o.key,"string"),Ct(t)==="symbol"?t:String(t)),o)}var t}var De=R(),dt=function(r){return typeof r=="function"?r:function(){return r}},Z=function(){function r(o){if(function(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}(this,r),this.props={overflow:"ellipsis",lineclamp:null,align:"left",wordBreak:null,valign:"top",width:function(){return 1/0},height:function(){return 1/0},x:function(){return 0},font:null,tAnchor:0,parser:r.defaultparser},o)for(var t in o)typeof this[t]=="function"&&this[t](o[t])}var n,a;return n=r,a=[{key:"linebreak",value:function(o){var t=this,u=this.props.parser(String(o)),d=this.font(),p=function(b,w,A){if(!b.length)return[];var E=w.height(),O=w.width(),P=w.overflowLine(),I=w.overflowWrap(),B=R(A,!0,!1),$=isFinite(E())?Math.floor(E()/A.height):1/0;if(!E()&&!O(0)||!$)return[];for(var j=0,D=0,N=0,Q=[],J=[],Y=!1;j<b.length&&D<$;){var F=b[j],ot=Ie(F,A);if(F.width=U(F,ot),F.font=ot,F.line=D,F.whitespace=F.value in T,F.value&&(F.value=F.value.replace(lr," ")),!(!N&&F.whitespace||Y&&F.whitespace))if(F instanceof K)N=0,J=[],Q.push(j+1),D++;else if(F instanceof ht||F instanceof ct)J.push({index:j,width:N});else if(F.whitespace||N+F.width<O(D))N+=F.width;else if(J.length){var it=void 0,mt=void 0;do{mt=!0,it=J.pop();var At=b[it.index],ft=void 0;At instanceof ct&&(ft=U("-",At.font),it.width+ft>O(D)&&(mt=!J.length))}while(!mt);Q.push(it.index+1),N=0,D++,j=it.index,J=[]}else if(I==="break-word"){var bt=O(D);if(N+F.width>bt){var Vt=F.clone();do F.value=F.value.slice(0,-1),F.width=U(F,F.font),N+=F.width;while(F.value&&F.width>bt);Vt.value=Vt.value.slice(F.value.length),b.splice(j+1,0,new ht,Vt)}Q.push(j+1),N=0,D++}else N+=F.width;j++,Y=F.whitespace}j!==Q[Q.length-1]&&Q.push(j);var fe=0,wt=0,tt=Q.map(function(Ot){for(var nt,Pt=fe;(nt=b[Pt])&&(nt.whitespace||!nt.value);)Pt++;for(var Et=Ot,gr=null;Et>Pt&&(nt=b[Et-1])&&(nt.whitespace||!(nt.value||nt instanceof ct));)nt instanceof K&&(gr=nt),Et--;nt instanceof ct&&(nt.value="-",nt.width=U("-",nt.font)),fe=Ot;var Yt=b.slice(Pt,Et).filter(function(pr){return pr.value});return gr&&Yt.push(gr),Yt.width=Yt.reduce(function(pr,Pn){return pr+Pn.width},0),Yt.width>wt&&(wt=Yt.width),Yt});if(tt.hasLineOverflow=!1,P){var Be=P==="ellipsis"?"…":P;tt.forEach(function(Ot,nt){var Pt=O(nt);if(Ot.width>Pt){var Et=new z(Be);Et.font=A,Et.width=U(Be,B),se(Ot,Pt,Et),tt.hasLineOverflow=!0}})}var q=w.overflow()==="ellipsis"?"…":w.overflow();if(q&&j!==b.length){var et=O(tt.length-1),He=tt[tt.length-1],ge=new z(q);ge.font=A,ge.width=U(q,B),se(He,et,ge),tt.hasOverflow=!0}else tt.hasOverflow=!1;return tt.font=A,tt.width=wt,tt}(u,this,d);return p.height=p.length*d.height,p.render=function(b){return t.render(p,b)},p.svg=p.render,p.draw=p.render,p}},{key:"font",value:function(o){return arguments.length?(this.props.font=R(o),this):this.props.font||R(De)}},{key:"overflow",value:function(o){return arguments.length?(this.props.overflow=String(o),this):this.props.overflow}},{key:"overflowLine",value:function(o){return arguments.length?(this.props.lineclamp=String(o),this):this.props.lineclamp}},{key:"valign",value:function(o){return arguments.length?(this.props.valign=o,this):this.props.valign}},{key:"align",value:function(o){if(!arguments.length)return this.props.align;var t=String(o).toLowerCase();return t==="left"||t==="start"?(this.props.align="left",this.props.tAnchor=0):t==="center"||t==="middle"?(this.props.align="center",this.props.tAnchor=-.5):t==="end"||t==="right"?(this.props.align="right",this.props.tAnchor=-1):t==="justify"&&(this.props.align=o,this.props.tAnchor=0),this}},{key:"overflowWrap",value:function(o){if(!arguments.length)return this.props.overflowWrap||"normal";var t=String(o).toLowerCase();return t==="break-word"?this.props.overflowWrap="break-word":t!=="normal"&&o!=null||(this.props.overflowWrap=null),this}},{key:"width",value:function(o){return arguments.length?(this.props.width=dt(o),this):this.props.width}},{key:"height",value:function(o){return arguments.length?(this.props.height=dt(o),this):this.props.height}},{key:"x",value:function(o){return arguments.length?(this.props.x=dt(o),this):this.props.x}},{key:"parser",value:function(o){if(!arguments.length)return this.props.parser;if(typeof o=="string"){var t=r[o]||r[o+"parser"];typeof t=="function"&&(o=t)}if(typeof o!="function")throw new Error("Unknown parser: "+o);return this.props.parser=o,this}},{key:"createElement",value:function(o){return arguments.length?(this.props.createElement=o,this):this.props.createElement||r.createElement}},{key:"render",value:function(){var o=Fe(arguments);return typeof o.text=="string"&&(o.text=this.linebreak(o.text)),o.ctx?cr(o.text,this,o.ctx):ur(o.text,this)}}],a&&he(n.prototype,a),Object.defineProperty(n,"prototype",{writable:!1}),r}();function vt(r){return vt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},vt(r)}function Ut(r,n){(n==null||n>r.length)&&(n=r.length);for(var a=0,o=new Array(n);a<n;a++)o[a]=r[a];return o}function dr(r,n){for(var a=0;a<n.length;a++){var o=n[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(r,(t=function(u,d){if(vt(u)!=="object"||u===null)return u;var p=u[Symbol.toPrimitive];if(p!==void 0){var b=p.call(u,d);if(vt(b)!=="object")return b;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(u)}(o.key,"string"),vt(t)==="symbol"?t:String(t)),o)}var t}var ce=function(r){return typeof r=="function"?r:function(){return r}},Me=function(){function r(o){if(function(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}(this,r),this.props={width:function(){return 1/0},height:function(){return 1/0},rotation:0,vAnchor:0,hAnchor:0},o)for(var t in o)typeof this[t]=="function"&&this[t](o[t]);this.render=this.render.bind(this)}var n,a;return n=r,a=[{key:"anchor",value:function(o){var t=this.props,u=t.hAnchor,d=t.vAnchor,p=t.width,b=t.height;if(!arguments.length)return[u*p(0),d*b(0)];if(typeof o=="string"){var w=this.props;o.toLowerCase().trim().split(/\s+/).forEach(function(A){A==="top"&&(w.vAnchor=-0),A==="middle"&&(w.vAnchor=-.5),A==="bottom"&&(w.vAnchor=-1),A==="left"&&(w.hAnchor=-0),A==="center"&&(w.hAnchor=-.5),A==="right"&&(w.hAnchor=-1)})}return this}},{key:"width",value:function(o){return arguments.length?(this.props.width=ce(o),this):this.props.width}},{key:"height",value:function(o){return arguments.length?(this.props.height=ce(o),this):this.props.height}},{key:"rotate",value:function(o){return arguments.length?(this.props.rotation=o,this):this.props.rotation}},{key:"createElement",value:function(o){return arguments.length?(this.props.createElement=o,this):this.props.createElement||r.createElement}},{key:"canvas",value:function(o,t){var u,d=o.getContext?o.getContext("2d"):o;return d.save(),d.rotate(this.rotate()*Math.PI/180),d.translate.apply(d,function(p){if(Array.isArray(p))return Ut(p)}(u=this.anchor())||function(p){if(typeof Symbol<"u"&&p[Symbol.iterator]!=null||p["@@iterator"]!=null)return Array.from(p)}(u)||function(p,b){if(p){if(typeof p=="string")return Ut(p,b);var w=Object.prototype.toString.call(p).slice(8,-1);return w==="Object"&&p.constructor&&(w=p.constructor.name),w==="Map"||w==="Set"?Array.from(p):w==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(w)?Ut(p,b):void 0}}(u)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
38
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()),t(d),d.restore(),d}},{key:"render",value:function(){var o=Fe(arguments);if(o.d3)return o.d3.attr("transform","rotate(".concat(this.rotate(),") translate(").concat(this.anchor(),")"));if(o.ctx)return this.canvas(o.ctx,o.fn);if(o.text){var t=typeof o.text.render=="function"?o.text.render():o.text;return this.createElement()("g",{transform:"rotate(".concat(this.rotate(),") translate(").concat(this.anchor(),")")},t)}}}],a&&dr(n.prototype,a),Object.defineProperty(n,"prototype",{writable:!1}),r}(),$e=Object.prototype.hasOwnProperty,Wt={};function fr(r){return Wt[r]||(Wt[r]=r.replace(/([a-z])([A-Z])/g,function(n,a,o){return a+"-"+o.toLowerCase()})),Wt[r]}function ze(r,n){if(Array.isArray(n))return n.forEach(function(a){return ze(r,a)});typeof n=="string"&&(n=document.createTextNode(n)),r.appendChild(n)}function de(r,n){if(typeof document<"u"){var a=typeof r=="string"?document.createElementNS("http://www.w3.org/2000/svg",r):r;if(n&&a.setAttribute)for(var o in n)$e.call(n,o)&&n[o]!=null&&a.setAttribute(o==="className"?"class":fr(o),n[o]);for(var t=arguments.length,u=new Array(t>2?t-2:0),d=2;d<t;d++)u[d-2]=arguments[d];return u!=null&&u.length&&u.forEach(function(p){ze(a,p)}),a}}Z.createElement=de,Z.textparser=St,Z.defaultparser=St,Z.htmlparser=function(r){r=String(r||"").trim();for(var n,a,o={weight:null,style:null,sub:!1,sup:!1,href:null,color:null,rel:null,target:null},t=[],u=[],d=function(E){for(var O in o)o[O]&&(E[O]=o[O]);t.push(E)},p=function(E){var O=t.length,P=nr[E];if(O&&P){for(var I=O-1;t[I]&&(t[I]instanceof ht||rr.test(t[I].value));)I--;for(;P&&t[I]&&t[I]instanceof K;)I--,P--;for(;P-- >0;)t.push(new K)}};r.length;){if(n=/^[^<]+/.exec(r))St(ie(n[0]),!1).forEach(d);else if(!(n=zt.exec(r)))if(n=ee.exec(r))u.length&&(o=u.pop()),p(n[1]);else if(n=re.exec(r)){var b=n[1];p(b),u.push(o),o=Object.create(o),Tt[b]&&Tt[b](o,"");var w=Nt(n[2]);b==="a"&&(w.href&&(o.href=w.href),w.rel&&(o.rel=w.rel),w.target&&(o.target=w.target)),w.class&&(o.class=o.class?o.class+" "+w.class:w.class),w.style&&(a=/(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(w.style))&&a[1]&&(o.color=a[1]),b==="br"&&t.push(new K)}else n=[r.slice(0,1)],d(new z(n[0]));r=r.slice(n[0].length)}for(var A=t[t.length-1];A instanceof K;)t.pop(),A=t[t.length-1];return t},Z.latexparser=function(r){r=String(r||"").trim();var n=[0];r=r.replace(/\\verb,(.*?),/,function($,j){return n.push(j),"\\verb,"+(n.length-1)+","}).replace(/\\\\\n/g,function(){return"\\\\"}).replace(ar,function($,j,D){return D.charAt(j-1)==="\\"?$:oe[$]}).replace(/\n\s+/g,function($){return/\n/.test($.slice(1))?"\\par ":$}).replace(/\\symbol\{(\d+)\}/,function($,j,D,N){return N.charAt(D-1)==="\\"?$:String.fromCharCode(1*j)}).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g,function($,j,D,N){return j+D+"{"+N+"}"}).replace(/\\verb,(.*?),/,function($,j){return"\\verb,".concat(n[+j],",")});for(var a,o={weight:null,italic:null,variant:null,sub:!1,sup:!1,href:null},t=[],u=[],d=function($){for(var j in o)o[j]&&($[j]=o[j]);return t.push($),$},p=function(){u.push(o),o=Object.create(o)},b=function(){if(!u.length)throw new Error("Unexpected }");o=u.pop()},w={tokens:t,open_context:p,close_context:b,add_token:d};r.length;){if(a=Bt.exec(r))St(a[0],!1).forEach(d);else if(a=sr.exec(r))d(new z(a[1]));else if(!(a=Re.exec(r))){if(a=/^\{/.exec(r))p();else if(a=/^\}/.exec(r))b();else if(!(a=/^\$/.exec(r)))if(a=/^\\verb,([^,]+),/.exec(r))d(new z(a[1]));else if(a=Pe.exec(r)){var A=a[1].slice(1)||a[1],E=!!a[2];if(/^(La)?TeX$/i.test(A)){p(),o.family="serif";var O=void 0;A==="LaTeX"&&((O=d(new z("L"))).tracking=-.25,(O=d(new z("A"))).size=.7,O.baseline=.3,O.tracking=-.1),(O=d(new z("T"))).tracking=-.17,(O=d(new z("E"))).baseline=-.22,O.tracking=-.13,O=d(new z("X")),b()}else if(A in xt)d(new z(xt[A])),E&&p();else if(A in V){var P=[],I=V[A].length-1,B=void 0;if(I){for(E=!1,r=r.slice(a[0].length-1);I--;){if(!(B=/^\{([^}]+)\}/.exec(r)))throw new Error(A+" is missing an argument");P.push(B[1]),r=r.slice(B[0].length)}a[0]=/^\{/.exec(r)?"{":"",E=!!a[0]}E&&p(),V[A].apply(w,[o].concat(P))}else console.warn("unknown latex command",A),d(new z(a[1])),E&&p()}else a=[r.slice(0,1)],d(new z(a[0]))}r=r.slice(a[0].length)}return t},Z.measureText=function(r,n,a){return U(r,R(n),a)},Z.Token=z,Z.Break=ht,Z.LineBreak=K,Z.SoftHyphen=ct,Z.Rotator=Me,Me.createElement=de;const Ne=Z;return i.default})())})(Mr);var yn=Mr.exports;const $r=Or(yn);function Je(h){return h.replace(/…$/,"")}function Ke(h){return h.children[0].innerHTML}function vn(h,e){const s=gt(h),{fontSize:i,font:l,padding:c=0}=h.properties.style||{};if(s.width===s.height&&s.width===0)return;const g=new $r({font:`${i}px/${i}px ${l}`.replace(/(px)+/g,"px"),width:s.width-c*2,height:s.height-c*2,align:"left",valign:"top",x:0,overflow:"ellipsis",parser:"html",createElement:$r.createElement});g.overflowWrap("break-word");const y=g.linebreak(h.properties.content.replaceAll(`
39
- `,"<br>")).render(),f=[...y.children];let m=0;const v=[];h.properties.content.split(`
40
- `).forEach(_=>{let R=_;for(;R.length&&m<f.length;){if(f[m].innerHTML==="&nbsp;"){R.startsWith(`
41
- `)||v.push(m),m++;break}const T=Je(Ke(f[m]));R.startsWith(T)&&(R=R.slice(T.length).trim()),m++}}),v.forEach(_=>y.removeChild(f[_]));const k=h.properties.content.match(/(https?:\/\/.*)/gm),C=k?k.map(_=>_.split(" ")[0]):[];y.setAttribute("transform",`translate(${c}, ${c})`),C.forEach(_=>{let R=_;const T=[];for(;R.length>0;){const M=f.find(S=>!!S.children[0]&&S.children[0].tagName==="tspan"&&R.startsWith(Je(Ke(S))));if(!M)break;T.push(M);const L=Je(M.children[0].innerHTML).length;if(!L)break;R=R.slice(L)}T.forEach(M=>{const L=document.createElementNS("http://www.w3.org/2000/svg","a");L.setAttribute("href",_),L.setAttribute("target","_blank"),L.innerHTML=Ke(M),M.children[0].innerHTML="",M.children[0].appendChild(L)})}),e.appendChild(y)}const zr=20;class mn extends Ir{constructor(e,s={}){super(e,`
42
- <div class="annotation-text-handle">
43
- <span class="handle line-handle top" data-handle-id="0"></span>
44
- <span class="handle line-handle bottom" data-handle-id="1"></span>
45
- <span class="handle line-handle left" data-handle-id="2"></span>
46
- <span class="handle line-handle right" data-handle-id="3"></span>
47
- <span class="handle top right point-handle top-right" data-handle-id="4"></span>
48
- <span class="handle left top point-handle top-left" data-handle-id="5"></span>
49
- <span class="handle bottom right point-handle bottom-right" data-handle-id="6"></span>
50
- <span class="handle left bottom left-handle point-handle bottom-left" data-handle-id="7"></span>
51
- <textarea wrap="on"></textarea>
37
+ `),w(this,"draggedHandle",Z),w(this,"start",{x:0,y:0}),w(this,"end",{x:0,y:0}),w(this,"arrow",{...hr}),w(this,"startX",0),w(this,"startY",0),w(this,"minArrowHeight",0),w(this,"maxArrowHeight",0),w(this,"handles",[]),w(this,"onHandleMouseDown",r=>{const o=this.getById(this.selectedId)||this.getById(this.hoveredId);if(!o)return;const{x:u,y:d}=$e(r,this.ogma.getContainer());this.startDragging(o,u,d),this.draggedHandle=fr(r.target)}),w(this,"onMouseUp",()=>{this.draggedHandle!==-1&&(this.restoreDragging(),this.isDragging=!1,this.draggedHandle=Z,this.emit(Gt,this.arrow))}),w(this,"onMouseMove",r=>{if(!this.isDragging||this.draggedHandle===Z)return;const o=this.handles[this.draggedHandle],u=this.ogma.view.getAngle(),{x:d,y:f}=dt(un({x:r.x-this.startX,y:r.y-this.startY},this.ogma.view.getZoom()),u),g=o.id===Cr,p=o.id===Tr,m=o.id===Or;(g||p)&&cr(this.arrow,this.start.x+d,this.start.y+f),(g||m)&&dr(this.arrow,this.end.x+d,this.end.y+f),this.emit(Ae,this.arrow,g?"line":p?"start":"end"),this.refreshEditor(),this.layer.refresh()}),this.minArrowHeight=i.minArrowHeight||0,this.maxArrowHeight=i.maxArrowHeight||1e6,this.handles=Array.prototype.slice.call(this.editor.element.querySelectorAll(".arrow-handle>.handle")),this.handles.forEach(r=>r.addEventListener("mousedown",this.onHandleMouseDown)),document.addEventListener("mousemove",this.onMouseMove,!0),document.addEventListener("mouseup",this.onMouseUp)}startDrawing(t,i,r=Qr(t,i,t,i,ne)){var o;this.disableDragging(),this.add(r),this.hoveredId=r.id;const u=this.ogma.view.graphToScreenCoordinates({x:t,y:i}),d=((o=this.ogma.getContainer())==null?void 0:o.getBoundingClientRect())||{left:0,top:0};this.startDragging(this.getById(r.id),u.x+(d==null?void 0:d.left),u.y+d.top),this.draggedHandle=2}cancelDrawing(){this.isDragging&&(this.remove(this.arrow.id),this.emit(Gt,this.arrow),this.restoreDragging(),this.isDragging=!1,this.draggedHandle=Z)}startDragging(t,i,r){this.selectedId!==t.id&&this.select(this.hoveredId),this.arrow=t,this.startX=i,this.startY=r,this.start=ie(this.arrow),this.end=ve(this.arrow),this.disableDragging(),this.emit(Ee,this.arrow),this.isDragging=!0}detect(t,i=0){return this.elements.find(r=>{const{start:o,end:u}=we(r),d=Ft(t,{x:(o.x+u.x)/2,y:(o.y+u.y)/2}),f=Ft(u,o),g=Ut(f),p=pr(f),m=vr(r);return Math.abs(yr(p,d))<g/2+i&&Math.abs(yr(dt(p,Math.PI/2),d))<m/2+i})}refreshEditor(){if(+this.selectedId<0&&+this.hoveredId<0)return;const t=this.selectedId!==Z?this.getById(this.selectedId):this.getById(this.hoveredId),i=we(t),r=this.ogma.view.graphToScreenCoordinates(i.start),o=this.ogma.view.graphToScreenCoordinates(i.end),[u,d,f]=Array.prototype.slice.call(this.editor.element.querySelectorAll(".handle"));d.style.transform=`translate(${r.x}px, ${r.y}px) translate(-50%, -50%)`,f.style.transform=`translate(${o.x}px, ${o.y}px) translate(-50%, -50%)`;const g={x:(o.x+r.x)/2,y:(o.y+r.y)/2},p=Ft(o,r),m=mr(p,1/Ut(p)),C=Math.atan2(m.y,m.x);u.style.width=`${Ut(p)}px`,u.style.left=`${g.x}px`,u.style.top=`${g.y}px`,u.style.transform=`translate(-50%, -50%) rotate(${C}rad)`}getDefaultOptions(){return hr}draw(t){t.innerHTML="";const i=$t("g"),r=this.ogma.view.getAngle();r!==0&&i.setAttribute("transform",`rotate(${-r*(180/Math.PI)})`),this.elements.forEach(o=>dn(o,i,ne,this.minArrowHeight,this.maxArrowHeight)),t.appendChild(i)}refreshDrawing(){const t=this.ogma.view.getAngle();this.layer.element!==null&&t!==0&&this.layer.element.children[0].setAttribute("transform",`rotate(${-t*(180/Math.PI)})`)}destroy(){super.destroy(),document.removeEventListener("mousemove",this.onMouseMove,!0),document.removeEventListener("mouseup",this.onMouseUp)}}const Xt={font:"sans-serif",fontSize:18,color:"#505050",background:"#f5f5f5",strokeWidth:0,borderRadius:8,padding:16,strokeType:"plain"},Ue={id:0,type:"Feature",properties:{type:"text",content:"",style:{...Xt}},geometry:{type:"Polygon",coordinates:[[[0,0],[100,0],[100,50],[0,50],[0,0]]]}},jr={handleSize:3.5,placeholder:"Your text..."},xn=(a=0,t=0,i=100,r=50,o="",u={...Xt})=>({id:me(),type:"Feature",properties:{type:"text",content:o,style:{...Xt,...u}},geometry:{type:"Polygon",coordinates:[[[a,t],[a+i,t],[a+i,t+r],[a,t+r],[a,t]]]}});var Ye={exports:{}},An=Ye.exports,Lr;function En(){return Lr||(Lr=1,function(a,t){(function(i,r){a.exports=r()})(An,()=>(()=>{var i={d:(e,n)=>{for(var l in n)i.o(n,l)&&!i.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:n[l]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n)},r={};function o(e){return o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},o(e)}i.d(r,{default:()=>Wn});var u=/^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/,d=/\bsmall-caps\b/,f=/\b(?:italic|oblique)\b/,g=/\bbold(?:er)?\b/,p=13.3333333,m={"xx-small":9,"x-small":10,smaller:13.3333,small:13,medium:16,large:18,larger:19.2,"x-large":24,"xx-large":32};function C(e){var n="",l=this;return l.style&&l.style!=="normal"&&(n+=l.style),l.variant&&l.variant!=="normal"&&(n+=(n?" ":"")+l.variant),l.weight&&l.weight!=="normal"&&(n+=(n?" ":"")+l.weight),l.size&&(n+=(n?" ":"")+l.size+"px",l.height!==l.size&&(n+="/"+l.height+"px")),l.family&&(n+=(n?" ":"")+l.family),e&&(n+="::"+l.baseline),e&&(n+="::"+l.color),n}var S={id:"",family:"sans-serif",height:14,size:12,variant:"",style:"",weight:"",baseline:"",color:null,toString:C,valueOf:C};function A(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=u.exec(e);n.family=(l[6]||"").trim();var s=m[l[2]]||parseFloat(l[2]);l[3]==="%"?s*=.16:l[3]==="em"?s*=16:l[3]==="pt"&&(s*=p),n.size=s;var c=parseFloat(l[4]);if(c!=="normal"&&c!=="inherit"&&c?l[5]&&l[5]!=="em"?l[5]==="pt"?n.height=c*p:l[5]==="%"?n.height=.01*s:n.height=c:n.height=c*s:n.height=Math.round(s*(7/6)),d.test(l[1])&&(n.variant="small-caps"),f.test(l[1])&&(n.style="italic"),g.test(l[1]))n.weight="bold";else{var y=parseInt(/\b(\d+)\b/.exec(l[1]),10);y>=100&&y!==400&&(n.weight=y)}return n}function _(){var e,n,l,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"12px/14px sans-serif",c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y=14,k=12,b=null,O=null,j="";if(s&&s.nodeType){var N=s&&(s.ownerDocument&&s.ownerDocument.defaultView||s.document&&s||s.defaultView),R=N.getComputedStyle(s,null);e=R.getPropertyValue("font-family")||"",k=parseFloat(R.getPropertyValue("font-size")),y=R.getPropertyValue("line-height"),b=R.getPropertyValue("font-weight"),O=R.getPropertyValue("font-style"),j=R.getPropertyValue("font-variant")||""}else if(typeof s=="string"){var D=A(s);e=D.family,k=D.size,y=D.height,j=D.variant,O=D.style,b=D.weight}else o(s)==="object"&&(e=s.family,k=s.size,y=s.height,j=s.variant,b=s.weight,O=s.style,n=s.baseline,l=s.color);c.size&&c.size<3&&(k*=c.size),y=y!=="normal"&&y?parseFloat(y):k*(7/6),c.height&&c.height<3&&(y*=c.height);var $=Object.create(S);return $.family=c.family||e||"sans-serif",$.height=y??14,$.size=k??12,$.variant=c.variant||j||"",$.style=c.style||O||"",$.weight=c.weight||b||"",$.baseline=n||0,c.baseline!=null&&($.baseline=c.baseline),$.color=c.color||l||"",$.id=C.call($,!0),$}const x={"\n":.28,"\r":.28," ":.28," ":.28," ":.28,"᠎":0," ":.5," ":1," ":.5," ":1," ":.33," ":.25," ":.16," ":.56," ":.28," ":.2," ":.15,"​":0," ":.16," ":.22," ":1,"\uFEFF":0};var M,I=function(e){var n=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(100,100)||e&&e.createElement("canvas");if(n&&n.getContext){var l=n.getContext("2d");if(l&&typeof l.measureText=="function")return function(s,c){return l.font=String(c),l.measureText(s).width}}}(typeof document<"u"?document:null)||(M={},function(e,n){if(!M[n]){var l=_(n);M[n]=l,/\bmonospace\b/.test(l.family)?l.size*=.6:(l.size*=.45,l.weight&&(l.size*=1.18))}return e.length*M[n].size}),T={},H={trim:!0,collapse:!0};function B(e,n,l){var s=Object.assign({},H,l),c=String(e);if(!c)return 0;if(c in x){var y=n.id+"/"+c;return y in T||(T[y]=I("_".concat(c,"_"),n)-I("__",n)),T[y]}return s.trim&&s.collapse?s.trim?c=c.trim():s.collapse&&(c=c.replace(/\s+/g," ")):c=c.replace(/\n/g," "),I(c,n)+n.size*(e.tracking||0)}function ot(e){return ot=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},ot(e)}function rt(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),n&&Vt(e,n)}function Vt(e,n){return Vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(l,s){return l.__proto__=s,l},Vt(e,n)}function Jt(e){var n=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var l,s=Ht(e);if(n){var c=Ht(this).constructor;l=Reflect.construct(s,arguments,c)}else l=s.apply(this,arguments);return ke(this,l)}}function ke(e,n){if(n&&(ot(n)==="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(l){if(l===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return l}(e)}function Ht(e){return Ht=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ht(e)}function Dt(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function se(e,n){for(var l=0;l<n.length;l++){var s=n[l];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,(c=function(y,k){if(ot(y)!=="object"||y===null)return y;var b=y[Symbol.toPrimitive];if(b!==void 0){var O=b.call(y,k);if(ot(O)!=="object")return O;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(y)}(s.key,"string"),ot(c)==="symbol"?c:String(c)),s)}var c}function Pt(e,n,l){return n&&se(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var U=function(){function e(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";Dt(this,e),this.value=n,this.weight=null,this.style=null,this.font=null,this.href=null,this.sub=!1,this.sup=!1}return Pt(e,[{key:"clone",value:function(){var n=new e(this.value);return n.value=this.value,n.weight=this.weight,n.style=this.style,n.font=this.font,n.href=this.href,n.sub=this.sub,n.sup=this.sup,n}},{key:"valueOf",value:function(){return this.value}},{key:"toString",value:function(){return this.value}}]),e}(),St=function(e){rt(l,e);var n=Jt(l);function l(){return Dt(this,l),n.apply(this,arguments)}return Pt(l)}(U),at=function(e){rt(l,e);var n=Jt(l);function l(){return Dt(this,l),n.apply(this,arguments)}return Pt(l)}(U),vt=function(e){rt(l,e);var n=Jt(l);function l(){return Dt(this,l),n.apply(this,arguments)}return Pt(l)}(U),oe=/^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/,_t=/^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/,ae=/^[\xA0\u2011\u202F\u2060\uFEFF]/,Ct=/^(?:[;\xAD%?…]|,(?!\d))/,Qe=/^[´±°¢£¤$¥\u2212]/;function Nt(e,n){n!==!1&&(e=e.trim());for(var l,s,c=[],y=e.charAt(0),k=0,b=1,O=e.length;b<O;b++){l=e.charAt(b),s=e.charAt(b+1);var j=oe.test(y),N=oe.test(l),R=N||j,D=void 0;if((Qe.test(l)&&!ae.test(y)||Ct.test(y+s)&&!ae.test(l))&&(R=!0),y!=="-"&&y!=="‐"&&y!=="–"&&y!=="—"||((D=oe.test(e.charAt(b-2)))&&!N&&(R=!1),!D&&_t.test(l+s)&&(R=!0)),R){var $=e.slice(k,b);/\u00AD$/.test($)?(c.push(new U($.slice(0,-1))),c.push(new vt)):(c.push(new U($)),c.push(new St)),k=b}y=l}return c.push(new U(e.slice(k))),c}const Rt={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"⊥",or:"⊦",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›"};var Se=/^[\n\r\x20\u2000-\u200B\u205F\u3000]/,_e=/^<\/([a-zA-Z0-9]+)([^>]*)>/,Ce=/^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/,Te=/^<!--(.+?)-->/,Oe=/&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g,le={b:function(e){e.weight="bold"},strong:function(e){e.weight="bold"},i:function(e){e.style="italic"},em:function(e){e.style="italic"},dfn:function(e){e.style="italic"},cite:function(e){e.style="italic"},code:function(e){e.family="monospace"},kbd:function(e){e.family="monospace"},samp:function(e){e.family="monospace"},var:function(e){e.family="monospace"},tt:function(e){e.family="monospace"},sub:function(e){e.sub=!0},sup:function(e){e.sup=!0}},je={div:1,li:1,blockquote:2,h1:2,h2:2,h3:2,h4:2,h5:2,h6:2,ul:2,ol:2,hr:2,p:2};function Zt(e){return e.replace(Oe,function(n,l,s,c){if(l||s){var y=l?10:16;return String.fromCharCode(parseInt(l||s,y))}return c in Rt?Rt[c]:n})}function Le(e){return e&&e.length>1&&(e[0]==='"'&&e[e.length-1]==='"'||e[0]==="'"&&e[e.length-1]==="'")?e.slice(1,-1):e}var he=/^\s*([^=\s&]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/;function ue(e){var n,l={};if(e){do if(n=he.exec(e)){var s=Zt(Le(n[2]||"")).replace(/[ \r\n\t]+/g," ").trim();if(l[n[1]]=s,(e=e.slice(n[0].length)).length&&/^\S/.test(e[0]))throw new Error("Attribute error")}while(n&&e.length);if(/\S/.test(e))throw new Error("Attribute error")}return l}const Me={copyright:"©",textcopyright:"©",dag:"†",textdagger:"†",ddag:"‡",textdaggerdbl:"‡",guillemotleft:"«",guillemotright:"»",guilsinglleft:"‹",guilsinglright:"›",ldots:"…",dots:"…",textellipsis:"…",lq:"‘",P:"¶",textparagraph:"¶",pounds:"£",textsterling:"£",quotedblbase:"„",quotesinglbase:"‚",rq:"’",S:"§",sim:"~",textasciicircum:"^",textasciitilde:"˜",texttildelow:"~",textasteriskcentered:"*",textbackslash:"'",textbar:"|",textbardbl:"╎",textbigcircle:"◯",textbraceleft:"{",textbraceright:"}",textbullet:"•",textdollar:"$",textemdash:"—",textendash:"—",texteuro:"€",eurosym:"€",euro:"€",textexclamdown:"¡",textgreater:">",textless:"<",textordfeminine:"ª",textordmasculine:"º",textperiodcentered:"·",cdot:"·",textquestiondown:"¿",textquotedblleft:"“",textquotedblright:"”",textquoteleft:"‘",textquoteright:"’",textquotestraightbase:"‚",textquotestraightdblbase:"„",textregistered:"®",textthreequartersemdash:"-",texttrademark:"™",texttwelveudash:"-",textunderscore:"_",textvisiblespace:"␣",gets:"←",textleftarrow:"←",to:"→",textrightarrow:"→",textdegree:"°",infty:"∞",triangle:"△",triangledown:"▽",blacktriangle:"▲",blacktriangledown:"▼",angle:"∠",sphericalangle:"∢",aleph:"ℵ",hbar:"ħ",imath:"𝚤",jmath:"𝚥",ell:"ℓ",wp:"℘",Re:"ℜ",Im:"ℑ",mho:"℧",prime:"′",emptyset:"∅",nabla:"∇",surd:"√",partial:"∂",top:"⟙",bot:"⟂",vdash:"⟝",dashv:"⟞",forall:"∀",exists:"∃",nexists:"∄",neg:"¬",lnot:"¬",flat:"♭",natural:"♮",sharp:"♯",backslash:"\\",Box:"□",Diamond:"♢",clubsuit:"♣",diamondsuit:"♦",heartsuit:"♥",spadesuit:"♠",Join:"⨝",blacksquare:"■",bigstar:"★",diagdown:"╲",diagup:"╱",blacklozenge:"⧫",rfloor:"⌋",lfloor:"⌊",rceil:"⌉",lceil:"⌈",rangle:"⟩",langle:"⟨",sum:"∑",int:"∫",oint:"∮",prod:"∏",coprod:"∏",bigcap:"∩",bigcup:"∪",bigsqcup:"⊔",bigvee:"∨",bigwedge:"∧",bigodot:"⊙",bigotimes:"⊗",bigoplus:"⊕",biguplus:"⊎",alpha:"α",beta:"β",chi:"χ",delta:"δ",epsilon:"ε",eta:"η",gamma:"γ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",omega:"ω",phi:"φ",pi:"π",psi:"ψ",rho:"ρ",sigma:"σ",tau:"τ",theta:"θ",upsilon:"υ",xi:"ξ",zeta:"ζ",Alpha:"Α",Beta:"Β",Chi:"Χ",Delta:"Δ",Epsilon:"Ε",Eta:"Η",Gamma:"Γ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Omega:"Ω",Phi:"Φ",Pi:"Π",Psi:"Ψ",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Theta:"Θ",Upsilon:"Υ",Xi:"Ξ",Zeta:"Ζ",aa:"å",AA:"Å",ae:"æ",AE:"Æ",dh:"ð",DH:"Ð",dj:"đ",DJ:"Đ",ij:"ij",IJ:"IJ",l:"ł",L:"Ł",ng:"ŋ",NG:"Ŋ",o:"ø",O:"Ø",oe:"œ",OE:"Œ",ss:"ß",SS:"SS",th:"þ",TH:"Þ"};var De=/^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/,Pe=/^%[^\n]+(?:\n|$)/,Ne=/^[^#$%&~_^\\{}]+/,Re=/^\\([&{}$%#_])/,h=/(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g,E={"---":"—","--":"–","!`":"¡","?`":"¿","``":"“",",,":"„","''":"”","`":"‘","'":"’","<<":"«",">>":"»","~":" ","\\-":"­","\\,":" ","\\;":" ","\\:":" ","\\!":" ","\\@":"\uFEFF","\\\\":"\\newline{}"},v={bf:function(e){e.weight="bold"},it:function(e){e.style="italic"},sl:function(e){e.style="italic"},color:function(e,n){e.color=n},href:function(e,n){e.href=n},"^":function(e){e.sup=!0},_:function(e){e.sub=!0},par:function(e){this.tokens.push(new at,new at)},newline:function(e){this.tokens.push(new at)},url:function(e,n){this.open_context().href=n,this.add_token(new U(n)),this.close_context()}};v.textsuperscript=v["^"],v.textsubscript=v._,v.textsl=v.sl,v.mathbf=v.bf,v.mathit=v.it,v.textbf=v.bf,v.textit=v.it,v.textcolor=v.color;var z=/[\r\n\xA0]+/g;function tt(e,n){e.sup&&(e.baseline=.45,e.size=.7),e.sub&&(e.baseline=-.3,e.size=.7);var l=n;return(e.style||e.weight||e.baseline||e.color||e.size||e.family)&&(l=_(n,e)),l}function W(e,n,l){for(var s,c,y=e.width;y+l.width>n&&e.length;)c=(s=e[e.length-1]).width,s.width>l.width?(s.value=s.value.slice(0,-1),s.width=B(s,s.font),y+=s.width):e.pop(),y-=c;e[e.length-1]instanceof vt&&e.pop(),s=e[e.length-1]||s||{},l.font=_(l.font,s.bold,s.italic,""),l.href=e.length?s.href:null,l.rel=e.length?s.rel:null,l.target=e.length?s.target:null,e.push(l)}function L(e){return Math.round(1e6*e)/1e6}function pt(e){return function(n){if(Array.isArray(n))return wt(n)}(e)||function(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}(e)||function(n,l){if(n){if(typeof n=="string")return wt(n,l);var s=Object.prototype.toString.call(n).slice(8,-1);return s==="Object"&&n.constructor&&(s=n.constructor.name),s==="Map"||s==="Set"?Array.from(n):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?wt(n,l):void 0}}(e)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
38
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function wt(e,n){(n==null||n>e.length)&&(n=e.length);for(var l=0,s=new Array(n);l<n;l++)s[l]=e[l];return s}var et={center:"middle",right:"end"},Tt={middle:.5,center:.5,bottom:1,end:1},Ot=function(e,n){return!e&&!n||e===n};function bt(e,n){var l=[],s=n.font(),c=s.size,y=s.family,k=n.align(),b=n.createElement();if(e.length){var O=s.height,j=n.valign(),N=n.height()(),R=n.width()(0),D=!isFinite(R)&&e.length===1,$=D?null:n.x(),X=L(O/c),ht=D?null:L(O/(1.15*c+(O-c)/2));if(Tt[j]&&isFinite(N)){var q=j==="bottom"?1:.5;ht+=(N*q-O*e.length*q)/c}var F=k==="justify",V=0;k==="right"?V=R:k==="center"&&(V=R/2);for(var G=[],ut="tspan",nt=null,J="",P=function(){if(J){var Bt=b(ut,nt,J);G.push(Bt)}ut="tspan",nt=null,J=""},ft=0,ct=e.length;ft<ct;ft++){var jt="",It="",xt=0,Lt=e[ft];if(Lt.length){G=[];for(var Qt=0,fe=0,Mt=void 0,it=0,Ie=Lt.length;it<Ie;it++){var K=Lt[it],st=K.font;K.whitespace&&Qt++,fe+=K.width,it&&!K.tracking&&!xt&&Ot(st.id,jt)&&Ot(K.class,It)&&Ot(Mt,K.href)?J+=K.value:(P(),J=K.value,nt={fontFamily:st.family!==y?st.family:null,fontSize:st.size!==c?st.size:null,fontWeight:st.weight||null,fontStyle:st.style||null,fontVariant:st.variant!=="normal"&&st.variant||null,fill:st.color||null,baselineShift:st.baseline?100*st.baseline+"%":null,className:K.class||null},xt&&(nt.dx=L(xt),xt=0),K.tracking&&(xt=st.size*K.tracking),K.href&&!Mt?(Mt=K.href,ut="a",nt.href=Mt,nt.rel=K.rel,nt.target=K.target):Mt=null,jt=st.id,It=K.class)}if(P(),D)l.push.apply(l,pt(G));else{var ze=null,ge=ft===ct-1||Lt[Lt.length-1]instanceof at;F&&Lt.length>1&&!ge&&(ze=L((R-fe)/Qt)),l.push(b.apply(void 0,["tspan",{wordSpacing:ze,x:$(ft)+V,dy:L(ft?X:ht)+"em"}].concat(pt(G))))}}else l.push(b("tspan",{x:$(ft),dy:L(ft?X:ht)+"em"}," "))}}return b.apply(void 0,["text",{fontFamily:y,fontSize:c,textAnchor:et[k]||"start"}].concat(l))}var Kt={middle:.5,center:.5,bottom:1,end:1};function yt(e,n,l){if(e.length){l.textBaseline="middle";var s=n.font(),c=s.height,y=s.size,k=n.valign(),b=n.height()(),O=n.width()(0),j=n.align(),N=j==="justify",R=.5*c,D=Kt[k];if(D&&isFinite(b)){var $=e.length*c;R+=b*D-$*D}e.forEach(function(X,ht){var q=n.x()(ht),F=ht*c+R,V=0,G=0;X.forEach(function(J){J.whitespace&&V++,G+=J.width});var ut=0,nt=ht===e.length-1||X[X.length-1]instanceof at;N&&X.length>1&&!nt&&(ut=(O-G)/V),X.forEach(function(J){l.font=J.font;var P=J.font,ft=P.baseline?y*-P.baseline+.15*y:0;l.fillStyle=function(It,xt){return It.color?It.color:xt.href?"#00C":"#000"}(P,J);var ct=0;if(j==="right"?ct+=O-G:j==="center"?ct+=O/2-G/2:j==="justify"&&(J.whitespace||J instanceof at)&&(q+=ut),l.fillText(J.value,q+ct,F+ft),J.href){l.beginPath(),l.strokeStyle=l.fillStyle;var jt=Math.floor(F+.45*y)+.5;l.moveTo(q+ct,jt),l.lineTo(q+ct+J.width,jt),l.stroke()}q+=J.width})})}}function tr(e){return tr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},tr(e)}function Hr(e){for(var n={},l=0;l<e.length;l++){var s=e[l];typeof s!="number"&&s!=null&&(typeof s=="string"?n.text=s:typeof s=="function"?n.fn=s:tr(s)==="object"&&s._groups?n.d3=s:s&&s.nodeType&&s.getContext?n.ctx=s.getContext("2d"):s&&s.fillText&&s.beginPath?n.ctx=s:s&&(n.text=s))}return n}function ce(e){return ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},ce(e)}function zn(e,n){for(var l=0;l<n.length;l++){var s=n[l];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,(c=function(y,k){if(ce(y)!=="object"||y===null)return y;var b=y[Symbol.toPrimitive];if(b!==void 0){var O=b.call(y,k);if(ce(O)!=="object")return O;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(y)}(s.key,"string"),ce(c)==="symbol"?c:String(c)),s)}var c}var $n=_(),er=function(e){return typeof e=="function"?e:function(){return e}},mt=function(){function e(s){if(function(y,k){if(!(y instanceof k))throw new TypeError("Cannot call a class as a function")}(this,e),this.props={overflow:"ellipsis",lineclamp:null,align:"left",wordBreak:null,valign:"top",width:function(){return 1/0},height:function(){return 1/0},x:function(){return 0},font:null,tAnchor:0,parser:e.defaultparser},s)for(var c in s)typeof this[c]=="function"&&this[c](s[c])}var n,l;return n=e,l=[{key:"linebreak",value:function(s){var c=this,y=this.props.parser(String(s)),k=this.font(),b=function(O,j,N){if(!O.length)return[];var R=j.height(),D=j.width(),$=j.overflowLine(),X=j.overflowWrap(),ht=_(N,!0,!1),q=isFinite(R())?Math.floor(R()/N.height):1/0;if(!R()&&!D(0)||!q)return[];for(var F=0,V=0,G=0,ut=[],nt=[],J=!1;F<O.length&&V<q;){var P=O[F],ft=tt(P,N);if(P.width=B(P,ft),P.font=ft,P.line=V,P.whitespace=P.value in x,P.value&&(P.value=P.value.replace(z," ")),!(!G&&P.whitespace||J&&P.whitespace))if(P instanceof at)G=0,nt=[],ut.push(F+1),V++;else if(P instanceof St||P instanceof vt)nt.push({index:F,width:G});else if(P.whitespace||G+P.width<D(V))G+=P.width;else if(nt.length){var ct=void 0,jt=void 0;do{jt=!0,ct=nt.pop();var It=O[ct.index],xt=void 0;It instanceof vt&&(xt=B("-",It.font),ct.width+xt>D(V)&&(jt=!nt.length))}while(!jt);ut.push(ct.index+1),G=0,V++,F=ct.index,nt=[]}else if(X==="break-word"){var Lt=D(V);if(G+P.width>Lt){var Qt=P.clone();do P.value=P.value.slice(0,-1),P.width=B(P,P.font),G+=P.width;while(P.value&&P.width>Lt);Qt.value=Qt.value.slice(P.value.length),O.splice(F+1,0,new St,Qt)}ut.push(F+1),G=0,V++}else G+=P.width;F++,J=P.whitespace}F!==ut[ut.length-1]&&ut.push(F);var fe=0,Mt=0,it=ut.map(function(Bt){for(var lt,Wt=fe;(lt=O[Wt])&&(lt.whitespace||!lt.value);)Wt++;for(var zt=Bt,ir=null;zt>Wt&&(lt=O[zt-1])&&(lt.whitespace||!(lt.value||lt instanceof vt));)lt instanceof at&&(ir=lt),zt--;lt instanceof vt&&(lt.value="-",lt.width=B("-",lt.font)),fe=Bt;var te=O.slice(Wt,zt).filter(function(sr){return sr.value});return ir&&te.push(ir),te.width=te.reduce(function(sr,qn){return sr+qn.width},0),te.width>Mt&&(Mt=te.width),te});if(it.hasLineOverflow=!1,$){var Ie=$==="ellipsis"?"…":$;it.forEach(function(Bt,lt){var Wt=D(lt);if(Bt.width>Wt){var zt=new U(Ie);zt.font=N,zt.width=B(Ie,ht),W(Bt,Wt,zt),it.hasLineOverflow=!0}})}var K=j.overflow()==="ellipsis"?"…":j.overflow();if(K&&F!==O.length){var st=D(it.length-1),ze=it[it.length-1],ge=new U(K);ge.font=N,ge.width=B(K,ht),W(ze,st,ge),it.hasOverflow=!0}else it.hasOverflow=!1;return it.font=N,it.width=Mt,it}(y,this,k);return b.height=b.length*k.height,b.render=function(O){return c.render(b,O)},b.svg=b.render,b.draw=b.render,b}},{key:"font",value:function(s){return arguments.length?(this.props.font=_(s),this):this.props.font||_($n)}},{key:"overflow",value:function(s){return arguments.length?(this.props.overflow=String(s),this):this.props.overflow}},{key:"overflowLine",value:function(s){return arguments.length?(this.props.lineclamp=String(s),this):this.props.lineclamp}},{key:"valign",value:function(s){return arguments.length?(this.props.valign=s,this):this.props.valign}},{key:"align",value:function(s){if(!arguments.length)return this.props.align;var c=String(s).toLowerCase();return c==="left"||c==="start"?(this.props.align="left",this.props.tAnchor=0):c==="center"||c==="middle"?(this.props.align="center",this.props.tAnchor=-.5):c==="end"||c==="right"?(this.props.align="right",this.props.tAnchor=-1):c==="justify"&&(this.props.align=s,this.props.tAnchor=0),this}},{key:"overflowWrap",value:function(s){if(!arguments.length)return this.props.overflowWrap||"normal";var c=String(s).toLowerCase();return c==="break-word"?this.props.overflowWrap="break-word":c!=="normal"&&s!=null||(this.props.overflowWrap=null),this}},{key:"width",value:function(s){return arguments.length?(this.props.width=er(s),this):this.props.width}},{key:"height",value:function(s){return arguments.length?(this.props.height=er(s),this):this.props.height}},{key:"x",value:function(s){return arguments.length?(this.props.x=er(s),this):this.props.x}},{key:"parser",value:function(s){if(!arguments.length)return this.props.parser;if(typeof s=="string"){var c=e[s]||e[s+"parser"];typeof c=="function"&&(s=c)}if(typeof s!="function")throw new Error("Unknown parser: "+s);return this.props.parser=s,this}},{key:"createElement",value:function(s){return arguments.length?(this.props.createElement=s,this):this.props.createElement||e.createElement}},{key:"render",value:function(){var s=Hr(arguments);return typeof s.text=="string"&&(s.text=this.linebreak(s.text)),s.ctx?yt(s.text,this,s.ctx):bt(s.text,this)}}],l&&zn(n.prototype,l),Object.defineProperty(n,"prototype",{writable:!1}),e}();function de(e){return de=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},de(e)}function rr(e,n){(n==null||n>e.length)&&(n=e.length);for(var l=0,s=new Array(n);l<n;l++)s[l]=e[l];return s}function Fn(e,n){for(var l=0;l<n.length;l++){var s=n[l];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,(c=function(y,k){if(de(y)!=="object"||y===null)return y;var b=y[Symbol.toPrimitive];if(b!==void 0){var O=b.call(y,k);if(de(O)!=="object")return O;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(y)}(s.key,"string"),de(c)==="symbol"?c:String(c)),s)}var c}var Br=function(e){return typeof e=="function"?e:function(){return e}},Wr=function(){function e(s){if(function(y,k){if(!(y instanceof k))throw new TypeError("Cannot call a class as a function")}(this,e),this.props={width:function(){return 1/0},height:function(){return 1/0},rotation:0,vAnchor:0,hAnchor:0},s)for(var c in s)typeof this[c]=="function"&&this[c](s[c]);this.render=this.render.bind(this)}var n,l;return n=e,l=[{key:"anchor",value:function(s){var c=this.props,y=c.hAnchor,k=c.vAnchor,b=c.width,O=c.height;if(!arguments.length)return[y*b(0),k*O(0)];if(typeof s=="string"){var j=this.props;s.toLowerCase().trim().split(/\s+/).forEach(function(N){N==="top"&&(j.vAnchor=-0),N==="middle"&&(j.vAnchor=-.5),N==="bottom"&&(j.vAnchor=-1),N==="left"&&(j.hAnchor=-0),N==="center"&&(j.hAnchor=-.5),N==="right"&&(j.hAnchor=-1)})}return this}},{key:"width",value:function(s){return arguments.length?(this.props.width=Br(s),this):this.props.width}},{key:"height",value:function(s){return arguments.length?(this.props.height=Br(s),this):this.props.height}},{key:"rotate",value:function(s){return arguments.length?(this.props.rotation=s,this):this.props.rotation}},{key:"createElement",value:function(s){return arguments.length?(this.props.createElement=s,this):this.props.createElement||e.createElement}},{key:"canvas",value:function(s,c){var y,k=s.getContext?s.getContext("2d"):s;return k.save(),k.rotate(this.rotate()*Math.PI/180),k.translate.apply(k,function(b){if(Array.isArray(b))return rr(b)}(y=this.anchor())||function(b){if(typeof Symbol<"u"&&b[Symbol.iterator]!=null||b["@@iterator"]!=null)return Array.from(b)}(y)||function(b,O){if(b){if(typeof b=="string")return rr(b,O);var j=Object.prototype.toString.call(b).slice(8,-1);return j==="Object"&&b.constructor&&(j=b.constructor.name),j==="Map"||j==="Set"?Array.from(b):j==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(j)?rr(b,O):void 0}}(y)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
39
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()),c(k),k.restore(),k}},{key:"render",value:function(){var s=Hr(arguments);if(s.d3)return s.d3.attr("transform","rotate(".concat(this.rotate(),") translate(").concat(this.anchor(),")"));if(s.ctx)return this.canvas(s.ctx,s.fn);if(s.text){var c=typeof s.text.render=="function"?s.text.render():s.text;return this.createElement()("g",{transform:"rotate(".concat(this.rotate(),") translate(").concat(this.anchor(),")")},c)}}}],l&&Fn(n.prototype,l),Object.defineProperty(n,"prototype",{writable:!1}),e}(),Hn=Object.prototype.hasOwnProperty,nr={};function Bn(e){return nr[e]||(nr[e]=e.replace(/([a-z])([A-Z])/g,function(n,l,s){return l+"-"+s.toLowerCase()})),nr[e]}function qr(e,n){if(Array.isArray(n))return n.forEach(function(l){return qr(e,l)});typeof n=="string"&&(n=document.createTextNode(n)),e.appendChild(n)}function Ur(e,n){if(typeof document<"u"){var l=typeof e=="string"?document.createElementNS("http://www.w3.org/2000/svg",e):e;if(n&&l.setAttribute)for(var s in n)Hn.call(n,s)&&n[s]!=null&&l.setAttribute(s==="className"?"class":Bn(s),n[s]);for(var c=arguments.length,y=new Array(c>2?c-2:0),k=2;k<c;k++)y[k-2]=arguments[k];return y!=null&&y.length&&y.forEach(function(b){qr(l,b)}),l}}mt.createElement=Ur,mt.textparser=Nt,mt.defaultparser=Nt,mt.htmlparser=function(e){e=String(e||"").trim();for(var n,l,s={weight:null,style:null,sub:!1,sup:!1,href:null,color:null,rel:null,target:null},c=[],y=[],k=function(R){for(var D in s)s[D]&&(R[D]=s[D]);c.push(R)},b=function(R){var D=c.length,$=je[R];if(D&&$){for(var X=D-1;c[X]&&(c[X]instanceof St||Se.test(c[X].value));)X--;for(;$&&c[X]&&c[X]instanceof at;)X--,$--;for(;$-- >0;)c.push(new at)}};e.length;){if(n=/^[^<]+/.exec(e))Nt(Zt(n[0]),!1).forEach(k);else if(!(n=Te.exec(e)))if(n=_e.exec(e))y.length&&(s=y.pop()),b(n[1]);else if(n=Ce.exec(e)){var O=n[1];b(O),y.push(s),s=Object.create(s),le[O]&&le[O](s,"");var j=ue(n[2]);O==="a"&&(j.href&&(s.href=j.href),j.rel&&(s.rel=j.rel),j.target&&(s.target=j.target)),j.class&&(s.class=s.class?s.class+" "+j.class:j.class),j.style&&(l=/(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(j.style))&&l[1]&&(s.color=l[1]),O==="br"&&c.push(new at)}else n=[e.slice(0,1)],k(new U(n[0]));e=e.slice(n[0].length)}for(var N=c[c.length-1];N instanceof at;)c.pop(),N=c[c.length-1];return c},mt.latexparser=function(e){e=String(e||"").trim();var n=[0];e=e.replace(/\\verb,(.*?),/,function(q,F){return n.push(F),"\\verb,"+(n.length-1)+","}).replace(/\\\\\n/g,function(){return"\\\\"}).replace(h,function(q,F,V){return V.charAt(F-1)==="\\"?q:E[q]}).replace(/\n\s+/g,function(q){return/\n/.test(q.slice(1))?"\\par ":q}).replace(/\\symbol\{(\d+)\}/,function(q,F,V,G){return G.charAt(V-1)==="\\"?q:String.fromCharCode(1*F)}).replace(/(^|[^\\])(\^|_)(\d|[^{]\S*)/g,function(q,F,V,G){return F+V+"{"+G+"}"}).replace(/\\verb,(.*?),/,function(q,F){return"\\verb,".concat(n[+F],",")});for(var l,s={weight:null,italic:null,variant:null,sub:!1,sup:!1,href:null},c=[],y=[],k=function(q){for(var F in s)s[F]&&(q[F]=s[F]);return c.push(q),q},b=function(){y.push(s),s=Object.create(s)},O=function(){if(!y.length)throw new Error("Unexpected }");s=y.pop()},j={tokens:c,open_context:b,close_context:O,add_token:k};e.length;){if(l=Ne.exec(e))Nt(l[0],!1).forEach(k);else if(l=Re.exec(e))k(new U(l[1]));else if(!(l=Pe.exec(e))){if(l=/^\{/.exec(e))b();else if(l=/^\}/.exec(e))O();else if(!(l=/^\$/.exec(e)))if(l=/^\\verb,([^,]+),/.exec(e))k(new U(l[1]));else if(l=De.exec(e)){var N=l[1].slice(1)||l[1],R=!!l[2];if(/^(La)?TeX$/i.test(N)){b(),s.family="serif";var D=void 0;N==="LaTeX"&&((D=k(new U("L"))).tracking=-.25,(D=k(new U("A"))).size=.7,D.baseline=.3,D.tracking=-.1),(D=k(new U("T"))).tracking=-.17,(D=k(new U("E"))).baseline=-.22,D.tracking=-.13,D=k(new U("X")),O()}else if(N in Me)k(new U(Me[N])),R&&b();else if(N in v){var $=[],X=v[N].length-1,ht=void 0;if(X){for(R=!1,e=e.slice(l[0].length-1);X--;){if(!(ht=/^\{([^}]+)\}/.exec(e)))throw new Error(N+" is missing an argument");$.push(ht[1]),e=e.slice(ht[0].length)}l[0]=/^\{/.exec(e)?"{":"",R=!!l[0]}R&&b(),v[N].apply(j,[s].concat($))}else console.warn("unknown latex command",N),k(new U(l[1])),R&&b()}else l=[e.slice(0,1)],k(new U(l[0]))}e=e.slice(l[0].length)}return c},mt.measureText=function(e,n,l){return B(e,_(n),l)},mt.Token=U,mt.Break=St,mt.LineBreak=at,mt.SoftHyphen=vt,mt.Rotator=Wr,Wr.createElement=Ur;const Wn=mt;return r.default})())}(Ye)),Ye.exports}var kn=En();const Mr=Ar(kn);function Ge(a){return a.replace(/…$/,"")}function Xe(a){return a.children[0].innerHTML}function Sn(a,t){const i=At(a),{fontSize:r,font:o,padding:u=0}=a.properties.style||{};if(i.width===i.height&&i.width===0)return;const d=new Mr({font:`${r}px/${r}px ${o}`.replace(/(px)+/g,"px"),width:i.width-u*2,height:i.height-u*2,align:"left",valign:"top",x:0,overflow:"ellipsis",parser:"html",createElement:Mr.createElement});d.overflowWrap("break-word");const f=d.linebreak(a.properties.content.replaceAll(`
40
+ `,"<br>")).render(),g=[...f.children];let p=0;const m=[];a.properties.content.split(`
41
+ `).forEach(A=>{let _=A;for(;_.length&&p<g.length;){if(g[p].innerHTML==="&nbsp;"){_.startsWith(`
42
+ `)||m.push(p),p++;break}const x=Ge(Xe(g[p]));_.startsWith(x)&&(_=_.slice(x.length).trim()),p++}}),m.forEach(A=>f.removeChild(g[A]));const C=a.properties.content.match(/(https?:\/\/.*)/gm),S=C?C.map(A=>A.split(" ")[0]):[];f.setAttribute("transform",`translate(${u}, ${u})`),S.forEach(A=>{let _=A;const x=[];for(;_.length>0;){const M=g.find(T=>!!T.children[0]&&T.children[0].tagName==="tspan"&&_.startsWith(Ge(Xe(T))));if(!M)break;x.push(M);const I=Ge(M.children[0].innerHTML).length;if(!I)break;_=_.slice(I)}x.forEach(M=>{const I=document.createElementNS("http://www.w3.org/2000/svg","a");I.setAttribute("href",A),I.setAttribute("target","_blank"),I.innerHTML=Xe(M),M.children[0].innerHTML="",M.children[0].appendChild(I)})}),t.appendChild(f)}const Dr=20;class _n extends _r{constructor(t,i={}){super(t,`
43
+ <div class="annotation-text-handle" data-handle-id="8">
44
+ <span class="handle line-handle top" data-handle-id="0"></span>
45
+ <span class="handle line-handle bottom" data-handle-id="1"></span>
46
+ <span class="handle line-handle left" data-handle-id="2"></span>
47
+ <span class="handle line-handle right" data-handle-id="3"></span>
48
+ <span class="handle top right point-handle top-right" data-handle-id="4"></span>
49
+ <span class="handle left top point-handle top-left" data-handle-id="5"></span>
50
+ <span class="handle bottom right point-handle bottom-right" data-handle-id="6"></span>
51
+ <span class="handle left bottom left-handle point-handle bottom-left" data-handle-id="7"></span>
52
+ <textarea wrap="on"></textarea>
52
53
  </div>
53
- `),x(this,"textArea"),x(this,"handleSize"),x(this,"rect",{x:0,y:0,width:0,height:0}),x(this,"annotation",{...Xe}),x(this,"startX",0),x(this,"startY",0),x(this,"handles",[]),x(this,"draggedHandle",G),x(this,"isFocused",!1),x(this,"placeholder","Type your text here..."),x(this,"_onFocus",()=>{this.textArea.value===this.placeholder&&(this.textArea.value=""),this.isFocused=!0}),x(this,"_onBlur",()=>{this.isFocused=!1}),x(this,"startDrawing",(l,c,g=pn(l,c,0,0,"",Ft))=>{this.add(g);const y=this.ogma.view.graphToScreenCoordinates({x:l,y:c});this.select(g.id),this.startDragging(this.getById(g.id),y.x,y.y),this.draggedHandle=6}),x(this,"cancelDrawing",()=>{this.isDragging&&(this.remove(this.annotation.id),this.annotation={...Xe},this.draggedHandle=G,this.isDragging=!1,this.emit(jt,this.annotation))}),x(this,"startDragging",(l,c,g)=>{this.annotation=l;const y=pt(this.annotation),f=gt(this.annotation);this.rect.x=y.x,this.rect.y=y.y,this.rect.width=f.width,this.rect.height=f.height,this.startX=c,this.startY=g,this.disableDragging(),this.textArea.classList.add("noevents"),this.textArea.setAttribute("disabled","disabled"),this.emit(Ee,this.annotation),this.isDragging=!0}),x(this,"onHandleMouseDown",l=>{const c=this.getById(this.selectedId)||this.getById(this.hoveredId);if(!c)return;this.selectedId!==c.id&&this.select(this.hoveredId);const{x:g,y}=we(l,this.ogma.getContainer());this.startDragging(c,g,y),this.draggedHandle=Ar(l.target)}),x(this,"onMouseMove",l=>{requestAnimationFrame(()=>this._onMouseMove(l))}),x(this,"_onMouseMove",l=>{if(!this.isDragging)return;l.stopPropagation(),l.preventDefault();const c=this.handles[this.draggedHandle],g=c.classList.contains("top"),y=c.classList.contains("left"),f=c.classList.contains("right"),m=c.classList.contains("bottom"),v=c.classList.contains("line-handle"),{x:k,y:C}=we(l,this.ogma.getContainer()),_=this.ogma.view.getZoom(),R=(k-this.startX)/_,T=(C-this.startY)/_,M=this.ogma.view.getAngle(),L=st({x:R,y:T},M);(m&&y||g&&f)&&(L.y=0,L.x=0);const S=y||v?this.rect.x+L.x:this.rect.x,W=g||v?this.rect.y+L.y:this.rect.y,U=Math.max(this.rect.width+R*(v||y?0:1),zr),lt=Math.max(this.rect.height+T*(v||g?0:1),zr);rn(this.annotation,S,W,U,lt),this.emit(Ae,this.annotation,"text"),this.refreshEditor(),this.layer.refresh()}),x(this,"onMouseUp",()=>{!this.isDragging||this.draggedHandle===G||(this.restoreDragging(),this.textArea.classList.remove("noevents"),this.textArea.removeAttribute("disabled"),this.emit(jt,this.annotation),this.isDragging=!1,this.draggedHandle=G)}),x(this,"_onMousedown",l=>{l.stopPropagation()}),x(this,"onViewChanged",()=>{const l=Math.max(2,this.handleSize/this.ogma.view.getZoom());document.documentElement.style.setProperty("--handle-scale",`${1/l}`)}),x(this,"_onInput",()=>{const l=this.getById(this.selectedId);l&&(this.textArea.value=this.textArea.value.replace(/ +(?= )/g,""),this.textArea.focus(),l.properties.content=this.textArea.value,this.emit(qe,l),this.layer.refresh())}),this.showeditorOnHover=!1,this.handleSize=Dr.handleSize,this.placeholder=Dr.placeholder;const i=this.textArea=this.editor.element.querySelector("textarea");i.addEventListener("input",this._onInput),i.addEventListener("focus",this._onFocus),i.addEventListener("blur",this._onBlur),i.addEventListener("mousedown",this._onMousedown),i.spellcheck=!1,this.handles=Array.prototype.slice.call(this.editor.element.querySelectorAll(".annotation-text-handle > .handle")),this.handles.forEach(l=>l.addEventListener("mousedown",this.onHandleMouseDown)),document.addEventListener("mouseup",this.onMouseUp),document.addEventListener("mousemove",this.onMouseMove,!0),e.events.on(["viewChanged","zoom"],this.onViewChanged)}_canRemove(){return!this.isFocused}detect({x:e,y:s},i=0){const l={x:e,y:s},c=this.ogma.view.getAngle();return this.elements.find(g=>{const{x:y,y:f}=pt(g),{width:m,height:v}=gt(g),k={x:y,y:f},{x:C,y:_}=st(_t(l,k),-c);return C>-i&&C<m+i&&_>-i&&_<v+i})}draw(e){e.innerHTML="";const s="",i=this.ogma.view.getAngle();this.elements.forEach((c,g)=>{const y=`class${g}`,f=gt(c),m=pt(c),v=c.id,{color:k,fontSize:C,font:_,strokeColor:R,strokeWidth:T,strokeType:M,background:L}=c.properties.style||Ft;if(v===this.selectedId)return;const S=Jt("g");S.classList.add("annotation-text"),S.setAttribute("fill",`${k}`),S.setAttribute("font-size",`${C}px`),S.setAttribute("font-family",`${_}`);const W=Jt("rect");let U=!1;M&&M!=="none"&&(U=!0,W.setAttribute("stroke",R||"black"),W.setAttribute("stroke-width",`${T}`),M==="dashed"&&W.setAttribute("stroke-dasharray","5,5")),(L&&L.length||U)&&(U=!0,W.setAttribute("fill",L||"transparent")),U&&(W.setAttribute("width",`${f.width}`),W.setAttribute("height",`${f.height}`)),S.appendChild(W),vn(c,S);const{x:lt,y:kt}=st(m,-i);S.setAttribute("transform",`translate(${lt},${kt})`),S.classList.add(y),S.setAttribute("data-annotation",`${c.id}`),S.setAttribute("data-annotation-type","text"),e.appendChild(S)});const l=Jt("style");l.innerHTML=s,e.firstChild&&e.insertBefore(l,e.firstChild)}refreshDrawing(){const e=this.ogma.view.getAngle();[...this.layer.element.children].forEach(s=>{const i=s.getAttribute("data-annotation");if(!i)return;const l=pt(this.getById(i)),{x:c,y:g}=st(l,-e);s.setAttribute("transform",`translate(${c},${g})`)})}getDefaultOptions(){return Xe}refreshEditor(){if(+this.selectedId<0&&+this.hoveredId<0)return;const e=this.getById(this.selectedId)||this.getById(this.hoveredId),s=gt(e),i=this.ogma.view.graphToScreenCoordinates(pt(e)),l=this.ogma.view.getZoom(),{font:c,fontSize:g,color:y,background:f,padding:m=0}=e.properties.style||Ft,v=(g||1)*l;this.textArea.value=e.properties.content,this.editor.element.style.transform=`translate(${i.x}px, ${i.y}px)translate(-50%, -50%)translate(${s.width/2*l}px, ${s.height/2*l}px)`,this.editor.element.style.width=`${s.width*l}px`,this.editor.element.style.height=`${s.height*l}px`,this.textArea.style.font=`${v} ${c}`,this.textArea.style.fontFamily=c||"sans-serif",this.textArea.style.fontSize=`${v}px`,this.textArea.style.padding=`${l*m}px`,this.textArea.style.lineHeight=`${v}px`,this.textArea.style.boxSizing="border-box",this.textArea.style.color=y||"black",this.textArea.style.background=f||"transparent",this.textArea.placeholder=this.placeholder,this.layer.refresh()}select(e){super.select(e),this.textArea.focus()}destroy(){super.destroy(),document.removeEventListener("mouseup",this.onMouseUp),document.removeEventListener("mousemove",this.onMouseMove,!0),this.ogma.events.off(this.onViewChanged)}}class bn{constructor(){x(this,"links",{}),x(this,"linksByTargetId",{}),x(this,"linksByArrowId",{})}add(e,s,i,l,c){const g=pe(),y=e.id,f={id:g,arrow:y,target:i,targetType:l,connectionPoint:c,side:s};return this.links[g]=f,this.linksByTargetId[i]||(this.linksByTargetId[i]=[]),this.linksByTargetId[i].push(g),this.linksByArrowId[y]||(this.linksByArrowId[y]={}),this.linksByArrowId[y][s]=g,e.properties.link=e.properties.link||{},e.properties.link[s]={id:i,side:s,type:l,magnet:c},this}arrowIsLinked(e,s){var i;return!!((i=this.linksByArrowId[e])!=null&&i[s])}remove(e,s){var i,l;const c=e.id,g=(i=this.linksByArrowId[c])==null?void 0:i[s];if((l=e.properties.link)==null||delete l[s],!g)return this;const y=this.links[g];delete this.links[g];const f=this.linksByTargetId[y.target];for(let m=0;m<f.length;m++)if(f[m]===g){f.splice(m,1);break}return delete this.linksByArrowId[c][s],this}getArrowLink(e,s){var i;const l=(i=this.linksByArrowId[e])==null?void 0:i[s];return l?this.links[l]:null}getTargetLinks(e,s){var i;return((i=this.linksByTargetId[e])==null?void 0:i.map(l=>this.links[l]).filter(l=>l.targetType===s))??[]}forEach(e){Object.values(this.links).forEach(e)}}const at=h=>h.properties.type==="arrow",yt=h=>h.properties.type==="text",Nr=h=>h.type==="FeatureCollection",wn={magnetColor:"#3e8",detectMargin:20,magnetHandleRadius:5,magnetRadius:10,textPlaceholder:"Type here",arrowHandleSize:3.5,textHandleSize:3.5,minArrowHeight:20,maxArrowHeight:30},Br=["start","end"],Hr=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:0,y:.5},{x:1,y:.5},{x:0,y:1},{x:.5,y:1},{x:1,y:1}];class xn extends Rr{constructor(e,s={}){super(),x(this,"arrows"),x(this,"texts"),x(this,"links",new bn),x(this,"layer"),x(this,"annotations"),x(this,"ogma"),x(this,"options"),x(this,"selected",null),x(this,"updateTimeout",0),x(this,"hoveredNode",null),x(this,"dragged",null),x(this,"textToMagnet"),x(this,"activeLinks",[]),x(this,"_render",i=>{if(!this.dragged||this.textToMagnet===void 0)return;i.beginPath(),i.fillStyle="green";const l=this.ogma.view.getZoom();Hr.forEach(c=>{if(!this.textToMagnet)return;const g=gt(this.textToMagnet),y=pt(this.textToMagnet),f=xe(c,{x:g.width,y:g.height}),m=st(f,this.ogma.view.getAngle()),{x:v,y:k}=Lt(m,y);i.moveTo(v,k),i.arc(v,k,this.options.magnetHandleRadius/l,0,Math.PI*2)}),i.fill(),i.closePath()}),x(this,"_onFeatureDrag",(i,l)=>{const c=l;if(at(i)&&c==="line")["start","end"].find(g=>{const y=g==="start"?Kt(i):ve(i);return this._snapToText(i,c,y)||this._findAndSnapToNode(i,g,y)});else if(at(i)&&c!=="line"){const g=c==="start"?Kt(i):ve(i);this._snapToText(i,c,g)||this._findAndSnapToNode(i,c,g)}else yt(i)&&(this.activeLinks.forEach(({arrow:g,side:y,connectionPoint:f})=>{const m=this.getAnnotation(g),v=gt(i),k=pt(i),C=xe(f,{x:v.width,y:v.height}),_=st(C,this.ogma.view.getAngle()),R=Lt(_,k);m.geometry.coordinates[y==="start"?0:1]=[R.x,R.y]}),this.activeLinks.length&&this.arrows.refreshLayer());this.layer.refresh(),this.emit(Ae,i,l)}),x(this,"_onFeatureDragEnd",i=>{this.dragged!==null&&at(i)&&Kt(this.dragged)&&Br.forEach(l=>{this.links.getArrowLink(i.id,l)&&this.emit(cn,{arrow:i,link:this.links.getArrowLink(i.id,l)})}),(yt(i)||at(i))&&this.onUpdate(i),this.dragged=null,this.activeLinks=[],this.textToMagnet=void 0,this.annotations.forEach(l=>l.enableDetection()),this.layer.refresh(),this.emit(jt,i)}),x(this,"_onFeatureDragStart",i=>{this.textToMagnet=void 0,at(i)?this.dragged=i:yt(i)&&this.activeLinks.push(...this.links.getTargetLinks(i.id,"text")),this.annotations.forEach(l=>{const c=l.getSelectedFeature();c&&c!==i&&l.unhover().unselect(),l.disableDetection()}),this.emit(Ee,i)}),x(this,"_onNodesDragStart",()=>{this.arrows.unhover().unselect(),this.texts.unhover().unselect()}),x(this,"_onNodesDrag",i=>{const{dx:l,dy:c}=i;this._moveNodes(i.nodes,l,c)}),x(this,"_onLayoutEnd",i=>{i.ids.forEach((l,c)=>{this.links.getTargetLinks(l,"node").forEach(g=>{const y=this.getAnnotation(g.arrow),f=g.side,m=ye(y,f==="start"?"end":"start"),v=i.positions.current[c],k=this.ogma.getNode(l).getAttribute("radius"),C=be(m,v,+k);Rt(y,f,C.x,C.y)})}),this.arrows.refreshLayer(),this.texts.refreshLayer()}),x(this,"_onAdded",i=>{this.emit(Ge,i)}),x(this,"_onRemoved",i=>{this.emit(Ye,i)}),x(this,"_onUnselect",i=>{this.selected=null,this.emit(Ve,i)}),x(this,"_onSelect",i=>{this.selected!==i&&(this.selected=i,this.emit(We,this.selected))}),x(this,"onUpdate",i=>{cancelAnimationFrame(this.updateTimeout),this.updateTimeout=requestAnimationFrame(()=>this._onUpdate(i))}),x(this,"_onUpdate",i=>{this.emit(qe,i)}),this.options=this.setOptions({...wn,...s}),this.ogma=e,this.arrows=new gn(e,this.options),this.texts=new mn(e,this.options),this.annotations=[this.arrows,this.texts],this.annotations.forEach(i=>{i.on(Ee,this._onFeatureDragStart).on(Ae,this._onFeatureDrag).on(jt,this._onFeatureDragEnd).on(qe,this.onUpdate).on(Ve,this._onUnselect).on(We,this._onSelect).on(Ge,this._onAdded).on(Ye,this._onRemoved)}),this.ogma.events.on("nodesDragStart",this._onNodesDragStart).on("nodesDragProgress",this._onNodesDrag).on("layoutEnd",this._onLayoutEnd).on(["viewChanged","rotate"],()=>{this.refreshTextLinks()}),this.layer=e.layers.addCanvasLayer(this._render),this.layer.moveToBottom()}_moveNodes(e,s,i){e.forEach(l=>{const c=this.links.getTargetLinks(l.getId(),"node"),g=l.getPosition();c.forEach(y=>{const f=this.getAnnotation(y.arrow),m=y.side,v=ye(f,m==="start"?"end":"start");let k=g;const C=+l.getAttribute("radius"),_=1e-6;(y.connectionPoint.x-(g.x-s)>_||y.connectionPoint.y-(g.y-i)>_)&&(k=be(v,g,C)),Rt(f,m,k.x,k.y)})}),this.arrows.refreshLayer()}_snapToText(e,s,i){const l=this.texts.detect(i,this.options.detectMargin);if(this.links.remove(e,s),!l)return!1;this.textToMagnet=l;const c=this.findMagnetPoint(Hr,l,i);return c?(Rt(e,s,c.point.x,c.point.y),this.links.add(e,s,l.id,"text",c.magnet),!0):!1}_findAndSnapToNode(e,s,i){var l,c;const g=this.ogma.view.graphToScreenCoordinates(i),y=this.ogma.view.getElementAt(g);this.links.remove(e,s),y&&y.isNode?((l=this.hoveredNode)==null||l.setSelected(!1),this.hoveredNode=y,y.setSelected(!0),this._snapToNode(e,s,y,g)):((c=this.hoveredNode)==null||c.setSelected(!1),this.hoveredNode=null)}_snapToNode(e,s,i,l){const c=i.getPositionOnScreen(),g=+i.getAttribute("radius"),y=g*this.ogma.view.getZoom(),f=l.x-c.x,m=l.y-c.y,v=Math.sqrt(f*f+m*m),k=i.getPosition();if(v<y+this.options.detectMargin){let C=k;if(v>y/2){const _=ye(e,s==="end"?"start":"end");C=be(_,C,g)}Rt(e,s,C.x,C.y),this.links.add(e,s,i.getId(),"node",C)}}refreshTextLinks(){let e=!1;this.links.forEach(({connectionPoint:s,targetType:i,target:l,arrow:c,side:g})=>{if(i!=="text")return;e=!0;const y=this.getAnnotation(l),f=this.getAnnotation(c),m=gt(y),v=pt(y),k=xe(s,{x:m.width,y:m.height}),C=st(k,this.ogma.view.getAngle()),_=Lt(C,v);Rt(f,g,_.x,_.y)}),e&&this.arrows.refreshLayer()}getSelected(){return this.selected}findMagnetPoint(e,s,i){let l;for(const c of e){const g=gt(s),y=pt(s),f=xe(c,{x:g.width,y:g.height}),m=st(f,this.ogma.view.getAngle()),v=Lt(m,y),k=It(_t(v,i)),C=Math.min(this.options.magnetRadius*this.ogma.view.getZoom(),g.width/2,g.height/2);if(k<Math.max(C,this.options.magnetHandleRadius)){l={point:v,magnet:c};break}}return l}setOptions(e={}){return this.options={...this.options||{},...e},this.options}select(e){const s=this.getAnnotations().features.find(i=>i.id===e);return s?(at(s)?this.arrows.select(s.id):yt(s)&&this.texts.select(s.id),this):this}unselect(){return this.selected?(at(this.selected)?this.arrows.unselect():yt(this.selected)&&this.texts.unselect(),this):this}add(e){if(Nr(e)){const[s,i]=e.features.reduce((l,c)=>(at(c)?l[1].push(c):yt(c)&&l[0].push(c),l),[[],[]]);return s.forEach(l=>this.add(l)),i.forEach(l=>this.add(l)),this.arrows.refreshLayer(),this}switch(e.properties.type){case"text":this.texts.add(e);break;default:this.arrows.add(e),this.loadLink(e);break}return this}remove(e){return Nr(e)?(e.features.forEach(s=>this.remove(s)),this):(at(e)?(this.links.remove(e,"start"),this.links.remove(e,"end"),this.arrows.remove(e.id)):this.texts.remove(e.id),this)}loadLink(e){if(e.properties.link)for(const s of Br){const i=e.properties.link[s];if(!i)continue;const l=this.getAnnotation(i.id);if(i.type==="text"&&l)this.links.add(e,s,i.id,i.type,i.magnet);else if(i.type==="node"){const c=this.ogma.getNode(i.id);if(!c)continue;this.links.add(e,s,i.id,i.type,i.magnet);const g=c.getPosition(),y=c.getAttribute("radius")||0,f=ye(e,s==="start"?"end":"start"),m=be(f,g,+y);Rt(e,s,m.x,m.y)}}}startArrow(e,s,i){this.cancelDrawing(),this.arrows.startDrawing(e,s,i)}startText(e,s,i){this.cancelDrawing(),this.texts.startDrawing(e,s,i)}cancelDrawing(){this.annotations.forEach(e=>e.cancelDrawing()),this.emit(hn)}updateStyle(e,s){const i=this.getAnnotations().features.find(l=>l.id===e);return i?(at(i)?this.arrows.updateStyle(i,s):yt(i)&&this.texts.updateStyle(i,s),this.onUpdate(i),this):this}setScale(e,s,i,l){const c=this.getAnnotations().features.find(g=>g.id===e);return c?(at(c)?this.arrows.scale(c,s,i,l):yt(c)&&this.texts.scale(c,s,i,l),this.onUpdate(c),this):this}getAnnotations(){const e={type:"FeatureCollection",features:[]};return this.annotations.forEach(s=>{e.features=[...e.features,...s.getElements()]}),e}getAnnotation(e){return this.getAnnotations().features.find(s=>s.id===e)}destroy(){this.annotations.forEach(e=>e.destroy()),this.layer.destroy()}}const Ze=[8,10,12,14,16,24,32,48,64,72],Qe="none",tr="#333333",An=["#FFFFFF","#F44E3B","#FE9200","#FCDC00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#1E88E5","#333333","#808080","#cccccc"],En=["Roboto","Helvetica Neue","Helvetica","Arial","sans-serif","Georgia, serif","Menlo","Monaco","Consolas","Courier New","monospace"].sort((h,e)=>h.toLocaleLowerCase().localeCompare(e.toLocaleLowerCase())),Ur={head:"arrow",strokeColor:tr,strokeWidth:5},Wr=.25,Vr={font:"Roboto",fontSize:Ze[2],padding:Ze[2]*Wr,color:tr,strokeType:Qe,background:Qe};function Yr(h){return h.reduce((e,s)=>e+s,0)/h.length}function _n(h,e=0,s=1){return e+(s-e)*h}function kn(h,e=0,s=1){return(h-e)/(s-e)}function Sn(){return X.createContext(null)}const er=X.createContext(void 0),Tn=()=>X.useContext(er),Cn=(h,e)=>{switch(e.type){case"add":return{...h,features:[...h.features,e.payload]};case"remove":return{...h,features:h.features.filter(s=>s.id!==e.payload.id)};case"update":return{...h,features:h.features.map(s=>s.id===e.payload.id?e.payload:s)};default:return h}},On=({children:h})=>{const e=Gr.useOgma(),[s,i]=X.useReducer(Cn,{type:"FeatureCollection",features:[]}),[l,c]=X.useState(null),[g,y]=X.useState(Ur),[f,m]=X.useState(Vr),[v,k]=X.useState(),[C,_]=X.useState(1),[R,T]=X.useState(1);return X.useEffect(()=>{if(!e)return;const M=new xn(e,{minArrowHeight:1}),L=Yr(e.getNodes().getAttribute("radius"))/5,S=C;return y({...g,strokeWidth:(g.strokeWidth||1)*S}),_(S),T(L),M.on("select",W=>{at(W)?y({...W.properties.style||{}}):yt(W)&&m({...W.properties.style||{}}),c(W)}).on("unselect",()=>{c(null)}),k(M),()=>{v==null||v.destroy()}},[e]),X.useEffect(()=>{v&&l&&(l==null?void 0:l.properties.type)==="arrow"&&v.updateStyle(l.id,g)},[v,g,l]),X.useEffect(()=>{v&&l&&(l==null?void 0:l.properties.type)==="text"&&v.updateStyle(l.id,f)},[v,f,l]),Jr.jsx(er.Provider,{value:{annotations:s,updateAnnotations:i,currentAnnotation:l,setCurrentAnnotation:c,textStyle:f,setTextStyle:m,arrowStyle:g,setArrowStyle:y,arrowWidthFactor:C,setArrowWidthFactor:_,textSizeFactor:R,setTextSizeFactor:T,editor:v,setEditor:k},children:h})};H.AnnotationsContext=er,H.AnnotationsContextProvider=On,H.BLACK=tr,H.RELATIVE_PADDING=Wr,H.TRANSPARENT=Qe,H.createAnnotationsContext=Sn,H.defaultArrowStyle=Ur,H.defaultColors=An,H.defaultTextStyle=Vr,H.fontSizes=Ze,H.fonts=En,H.interpolate=_n,H.mean=Yr,H.normalize=kn,H.useAnnotationsContext=Tn,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});
54
+ `),w(this,"textArea"),w(this,"handleSize"),w(this,"rect",{x:0,y:0,width:0,height:0}),w(this,"annotation",{...Ue}),w(this,"startX",0),w(this,"startY",0),w(this,"handles",[]),w(this,"draggedHandle",Z),w(this,"isFocused",!1),w(this,"placeholder","Type your text here..."),w(this,"_onFocus",()=>{this.textArea.value===this.placeholder&&(this.textArea.value=""),this.isFocused=!0}),w(this,"_onBlur",()=>{this.isFocused=!1}),w(this,"startDrawing",(o,u,d=xn(o,u,0,0,"",Xt))=>{this.add(d);const f=this.ogma.view.graphToScreenCoordinates({x:o,y:u});this.select(d.id),this.startDragging(this.getById(d.id),f.x,f.y),this.draggedHandle=6}),w(this,"cancelDrawing",()=>{this.isDragging&&(this.remove(this.annotation.id),this.annotation={...Ue},this.draggedHandle=Z,this.isDragging=!1,this.emit(Gt,this.annotation))}),w(this,"startDragging",(o,u,d)=>{this.annotation=o;const f=Et(this.annotation),g=At(this.annotation);this.rect.x=f.x,this.rect.y=f.y,this.rect.width=g.width,this.rect.height=g.height,this.startX=u,this.startY=d,this.disableDragging(),this.textArea.classList.add("noevents"),this.textArea.setAttribute("disabled","disabled"),this.emit(Ee,this.annotation),this.isDragging=!0}),w(this,"onHandleMouseDown",o=>{const u=this.getById(this.selectedId)||this.getById(this.hoveredId);if(!u)return;this.selectedId!==u.id&&this.select(this.hoveredId);const{x:d,y:f}=$e(o,this.ogma.getContainer());this.startDragging(u,d,f),this.draggedHandle=fr(o.target)}),w(this,"onMouseMove",o=>{requestAnimationFrame(()=>this._onMouseMove(o))}),w(this,"_onMouseMove",o=>{if(!this.isDragging)return;o.stopPropagation(),o.preventDefault();const u=this.handles[this.draggedHandle];let d=u.classList.contains("top");const f=u.classList.contains("left"),g=u.classList.contains("right"),p=u.classList.contains("bottom");let m=u.classList.contains("line-handle");!m&&!d&&!p&&!f&&!g&&(d=!0,m=!0);const{x:C,y:S}=$e(o,this.ogma.getContainer());let A=this.rect.x,_=this.rect.y,x=Math.max(this.rect.width,Dr),M=Math.max(this.rect.height,Dr);const I=this.ogma.view.getZoom(),T=(C-this.startX)/I,H=(S-this.startY)/I,B=this.ogma.view.getAngle(),ot=dt({x:T,y:H},B),rt=dt({x:T,y:H},-B);m?(A=this.rect.x+ot.x,_=this.rect.y+ot.y):f&&d?(A+=ot.x,_+=ot.y,x-=T,M-=H):g&&p?(x+=T,M+=H):f&&p?(A+=rt.x,x-=rt.x,M+=rt.y):g&&d&&(_+=rt.y,x+=rt.x,M-=rt.y),rn(this.annotation,A,_,x,M),this.emit(Ae,this.annotation,"text"),this.refreshEditor(),this.layer.refresh()}),w(this,"onMouseUp",()=>{!this.isDragging||this.draggedHandle===Z||(this.restoreDragging(),this.textArea.classList.remove("noevents"),this.textArea.removeAttribute("disabled"),this.emit(Gt,this.annotation),this.isDragging=!1,this.draggedHandle=Z)}),w(this,"_onMousedown",o=>{o.stopPropagation()}),w(this,"onViewChanged",()=>{const o=Math.max(2,this.handleSize/this.ogma.view.getZoom());document.documentElement.style.setProperty("--handle-scale",`${1/o}`)}),w(this,"_onInput",()=>{const o=this.getById(this.selectedId);o&&(this.textArea.value=this.textArea.value.replace(/ +(?= )/g,""),this.textArea.focus(),o.properties.content=this.textArea.value,this.emit(qe,o),this.layer.refresh())}),this.showeditorOnHover=!1,this.handleSize=jr.handleSize,this.placeholder=jr.placeholder;const r=this.textArea=this.editor.element.querySelector("textarea");r.addEventListener("input",this._onInput),r.addEventListener("focus",this._onFocus),r.addEventListener("blur",this._onBlur),r.addEventListener("mousedown",this._onMousedown),r.spellcheck=!1,this.handles=Array.prototype.slice.call(this.editor.element.querySelectorAll(".annotation-text-handle > .handle")),this.handles.push(this.editor.element),this.handles.forEach(o=>o.addEventListener("mousedown",this.onHandleMouseDown)),document.addEventListener("mouseup",this.onMouseUp),document.addEventListener("mousemove",this.onMouseMove,!0),t.events.on(["viewChanged","zoom"],this.onViewChanged)}_canRemove(){return!this.isFocused}detect({x:t,y:i},r=0){const o={x:t,y:i},u=this.ogma.view.getAngle();return this.elements.find(d=>{const{x:f,y:g}=Et(d),{width:p,height:m}=At(d),C={x:f,y:g},{x:S,y:A}=dt(Ft(o,C),-u);return S>-r&&S<p+r&&A>-r&&A<m+r})}draw(t){t.innerHTML="";const i="",r=this.ogma.view.getAngle();for(let u=0;u<this.elements.length;u++){const d=this.elements[u],f=`class${u}`,g=At(d),p=Et(d);if(d.id===this.selectedId)continue;const{color:m,fontSize:C,font:S,strokeColor:A,strokeWidth:_,strokeType:x,background:M,borderRadius:I}=d.properties.style||Xt,T=$t("g");T.classList.add("annotation-text"),T.setAttribute("fill",`${m}`),T.setAttribute("font-size",`${C}px`),T.setAttribute("font-family",`${S}`);const H=$t("rect");I&&(H.setAttribute("rx",`${I}`),H.setAttribute("ry",`${I}`));let B=!1;x&&x!=="none"&&(B=!0,H.setAttribute("stroke",A||"black"),H.setAttribute("stroke-width",`${_}`),x==="dashed"&&H.setAttribute("stroke-dasharray","5,5")),(M&&M.length||B)&&(B=!0,H.setAttribute("fill",M||"transparent")),B&&(H.setAttribute("width",`${g.width}`),H.setAttribute("height",`${g.height}`)),T.appendChild(H),Sn(d,T);const{x:ot,y:rt}=dt(p,-r);T.setAttribute("transform",`translate(${ot},${rt})`),T.classList.add(f),T.setAttribute("data-annotation",`${d.id}`),T.setAttribute("data-annotation-type","text"),t.appendChild(T)}const o=$t("style");o.innerHTML=i,t.firstChild&&t.insertBefore(o,t.firstChild)}refreshDrawing(){const t=this.ogma.view.getAngle(),i=this.layer.element.children;for(let r=0;r<i.length;r++){const o=i[r];if(!o.hasAttribute("data-annotation"))continue;const u=o.getAttribute("data-annotation"),d=Et(this.getById(u)),{x:f,y:g}=dt(d,-t);o.setAttribute("transform",`translate(${f},${g})`)}}getDefaultOptions(){return Ue}refreshEditor(){if(+this.selectedId<0&&+this.hoveredId<0)return;const t=this.getById(this.selectedId)||this.getById(this.hoveredId),i=At(t),r=this.ogma.view.graphToScreenCoordinates(Et(t)),o=this.ogma.view.getZoom(),{font:u,fontSize:d,color:f,background:g,padding:p=0}=t.properties.style||Xt,m=(d||1)*o;this.textArea.value=t.properties.content;const C=this.editor.element.style;C.transform=`translate(${r.x}px, ${r.y}px)translate(-50%, -50%)translate(${i.width/2*o}px, ${i.height/2*o}px)`,C.width=`${i.width*o}px`,C.height=`${i.height*o}px`;const S=this.textArea.style;S.font=`${m} ${u}`,S.fontFamily=u||"sans-serif",S.fontSize=`${m}px`,S.padding=`${o*p}px`,S.lineHeight=`${m}px`,S.boxSizing="border-box",S.color=f||"black",S.background=g||"transparent",this.textArea.placeholder=this.placeholder,this.layer.refresh()}select(t){super.select(t),this.textArea.classList.add("noevents")}destroy(){super.destroy(),document.removeEventListener("mouseup",this.onMouseUp),document.removeEventListener("mousemove",this.onMouseMove,!0),this.ogma.events.off(this.onViewChanged)}}class Cn{constructor(){w(this,"links",{}),w(this,"linksByTargetId",{}),w(this,"linksByArrowId",{})}add(t,i,r,o,u){const d=me(),f=t.id,g={id:d,arrow:f,target:r,targetType:o,connectionPoint:u,side:i};return this.links[d]=g,this.linksByTargetId[r]||(this.linksByTargetId[r]=[]),this.linksByTargetId[r].push(d),this.linksByArrowId[f]||(this.linksByArrowId[f]={}),this.linksByArrowId[f][i]=d,t.properties.link=t.properties.link||{},t.properties.link[i]={id:r,side:i,type:o,magnet:u},this}arrowIsLinked(t,i){var r;return!!((r=this.linksByArrowId[t])!=null&&r[i])}remove(t,i){var r,o;const u=t.id,d=(r=this.linksByArrowId[u])==null?void 0:r[i];if((o=t.properties.link)==null||delete o[i],!d)return this;const f=this.links[d];delete this.links[d];const g=this.linksByTargetId[f.target];for(let p=0;p<g.length;p++)if(g[p]===d){g.splice(p,1);break}return delete this.linksByArrowId[u][i],this}getArrowLink(t,i){var r;const o=(r=this.linksByArrowId[t])==null?void 0:r[i];return o?this.links[o]:null}getTargetLinks(t,i){var r;return((r=this.linksByTargetId[t])==null?void 0:r.map(o=>this.links[o]).filter(o=>o.targetType===i))??[]}forEach(t){Object.values(this.links).forEach(t)}}const gt=a=>a.properties.type==="arrow",kt=a=>a.properties.type==="text",Pr=a=>a.type==="FeatureCollection",Tn={magnetColor:"#3e8",detectMargin:20,magnetHandleRadius:5,magnetRadius:10,textPlaceholder:"Type here",arrowHandleSize:3.5,textHandleSize:3.5,minArrowHeight:20,maxArrowHeight:30},Nr=["start","end"],Rr=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:0,y:.5},{x:1,y:.5},{x:0,y:1},{x:.5,y:1},{x:1,y:1}];class On extends Sr{constructor(t,i={}){super(),w(this,"arrows"),w(this,"texts"),w(this,"links",new Cn),w(this,"layer"),w(this,"annotations"),w(this,"ogma"),w(this,"options"),w(this,"selected",null),w(this,"updateTimeout",0),w(this,"hoveredNode",null),w(this,"dragged",null),w(this,"textToMagnet"),w(this,"activeLinks",[]),w(this,"_render",r=>{if(!this.dragged||this.textToMagnet===void 0)return;r.beginPath(),r.fillStyle="green";const o=this.ogma.view.getZoom();Rr.forEach(u=>{if(!this.textToMagnet)return;const d=At(this.textToMagnet),f=Et(this.textToMagnet),g=xe(u,{x:d.width,y:d.height}),p=dt(g,this.ogma.view.getAngle()),{x:m,y:C}=Yt(p,f);r.moveTo(m,C),r.arc(m,C,this.options.magnetHandleRadius/o,0,Math.PI*2)}),r.fill(),r.closePath()}),w(this,"_onFeatureDrag",(r,o)=>{const u=o;if(gt(r)&&u==="line")["start","end"].find(d=>{const f=d==="start"?ie(r):ve(r);return this._snapToText(r,u,f)||this._findAndSnapToNode(r,d,f)});else if(gt(r)&&u!=="line"){const d=u==="start"?ie(r):ve(r);this._snapToText(r,u,d)||this._findAndSnapToNode(r,u,d)}else kt(r)&&(this.activeLinks.forEach(({arrow:d,side:f,connectionPoint:g})=>{const p=this.getAnnotation(d),m=At(r),C=Et(r),S=xe(g,{x:m.width,y:m.height}),A=dt(S,this.ogma.view.getAngle()),_=Yt(A,C);p.geometry.coordinates[f==="start"?0:1]=[_.x,_.y]}),this.activeLinks.length&&this.arrows.refreshLayer());this.layer.refresh(),this.emit(Ae,r,o)}),w(this,"_onFeatureDragEnd",r=>{this.dragged!==null&&gt(r)&&ie(this.dragged)&&Nr.forEach(o=>{this.links.getArrowLink(r.id,o)&&this.emit(yn,{arrow:r,link:this.links.getArrowLink(r.id,o)})}),(kt(r)||gt(r))&&this.onUpdate(r),this.dragged=null,this.activeLinks=[],this.textToMagnet=void 0,this.annotations.forEach(o=>o.enableDetection()),this.layer.refresh(),this.emit(Gt,r)}),w(this,"_onFeatureDragStart",r=>{this.textToMagnet=void 0,gt(r)?this.dragged=r:kt(r)&&this.activeLinks.push(...this.links.getTargetLinks(r.id,"text")),this.annotations.forEach(o=>{const u=o.getSelectedFeature();u&&u!==r&&o.unhover().unselect(),o.disableDetection()}),this.emit(Ee,r)}),w(this,"_onNodesDragStart",()=>{this.arrows.unhover().unselect(),this.texts.unhover().unselect()}),w(this,"_onNodesDrag",r=>{const{dx:o,dy:u}=r;this._moveNodes(r.nodes,o,u)}),w(this,"_onLayoutEnd",r=>{r.ids.forEach((o,u)=>{this.links.getTargetLinks(o,"node").forEach(d=>{const f=this.getAnnotation(d.arrow),g=d.side,p=ye(f,g==="start"?"end":"start"),m=r.positions.current[u],C=this.ogma.getNode(o).getAttribute("radius"),S=be(p,m,+C);qt(f,g,S.x,S.y)})}),this.arrows.refreshLayer(),this.texts.refreshLayer()}),w(this,"_onAdded",r=>{this.emit(We,r)}),w(this,"_onRemoved",r=>{this.emit(Be,r)}),w(this,"_onUnselect",r=>{this.selected=null,this.emit(He,r)}),w(this,"_onSelect",r=>{this.selected!==r&&(this.selected=r,this.emit(Fe,this.selected))}),w(this,"onUpdate",r=>{cancelAnimationFrame(this.updateTimeout),this.updateTimeout=requestAnimationFrame(()=>this._onUpdate(r))}),w(this,"_onUpdate",r=>{this.emit(qe,r)}),this.options=this.setOptions({...Tn,...i}),this.ogma=t,this.arrows=new bn(t,this.options),this.texts=new _n(t,this.options),this.annotations=[this.arrows,this.texts],this.annotations.forEach(r=>{r.on(Ee,this._onFeatureDragStart).on(Ae,this._onFeatureDrag).on(Gt,this._onFeatureDragEnd).on(qe,this.onUpdate).on(He,this._onUnselect).on(Fe,this._onSelect).on(We,this._onAdded).on(Be,this._onRemoved)}),this.ogma.events.on("nodesDragStart",this._onNodesDragStart).on("nodesDragProgress",this._onNodesDrag).on("layoutEnd",this._onLayoutEnd).on(["viewChanged","rotate"],()=>{this.refreshTextLinks()}),this.layer=t.layers.addCanvasLayer(this._render),this.layer.moveToBottom()}_moveNodes(t,i,r){t.forEach(o=>{const u=this.links.getTargetLinks(o.getId(),"node"),d=o.getPosition();u.forEach(f=>{const g=this.getAnnotation(f.arrow),p=f.side,m=ye(g,p==="start"?"end":"start");let C=d;const S=+o.getAttribute("radius"),A=1e-6;(f.connectionPoint.x-(d.x-i)>A||f.connectionPoint.y-(d.y-r)>A)&&(C=be(m,d,S)),qt(g,p,C.x,C.y)})}),this.arrows.refreshLayer()}_snapToText(t,i,r){const o=this.texts.detect(r,this.options.detectMargin);if(this.links.remove(t,i),!o)return!1;this.textToMagnet=o;const u=this.findMagnetPoint(Rr,o,r);return u?(qt(t,i,u.point.x,u.point.y),this.links.add(t,i,o.id,"text",u.magnet),!0):!1}_findAndSnapToNode(t,i,r){var o,u;const d=this.ogma.view.graphToScreenCoordinates(r),f=this.ogma.view.getElementAt(d);this.links.remove(t,i),f&&f.isNode?((o=this.hoveredNode)==null||o.setSelected(!1),this.hoveredNode=f,f.setSelected(!0),this._snapToNode(t,i,f,d)):((u=this.hoveredNode)==null||u.setSelected(!1),this.hoveredNode=null)}_snapToNode(t,i,r,o){const u=r.getPositionOnScreen(),d=+r.getAttribute("radius"),f=d*this.ogma.view.getZoom(),g=o.x-u.x,p=o.y-u.y,m=Math.sqrt(g*g+p*p),C=r.getPosition();if(m<f+this.options.detectMargin){let S=C;if(m>f/2){const A=ye(t,i==="end"?"start":"end");S=be(A,S,d)}qt(t,i,S.x,S.y),this.links.add(t,i,r.getId(),"node",S)}}refreshTextLinks(){let t=!1;this.links.forEach(({connectionPoint:i,targetType:r,target:o,arrow:u,side:d})=>{if(r!=="text")return;t=!0;const f=this.getAnnotation(o),g=this.getAnnotation(u),p=At(f),m=Et(f),C=xe(i,{x:p.width,y:p.height}),S=dt(C,this.ogma.view.getAngle()),A=Yt(S,m);qt(g,d,A.x,A.y)}),t&&this.arrows.refreshLayer()}getSelected(){return this.selected}findMagnetPoint(t,i,r){let o;for(const u of t){const d=At(i),f=Et(i),g=xe(u,{x:d.width,y:d.height}),p=dt(g,this.ogma.view.getAngle()),m=Yt(p,f),C=Ut(Ft(m,r)),S=Math.min(this.options.magnetRadius*this.ogma.view.getZoom(),d.width/2,d.height/2);if(C<Math.max(S,this.options.magnetHandleRadius)){o={point:m,magnet:u};break}}return o}setOptions(t={}){return this.options={...this.options||{},...t},this.options}select(t){const i=this.getAnnotations().features.find(r=>r.id===t);return i?(gt(i)?this.arrows.select(i.id):kt(i)&&this.texts.select(i.id),this):this}unselect(){return this.selected?(gt(this.selected)?this.arrows.unselect():kt(this.selected)&&this.texts.unselect(),this):this}add(t){if(Pr(t)){const[i,r]=t.features.reduce((o,u)=>(gt(u)?o[1].push(u):kt(u)&&o[0].push(u),o),[[],[]]);return i.forEach(o=>this.add(o)),r.forEach(o=>this.add(o)),this.arrows.refreshLayer(),this}switch(t.properties.type){case"text":this.texts.add(t);break;default:this.arrows.add(t),this.loadLink(t);break}return this}remove(t){return Pr(t)?(t.features.forEach(i=>this.remove(i)),this):(gt(t)?(this.links.remove(t,"start"),this.links.remove(t,"end"),this.arrows.remove(t.id)):this.texts.remove(t.id),this)}loadLink(t){if(t.properties.link)for(const i of Nr){const r=t.properties.link[i];if(!r)continue;const o=this.getAnnotation(r.id);if(r.type==="text"&&o)this.links.add(t,i,r.id,r.type,r.magnet);else if(r.type==="node"){const u=this.ogma.getNode(r.id);if(!u)continue;this.links.add(t,i,r.id,r.type,r.magnet);const d=u.getPosition(),f=u.getAttribute("radius")||0,g=ye(t,i==="start"?"end":"start"),p=be(g,d,+f);qt(t,i,p.x,p.y)}}}startArrow(t,i,r){this.cancelDrawing(),this.arrows.startDrawing(t,i,r)}startText(t,i,r){this.cancelDrawing(),this.texts.startDrawing(t,i,r)}cancelDrawing(){this.annotations.forEach(t=>t.cancelDrawing()),this.emit(mn)}updateStyle(t,i){const r=this.getAnnotations().features.find(o=>o.id===t);return r?(gt(r)?this.arrows.updateStyle(r,i):kt(r)&&this.texts.updateStyle(r,i),this.onUpdate(r),this):this}setScale(t,i,r,o){const u=this.getAnnotations().features.find(d=>d.id===t);return u?(gt(u)?this.arrows.scale(u,i,r,o):kt(u)&&this.texts.scale(u,i,r,o),this.onUpdate(u),this):this}getAnnotations(){const t={type:"FeatureCollection",features:[]};return this.annotations.forEach(i=>{t.features=[...t.features,...i.getElements()]}),t}getAnnotation(t){return this.getAnnotations().features.find(i=>i.id===t)}destroy(){this.annotations.forEach(t=>t.destroy()),this.layer.destroy()}}const Ve=[8,10,12,14,16,24,32,48,64,72],Je="none",Ze="#333333",jn=["#FFFFFF","#F44E3B","#FE9200","#FCDC00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#1E88E5","#333333","#808080","#cccccc"],Ln=["Roboto","Helvetica Neue","Helvetica","Arial","sans-serif","Georgia, serif","Menlo","Monaco","Consolas","Courier New","monospace"].sort((a,t)=>a.toLocaleLowerCase().localeCompare(t.toLocaleLowerCase())),Ir={head:"arrow",strokeColor:Ze,strokeWidth:5},zr=.25,$r={font:"Roboto",fontSize:Ve[2],padding:Ve[2]*zr,color:Ze,strokeType:Je,background:Je};function Fr(a){return a.reduce((t,i)=>t+i,0)/a.length}function Mn(a,t=0,i=1){return t+(i-t)*a}function Dn(a,t=0,i=1){return(a-t)/(i-t)}function Pn(){return Q.createContext(null)}const Ke=Q.createContext(void 0),Nn=()=>Q.useContext(Ke),Rn=(a,t)=>{switch(t.type){case"add":return{...a,features:[...a.features,t.payload]};case"remove":return{...a,features:a.features.filter(i=>i.id!==t.payload.id)};case"update":return{...a,features:a.features.map(i=>i.id===t.payload.id?t.payload:i)};default:return a}},In=({children:a})=>{const t=Yr.useOgma(),[i,r]=Q.useReducer(Rn,{type:"FeatureCollection",features:[]}),[o,u]=Q.useState(null),[d,f]=Q.useState(Ir),[g,p]=Q.useState($r),[m,C]=Q.useState(),[S,A]=Q.useState(1),[_,x]=Q.useState(1);return Q.useEffect(()=>{if(!t)return;const M=new On(t,{minArrowHeight:1}),I=Fr(t.getNodes().getAttribute("radius"))/5,T=S;return f({...d,strokeWidth:(d.strokeWidth||1)*T}),A(T),x(I),M.on("select",H=>{gt(H)?f({...H.properties.style||{}}):kt(H)&&p({...H.properties.style||{}}),u(H)}).on("unselect",()=>{u(null)}),C(M),()=>{m==null||m.destroy()}},[t]),Q.useEffect(()=>{m&&o&&(o==null?void 0:o.properties.type)==="arrow"&&m.updateStyle(o.id,d)},[m,d,o]),Q.useEffect(()=>{m&&o&&(o==null?void 0:o.properties.type)==="text"&&m.updateStyle(o.id,g)},[m,g,o]),Jr.jsx(Ke.Provider,{value:{annotations:i,updateAnnotations:r,currentAnnotation:o,setCurrentAnnotation:u,textStyle:g,setTextStyle:p,arrowStyle:d,setArrowStyle:f,arrowWidthFactor:S,setArrowWidthFactor:A,textSizeFactor:_,setTextSizeFactor:x,editor:m,setEditor:C},children:a})};Y.AnnotationsContext=Ke,Y.AnnotationsContextProvider=In,Y.BLACK=Ze,Y.RELATIVE_PADDING=zr,Y.TRANSPARENT=Je,Y.createAnnotationsContext=Pn,Y.defaultArrowStyle=Ir,Y.defaultColors=jn,Y.defaultTextStyle=$r,Y.fontSizes=Ve,Y.fonts=Ln,Y.interpolate=Mn,Y.mean=Fr,Y.normalize=Dn,Y.useAnnotationsContext=Nn,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});