`}firstUpdated(e){super.firstUpdated(e),this.headerElement=this.blueprint.querySelector(".ueb-viewport-header"),this.overlayElement=this.blueprint.querySelector(".ueb-viewport-overlay"),this.viewportElement=this.blueprint.querySelector(".ueb-viewport-body"),this.selectorElement=this.blueprint.querySelector("ueb-selector"),this.gridElement=this.viewportElement.querySelector(".ueb-grid"),this.linksContainerElement=this.blueprint.querySelector("[data-links]"),this.linksContainerElement.append(...this.blueprint.getLinks()),this.nodesContainerElement=this.blueprint.querySelector("[data-nodes]"),this.nodesContainerElement.append(...this.blueprint.getNodes()),this.viewportElement.scroll(ae.expandGridSize,ae.expandGridSize)}willUpdate(e){super.willUpdate(e),this.headerElement&&e.has("zoom")&&(this.headerElement.classList.contains("ueb-zoom-changed")&&(this.headerElement.classList.remove("ueb-zoom-changed"),this.headerElement.offsetWidth),this.headerElement.classList.add("ueb-zoom-changed"),this.headerElement.addEventListener("animationend",this.#vt,{once:!0}))}updated(e){if(super.updated(e),(e.has("scrollX")||e.has("scrollY"))&&this.viewportElement.scroll(this.blueprint.scrollX,this.blueprint.scrollY),e.has("zoom")){this.blueprint.style.setProperty("--ueb-scale",this.blueprint.getScale());const t=e.get("zoom"),i=Math.min(t,this.blueprint.zoom),s=Math.max(t,this.blueprint.zoom),r=oe.range(i,s),n=e=>`ueb-zoom-${e}`;te<0)).map(n)),this.blueprint.classList.add(...r.filter((e=>e>0)).map(n))):(this.blueprint.classList.remove(...r.filter((e=>e>0)).map(n)),this.blueprint.classList.add(...r.filter((e=>e<0)).map(n)))}}getCommentNodes(e=!1){return this.blueprint.querySelectorAll(`ueb-node[data-type="${ae.paths.comment}"]${e?'[data-selected="true"]':""}, ueb-node[data-type="${ae.paths.materialGraphNodeComment}"]${e?'[data-selected="true"]':""}`)}getPin(e){return this.blueprint.querySelector(`ueb-node[data-title="${e.objectName}"] ueb-pin[data-id="${e.pinGuid}"]`)}getCopyInputObject(){return this.#gt}getPasteInputObject(){return this.#bt}getZoomInputObject(){return this.#lt}isPointVisible(e,t){return!1}gridTopVisibilityBoundary(){return this.blueprint.scaleCorrect(this.blueprint.scrollY)-this.blueprint.translateY}gridRightVisibilityBoundary(){return this.gridLeftVisibilityBoundary()+this.blueprint.scaleCorrect(this.viewportSize[0])}gridBottomVisibilityBoundary(){return this.gridTopVisibilityBoundary()+this.blueprint.scaleCorrect(this.viewportSize[1])}gridLeftVisibilityBoundary(){return this.blueprint.scaleCorrect(this.blueprint.scrollX)-this.blueprint.translateX}centerViewport(e=0,t=0,i=!0){const s=this.gridLeftVisibilityBoundary()+this.blueprint.scaleCorrect(this.viewportSize[0]/2),r=this.gridTopVisibilityBoundary()+this.blueprint.scaleCorrect(this.viewportSize[1]/2);this.blueprint.scrollDelta(this.blueprint.scaleCorrectReverse(e-s),this.blueprint.scaleCorrectReverse(t-r),i)}centerContentInViewport(e=!0){let t=0,i=0,s=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER,a=Number.MIN_SAFE_INTEGER;const o=this.blueprint.getNodes();for(const e of o)t+=e.leftBoundary()+e.rightBoundary(),i+=e.topBoundary()+e.bottomBoundary(),s=Math.min(s,e.leftBoundary()),r=Math.max(r,e.rightBoundary()),n=Math.min(n,e.topBoundary()),a=Math.max(a,e.bottomBoundary());t=Math.round(r-s<=this.viewportSize[0]?(r+s)/2:t/(2*o.length)),i=Math.round(a-n<=this.viewportSize[1]?(a+n)/2:i/(2*o.length)),this.centerViewport(t,i,e)}}class ki extends le{static properties={selecting:{type:Boolean,attribute:"data-selecting",reflect:!0,converter:Le.booleanConverter},scrolling:{type:Boolean,attribute:"data-scrolling",reflect:!0,converter:Le.booleanConverter},focused:{type:Boolean,attribute:"data-focused",reflect:!0,converter:Le.booleanConverter},zoom:{type:Number,attribute:"data-zoom",reflect:!0},scrollX:{type:Number,attribute:!1},scrollY:{type:Number,attribute:!1},additionalX:{type:Number,attribute:!1},additionalY:{type:Number,attribute:!1},translateX:{type:Number,attribute:!1},translateY:{type:Number,attribute:!1}};static nodeBoundariesSupplier=e=>({primaryInf:e.leftBoundary(!0),primarySup:e.rightBoundary(!0),secondaryInf:e.topBoundary(!0),secondarySup:e.bottomBoundary(!0)});static nodeSelectToggleFunction=(e,t)=>{e.setSelected(t)};#ft=0;#yt=0;nodes=[];links=[];nodesNames=new Map;mousePosition=[0,0];waitingExpandUpdate=!1;constructor(){super(),this.selecting=!1,this.scrolling=!1,this.focused=!1,this.zoom=0,this.scrollX=ae.expandGridSize,this.scrollY=ae.expandGridSize,this.translateX=ae.expandGridSize,this.translateY=ae.expandGridSize,super.initialize(new mi,new Pi)}initialize(){}getGridDOMElement(){return this.template.gridElement}getScroll(){return[this.scrollX,this.scrollY]}setScroll(e,t){this.scrollX=e,this.scrollY=t}scrollDelta(e=0,t=0,i=!1,s=ae.smoothScrollTime){if(i){let i=[0,0];this.#ft&&cancelAnimationFrame(this.#ft),this.#yt&&cancelAnimationFrame(this.#yt),oe.animate(0,e,s,(e=>{this.scrollDelta(e-i[0],0,!1),i[0]=e}),(e=>this.#ft=e)),oe.animate(0,t,s,(e=>{this.scrollDelta(0,e-i[1],!1),i[1]=e}),(e=>this.#yt=e))}else{const i=[2*ae.expandGridSize,2*ae.expandGridSize];let s=this.getScroll(),r=[s[0]+e,s[1]+t],n=[0,0];for(let e=0;e<2;++e)r[e]i[e]-ae.gridExpandThreshold*ae.expandGridSize&&(n[e]=1);0==n[0]&&0==n[1]||this.seamlessExpand(n[0],n[1]),s=this.getScroll(),r=[s[0]+e,s[1]+t],this.setScroll(r[0],r[1])}}scrollCenter(e=!1){const t=this.getScroll(),i=[this.translateX-t[0],this.translateY-t[1]],s=this.getViewportSize().map((e=>e/2)),r=[i[0]-s[0],i[1]-s[1]];this.scrollDelta(r[0],r[1],e)}getViewportSize(){return[this.template.viewportElement.clientWidth,this.template.viewportElement.clientHeight]}getScrollMax(){return[this.template.viewportElement.scrollWidth-this.template.viewportElement.clientWidth,this.template.viewportElement.scrollHeight-this.template.viewportElement.clientHeight]}snapToGrid(e,t){return oe.snapToGrid(e,t,ae.gridSize)}seamlessExpand(e,t){e=Math.round(e),t=Math.round(t);let i=this.getScale();[e,t]=[-e*ae.expandGridSize,-t*ae.expandGridSize],0!=e&&(this.scrollX+=e,e/=i),0!=t&&(this.scrollY+=t,t/=i),this.translateX+=e,this.translateY+=t}progressiveSnapToGrid(e){return ae.expandGridSize*Math.round(e/ae.expandGridSize+.5*Math.sign(e))}getZoom(){return this.zoom}setZoom(e,t){if((e=oe.clamp(e,ae.minZoom,ae.maxZoom))==this.zoom)return;let i=this.getScale();if(this.zoom=e,t){t[0]+=this.translateX,t[1]+=this.translateY;let e=this.getScale()/i,s=[e*t[0],e*t[1]];this.scrollDelta((s[0]-t[0])*i,(s[1]-t[1])*i)}}getScale(){return ae.scale[this.getZoom()]}scaleCorrect(e){return e/this.getScale()}scaleCorrectReverse(e){return e*this.getScale()}compensateTranslation(e,t){return[e-=this.translateX,t-=this.translateY]}getNodes(e=!1){let t=this.nodes;return e&&(t=t.filter((e=>e.selected))),t}getCommentNodes(e=!1){let t=[...this.template.getCommentNodes(e)];return 0===t.length&&(t=this.nodes.filter((t=>t.getType()===ae.paths.comment&&(!e||t.selected)))),t}getPin(e){let t=this.template.getPin(e);return t&&t.nodeElement.getNodeName()==e.objectName.toString()||(t=[...this.nodes.find((t=>e.objectName.toString()==t.getNodeName()))?.getPinElements()??[]].find((t=>e.pinGuid.toString()==t.getPinId().toString()))),t}getLinks(e=null,t=null){if(null==e!=(null==t)){const i=e??t;return this.links.filter((e=>e.origin==i||e.target==i))}return null!=e&&null!=t?this.links.filter((i=>i.origin==e&&i.target==t||i.origin==t&&i.target==e)):this.links}getLink(e,t,i=!1){return this.links.find((s=>s.origin==e&&s.target==t||!i&&s.origin==t&&s.target==e))}selectAll(){this.getNodes().forEach((e=>ki.nodeSelectToggleFunction(e,!0)))}unselectAll(){this.getNodes().forEach((e=>ki.nodeSelectToggleFunction(e,!1)))}getSerializedText(){const e=this.blueprint.getNodes(!0).map((e=>e.entity));let t=!1,i=e.filter((e=>(t||=e.exported,!e.exported))).reduce(((e,t)=>e+t.serialize()),"");if(t){i=new gi(this.blueprint.entity,e).serialize()+i}return i}addGraphElement(...e){const t=e=>{const i=e.currentTarget;i.removeEventListener(ae.removeEventName,t);const[s,r]=i instanceof di?[this.nodes,i.entity]:i instanceof Gt?[this.links]:null,n=s?.indexOf(i);if(n>=0){const e=s.pop();ne.entity.exported=!0));continue}const s=this.entity.getHomonymObjectEntity(i.entity);if(s){const t=this.entity.takeFreeName(e);s.Name=new s.Name.constructor(t)}this.nodes.push(i),this.entity.addObjectEntity(i.entity),i.addEventListener(ae.removeEventName,t),this.template.nodesContainerElement?.appendChild(i)}else i instanceof Gt&&!this.links.includes(i)&&(this.links.push(i),i.addEventListener(ae.removeEventName,t),this.template.linksContainerElement&&!this.template.linksContainerElement.contains(i)&&this.template.linksContainerElement.appendChild(i));e.filter((e=>e instanceof di)).forEach((t=>t.sanitizeLinks(e))),e.filter((e=>e instanceof di&&e.getType()==ae.paths.comment)).forEach((e=>e.updateComplete.then((()=>e.template.manageNodesBind()))))}removeGraphElement(...e){for(let t of e){if(t.closest("ueb-blueprint")!==this)return;t.remove()}}setFocused(e=!0){if(this.focused==e)return;let t=new CustomEvent(e?ae.focusEventName.begin:ae.focusEventName.end);this.focused=e,this.focused||this.unselectAll(),this.dispatchEvent(t)}acknowledgeEditText(e){const t=new CustomEvent(e?ae.editTextEventName.begin:ae.editTextEventName.end);this.dispatchEvent(t)}}customElements.define("ueb-blueprint",ki);class Li extends Ut{#wt;get locationChangeCallback(){return this.#wt}set locationChangeCallback(e){this.#wt=e}movementSpace;movementSpaceSize=[0,0];firstUpdated(e){super.firstUpdated(e),this.movementSpace=this.element.parentElement}setup(){super.setup();const e=this.movementSpace.getBoundingClientRect();this.movementSpaceSize=[e.width,e.height]}createDraggableObject(){return new _t(this.element,this.blueprint,{draggableElement:this.movementSpace,ignoreTranslateCompensate:!0,moveEverywhere:!0,movementSpace:this.movementSpace,repositionOnClick:!0,stepSize:1})}adjustLocation(e,t){return this.locationChangeCallback?.(e,t),[e,t]}}class Ai extends Li{adjustLocation(e,t){const i=Math.round(this.movementSpaceSize[0]/2);e-=i,t=-(t-i);let[s,r]=oe.getPolarCoordinates(e,t);return s=Math.min(s,i),[e,t]=oe.getCartesianCoordinates(s,r),this.locationChangeCallback?.(e/i,t/i),[e=Math.round(e+i),t=Math.round(-t+i)]}}class Mi extends Ht{windowElement;setup(){super.setup(),this.windowElement=this.closest("ueb-window")}setLocation(e,t){super.setLocation(...this.template.adjustLocation(e,t))}}class Ii extends Mi{constructor(){super(),super.initialize({},new Ai)}static newObject(){return new Ii}initialize(){}}class Ti extends Li{adjustLocation(e,t){return e=oe.clamp(e,0,this.movementSpaceSize[0]),t=oe.clamp(t,0,this.movementSpaceSize[1]),this.locationChangeCallback?.(e/this.movementSpaceSize[0],1-t/this.movementSpaceSize[1]),[e,t]}}class Oi extends Mi{constructor(){super(),super.initialize({},new Ti)}static newObject(){return new Oi}initialize(){}}class Di extends zt{constructor(e,t,i={}){i.consumeEvent=!0,super(e,t,i)}}class $i extends $t{#St;#Et;#Ct=e=>this.element.selectedOption=e.target.selectedOptions[0].value;render(){return z` `}firstUpdated(e){super.firstUpdated(e),this.#St=this.element.querySelector("select:first-child"),this.#Et=this.element.querySelector("select:last-child");const t=new Event("input",{bubbles:!0});this.#St.dispatchEvent(t)}updated(e){super.updated(e);const t=this.#Et.getBoundingClientRect();this.element.style.setProperty("--ueb-dropdown-width",t.width+"px")}createInputObjects(){return[...super.createInputObjects(),new Di(this.element,this.blueprint)]}setSelectedValue(e){this.element.querySelector(`option[value="${e}"]`).defaultSelected=!0}getSelectedValue(){return this.#St.value}}class Vi extends le{static properties={...super.properties,options:{type:Object},selectedOption:{type:String}};constructor(){super(),super.initialize({},new $i),this.options=[],this.selectedOption=""}static newObject(e){return new Vi}initialize(){}getValue(){return this.template.getSelectedValue()}}class Bi extends $t{#Nt=()=>{this.blueprint.acknowledgeEditText(!0),this.element.selectOnFocus&&getSelection().selectAllChildren(this.element)};#xt=()=>{this.blueprint.acknowledgeEditText(!1),getSelection().removeAllRanges()};#Pt=e=>e.target.querySelectorAll("br").forEach((e=>e.remove()));#kt=e=>{"Enter"!=e.code||e.shiftKey||e.target.blur()};initialize(e){super.initialize(e),this.element.classList.add("ueb-pin-input-content"),this.element.setAttribute("role","textbox"),this.element.contentEditable="true"}firstUpdated(e){super.firstUpdated(e);const t=new Event("input",{bubbles:!0});this.element.dispatchEvent(t)}createInputObjects(){return[...super.createInputObjects(),new Di(this.element,this.blueprint)]}setup(){super.setup(),this.element.addEventListener("focus",this.#Nt),this.element.addEventListener("focusout",this.#xt),this.element.singleLine&&this.element.addEventListener("input",this.#Pt),this.element.blurOnEnter&&this.element.addEventListener("keydown",this.#kt)}cleanup(){super.cleanup(),this.element.removeEventListener("focus",this.#Nt),this.element.removeEventListener("focusout",this.#xt),this.element.removeEventListener("input",this.#Pt),this.element.removeEventListener("keydown",this.#kt)}}class Ri extends le{static properties={...super.properties,singleLine:{type:Boolean,attribute:"data-single-line",converter:Le.booleanConverter,reflect:!0},selectOnFocus:{type:Boolean,attribute:"data-select-focus",converter:Le.booleanConverter,reflect:!0},blurOnEnter:{type:Boolean,attribute:"data-blur-enter",converter:Le.booleanConverter,reflect:!0}};constructor(){super(),this.singleLine=!1,this.selectOnFocus=!0,this.blurOnEnter=!0,super.initialize({},new Bi)}static newObject(){return new Ri}initialize(){}}class Gi extends ii{#Lt;#At=()=>{const e=this.element.getDefaultValue(!0);e.value=this.#Lt.checked,this.element.setDefaultValue(e)};firstUpdated(e){super.firstUpdated(e),this.#Lt=this.element.querySelector(".ueb-pin-input")}setup(){super.setup(),this.#Lt?.addEventListener("change",this.#At)}cleanup(){super.cleanup(),this.#Lt?.removeEventListener("change",this.#At)}createInputObjects(){return[...super.createInputObjects(),new Di(this.#Lt,this.blueprint)]}renderInput(){return z``}}class Hi extends ii{static singleLineInput=!1;static selectOnFocus=!0;static saveEachInputChange=!1;#Mt;get inputWrapper(){return this.#Mt}#It;static stringFromInputToUE(e){return e.replace(/(?=\n\s*)\n$/,"")}static stringFromUEToInput(e){return e.replaceAll(/(?:\r|(?<=(?:^|[^\\])(?:\\\\)*)\\r)(?=\n)/g,"").replace(/(?<=\n\s*)$/,"\n")}#Tt=()=>this.setInputs(this.getInputs(),!0);#Ot=e=>this.#Dt(e.target);#Dt(e){if(this.element.querySelector(".ueb-pin-name")?.getBoundingClientRect().width<20)return;const t=this.blueprint.scaleCorrect(this.#Mt.getBoundingClientRect().width)+this.nameWidth,i=this.element.classList.contains("ueb-pin-input-wrap");!i&&t>ae.pinInputWrapWidth?this.element.classList.add("ueb-pin-input-wrap"):i&&t<=ae.pinInputWrapWidth&&this.element.classList.remove("ueb-pin-input-wrap")}firstUpdated(e){super.firstUpdated(e);this.constructor.canWrapInput&&this.isInputRendered()&&(this.element.addEventListener("input",this.#Ot),this.nameWidth=this.blueprint.scaleCorrect(this.element.querySelector(".ueb-pin-name")?.getBoundingClientRect().width??0)),this.#Mt=this.element.querySelector(".ueb-pin-input-wrapper"),this.#It=[...this.element.querySelectorAll("ueb-input")]}setup(){super.setup();const e=this.constructor;e.saveEachInputChange?this.element.addEventListener("input",this.#Tt):this.element.addEventListener("focusout",this.#Tt),e.canWrapInput&&this.isInputRendered()&&(this.element.addEventListener("input",this.#Ot),this.element.nodeElement.addEventListener(ae.nodeReflowEventName,this.#Ot))}cleanup(){super.cleanup(),this.element.nodeElement.removeEventListener(ae.nodeReflowEventName,this.#Ot),this.element.removeEventListener("input",this.#Ot),this.element.removeEventListener("input",this.#Tt),this.element.removeEventListener("focusout",this.#Tt)}getInput(){return this.getInputs().reduce(((e,t)=>e+t),"")}getInputs(){return this.#It.map((e=>oe.clearHTMLWhitespace(e.innerHTML)))}setInputs(e=[],t=!0){this.#It.forEach(this.constructor.singleLineInput?(t,i)=>t.innerText=e[i]:(t,i)=>t.innerText=e[i].replaceAll("\n","")),t&&this.setDefaultValue(e.map((e=>Hi.stringFromInputToUE(e))),e),this.element.requestUpdate(),this.element.nodeElement.acknowledgeReflow()}setDefaultValue(e=[],t=e){this.element.setDefaultValue(e.join(""))}renderInput(){const e=this.constructor,t=e.singleLineInput,i=e.selectOnFocus;return z`
`}}class zi extends ii{renderIcon(){return ce.execPin}renderName(){let e=this.element.entity.PinName?.toString();if(this.element.entity.PinFriendlyName)e=this.element.entity.PinFriendlyName.toString();else if("execute"===e||"then"===e)return z``;return z`${this.element.getPinDisplayName()}`}}class _i extends Hi{static singleLineInput=!0;setInputs(e=[],t=!1){if(e&&0!=e.length||(e=[this.getInput()]),super.setInputs(e,!1),t){let i=[];for(const s of e){let e=parseFloat(s);isNaN(e)&&(e=0,t=!1),i.push(e)}this.setDefaultValue(i,e)}}setDefaultValue(e=[],t){const i=this.element.getDefaultValue();i.value=e[0],this.element.setDefaultValue(i),this.element.requestUpdate()}}class Fi extends _i{renderInput(){return z`
`}}
/**
* @license
* Copyright 2017 Google LLC
@@ -30,4 +30,4 @@ class re extends S{constructor(){super(...arguments),this.renderOptions={host:th
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
- */const Ki="important",Yi=" !"+Ki,qi=(e=>(...t)=>({_$litDirective$:e,values:t}))(class extends Ui{constructor(e){if(super(e),e.type!==ji||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,i)=>{const s=e[i];return null==s?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?i.removeProperty(e):i[e]=null);for(const e in t){const s=t[e];if(null!=s){this.ft.add(e);const t="string"==typeof s&&s.endsWith(Yi);e.includes("-")||t?i.setProperty(e,t?s.slice(0,-11):s,t?Ki:""):i[e]=s}}return _}});class Xi extends Kt{toggleAdvancedDisplayHandler;getDraggableElement(){return this.element.querySelector(".ueb-window-top")}createDraggableObject(){return new _t(this.element,this.blueprint,{draggableElement:this.getDraggableElement(),ignoreScale:!0,ignoreTranslateCompensate:!1,movementSpace:this.blueprint,stepSize:1})}setup(){const e=this.blueprint.template.gridLeftVisibilityBoundary(),t=this.blueprint.template.gridTopVisibilityBoundary();this.element.locationX=this.blueprint.scaleCorrectReverse(this.blueprint.mousePosition[0]-e),this.element.locationY=this.blueprint.scaleCorrectReverse(this.blueprint.mousePosition[1]-t),this.element.updateComplete.then((()=>{const e=this.blueprint.getBoundingClientRect();this.element.locationX+this.element.sizeX>e.width&&(this.element.locationX=e.width-this.element.sizeX),this.element.locationX=Math.max(0,this.element.locationX),this.element.locationY+this.element.sizeY>e.height&&(this.element.locationY=e.height-this.element.sizeY),this.element.locationY=Math.max(0,this.element.locationY)}))}render(){return z`
`}}class Ji extends _i{#Jt(){return $e.printNumber(this.element.getDefaultValue()?.X.valueOf()??0)}#ei(){return $e.printNumber(this.element.getDefaultValue()?.Y.valueOf()??0)}#ti(){return $e.printNumber(this.element.getDefaultValue()?.Z.valueOf()??0)}setDefaultValue(e,t){const i=this.element.getDefaultValue(!0);if(!(i instanceof Ve))throw new TypeError("Expected DefaultValue to be a VectorEntity");i.X.value=e[0],i.Y.value=e[1],i.Z.value=e[2],this.element.requestUpdate("DefaultValue",i)}renderInput(){return z`
`}},MUTABLE_REFERENCE:class extends ii{renderIcon(){return ce.referencePin}},name:class extends Hi{static singleLineInput=!0},real:Wi,rg:Qi,string:class extends Hi{},[ae.paths.linearColor]:class extends ii{#ri;#ni=e=>{e.preventDefault(),this.blueprint.setFocused(!0),this.#ri=Ae.getConstructor("ueb-window").newObject({type:new Zi,windowOptions:{getPinColor:()=>this.element.defaultValue,setPinColor:e=>this.element.setDefaultValue(e)}}),this.blueprint.append(this.#ri);const t=()=>{this.element.setDefaultValue(this.#ri.template.color)},i=()=>{this.#ri.removeEventListener(ae.windowApplyEventName,t),this.#ri.removeEventListener(ae.windowCloseEventName,i),this.#ri=null};this.#ri.addEventListener(ae.windowApplyEventName,t),this.#ri.addEventListener(ae.windowCloseEventName,i)};renderInput(){return z``}},[ae.paths.niagaraBool]:Gi,[ae.paths.niagaraFloat]:Wi,[ae.paths.niagaraInt32]:Fi,[ae.paths.niagaraPosition]:Ji,[ae.paths.rotator]:class extends _i{#ai(){return $e.printNumber(this.element.getDefaultValue()?.R.valueOf()??0)}#oi(){return $e.printNumber(this.element.getDefaultValue()?.P.valueOf()??0)}#ei(){return $e.printNumber(this.element.getDefaultValue()?.Y.valueOf()??0)}setDefaultValue(e=[],t=e){const i=this.element.getDefaultValue(!0);if(!(i instanceof dt))throw new TypeError("Expected DefaultValue to be a RotatorEntity");i.R.value=e[0],i.P.value=e[1],i.Y.value=e[2],this.element.requestUpdate("DefaultValue",i)}renderInput(){return z`
X
Y
Z
`}},[ae.paths.vector]:Ji,[ae.paths.vector2D]:Qi,[ae.paths.vector2f]:Qi,[ae.paths.vector3f]:Ji,[ae.paths.vector4f]:class extends _i{#Jt(){return $e.printNumber(this.element.getDefaultValue()?.X.valueOf()??0)}#ei(){return $e.printNumber(this.element.getDefaultValue()?.Y.valueOf()??0)}#ti(){return $e.printNumber(this.element.getDefaultValue()?.Z.valueOf()??0)}#li(){return $e.printNumber(this.element.getDefaultValue()?.W.valueOf()??0)}setDefaultValue(e,t){const i=this.element.getDefaultValue(!0);if(!(i instanceof bt))throw new TypeError("Expected DefaultValue to be a Vector4DEntity");i.X.value=e[0],i.Y.value=e[1],i.Z.value=e[2],i.W.value=e[3],this.element.requestUpdate("DefaultValue",i)}renderInput(){return z`
X
Y
Z
W
`}}};function ts(e){if("Array"===e.PinType.ContainerType?.toString())return ii;if(e.PinType.bIsReference?.valueOf()&&!e.PinType.bIsConst?.valueOf())return es.MUTABLE_REFERENCE;if(e.isExecution())return zi;const t=e.getType();return(e.isInput()?es[t]:ii)??ii}class is extends le{static properties={pinId:{type:Ue,converter:{fromAttribute:(e,t)=>e?Ue.grammar.parse(e):null,toAttribute:(e,t)=>e?.toString()},attribute:"data-id",reflect:!0},pinType:{type:String,attribute:"data-type",reflect:!0},advancedView:{type:String,attribute:"data-advanced-view",reflect:!0},color:{type:Oe,converter:{fromAttribute:(e,t)=>e?Oe.getLinearColorFromAnyFormat().parse(e):null,toAttribute:(e,t)=>e?Oe.printLinearColor(e):null},attribute:"data-color",reflect:!0},defaultValue:{type:String,attribute:!1},isLinked:{type:Boolean,converter:Le.booleanConverter,attribute:"data-linked",reflect:!0},pinDirection:{type:String,attribute:"data-direction",reflect:!0},connectable:{type:Boolean,converter:Le.booleanConverter,attribute:"data-connectable",reflect:!0}};nodeElement;static newObject(e=new yt,t=new(ts(e)),i=void 0){const s=new is;return s.initialize(e,t,i),s}initialize(e=new yt,t=new(ts(e)),i=void 0){this.nodeElement=i,this.advancedView=e.bAdvancedView?.valueOf(),this.isLinked=!1,this.connectable=!e.bNotConnectable?.valueOf(),super.initialize(e,t),this.pinId=this.entity.PinId,this.pinType=this.entity.getType(),this.defaultValue=this.entity.getDefaultValue(),this.color=is.properties.color.converter.fromAttribute(this.getColor().toString()),this.pinDirection=e.isInput()?"input":e.isOutput()?"output":"hidden"}setup(){super.setup(),this.nodeElement=this.closest("ueb-node")}createPinReference(){return new lt(new et(this.nodeElement.getNodeName()),this.getPinId())}getPinId(){return this.entity.PinId}getPinName(){return this.entity.PinName?.toString()??""}getPinDisplayName(){return this.entity.pinTitle()}getColor(){return this.entity.pinColor()}#ci(e){for(;e?.isKnot();){const t=e.nodeElement.getPinElements();e=(e=e===t[0]?t[1]:t[0]).isLinked?this.blueprint.getPin(e.getLinks()[0]):null}return e?.isKnot()?void 0:e}isInput(e=!1){let t=this;return e?this.#ci(t)?.isInput():t.entity.isInput()}isInputLoosely(){return this.isInput(!1)&&void 0===this.isInput(!0)}isInputVisually(){const e=this.nodeElement.template,t=this.isKnot();return t&&this.isInput()!=e.switchDirectionsVisually||!t&&this.isInput()}isOutput(e=!1){let t=this;return e&&e?this.#ci(t)?.isOutput():t.entity.isOutput()}isOutputLoosely(){return this.isOutput(!1)&&void 0===this.isOutput(!0)}isOutputVisually(){const e=this.nodeElement.template,t=this.isKnot();return t&&this.isOutput()!=e.switchDirectionsVisually||!t&&this.isOutput()}isKnot(){return this.nodeElement?.getType()==ae.paths.knot}getLinkLocation(e=!1){return this.template.getLinkLocation(e)}getNodeElement(){return this.nodeElement}getLinks(){return this.entity.LinkedTo?.valueOf()??[]}getDefaultValue(e=!1){return this.defaultValue=this.entity.getDefaultValue(e)}setDefaultValue(e){this.entity.DefaultValue=e,this.defaultValue=e,this.entity.recomputesNodeTitleOnChange&&this.nodeElement?.computeNodeDisplayName()}sanitizeLinks(e=[]){this.entity.LinkedTo=new yt.attributes.LinkedTo(this.entity.LinkedTo?.valueOf().filter((t=>{let i=this.blueprint.getPin(t);if(i){if(e.length&&!e.includes(i.nodeElement))return!1;let t=this.blueprint.getLink(this,i);t||(t=Ae.getConstructor("ueb-link").newObject(this,i),this.blueprint.addGraphElement(t))}return i}))),this.isLinked=this.entity.isLinked()}linkTo(e){const t=this.createPinReference();this.isLinked&&(this.isInput(!0)||this.isOutput(!0)&&(this.entity.isExecution()||e.entity.isExecution()))&&!this.getLinks().some((e=>t.equals(e)))&&this.unlinkFromAll(),this.entity.linkTo(e.getNodeElement().getNodeName(),e.entity)&&(this.isLinked=this.entity.isLinked(),this.entity.recomputesNodeTitleOnChange&&this.nodeElement?.computeNodeDisplayName())}unlinkFrom(e,t=!0){this.entity.unlinkFrom(e.getNodeElement().getNodeName(),e.entity)&&(this.isLinked=this.entity.isLinked(),t&&this.blueprint.getLink(this,e)?.remove(),this.entity.recomputesNodeTitleOnChange&&this.nodeElement?.computeNodeDisplayName())}unlinkFromAll(){this.getLinks().length,this.getLinks().map((e=>this.blueprint.getPin(e))).forEach((e=>this.unlinkFrom(e)))}redirectLink(e,t){const i=this.getLinks().findIndex((t=>t.objectName.toString()==e.getNodeElement().getNodeName()&&t.pinGuid.toString()==e.entity.PinId.toString()));return i>=0&&(this.entity.LinkedTo.valueOf()[i]=t,!0)}}class ss{constructor(e=e=>e,t=null){this.array=new Uint32Array(t),this.comparisonValueSupplier=e,this.length=0,this.currentPosition=0}get(e){return e>=0&&e=0&&this.currentPosition=0&&this.currentPosition0?this.get(this.currentPosition-1):null}getPrevValue(){return this.currentPosition>0?this.comparisonValueSupplier(this.get(this.currentPosition-1)):Number.MIN_SAFE_INTEGER}shiftLeft(e,t=1){this.array.set(this.array.subarray(e+t),e)}shiftRight(e,t=1){this.array.set(this.array.subarray(e,-t),e+t)}}class rs{constructor(e,t,i,s){this.initialPosition=e,this.finalPosition=e,this.metadata=new Array(t.length),this.primaryOrder=new ss((e=>this.metadata[e].primaryBoundary)),this.secondaryOrder=new ss((e=>this.metadata[e].secondaryBoundary)),this.selectFunc=s,this.rectangles=t,this.primaryOrder.reserve(this.rectangles.length),this.secondaryOrder.reserve(this.rectangles.length),t.forEach(((e,t)=>{let r={primaryBoundary:this.initialPosition[0],secondaryBoundary:this.initialPosition[1],rectangle:t,onSecondaryAxis:!1};this.metadata[t]=r,s(e,!1);const n=i(e);this.initialPosition[1]{if(this.metadata[i].onSecondaryAxis)this.selectFunc(this.rectangles[i],s);else if(s){this.secondaryOrder.insert(i,e[1]);const s=this.metadata[i].secondaryBoundary;Math.sign(e[1]-s)==t[1]&&Math.sign(s-this.initialPosition[1])==t[1]&&this.selectFunc(this.rectangles[i],!0)}else this.selectFunc(this.rectangles[i],!1),this.secondaryOrder.remove(i);this.computeBoundaries(),this.selectTo(e)};e[0]this.boundaries.primaryN.v&&e[0]this.boundaries.primaryP.v&&(++this.primaryOrder.currentPosition,i(this.boundaries.primaryP.i,this.initialPosition[0]{this.selectFunc(this.rectangles[t],i),this.computeBoundaries(),this.selectTo(e)};e[1]this.boundaries.secondaryN.v&&e[1]this.boundaries.secondaryP.v&&(++this.secondaryOrder.currentPosition,s(this.boundaries.secondaryP.i,this.initialPosition[1]os.#ui[e],toAttribute:(e,t)=>Object.entries(os.#ui).find((([t,i])=>e.constructor===i))?.[0]}}};static newObject(e={},t=e.type??new Xi){const i=new os;return i.initialize(e,t),i}initialize(e={},t=e.type??new Xi){e.windowOptions??={},this.type=e.type,this.windowOptions=e.windowOptions,super.initialize(e,t)}computeSizes(){const e=this.getBoundingClientRect();this.sizeX=e.width,this.sizeY=e.height}cleanup(){super.cleanup(),this.acknowledgeClose()}acknowledgeClose(){let e=new CustomEvent(ae.windowCloseEventName);this.dispatchEvent(e)}}class ls extends ke{static attributes={...super.attributes,VariableGuid:Ue};static grammar=this.createGrammar();static{ke.unknownEntity=this}static createGrammar(){return Pe.seq(Pe.reg(new RegExp(`(${Ie.Regex.Path.source}|${Ie.Regex.Symbol.source}\\s*)?\\(\\s*`),1),Pe.seq(Ie.attributeName,Ie.equalSeparation).map((([e,t])=>e)).chain((e=>this.unknownEntityGrammar.map((t=>i=>i[e]=t)))).sepBy(Ie.commaSeparation),Pe.reg(/\s*(?:,\s*)?\)/)).map((([e,t,i])=>{e??="";let s={};return e.length&&(s.lookbehind=e),t.forEach((e=>e(s))),new this(s)})).label("UnknownKeysEntity")}}ke.unknownEntityGrammar=Pe.alt(Le.grammar,Ue.grammar,Pe.str("None").map((()=>ot.createNoneInstance())),Et.grammar,$e.grammar,Pe.alt(ot.fullReferenceGrammar,Pe.regArray(new RegExp(`"(${Ie.Regex.Path.source})'(${Ie.Regex.Path.source}|${Ie.symbol.getParser().regexp.source})'"`)).map((([e,t,i])=>new ot(t,i,((e,t)=>`"${e}'${t}'"`))))),Qe.grammar,rt.grammar,st.grammar,nt.grammar,lt.grammar,bt.grammar,Ve.grammar,ht.grammar,dt.grammar,Oe.grammar,ls.grammar,et.grammar,Fe.of(lt).grammar,Fe.of(Me.accepting($e,Qe,et)).grammar,Pe.lazy((()=>Fe.createGrammar(ke.unknownEntityGrammar)))),function(){const e=(e,t)=>{customElements.define(e,t),Ae.registerElement(e,t)};e("ueb-color-handler",Ii),e("ueb-dropdown",Vi),e("ueb-input",Ri),e("ueb-link",Gt),e("ueb-node",di),e("ueb-pin",is),e("ueb-selector",as),e("ueb-ui-slider",Oi),e("ueb-window",os)}();export{ki as Blueprint,ae as Configuration,Gt as LinkElement,di as NodeElement,oe as Utility};
+ */const Ki="important",Yi=" !"+Ki,qi=(e=>(...t)=>({_$litDirective$:e,values:t}))(class extends Ui{constructor(e){if(super(e),e.type!==ji||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,i)=>{const s=e[i];return null==s?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?i.removeProperty(e):i[e]=null);for(const e in t){const s=t[e];if(null!=s){this.ft.add(e);const t="string"==typeof s&&s.endsWith(Yi);e.includes("-")||t?i.setProperty(e,t?s.slice(0,-11):s,t?Ki:""):i[e]=s}}return _}});class Xi extends Kt{toggleAdvancedDisplayHandler;getDraggableElement(){return this.element.querySelector(".ueb-window-top")}createDraggableObject(){return new _t(this.element,this.blueprint,{draggableElement:this.getDraggableElement(),ignoreScale:!0,ignoreTranslateCompensate:!1,movementSpace:this.blueprint,stepSize:1})}setup(){const e=this.blueprint.template.gridLeftVisibilityBoundary(),t=this.blueprint.template.gridTopVisibilityBoundary();this.element.locationX=this.blueprint.scaleCorrectReverse(this.blueprint.mousePosition[0]-e),this.element.locationY=this.blueprint.scaleCorrectReverse(this.blueprint.mousePosition[1]-t),this.element.updateComplete.then((()=>{const e=this.blueprint.getBoundingClientRect();this.element.locationX+this.element.sizeX>e.width&&(this.element.locationX=e.width-this.element.sizeX),this.element.locationX=Math.max(0,this.element.locationX),this.element.locationY+this.element.sizeY>e.height&&(this.element.locationY=e.height-this.element.sizeY),this.element.locationY=Math.max(0,this.element.locationY)}))}render(){return z`
`}}class Ji extends _i{#Jt(){return $e.printNumber(this.element.getDefaultValue()?.X.valueOf()??0)}#ei(){return $e.printNumber(this.element.getDefaultValue()?.Y.valueOf()??0)}#ti(){return $e.printNumber(this.element.getDefaultValue()?.Z.valueOf()??0)}setDefaultValue(e,t){const i=this.element.getDefaultValue(!0);if(!(i instanceof Ve))throw new TypeError("Expected DefaultValue to be a VectorEntity");i.X.value=e[0],i.Y.value=e[1],i.Z.value=e[2],this.element.requestUpdate("DefaultValue",i)}renderInput(){return z`
`}},MUTABLE_REFERENCE:class extends ii{renderIcon(){return ce.referencePin}},name:class extends Hi{static singleLineInput=!0},real:Wi,rg:Qi,string:class extends Hi{setDefaultValue(e=[],t){const i=this.element.getDefaultValue();i.value=e[0],this.element.setDefaultValue(i),this.element.requestUpdate()}},[ae.paths.linearColor]:class extends ii{#ri;#ni=e=>{e.preventDefault(),this.blueprint.setFocused(!0),this.#ri=Ae.getConstructor("ueb-window").newObject({type:new Zi,windowOptions:{getPinColor:()=>this.element.defaultValue,setPinColor:e=>this.element.setDefaultValue(e)}}),this.blueprint.append(this.#ri);const t=()=>{this.element.setDefaultValue(this.#ri.template.color)},i=()=>{this.#ri.removeEventListener(ae.windowApplyEventName,t),this.#ri.removeEventListener(ae.windowCloseEventName,i),this.#ri=null};this.#ri.addEventListener(ae.windowApplyEventName,t),this.#ri.addEventListener(ae.windowCloseEventName,i)};renderInput(){return z``}},[ae.paths.niagaraBool]:Gi,[ae.paths.niagaraFloat]:Wi,[ae.paths.niagaraInt32]:Fi,[ae.paths.niagaraPosition]:Ji,[ae.paths.rotator]:class extends _i{#ai(){return $e.printNumber(this.element.getDefaultValue()?.R.valueOf()??0)}#oi(){return $e.printNumber(this.element.getDefaultValue()?.P.valueOf()??0)}#ei(){return $e.printNumber(this.element.getDefaultValue()?.Y.valueOf()??0)}setDefaultValue(e=[],t=e){const i=this.element.getDefaultValue(!0);if(!(i instanceof dt))throw new TypeError("Expected DefaultValue to be a RotatorEntity");i.R.value=e[0],i.P.value=e[1],i.Y.value=e[2],this.element.requestUpdate("DefaultValue",i)}renderInput(){return z`
X
Y
Z
`}},[ae.paths.vector]:Ji,[ae.paths.vector2D]:Qi,[ae.paths.vector2f]:Qi,[ae.paths.vector3f]:Ji,[ae.paths.vector4f]:class extends _i{#Jt(){return $e.printNumber(this.element.getDefaultValue()?.X.valueOf()??0)}#ei(){return $e.printNumber(this.element.getDefaultValue()?.Y.valueOf()??0)}#ti(){return $e.printNumber(this.element.getDefaultValue()?.Z.valueOf()??0)}#li(){return $e.printNumber(this.element.getDefaultValue()?.W.valueOf()??0)}setDefaultValue(e,t){const i=this.element.getDefaultValue(!0);if(!(i instanceof bt))throw new TypeError("Expected DefaultValue to be a Vector4DEntity");i.X.value=e[0],i.Y.value=e[1],i.Z.value=e[2],i.W.value=e[3],this.element.requestUpdate("DefaultValue",i)}renderInput(){return z`