UNPKG

@hpcc-js/react

Version:
484 lines (460 loc) 55.7 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@hpcc-js/common')) : typeof define === 'function' && define.amd ? define(['exports', '@hpcc-js/common'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@hpcc-js/react"] = {}, global["@hpcc-js/common"])); })(this, (function (exports, common) { 'use strict'; var PKG_NAME$1 = "@hpcc-js/react"; var PKG_VERSION$1 = "2.53.8"; var BUILD_VERSION$1 = "2.104.28"; var PKG_NAME = "@hpcc-js/preact-shim"; var PKG_VERSION = "2.16.6"; var BUILD_VERSION = "2.104.28"; var n,l$1,u$1,t$1,o$1,r$1,f$1,c$1={},s$1=[],a$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v$1=Array.isArray;function h$1(n,l){for(var u in l)n[u]=l[u];return n}function p$1(n){var l=n.parentNode;l&&l.removeChild(n);}function y(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d$1(l,f,t,o,null)}function d$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function k$1(n){return n.children}function b$1(n,l){this.props=n,this.context=l;}function g$1(n,l){if(null==l)return n.__?g$1(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?g$1(n):null}function m$1(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return m$1(n)}}function w$1(n){(!n.__d&&(n.__d=!0)&&t$1.push(n)&&!x.__r++||o$1!==l$1.debounceRendering)&&((o$1=l$1.debounceRendering)||r$1)(x);}function x(){var n,l,u,i,o,r,e,c;for(t$1.sort(f$1);n=t$1.shift();)n.__d&&(l=t$1.length,i=void 0,o=void 0,e=(r=(u=n).__v).__e,(c=u.__P)&&(i=[],(o=h$1({},r)).__v=r.__v+1,L(c,r,o,u.__n,void 0!==c.ownerSVGElement,null!=r.__h?[e]:null,i,null==e?g$1(r):e,r.__h),M(i,r),r.__e!=e&&m$1(r)),t$1.length>l&&t$1.sort(f$1));x.__r=0;}function P(n,l,u,i,t,o,r,f,e,a){var h,p,y,_,b,m,w,x=i&&i.__k||s$1,P=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(_=u.__k[h]=null==(_=l[h])||"boolean"==typeof _||"function"==typeof _?null:"string"==typeof _||"number"==typeof _||"bigint"==typeof _?d$1(null,_,null,null,_):v$1(_)?d$1(k$1,{children:_},null,null,null):_.__b>0?d$1(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)){if(_.__=u,_.__b=u.__b+1,null===(y=x[h])||y&&_.key==y.key&&_.type===y.type)x[h]=void 0;else for(p=0;p<P;p++){if((y=x[p])&&_.key==y.key&&_.type===y.type){x[p]=void 0;break}y=null;}L(n,_,y=y||c$1,t,o,r,f,e,a),b=_.__e,(p=_.ref)&&y.ref!=p&&(w||(w=[]),y.ref&&w.push(y.ref,null,_),w.push(p,_.__c||b,_)),null!=b?(null==m&&(m=b),"function"==typeof _.type&&_.__k===y.__k?_.__d=e=C(_,e,n):e=$(n,_,y,x,b,e),"function"==typeof u.type&&(u.__d=e)):e&&y.__e==e&&e.parentNode!=n&&(e=g$1(y));}for(u.__e=m,h=P;h--;)null!=x[h]&&("function"==typeof u.type&&null!=x[h].__e&&x[h].__e==u.__d&&(u.__d=A(i).nextSibling),q(x[h],x[h]));if(w)for(h=0;h<w.length;h++)O(w[h],w[++h],w[++h]);}function C(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?C(i,l,u):$(u,i,i,t,i.__e,l));return l}function $(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=1)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function A(n){var l,u,i;if(null==n.type||"string"==typeof n.type)return n.__e;if(n.__k)for(l=n.__k.length-1;l>=0;l--)if((u=n.__k[l])&&(i=A(u)))return i;return null}function H(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||T$1(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||T$1(n,o,l[o],u[o],i);}function I(n,l,u){"-"===l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||a$1.test(l)?u:u+"px";}function T$1(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||I(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||I(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?z$1:j$1,o):n.removeEventListener(l,o?z$1:j$1,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==l&&"height"!==l&&"href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&"rowSpan"!==l&&"colSpan"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u));}}function j$1(n){return this.l[n.type+!1](l$1.event?l$1.event(n):n)}function z$1(n){return this.l[n.type+!0](l$1.event?l$1.event(n):n)}function L(n,u,i,t,o,r,f,e,c){var s,a,p,y,d,_,g,m,w,x,C,S,$,A,H,I=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(s=l$1.__b)&&s(u);try{n:if("function"==typeof I){if(m=u.props,w=(s=I.contextType)&&t[s.__c],x=s?w?w.props.value:s.__:t,i.__c?g=(a=u.__c=i.__c).__=a.__E:("prototype"in I&&I.prototype.render?u.__c=a=new I(m,x):(u.__c=a=new b$1(m,x),a.constructor=I,a.render=B$1),w&&w.sub(a),a.props=m,a.state||(a.state={}),a.context=x,a.__n=t,p=a.__d=!0,a.__h=[],a._sb=[]),null==a.__s&&(a.__s=a.state),null!=I.getDerivedStateFromProps&&(a.__s==a.state&&(a.__s=h$1({},a.__s)),h$1(a.__s,I.getDerivedStateFromProps(m,a.__s))),y=a.props,d=a.state,a.__v=u,p)null==I.getDerivedStateFromProps&&null!=a.componentWillMount&&a.componentWillMount(),null!=a.componentDidMount&&a.__h.push(a.componentDidMount);else {if(null==I.getDerivedStateFromProps&&m!==y&&null!=a.componentWillReceiveProps&&a.componentWillReceiveProps(m,x),!a.__e&&null!=a.shouldComponentUpdate&&!1===a.shouldComponentUpdate(m,a.__s,x)||u.__v===i.__v){for(u.__v!==i.__v&&(a.props=m,a.state=a.__s,a.__d=!1),a.__e=!1,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),C=0;C<a._sb.length;C++)a.__h.push(a._sb[C]);a._sb=[],a.__h.length&&f.push(a);break n}null!=a.componentWillUpdate&&a.componentWillUpdate(m,a.__s,x),null!=a.componentDidUpdate&&a.__h.push(function(){a.componentDidUpdate(y,d,_);});}if(a.context=x,a.props=m,a.__P=n,S=l$1.__r,$=0,"prototype"in I&&I.prototype.render){for(a.state=a.__s,a.__d=!1,S&&S(u),s=a.render(a.props,a.state,a.context),A=0;A<a._sb.length;A++)a.__h.push(a._sb[A]);a._sb=[];}else do{a.__d=!1,S&&S(u),s=a.render(a.props,a.state,a.context),a.state=a.__s;}while(a.__d&&++$<25);a.state=a.__s,null!=a.getChildContext&&(t=h$1(h$1({},t),a.getChildContext())),p||null==a.getSnapshotBeforeUpdate||(_=a.getSnapshotBeforeUpdate(y,d)),P(n,v$1(H=null!=s&&s.type===k$1&&null==s.key?s.props.children:s)?H:[H],u,i,t,o,r,f,e,c),a.base=u.__e,u.__h=null,a.__h.length&&f.push(a),g&&(a.__E=a.__=null),a.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=N(i.__e,u,i,t,o,r,f,c);(s=l$1.diffed)&&s(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,i);}}function M(n,u){l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function N(l,u,i,t,o,r,f,e){var s,a,h,y=i.props,d=u.props,_=u.type,k=0;if("svg"===_&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!_&&(_?s.localName===_:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===_)return document.createTextNode(d);l=o?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,d.is&&d),r=null,e=!1;}if(null===_)y===d||e&&l.data===d||(l.data=d);else {if(r=r&&n.call(l.childNodes),a=(y=i.props||c$1).dangerouslySetInnerHTML,h=d.dangerouslySetInnerHTML,!e){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(h||a)&&(h&&(a&&h.__html==a.__html||h.__html===l.innerHTML)||(l.innerHTML=h&&h.__html||""));}if(H(l,d,y,o,e),h)u.__k=[];else if(P(l,v$1(k=u.props.children)?k:[k],u,i,t,o&&"foreignObject"!==_,r,f,r?r[0]:i.__k&&g$1(i,0),e),null!=r)for(k=r.length;k--;)null!=r[k]&&p$1(r[k]);e||("value"in d&&void 0!==(k=d.value)&&(k!==l.value||"progress"===_&&!k||"option"===_&&k!==y.value)&&T$1(l,"value",k,y.value,!1),"checked"in d&&void 0!==(k=d.checked)&&k!==l.checked&&T$1(l,"checked",k,y.checked,!1));}return l}function O(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,i);}}function q(n,u,i){var t,o;if(l$1.unmount&&l$1.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||O(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$1.__e(n,u);}t.base=t.__P=null,n.__c=void 0;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&q(t[o],u,i||"function"!=typeof n.type);i||null==n.__e||p$1(n.__e),n.__=n.__e=n.__d=void 0;}function B$1(n,l,u){return this.constructor(n,u)}function D(u,i,t){var o,r,f;l$1.__&&l$1.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,f=[],L(i,u=(!o&&t||i).__k=y(k$1,null,[u]),r||c$1,c$1,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,f,!o&&t?t:r?r.__e:i.firstChild,o),M(f,u);}n=s$1.slice,l$1={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$1=0,b$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h$1({},this.state),"function"==typeof n&&(n=n(h$1({},u),this.props)),n&&h$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),w$1(this));},b$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),w$1(this));},b$1.prototype.render=k$1,t$1=[],r$1="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f$1=function(n,l){return n.__v.__b-l.__v.__b},x.__r=0; var t,r,u,i,o=0,f=[],c=[],e=l$1.__b,a=l$1.__r,v=l$1.diffed,l=l$1.__c,m=l$1.unmount;function d(t,u){l$1.__h&&l$1.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function h(n){return o=1,s(B,n)}function s(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r,!r.u)){var f=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return !n.__N}))return !c||c.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!(!i&&o.__c.props===n)&&(!c||c.call(this,n,t,r))};r.u=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u;}e&&e.call(this,n,t,r);},r.shouldComponentUpdate=f;}return o.__N||o.__}function p(u,i){var o=d(t++,3);!l$1.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__H.__h.push(o));}function F(n,r){var u=d(t++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T(n,t){return o=8,F(function(){return n},t)}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[];}catch(r){t.__H.__h=[],l$1.__e(r,t.__v);}}l$1.__b=function(n){r=null,e&&e(n);},l$1.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0;})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[],t=0)),u=r;},l$1.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===l$1.requestAnimationFrame||((i=l$1.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c;})),u=r=null;},l$1.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return !n.__||w(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$1.__e(u,t.__v);}}),l&&l(t,r);},l$1.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$1.__e(r,u.__v));};var g="function"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r));}function k(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function w(n){var t=r;n.__c=n.__(),r=t;}function z(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B(n,t){return "function"==typeof t?t(n):t} var index_es6 = /*#__PURE__*/Object.freeze({ __proto__: null, BUILD_VERSION: BUILD_VERSION, Component: b$1, Fragment: k$1, PKG_NAME: PKG_NAME, PKG_VERSION: PKG_VERSION, createElement: y, h: y, render: D, useCallback: T, useEffect: p, useMemo: F, useReducer: s, useState: h }); /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } var Image = function (_a) { var href = _a.href, x = _a.x, _b = _a.y, y$1 = _b === void 0 ? 0 : _b, _c = _a.height, height = _c === void 0 ? 12 : _c; return y("image", { href: href, x: x - height / 2, y: y$1 - height / 2, width: height, height: height }); }; var ImageChar = function (_a) { var x = _a.x, _b = _a.y, y$1 = _b === void 0 ? 0 : _b, _c = _a.height, height = _c === void 0 ? 12 : _c, fill = _a.fill, stroke = _a.stroke, _d = _a.fontFamily, fontFamily = _d === void 0 ? "FontAwesome" : _d, _e = _a.char, char = _e === void 0 ? "" : _e; var renderChar = F(function () { return fontFamily === "FontAwesome" ? common.Utility.faChar(char) : char; }, [char, fontFamily]); return y("text", { x: x, y: y$1, fill: fill, stroke: stroke, "font-family": fontFamily, "font-size": "".concat(height, "px"), "dominant-baseline": "middle", style: "text-anchor: middle;alignment-baseline:middle;" }, renderChar); }; var Circle = function (_a) { var _b = _a.radius, radius = _b === void 0 ? 32 : _b, _c = _a.fill, fill = _c === void 0 ? "navy" : _c, _d = _a.stroke, stroke = _d === void 0 ? fill : _d, _e = _a.strokeWidth, strokeWidth = _e === void 0 ? 1 : _e, shapeRendering = _a.shapeRendering; return y("circle", { r: radius, fill: fill, stroke: stroke, "stroke-width": strokeWidth, "shape-rendering": shapeRendering }); }; var Square = function (_a) { var _b = _a.radius, radius = _b === void 0 ? 30 : _b, _c = _a.cornerRadius, cornerRadius = _c === void 0 ? 0 : _c, _d = _a.fill, fill = _d === void 0 ? "white" : _d, stroke = _a.stroke, _e = _a.strokeWidth, strokeWidth = _e === void 0 ? 1 : _e, shapeRendering = _a.shapeRendering; return y("rect", { x: -radius, y: -radius, rx: cornerRadius, ry: cornerRadius, width: radius * 2, height: radius * 2, fill: fill, stroke: stroke || fill, "stroke-width": strokeWidth, "shape-rendering": shapeRendering }); }; var Rectangle = function (_a) { var _b = _a.width, width = _b === void 0 ? 30 : _b, _c = _a.height, height = _c === void 0 ? 30 : _c, _d = _a.cornerRadius, cornerRadius = _d === void 0 ? 0 : _d, _e = _a.fill, fill = _e === void 0 ? "white" : _e, _f = _a.stroke, stroke = _f === void 0 ? "black" : _f, _g = _a.strokeWidth, strokeWidth = _g === void 0 ? 1 : _g, shapeRendering = _a.shapeRendering; return y("rect", { x: -width / 2, y: -height / 2, rx: cornerRadius, ry: cornerRadius, width: width, height: height, fill: fill, stroke: stroke || fill, "stroke-width": strokeWidth, "shape-rendering": shapeRendering }); }; var Shape = function (_a) { var _b = _a.shape, shape = _b === void 0 ? "circle" : _b, _c = _a.height, height = _c === void 0 ? 128 : _c, width = _a.width, fill = _a.fill, stroke = _a.stroke, _d = _a.strokeWidth, strokeWidth = _d === void 0 ? 1 : _d, shapeRendering = _a.shapeRendering, cornerRadius = _a.cornerRadius; switch (shape) { case "square": return y(Square, { radius: height / 2, fill: fill, stroke: stroke, strokeWidth: strokeWidth, shapeRendering: shapeRendering, cornerRadius: cornerRadius }); case "rectangle": return y(Rectangle, { width: width !== null && width !== void 0 ? width : height, height: height, fill: fill, stroke: stroke, strokeWidth: strokeWidth, shapeRendering: shapeRendering, cornerRadius: cornerRadius }); case "circle": default: return y(Circle, { radius: height / 2, fill: fill, stroke: stroke, strokeWidth: strokeWidth, shapeRendering: shapeRendering }); } }; var Icon = function (_a) { var _b = _a.shape, shape = _b === void 0 ? "circle" : _b, width = _a.width, _c = _a.height, height = _c === void 0 ? 32 : _c, fill = _a.fill, stroke = _a.stroke, _d = _a.strokeWidth, strokeWidth = _d === void 0 ? 0 : _d, _e = _a.imageUrl, imageUrl = _e === void 0 ? "" : _e, _f = _a.imageFontFamily, imageFontFamily = _f === void 0 ? "FontAwesome" : _f, _g = _a.imageChar, imageChar = _g === void 0 ? "" : _g, _h = _a.imageCharFill, imageCharFill = _h === void 0 ? common.Palette.textColor(fill) : _h, _j = _a.padding, padding = _j === void 0 ? height / 5 : _j, _k = _a.xOffset, xOffset = _k === void 0 ? 0 : _k, _l = _a.yOffset, yOffset = _l === void 0 ? 0 : _l, cornerRadius = _a.cornerRadius, shapeRendering = _a.shapeRendering; return y(k$1, null, y(Shape, { shape: shape, width: width, height: height, fill: fill, stroke: stroke, strokeWidth: strokeWidth, shapeRendering: shapeRendering, cornerRadius: cornerRadius }), imageUrl ? y(Image, { href: imageUrl, x: xOffset, y: yOffset, height: height - padding }) : y(ImageChar, { x: xOffset, y: yOffset, height: height - padding, fontFamily: imageFontFamily, char: imageChar, fill: imageCharFill, "font-weight": 400 })); }; var Icons = function (_a) { var _b = _a.icons, icons = _b === void 0 ? [] : _b; var IconComponents = icons.map(function (cat) { return y("g", { key: cat.id, id: cat.id }, y(Icon, __assign({}, cat))); }); return y(k$1, null, IconComponents); }; var TextLine = function (_a) { var text = _a.text, _b = _a.height, height = _b === void 0 ? 12 : _b, _c = _a.anchor, anchor = _c === void 0 ? "middle" : _c, _d = _a.baseline, baseline = _d === void 0 ? "middle" : _d, _e = _a.fontFamily, fontFamily = _e === void 0 ? "Verdana" : _e, _f = _a.fill, fill = _f === void 0 ? "black" : _f; return y("text", { "font-family": fontFamily, "font-size": "".concat(height, "px"), "text-anchor": anchor, "dominant-baseline": baseline, fill: fill }, text); }; var Text = function (_a) { var text = _a.text, _b = _a.height, height = _b === void 0 ? 12 : _b, _c = _a.fontFamily, fontFamily = _c === void 0 ? "Verdana" : _c, _d = _a.fill, fill = _d === void 0 ? "black" : _d, onSizeUpdate = _a.onSizeUpdate; var _e = h(0), totalWidth = _e[0], setTotalWidthUpdate = _e[1]; var _f = h(0), totalHeight = _f[0], setTotalHeightUpdate = _f[1]; p(function () { onSizeUpdate && onSizeUpdate({ width: totalWidth, height: totalHeight }); }, [totalWidth, totalHeight, onSizeUpdate]); var parts = F(function () { return text.split("\n"); }, [text]); var ts = F(function () { return common.Utility.textSize(parts, fontFamily, height); }, [fontFamily, height, parts]); setTotalWidthUpdate(ts.width); setTotalHeightUpdate(parts.length * (height + 2) - 2); var yOffset = -(totalHeight / 2) + (height / 2); var TextLines = F(function () { return parts.map(function (p, i) { return y("g", { key: i, transform: "translate(0 ".concat(yOffset + i * (height + 2), ")") }, y(TextLine, { text: p, height: height, fontFamily: fontFamily, fill: fill })); }); }, [fill, fontFamily, height, parts, yOffset]); return y(k$1, null, TextLines); }; var TextBox = function (_a) { var text = _a.text, _b = _a.height, height = _b === void 0 ? 12 : _b, _c = _a.fontFamily, fontFamily = _c === void 0 ? "Verdana" : _c, _d = _a.padding, padding = _d === void 0 ? 4 : _d, _e = _a.fill, fill = _e === void 0 ? "whitesmoke" : _e, _f = _a.stroke, stroke = _f === void 0 ? "lightgray" : _f, _g = _a.textFill, textFill = _g === void 0 ? "black" : _g, _h = _a.strokeWidth, strokeWidth = _h === void 0 ? 1 : _h, _j = _a.cornerRadius, cornerRadius = _j === void 0 ? 0 : _j, onSizeUpdate = _a.onSizeUpdate; var _k = h(0), textWidth = _k[0], setTextWidthUpdate = _k[1]; var _l = h(0), textHeight = _l[0], setTextHeightUpdate = _l[1]; p(function () { onSizeUpdate && onSizeUpdate({ width: textWidth, height: textHeight }); }, [textWidth, textHeight, onSizeUpdate]); var onTextSizeUpdate = T(function (size) { setTextWidthUpdate(size.width); setTextHeightUpdate(size.height); }, []); var w = textWidth + padding * 2 + strokeWidth; var h$1 = textHeight + padding * 2 + strokeWidth; var textOffsetY = Math.floor(height / 10); return y(k$1, null, y(Rectangle, { width: w, height: h$1, fill: fill, stroke: stroke, strokeWidth: strokeWidth, cornerRadius: cornerRadius }), y("g", { transform: "translate(0 ".concat(textOffsetY, ")") }, y(Text, { text: text, fontFamily: fontFamily, height: height, fill: textFill, onSizeUpdate: onTextSizeUpdate }))); }; var LabelledRect = function (_a) { var text = _a.text, _b = _a.height, height = _b === void 0 ? 12 : _b, _c = _a.width, width = _c === void 0 ? 12 : _c, _d = _a.fontFamily, fontFamily = _d === void 0 ? "Verdana" : _d, _e = _a.fontSize, fontSize = _e === void 0 ? 10 : _e, _f = _a.padding, padding = _f === void 0 ? 3 : _f, _g = _a.fill, fill = _g === void 0 ? "whitesmoke" : _g, _h = _a.stroke, stroke = _h === void 0 ? "lightgray" : _h, _j = _a.textFill, textFill = _j === void 0 ? "black" : _j, _k = _a.strokeWidth, strokeWidth = _k === void 0 ? 1 : _k, _l = _a.cornerRadius, cornerRadius = _l === void 0 ? 0 : _l; _a.onSizeUpdate; return y(k$1, null, y(Rectangle, { width: width, height: height, fill: fill, stroke: stroke, strokeWidth: strokeWidth, cornerRadius: cornerRadius }), y("g", { transform: "translate(".concat(-(width / 2) + padding, " ").concat(-(height / 2) + padding, ")") }, y(TextLine, { text: text, fontFamily: fontFamily, height: fontSize, fill: textFill, anchor: "start", baseline: "hanging" }))); }; var IconLabelledRect = function (_a) { var icon = _a.icon, iconFontFamily = _a.iconFontFamily, text = _a.text, _b = _a.height, height = _b === void 0 ? 12 : _b, _c = _a.width, width = _c === void 0 ? 12 : _c, _d = _a.fontFamily, fontFamily = _d === void 0 ? "Verdana" : _d, _e = _a.fontSize, fontSize = _e === void 0 ? 10 : _e, _f = _a.padding, padding = _f === void 0 ? 3 : _f, _g = _a.fill, fill = _g === void 0 ? "whitesmoke" : _g, _h = _a.stroke, stroke = _h === void 0 ? "lightgray" : _h, _j = _a.textFill, textFill = _j === void 0 ? "black" : _j, _k = _a.strokeWidth, strokeWidth = _k === void 0 ? 1 : _k, _l = _a.cornerRadius, cornerRadius = _l === void 0 ? 0 : _l; _a.onSizeUpdate; return y(k$1, null, y(Rectangle, { width: width, height: height, fill: fill, stroke: stroke, strokeWidth: strokeWidth, cornerRadius: cornerRadius }), y("g", { transform: "translate(".concat(-(width / 2) + padding, " ").concat(-(height / 2) + padding, ")") }, y(Icon, { shape: "square", imageFontFamily: iconFontFamily, imageChar: icon, height: height, fill: fill, imageCharFill: textFill })), y("g", { transform: "translate(".concat(-(width / 2) + (padding * 2) + height, " ").concat(-(height / 2) + padding, ")") }, y(TextLine, { text: text, fontFamily: fontFamily, height: fontSize, fill: textFill, anchor: "start", baseline: "hanging" }))); }; var Edge = function (_a) { var label = _a.label, labelPos = _a.labelPos, _b = _a.labelFill, labelFill = _b === void 0 ? "black" : _b, _c = _a.labelHeight, labelHeight = _c === void 0 ? 12 : _c, path = _a.path, stroke = _a.stroke, strokeWidth = _a.strokeWidth, strokeDasharray = _a.strokeDasharray; return y(k$1, null, y("path", { d: path, stroke: stroke, style: { strokeWidth: strokeWidth, strokeDasharray: strokeDasharray } }), label && labelPos && labelPos.length === 2 ? y("g", { transform: "translate(".concat(labelPos[0], " ").concat(labelPos[1], ")") }, y(Text, { text: label, fill: labelFill, height: labelHeight })) : undefined); }; function render(C, props, parent, replaceNode) { D(y(C, props), parent, replaceNode); } function svgRender(C, props, parent, replaceNode) { D(y("svg", null, y(C, props)), parent, replaceNode); } var HTMLAdapter = /** @class */ (function (_super) { __extends(HTMLAdapter, _super); function HTMLAdapter(_component) { var _this = _super.call(this) || this; _this._component = _component; _this._props = {}; return _this; } HTMLAdapter.prototype.props = function (_) { if (!arguments.length) return this._props; this._props = __assign(__assign({}, this._props), _); return this; }; HTMLAdapter.prototype.prop = function (_, value) { if (arguments.length === 1) return this._props[_]; this._props[_] = value; return this; }; HTMLAdapter.prototype.update = function (domNode, element) { _super.prototype.update.call(this, domNode, element); render(this._component, this._props, domNode); }; __decorate([ common.publish({}, "object", "Properties"), __metadata("design:type", Object) ], HTMLAdapter.prototype, "_props", void 0); return HTMLAdapter; }(common.HTMLWidget)); var SVGAdapter = /** @class */ (function (_super) { __extends(SVGAdapter, _super); function SVGAdapter(_component) { var _this = _super.call(this) || this; _this._component = _component; _this._props = {}; return _this; } SVGAdapter.prototype.props = function (_) { if (!arguments.length) return this._props; this._props = __assign(__assign({}, this._props), _); return this; }; SVGAdapter.prototype.prop = function (_, value) { if (arguments.length === 1) return this._props[_]; this._props[_] = value; return this; }; SVGAdapter.prototype.update = function (domNode, element) { _super.prototype.update.call(this, domNode, element); render(this._component, this._props, domNode); }; __decorate([ common.publish({}, "object", "Properties"), __metadata("design:type", Object) ], SVGAdapter.prototype, "_props", void 0); return SVGAdapter; }(common.SVGWidget)); var Annotations = function (_a) { var x = _a.x, y$1 = _a.y, _b = _a.annotationIDs, annotationIDs = _b === void 0 ? [] : _b, _c = _a.stepSize, stepSize = _c === void 0 ? -16 : _c; var IconComponents = annotationIDs.map(function (id, i) { return y("g", { key: id, transform: "translate(".concat(x + i * stepSize, " ").concat(y$1, ")") }, y("use", { href: "#" + id })); }); return y(k$1, null, IconComponents); }; var Vertex = function (_a) { var _b = _a.categoryID, categoryID = _b === void 0 ? "" : _b, _c = _a.text, text = _c === void 0 ? "" : _c, _d = _a.textHeight, textHeight = _d === void 0 ? 12 : _d, _e = _a.textPadding, textPadding = _e === void 0 ? 4 : _e, _f = _a.icon, icon = _f === void 0 ? {} : _f, _g = _a.annotationsHeight, annotationsHeight = _g === void 0 ? 12 : _g, _h = _a.annotationIDs, annotationIDs = _h === void 0 ? [] : _h, textFill = _a.textFill, textboxFill = _a.textboxFill, textboxStroke = _a.textboxStroke, textFontFamily = _a.textFontFamily, onSizeUpdate = _a.onSizeUpdate, _j = _a.showLabel, showLabel = _j === void 0 ? true : _j, _k = _a.scale, scale = _k === void 0 ? 1 : _k; var _l = h(0), textBoxWidth = _l[0], setTextBoxWidthUpdate = _l[1]; var _m = h(0), textBoxHeight = _m[0], setTextBoxHeightUpdate = _m[1]; p(function () { onSizeUpdate && onSizeUpdate({ width: 0, height: 0 }); }, [textBoxWidth, textBoxHeight, onSizeUpdate]); icon = __assign({ imageChar: "fa-question", height: 32, fill: "transparent" }, icon); var width = textBoxWidth; width += 4; var offsetY = -(icon.height * 2 / 6 + textHeight + 8) / 2; var textboxOffsetY = icon.height / 3 + textBoxHeight / 2 + textPadding; var annotationOffsetY = icon.height / 3 + textBoxHeight + textPadding + annotationsHeight / 3; if (!showLabel) { offsetY += (textHeight + 8) / 2; annotationOffsetY -= textBoxHeight + textPadding; } var onTextBoxSizeUpdate = T(function (size) { setTextBoxWidthUpdate(size.width); setTextBoxHeightUpdate(size.height); }, []); var label = showLabel ? y("g", { transform: "translate(0 ".concat(textboxOffsetY, ")") }, y(TextBox, { text: text, height: textHeight, padding: textPadding, onSizeUpdate: onTextBoxSizeUpdate, textFill: textFill, fill: textboxFill, stroke: textboxStroke, fontFamily: textFontFamily })) : undefined; return categoryID ? y("g", { transform: "translate(0 ".concat(offsetY, ") scale(").concat(scale, ")") }, y("use", { href: "#" + categoryID }), label, y(Annotations, { x: width / 2, y: annotationOffsetY, annotationIDs: annotationIDs })) : y("g", { transform: "translate(0 ".concat(offsetY, ") scale(").concat(scale, ")") }, y(Icon, __assign({}, icon)), label); }; var Vertex2 = function (_a) { var _b = _a.categoryID, categoryID = _b === void 0 ? "" : _b, _c = _a.text, text = _c === void 0 ? "" : _c, _d = _a.textHeight, textHeight = _d === void 0 ? 12 : _d, _e = _a.textPadding, textPadding = _e === void 0 ? 4 : _e, _f = _a.icon, icon = _f === void 0 ? {} : _f, _g = _a.textFill, textFill = _g === void 0 ? "black" : _g, _h = _a.textboxFill, textboxFill = _h === void 0 ? "white" : _h, _j = _a.textboxStroke, textboxStroke = _j === void 0 ? "black" : _j, textFontFamily = _a.textFontFamily, _k = _a.annotationsHeight, annotationsHeight = _k === void 0 ? 12 : _k, _l = _a.annotationIDs, annotationIDs = _l === void 0 ? [] : _l; icon = __assign({ imageChar: "fa-question", imageCharFill: "white", height: 32, fill: "black", shape: "square" }, icon); var textBoxHeight = textHeight + textPadding * 2; var width = F(function () { return common.Utility.textSize(text, textFontFamily, textHeight, false); }, [text, textFontFamily, textHeight]).width; var stepSize = annotationsHeight; var textboxStrokeWidth = 1; var halfTextboxHeight = textBoxHeight / 2; var offsetX = 0; var offsetY = -(icon.height * 2 / 6 + textHeight + 8) / 2; var iconOffsetX = -icon.height / 2; var iconOffsetY = 0; var textboxOffsetX = Math.ceil((width / 2) + textPadding); var textboxOffsetY = halfTextboxHeight - (icon.height / 2); var annotationOffsetX = stepSize / 2; var annotationOffsetY = halfTextboxHeight; return categoryID ? y("g", { transform: "translate(".concat(offsetX, " ").concat(offsetY, ")") }, y("g", { transform: "translate(".concat(iconOffsetX, " ").concat(iconOffsetY, ")") }, y("use", { href: "#" + categoryID })), y("g", { transform: "translate(".concat(textboxOffsetX, " ").concat(textboxOffsetY, ")") }, y(TextBox, { text: text, height: textHeight, padding: textPadding, strokeWidth: textboxStrokeWidth, stroke: textboxStroke, fill: textboxFill, textFill: textFill, fontFamily: textFontFamily })), y(Annotations, { x: annotationOffsetX, y: annotationOffsetY, annotationIDs: annotationIDs, stepSize: stepSize })) : y(k$1, null, y("g", { transform: "translate(".concat(iconOffsetX, " ").concat(iconOffsetY, ")scale(1.0002)") }, y(Icon, __assign({}, icon, { shape: "square" }))), y("g", { transform: "translate(".concat(textboxOffsetX, " ").concat(textboxOffsetY, ")scale(1.0002)") }, y(TextBox, { text: text, height: textHeight, padding: textPadding, stroke: textboxStroke, fill: textboxFill }))); }; var Vertex3 = function (_a) { var _b = _a.text, text = _b === void 0 ? "" : _b, _c = _a.textHeight, textHeight = _c === void 0 ? 10 : _c, _d = _a.textPadding, textPadding = _d === void 0 ? 4 : _d, _e = _a.textFill, textFill = _e === void 0 ? "#287EC4" : _e, _f = _a.textboxFill, textboxFill = _f === void 0 ? "white" : _f, _g = _a.textboxStroke, textboxStroke = _g === void 0 ? "#CCCCCC" : _g, _h = _a.textboxStrokeWidth, textboxStrokeWidth = _h === void 0 ? 1 : _h, _j = _a.textFontFamily, textFontFamily = _j === void 0 ? "Verdana" : _j, _k = _a.annotationGutter, annotationGutter = _k === void 0 ? 2 : _k, _l = _a.annotations, annotations = _l === void 0 ? [] : _l, _m = _a.cornerRadius, cornerRadius = _m === void 0 ? 3 : _m, _o = _a.icon, icon = _o === void 0 ? {} : _o, _p = _a.subText, subText = _p === void 0 ? { text: "" } : _p, _q = _a.showLabel, showLabel = _q === void 0 ? true : _q, _r = _a.noLabelRadius, noLabelRadius = _r === void 0 ? 5 : _r, expansionIcon = _a.expansionIcon, _s = _a.scale, scale = _s === void 0 ? 1 : _s; icon = __assign({ height: 50, imageChar: "?", imageFontFamily: "FontAwesome", imageCharFill: "#555555", fill: "transparent", strokeWidth: 0 }, icon); subText = __assign({ text: "", fill: "white", textFill: "#555555" }, subText); expansionIcon = expansionIcon ? __assign({ height: 16, shape: "circle", padding: 6, imageChar: "?", imageFontFamily: "FontAwesome", imageCharFill: "black", fill: "whitesmoke", stroke: "whitesmoke", strokeWidth: 0 }, expansionIcon) : undefined; var fullAnnotationWidth = 0; var annoOffsetY = 0; var labelWidth = F(function () { return common.Utility.textSize(text, textFontFamily, textHeight, false).width; }, [text, textFontFamily, textHeight]); var labelShapeWidth = 0; if (text !== "") { labelShapeWidth = labelWidth + (textPadding * 2) + (textboxStrokeWidth * 2); } fullAnnotationWidth += labelShapeWidth + annotationGutter; var textOffsetX = fullAnnotationWidth - (labelShapeWidth / 2); var textShapeHeight = textHeight + (textPadding * 2) + (textboxStrokeWidth * 2); var annotationArr = []; annotations.forEach(function (anno, idx) { var annoText = anno.imageChar; var annoShapeWidth = textShapeHeight; fullAnnotationWidth += annoShapeWidth + annotationGutter; var annoOffsetX = fullAnnotationWidth - (annoShapeWidth / 2); annotationArr.push(y("g", { key: idx, class: "vertex3-anno", "data-click": "annotation", "data-click-data": JSON.stringify(anno), transform: "translate(".concat(annoOffsetX, " ").concat(annoOffsetY, ")") }, y(Icon, __assign({}, anno, { shape: "square", height: textShapeHeight, imageChar: annoText, imageFontFamily: anno.imageFontFamily, cornerRadius: cornerRadius, strokeWidth: 0 })))); }); if (annotations.length > 0) { fullAnnotationWidth += annotationGutter * (annotations.length - 1); } var textElement = y("g", { "data-click": "text", transform: "translate(".concat(textOffsetX, " ").concat(annoOffsetY, ")") }, !showLabel || text === "" ? y("circle", { r: noLabelRadius, stroke: textboxStroke, fill: textFill }) : y(TextBox, { text: text, height: textHeight, padding: textPadding, strokeWidth: textboxStrokeWidth, stroke: textboxStroke, fill: textboxFill, textFill: textFill, fontFamily: textFontFamily, cornerRadius: cornerRadius })); var iconHeight = icon.height || 20; var iconStrokeWidth = icon.strokeWidth || 0; var iconOffsetX = 0; var iconOffsetY = 0; var subTextOffsetX = 0; var subTextOffsetY = textShapeHeight + (annotationGutter * 2); if (text !== "" || annotationArr.length > 0) { iconOffsetY = -(iconHeight / 2) - (iconStrokeWidth) - (textShapeHeight / 2) - (annotationGutter * 2); } else if (subText.text !== "") { subTextOffsetY = (iconHeight / 2) + iconStrokeWidth + (annotationGutter * 2); } var subtextElement = subText.text === "" ? null : y("g", { "data-click": "subtext", transform: "translate(".concat(subTextOffsetX, " ").concat(subTextOffsetY, ")") }, y(TextBox, __assign({ fill: subText.fill || "#FFFFFF", textFill: subText.textFill || textFill }, subText, { height: textHeight, padding: textPadding, strokeWidth: 0, stroke: textboxStroke, fontFamily: textFontFamily, cornerRadius: cornerRadius }))); return y("g", { transform: "scale(".concat(scale, ")") }, y("g", { "data-click": "icon", transform: "translate(".concat(iconOffsetX, " ").concat(iconOffsetY, ")") }, y(Icon, __assign({}, icon)), expansionIcon && y("g", { "data-click": "expanded-icon", "data-click-data": JSON.stringify(expansionIcon), transform: "translate(".concat((icon.height + iconStrokeWidth) / 2 - expansionIcon.height / 2, " ").concat(-(icon.height + iconStrokeWidth) / 2 + expansionIcon.height / 2, ")") }, y(Icon, __assign({}, expansionIcon)))), y("g", { transform: "translate(".concat(-fullAnnotationWidth / 2, " ").concat(annoOffsetY, ")") }, textElement, annotationArr), subtextElement); }; var CentroidVertex3 = function (_a) { var id = _a.id, _b = _a.categoryID, categoryID = _b === void 0 ? "" : _b, _c = _a.text, text = _c === void 0 ? "" : _c, _d = _a.textHeight, textHeight = _d === void 0 ? 12 : _d, _e = _a.textPadding, textPadding = _e === void 0 ? 10 : _e, _f = _a.textFill, textFill = _f === void 0 ? "#287EC4" : _f, _g = _a.textboxFill, textboxFill = _g === void 0 ? "white" : _g, _h = _a.textboxStroke, textboxStroke = _h === void 0 ? "#CCCCCC" : _h, _j = _a.textboxStrokeWidth, textboxStrokeWidth = _j === void 0 ? 1 : _j, _k = _a.textFontFamily, textFontFamily = _k === void 0 ? "Verdana" : _k, _l = _a.annotationGutter, annotationGutter = _l === void 0 ? 2 : _l, _m = _a.annotations, annotations = _m === void 0 ? [] : _m, cornerRadius = _a.cornerRadius, _o = _a.icon, icon = _o === void 0 ? {} : _o, _p = _a.subText, subText = _p === void 0 ? {} : _p, expansionIcon = _a.expansionIcon, _q = _a.scale, scale = _q === void 0 ? 1 : _q; icon = __assign({ height: 91, padding: 40, imageCharFill: "#555555", imageFontFamily: "FontAwesome", fill: "#FFCC33", stroke: "#DFDFDF", imageChar: "?", strokeWidth: 4, yOffset: -15 }, icon); subText = __assign({ text: "", fill: "transparent", textFill: "#555555" }, subText); var props = { id: id, categoryID: categoryID, text: text, textHeight: textHeight, textPadding: textPadding, textFill: textFill, textboxFill: textboxFill, textboxStroke: textboxStroke, textboxStrokeWidth: textboxStrokeWidth, textFontFamily: textFontFamily, annotationGutter: annotationGutter, annotations: annotations, cornerRadius: cornerRadius, icon: icon, subText: subText, expansionIcon: expansionIcon, scale: scale }; return y(Vertex3, __assign({}, props, { icon: icon, subText: subText })); }; var Vertex4 = function (_a) { _a.categoryID; var _c = _a.text, text = _c === void 0 ? "" : _c, _d = _a.textHeight, textHeight = _d === void 0 ? 10 : _d, _e = _a.textPadding, textPadding = _e === void 0 ? 4 : _e, _f = _a.textFill, textFill = _f === void 0 ? "#287EC4" : _f, _g = _a.textboxFill, textboxFill = _g === void 0 ? "white" : _g, _h = _a.textboxStroke, textboxStroke = _h === void 0 ? "#CCCCCC" : _h, _j = _a.textboxStrokeWidth, textboxStrokeWidth = _j === void 0 ? 1 : _j, _k = _a.textFontFamily, textFontFamily = _k === void 0 ? "Verdana" : _k, _l = _a.annotationGutter, annotationGutter = _l === void 0 ? 2 : _l, _m = _a.annotations, annotations = _m === void 0 ? [] : _m, _o = _a.iconAnnotations, iconAnnotations = _o === void 0 ? [] : _o, _p = _a.cornerRadius, cornerRadius = _p === void 0 ? 3 : _p, _q = _a.icon, icon = _q === void 0 ? {} : _q, _r = _a.subText, subText = _r === void 0 ? {} : _r, _s = _a.showLabel, showLabel = _s === void 0 ? true : _s, _t = _a.noLabelRadius, noLabelRadius = _t === void 0 ? 5 : _t, _u = _a.iconBorderWidth, iconBorderWidth = _u === void 0 ? 1 : _u, _v = _a.iconBorderColor, iconBorderColor = _v === void 0 ? "#333" : _v, _w = _a.iconBackgroundColor, iconBackgroundColor = _w === void 0 ? "#fff" : _w, _x = _a.iconFontColor, iconFontColor = _x === void 0 ? "#000" : _x, _y = _a.iconFontSize, iconFontSize = _y === void 0 ? 20 : _y, _z = _a.iconFontFamily, iconFontFamily = _z === void 0 ? "FontAwesome" : _z, _0 = _a.shapeOffsetX, shapeOffsetX = _0 === void 0 ? 0 : _0, _1 = _a.shapeOffsetY, shapeOffsetY = _1 === void 0 ? 0 : _1, _2 = _a.iconOffsetX, iconOffsetX = _2 === void 0 ? 0 : _2, _3 = _a.iconOffsetY, iconOffsetY = _3 === void 0 ? 0 : _3, _4 = _a.iconPadding, iconPadding = _4 === void 0 ? 4 : _4, _5 = _a.iconText, iconText = _5 === void 0 ? "?" : _5, _6 = _a.shapeRendering, shapeRendering = _6 === void 0 ? "auto" : _6; icon = __assign({ height: 50, imageChar: "?", imageFontFamily: "FontAwesome", imageCharFill: "#555555", fill: "transparent", strokeWidth: 0 }, icon); subText = __assign({ text: "", fill: "white", textFill: "#555555" }, subText); var annoOffsetY = 0; var labelWidth = F(function () { return common.Utility.textSize(text, textFontFamily, textHeight, false).width; }, [text, textFontFamily, textHeight]); var labelShapeWidth = 0; if (text !== "") { labelShapeWidth = labelWidth + (textPadding * 2) + (textboxStrokeWidth * 2); } var fullAnnotationWidth = labelShapeWidth + annotationGutter; var textOffsetX = fullAnnotationWidth - (labelShapeWidth / 2); var textShapeHeight = textHeight + (annotationGutter * 2) + (textboxStrokeWidth * 2); var annoWidthArr = annotations.map(function (anno, i) { return common.Utility.textSize(anno.imageChar, anno.imageFontFamily, anno.height, false).width; }); var annotationArr = []; var _labelAnnoOffsetX = fullAnnotationWidth; annotations.forEach(function (anno, i) { var _a; var annoText = anno.imageChar; var annoTextHeight = (_a = anno.height) !== null && _a !== void 0 ? _a : textShapeHeight; _labelAnnoOffsetX += annoWidthArr[i] + annotationGutter; var annoOffsetX = _labelAnnoOffsetX - (annoWidthArr[i] / 2); annotationArr.push(y("g", { key: i, class: "vertex3-anno", "data-click": "annotation", "data-click-data": JSON.stringify(anno), transform: "translate(".concat(annoOffsetX, " ").concat(annoOffsetY, ")") }, y(Icon, __assign({}, anno, { shape: "rectangle", width: annoWidthArr[i], height: annoTextHeight, imageChar: annoText, imageFontFamily: anno.imageFontFamily, cornerRadius: cornerRadius, strokeWidth: 0 })))); }); if (annotations.length > 0) { fullAnnotationWidth += annotationGutter * (annotations.length - 1); } var iconAnnotationArr = []; iconAnnotations.forEach(function (anno, i) { var _a; var x = anno.shapeOffsetX; var y$1 = anno.shapeOffsetY; iconAnnotationArr.push(y("g", { key: i, class: "vertex3-iconAnno", "data-click": "icon-annotation", "data-click-data": JSON.stringify(anno), transform: "translate(".concat(x, " ").concat(y$1, ")") }, y(Icon, __assign({}, anno, { shape: (_a = anno.shape) !== null && _a !== void 0 ? _a : "square", imageChar: anno.imageChar, imageFontFamily: anno.imageFontFamily, cornerRadius: cornerRadius, stroke: anno.stroke, strokeWidth: anno.strokeWidth })))); }); var textElement = y("g", { "data-click": "text", transform: "translate(".concat(textOffsetX, " ").concat(annoOffsetY, ")") }, !showLabel || text === "" ? y("circle", { r: noLabelRadius, stroke: textboxStroke, fill: textFill }) : y(TextBox, { text: text, height: textHeight, padding: textPadding, strokeWidth: textboxStrokeWidth, stroke: textboxStroke, fill: textboxFill, textFill: textFill, fontFamily: textFontFamily, cornerRadius: cornerRadius })); var subTextOffsetX = 0; var subTextOffsetY = textShapeHeight + (annotationGutter * 2); var subtextElement = subText.text === "" ? null : y("g", { "data-click": "subtext", transform: "translate(".concat(subTextOffsetX, " ").concat(subTextOffsetY, ")") }, y(TextBox, __assign({ fill: subText.fill || "#FFFFFF", textFill: subText.textFill || textFill }, subText, { height: textHeight, padding: textPadding, strokeWidth: 0, stroke: textboxStroke, fontFamily: textFontFamily, cornerRadius: cornerRadius }))); return y("g", null, y("g", { "data-click": "icon", transform: "translate(".concat(shapeOffsetX, " ").concat(shapeOffsetY, ")") }, y(Icon, __assign({}, icon, { strokeWidth: iconBorderWidth, shape: "circle", height: iconFontSize, fill: iconBackgroundColor, stroke: iconBorderColor, imageFontFamily: iconFontFamily, imageChar: iconText, imageCharFill: iconFontColor, padding: iconPadding, xOffset: iconOffsetX, yOffset: iconOffsetY, cornerRadius: cornerRadius, shapeRendering: shapeRend