katana-render-runtime 0.3.6

Versioned render runtime for KatanA diagrams and math (Mermaid, Draw.io, ZenUML, PlantUML, MathJax).
Documentation
1
2
3
4
// @generated by scripts/runtime-bundles/bundle-runtime.ts
// bundle: drawio

globalThis.eval('globalThis.window=globalThis,globalThis.self=globalThis,globalThis.navigator={userAgent:"KatanA Rust-managed Mermaid runtime"},globalThis.location={href:"https://katana.local/",origin:"https://katana.local",protocol:"https:",host:"katana.local",hostname:"katana.local",pathname:"/",search:"",hash:""};const KATANA_DETERMINISTIC_NOW=Date.parse("2026-01-01T00:00:00.000Z");globalThis.Date.now=()=>KATANA_DETERMINISTIC_NOW,globalThis.performance={now:()=>Date.now()},globalThis.devicePixelRatio=1,globalThis.innerWidth=1520,globalThis.innerHeight=845,globalThis.screen={width:globalThis.innerWidth,height:globalThis.innerHeight,availWidth:globalThis.innerWidth,availHeight:globalThis.innerHeight},globalThis.localStorage=katanaStorage(),globalThis.sessionStorage=katanaStorage();const katanaIntl=globalThis.Intl??{};katanaIntl.Segmenter=class KatanaSegmenter{segment(value){const input=String(value);let index=0;return Array.from(input).map(segment=>{const entry={segment:segment,index:index,input:input};return index+=segment.length,entry})}},globalThis.Intl=katanaIntl,globalThis.crypto={getRandomValues(array){for(let index=0;index<array.length;index+=1)array[index]=katanaDeterministicByte(index);return array},randomUUID:()=>"00000000-0000-4000-8000-000000000000"},Math.random=function katanaDeterministicRandom(){return katanaRandomState=1664525*katanaRandomState+1013904223>>>0,katanaRandomState/4294967296};let katanaRandomState=305419896;function katanaDeterministicByte(index){return 73*index+41&255}function katanaStorage(){const values={};return{get length(){return Object.keys(values).length},clear(){Object.keys(values).forEach(key=>delete values[key])},getItem:key=>values[String(key)]??null,key:index=>Object.keys(values)[index]??null,removeItem(key){delete values[String(key)]},setItem(key,value){values[String(key)]=String(value)}}}globalThis.queueMicrotask=callback=>Promise.resolve().then(callback),globalThis.setTimeout=(callback,_delay,...args)=>callback(...args),globalThis.clearTimeout=()=>{},globalThis.setInterval=(callback,_delay,...args)=>callback(...args),globalThis.clearInterval=()=>{},globalThis.MessageChannel=class KatanaMessageChannel{constructor(){this.port1={onmessage:null},this.port2={postMessage:data=>{queueMicrotask(()=>this.port1.onmessage?.({data:data}))}}}};let katanaAnimationFrameDepth=0;function katanaBase64Chunk(chunk){const first=chunk.charCodeAt(0),second=chunk.charCodeAt(1),third=chunk.charCodeAt(2);return[first>>2,(3&first)<<4|second>>4,katanaThirdBase64Index(second,third),katanaFourthBase64Index(third)].map(index=>"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(index)).join("")}function katanaThirdBase64Index(second,third){return Number.isNaN(second)?64:(15&second)<<2|third>>6}function katanaFourthBase64Index(third){return Number.isNaN(third)?64:63&third}globalThis.requestAnimationFrame=callback=>function katanaRunAnimationFrame(callback){return katanaAnimationFrameDepth>4?0:function katanaInvokeAnimationFrame(callback){katanaAnimationFrameDepth+=1;try{return callback(Date.now())}finally{katanaAnimationFrameDepth-=1}}(callback)}(callback),globalThis.cancelAnimationFrame=()=>{},globalThis.addEventListener=()=>{},globalThis.removeEventListener=()=>{},globalThis.__katanaMissingSelectors=[],globalThis.btoa=value=>function katanaBase64Triplets(value){return value.match(/[\\s\\S]{1,3}/g)??[]}(unescape(encodeURIComponent(String(value)))).map(katanaBase64Chunk).join(""),globalThis.DOMPurify={sanitize:value=>String(value??""),addHook(){},removeHook(){}};class KatanaStyle{constructor(){this.values={}}setProperty(name,value){this.values[String(name)]=String(value)}getPropertyValue(name){return this.values[String(name)]??""}removeProperty(name){const value=this.getPropertyValue(name);return delete this.values[String(name)],value}set mixBlendMode(value){this.setProperty("mix-blend-mode",value)}get mixBlendMode(){return this.getPropertyValue("mix-blend-mode")}get cssText(){return Object.entries(this.values).map(([key,value])=>`${key}: ${value};`).join(" ")}clone(){const cloned=new KatanaStyle;return cloned.values={...this.values},cloned}}class KatanaCSSRule{constructor(cssText){this.cssText=String(cssText)}}function katanaEscapeSvgText(value){return String(value).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}globalThis.CSSStyleSheet=class KatanaCSSStyleSheet{constructor(){this.cssRules=[]}insertRule(rule,index=this.cssRules.length){const insertIndex=function katanaCssRuleInsertIndex(index,length){const parsed=Number(index);return Number.isFinite(parsed)?Math.max(0,Math.min(Math.trunc(parsed),length)):length}(index,this.cssRules.length);return this.cssRules.splice(insertIndex,0,new KatanaCSSRule(rule)),insertIndex}replaceSync(cssText){this.cssRules=function katanaStyleSheetRuleTexts(cssText){const source=String(cssText??"").trim();return 0===source.length?[]:source.match(/[^{}]+\\{[^{}]*\\}/g)??[source]}(cssText).map(it=>new KatanaCSSRule(it))}},globalThis.getComputedStyle=node=>({getPropertyValue:name=>node?.style?.getPropertyValue?.(name)??""});class KatanaNode{constructor(tagName,namespaceURI=null){const rawName=function katanaRawNodeName(tagName){return String(tagName||"")}(tagName),preservesCase=function katanaPreservesNodeCase(namespaceURI){return[katanaNamespaceIncludes(namespaceURI,"svg"),katanaNamespaceIncludes(namespaceURI,"xml")].includes(!0)}(namespaceURI);this.serializedName=function katanaSerializedNodeName(rawName,preservesCase){return preservesCase?rawName:rawName.toLowerCase()}(rawName,preservesCase),this.tagName=function katanaTagNodeName(rawName,preservesCase){return preservesCase?rawName:rawName.toUpperCase()}(rawName,preservesCase),this.nodeName=this.tagName,this.localName=rawName.toLowerCase(),this.namespaceURI=namespaceURI,this.children=[],this.childNodes=this.children,this.parentNode=null,this.ownerDocument=null,this.nodeType=function katanaNodeType(tagName){return"#text"===tagName?3:1}(tagName),this.attributes=[],this.attributeMap={},this.style=new KatanaStyle,this.dataset={},this._textContent="",this.className="",this.id=""}appendChild(child){return child.parentNode=this,child.ownerDocument=this.ownerDocument,this.children.push(child),this.childNodes=this.children,child}insertBefore(child,reference){child.parentNode=this,child.ownerDocument=this.ownerDocument;const index=this.children.indexOf(reference);return index<0?(this.children.push(child),this.childNodes=this.children,child):(this.children.splice(index,0,child),this.childNodes=this.children,child)}removeChild(child){return this.children=this.children.filter(candidate=>candidate!==child),this.childNodes=this.children,child}remove(){this.parentNode&&this.parentNode.removeChild(this)}get firstChild(){return this.children[0]??null}get lastChild(){return this.children[this.children.length-1]??null}get parentElement(){return this.parentNode}getRootNode(){return this.ownerDocument??document}hasChildNodes(){return this.children.length>0}compareDocumentPosition(other){return this===other?0:4}get nextSibling(){if(!this.parentNode)return null;const index=this.parentNode.children.indexOf(this);return this.parentNode.children[index+1]??null}get previousSibling(){if(!this.parentNode)return null;const index=this.parentNode.children.indexOf(this);return this.parentNode.children[index-1]??null}setAttribute(name,value){const normalized=String(name),attribute=function katanaUpsertAttribute(node,normalized){const attribute=node.attributeMap[normalized];return attribute||function katanaCreateAttribute(node,normalized){const attribute={name:normalized,nodeName:normalized,value:""};return node.attributeMap[normalized]=attribute,node.attributes.push(attribute),attribute}(node,normalized)}(this,normalized);attribute.value=String(value),function katanaSyncIdAttribute(node,normalized,value){"id"===normalized&&(node.id=String(value))}(this,normalized,value),function katanaSyncClassAttribute(node,normalized,value){"class"===normalized&&(node.className=String(value))}(this,normalized,value)}getAttribute(name){return this.attributeMap[String(name)]?.value??null}removeAttribute(name){const normalized=String(name);delete this.attributeMap[normalized],this.attributes=this.attributes.filter(attribute=>attribute.name!==normalized)}setAttributeNS(_namespace,name,value){this.setAttribute(name,value)}getAttributeNS(_namespace,name){return this.getAttribute(name)}hasAttribute(name){return Object.hasOwn(this.attributeMap,String(name))}querySelector(selector){const result=function katanaFirstQuerySelectorResult(node,selector){return node.querySelectorAll(selector)[0]??null}(this,selector);return null===result&&globalThis.__katanaMissingSelectors.push(`${this.localName}:${selector}`),result}querySelectorAll(selector){const compound=function queryCompoundSelector(root,selector){const parts=selector.split(/\\s+/).filter(Boolean);return parts.length<=1?null:function katanaQuerySelectorParts(candidates,parts){return parts.reduce((current,part)=>current.flatMap(candidate=>querySimpleSelector(candidate,part)),candidates)}([root],parts)}(this,String(selector));return null!==compound?compound:querySimpleSelector(this,String(selector))}getElementsByTagName(tagName){return this.querySelectorAll(String(tagName).toLowerCase())}addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}focus(){document.activeElement=this}click(){}get isConnected(){return this===document||document.documentElement.contains(this)}toJSON(){return{}}}function katanaNamespaceIncludes(namespaceURI,value){return String(namespaceURI||"").includes(value)}function katanaStyleCamelName(name){return String(name).replace(/-([a-z])/g,(_match,char)=>char.toUpperCase())}function katanaStyleKebabName(name){return String(name).replace(/[A-Z]/g,char=>`-${char.toLowerCase()}`)}["backgroundColor","border","borderBottom","borderColor","borderRadius","borderRightStyle","color","colorScheme","cursor","display","fill","fontFamily","fontSize","fontWeight","height","margin","marginBottom","maxHeight","maxWidth","opacity","overflow","padding","paddingBottom","position","right","stroke","stopColor","textAlign","top","verticalAlign","width","zIndex"].forEach(function katanaInstallStyleDirectProperty(camel){Object.getOwnPropertyDescriptor(KatanaStyle.prototype,camel)||Object.defineProperty(KatanaStyle.prototype,camel,{get(){return this.getPropertyValue(katanaStyleKebabName(camel))},set(value){this.setProperty(katanaStyleKebabName(camel),value)}})}),KatanaStyle.prototype.setProperty=function setProperty(name,value){const kebab=katanaStyleKebabName(name),camel=katanaStyleCamelName(name);this.values[kebab]=String(value),this.values[camel]=String(value),Object.getOwnPropertyDescriptor(KatanaStyle.prototype,camel)||(this[camel]=String(value))},KatanaStyle.prototype.getPropertyValue=function getPropertyValue(name){const key=String(name),kebab=katanaStyleKebabName(key),camel=katanaStyleCamelName(key);return this.values[key]??this.values[kebab]??this.values[camel]??function katanaStyleOwnValue(style,camel){return Object.hasOwn(style,camel)?style[camel]:""}(this,camel)},KatanaStyle.prototype.removeProperty=function removeProperty(name){const value=this.getPropertyValue(name);return delete this.values[String(name)],delete this.values[katanaStyleKebabName(name)],delete this.values[katanaStyleCamelName(name)],delete this[katanaStyleCamelName(name)],value},Object.defineProperty(KatanaStyle.prototype,"cssText",{get(){return Object.entries(this.values).filter(([key])=>key.includes("-")).map(([key,value])=>`${key}: ${value}`).join("; ")},set(value){this.values={},function katanaApplyCssText(style,value){(function katanaCssEntries(value){return String(value??"").split(";")})(value).forEach(entry=>{!function katanaApplyCssEntry(style,entry){const separator=entry.indexOf(":");separator<0||style.setProperty(entry.slice(0,separator).trim(),entry.slice(separator+1).trim())}(style,entry)})}(this,value)}});const katanaSetAttributeBase=KatanaNode.prototype.setAttribute;function parseInnerHtml(source,xmlMode=!1){const root={localName:"#root",children:[],appendChild(child){this.children.push(child)}},stack=[root];return Array.from(source.matchAll(/<\\/?([a-zA-Z0-9:_-]+)([^>]*)>|([^<]+)/g)).forEach(match=>{!function appendHtmlToken(stack,match,xmlMode){void 0===match[3]?function appendHtmlTag(stack,match,xmlMode){match[0].startsWith("</")?function popHtmlStack(stack,tagName){const normalized=String(tagName).toLowerCase(),index=stack.findLastIndex(node=>node.localName===normalized);index>0&&stack.splice(index)}(stack,match[1]):function appendHtmlStartTag(stack,match,xmlMode){const node=new KatanaNode(match[1],function katanaHtmlNamespace(xmlMode){return xmlMode?"katana-xml":null}(xmlMode));node.ownerDocument=document,function parseAttributes(source){return Array.from(source.matchAll(/([a-zA-Z0-9:_-]+)="([^"]*)"/g)).map(match=>[match[1],decodeHtmlEntities(match[2])])}(match[2]).forEach(([name,value])=>{node.setAttribute(name,value)}),stack[stack.length-1].appendChild(node),function pushHtmlElementIfOpen(stack,node,fullTag,tagName){(function katanaIsOpenHtmlTag(fullTag,tagName){return[!fullTag.endsWith("/>"),!isHtmlVoidTag(tagName)].every(Boolean)})(fullTag,tagName)&&stack.push(node)}(stack,node,match[0],match[1])}(stack,match,xmlMode)}(stack,match,xmlMode):function appendHtmlText(parent,value){const text=decodeHtmlEntities(value);text.length>0&&parent.appendChild(new KatanaTextNode(text))}(stack[stack.length-1],match[3])}(stack,match,xmlMode)}),root.children}function isHtmlVoidTag(tagName){return new Set(["br","hr","img","input","meta","link"]).has(String(tagName).toLowerCase())}function decodeHtmlEntities(value){return"block"===globalThis.__katanaMermaidDiagramType?function katanaDecodeHtmlEntitiesForBlock(value){return String(value).replace(/&amp;nbsp;/g,"&nbsp;").replace(/&#xa;/gi,"\\n").replace(/&#10;/g,"\\n").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,\'"\').replace(/&#39;/g,"\'")}(value):String(value).replace(/&amp;nbsp;/g," ").replace(/&nbsp;/g," ").replace(/&#xa;/gi,"\\n").replace(/&#10;/g,"\\n").replace(/&#160;/g," ").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,\'"\').replace(/&#39;/g,"\'")}KatanaNode.prototype.setAttribute=function setAttribute(name,value){katanaSetAttributeBase.call(this,name,value),"style"===String(name).toLowerCase()&&(this.style.cssText=value)};class KatanaTextNode extends KatanaNode{constructor(value){super("#text"),this.textContent=String(value)}get outerHTML(){return katanaEscapeSvgText(this.textContent)}}function katanaStyleAttribute(node){return function katanaShouldSerializeStyle(node){return[node.style.cssText,!node.hasAttribute("style")].every(Boolean)}(node)?{style:node.style.cssText}:{}}KatanaNode.prototype.getBBox=function getBBox(){const text=function katanaNodeTextForBox(node){return String(function katanaFirstTextValue(values){return values.find(Boolean)??""}([node.textContent,node.innerText]))}(this),childWidth=function katanaNodeChildWidth(node){return node.children.reduce((max,child)=>Math.max(max,child.getBBox().width),0)}(this);return{x:0,y:0,width:Math.max(80,childWidth,katanaTextWidth(text)),height:Math.max(24,24*this.children.length)}},KatanaNode.prototype.getBoundingClientRect=function getBoundingClientRect(){const box=this.getBBox();return{...box,top:box.y,left:box.x,right:box.x+box.width,bottom:box.y+box.height}},KatanaNode.prototype.getComputedTextLength=function getComputedTextLength(){return Math.max(16,katanaTextWidth(String(this.textContent||"")))},KatanaNode.prototype.getContext=function getContext(){return{font:"",measureText:value=>({width:Math.max(16,katanaTextWidth(String(value||"")))})}},Object.defineProperty(KatanaNode.prototype,"innerHTML",{get(){return 0===this.children.length?this.textContent:this.children.map(child=>child.outerHTML??child.textContent??"").join("")},set(value){!function katanaClearInnerHtml(node){node.textContent="",node.children=[],node.childNodes=node.children}(this),function katanaApplyInnerHtml(node,value,parsed){0!==parsed.length?function katanaAppendParsedHtml(node,parsed){for(const child of parsed)node.appendChild(child)}(node,parsed):node.textContent=value}(this,String(value),parseInnerHtml(String(value)))}}),Object.defineProperty(KatanaNode.prototype,"outerHTML",{get(){const attrs=function katanaSerializedAttributeText(node){return Object.entries({...node.serializedAttributes(),...katanaStyleAttribute(node)}).map(([key,value])=>` ${key}="${function katanaEscapeSvgAttribute(value){return String(value).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}(value)}"`).join("")}(this),body=function katanaOuterHtmlBody(node){return 0===node.children.length?katanaEscapeSvgText(node.textContent):node.innerHTML}(this);return`<${this.serializedName}${attrs}>${body}</${this.serializedName}>`}}),KatanaNode.prototype.cloneNode=function cloneNode(deep=!1){const clone=function katanaShallowCloneNode(node){const clone=new KatanaNode(node.serializedName,node.namespaceURI);return node.attributes.forEach(attribute=>{clone.setAttribute(attribute.name,attribute.value)}),clone.style=node.style.clone(),clone._textContent=node._textContent??"",clone.className=node.className,clone.id=node.id,clone.ownerDocument=node.ownerDocument,clone}(this);return function katanaCloneChildrenIfDeep(node,clone,deep){deep&&function katanaCloneChildren(node,clone){for(const child of node.children)clone.appendChild(child.cloneNode(!0))}(node,clone)}(this,clone,deep),clone},KatanaNode.prototype.serializedAttributes=function serializedAttributes(){return Object.fromEntries(this.attributes.map(attribute=>[attribute.name,attribute.value]))};class KatanaCanvasContext{constructor(){this.font=""}measureText(value){return{width:katanaCanvasTextWidth(String(value??""),this.font)}}}function katanaCanvasTextWidth(text,font){const fontScale=function katanaCanvasFontScale(font){return katanaFiniteFontSize(function katanaCanvasFontSize(font){const match=String(font??"").match(/(\\d+(?:\\.\\d+)?)px/);return match?Number(match[1]):16}(font))/16}(font);return Array.from(katanaMeasuredTextValue(text)).map(char=>function katanaCanvasCharacterWidth(char){return 160===char.charCodeAt(0)?KATANA_CANVAS_ASCII_TEXT_WIDTHS[" "]:KATANA_CANVAS_ASCII_TEXT_WIDTHS[char]??katanaTextWidth(char)}(char)).reduce((width,charWidth)=>width+charWidth*fontScale,0)}KatanaNode.prototype.getContext=function getContext(){return new KatanaCanvasContext};const KATANA_CANVAS_ASCII_TEXT_WIDTHS={" ":4.445,"!":4.445,\'"\':5.68,"\'":3.055,"(":5.328,")":5.328,"-":5.328,".":4.445,"/":4.445,":":4.445,0:8.898,1:8.898,2:8.898,3:8.898,4:8.898,5:8.898,6:8.898,7:8.898,8:8.898,9:8.898,"=":9.344,A:10.672,B:10.672,C:11.555,D:11.555,E:10.672,F:9.773,G:12.445,H:11.555,I:4.445,J:8,K:10.672,L:8.898,M:13.328,N:11.555,O:12.445,P:10.672,Q:12.445,R:11.555,S:10.672,T:9.773,U:11.555,V:10.672,W:15.102,X:10.672,Y:10.672,Z:9.773,_:8.898,a:8.898,b:8.898,c:8,d:8.898,e:8.898,f:4.445,g:8.898,h:8.898,i:3.555,j:3.555,k:8,l:3.555,m:13.328,n:8.898,o:8.898,p:8.898,q:8.898,r:5.328,s:8,t:4.445,u:8.898,v:8,w:11.555,x:8,y:8,z:8};function matchesSelector(node,selector){const matcher=KATANA_SELECTOR_MATCHERS.find(entry=>entry.applies(selector));return matcher?matcher.matches(node,selector):function katanaMatchesTag(node,selector){return node.localName===selector.toLowerCase()}(node,selector)}const KATANA_SELECTOR_MATCHERS=[{applies:function katanaIsBareFirstChildSelector(selector){return[":first-child","::first-child"].includes(selector)},matches:katanaMatchesBareFirstChild},{applies:function katanaIsNestedFirstChildSelector(selector){return selector.endsWith(":first-child")},matches:function katanaMatchesNestedFirstChild(node,selector){return[matchesSelector(node,selector.replace(/:{1,2}first-child$/,"")),katanaMatchesBareFirstChild(node)].every(Boolean)}},{applies:function katanaIsWildcardSelector(selector){return"*"===selector},matches:function katanaMatchesWildcard(node){return node.nodeType===Node.ELEMENT_NODE}},{applies:function katanaIsTagIdSelector(selector){return/^([a-zA-Z0-9:_-]+)#(.+)$/.test(selector)},matches:function katanaMatchesTagId(node,selector){const match=selector.match(/^([a-zA-Z0-9:_-]+)#(.+)$/);return[node.localName===match[1].toLowerCase(),node.id===match[2]].every(Boolean)}},{applies:function katanaIsBodySelector(selector){return"body"===selector},matches:function katanaMatchesBody(node){return node===document.body}},{applies:function katanaIsIdSelector(selector){return selector.startsWith("#")},matches:function katanaMatchesId(node,selector){return node.id===selector.slice(1)}},{applies:function katanaIsIdAttributeSelector(selector){return/^\\[id="([^"]+)"\\]$/.test(selector)},matches:function katanaMatchesIdAttribute(node,selector){return node.id===selector.match(/^\\[id="([^"]+)"\\]$/)[1]}},{applies:function katanaIsClassSelector(selector){return selector.startsWith(".")},matches:function katanaMatchesClass(node,selector){return String(node.className).split(/\\s+/).includes(selector.slice(1))}}];function katanaMatchesBareFirstChild(node){return node.parentNode?.firstElementChild===node}function querySimpleSelector(root,selector){const results=[];return root.children.forEach(node=>{katanaVisitSelector(node,selector,results)}),results}function katanaVisitSelector(node,selector,results){!function katanaAddMatchingSelector(node,selector,results){matchesSelector(node,selector)&&results.push(node)}(node,selector,results),node.children.forEach(child=>{katanaVisitSelector(child,selector,results)})}const document={nodeType:9,currentScript:null,activeElement:null,addEventListener(){},removeEventListener(){},dispatchEvent:()=>!0,createElement(tagName){const node=new KatanaNode(tagName);return node.ownerDocument=document,node},createElementNS(namespaceURI,tagName){const node=new KatanaNode(tagName,namespaceURI);return node.ownerDocument=document,node},createTextNode(value){const node=new KatanaTextNode(value);return node.ownerDocument=document,node},createComment(value){return this.createTextNode(value)},createDocumentFragment(){const node=new KatanaNode("#document-fragment");return node.nodeType=11,node.ownerDocument=document,node},createNodeIterator(root){const nodes=[],visit=node=>{nodes.push(node),node.children.forEach(visit)};visit(root);let index=0;return{nextNode:()=>nodes[index++]??null}},getElementsByTagName(tagName){return this.documentElement.querySelectorAll(String(tagName).toLowerCase())},importNode(node,deep){const clone=node.cloneNode(deep);return clone.ownerDocument=document,clone},getElementById(id){const result=this.documentElement.querySelector(`#${id}`);return null===result&&globalThis.__katanaMissingSelectors.push(`document.getElementById:${id}`),result},querySelector(selector){return"body"===selector?this.body:this.documentElement.querySelector(selector)},querySelectorAll(selector){return this.documentElement.querySelectorAll(selector)},implementation:{createHTMLDocument:()=>createDetachedDocument()},fonts:{ready:Promise.resolve()}};function createDetachedDocument(){const detached=Object.create(document);return detached.documentElement=document.createElement("html"),detached.head=document.createElement("head"),detached.body=document.createElement("body"),detached.documentElement.ownerDocument=detached,detached.head.ownerDocument=detached,detached.body.ownerDocument=detached,detached.documentElement.appendChild(detached.head),detached.documentElement.appendChild(detached.body),detached.defaultView=globalThis,detached.nodeType=9,detached}function attachOwnerDocument(node,ownerDocument){node.ownerDocument=ownerDocument;for(const child of node.children)attachOwnerDocument(child,ownerDocument)}function katanaDetachChild(child){const parent=child?.parentNode;parent&&(function katanaReplaceChildList(parent,children){parent.children=children,parent.childNodes=children}(parent,function katanaChildList(parent){return[parent.children,parent.childNodes,[]].find(Array.isArray)}(parent).filter(candidate=>candidate!==child)),child.parentNode=null)}function katanaAdoptChild(parent,child){child.parentNode=parent,child.ownerDocument=parent.ownerDocument??parent}function katanaDocumentPath(node){const path=[];let current=node;for(;current?.parentNode;)path.unshift(current.parentNode.children.indexOf(current)),current=current.parentNode;return path}document.documentElement=document.createElement("html"),document.head=document.createElement("head"),document.body=document.createElement("body"),document.documentElement.appendChild(document.head),document.documentElement.appendChild(document.body),document.defaultView=globalThis,globalThis.document=document,globalThis.Element=KatanaNode,globalThis.HTMLElement=KatanaNode,globalThis.SVGElement=KatanaNode,globalThis.Node=KatanaNode,globalThis.Node.ELEMENT_NODE=1,globalThis.Node.TEXT_NODE=3,globalThis.Node.DOCUMENT_NODE=9,globalThis.Node.DOCUMENT_FRAGMENT_NODE=11,globalThis.DocumentFragment=KatanaNode,globalThis.HTMLTemplateElement=KatanaNode,globalThis.HTMLFormElement=KatanaNode,globalThis.HTMLButtonElement=KatanaNode,globalThis.HTMLCanvasElement=KatanaNode,globalThis.HTMLFieldSetElement=KatanaNode,globalThis.HTMLIFrameElement=KatanaNode,globalThis.HTMLImageElement=KatanaNode,globalThis.HTMLInputElement=KatanaNode,globalThis.HTMLLabelElement=KatanaNode,globalThis.HTMLLegendElement=KatanaNode,globalThis.HTMLSelectElement=KatanaNode,globalThis.HTMLTextAreaElement=KatanaNode,globalThis.HTMLVideoElement=KatanaNode,globalThis.SVGImageElement=KatanaNode,globalThis.NamedNodeMap=Array,globalThis.NodeFilter={SHOW_ELEMENT:1,SHOW_TEXT:4,SHOW_COMMENT:128},globalThis.MutationObserver=class{constructor(callback){this.callback=callback}observe(){}disconnect(){}takeRecords(){return[]}},globalThis.trustedTypes={createPolicy:()=>({createHTML:value=>String(value),createScriptURL:value=>String(value)})},globalThis.TextEncoder=class{encode(value){return new Uint8Array(Array.from(String(value)).flatMap(char=>function katanaUtf8Bytes(char){const code=char.charCodeAt(0);return code<128?[code]:function katanaMultibyteUtf8Bytes(code){return code<2048?[192|code>>6,128|63&code]:[224|code>>12,128|code>>6&63,128|63&code]}(code)}(char)))}},globalThis.TextDecoder=class{decode(value){return Array.from(value).map(byte=>String.fromCharCode(byte)).join("")}},globalThis.structuredClone=value=>JSON.parse(JSON.stringify(value)),globalThis.XMLSerializer=class{serializeToString(node){return node.outerHTML??""}},globalThis.DOMParser=class{parseFromString(source){const parsed=parseInnerHtml(String(source).trim(),!0),detached=createDetachedDocument(),root=parsed[0]??detached.createElement("xml");return attachOwnerDocument(root,detached),detached.documentElement=root,detached.body=root,detached}},KatanaNode.prototype.appendChild=function appendChild(child){return child.nodeType===Node.DOCUMENT_FRAGMENT_NODE?function katanaAppendFragment(parent,fragment){const nodes=[...fragment.childNodes];for(const node of nodes)parent.appendChild(node);return fragment}(this,child):(katanaDetachChild(child),katanaAdoptChild(this,child),this.children.push(child),this.childNodes=this.children,child)},KatanaNode.prototype.insertBefore=function insertBefore(child,reference){return child.nodeType===Node.DOCUMENT_FRAGMENT_NODE?function katanaInsertFragmentBefore(parent,fragment,reference){for(const node of fragment.childNodes)parent.insertBefore(node,reference);return fragment}(this,child,reference):function katanaInsertNodeBefore(parent,child,reference){return child===reference?child:function katanaInsertDetachedNodeBefore(parent,child,reference){return katanaDetachChild(child),katanaAdoptChild(parent,child),function katanaInsertAtReference(parent,child,reference){const index=parent.children.indexOf(reference);index<0?parent.children.push(child):parent.children.splice(index,0,child)}(parent,child,reference),parent.childNodes=parent.children,child}(parent,child,reference)}(this,child,reference)},KatanaNode.prototype.removeChild=function removeChild(child){return this.children=this.children.filter(candidate=>candidate!==child),this.childNodes=this.children,child.parentNode=null,child},Object.defineProperty(KatanaNode.prototype,"firstElementChild",{get(){return this.children.find(child=>child.nodeType===Node.ELEMENT_NODE)??null}}),KatanaNode.prototype.compareDocumentPosition=function compareDocumentPosition(other){return this===other?0:function katanaComparePath(left,right){const mismatch=function katanaFirstPathMismatch(left,right){return function katanaPathIndexes(left,right){return Array.from({length:Math.min(left.length,right.length)},(_value,index)=>index)}(left,right).find(index=>left[index]!==right[index])??null}(left,right);return null!==mismatch?function katanaPathMismatchPosition(left,right,index){return left[index]<right[index]?4:2}(left,right,mismatch):function katanaPathLengthPosition(left,right){return left.length===right.length?0:function katanaUnequalPathLengthPosition(left,right){return left.length<right.length?20:10}(left,right)}(left,right)}(katanaDocumentPath(this),katanaDocumentPath(other))},Node.DOCUMENT_POSITION_DISCONNECTED=1,Node.DOCUMENT_POSITION_PRECEDING=2,Node.DOCUMENT_POSITION_FOLLOWING=4,Node.DOCUMENT_POSITION_CONTAINS=8,Node.DOCUMENT_POSITION_CONTAINED_BY=16;const KATANA_HIDDEN_LAYOUT_TAGS=new Set(["style","script","defs","marker","lineargradient","radialgradient","stop","filter","fedropshadow","clippath","mask","pattern"]);function katanaOwnText(node){return String(node?._textContent??"")}function katanaTextContent(node){return node?`${katanaOwnText(node)}${function katanaTextContentChildren(node){return(node.children??[]).map(child=>katanaTextContent(child)).join("")}(node)}`:""}function katanaLayoutTextContent(node){return katanaIsHiddenLayoutNode(node)?"":`${katanaOwnText(node)}${function katanaLayoutTextChildren(node){return(node.children??[]).map(child=>katanaLayoutTextContent(child)).join("")}(node)}`}function katanaIsHiddenLayoutNode(node){return[!node,KATANA_HIDDEN_LAYOUT_TAGS.has(node?.localName)].includes(!0)}function katanaNodeValue(value){return value instanceof KatanaNode?value:document.createTextNode(function katanaStringValue(value){return String(value??"")}(value))}function katanaNumberAttr(node,name){return function katanaNullableNumber(rawValue){return function katanaHasNumberValue(rawValue){return![null,void 0,""].includes(rawValue)}(rawValue)?function katanaFiniteNumber(value){return Number.isFinite(value)?value:null}(Number(rawValue)):null}(node?.getAttribute?.(name))}function katanaBox(x,y,width,height){return{x:x,y:y,width:width,height:height,w:width,h:height}}function katanaUnionBox(boxes){if(0===boxes.length)return katanaBox(0,0,0,0);const minX=Math.min(...boxes.map(box=>box.x)),minY=Math.min(...boxes.map(box=>box.y));return katanaBox(minX,minY,Math.max(...boxes.map(box=>box.x+box.width))-minX,Math.max(...boxes.map(box=>box.y+box.height))-minY)}function katanaVisibleChildBoxes(node){return(node.children??[]).filter(child=>!KATANA_HIDDEN_LAYOUT_TAGS.has(child.localName)).map(child=>{const box=child.getBBox(),offset=function katanaNodeTranslate(node){const match=function katanaTransformValue(node){return String(node?.getAttribute?.("transform")??"")}(node).match(/translate\\(([-\\d.]+)[,\\s]+([-\\d.]+)\\)/);return match?[Number(match[1]),Number(match[2])]:[0,0]}(child);return katanaBox(box.x+offset[0],box.y+offset[1],box.width,box.height)})}function katanaExplicitMeasuredBox(node){const attrs=function katanaBoxAttributes(node){return{x:katanaNumberAttrOrDefault(node,"x",0),y:katanaNumberAttrOrDefault(node,"y",0),width:katanaNumberAttrOrDefault(node,"width",0),height:katanaNumberAttrOrDefault(node,"height",0)}}(node);return[attrs.width>0,attrs.height>0].includes(!0)?katanaBox(attrs.x,attrs.y,attrs.width,attrs.height):null}function katanaNumberAttrOrDefault(node,name,fallback){const value=katanaNumberAttr(node,name);return null===value?fallback:value}function katanaMeasuredNodeText(node,childBox){return katanaOwnText(node)||function katanaFallbackLayoutText(node,childBox){return 0===childBox.width?katanaLayoutTextContent(node):""}(node,childBox)}function katanaLineBox(node){return"line"!==node.localName?null:function katanaLineShapeBox(node){const x1=katanaNumberAttrOrDefault(node,"x1",0),y1=katanaNumberAttrOrDefault(node,"y1",0),x2=katanaNumberAttrOrDefault(node,"x2",0),y2=katanaNumberAttrOrDefault(node,"y2",0);return katanaBox(Math.min(x1,x2),Math.min(y1,y2),Math.abs(x2-x1),Math.abs(y2-y1))}(node)}function katanaCircleBox(node){return function katanaIsRoundSvgShape(node){return["circle","ellipse"].includes(node.localName)}(node)?function katanaRoundShapeBox(node){const cx=katanaNumberAttrOrDefault(node,"cx",0),cy=katanaNumberAttrOrDefault(node,"cy",0),rx=katanaRoundRadius(node,"rx"),ry=katanaRoundRadius(node,"ry");return katanaBox(cx-rx,cy-ry,2*rx,2*ry)}(node):null}function katanaRoundRadius(node,name){return katanaNumberAttr(node,name)??katanaNumberAttrOrDefault(node,"r",0)}const KATANA_DEFAULT_CLIENT_TAGS=new Set(["body","div","main","pre","section","article"]);function katanaExplicitClientWidth(node){return katanaCssLength(node.style?.getPropertyValue?.("width"))??katanaNumberAttr(node,"width")}function katanaExplicitClientHeight(node){return katanaCssLength(node.style?.getPropertyValue?.("height"))??katanaNumberAttr(node,"height")}function katanaDefaultViewportWidth(){return Number(globalThis.innerWidth??globalThis.screen?.width??800)}function katanaDefaultViewportHeight(){return Number(globalThis.innerHeight??globalThis.screen?.height??600)}function katanaNeedsDefaultClientBox(node){return[KATANA_DEFAULT_CLIENT_TAGS.has(node.localName),katanaHasSvgChild(node)].includes(!0)}function katanaCssLength(value){return value?function katanaFiniteCssLength(value){const number=Number(String(value).replace("px",""));return Number.isFinite(number)?number:null}(value):null}function katanaHasSvgChild(node){return(node.children??[]).some(child=>"svg"===child.localName)}function katanaNodeChildren(node){return node.children??[]}function katanaInnerText(node){return node?"br"===node.localName?"\\n":katanaIsHiddenLayoutNode(node)?"":`${katanaOwnText(node)}${katanaNodeChildren(node).map(katanaInnerText).join("")}`:""}function katanaElementClientBox(node){return function katanaMeasuredClientBox(node){const context=function katanaClientBoxContext(node){return{node:node,box:node.getBBox(),explicitWidth:katanaExplicitClientWidth(node),explicitHeight:katanaExplicitClientHeight(node)}}(node);return function katanaDefaultExplicitZeroBox(context){return[katanaNeedsDefaultClientBox(context.node),0===context.explicitWidth].every(Boolean)?katanaBox(0,0,katanaDefaultViewportWidth(),function katanaPositiveOrDefault(value,fallback){return value>0?value:fallback}(context.explicitHeight,katanaDefaultViewportHeight())):null}(context)??function katanaExplicitClientBox(context){return function katanaHasExplicitClientSize(context){return[null!==context.explicitWidth,null!==context.explicitHeight].includes(!0)}(context)?function katanaResolvedExplicitClientBox(context){return katanaBox(context.box.x,context.box.y,function katanaExplicitWidthValue(context){return context.explicitWidth??context.box.width}(context),function katanaExplicitHeightValue(context){return context.explicitHeight??context.box.height}(context))}(context):null}(context)??function katanaSvgClientBox(context){return"svg"===context.node.localName?function katanaSvgViewBoxClientBox(context){const viewBox=function katanaViewBoxSize(value){const values=function katanaViewBoxValues(value){return String(value??"").split(/\\s+/).map(it=>Number(it))}(value);return function katanaIsValidViewBox(values){return[4===values.length,values.every(it=>Number.isFinite(it))].every(Boolean)}(values)?[values[2],values[3]]:null}(context.node.getAttribute("viewBox"));return katanaBox(context.box.x,context.box.y,function katanaViewBoxWidth(context,viewBox){return viewBox?.[0]??Math.max(context.box.width,katanaDefaultViewportWidth())}(context,viewBox),function katanaViewBoxHeight(context,viewBox){return viewBox?.[1]??Math.max(context.box.height,katanaDefaultViewportHeight())}(context,viewBox))}(context):null}(context)??function katanaEmptyDefaultClientBox(context){return[katanaNeedsDefaultClientBox(context.node),(box=context.box,[0===box.width,0===box.height].every(Boolean))].every(Boolean)?katanaBox(0,0,katanaDefaultViewportWidth(),katanaDefaultViewportHeight()):null;var box}(context)??context.box}(node)}function katanaCssComputedStyleValue(node,name){return node?function katanaCssRuleValue(cssText,node,name){return Array.from(cssText.matchAll(/([^{}]+)\\{([^{}]+)\\}/g)).map(rule=>function katanaCssRuleDeclarationValue(rule,node,name){return[rule].filter(it=>function katanaCssRuleMatchesNode(selectorText,node){return selectorText.split(",").some(selector=>function katanaCssSelectorMatchesNode(node,selector){const parts=String(selector).trim().split(/\\s+/).filter(Boolean);return 0!==parts.length&&katanaCssSelectorTailMatches(node,parts,parts.length-1)}(node,selector))}(it[1],node)).map(it=>function katanaCssDeclarationValue(declarations,name){return String(declarations).split(";").map(declaration=>function katanaCssDeclarationEntry(declaration){const parts=String(declaration).split(":");return{name:String(parts.shift()??"").trim(),value:parts.join(":").trim()}}(declaration)).find(entry=>entry.name===name)?.value??""}(it[2],name))[0]??""}(rule,node,name)).filter(Boolean).at(-1)??""}(function katanaCssText(node){const root=function katanaCssRoot(node){return katanaCssRootNode(node)||document.documentElement}(node);return function katanaCssStyleNodes(root){return function katanaCssDescendantNodes(node){return[node].filter(Boolean).flatMap(katanaCssNodeWithDescendants)}(root).filter(katanaIsCssStyleNode)}(root).map(styleNode=>styleNode.textContent).join("\\n")}(node),node,name):""}function katanaCssRootNode(node){return KATANA_CSS_ROOT_READERS[Number(Boolean(katanaCssParentNode(node)))](node)}function katanaCssParentNode(node){return node?.parentNode||null}function katanaCssNodeWithDescendants(node){return[node].concat(Array.from(node.children||[]).flatMap(katanaCssNodeWithDescendants))}function katanaIsCssStyleNode(node){return"style"===node.localName}Object.defineProperty(KatanaNode.prototype,"textContent",{get(){return katanaTextContent(this)},set(value){this._textContent=String(value??""),this.children=[],this.childNodes=this.children}}),Object.defineProperty(KatanaNode.prototype,"innerText",{get(){return katanaInnerText(this)},set(value){this.textContent=value}}),Object.defineProperty(KatanaNode.prototype,"nodeValue",{get(){return 3===this.nodeType?this.textContent:null},set(value){3===this.nodeType&&(this.textContent=value)}}),KatanaNode.prototype.append=function append(...values){for(const value of values)this.appendChild(katanaNodeValue(value))},KatanaNode.prototype.prepend=function prepend(...values){for(const value of values.reverse())this.insertBefore(katanaNodeValue(value),this.firstChild)},KatanaNode.prototype.replaceChildren=function replaceChildren(...values){this.children=[],this.childNodes=this.children,this.append(...values)},KatanaNode.prototype.contains=function contains(candidate){return this===candidate||katanaNodeChildren(this).some(child=>child.contains(candidate))},KatanaNode.prototype.text=function text(...values){return 0===values.length?this.textContent:(this.textContent=values[0],this)},KatanaNode.prototype.getBBox=function getBBox(){return function katanaMeasuredBox(node){return KATANA_HIDDEN_LAYOUT_TAGS.has(node.localName)?katanaBox(0,0,0,0):function katanaVisibleMeasuredBox(node){return katanaExplicitMeasuredBox(node)??function katanaDirectShapeBox(node){return katanaLineBox(node)??katanaCircleBox(node)}(node)??function katanaChildTextMeasuredBox(node){const childBox=katanaUnionBox(katanaVisibleChildBoxes(node)),text=katanaMeasuredNodeText(node,childBox);return katanaBox(0,0,function katanaMeasuredTextWidth(text,childBox){return Math.max(16,function katanaTextWidthFallback(text){return 0===text.length?0:Math.max(16,katanaTextWidth(text))}(text),childBox.width)}(text,childBox),function katanaMeasuredTextHeight(text,childBox){return Math.max(24,function katanaTextHeightFallback(text){return 0===text.length?0:24}(text),childBox.height)}(text,childBox))}(node)}(node)}(this)},KatanaNode.prototype.getBoundingClientRect=function getBoundingClientRect(){const box=katanaElementClientBox(this);return{...box,top:box.y,left:box.x,right:box.x+box.width,bottom:box.y+box.height}},KatanaNode.prototype.getComputedTextLength=function getComputedTextLength(){if("block"===globalThis.__katanaMermaidDiagramType){const text=katanaTextContent(this);if(/^\\u00a0+$/.test(text))return Math.max(16,8*text.replace(/\\u00a0/g,"&nbsp;").length)}return Math.max(16,8*katanaTextContent(this).length)},KatanaNode.prototype.getScreenCTM=function getScreenCTM(){return{a:1,b:0,c:0,d:1,e:0,f:0,inverse:()=>this.getScreenCTM()}},KatanaNode.prototype.createSVGPoint=function createSVGPoint(){return{x:0,y:0,matrixTransform(){return{x:this.x,y:this.y}}}},Object.defineProperties(KatanaNode.prototype,{clientWidth:{get(){return Math.ceil(katanaElementClientBox(this).width)}},clientHeight:{get(){return Math.ceil(katanaElementClientBox(this).height)}},offsetWidth:{get(){return Math.ceil(katanaElementClientBox(this).width)}},offsetHeight:{get(){return Math.ceil(katanaElementClientBox(this).height)}},scrollWidth:{get(){return Math.ceil(katanaElementClientBox(this).width)}},scrollHeight:{get(){return Math.ceil(katanaElementClientBox(this).height)}}});const KATANA_CSS_ROOT_READERS=[node=>node,node=>katanaCssRootNode(katanaCssParentNode(node))];function katanaCssSelectorTailMatches(node,parts,index){return!(!node||!function katanaCssSimpleSelectorMatches(node,selector){const normalized=function katanaCssSimpleSelector(selector){return String(selector).trim().replace(/:{1,2}(?!root\\b)[a-zA-Z-]+(?:\\([^)]*\\))?/g,"")}(selector);return"*"===normalized||(":root"===normalized?node===document.documentElement:[katanaCssSelectorTagMatches(node,normalized),katanaCssSelectorIdMatches(node,normalized),katanaCssSelectorClassesMatch(node,normalized),katanaCssSelectorAttributesMatch(node,normalized)].every(Boolean))}(node,parts[index]))&&(0===index||katanaCssAncestorMatches(node.parentNode,parts,index-1))}function katanaCssAncestorMatches(node,parts,index){return!!node&&(!!katanaCssSelectorTailMatches(node,parts,index)||katanaCssAncestorMatches(node.parentNode,parts,index))}function katanaCssSelectorTagMatches(node,selector){const tag=selector.match(/^[a-zA-Z][a-zA-Z0-9:_-]*/)?.[0];return!tag||node.localName===tag.toLowerCase()}function katanaCssSelectorIdMatches(node,selector){const id=selector.match(/#([a-zA-Z0-9_-]+)/)?.[1];return!id||node.id===id}function katanaCssSelectorClassesMatch(node,selector){const classNames=String(node.className??"").split(/\\s+/).filter(Boolean);return Array.from(selector.matchAll(/\\.([a-zA-Z0-9_-]+)/g)).map(match=>match[1]).every(className=>classNames.includes(className))}function katanaCssSelectorAttributesMatch(node,selector){return Array.from(selector.matchAll(/\\[([a-zA-Z0-9:_-]+)(?:="([^"]*)")?\\]/g)).map(match=>function katanaCssSelectorAttributeMatches(node,name,value){const actual=node.getAttribute?.(name);return void 0===value?null!==actual:actual===value}(node,match[1],match[2])).every(Boolean)}function katanaComputedFontSize(node){return katanaComputedStyleValue(node,"font-size")||"16px"}function katanaComputedFontFamily(node){return katanaComputedStyleValue(node,"font-family")||"trebuchet ms, verdana, arial, sans-serif"}function katanaComputedStyleValue(node,name){return[katanaRawComputedStyleValue(node,name),katanaCssComputedStyleValue(node,name)].filter(Boolean).concat([katanaDefaultComputedStyleValue(name)])[0]??""}function katanaRawComputedStyleValue(node,name){return node?.style?.getPropertyValue?.(name)??""}function katanaDefaultComputedStyleValue(name){return/^(padding|margin|border).*/.test(name)?"0px":""}function katanaOptionalTextBox(node,text){return text?katanaAnchoredTextNodeBox(node,text,0,0):katanaBox(0,0,0,0)}function katanaHasArea(box){return[box.width>0,box.height>0].includes(!0)}function katanaOptionalNumberListBox(value){return value?function katanaNumberListBox(value){const numbers=Array.from(String(value).matchAll(/-?\\d+(?:\\.\\d+)?(?:e-?\\d+)?/gi)).map(match=>Number(match[0]));if(numbers.length<2)return null;const xs=numbers.filter((_value,index)=>index%2==0),ys=numbers.filter((_value,index)=>index%2==1);return katanaBox(Math.min(...xs),Math.min(...ys),Math.max(...xs)-Math.min(...xs),Math.max(...ys)-Math.min(...ys))}(value):null}function katanaLineValueOrDefault(value,fallback){return value??fallback}function katanaTextLines(node){return function katanaTextTspans(node){return function katanaDescendantElements(node,tagName){return Array.from(node.children).flatMap(child=>katanaDescendantElement(child,tagName))}(node,"tspan").filter(child=>katanaTextContent(child).length>0).filter(child=>!function katanaHasTextTspanAncestor(child,root){return function katanaTextTspanAncestors(child,root){return katanaTextTspanAncestorList(child.parentNode,root)}(child,root).some(katanaIsFilledTextTspan)}(child,node))}(node).reduce(katanaAppendTextLine,{lines:[],current:null}).lines}function katanaTextTspanAncestorList(node,root){return KATANA_TEXT_TSPAN_ANCESTOR_READERS[Number(function katanaHasTextAncestorNode(node,root){return Boolean(node)&&node!==root}(node,root))](node,root)}function katanaIsFilledTextTspan(node){return["tspan"===node.localName,katanaTextContent(node).length>0].every(Boolean)}function katanaAppendTextLine(state,tspan,index){const next=function katanaTextLineState(state,tspan,index){return KATANA_TEXT_LINE_STATE_READERS[Number(function katanaStartsTextLine(tspan,index){return[0===index,tspan.hasAttribute("x"),Math.abs(katanaSvgTextLengthAttr(tspan,"dy")??0)>=1].includes(!0)}(tspan,index))](state,tspan)}(state,tspan,index);return next.current.text+=katanaTextContent(tspan),next}function katanaTspanLineY(tspan){const values=[katanaSvgTextLengthAttr(tspan,"y"),katanaSvgTextLengthAttr(tspan,"dy")];return KATANA_TSPAN_LINE_Y_READERS[Number(values.some(katanaIsSvgTextLengthValue))](values)}function katanaIsSvgTextLengthValue(value){return null!==value}function katanaSvgTextLengthAttr(node,name){return[String(node.getAttribute?.(name)??"")].filter(Boolean).map(raw=>function katanaSvgTextLengthValue(node,raw){return[raw.match(/^(-?\\d+(?:\\.\\d+)?)([a-z%]*)$/i)].filter(Boolean).map(match=>function katanaSvgTextLengthMatchValue(node,match){return[Number(match[1])].filter(Number.isFinite).map(value=>function katanaSvgTextLengthPixels(node,value,unit){return(KATANA_SVG_TEXT_LENGTH_UNITS[unit]??KATANA_SVG_TEXT_LENGTH_UNITS.px)(node,value)}(node,value,match[2])).concat([null])[0]}(node,match)).concat([null])[0]}(node,raw)).concat([null])[0]}function katanaDescendantElement(child,tagName){return[katanaMatchingDescendantElement(child,tagName)].filter(Boolean).concat(Array.from(child.children).flatMap(node=>katanaDescendantElement(node,tagName)))}function katanaMatchingDescendantElement(child,tagName){return[child].filter(node=>node.localName===tagName)[0]??null}globalThis.getComputedStyle=node=>function katanaComputedStyle(node){const box=function katanaComputedStyleBox(node){return node?katanaElementClientBox(node):katanaBox(0,0,0,0)}(node);return{width:`${box.width}px`,height:`${box.height}px`,display:"block",fontSize:katanaComputedFontSize(node),fontFamily:katanaComputedFontFamily(node),getPropertyValue(name){return function katanaComputedPropertyValue(node,style,name){return katanaComputedStyleValue(node,name)||style[name]||""}(node,this,name)}}}(node),KatanaNode.prototype.getBBox=function getBBox(){return function katanaMeasuredBoxAccurate(node){return KATANA_HIDDEN_LAYOUT_TAGS.has(node.localName)?katanaBox(0,0,0,0):function katanaVisibleMeasuredBoxAccurate(node){return function katanaTextElementMeasuredBox(node){return"text"===node.localName?function katanaTextElementBox(node){const lines=katanaTextLines(node),text=function katanaTextElementText(node,lines){return 0===lines.length?katanaTextContent(node):lines.map(line=>line.text).join("")}(node,lines);return text?katanaUnionBox(function katanaTextLineValues(node,text,lines){return 0===lines.length?[{text:text,x:katanaNumberAttr(node,"x"),y:katanaNumberAttr(node,"y")}]:lines}(node,text,lines).map((line,index)=>function katanaTextLineBox(node,line,index){const x=katanaLineValueOrDefault(line.x,katanaNumberAttrOrDefault(node,"x",0)),y=katanaLineValueOrDefault(line.y,function katanaTextLineFallbackY(node,index){return(katanaNumberAttr(node,"y")??0)+index*katanaLineHeight(node)}(node,index));return katanaAnchoredTextNodeBox(node,line.text,x,y)}(node,line,index))):katanaBox(0,0,0,0)}(node):null}(node)??function katanaTextFragmentMeasuredBox(node){return["tspan","#text"].includes(node.localName)?function katanaTextFragmentBox(node){const text=function katanaFragmentText(node){return[katanaOwnText(node),katanaTextContent(node)].find(Boolean)??""}(node);return text?katanaAnchoredTextNodeBox(function katanaTextFragmentParent(node){return node.parentNode??node}(node),text,katanaNumberAttrOrDefault(node,"x",0),katanaNumberAttrOrDefault(node,"y",0)):katanaBox(0,0,0,0)}(node):null}(node)??katanaExplicitMeasuredBox(node)??function katanaDirectMeasuredBox(node){return katanaLineBox(node)??katanaCircleBox(node)??function katanaPathBox(node){return function katanaSvgPathBox(node){return"path"===node.localName?katanaOptionalNumberListBox(node.getAttribute("d")):null}(node)??function katanaSvgPointsBox(node){return["polygon","polyline"].includes(node.localName)?katanaOptionalNumberListBox(node.getAttribute("points")):null}(node)}(node)}(node)??function katanaChildTextBox(node){const childBox=katanaUnionBox(katanaVisibleChildBoxes(node));return katanaUnionBox([childBox,katanaOptionalTextBox(node,katanaMeasuredNodeText(node,childBox))].filter(katanaHasArea))}(node)}(node)}(this)};const KATANA_TEXT_TSPAN_ANCESTOR_READERS=[()=>[],(node,root)=>[node].concat(katanaTextTspanAncestorList(node.parentNode,root))],KATANA_TEXT_LINE_STATE_READERS=[state=>state,(state,tspan)=>function katanaStartTextLine(state,tspan){const line={text:"",x:katanaNumberAttr(tspan,"x"),y:katanaTspanLineY(tspan)};return{lines:[...state.lines,line],current:line}}(state,tspan)];function katanaOptionalSvgTextLength(value){return[value].filter(katanaIsSvgTextLengthValue).concat([0])[0]}const KATANA_TSPAN_LINE_Y_READERS=[()=>null,values=>function katanaSumTspanLineY(values){return katanaOptionalSvgTextLength(values[0])+katanaOptionalSvgTextLength(values[1])}(values)],KATANA_SVG_TEXT_LENGTH_UNITS={em:(node,value)=>value*katanaFiniteFontSize(Number(String(katanaLineHeightFontSize(node)).replace("px",""))),px:(_node,value)=>value},KATANA_ASCII_KERNING_PAIRS={\'"T\':-2.805,"n\'":-.993,"\'t":-.985,"\'w":-.984,"<<":.781,">>":.781,"E]":-2.117,"M]":-2.118,"P]":-2.125,Pa:-.75,Pe:-.743,Ph:-.742,Po:-.742,Pr:-.75,Re:-.649,Ro:-.649,Ta:-1.992,Te:-1.985,Ti:-.665,To:-1.984,Tu:-2.062,Tw:-2.211,Ty:-1.836,Ve:-1.031,Wa:-.883,We:-.735,Ye:-1.68,Yo:-1.836,"e\'":-.993,"e,":-2.118,"e?":-2.118,"k,":-2.117,"n,":-2.117,"p;":-2.117,\'s"\':-2.805,"s,":-2.118,"t!":-2.125,"u!":-2.117,"u?":-2.117,"v.":-2.149,"y?":-2.125,"y]":-2.125},KATANA_ASCII_TEXT_WIDTHS={" ":4.82,"\'":3.547,$:8.391,"(":5.875,")":5.875,"-":5.875,".":5.875,":":5.875,0:8.391,1:8.391,2:8.391,3:8.391,4:8.391,5:8.391,6:8.391,7:8.391,8:8.391,9:8.391,A:9.438,B:9.055,C:9.57,D:9.813,E:8.57,F:8.398,G:10.82,H:10.469,I:4.453,J:7.625,K:9.211,L:8.102,M:11.352,N:10.211,O:10.781,P:8.922,Q:10.813,R:9.313,S:7.695,T:9.289,U:10.375,V:9.398,W:13.633,X:8.906,Y:9.125,Z:8.805,_:8.391,a:8.406,b:8.914,c:7.922,d:8.914,e:8.727,f:5.914,g:8.031,h:8.742,i:4.563,j:5.867,k:8.07,l:4.719,m:13.281,n:8.742,o:8.586,p:8.914,q:8.914,r:6.219,s:6.477,t:6.344,u:8.742,v:7.836,w:11.906,x:8.016,y:7.891,z:7.594};function katanaAnchoredTextNodeBox(node,text,x,y){const width=Math.max(1,katanaTextNodeWidth(node,text)),height=katanaLineHeight(node);return katanaBox(function katanaAnchoredTextLeft(anchor,x,width){return(KATANA_TEXT_ANCHORS[anchor]??KATANA_TEXT_ANCHORS.start)(x,width)}(function katanaTextAnchor(node){return String(function katanaTextAnchorValues(node){return[node.getAttribute?.("text-anchor"),node.style?.getPropertyValue?.("text-anchor"),katanaCssComputedStyleValue(node,"text-anchor"),node.parentNode?.getAttribute?.("text-anchor"),katanaCssComputedStyleValue(node.parentNode,"text-anchor")]}(node).find(Boolean)??"start")}(node),x,width),y-height*function katanaTextBoxBaselineRatio(){return KATANA_TEXT_BOX_BASELINE_RATIOS[Number(katanaIsRequirementDiagram())]()}(),width,height)}const KATANA_TEXT_ANCHORS={end:(x,width)=>x-width,middle:(x,width)=>x-width/2,start:x=>x};function katanaLineHeight(node){return function katanaBrowserTextBoxHeight(fontSize){const measured=KATANA_TEXT_BOX_HEIGHTS[String(fontSize)];return measured||Math.max(12,Math.ceil(1.15*fontSize))}(katanaFiniteFontSize(Number(String(katanaLineHeightFontSize(node)).replace("px",""))))}const KATANA_TEXT_BOX_HEIGHTS={10:11,11:12.25,12:14,14:16,16:19,18:21,20:23};function katanaLineHeightFontSize(node){return function katanaLineHeightFontSizeValues(node){return[node.style?.getPropertyValue?.("font-size"),katanaCssComputedStyleValue(node,"font-size"),node.getAttribute?.("font-size"),node.parentNode?.style?.getPropertyValue?.("font-size"),katanaCssComputedStyleValue(node.parentNode,"font-size"),node.parentNode?.getAttribute?.("font-size")]}(node).find(Boolean)??"16"}function katanaFiniteFontSize(fontSize){return Number.isFinite(fontSize)?fontSize:16}function katanaTextNodeWidth(node,text){return katanaTextWidth(text)*function katanaTextWidthScale(node){return katanaFiniteFontSize(Number(String(katanaLineHeightFontSize(node)).replace("px","")))/16*function katanaTextWeightScale(node){return KATANA_TEXT_WEIGHT_SCALES[Number([katanaIsRequirementDiagram(),katanaHasBoldTextWeight(node)].every(Boolean))]()}(node)}(node)}function katanaHasBoldTextWeight(node){return function katanaTextWeightValues(node){return[node.style?.getPropertyValue?.("font-weight"),katanaCssComputedStyleValue(node,"font-weight"),node.getAttribute?.("font-weight"),node.parentNode?.style?.getPropertyValue?.("font-weight"),katanaCssComputedStyleValue(node.parentNode,"font-weight"),node.parentNode?.getAttribute?.("font-weight")]}(node).some(katanaIsBoldTextWeight)}function katanaIsBoldTextWeight(value){const normalized=String(value??"").trim().toLowerCase();return"bold"===normalized||Number(normalized)>=600}function katanaTextWidth(text){const chars=Array.from(katanaMeasuredTextValue(text));return chars.map(char=>function katanaCharacterWidth(char){return KATANA_CHARACTER_WIDTHS[Number(char.charCodeAt(0)>255)](char)}(char)).reduce((width,charWidth)=>width+charWidth,0)+function katanaTextKerningWidth(chars){return chars.slice(0,-1).map((char,index)=>function katanaKerningPairWidth(left,right){return KATANA_KERNING_PAIR_WIDTH_READERS[Number(function katanaHasWideKerningChar(left,right){return[left,right].some(katanaIsWideTextChar)}(left,right))](left,right)}(char,chars[index+1])).reduce((width,pairWidth)=>width+pairWidth,0)}(chars)}function katanaMeasuredTextValue(text){return"block"===globalThis.__katanaMermaidDiagramType?String(text):String(text).replace(/&(?:amp;)?nbsp;|&#160;/g," ")}function katanaIsWideTextChar(char){return char.charCodeAt(0)>255}const KATANA_WIDE_CHARACTER_WIDTHS=[function katanaDefaultWideCharacterWidth(char){return function katanaIsWidePunctuation(char){return["。","、"].includes(char)}(char)?20:KATANA_DEFAULT_WIDE_CHARACTER_WIDTHS[Number(function katanaIsCjkIdeograph(char){const codePoint=function katanaCharacterCodePoint(char){return char.codePointAt(0)??0}(char);return KATANA_CJK_IDEOGRAPH_RULES.every(rule=>rule(codePoint))}(char))]()},()=>12.5],KATANA_DEFAULT_WIDE_CHARACTER_WIDTHS=[()=>15.8,()=>16.3],KATANA_CJK_IDEOGRAPH_RULES=[function katanaIsCjkIdeographStart(codePoint){return codePoint>=19968},function katanaIsCjkIdeographEnd(codePoint){return codePoint<=40959}],KATANA_CHARACTER_WIDTHS=[function katanaAsciiCharacterWidth(char){return 160===char.charCodeAt(0)?KATANA_ASCII_TEXT_WIDTHS[" "]:[KATANA_ASCII_TEXT_WIDTHS[char]].filter(Boolean).concat([8])[0]},function katanaWideCharacterWidth(char){return KATANA_WIDE_CHARACTER_WIDTHS[Number("kanban"===globalThis.__katanaMermaidDiagramType)](char)}],KATANA_KERNING_PAIR_WIDTH_READERS=[(left,right)=>KATANA_ASCII_KERNING_PAIRS[`${left}${right}`]??0,()=>0],KATANA_TEXT_WEIGHT_SCALES=[()=>1,()=>1.055],KATANA_TEXT_BOX_BASELINE_RATIOS=[()=>.8,()=>.8421052631578947];function katanaIsRequirementDiagram(){return["requirement","requirementdiagram"].includes(globalThis.__katanaMermaidDiagramType)}function katanaDrawioLocaleDate(){return this.toISOString().slice(0,10)}function katanaDrawioClasses(node){return String(node.className||"").split(/\\s+/).filter(Boolean)}function katanaSetDrawioClasses(node,values){node.setAttribute("class",Array.from(new Set(values)).join(" "))}function katanaDrawioNodeNamespace(node){return String(node.namespaceURI||"")}function katanaDrawioNodeLocalName(node){return String(node.localName||"").toLowerCase()}function katanaDrawioResourceResponse(resources,url){const path=katanaDrawioResourcePath(url),resource=resources.get(path);return function katanaTrackDrawioMissingResource(resource,path){resource||globalThis.__katanaDrawioMissingResources.push(path)}(resource,path),function katanaDrawioResponseForResource(resource){return{getStatus:()=>function katanaDrawioResourceStatus(resource){return resource?200:404}(resource),getText:()=>katanaDrawioResourceContent(resource),getXml:()=>(new DOMParser).parseFromString(katanaDrawioResourceContent(resource),"text/xml"),getDocumentElement(){return this.getXml().documentElement},isReady:()=>!0}}(resource)}function katanaDrawioResourceContent(resource){return resource?function katanaDecodeDrawioResourceContent(resource){return"base64"===resource.encoding?atob(resource.content):resource.content}(resource):""}function katanaDrawioResourcePath(url){let path=String(url??"");return path=path.replace(/^https?:\\/\\/[^/]+\\//,""),path=path.replace(/^katana:\\/\\/drawio\\//,""),path=path.replace(/[?#].*$/,""),path=path.replace(/^\\/+/,""),path}function katanaDrawioCreateXmlDocument(){const detached=Object.create(document);return function katanaSetupDrawioXmlDocumentBase(detached){detached.nodeType=9,detached.documentElement=null,detached.body=null,detached.defaultView=globalThis}(detached),function katanaSetupDrawioXmlDocumentFactories(detached){detached.createElement=tagName=>katanaDrawioOwnedNode(document.createElement(tagName),detached),detached.createElementNS=(namespaceURI,tagName)=>katanaDrawioOwnedNode(document.createElementNS(namespaceURI,tagName),detached),detached.createTextNode=value=>katanaDrawioOwnedNode(document.createTextNode(value),detached),detached.createDocumentFragment=()=>katanaDrawioOwnedNode(document.createDocumentFragment(),detached),detached.importNode=(node,deep)=>katanaDrawioOwnedTree(node.cloneNode(deep),detached),detached.appendChild=child=>function katanaDrawioAppendDocumentChild(detached,child){return katanaDrawioOwnedTree(child,detached),child.parentNode=detached,detached.documentElement=child,child}(detached,child)}(detached),function katanaSetupDrawioXmlDocumentQueries(detached){detached.getElementById=id=>katanaDrawioDocumentElement(detached)?.querySelector(`#${id}`)??null,detached.getElementsByTagName=tagName=>katanaDrawioDocumentElement(detached)?.getElementsByTagName(tagName)??[]}(detached),detached}function katanaDrawioDocumentElement(detached){return detached.documentElement}function katanaDrawioOwnedNode(node,ownerDocument){return node.ownerDocument=ownerDocument,node}function katanaDrawioOwnedTree(node,ownerDocument){return katanaDrawioOwnedNode(node,ownerDocument),function katanaDrawioNodeChildren(node){return node.children?node.children:[]}(node).forEach(child=>{katanaDrawioOwnedTree(child,ownerDocument)}),node}function katanaDrawioImageResourceSrc(resource){return[resource].filter(Boolean).map(katanaDrawioDataUri).concat([""])[0]}function katanaDrawioExternalImageSrc(src){return[src].filter(katanaIsExternalDrawioImageSrc).map(()=>KATANA_DRAWIO_TRANSPARENT_IMAGE_SRC).concat([""])[0]}function katanaIsExternalDrawioImageSrc(src){return["http://","https://"].some(it=>String(src).startsWith(it))}function katanaDrawioDataUri(resource){return`data:${resource.mime_type};base64,${function katanaDrawioResourceBase64(resource){return"base64"===resource.encoding?resource.content:btoa(resource.content)}(resource)}`}KatanaNode.prototype.getComputedTextLength=function getComputedTextLength(){const lines=function katanaComputedTextLines(node){return"text"===node.localName?katanaTextLines(node).map(line=>line.text):[katanaTextContent(node)]}(this);return Math.max(1,...lines.map(line=>katanaTextNodeWidth(this,line)))},globalThis.navigator={userAgent:"KatanA Rust-managed Draw.io runtime",appName:"Netscape",language:"en-US",languages:["en-US","en"],appVersion:"KatanA",vendor:"",platform:"MacIntel",maxTouchPoints:0},globalThis.location={href:"https://viewer.diagrams.net/?offline=1&embed=1&proto=json",host:"viewer.diagrams.net",hostname:"viewer.diagrams.net",protocol:"https:",search:"?offline=1&embed=1&proto=json",hash:"",pathname:"/",toString(){return this.href}},globalThis.window.location=globalThis.location,globalThis.window.innerWidth=1280,globalThis.window.innerHeight=800,globalThis.window.top=globalThis.window,globalThis.document.referrer="",globalThis.document.location=globalThis.location,globalThis.document.compatMode="CSS1Compat",globalThis.localStorage={getItem:()=>null,setItem(){},removeItem(){}},globalThis.sessionStorage=globalThis.localStorage,globalThis.atob=function katanaDrawioAtob(value){const state={bits:0,buffer:0,output:"",stopped:!1},input=String(value).replace(/[^A-Za-z0-9+/=]/g,"");return Array.from(input).forEach(char=>{!function katanaDrawioReadBase64Char(state,code){state.stopped||function katanaDrawioApplyBase64Code(state,code){!function katanaDrawioStopsBase64(code){return[code<0,64===code].some(Boolean)}(code)?(state.buffer=state.buffer<<6|code,state.bits+=6,function katanaDrawioFlushBase64Byte(state){state.bits>=8&&(state.bits-=8,state.output+=String.fromCharCode(state.buffer>>state.bits&255))}(state)):state.stopped=!0}(state,code)}(state,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(char))}),state.output},Date.prototype.toLocaleDateString=katanaDrawioLocaleDate,Date.prototype.toLocaleString=katanaDrawioLocaleDate,globalThis.urlParams=globalThis.urlParams||{},globalThis.mxLoadResources=!1,globalThis.mxForceIncludes=!1,globalThis.mxResourceExtension=".txt",globalThis.mxBasePath="",globalThis.STYLE_PATH="styles",globalThis.SHAPES_PATH="shapes",globalThis.STENCIL_PATH="stencils",globalThis.IMAGE_PATH="",globalThis.RESOURCES_PATH="",globalThis.GRAPH_IMAGE_PATH="img",globalThis.EXPORT_URL="","function"==typeof KatanaNode&&(Object.defineProperty(KatanaNode.prototype,"classList",{get(){return function katanaDrawioClassList(node){return{add(name){katanaSetDrawioClasses(node,[...katanaDrawioClasses(node),name])},remove(name){katanaSetDrawioClasses(node,katanaDrawioClasses(node).filter(it=>it!==name))},contains:name=>katanaDrawioClasses(node).includes(name)}}(this)}}),KatanaNode.prototype.toString=function katanaDrawioNodeToString(){return function katanaDrawioNodeClassName(node){return function katanaIsDrawioSvgForeignObject(node){return[katanaDrawioNodeNamespace(node).includes("svg"),"foreignobject"===katanaDrawioNodeLocalName(node)].every(Boolean)}(node)?"[object SVGForeignObjectElement]":"[object Element]"}(this)});const KATANA_DRAWIO_TRANSPARENT_IMAGE_SRC="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";function katanaShouldContinueOwnerSvgSearch(state){return[null!==state.node,null===state.result].every(Boolean)}function katanaSearchOwnerSvgStep(state){"svg"!==String(state.node.nodeName).toLowerCase()?state.node=state.node.parentNode:state.result=state.node}function katanaInstallDrawioRuntimeAdapter(){globalThis.__katanaDrawioMissingResources=[],globalThis.__katanaDrawioResourceErrors=[];const context=function katanaDrawioRuntimeContext(){return{request:globalThis.__katanaDrawioRequest??{},resources:new Map,stencilXmlFiles:new Map}}();(function katanaRegisterDrawioResources(context){(context.request.resources??[]).forEach(resource=>{!function katanaRegisterDrawioResource(context,resource){const path=katanaDrawioResourcePath(resource.path);context.resources.set(path,resource),function katanaRunDrawioShapeResource(resource){"application/javascript"===resource.mime_type&&function katanaExecuteDrawioShapeResource(path,content){try{Function(content).call(globalThis)}catch(error){!function katanaTrackDrawioResourceError(path,error){globalThis.__katanaDrawioResourceErrors.push(`${path}: ${String(error)}`)}(path,error)}}(resource.path,katanaDrawioResourceContent(resource))}(resource),function katanaStoreDrawioStencilResource(context,path,resource){(function katanaIsDrawioStencilResource(path,resource){return["text/xml"===resource.mime_type,["stencils/","stencils\\\\"].some(prefix=>0===path.indexOf(prefix))].every(Boolean)})(path,resource)&&context.stencilXmlFiles.set(path,katanaDrawioResourceContent(resource))}(context,path,resource)}(context,resource)})})(context),function katanaInstallDrawioStencilLoader(context){if("object"!=typeof mxStencilRegistry)return;const originalGetStencil=mxStencilRegistry.getStencil;mxStencilRegistry.getStencil=function getStencil(name){return function katanaGetDrawioStencil(registry,originalGetStencil,stencilXmlFiles,name){return originalGetStencil.call(registry,name)||function katanaFindDrawioStencil(stencilXmlFiles,name){const stencil=Array.from(stencilXmlFiles.values()).map(content=>function katanaStencilFromXmlContent(content,name){const stencilName=function katanaDrawioStencilName(content,name){const exactName=String(name),groupedName=function katanaDrawioGroupedStencilName(content,exactName){const group=function katanaDrawioStencilGroup(content){const match=content.match(/<shapes[^>]+name="([^"]+)"/);return match?.[1]??""}(content);return function katanaDrawioNameBelongsToGroup(name,group){return Boolean(group)&&name.toLowerCase().startsWith(`${group.toLowerCase()}.`)}(exactName,group)?function katanaFindDrawioGroupedStencilName(content,normalizedName){return function katanaDrawioShapeNames(content){return Array.from(content.matchAll(/<(shape|stencil)[^>]+name="([^"]+)"/gm)).map(match=>match[2])}(content).find(shapeName=>function katanaNormalizeDrawioStencilName(name){return String(name).trim().replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[\\s-]+/g,"_").toLowerCase()}(shapeName)===normalizedName)}(content,exactName.slice(group.length+1)):""}(content,exactName);return groupedName||exactName}(content,name),match=content.match(function katanaDrawioStencilPattern(name){const escapedName=String(name).replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&");return new RegExp(`<(shape|stencil)[^>]+name="${escapedName}"[^>]*>([\\\\s\\\\S]*?)<\\\\/\\\\1>`,"m")}(stencilName));return match?function katanaCreateDrawioStencil(name,xml){try{const xmlDoc=(new DOMParser).parseFromString(xml,"text/xml"),stencil=new mxStencil(xmlDoc.documentElement);return mxStencilRegistry.addStencil(name,stencil),stencil}catch{return null}}(name,match[0]):null}(content,name)).find(Boolean);return function katanaNullableDrawioStencil(stencil){return stencil||null}(stencil)}(stencilXmlFiles,name)}(this,originalGetStencil,context.stencilXmlFiles,name)}}(context),function katanaInstallDrawioMxUtils(context){"object"==typeof mxUtils&&(mxUtils.createXmlDocument=katanaDrawioCreateXmlDocument,mxUtils.load=url=>katanaDrawioResourceResponse(context.resources,url),mxUtils.get=(url,onload,onerror)=>function katanaDrawioGetResource(resources,url,onload,onerror){const response=katanaDrawioResourceResponse(resources,url);return function katanaDispatchDrawioResourceResponse(response,onload,onerror){!function katanaDrawioIsOkResponse(response){return[response.getStatus()>=200,response.getStatus()<300].every(Boolean)}(response)?onerror?.(response):onload?.(response)}(response,onload,onerror),response}(context.resources,url,onload,onerror))}(context),function katanaInstallDrawioLightDarkColorSupport(){const runtimeMxUtils=katanaDrawioMxUtils();"object"==typeof runtimeMxUtils&&(runtimeMxUtils.lightDarkColorSupported=!0,runtimeMxUtils.preferDarkColor=!1)}(),function katanaInstallDrawioTextConversionGuard(){const originalConvertHtmlToText=Editor.convertHtmlToText;Editor.convertHtmlToText=function convertHtmlToText(value){return KATANA_DRAWIO_TEXT_CONVERSION_HANDLERS[Number(null!=value)](originalConvertHtmlToText,value)}}(),function katanaInstallDrawioSvgTextOutput(){!function katanaDisableDrawioForeignObjectWarning(){"function"==typeof Graph&&(Graph.prototype.addForeignObjectWarning=function addForeignObjectWarning(){})}()}(),function katanaInstallDrawioImageBundles(context){if("function"!=typeof mxGraph)return;const originalGetImageFromBundles=mxGraph.prototype.getImageFromBundles;mxGraph.prototype.getImageFromBundles=function getImageFromBundles(key,...args){return function katanaDrawioImageFromBundles(resources,originalGetImageFromBundles,graph,key,args){const resource=resources.get(katanaDrawioResourcePath(key));return function katanaIsDrawioSvgResource(resource){return"image/svg+xml"===resource?.mime_type}(resource)?katanaDrawioDataUri(resource):function katanaDrawioBundleFallback(originalGetImageFromBundles,graph,key,args){return"function"==typeof originalGetImageFromBundles?originalGetImageFromBundles.apply(graph,[key,...args]):key}(originalGetImageFromBundles,graph,key,args)}(context.resources,originalGetImageFromBundles,this,key,args)}}(context),function katanaInstallDrawioSvgImages(context){if("function"!=typeof mxSvgCanvas2D)return;const originalImage=mxSvgCanvas2D.prototype.image;mxSvgCanvas2D.prototype.image=function image(x,y,width,height,src,aspect,flipH,flipV){originalImage.call(this,x,y,width,height,function katanaDrawioResolvedImageSrc(resources,src){return[katanaDrawioImageResourceSrc(resources.get(katanaDrawioResourcePath(src))),katanaDrawioExternalImageSrc(src),src].filter(Boolean)[0]}(context.resources,src),aspect,flipH,flipV)}}(context),function katanaInstallDrawioOwnerSvgElement(){(function katanaNeedsDrawioOwnerSvgElement(){return["function"==typeof KatanaNode,!Object.getOwnPropertyDescriptor(KatanaNode.prototype,"ownerSVGElement")].every(Boolean)})()&&Object.defineProperty(KatanaNode.prototype,"ownerSVGElement",{get(){return function katanaOwnerSvgElement(node){const state={node:node,result:null};for(;katanaShouldContinueOwnerSvgSearch(state);)katanaSearchOwnerSvgStep(state);return state.result}(this)}})}()}function katanaDrawioMxUtils(){try{return mxUtils}catch(_error){return globalThis.mxUtils}}const KATANA_DRAWIO_TEXT_CONVERSION_HANDLERS=[()=>"",(originalConvertHtmlToText,value)=>originalConvertHtmlToText.call(Editor,value)];function katanaDrawioHtmlLabelText(value){const html=String(value);return function katanaNormalizeHtmlLabelWhitespace(text){return text.replace(/\\u00a0/g," ").replace(/[ \\t\\f\\v]+/g," ").replace(/ *\\n */g,"\\n").replace(/\\n{3,}/g,"\\n\\n").trim()}(KATANA_DRAWIO_HTML_LABEL_NORMALIZERS[Number(function katanaCanUseDomParser(){return"object"==typeof document&&"function"==typeof document.createElement}())](html))}const KATANA_DRAWIO_HTML_LABEL_NORMALIZERS=[html=>function katanaNormalizeHtmlLabelTextByRegex(html){return decodeHtmlEntities(html.replace(/<\\s*br\\b[^>]*>/gi,"\\n").replace(/<\\s*\\/\\s*(div|p|li|tr|td|th|h[1-6]|section|article)\\s*>/gi,"\\n").replace(/<[^>]+>/g,""))}(html),html=>function katanaNormalizeHtmlLabelTextByDom(html){const container=document.createElement("div");return container.innerHTML=html,function katanaCollectHtmlLabelTextFromNode(root){const buffer=[],inlineBreakTags=new Set(["BR"]),blockTags=new Set(["DIV","P","LI","UL","OL","TABLE","TBODY","THEAD","TFOOT","TR","TD","TH","SECTION","ARTICLE","BLOCKQUOTE","PRE","H1","H2","H3","H4","H5","H6"]),visit=node=>{if(node.nodeType===Node.TEXT_NODE)return void buffer.push(node.nodeValue??"");if(node.nodeType!==Node.ELEMENT_NODE)return;const element=node;inlineBreakTags.has(element.tagName)?buffer.push("\\n"):(blockTags.has(element.tagName)&&element!==root&&buffer.length>0&&!String(buffer[buffer.length-1]).endsWith("\\n")&&buffer.push("\\n"),Array.from(element.childNodes).forEach(visit))};return visit(root),decodeHtmlEntities(buffer.join(""))}(container).trim()}(html)];function katanaDrawioSourceContentBox(svg){return function katanaDrawioSourceCropBox(svg,entries){const sourceBox=katanaDrawioUnionBox(entries),offset=katanaDrawioSourceCropOffset(svg,entries);return[sourceBox,offset].every(Boolean)?function katanaDrawioShiftedSourceCropBox(box,offset){return{x:Math.floor(box.x+offset.x),y:Math.floor(box.y+offset.y),width:Math.ceil(box.width),height:Math.ceil(box.height)}}(sourceBox,offset):null}(svg,katanaDrawioSourceGeometryEntries())}function katanaDrawioSourceMinimumTop(){const entries=katanaDrawioSourceGeometryEntries();return 0===entries.length?Number.NaN:Math.min(...entries.map(entry=>entry.y))}function katanaDrawioSourceGeometryEntries(){return[...Array.from(katanaDrawioRequestSource().matchAll(/<mxCell\\b([^>]*)>\\s*<mxGeometry\\b([^>]*)/g)).map(katanaDrawioSourceGeometryEntry),...Array.from(katanaDrawioRequestSource().matchAll(/<(?:UserObject|object)\\b([^>]*)>\\s*<mxCell\\b([^>]*)>\\s*<mxGeometry\\b([^>]*)/g)).map(katanaDrawioSourceUserObjectGeometryEntry)].filter(katanaHasDrawioSourceGeometryEntry).filter(katanaDrawioIsTopLevelSourceGeometryEntry)}function katanaDrawioIsSourceVertexGeometryEntry(entry){return entry.vertex}function katanaDrawioSourceGeometryEntry(match){return katanaDrawioSourceGeometry(katanaDrawioXmlAttributes(match[1]),katanaDrawioXmlAttributes(match[2]))}function katanaDrawioSourceUserObjectGeometryEntry(match){const userObjectAttributes=katanaDrawioXmlAttributes(match[1]),cellAttributes=katanaDrawioXmlAttributes(match[2]);return katanaDrawioSourceGeometry(userObjectAttributes,katanaDrawioXmlAttributes(match[3]),cellAttributes)}function katanaDrawioSourceGeometry(cellAttributes,geometryAttributes,fallbackAttributes){return{id:katanaDrawioCellAttribute(cellAttributes,"id"),parent:katanaDrawioSourceParentAttribute(cellAttributes,fallbackAttributes),vertex:katanaDrawioBooleanSourceAttribute(cellAttributes,fallbackAttributes,"vertex"),edge:katanaDrawioBooleanSourceAttribute(cellAttributes,fallbackAttributes,"edge"),x:katanaDrawioCoordinateAttribute(geometryAttributes,"x"),y:katanaDrawioCoordinateAttribute(geometryAttributes,"y"),width:katanaDrawioRequiredNumberAttribute(geometryAttributes,"width"),height:katanaDrawioRequiredNumberAttribute(geometryAttributes,"height")}}function katanaDrawioBooleanSourceAttribute(attributes,fallbackAttributes,name){return[katanaDrawioCellAttribute(attributes,name),katanaDrawioOptionalCellAttribute(fallbackAttributes,name)].includes("1")}function katanaDrawioSourceParentAttribute(cellAttributes,fallbackAttributes){return[katanaDrawioOptionalCellAttribute(cellAttributes,"parent"),katanaDrawioOptionalCellAttribute(fallbackAttributes,"parent")].filter(Boolean).concat([""])[0]}function katanaDrawioOptionalCellAttribute(attributes,name){return attributes?katanaDrawioCellAttribute(attributes,name):""}function katanaHasDrawioSourceGeometryEntry(entry){return[entry.id,Number.isFinite(entry.x),Number.isFinite(entry.y),entry.width>0,entry.height>0].every(Boolean)}function katanaDrawioIsTopLevelSourceGeometryEntry(entry){return[(parent=entry.parent,["","1"].includes(parent)),"0"===new Map(Array.from(katanaDrawioRequestSource().matchAll(/<mxCell\\b([^>]*)/g)).map(match=>katanaDrawioXmlAttributes(match[1])).filter(katanaDrawioHasSourceCellParent).map(katanaDrawioSourceCellParentEntry)).get(entry.parent)].some(Boolean);var parent}function katanaDrawioHasSourceCellParent(attributes){return[attributes.has("id"),attributes.has("parent")].every(Boolean)}function katanaDrawioSourceCellParentEntry(attributes){return[katanaDrawioCellAttribute(attributes,"id"),katanaDrawioCellAttribute(attributes,"parent")]}function katanaDrawioCoordinateAttribute(attributes,name){return katanaDrawioOptionalNumberAttribute(attributes,name,0)}function katanaDrawioRequiredNumberAttribute(attributes,name){return katanaDrawioOptionalNumberAttribute(attributes,name,Number.NaN)}function katanaDrawioOptionalNumberAttribute(attributes,name,fallback){const value=katanaDrawioCellAttribute(attributes,name);return""===value?fallback:Number(value)}function katanaDrawioSourceCropOffset(svg,entries){return function katanaDrawioMedianOffset(offsets){return 0===offsets.length?null:{x:katanaDrawioMedianValue(offsets.map(offset=>offset.x)),y:katanaDrawioMedianValue(offsets.map(offset=>offset.y))}}(function katanaDrawioSourceCropOffsets(svg,entries){return entries.map(entry=>function katanaDrawioSourceCellOffset(svg,entry){const box=function katanaDrawioMeasuredSourceCellBox(svg,entry){return[katanaDrawioCellGroup(svg,entry.id)].filter(Boolean).map(katanaDrawioCellShapeBox).filter(Boolean).filter(box=>function katanaDrawioSimilarSourceBox(box,entry){return[katanaDrawioSimilarSourceSize(box.width,entry.width),katanaDrawioSimilarSourceSize(box.height,entry.height)].every(Boolean)}(box,entry)).concat([null])[0]}(svg,entry);return box?{x:box.x-entry.x,y:box.y-entry.y}:null}(svg,entry)).filter(Boolean)}(svg,entries))}function katanaDrawioSimilarSourceSize(actual,expected){return Math.abs(actual-expected)<=Math.max(4,.02*expected)}function katanaDrawioMedianValue(values){const sorted=[...values].sort((left,right)=>left-right);return sorted[Math.floor(sorted.length/2)]}function katanaRemoveDrawioNode(node){node.parentNode?.removeChild(node)}function katanaIsDrawioPageSizedLabelBackground(rect){return["#ffffff"===katanaDrawioColorValue(rect,"fill"),"none"===rect.getAttribute("stroke"),katanaDrawioNodeWidth(rect)>.5*katanaDrawioSvgBox(rect.ownerSVGElement).width].every(Boolean)}function katanaIsDrawioTextLabelBackground(rect){return["#ffffff"===katanaDrawioColorValue(rect,"fill"),"none"===rect.getAttribute("stroke"),katanaDrawioNodeWidth(rect)>16,katanaHasDrawioTextSibling(rect)].every(Boolean)}function katanaHasDrawioTextSibling(rect){return Array.from(rect.parentNode?.querySelectorAll("text")??[]).length>0}function katanaDrawioColorValue(node,name){return String(node.getAttribute(name)??"").toLowerCase()}const KATANA_DRAWIO_CROP_BOX_READERS=[svg=>function katanaDrawioPreferredContentBox(svg){if(katanaDrawioUsesDevicePageContentCrop())return katanaDrawioContentBox(svg);const sourceBox=katanaDrawioSourceContentBox(svg);return function katanaDrawioCanUseSourceContentBox(box){return[box,Number.isFinite(box?.x),Number.isFinite(box?.y),box?.width>0,box?.height>0].every(Boolean)}(sourceBox)?sourceBox:katanaDrawioContentBox(svg)}(svg),svg=>katanaDrawioContentBox(svg)];function katanaDrawioNeedsMeasuredContentBox(svg){if(!katanaDrawioSourceIsDeviceTemplate())return!1;const sourceBox=katanaDrawioSourceContentBox(svg),contentBox=katanaDrawioContentBox(svg);return!sourceBox||[sourceBox,contentBox,sourceBox.width>0,contentBox.width>0,[contentBox.width>1.03*sourceBox.width,contentBox.height>1.03*sourceBox.height].some(Boolean)].every(Boolean)}function katanaDrawioContentBox(svg){return function katanaDrawioOptionalContentBox(svg){const boxes=function katanaDrawioContentElements(svg){return["rect","path","ellipse","circle","line","polygon","polyline","image","text"].flatMap(tagName=>Array.from(svg.querySelectorAll(tagName))).filter(element=>!function katanaShouldIgnoreDrawioContentElement(element){return function katanaIsWrappedDrawioHtmlFallbackText(element){const style=katanaDrawioSourceStyleForElement(element);return["text"===element.localName,style.has("html"),"wrap"===style.get("whiteSpace"),Boolean(katanaDrawioContentCellGroup(element)?.querySelector("foreignObject"))].every(Boolean)}(element)}(element))}(svg).map(katanaDrawioElementBox);return katanaDrawioUnionBox(boxes.filter(katanaDrawioHasArea))}(svg)??{x:0,y:0,width:1,height:1}}function katanaDrawioContentCellGroup(element){return katanaDrawioElementAncestors(element).filter(node=>node.getAttribute?.("data-cell-id")).concat([null])[0]}function katanaDrawioElementBox(element){return function katanaDrawioTranslatedBox(box,translate){return{x:box.x+translate.x,y:box.y+translate.y,width:box.width,height:box.height}}(element.getBBox(),function katanaDrawioTranslate(element){return katanaDrawioParentTranslate(element.parentNode)}(element))}function katanaDrawioParentTranslate(node){return node?function katanaDrawioAddTranslate(translate,node){const next=function katanaDrawioNodeTranslate(node){return function katanaDrawioTranslateMatch(transform){return[transform.match(/translate\\(([-\\d.]+)(?:[,\\s]+([-\\d.]+))?\\)/)].filter(Boolean).map(katanaDrawioTranslateFromMatch).concat([{x:0,y:0}])[0]}(String(node?.getAttribute?.("transform")??""))}(node);return{x:translate.x+next.x,y:translate.y+next.y}}(katanaDrawioParentTranslate(node.parentNode),node):{x:0,y:0}}function katanaDrawioTranslateFromMatch(match){return{x:Number(match[1]),y:Number(match[2]??0)}}function katanaDrawioUnionBox(boxes){return 0===boxes.length?null:function katanaDrawioUnionNonEmptyBox(boxes){const left=Math.min(...boxes.map(box=>box.x)),top=Math.min(...boxes.map(box=>box.y)),right=Math.max(...boxes.map(katanaDrawioBoxRight)),bottom=Math.max(...boxes.map(katanaDrawioBoxBottom));return{x:Math.floor(left),y:Math.floor(top),width:Math.ceil(right-left),height:Math.ceil(bottom-top)}}(boxes)}function katanaDrawioBoxRight(box){return box.x+box.width}function katanaDrawioBoxBottom(box){return box.y+box.height}function katanaDrawioHasArea(box){return[box.width>0,box.height>0].every(Boolean)}function katanaDrawioShouldApplyShadowExportPadding(){return[Array.from(KATANA_DRAWIO_SOURCE_CELL_STYLE_CACHE.values()).some(katanaDrawioSourceStyleHasShadow),!katanaDrawioUsesDevicePageContentCrop()].every(Boolean)}function katanaDrawioUsesDevicePageContentCrop(){return[katanaDrawioSourceHasPageBounds(),katanaDrawioSourceIsDeviceTemplate(),katanaDrawioSourceHasTransparentPageBackground(),1===katanaDrawioSourceModelCount()].every(Boolean)}function katanaTranslateDrawioContent(svg,box){const wrapper=document.createElementNS("http://www.w3.org/2000/svg","g");wrapper.setAttribute("transform",`translate(${-box.x},${-box.y})`),Array.from(svg.childNodes).forEach(child=>{wrapper.appendChild(child)}),svg.appendChild(wrapper)}function katanaDrawioNodeWidth(node){return katanaDrawioCssPixels(node.getAttribute("width"))}function katanaDrawioElementCellShape(element){return function katanaDrawioSourceCellShape(id){return[KATANA_DRAWIO_SOURCE_CELL_STYLE_CACHE.get(id)].filter(Boolean).map(style=>style.get("shape")).filter(Boolean).concat([""])[0]}(katanaDrawioElementCellId(element))}function katanaDrawioElementCellId(element){return katanaDrawioElementAncestors(element).map(katanaDrawioDirectElementCellId).filter(Boolean).concat([""])[0]}function katanaDrawioElementAncestors(element){const parent1=katanaDrawioParentNode(element),parent2=katanaDrawioParentNode(parent1),parent3=katanaDrawioParentNode(parent2),parent4=katanaDrawioParentNode(parent3),parent5=katanaDrawioParentNode(parent4),parent6=katanaDrawioParentNode(parent5),parent7=katanaDrawioParentNode(parent6);return[element,parent1,parent2,parent3,parent4,parent5,parent6,parent7,katanaDrawioParentNode(parent7)].filter(Boolean)}function katanaDrawioParentNode(node){return[node].filter(Boolean).map(it=>it.parentNode).filter(Boolean).concat([null])[0]}function katanaDrawioDirectElementCellId(element){return[element.getAttribute?.("data-cell-id")].filter(Boolean).concat([""])[0]}function katanaDrawioElementCellStyleValue(element,name){return function katanaDrawioSourceCellStyleValue(id,name){return[KATANA_DRAWIO_SOURCE_CELL_STYLE_CACHE.get(id)].filter(Boolean).map(style=>style.get(name)).filter(Boolean).concat([""])[0]}(katanaDrawioElementCellId(element),name)}function katanaDrawioElementCellIsEdge(element){return KATANA_DRAWIO_SOURCE_CELL_EDGE_CACHE.has(katanaDrawioElementCellId(element))}function katanaDrawioElementCellHasStyleKey(element,name){return katanaDrawioSourceStyleForElement(element).has(name)}function katanaDrawioElementCellHasShadowStyle(element){return katanaDrawioSourceStyleHasShadow(katanaDrawioSourceStyleForElement(element))}function katanaDrawioSourceStyleForElement(element){return KATANA_DRAWIO_SOURCE_CELL_STYLE_CACHE.get(katanaDrawioElementCellId(element))??new Map}function katanaDrawioSourceStyleHasShadow(style){return[katanaDrawioSourceStyleExplicitShadow(style),katanaDrawioSourceStyleNamedShadow(style)].some(Boolean)}function katanaDrawioSourceStyleExplicitShadow(style){return"1"===style.get("shadow")}function katanaDrawioSourceStyleNamedShadow(style){return["0"!==style.get("shadow"),KATANA_DRAWIO_SHADOW_STYLE_NAMES.some(name=>style.has(name))].every(Boolean)}function katanaDrawioSourceCellEdgeId(match){const attributes=katanaDrawioSourceStyleXmlAttributes(match[1]);return"1"===attributes.get("edge")?katanaDrawioSourceCellId(attributes):""}function katanaDrawioSourceObjectCellStyleEntry(match){const objectAttributes=katanaDrawioSourceStyleXmlAttributes(match[1]),cellAttributes=katanaDrawioSourceStyleXmlAttributes(match[2]);return[katanaDrawioSourceCellId(objectAttributes),katanaDrawioSourceCellStyle(cellAttributes)]}function katanaDrawioSourceCellStyleEntry(match){const attributes=katanaDrawioSourceStyleXmlAttributes(match[1]);return[katanaDrawioSourceCellId(attributes),katanaDrawioSourceCellStyle(attributes)]}function katanaDrawioSourceCellId(attributes){return[attributes.get("id")].filter(Boolean).concat([""])[0]}function katanaDrawioSourceCellStyle(attributes){return function katanaDrawioSourceStyleMap(style){return new Map(String(style).split(";").map(katanaDrawioSourceStyleEntry).filter(entry=>entry[0]))}([attributes.get("style")].filter(Boolean).concat([""])[0])}function katanaDrawioSourceStyleRequestSource(){return String(globalThis.__katanaDrawioRequest?.source??"")}function katanaDrawioSourceStyleXmlAttributes(source){return new Map(Array.from(String(source).matchAll(/([a-zA-Z0-9:_-]+)="([^"]*)"/g)).map(match=>[match[1],decodeHtmlEntities(match[2])]))}function katanaDrawioSourceStyleEntry(value){return String(value).split("=").concat(["",""]).slice(0,2)}const KATANA_DRAWIO_SHADOW_STYLE_NAMES=["fancy","gray","blue","green","turquoise","yellow","orange","red","pink","purple"],KATANA_DRAWIO_SOURCE_CELL_STYLE_CACHE=function katanaDrawioSourceCellStyleMap(){return new Map([...Array.from(katanaDrawioSourceStyleRequestSource().matchAll(/<mxCell\\b([^>]*)>/g)).map(katanaDrawioSourceCellStyleEntry),...Array.from(katanaDrawioSourceStyleRequestSource().matchAll(/<(?:UserObject|object)\\b([^>]*)>\\s*<mxCell\\b([^>]*)/g)).map(katanaDrawioSourceObjectCellStyleEntry)].filter(entry=>entry[0]))}(),KATANA_DRAWIO_SOURCE_CELL_EDGE_CACHE=function katanaDrawioSourceCellEdgeSet(){return new Set(Array.from(katanaDrawioSourceStyleRequestSource().matchAll(/<mxCell\\b([^>]*)>/g)).map(katanaDrawioSourceCellEdgeId).filter(Boolean))}(),KATANA_DRAWIO_LIGHT_DARK_PATTERN=/light-dark\\((rgb\\([^)]+\\)|#[\\da-f]{6}),\\s*(rgb\\([^)]+\\)|#[\\da-f]{6}|var\\(--ge-dark-color,\\s*#[\\da-f]{6}\\))\\)/gi,KATANA_DRAWIO_STYLE_SVG_COLOR_ATTRIBUTES=["fill","stroke","stop-color"];function katanaDrawioElementStyleText(element){return element.getAttribute("style")??element.style?.cssText??""}function katanaHasDrawioStyleColorAttributeValue(attribute){return""!==attribute.value}function katanaDrawioStylePropertyValue(style,name){return style.split(";").map(declaration=>declaration.trim()).filter(declaration=>declaration.toLowerCase().startsWith(`${name}:`)).map(katanaDrawioStyleDeclarationValue).filter(Boolean).concat([""])[0]}function katanaDrawioStyleDeclarationValue(declaration){return declaration.slice(declaration.indexOf(":")+1).trim()}const KATANA_DRAWIO_AZURE_SHAPE_PREFIXES=["mxgraph.azure.","mxgraph.mscae.","mxgraph.office."],KATANA_DRAWIO_VISUAL_SHAPE_TAGS=new Set(["circle","ellipse","line","path","polygon","polyline","rect"]),KATANA_DRAWIO_PAINT_ATTRIBUTES=new Set(["fill","stroke","stop-color"]),KATANA_DRAWIO_AZURE_DARK_ATTRIBUTES=new Set(["color","fill","stroke"]),KATANA_DRAWIO_ANDROID_DEVICE_SHAPES=new Set(["mxgraph.android.phone2","mxgraph.android.tab2"]),KATANA_DRAWIO_ANDROID_DEVICE_SCREEN_COLORS=new Set(["#ededed","#202020","rgb(237, 237, 237)","rgb(32, 32, 32)"]);function katanaDrawioContextOriginalColor(element,name,value){return function katanaDrawioAzureDocumentDarkColor(element,name,value){return KATANA_DRAWIO_AZURE_DOCUMENT_DARK_COLOR.get(function katanaDrawioAzureDocumentDarkColorKey(element,name,value){return[katanaDrawioIsDarkMode(),KATANA_DRAWIO_AZURE_SHAPE_PREFIXES.some(katanaDrawioRequestSourceIncludes),KATANA_DRAWIO_AZURE_DARK_ATTRIBUTES.has(name),katanaDrawioAzureDocumentAllowsAttribute(element,name)].every(Boolean)?`${name}|${value}`:""}(element,name,value))??""}(element,name,value)||function katanaDrawioAzureDarkColor(element,name,value){return KATANA_DRAWIO_AZURE_DARK_COLOR.get(function katanaDrawioAzureDarkColorKey(element,name,value){return[katanaDrawioIsDarkMode(),KATANA_DRAWIO_AZURE_DARK_ATTRIBUTES.has(name),katanaDrawioIsAzureShapeElement(element)].every(Boolean)?`${name}|${value}`:""}(element,name,value))??""}(element,name,value)||function katanaDrawioLegacyAwsDarkColor(element,name,value){return KATANA_DRAWIO_AWS_LEGACY_DARK_COLOR.get(function katanaDrawioLegacyAwsDarkColorKey(element,name,value){return function katanaDrawioShouldMapLegacyAwsDarkColor(element,name){return[katanaDrawioIsDarkMode(),katanaDrawioIsPaintAttribute(name),katanaDrawioIsVisualShapeTag(element),katanaDrawioIsLegacyAwsShapeElement(element)].every(Boolean)}(element,name)?`${name}|${value}`:""}(element,name,value))??""}(element,name,value)||function katanaDrawioPidWhiteFillColor(element,name,value){return function katanaDrawioIsPidWhiteFill(element,name,value){return[katanaDrawioIsDarkMode(),"fill"===name,"white"===value,["ellipse","path"].includes(element.localName),katanaDrawioElementHasWhiteSourceFill(element),katanaDrawioIsPidWhiteFillSourceElement(element)].every(Boolean)}(element,name,value)?"#121212":""}(element,name,value)||function katanaDrawioSimpleDiagramDarkColor(element,name,value){return KATANA_DRAWIO_SIMPLE_DIAGRAM_DARK_COLOR.get(function katanaDrawioSimpleDiagramDarkColorKey(element,name,value){return function katanaDrawioShouldUseSimpleDiagramDarkColor(element,name,value){return[katanaDrawioIsDarkMode(),"fill"===name,"#ffffff"===value,String(globalThis.__katanaDrawioRequest?.source??"").includes("tooltip="),katanaDrawioIsTooltipsDarkFillElement(element)].every(Boolean)}(element,name,value)?katanaDrawioContextColorKey(element,name,value):""}(element,name,value))??""}(element,name,value)||function katanaDrawioFloorplanBlackPaintColor(element,name,value){return[katanaDrawioIsDarkMode(),["fill","stroke"].includes(name),"#000000"===value,katanaDrawioElementCellShape(element).startsWith("mxgraph.floorplan.")].every(Boolean)?"#ebebeb":""}(element,name,value)||function katanaDrawioExplicitBlackShapeStrokeColor(element,name,value){return function katanaDrawioIsExplicitBlackShapeStroke(element,name,value){return[katanaDrawioIsDarkMode(),"stroke"===name,KATANA_DRAWIO_SOURCE_BLACK_COLORS.has(value),KATANA_DRAWIO_SOURCE_BLACK_COLORS.has(katanaDrawioColorKey(katanaDrawioElementCellStyleValue(element,"strokeColor"))),!katanaDrawioElementCellIsEdge(element),katanaDrawioIsVisualShapeTag(element)].every(Boolean)}(element,name,value)?"#ededed":""}(element,name,value)||function katanaDrawioOpaqueBlackPathColor(element,name,value){return function katanaDrawioIsOpaqueBlackPath(element,name,value){return[katanaDrawioIsDarkMode(),"path"===element.localName,katanaDrawioUsesOfficialWhiteBlackPath(element),["fill","stroke"].includes(name),"#000000"===value,katanaDrawioPaintOpacity(element,name)>=1].every(Boolean)}(element,name,value)?"#ffffff":""}(element,name,value)||function katanaDrawioLargeWhitePathColor(element,name,value){return function katanaDrawioIsLargeWhitePath(element,name,value){return[katanaDrawioIsDarkMode(),"path"===element.localName,"fill"===name,"#ffffff"===value,katanaDrawioElementArea(element)>1e4].every(Boolean)}(element,name,value)?"#121212":""}(element,name,value)}function katanaDrawioElementHasWhiteSourceFill(element){return["#ffffff","white"].includes(katanaDrawioColorKey(katanaDrawioElementCellStyleValue(element,"fillColor")))}function katanaDrawioIsPidWhiteFillSourceElement(element){const shape=katanaDrawioElementCellShape(element),style=katanaDrawioSourceStyleForElement(element);return[shape.startsWith("mxgraph.pid."),style.has("ellipse")].some(Boolean)}function katanaDrawioHasAndroidDeviceSource(){const source=katanaDrawioRequestSource();return Array.from(KATANA_DRAWIO_ANDROID_DEVICE_SHAPES).some(shape=>source.includes(shape))}function katanaDrawioPathDataArea(element){const coordinates=Array.from(String(element.getAttribute("d")??"").matchAll(/-?\\d+\\.?\\d*/g)).map(match=>Number(match[0])).filter(Number.isFinite);if(coordinates.length<8)return 0;const axisCoordinates=offset=>coordinates.filter((_coordinate,index)=>index%2===offset);return katanaDrawioCoordinateSpan(axisCoordinates(0))*katanaDrawioCoordinateSpan(axisCoordinates(1))}function katanaDrawioCoordinateSpan(coordinates){return Math.max(...coordinates)-Math.min(...coordinates)}function katanaDrawioUsesOfficialWhiteBlackPath(element){return[katanaDrawioElementCellIsEdge(element),katanaDrawioElementCellHasStyleKey(element,"swimlane")].some(Boolean)}function katanaDrawioPaintOpacity(element,name){const value=element.getAttribute(`${name}-opacity`)||katanaDrawioStylePropertyValue(katanaDrawioElementStyleText(element),`${name}-opacity`)||element.getAttribute("opacity")||"1";return Number.parseFloat(value)}function katanaDrawioElementArea(element){const box=element.getBBox();return box.width*box.height}function katanaDrawioIsPaintAttribute(name){return KATANA_DRAWIO_PAINT_ATTRIBUTES.has(name)}function katanaDrawioIsVisualShapeTag(element){return KATANA_DRAWIO_VISUAL_SHAPE_TAGS.has(element.localName)}function katanaDrawioIsAzureShapeElement(element){return KATANA_DRAWIO_AZURE_SHAPE_PREFIXES.some(it=>katanaDrawioElementCellShape(element).startsWith(it))}function katanaDrawioIsLegacyAwsShapeElement(element){return["mxgraph.aws.","mxgraph.aws3.","mxgraph.aws4."].some(it=>katanaDrawioElementCellShape(element).startsWith(it))}const KATANA_DRAWIO_AWS_LEGACY_DARK_COLOR=new Map([["fill|#000000","#ededed"],["fill|#2e73b8","#5f9bd6"],["fill|#7d7c7c","#848383"],["fill|#d2d3d3","#373838"],["fill|#d9a741","#835801"],["fill|#e05243","#ef7568"],["fill|#f58534","#bd5c17"],["fill|#f58536","#bd5c18"],["fill|#ffffff","#232f3e"],["stroke|#000000","#ffffff"],["stroke|#e6e6e6","#272727"]]),KATANA_DRAWIO_AZURE_DARK_COLOR=new Map([["color|#ffffff","#121212"],["color|rgb(255, 255, 255)","rgb(18, 18, 18)"],["fill|#ffffff","#121212"],["fill|rgb(255, 255, 255)","rgb(18, 18, 18)"],["stroke|#ffffff","#121212"],["stroke|rgb(255, 255, 255)","rgb(18, 18, 18)"]]),KATANA_DRAWIO_SOURCE_BLACK_COLORS=new Set(["#000000","black","rgb(0, 0, 0)"]);function katanaDrawioAzureDocumentAllowsAttribute(element,name){return"color"===name||katanaDrawioIsVisualShapeTag(element)}function katanaDrawioRequestSourceIncludes(value){return katanaDrawioRequestSource().includes(value)}const KATANA_DRAWIO_AZURE_DOCUMENT_DARK_COLOR=new Map([["color|#ffffff","#121212"],["color|rgb(255, 255, 255)","rgb(18, 18, 18)"],["fill|#ffffff","#121212"],["fill|rgb(255, 255, 255)","rgb(18, 18, 18)"],["stroke|#ffffff","#121212"],["stroke|rgb(255, 255, 255)","rgb(18, 18, 18)"]]),KATANA_DRAWIO_STENCIL_PLACEHOLDER_STYLE_NAMES=new Map([["fillcolor","fillColor"],["strokecolor","strokeColor"],["fillcolor2","fillColor2"],["strokecolor2","strokeColor2"]]),KATANA_DRAWIO_CISCO_PLACEHOLDER_COLORS_BY_THEME=[new Map([["fillcolor","#10739e"],["strokecolor","#ffffff"],["fillcolor2","#000000"],["strokecolor2","#ffffff"]]),new Map([["fillcolor","#54a9ce"],["strokecolor","#121212"],["fillcolor2","#ededed"],["strokecolor2","#121212"]])];function katanaDrawioPlaceholderStyleName(token){return KATANA_DRAWIO_STENCIL_PLACEHOLDER_STYLE_NAMES.get(token)??""}function katanaDrawioIsCiscoShapeElement(element){return katanaDrawioElementCellShape(element).startsWith("mxgraph.cisco.")}function katanaNormalizeDrawioElementColors(element){(function katanaResolveDrawioLightDarkStyleColors(element){const style=katanaDrawioElementStyleText(element);if(!style?.includes("light-dark("))return;const resolvedStyle=function katanaResolvedDrawioLightDarkStyle(style){return style.replace(KATANA_DRAWIO_LIGHT_DARK_PATTERN,(_match,light,dark)=>function katanaDrawioLightDarkStyleChoice(light,dark){return katanaDrawioIsDarkMode()?function katanaDrawioLightDarkDarkStyleColor(dark){const value=String(dark).trim(),fallback=value.match(/var\\(--ge-dark-color,\\s*(#[\\da-f]{6})\\)/i);return fallback?.[1]??value}(dark):String(light).trim()}(light,dark))}(style);element.setAttribute("style",resolvedStyle),function katanaApplyDrawioStyleColorAttributes(element,style){KATANA_DRAWIO_STYLE_SVG_COLOR_ATTRIBUTES.map(name=>function katanaDrawioStyleColorAttribute(style,name){return{name:name,value:katanaDrawioStylePropertyValue(style,name)}}(style,name)).filter(katanaHasDrawioStyleColorAttributeValue).forEach(attribute=>{element.setAttribute(attribute.name,attribute.value),element.setAttribute(function katanaDrawioLightDarkAttributeName(name){return`data-katana-light-dark-${name}`}(attribute.name),"true")})}(element,resolvedStyle)})(element),["fill","stroke","stop-color"].forEach(name=>{!function katanaNormalizeDrawioColorAttribute(element,name){const color=element.getAttribute(name);color&&element.setAttribute(name,function katanaDrawioResolvedAttributeColor(element,name,color){return function katanaDrawioShouldResolveTextColor(element,name){return["text"===element.localName,"fill"===name].every(Boolean)}(element,name)?katanaDrawioResolvedTextColor(color):katanaDrawioResolvedColor(element,name,color)}(element,name,color))}(element,name)}),function katanaNormalizeDrawioStyleTextColor(element){if(function katanaDrawioShouldPreserveHtmlTextContentColor(element){const color=katanaDrawioStylePropertyValue(String(element.getAttribute("style")),"color");return[katanaDrawioShouldPreserveExplicitHtmlTextContentColor(element,color),katanaDrawioShouldPreserveExplicitHtmlTextDescendantColor(element,color),katanaDrawioShouldPreserveImplicitHtmlTextContentColor(element,color)].some(Boolean)}(element))return;const style=String(element.getAttribute("style"));[katanaDrawioStylePropertyValue(style,"color")].filter(Boolean).map(katanaDrawioResolvedTextColor).filter(Boolean).forEach(color=>{element.setAttribute("style",katanaDrawioStyleWithProperty(style,"color",color))})}(element)}function katanaDrawioHasHtmlTextContentColor(element){const style=String(element.getAttribute("style")??"");return[katanaDrawioStylePropertyValue(style,"color"),"0"!==katanaDrawioStylePropertyValue(style,"font-size"),katanaDrawioIsHtmlTextContentRoot(element)||!element.querySelector("div")].every(Boolean)}function katanaDrawioIsHtmlTextContentRoot(element){return"content"===element.getAttribute?.("data-katana-drawio-html-text")}function katanaDrawioHtmlTextSourceColorEntry(element){return{element:element,color:katanaDrawioHtmlTextSourceColor(katanaDrawioSourceStyleForElement(element))}}function katanaDrawioHtmlTextSourceColor(style){const fontColor=function katanaDrawioExplicitHtmlTextSourceFontColor(style){const color=katanaDrawioColorKey(style.get("fontColor")??"");return["","default"].includes(color)?"":color}(style);return fontColor?function katanaDrawioResolvedExplicitHtmlTextSourceColor(color){return katanaDrawioIsDarkMode()?katanaDrawioTextColorMapForTheme().get(color)||katanaDrawioOfficialDarkColor(color)||katanaDrawioResolvedTextColor(color):color}(fontColor):function katanaDrawioSourceStyleUsesDarkHtmlTextBackgroundMap(style){return[style.has("text"),"text"===style.get("shape"),["","none"].includes(katanaDrawioColorKey(style.get("fillColor")??""))].some(Boolean)}(style)||function katanaDrawioSourceStyleUsesDarkThemeFill(style){return[katanaDrawioIsDarkMode(),katanaDrawioColorLuminance(katanaDrawioResolvedSourceStyleFillColor(style))<.45].every(Boolean)}(style)?"#ffffff":""}function katanaDrawioResolvedSourceStyleFillColor(style){const color=katanaDrawioColorKey(style.get("fillColor")??"");return color?katanaDrawioColorMapForTheme().get(color)||katanaDrawioOfficialDarkColor(color)||katanaDrawioFallbackDarkColor(color)||color:"#121212"}function katanaApplyDrawioHtmlTextSourceColor(entry){const style=String(entry.element.getAttribute("style")??"");entry.element.setAttribute("style",katanaDrawioStyleWithProperty(style,"color",entry.color))}function katanaDrawioResolvedColor(element,name,color){return function katanaDrawioPaintServerPassthrough(color){return function katanaDrawioIsPaintServer(value){return String(value).trim().toLowerCase().startsWith("url(")}(color)?color:""}(color)||function katanaDrawioResolvedNonPaintColor(element,name,color){const value=katanaDrawioColorKey(color);return function katanaDrawioStencilPlaceholderColor(element,name,value){const token=function katanaDrawioStencilPlaceholderToken(value){const token=katanaDrawioColorKey(value);return KATANA_DRAWIO_STENCIL_PLACEHOLDER_STYLE_NAMES.has(token)?token:""}(value);return token?function katanaDrawioSourceStylePlaceholderColor(element,name,token){return[katanaDrawioElementCellStyleValue(element,katanaDrawioPlaceholderStyleName(token))].filter(Boolean).map(color=>function katanaDrawioResolvedSourcePlaceholderColor(element,name,token,color){return function katanaDrawioCiscoSourceSecondaryPlaceholderColor(element,token,color){return[katanaDrawioIsDarkMode(),katanaDrawioIsCiscoShapeElement(element),"fillcolor2"===token,["#000000","rgb(0, 0, 0)"].includes(katanaDrawioColorKey(color))].every(Boolean)?"#ededed":""}(element,token,color)||katanaDrawioResolvedColor(element,name,color)}(element,name,token,color)).concat([""])[0]}(element,name,token)||function katanaDrawioFallbackStencilPlaceholderColor(element,token){return katanaDrawioIsCiscoShapeElement(element)?KATANA_DRAWIO_CISCO_PLACEHOLDER_COLORS_BY_THEME[Number(katanaDrawioIsDarkMode())].get(token):""}(element,token):""}(element,name,value)||function katanaDrawioShapeMappedColor(element,name,value){return[katanaDrawioShapeColorMap(element).get(`${name}|${value}`)].filter(Boolean).concat([""])[0]}(element,name,value)||function katanaDrawioContextMappedColor(element,name,value){return[katanaDrawioContextOriginalColor(element,name,value),KATANA_DRAWIO_CONTEXT_COLOR_BY_THEME[Number(katanaDrawioIsDarkMode())].get(katanaDrawioContextColorKey(element,name,value))].filter(Boolean).concat([""])[0]}(element,name,value)||katanaDrawioLightDarkExactColor(value)||function katanaDrawioThemeMappedColor(element,name,value){return katanaDrawioColorMapForTheme().get(value)||function katanaDrawioFallbackThemeColor(element,name,value){return function katanaDrawioShouldUseFallbackDarkColor(element,name){return[katanaDrawioIsDarkMode(),["fill","stop-color"].includes(name),"text"!==element.localName].every(Boolean)}(element,name)?katanaDrawioFallbackDarkColor(value):""}(element,name,value)||value}(element,name,value)}(element,name,color)}function katanaDrawioLightDarkExactColor(value){const colors=KATANA_DRAWIO_LIGHT_DARK_COLORS.get(value);return colors?.[Number(katanaDrawioIsDarkMode())]??""}function katanaDrawioShapeColorMap(element){return KATANA_DRAWIO_SHAPE_COLOR_MAPS[Number(function katanaDrawioIsAws3dElement(element){return[katanaDrawioIsDarkMode(),katanaDrawioElementCellShape(element).startsWith("mxgraph.aws3d.")].every(Boolean)}(element))]}function katanaDrawioColorMapForTheme(){return KATANA_DRAWIO_COLOR_BY_THEME[Number(katanaDrawioIsDarkMode())]}function katanaDrawioColorKey(color){return String(color).trim().toLowerCase()}function katanaDrawioContextColorKey(element,name,value){return[element.tagName,name,value].map(katanaDrawioColorKey).join("|")}function katanaDrawioIsDarkMode(){return!0===globalThis.__katanaDrawioRequest?.dark_mode}const KATANA_DRAWIO_LIGHT_DARK_COLORS=new Map([["light-dark(#000000, #ffffff)",["#000000","#ffffff"]],["light-dark(rgb(255, 255, 255), rgb(18, 18, 18))",["rgb(255, 255, 255)","rgb(18, 18, 18)"]],["light-dark(rgb(218, 232, 252), rgb(29, 41, 59))",["rgb(218, 232, 252)","rgb(29, 41, 59)"]],["light-dark(rgb(108, 142, 191), rgb(92, 121, 163))",["rgb(108, 142, 191)","rgb(92, 121, 163)"]],["light-dark(rgb(213, 232, 212), rgb(31, 47, 30))",["rgb(213, 232, 212)","rgb(31, 47, 30)"]],["light-dark(rgb(130, 179, 102), rgb(68, 110, 44))",["rgb(130, 179, 102)","rgb(68, 110, 44)"]],["light-dark(rgb(255, 242, 204), rgb(40, 29, 0))",["rgb(255, 242, 204)","rgb(40, 29, 0)"]],["light-dark(rgb(214, 182, 86), rgb(109, 81, 0))",["rgb(214, 182, 86)","rgb(109, 81, 0)"]],["light-dark(rgb(248, 206, 204), rgb(81, 45, 43))",["rgb(248, 206, 204)","rgb(81, 45, 43)"]],["light-dark(rgb(184, 84, 80), rgb(215, 129, 126))",["rgb(184, 84, 80)","rgb(215, 129, 126)"]],["light-dark(rgb(225, 213, 231), rgb(57, 47, 63))",["rgb(225, 213, 231)","rgb(57, 47, 63)"]],["light-dark(rgb(150, 115, 166), rgb(149, 119, 163))",["rgb(150, 115, 166)","rgb(149, 119, 163)"]],["light-dark(rgb(255, 230, 204), rgb(54, 33, 10))",["rgb(255, 230, 204)","rgb(54, 33, 10)"]],["light-dark(rgb(215, 155, 0), rgb(153, 101, 0))",["rgb(215, 155, 0)","rgb(153, 101, 0)"]]]),KATANA_DRAWIO_DARK_COLOR_BY_LIGHT_COLOR=new Map([["#000000","#ffffff"],["rgb(0, 0, 0)","rgb(255, 255, 255)"],["#232f3e","#bdc7d4"],["rgb(35, 47, 62)","rgb(189, 199, 212)"],["#23445d","#a0bcd2"],["rgb(35, 68, 93)","rgb(160, 188, 210)"],["#545b64","#9aa0a8"],["rgb(84, 91, 100)","rgb(154, 160, 168)"],["#5a6c86","#8494aa"],["rgb(90, 108, 134)","rgb(132, 148, 170)"],["#eaeded","#1f2222"],["rgb(234, 237, 237)","rgb(31, 34, 34)"],["#f59d56","#9a4e11"],["rgb(245, 157, 86)","rgb(154, 78, 17)"],["#116d5b","#63b3a3"],["rgb(17, 109, 91)","rgb(99, 179, 163)"],["#4ab29a","#237d68"],["rgb(74, 178, 154)","rgb(35, 125, 104)"],["#277116","#72b264"],["rgb(39, 113, 22)","rgb(114, 178, 100)"],["#60a337","#4d872a"],["rgb(96, 163, 55)","rgb(77, 135, 42)"],["#5a30b5","#c8a4ff"],["rgb(90, 48, 181)","rgb(200, 164, 255)"],["#945df2","#a677f7"],["rgb(148, 93, 242)","rgb(166, 119, 247)"],["#3334b9","#afb0ff"],["rgb(51, 52, 185)","rgb(175, 176, 255)"],["#4d72f3","#6989f8"],["rgb(77, 114, 243)","rgb(105, 137, 248)"],["#bc1356","#ff97d1"],["rgb(188, 19, 86)","rgb(255, 151, 209)"],["#f34482","#ff6ba1"],["rgb(243, 68, 130)","rgb(255, 107, 161)"],["#c7131f","#ff9aa5"],["rgb(199, 19, 31)","rgb(255, 154, 165)"],["#f54749","#ff7072"],["rgb(245, 71, 73)","rgb(255, 112, 114)"],["#be0917","#ffa1ad"],["rgb(190, 9, 23)","rgb(255, 161, 173)"],["#d05c17","#e07c41"],["rgb(208, 92, 23)","rgb(224, 124, 65)"],["#007cbd","#3ea8e0"],["rgb(0, 124, 189)","rgb(62, 168, 224)"],["#b3b3b3","#535353"],["rgb(179, 179, 179)","rgb(83, 83, 83)"],["#f4f4f4","#1b1b1b"],["rgb(244, 244, 244)","rgb(27, 27, 27)"],["#dae8fc","#1d293b"],["rgb(218, 232, 252)","rgb(29, 41, 59)"],["#6c8ebf","#5c79a3"],["rgb(108, 142, 191)","rgb(92, 121, 163)"],["#d5e8d4","#1f2f1e"],["rgb(213, 232, 212)","rgb(31, 47, 30)"],["#82b366","#446e2c"],["rgb(130, 179, 102)","rgb(68, 110, 44)"],["#fff2cc","#281d00"],["rgb(255, 242, 204)","rgb(40, 29, 0)"],["#d6b656","#6d5100"],["rgb(214, 182, 86)","rgb(109, 81, 0)"],["#f8cecc","#512d2b"],["rgb(248, 206, 204)","rgb(81, 45, 43)"],["#b85450","#d7817e"],["rgb(184, 84, 80)","rgb(215, 129, 126)"],["#e1d5e7","#392f3f"],["rgb(225, 213, 231)","rgb(57, 47, 63)"],["#9673a6","#9577a3"],["rgb(150, 115, 166)","rgb(149, 119, 163)"],["#ffe6cc","#36210a"],["rgb(255, 230, 204)","rgb(54, 33, 10)"],["#d79b00","#996500"],["rgb(215, 155, 0)","rgb(153, 101, 0)"]]),KATANA_DRAWIO_COLOR_BY_THEME=[new Map,KATANA_DRAWIO_DARK_COLOR_BY_LIGHT_COLOR],KATANA_DRAWIO_DARK_CONTEXT_COLOR=new Map([["rect|fill|#ffffff","#121212"]]),KATANA_DRAWIO_CONTEXT_COLOR_BY_THEME=[new Map,KATANA_DRAWIO_DARK_CONTEXT_COLOR];(function katanaDrawioIsGcpDiagramSource(){return String(globalThis.__katanaDrawioRequest?.source??"").includes("mxgraph.gcp")})()&&[["#000000","#ededed"],["rgb(0, 0, 0)","rgb(237, 237, 237)"],["#333333","#c1c1c1"],["rgb(51, 51, 51)","rgb(193, 193, 193)"],["#445962","#95a7af"],["rgb(68, 89, 98)","rgb(149, 167, 175)"],["#455c66","#91a5ae"],["rgb(69, 92, 102)","rgb(145, 165, 174)"],["#717171","#8c8c8c"],["rgb(113, 113, 113)","rgb(140, 140, 140)"],["#757575","#898989"],["rgb(117, 117, 117)","rgb(137, 137, 137)"],["#999999","#6a6a6a"],["rgb(153, 153, 153)","rgb(106, 106, 106)"],["#9e9e9e","#656565"],["rgb(158, 158, 158)","rgb(101, 101, 101)"],["#bdbdbd","#4b4b4b"],["rgb(189, 189, 189)","rgb(75, 75, 75)"],["#dddddd","#2f2f2f"],["rgb(221, 221, 221)","rgb(47, 47, 47)"],["#e0e0e0","#2d2d2d"],["rgb(224, 224, 224)","rgb(45, 45, 45)"],["#e2e2e2","#2b2b2b"],["rgb(226, 226, 226)","rgb(43, 43, 43)"],["#f6f6f6","#1a1a1a"],["rgb(246, 246, 246)","rgb(26, 26, 26)"],["#ffffff","#121212"],["rgb(255, 255, 255)","rgb(18, 18, 18)"],["#288d44","#4ba263"],["rgb(40, 141, 68)","rgb(75, 162, 99)"],["#34a853","#2f9249"],["rgb(52, 168, 83)","rgb(47, 146, 73)"],["#3ca759","#338f4c"],["rgb(60, 167, 89)","rgb(51, 143, 76)"],["#3da858","#328e4a"],["rgb(61, 168, 88)","rgb(50, 142, 74)"],["#60b878","#2b7740"],["rgb(96, 184, 120)","rgb(43, 119, 64)"],["#8dc34c","#396801"],["rgb(141, 195, 76)","rgb(57, 104, 1)"],["#398bef","#4187dd"],["rgb(57, 139, 239)","rgb(65, 135, 221)"],["#3b8cf0","#4186dc"],["rgb(59, 140, 240)","rgb(65, 134, 220)"],["#3b8ff3","#3c84da"],["rgb(59, 143, 243)","rgb(60, 132, 218)"],["#4284f3","#4e86e6"],["rgb(66, 132, 243)","rgb(78, 134, 230)"],["#4285f4","#4c85e5"],["rgb(66, 133, 244)","rgb(76, 133, 229)"],["#4da1f5","#2f77c0"],["rgb(77, 161, 245)","rgb(47, 119, 192)"],["#5184f3","#5580e0"],["rgb(81, 132, 243)","rgb(85, 128, 224)"],["#528ff5","#477cd4"],["rgb(82, 143, 245)","rgb(71, 124, 212)"],["#9379cb","#8872b8"],["rgb(147, 121, 203)","rgb(136, 114, 184)"],["#dc473a","#fb7b70"],["rgb(220, 71, 58)","rgb(251, 123, 112)"],["#de433a","#ff7c75"],["rgb(222, 67, 58)","rgb(255, 124, 117)"],["#e61727","#ff8b98"],["rgb(230, 23, 39)","rgb(255, 139, 152)"],["#e93733","#ff7d7a"],["rgb(233, 55, 51)","rgb(255, 125, 122)"],["#ea4335","#ff796d"],["rgb(234, 67, 53)","rgb(255, 121, 109)"],["#e17028","#ce6d2f"],["rgb(225, 112, 40)","rgb(206, 109, 47)"],["#ee6429","#e36c39"],["rgb(238, 100, 41)","rgb(227, 108, 57)"],["#ef5402","#fc7731"],["rgb(239, 84, 2)","rgb(252, 119, 49)"],["#f57a36","#c95f24"],["rgb(245, 122, 54)","rgb(201, 95, 36)"],["#f5820b","#c56200"],["rgb(245, 130, 11)","rgb(197, 98, 0)"],["#f59121","#af5900"],["rgb(245, 145, 33)","rgb(175, 89, 0)"],["#f6a52a","#965100"],["rgb(246, 165, 42)","rgb(150, 81, 0)"],["#fbb724","#844900"],["rgb(251, 183, 36)","rgb(132, 73, 0)"],["#fbbb35","#7c4500"],["rgb(251, 187, 53)","rgb(124, 69, 0)"],["#fbbc04","#814b00"],["rgb(251, 188, 4)","rgb(129, 75, 0)"],["#ffa40c","#a05200"],["rgb(255, 164, 12)","rgb(160, 82, 0)"],["#ffcb2b","#6d4000"],["rgb(255, 203, 43)","rgb(109, 64, 0)"],["#ffcf48","#633a00"],["rgb(255, 207, 72)","rgb(99, 58, 0)"],["#e1f5fe","#0f2128"],["rgb(225, 245, 254)","rgb(15, 33, 40)"],["#efebe9","#252220"],["rgb(239, 235, 233)","rgb(37, 34, 32)"],["#f1f8e9","#161c0f"],["rgb(241, 248, 233)","rgb(22, 28, 15)"],["#f3e5f5","#2d212f"],["rgb(243, 229, 245)","rgb(45, 33, 47)"],["#f9bc8d","#6f3b12"],["rgb(249, 188, 141)","rgb(111, 59, 18)"],["#ffebee","#2c1b1e"],["rgb(255, 235, 238)","rgb(44, 27, 30)"],["#fff8e1","#1e1804"],["rgb(255, 248, 225)","rgb(30, 24, 4)"]].forEach(entry=>{KATANA_DRAWIO_DARK_COLOR_BY_LIGHT_COLOR.set(entry[0],entry[1])});const KATANA_DRAWIO_AWS3D_DARK_COLOR=new Map([["fill|#000000","#ededed"],["fill|#ececec","#222222"],["fill|#ffffff","#121212"],["fill|#f4b934","#7c4900"],["stroke|#000000","#ffffff"],["stroke|#2d6195","#7aa6d3"],["stroke|#292929","#cacaca"],["stroke|#5e5e5e","#9c9c9c"]]),KATANA_DRAWIO_SHAPE_COLOR_MAPS=[new Map,KATANA_DRAWIO_AWS3D_DARK_COLOR];[["#ffffff","#121212"],["rgb(255, 255, 255)","rgb(18, 18, 18)"],["#009bff","#0f94ea"],["rgb(0, 155, 255)","rgb(15, 148, 234)"],["#0072bc","#49abeb"],["rgb(0, 114, 188)","rgb(73, 171, 235)"],["#00b9e2","#008db0"],["rgb(0, 185, 226)","rgb(0, 141, 176)"],["#0c343d","#abced5"],["rgb(12, 52, 61)","rgb(171, 206, 213)"],["#8bc63e","#376a00"],["rgb(139, 198, 62)","rgb(55, 106, 0)"],["#94ce41","#316300"],["rgb(148, 206, 65)","rgb(49, 99, 0)"],["#336600","#88b45c"],["rgb(51, 102, 0)","rgb(136, 180, 92)"],["#f04d22","#ff7550"],["rgb(240, 77, 34)","rgb(255, 117, 80)"],["#ff0000","#f79090"],["rgb(255, 0, 0)","rgb(247, 144, 144)"],["#3399ff","#2b82da"],["rgb(51, 153, 255)","rgb(43, 130, 218)"],["#0080ff","#309eff"],["#0075e8","#41a5ff"],["#0067cc","#56aeff"],["#0062c4","#5db1ff"],["#0059b0","#6ab6ff"],["#004d99","#7cbeff"],["#61baff","#1865a0"],["#004c99","#7dbeff"],["#ffb366","#824100"],["rgb(255, 179, 102)","rgb(130, 65, 0)"],["#e6e6e6","#272727"],["rgb(230, 230, 230)","rgb(39, 39, 39)"],["#e6e7e8","#282929"],["rgb(230, 231, 232)","rgb(40, 41, 41)"],["#e8edf0","#1e2325"],["rgb(232, 237, 240)","rgb(30, 35, 37)"],["#ededed","#202020"],["rgb(237, 237, 237)","rgb(32, 32, 32)"],["#eeeeee","#202020"],["rgb(238, 238, 238)","rgb(32, 32, 32)"],["#eee","#000000"],["#ddd","#000000"],["#dddddd","#2f2f2f"],["rgb(221, 221, 221)","rgb(47, 47, 47)"],["#cccccc","#3e3e3e"],["rgb(204, 204, 204)","rgb(62, 62, 62)"],["#999999","#6a6a6a"],["rgb(153, 153, 153)","rgb(106, 106, 106)"],["#666666","#959595"],["rgb(102, 102, 102)","rgb(149, 149, 149)"],["#4d4d4d","#ababab"],["rgb(77, 77, 77)","rgb(171, 171, 171)"],["#333333","#c1c1c1"],["rgb(51, 51, 51)","rgb(193, 193, 193)"],["#282828","#cbcbcb"],["rgb(40, 40, 40)","rgb(203, 203, 203)"],["#003366","#a1cdf9"],["rgb(0, 51, 102)","rgb(161, 205, 249)"],["#deedff","#172433"],["rgb(222, 237, 255)","rgb(23, 36, 51)"],["#f5f5f5","#1a1a1a"],["rgb(245, 245, 245)","rgb(26, 26, 26)"],["#f9f9f9","#171717"],["rgb(249, 249, 249)","rgb(23, 23, 23)"],["#a680b8","#8b6a9a"],["rgb(166, 128, 184)","rgb(139, 106, 154)"],["#f19c99","#914845"],["rgb(241, 156, 153)","rgb(145, 72, 69)"],["#97d077","#295a0d"],["rgb(151, 208, 119)","rgb(41, 90, 13)"],["#a9c4eb","#334a6c"],["rgb(169, 196, 235)","rgb(51, 74, 108)"],["#ffb570","#7e3f03"],["rgb(255, 181, 112)","rgb(126, 63, 3)"],["#fff4c3","#261d00"],["rgb(255, 244, 195)","rgb(38, 29, 0)"],["#719c59","#5a7f45"],["rgb(113, 156, 89)","rgb(90, 127, 69)"],["#688f52","#668853"],["rgb(104, 143, 82)","rgb(102, 136, 83)"],["#7f628c","#a289ad"],["rgb(127, 98, 140)","rgb(162, 137, 173)"],["#856794","#9e84ab"],["rgb(133, 103, 148)","rgb(158, 132, 171)"],["#c2a54e","#785f14"],["rgb(194, 165, 78)","rgb(120, 95, 20)"],["#6281ad","#6984aa"],["rgb(98, 129, 173)","rgb(105, 132, 170)"],["#5d7f99","#6c899f"],["rgb(93, 127, 153)","rgb(108, 137, 159)"],["#64bbe2","#1c6788"],["rgb(100, 187, 226)","rgb(28, 103, 136)"],["#b07d4d","#a1754c"],["rgb(176, 125, 77)","rgb(161, 117, 76)"],["#f08705","#bd6300"],["rgb(240, 135, 5)","rgb(189, 99, 0)"],["#f18808","#bc6200"],["rgb(241, 136, 8)","rgb(188, 98, 0)"],["#f49731","#a65600"],["rgb(244, 151, 49)","rgb(166, 86, 0)"],["#fef15b","#372c00"],["rgb(254, 241, 91)","rgb(55, 44, 0)"],["#08585c","#79bec1"],["rgb(8, 88, 92)","rgb(121, 190, 193)"],["#736ca8","#8c86b9"],["rgb(115, 108, 168)","rgb(140, 134, 185)"],["#e3e2ee","#2a2934"],["rgb(227, 226, 238)","rgb(42, 41, 52)"],["#fdf2e3","#241b0e"],["rgb(253, 242, 227)","rgb(36, 27, 14)"],["#ae4132","#ec8f82"],["rgb(174, 65, 50)","rgb(236, 143, 130)"],["#cce5ff","#182e44"],["rgb(204, 229, 255)","rgb(24, 46, 68)"],["#d4e1ff","#222d47"],["rgb(212, 225, 255)","rgb(34, 45, 71)"],["#7ea6e0","#436697"],["rgb(126, 166, 224)","rgb(67, 102, 151)"],["#adc3d9","#374a5c"],["rgb(173, 195, 217)","rgb(55, 74, 92)"],["#98bf21","#4a6b00"],["rgb(152, 191, 33)","rgb(74, 107, 0)"],["#a7c942","#405e00"],["rgb(167, 201, 66)","rgb(64, 94, 0)"],["#eaf2d3","#1d2409"],["rgb(234, 242, 211)","rgb(29, 36, 9)"],["#eaf5d9","#182209"],["rgb(234, 245, 217)","rgb(24, 34, 9)"],["#c0c0c0","#484848"],["rgb(192, 192, 192)","rgb(72, 72, 72)"],["#e0e0e0","#2d2d2d"],["rgb(224, 224, 224)","rgb(45, 45, 45)"],["#ffd966","#543300"],["rgb(255, 217, 102)","rgb(84, 51, 0)"],["#ffd470","#5a3400"],["rgb(255, 212, 112)","rgb(90, 52, 0)"],["#fff2a1","#302700"],["rgb(255, 242, 161)","rgb(48, 39, 0)"],["#fff9b2","#2e2700"],["rgb(255, 249, 178)","rgb(46, 39, 0)"],["#0000ee","#cfcfff"],["rgb(0, 0, 238)","rgb(207, 207, 255)"],["#001933","#c9def5"],["#660000","#ffc4c4"],["rgb(102, 0, 0)","rgb(255, 196, 196)"],["#990000","#ffb5b5"],["rgb(153, 0, 0)","rgb(255, 181, 181)"],["#0d5b9d","#70b3ec"],["rgb(13, 91, 157)","rgb(112, 179, 236)"],["#efac43","#a96500"],["rgb(239, 172, 67)","rgb(169, 101, 0)"],["#d86613","#d8762e"],["rgb(216, 102, 19)","rgb(216, 118, 46)"],["#f08e81","#a55146"],["rgb(240, 142, 129)","rgb(165, 81, 70)"],["#f58534","#bd5c17"],["rgb(245, 133, 52)","rgb(189, 92, 23)"],["#f78e04","#b85e00"],["rgb(247, 142, 4)","rgb(184, 94, 0)"],["#ab221c","#ff9999"],["rgb(171, 34, 28)","rgb(255, 153, 153)"],["#55bfe0","#167f94"],["rgb(85, 191, 224)","rgb(22, 127, 148)"],["#61c6ce","#10676e"],["rgb(97, 198, 206)","rgb(16, 103, 110)"],["#58b957","#287f28"],["rgb(88, 185, 87)","rgb(40, 127, 40)"],["rgb(18, 170, 181)","rgb(14, 145, 155)"],["rgb(255, 133, 89)","rgb(189, 84, 46)"],["rgb(240, 142, 129)","rgb(165, 81, 70)"],["rgb(245, 175, 88)","rgb(133, 72, 0)"],["rgb(100, 187, 226)","rgb(28, 103, 136)"],["rgb(162, 157, 197)","rgb(99, 95, 129)"],["rgb(86, 81, 126)","rgb(164, 160, 198)"],["#bac8d3","#39454e"],["rgb(186, 200, 211)","rgb(57, 69, 78)"],["black","#ededed"],["#b6d7a8","#29461d"],["rgb(182, 215, 168)","rgb(41, 70, 29)"],["#cfe2f3","#20303f"],["rgb(207, 226, 243)","rgb(32, 48, 63)"],["#f4cccc","#522f2f"],["rgb(244, 204, 204)","rgb(82, 47, 47)"],["#10739e","#54a9ce"],["rgb(16, 115, 158)","rgb(84, 169, 206)"],["#1699d3","#2292c4"],["rgb(22, 153, 211)","rgb(34, 146, 196)"],["#e85642","#ed705f"],["rgb(232, 86, 66)","rgb(237, 112, 95)"],["#006600","#6fc76f"],["rgb(0, 102, 0)","rgb(111, 199, 111)"],["#2f5b7c","#85abc7"],["rgb(47, 91, 124)","rgb(133, 171, 199)"],["rgb(193, 240, 5)","rgb(37, 77, 0)"],["rgb(177, 221, 240)","rgb(23, 61, 77)"],["rgb(93, 127, 153)","rgb(108, 137, 159)"],["rgb(242, 147, 30)","rgb(173, 91, 0)"],["rgb(14, 128, 136)","rgb(70, 168, 175)"],["rgb(255, 242, 56)","rgb(58, 47, 0)"],["rgb(153, 76, 0)","rgb(219, 153, 88)"],["rgb(97, 198, 206)","rgb(16, 103, 110)"],["#a6c9ff","#284674"],["rgb(166, 201, 255)","rgb(40, 70, 116)"],["#cfdaff","#283151"],["rgb(207, 218, 255)","rgb(40, 49, 81)"],["#fff787","#2b2400"],["rgb(255, 247, 135)","rgb(43, 36, 0)"],["#ffffb5","#1b1b00"],["rgb(255, 255, 181)","rgb(27, 27, 0)"],["#c0d197","#384715"],["rgb(192, 209, 151)","rgb(56, 71, 21)"],["#dcf0ad","#1d2e00"],["rgb(220, 240, 173)","rgb(29, 46, 0)"],["#d6a27a","#815432"],["rgb(214, 162, 122)","rgb(129, 84, 50)"],["#ffc191","#6b360d"],["rgb(255, 193, 145)","rgb(107, 54, 13)"],["#6eadff","#2e65ab"],["rgb(110, 173, 255)","rgb(46, 101, 171)"],["#fff238","#3a2f00"],["rgb(255, 242, 56)","rgb(58, 47, 0)"],["#c1f005","#254d00"],["rgb(193, 240, 5)","rgb(37, 77, 0)"],["#ff5f03","#f56c1c"],["rgb(255, 95, 3)","rgb(245, 108, 28)"],["#3aa670","#2f8c5d"],["rgb(58, 166, 112)","rgb(47, 140, 93)"],["#d4e1f5","#233247"],["rgb(212, 225, 245)","rgb(35, 50, 71)"],["#0126b5","#a8c8ff"],["rgb(1, 38, 181)","rgb(168, 200, 255)"],["#5b6369","#939a9f"],["rgb(91, 99, 105)","rgb(147, 154, 159)"],["#5d636a","#94999f"],["rgb(93, 99, 106)","rgb(148, 153, 159)"],["#d1d5e1","#333640"],["rgb(209, 213, 225)","rgb(51, 54, 64)"],["#52595e","#9da3a8"],["rgb(82, 89, 94)","rgb(157, 163, 168)"],["#54b786","#257a50"],["rgb(84, 183, 134)","rgb(37, 122, 80)"],["#9acdb4","#27533e"],["rgb(154, 205, 180)","rgb(39, 83, 62)"],["#abb4c5","#4b5361"],["rgb(171, 180, 197)","rgb(75, 83, 97)"],["#b8bfd1","#434959"],["rgb(184, 191, 209)","rgb(67, 73, 89)"],["#c6cace","#3c4043"],["rgb(198, 202, 206)","rgb(60, 64, 67)"],["#d2d6e2","#31353f"],["rgb(210, 214, 226)","rgb(49, 53, 63)"],["#9da5ab","#5a6166"],["rgb(157, 165, 171)","rgb(90, 97, 102)"],["#697079","#888e96"],["rgb(105, 112, 121)","rgb(136, 142, 150)"],["#818181","#7e7e7e"],["rgb(129, 129, 129)","rgb(126, 126, 126)"],["#b6bdcf","#454b5b"],["rgb(182, 189, 207)","rgb(69, 75, 91)"],["#e6e7e9","#252627"],["rgb(230, 231, 233)","rgb(37, 38, 39)"],["#acd9f1","#1a4055"],["rgb(172, 217, 241)","rgb(26, 64, 85)"],["#c2c9d8","#3b414e"],["rgb(194, 201, 216)","rgb(59, 65, 78)"],["#676e77","#8a9098"],["rgb(103, 110, 119)","rgb(138, 144, 152)"],["#4c5357","#a2a8ac"],["rgb(76, 83, 87)","rgb(162, 168, 172)"],["#d2d1cf","#393937"],["rgb(210, 209, 207)","rgb(57, 57, 55)"],["#5d6368","#959a9e"],["rgb(93, 99, 104)","rgb(149, 154, 158)"],["#005cf1","#5eadff"],["rgb(0, 92, 241)","rgb(94, 173, 255)"],["#061580","#c6d3ff"],["rgb(6, 21, 128)","rgb(198, 211, 255)"],["#cfcfcf","#3b3b3b"],["rgb(207, 207, 207)","rgb(59, 59, 59)"],["#5cb8e1","#1d6c8f"],["rgb(92, 184, 225)","rgb(29, 108, 143)"],["#5d646b","#93999f"],["rgb(93, 100, 107)","rgb(147, 153, 159)"],["#d1d6e1","#31353e"],["rgb(209, 214, 225)","rgb(49, 53, 62)"],["#266792","#70a7cc"],["rgb(38, 103, 146)","rgb(112, 167, 204)"],["#008cce","#28a0d9"],["rgb(0, 140, 206)","rgb(40, 160, 217)"],["#00527f","#79bfe6"],["rgb(0, 82, 127)","rgb(121, 191, 230)"],["#64aadc","#326e99"],["rgb(100, 170, 220)","rgb(50, 110, 153)"],["#0a79b9","#46a6dd"],["rgb(10, 121, 185)","rgb(70, 166, 221)"],["#999ea4","#61666b"],["rgb(153, 158, 164)","rgb(97, 102, 107)"],["#006597","#5eb5e0"],["rgb(0, 101, 151)","rgb(94, 181, 224)"],["#0090c1","#24a0ca"],["rgb(0, 144, 193)","rgb(36, 160, 202)"],["#e6efff","#1b2535"],["rgb(230, 239, 255)","rgb(27, 37, 53)"],["#e6f2f8","#102734"],["rgb(230, 242, 248)","rgb(16, 39, 52)"],["#e9f3e6","#14240f"],["rgb(233, 243, 230)","rgb(20, 36, 15)"],["#d0ebf6","#142b34"],["rgb(208, 235, 246)","rgb(20, 43, 52)"],["#fce7cd","#34220b"],["rgb(252, 231, 205)","rgb(52, 34, 11)"],["#f8c382","#673a02"],["rgb(248, 195, 130)","rgb(103, 58, 2)"],["#faddd9","#3e2521"],["rgb(250, 221, 217)","rgb(62, 37, 33)"],["#fad9d5","#3a1512"],["rgb(250, 217, 213)","rgb(58, 21, 18)"],["#fff4f2","#241413"],["rgb(255, 244, 242)","rgb(36, 20, 19)"],["#b0e3e6","#12393c"],["rgb(176, 227, 230)","rgb(18, 57, 60)"],["#c3cd2d","#4c5400"],["rgb(195, 205, 45)","rgb(76, 84, 0)"],["gray","rgb(127, 127, 127)"]].forEach(entry=>{KATANA_DRAWIO_DARK_COLOR_BY_LIGHT_COLOR.set(entry[0],entry[1])}),KATANA_DRAWIO_DARK_CONTEXT_COLOR.set("stop|stop-color|#ffffff","#121212");const KATANA_DRAWIO_SIMPLE_DIAGRAM_DARK_COLOR=new Map([["ellipse|fill|#ffffff","#121212"],["ellipse|fill|white","#121212"],["path|fill|#ffffff","#121212"],["path|fill|white","#121212"]]),KATANA_DRAWIO_DARK_TEXT_COLOR_BY_LIGHT_COLOR=new Map([["default","#ffffff"],["#000000","#ffffff"],["rgb(0, 0, 0)","rgb(255, 255, 255)"],["#ffffff","#121212"],["rgb(255, 255, 255)","rgb(18, 18, 18)"],["#121212","#ffffff"],["rgb(18, 18, 18)","rgb(255, 255, 255)"],["#333333","#c1c1c1"],["rgb(51, 51, 51)","rgb(193, 193, 193)"],["#660000","#ffc4c4"],["rgb(102, 0, 0)","rgb(255, 196, 196)"],["#0d5b9d","#70b3ec"],["rgb(13, 91, 157)","rgb(112, 179, 236)"],["#232f3e","#bdc7d4"],["rgb(35, 47, 62)","rgb(189, 199, 212)"],["#23497d","#bdd7ff"],["rgb(35, 73, 125)","rgb(189, 215, 255)"],["#23445d","#a0bcd2"],["rgb(35, 68, 93)","rgb(160, 188, 210)"],["#505863","#9ca3ac"],["rgb(80, 88, 99)","rgb(156, 163, 172)"],["#742b21","#eeafa6"],["rgb(116, 43, 33)","rgb(238, 175, 166)"],["#3333ff","#a8a8ff"],["rgb(51, 51, 255)","rgb(168, 168, 255)"],["#4286c5","#518bc1"],["rgb(66, 134, 197)","rgb(81, 139, 193)"],["#647687","#7d8c9b"],["#6d8764","#718769"],["#a0522d","#d28f70"],["#76608a","#a18eb3"],["#e51400","#ff9281"],["#567199","#7a91b3"],["#bd5652","#d67e7a"],["#78a65f","#50783b"],["#bd8653","#9b6c40"],["#7f00ff","#ff9fff"],["rgb(127, 0, 255)","rgb(255, 159, 255)"],["#cc6600","#d47d25"],["rgb(204, 102, 0)","rgb(212, 125, 37)"]]),KATANA_DRAWIO_TEXT_COLOR_BY_THEME=[new Map,KATANA_DRAWIO_DARK_TEXT_COLOR_BY_LIGHT_COLOR],KATANA_DRAWIO_DARK_SCALE_RULES=[{luminance:.82,saturation:.25,scale:.14},{luminance:.82,saturation:Number.POSITIVE_INFINITY,scale:.35},{luminance:.62,saturation:.2,scale:.24},{luminance:.62,saturation:Number.POSITIVE_INFINITY,scale:.45},{luminance:.42,saturation:Number.POSITIVE_INFINITY,scale:.62},{luminance:Number.NEGATIVE_INFINITY,saturation:Number.POSITIVE_INFINITY,scale:1}],KATANA_DRAWIO_HEX_COLOR_READERS=[function katanaDrawioFullHexChannels(value){const match=/^#([0-9a-f]{6})$/iu.exec(value);return match?katanaDrawioHexChannels(match[1]):null},function katanaDrawioShortHexChannels(value){const match=/^#([0-9a-f]{3})$/iu.exec(value);return match?katanaDrawioHexChannels(function katanaDrawioExpandedHex(hex){return hex.split("").map(channel=>`${channel}${channel}`).join("")}(match[1])):null}];function katanaDrawioColorLuminance(value){return[katanaDrawioParsedColor(value)].filter(Boolean).map(katanaDrawioRgbLuminance).concat([1])[0]}function katanaDrawioRgbLuminance(color){return(.2126*color[0]+.7152*color[1]+.0722*color[2])/255}function katanaDrawioRgbSaturation(color){const channels=color.map(channel=>channel/255),max=Math.max(...channels),min=Math.min(...channels);return 0===max?0:(max-min)/max}function katanaDrawioParsedColor(value){return function katanaDrawioParsedHexColor(value){return KATANA_DRAWIO_HEX_COLOR_READERS.map(reader=>reader(value)).filter(Boolean).concat([null])[0]}(value)||function katanaDrawioParsedRgbColor(value){const match=/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/iu.exec(value);return match?match.slice(1,4).map(Number):null}(value)}function katanaDrawioHexChannels(hex){return[hex.slice(0,2),hex.slice(2,4),hex.slice(4,6)].map(channel=>Number.parseInt(channel,16))}function katanaDrawioHexChannel(channel){return channel.toString(16).padStart(2,"0")}const KATANA_DRAWIO_DARK_TEXT_FALLBACK_COLORS=["","#ffffff"];function katanaDrawioIsTooltipsDarkFillElement(element){return["ellipse"===element.localName,katanaDrawioIsLargeTooltipsPath(element)].some(Boolean)}function katanaDrawioIsLargeTooltipsPath(element){return["path"===element.localName,katanaDrawioElementArea(element)>1e3].every(Boolean)}function katanaDrawioShouldPreserveExplicitHtmlTextContentColor(element,color){return[katanaDrawioIsDarkMode(),"content"===element.getAttribute?.("data-katana-drawio-html-text"),katanaDrawioSourceStyleForElement(element).has("fontColor"),color].every(Boolean)}function katanaDrawioShouldPreserveExplicitHtmlTextDescendantColor(element,color){return[katanaDrawioIsDarkMode(),"1"===element.getAttribute?.("data-katana-drawio-html-text-explicit-color"),color].every(Boolean)}function katanaDrawioShouldPreserveImplicitHtmlTextContentColor(element,color){return[katanaDrawioIsDarkMode(),"content"===element.getAttribute?.("data-katana-drawio-html-text"),katanaDrawioSourceStyleUsesDarkHtmlTextBackground(element),"#ffffff"===katanaDrawioColorKey(color)].every(Boolean)}function katanaDrawioSourceStyleUsesDarkHtmlTextBackground(element){const style=katanaDrawioSourceStyleForElement(element);return[style.has("text"),"text"===style.get("shape"),"none"===style.get("fillColor")].some(Boolean)}function katanaDrawioResolvedTextColor(color){const value=katanaDrawioColorKey(color);return katanaDrawioLightDarkExactColor(value)||katanaDrawioTextColorMapForTheme().get(value)||katanaDrawioColorMapForTheme().get(value)||function katanaDrawioFallbackDarkTextColor(value){return KATANA_DRAWIO_DARK_TEXT_FALLBACK_COLORS[Number(function katanaDrawioShouldUseFallbackDarkTextColor(value){return[katanaDrawioIsDarkMode(),katanaDrawioColorLuminance(value)<.45].every(Boolean)}(value))]}(value)||value}function katanaDrawioTextColorMapForTheme(){return KATANA_DRAWIO_TEXT_COLOR_BY_THEME[Number(katanaDrawioIsDarkMode())]}function katanaDrawioStyleWithProperty(style,name,value){return String(style).split(";").map(declaration=>function katanaDrawioStylePropertyDeclaration(declaration,name,value){return[declaration.trim()].filter(Boolean).map(it=>function katanaDrawioStylePropertyReplacement(declaration,name,value){return[declaration].filter(it=>function katanaDrawioStyleDeclarationName(declaration){return declaration.slice(0,declaration.indexOf(":")).trim().toLowerCase()}(it)===name).map(()=>`${name}: ${value}`).concat([""])[0]}(it,name,value)||it).concat([""])[0]}(declaration,name,value)).filter(Boolean).join("; ")}function katanaDrawioFallbackDarkColor(value){return[katanaDrawioParsedColor(value)].filter(Boolean).map(color=>katanaDrawioOfficialDarkColor(value)||function katanaDrawioDarkThemeColor(color){return function katanaDrawioRgbHex(color){return`#${color.map(katanaDrawioHexChannel).join("")}`}(function katanaDrawioScaledDarkColor(color,scale){return color.map(channel=>Math.round(channel*scale))}(color,function katanaDrawioDarkScale(color){const metrics=function katanaDrawioColorMetrics(color){return{luminance:katanaDrawioRgbLuminance(color),saturation:katanaDrawioRgbSaturation(color)}}(color);return KATANA_DRAWIO_DARK_SCALE_RULES.find(rule=>function katanaDrawioDarkScaleRuleMatches(metrics,rule){return[metrics.luminance>rule.luminance,metrics.saturation<rule.saturation].every(Boolean)}(metrics,rule)).scale}(color)))}(color)).concat([""])[0]}function katanaDrawioOfficialDarkColor(value){return katanaDrawioCanUseAdaptiveSourceColor(value)&&katanaDrawioMxUtils().getLightDarkColor(value).dark||""}function katanaDrawioElementHasCellId(element){return element.hasAttribute("data-cell-id")}function katanaDrawioShadowTarget(group){return Array.from(group.children).find(katanaDrawioIsShadowShapeGroup)??null}function katanaDrawioIsShadowShapeGroup(element){return["g"===element.localName,element.hasAttribute("transform")].every(Boolean)}function katanaSetDrawioShadowStyle(element){element.setAttribute("style",function katanaDrawioStyleWithAddedProperty(style,name,value){const rewritten=katanaDrawioStyleWithProperty(style,name,value);return rewritten.includes(`${name}:`)?rewritten:[rewritten,`${name}: ${value}`].filter(Boolean).join("; ")}(function katanaDrawioShadowBaseStyle(element){return String(element.getAttribute("style")??"")}(element),"filter",function katanaDrawioShadowFilter(){return katanaDrawioIsDarkMode()?"drop-shadow(rgba(237, 237, 237, 0.25) 2px 3px 2px)":"drop-shadow(rgba(0, 0, 0, 0.25) 2px 3px 2px)"}()))}const KATANA_EMPTY_DRAWIO_ATTRIBUTES=new Map,KATANA_DRAWIO_ATTRIBUTE_READERS=[function katanaEmptyDrawioAttributes(_attributes){return KATANA_EMPTY_DRAWIO_ATTRIBUTES},function katanaReadableDrawioAttributes(attributes){return attributes}],KATANA_DRAWIO_SOURCE_OBJECT_ATTRIBUTES=function katanaDrawioSourceObjectAttributes(){return new Map(Array.from(katanaDrawioRequestSource().matchAll(/<(?:UserObject|object)\\b([^>]*)>/g)).map(match=>katanaDrawioXmlAttributes(match[1])).map(attributes=>[katanaDrawioCellAttribute(attributes,"id"),attributes]).filter(entry=>entry[0]))}(),KATANA_DRAWIO_SOURCE_VARS=function katanaDrawioSourceVars(){const match=katanaDrawioRequestSource().match(/\\bvars=\'([^\']*)\'/);return match?function katanaDrawioParsedSourceVars(source){try{return new Map(Object.entries(JSON.parse(source)))}catch(_error){return new Map}}(decodeHtmlEntities(match[1])):new Map}();function katanaDrawioSourceLabelEntries(){return[...Array.from(katanaDrawioRequestSource().matchAll(/<mxCell\\b([^>]*)>/g)).map(katanaDrawioMxCellLabelEntry),...Array.from(katanaDrawioRequestSource().matchAll(/<(?:UserObject|object)\\b([^>]*)>\\s*<mxCell\\b([^>]*)/g)).map(katanaDrawioObjectLabelEntry)].filter(katanaHasDrawioCellLabel)}function katanaDrawioMxCellLabelEntry(match){const attributes=katanaDrawioXmlAttributes(match[1]);return katanaDrawioSourceLabelEntry(attributes,attributes,katanaDrawioResolvedLabelValue(attributes,attributes,katanaDrawioCellAttribute(attributes,"value")))}function katanaDrawioObjectLabelEntry(match){const objectAttributes=katanaDrawioXmlAttributes(match[1]),cellAttributes=katanaDrawioXmlAttributes(match[2]);return katanaDrawioSourceLabelEntry(objectAttributes,cellAttributes,katanaDrawioResolvedLabelValue(objectAttributes,cellAttributes,katanaDrawioCellAttribute(objectAttributes,"label")))}function katanaDrawioSourceLabelEntry(attributes,cellAttributes,value){return{id:katanaDrawioCellAttribute(attributes,"id")||katanaDrawioCellAttribute(cellAttributes,"id"),value:value,label:katanaDrawioHtmlLabelText(value),edge:"1"===katanaDrawioCellAttribute(cellAttributes,"edge"),style:katanaDrawioCellAttribute(cellAttributes,"style")}}function katanaDrawioResolvedLabelValue(attributes,cellAttributes,value){return function katanaDrawioShouldResolvePlaceholders(attributes,cellAttributes){return["1"===katanaDrawioCellAttribute(attributes,"placeholders"),"1"===katanaDrawioStyleValue(katanaDrawioCellAttribute(cellAttributes,"style"),"placeholders")].some(Boolean)}(attributes,cellAttributes)?String(value).replace(/%([a-zA-Z0-9:_-]+)%/g,(_match,name)=>function katanaDrawioPlaceholderValue(name,attributes,cellAttributes){return[katanaDrawioCellAttribute(attributes,name),katanaDrawioCellAttribute(cellAttributes,name),katanaDrawioCellAttribute(katanaDrawioParentObjectAttributes(cellAttributes),name),KATANA_DRAWIO_SOURCE_VARS.get(name),`%${name}%`].filter(Boolean)[0]}(name,attributes,cellAttributes)):value}function katanaDrawioParentObjectAttributes(cellAttributes){return KATANA_DRAWIO_SOURCE_OBJECT_ATTRIBUTES.get(katanaDrawioCellAttribute(cellAttributes,"parent"))??KATANA_EMPTY_DRAWIO_ATTRIBUTES}function katanaDrawioCellAttribute(attributes,name){return function katanaDrawioAttributeReader(attributes){return KATANA_DRAWIO_ATTRIBUTE_READERS[Number(function katanaCanReadDrawioAttributes(attributes){return"function"==typeof attributes?.get}(attributes))](attributes)}(attributes).get(name)??""}function katanaDrawioXmlAttributes(source){return new Map(Array.from(String(source).matchAll(/([a-zA-Z0-9:_-]+)="([^"]*)"/g)).map(katanaDrawioXmlAttributeEntry))}function katanaDrawioXmlAttributeEntry(match){return[match[1],decodeHtmlEntities(match[2])]}function katanaHasDrawioCellLabel(entry){return[entry.id,entry.label].every(Boolean)}function katanaDrawioRequestSource(){return String(globalThis.__katanaDrawioRequest?.source??"")}function katanaDrawioCellGroup(svg,id){return Array.from(svg.querySelectorAll("g")).find(node=>node.getAttribute("data-cell-id")===id)??null}function katanaShouldInsertDrawioText(group){return[group,!katanaDrawioCellHasText(group),katanaDrawioCellShapeBox(group)].every(Boolean)}function katanaDrawioCellHasText(group){return group.querySelectorAll("text").length>0}function katanaDrawioCellShapeBox(group){return katanaDrawioUnionBox(function katanaDrawioCellShapeElements(group){return["rect","path","ellipse","circle","polygon","polyline","image"].flatMap(tagName=>Array.from(group.querySelectorAll(tagName)))}(group).map(katanaDrawioElementBox).filter(katanaDrawioHasArea))}function katanaDrawioTextLines(label){return String(label).split(/\\n+/).filter(Boolean)}function katanaDrawioCenterLabelPosition(box,_entry,lines,fontSize){return katanaDrawioTextPosition(box.x+box.width/2,katanaDrawioCenteredTextY(box,lines,fontSize),"middle")}function katanaDrawioTextPosition(x,y,anchor){return{x:x,y:y,anchor:anchor}}function katanaDrawioCenteredTextY(box,lines,fontSize){return box.y+box.height/2+fontSize/3-(lines.length-1)*fontSize*1.25/2}function katanaDrawioSpacing(style,name){return[Number(katanaDrawioStyleValue(style,name))].filter(Number.isFinite).concat([0])[0]}function katanaDrawioTextLineDy(index,fontSize){return["0",String(Math.ceil(1.25*fontSize))][Number(index>0)]}const KATANA_DRAWIO_LABEL_POSITIONERS=new Map([["bottom",function katanaDrawioBottomLabelPosition(box,entry,_lines,fontSize){return katanaDrawioTextPosition(box.x+box.width/2,box.y+box.height+fontSize+7+katanaDrawioSpacing(entry.style,"spacingTop"),"middle")}],["left",function katanaDrawioLeftLabelPosition(box,entry,lines,fontSize){return katanaDrawioTextPosition(box.x-2-katanaDrawioSpacing(entry.style,"spacingRight")-katanaDrawioAppliedLeftPadding(),katanaDrawioCenteredTextY(box,lines,fontSize),"end")}],["right",function katanaDrawioRightLabelPosition(box,entry,lines,fontSize){return katanaDrawioTextPosition(box.x+box.width+2+katanaDrawioSpacing(entry.style,"spacingLeft")-2*katanaDrawioAppliedLeftPadding(),katanaDrawioCenteredTextY(box,lines,fontSize),"start")}]]);function katanaDrawioRichTextLabelEntry(entry){return{id:entry.id,lines:(label=entry.value,String(label).split(/<\\s*br\\s*\\/?>/i).map(katanaDrawioRichTextLine).filter(line=>line.text))};var label}function katanaHasRichDrawioTextLabel(entry){return[entry.id,entry.lines.length>0,entry.lines.some(line=>line.bold||line.italic)].every(Boolean)}function katanaDrawioRichTextLine(source){return{text:katanaDrawioHtmlLabelText(source),bold:/<\\s*b\\b/i.test(source),italic:/<\\s*i\\b/i.test(source)}}function katanaDrawioRichTextElement(group){return Array.from(group.querySelectorAll("text"))[0]??null}function katanaApplyRichDrawioTextStyle(node,line){(function katanaRichDrawioTextAttributes(line){return[line].filter(Boolean).flatMap(it=>[[it.bold,{name:"font-weight",value:"bold"}],[it.italic,{name:"font-style",value:"italic"}]]).filter(entry=>entry[0]).map(entry=>entry[1])})(line).forEach(attribute=>{node.setAttribute(attribute.name,attribute.value)})}let KATANA_DRAWIO_LABEL_CLIP_INDEX=0;function katanaDrawioAncestorElements(element){const parent1=katanaDrawioParentNode(element),parent2=katanaDrawioParentNode(parent1),parent3=katanaDrawioParentNode(parent2),parent4=katanaDrawioParentNode(parent3),parent5=katanaDrawioParentNode(parent4);return[element,parent1,parent2,parent3,parent4,parent5,katanaDrawioParentNode(parent5)].filter(Boolean)}function katanaCreateDrawioSvgDefs(svg){const defs=document.createElementNS("http://www.w3.org/2000/svg","defs");return svg.insertBefore(defs,svg.firstChild),defs}function katanaNormalizeWrappedDrawioTextLabels(svg){katanaDrawioSourceLabelEntries().forEach(entry=>{!function katanaNormalizeWrappedDrawioTextLabel(svg,entry){[katanaDrawioCellGroup(svg,entry.id)].filter(Boolean).filter(group=>function katanaShouldNormalizeWrappedDrawioLabel(group,entry){return!katanaDrawioGroupHasForeignObject(group)&&[katanaDrawioCellShapeBox(group)].filter(Boolean).map(box=>function katanaWrappedDrawioLabelNeeded(entry,box){return["wrap"===katanaDrawioStyleValue(entry.style,"whiteSpace"),katanaDrawioTextNeedsWrap(entry.label,box,katanaDrawioFontSize(entry.style))].every(Boolean)}(entry,box)).concat([!1])[0]}(group,entry)).forEach(group=>{!function katanaReplaceWrappedDrawioTextLabel(group,entry){[katanaDrawioCellShapeBox(group)].filter(Boolean).forEach(box=>{const label=function katanaCreateWrappedDrawioTextLabel(entry,box){const style=entry.style,fontSize=katanaDrawioFontSize(entry.style),lines=function katanaDrawioWrappedTextLines(label,box,fontSize){const lineLimit=katanaDrawioMaxLineChars(box,fontSize);return katanaDrawioTextLines(label).flatMap(line=>function katanaDrawioWrapTextLine(line,lineLimit){return String(line).split(/\\s+/).filter(Boolean).reduce(function katanaAppendDrawioWrappedWord(lineLimit){return(lines,word)=>function katanaAppendDrawioWrappedLine(lines,word,lineLimit){const candidate=[katanaDrawioLastTextLine(lines),word].filter(Boolean).join(" ");return candidate.length<=lineLimit?function katanaDrawioReplaceLastTextLine(lines,line){return lines.slice(0,-1).concat([line])}(lines,candidate):lines.concat([word])}(lines,word,lineLimit)}(lineLimit),[])}(line,lineLimit))}(entry.label,box,fontSize),text=function katanaWrappedDrawioTextElement(box,style,lines,fontSize){const text=document.createElementNS("http://www.w3.org/2000/svg","text"),alignment=function katanaDrawioTextAlignment(style){return KATANA_DRAWIO_TEXT_ALIGNMENT.get(katanaDrawioStyleValueFromMap(style,"align","center"))??KATANA_DRAWIO_TEXT_ALIGNMENT.get("center")}(style);return text.setAttribute("x",function katanaDrawioAlignedTextX(box,alignment){return box.x+alignment.offset+box.width*alignment.ratio}(box,alignment)),text.setAttribute("y",function katanaDrawioAlignedTextY(box,style,lines,fontSize){return function katanaDrawioTextVerticalAlignment(style){return KATANA_DRAWIO_TEXT_VERTICAL_ALIGNMENT.get(katanaDrawioStyleValueFromMap(style,"verticalAlign","middle"))??KATANA_DRAWIO_TEXT_VERTICAL_ALIGNMENT.get("middle")}(style).y(box,lines,fontSize)}(box,style,lines,fontSize)),text.setAttribute("fill",katanaDrawioTextColor(style)),text.setAttribute("font-family","Helvetica"),text.setAttribute("font-size",`${fontSize}px`),text.setAttribute("text-anchor",alignment.anchor),text}(box,style,lines,fontSize);return lines.forEach((line,index)=>{text.appendChild(function katanaWrappedDrawioTextLine(text,line,index,fontSize){const tspan=document.createElementNS("http://www.w3.org/2000/svg","tspan");return tspan.setAttribute("x",text.getAttribute("x")),tspan.setAttribute("dy",function katanaWrappedDrawioLineDy(index,fontSize){return["0",String(Math.ceil(1.2*fontSize))][Number(index>0)]}(index,fontSize)),tspan.textContent=line,tspan}(text,line,index,fontSize))}),text}(entry,box);katanaDrawioTextNodes(group).forEach(katanaRemoveDrawioNode),group.appendChild(label),function katanaClipWrappedDrawioTextLabel(text,box){var element;[(element=text,katanaDrawioAncestorElements(element).filter(it=>"svg"===it.localName).concat([null])[0])].filter(Boolean).forEach(svg=>{const id=function katanaDrawioNextLabelClipId(){return KATANA_DRAWIO_LABEL_CLIP_INDEX+=1,`katana-drawio-label-clip-${KATANA_DRAWIO_LABEL_CLIP_INDEX}`}();(function katanaDrawioSvgDefs(svg){return[svg.querySelector("defs")].filter(Boolean).concat([katanaCreateDrawioSvgDefs(svg)])[0]})(svg).appendChild(function katanaCreateDrawioLabelClipPath(id,box){const clipPath=document.createElementNS("http://www.w3.org/2000/svg","clipPath");return clipPath.setAttribute("id",id),clipPath.appendChild(function katanaCreateDrawioLabelClipRect(box){const rect=document.createElementNS("http://www.w3.org/2000/svg","rect");return rect.setAttribute("x",box.x),rect.setAttribute("y",box.y),rect.setAttribute("width",box.width),rect.setAttribute("height",box.height),rect}(box)),clipPath}(id,box)),text.setAttribute("clip-path",`url(#${id})`)})}(label,box)})}(group,entry)})}(svg,entry)})}function katanaDrawioGroupHasForeignObject(group){return group.querySelectorAll("foreignObject").length>0}function katanaDrawioTextNeedsWrap(label,box,fontSize){const lineLimit=katanaDrawioMaxLineChars(box,fontSize);return katanaDrawioTextLines(label).some(line=>line.length>lineLimit)}function katanaDrawioTextNodes(group){return Array.from(group.querySelectorAll("text"))}function katanaDrawioLastTextLine(lines){return lines.at(-1)??""}function katanaDrawioMaxLineChars(box,fontSize){return Math.max(1,Math.floor((box.width-8)/function katanaDrawioAverageCharWidth(fontSize){return.55*fontSize}(fontSize)))}function katanaDrawioStyleMap(style){return new Map(String(style).split(";").map(katanaDrawioStyleEntry).filter(entry=>entry[0]))}function katanaDrawioStyleEntry(value){const parts=String(value).split("=").concat(["",""]);return[parts[0],parts[1]]}function katanaDrawioStyleValue(style,name){return katanaDrawioStyleMap(style).get(name)??""}function katanaDrawioFontSize(style){return[Number(katanaDrawioStyleValue(style,"fontSize"))].filter(Number.isFinite).filter(it=>it>0).concat([12])[0]}function katanaDrawioTextColor(style){return katanaDrawioStyleValueFromMap(style,"fontColor","#000000")}function katanaDrawioStyleValueFromMap(style,name,fallback){return katanaDrawioStyleMap(style).get(name)??fallback}const KATANA_DRAWIO_TEXT_ALIGNMENT=new Map([["left",{anchor:"start",offset:4,ratio:0}],["center",{anchor:"middle",offset:0,ratio:.5}],["right",{anchor:"end",offset:-4,ratio:1}]]),KATANA_DRAWIO_TEXT_VERTICAL_ALIGNMENT=new Map([["top",{y:(box,_lines,fontSize)=>box.y+fontSize}],["middle",{y:(box,lines,fontSize)=>box.y+box.height/2+fontSize/2-(lines.length-1)*fontSize*1.2/2}],["bottom",{y:(box,lines,fontSize)=>box.y+box.height-lines.length*fontSize}]]);function katanaDrawioHtmlTextAlignItems(style){return KATANA_DRAWIO_HTML_TEXT_ALIGN_ITEMS.get(katanaDrawioHtmlTextVerticalAlign(style))??"center"}function katanaDrawioHtmlTextVerticalAlign(style){return katanaDrawioStyleValueFromMap(style,"verticalAlign",function katanaDrawioDefaultVerticalAlign(style){return katanaDrawioUsesDefaultBottomImageHtmlTextLabel(style)||katanaDrawioIsTextShapeStyle(style)?"top":"middle"}(style))}function katanaDrawioHtmlTextJustifyContent(style){return KATANA_DRAWIO_HTML_TEXT_JUSTIFY_CONTENT.get(katanaDrawioStyleValueFromMap(style,"align",katanaDrawioDefaultAlign(style)))??"center"}function katanaDrawioTextAlign(style){return katanaDrawioStyleValueFromMap(style,"align",katanaDrawioDefaultAlign(style))}function katanaDrawioDefaultAlign(style){return katanaDrawioIsTextShapeStyle(style)?"left":"center"}function katanaDrawioIsTextShapeStyle(style){return[katanaDrawioStyleMap(style).has("text"),"text"===katanaDrawioStyleValue(style,"shape")].some(Boolean)}function katanaDrawioHtmlFontFamily(style){const family=katanaDrawioStyleValueFromMap(style,"fontFamily","Helvetica");return family.includes(" ")?`\'${family}\'`:family}function katanaDrawioHtmlTextTop(style,box){if(katanaDrawioIsFillHtmlTextLabel(style))return Math.round(box.y);if(katanaDrawioIsBottomHtmlTextLabel(style))return Math.round(box.y+box.height+7+katanaDrawioHtmlTextSpacingTop(style));if(katanaDrawioUsesExplicitLeftTopHtmlTextLabel(style))return Math.round(box.y-function katanaDrawioHtmlTextSpacingBottom(style){return katanaDrawioHtmlTextNumberStyle(style,"spacingBottom")}(style)-3);if(katanaDrawioUsesTextShapeWrapInsets(style))return Math.round(box.y+2);if(katanaDrawioUsesExplicitHtmlTextSpacing(style)&&katanaDrawioHtmlTextAlignTop(style))return Math.round(box.y+katanaDrawioHtmlTextSpacing(style)+katanaDrawioHtmlTextSpacingTop(style)+5+function katanaDrawioHtmlTextOfficialTopOffset(){return katanaDrawioHasDarkCubePageTop()?3:0}());const alignment=katanaDrawioHtmlTextVerticalAlign(style),textTop=(KATANA_DRAWIO_HTML_TEXT_TOP_BY_ALIGNMENT.get(alignment)??katanaDrawioMiddleHtmlTextTop)(box);return Math.round(textTop+function katanaDrawioMiddleHtmlTextSpacingTop(style,alignment){return"middle"===alignment?katanaDrawioHtmlTextSpacingTop(style)/2:0}(style,alignment))}function katanaDrawioMiddleHtmlTextTop(box){return box.y+box.height/2}function katanaDrawioHtmlTextWidth(style,box){return katanaDrawioIsFillHtmlTextLabel(style)?Math.max(1,Math.round(box.width+2)):katanaDrawioIsBottomHtmlTextLabel(style)?1:katanaDrawioUsesExplicitLeftTopHtmlTextLabel(style)?Math.max(1,Math.round(box.width+2)):katanaDrawioUsesTextShapeWrapInsets(style)?Math.max(1,Math.round(box.width-2)):katanaDrawioUsesExplicitHtmlTextSpacing(style)?Math.max(1,Math.round(box.width-function katanaDrawioHtmlTextHorizontalSpacing(style){return 2*katanaDrawioHtmlTextSpacing(style)+katanaDrawioHtmlTextSpacingLeft(style)+katanaDrawioHtmlTextSpacingRight(style)}(style)+2)):katanaDrawioIsSideHtmlTextLabel(style)?1:Math.max(1,Math.round(box.width-2))}function katanaDrawioHtmlTextHeight(style,box){return katanaDrawioIsFillHtmlTextLabel(style)?Math.max(1,Math.round(box.height)):1}function katanaDrawioHtmlTextLeft(style,box){return katanaDrawioIsFillHtmlTextLabel(style)?Math.round(box.x-katanaDrawioAppliedLeftPadding()):katanaDrawioIsLeftHtmlTextLabel(style)?katanaDrawioUsesExplicitLeftTopHtmlTextLabel(style)?Math.round(box.x-katanaDrawioHtmlTextWidth(style,box)-katanaDrawioHtmlTextSpacingRight(style)-katanaDrawioAppliedLeftPadding()):Math.round(box.x-2-katanaDrawioHtmlTextSpacingRight(style)-katanaDrawioAppliedLeftPadding()):katanaDrawioUsesTextShapeWrapInsets(style)?Math.round(box.x+2-katanaDrawioAppliedLeftPadding()):katanaDrawioUsesExplicitHtmlTextSpacing(style)?Math.round(box.x+katanaDrawioHtmlTextSpacing(style)+katanaDrawioHtmlTextSpacingLeft(style)-function katanaDrawioRightAlignedHtmlTextOffset(style){return"right"===katanaDrawioTextAlign(style)?2:0}(style)-katanaDrawioAppliedLeftPadding()):katanaDrawioIsBottomHtmlTextLabel(style)?Math.round(box.x+box.width/2-katanaDrawioAppliedLeftPadding()):Math.round((katanaDrawioIsRightHtmlTextLabel(style)?box.x+box.width+2+katanaDrawioHtmlTextSpacingLeft(style):box.x+KATANA_DRAWIO_HTML_TEXT_LEFT_PADDING)-katanaDrawioAppliedLeftPadding())}function katanaDrawioHtmlTextBoxSizeStyle(style,box){return katanaDrawioIsFillHtmlTextLabel(style)?[`width: ${Math.max(1,Math.round(box.width))}px`,`height: ${Math.max(1,Math.round(box.height))}px`,"overflow: hidden"]:"hidden"===katanaDrawioStyleValue(style,"overflow")?[`max-height: ${Math.max(1,Math.round(box.height))}px`,"overflow: hidden"]:[]}function katanaDrawioHtmlTextWhiteSpace(style){return[katanaDrawioIsFillHtmlTextLabel(style),katanaDrawioIsBottomHtmlTextLabel(style)].some(Boolean)?"nowrap":"normal"}function katanaDrawioHtmlTextContentSizeStyle(style){return katanaDrawioIsFillHtmlTextLabel(style)?["width: 100%","height: 100%"]:[]}function katanaDrawioIsFillHtmlTextLabel(style){return"fill"===katanaDrawioStyleValue(style,"overflow")}function katanaDrawioIsRightHtmlTextLabel(style){return"right"===katanaDrawioStyleValue(style,"labelPosition")}function katanaDrawioIsLeftHtmlTextLabel(style){return"left"===katanaDrawioStyleValue(style,"labelPosition")}function katanaDrawioIsSideHtmlTextLabel(style){return[katanaDrawioIsLeftHtmlTextLabel(style),katanaDrawioIsRightHtmlTextLabel(style)].some(Boolean)}function katanaDrawioIsBottomHtmlTextLabel(style){return[["bottom"===katanaDrawioStyleValue(style,"verticalLabelPosition"),katanaDrawioUsesDefaultBottomImageHtmlTextLabel(style)].some(Boolean),!katanaDrawioIsSideHtmlTextLabel(style)].every(Boolean)}function katanaDrawioUsesDefaultBottomImageHtmlTextLabel(style){return[katanaDrawioIsImageStyle(style),""===katanaDrawioStyleValue(style,"verticalLabelPosition")].every(Boolean)}function katanaDrawioIsImageStyle(style){const styleMap=katanaDrawioStyleMap(style);return[styleMap.has("image"),"image"===styleMap.get("shape")].some(Boolean)}function katanaDrawioUsesExplicitLeftTopHtmlTextLabel(style){return[katanaDrawioIsLeftHtmlTextLabel(style),katanaDrawioUsesExplicitHtmlTextSpacing(style),"top"===katanaDrawioStyleValue(style,"verticalLabelPosition")].every(Boolean)}function katanaDrawioHtmlTextColor(style){const color=katanaDrawioTextColor(style);return function katanaDrawioHtmlTextDarkColor(style,color){const value=katanaDrawioColorKey(color);return katanaDrawioKeepsLightHtmlTextOnDarkBackground(style,value)?"#ffffff":KATANA_DRAWIO_HTML_TEXT_DARK_COLOR.get(value)}(style,color)??function katanaDrawioHtmlTextAdaptiveColor(color){const adaptiveColor=[katanaDrawioIsDarkMode(),katanaDrawioCanUseAdaptiveSourceColor(color)].every(Boolean)?function katanaDrawioAdaptiveDarkColor(color){const value=katanaDrawioColorKey(color);return katanaDrawioOfficialDarkColor(value)||katanaDrawioFallbackDarkColor(value)}(color):"";return katanaDrawioColorMapForTheme().get(katanaDrawioColorKey(color))||katanaDrawioColorMapForTheme().get(katanaDrawioColorKey(adaptiveColor))||adaptiveColor||void 0}(color)??katanaDrawioResolvedTextColor(color)}function katanaDrawioKeepsLightHtmlTextOnDarkBackground(style,color){return[katanaDrawioIsDarkMode(),!katanaDrawioHasExplicitHtmlTextFontColor(style),katanaDrawioHtmlTextUsesDarkBackground(style),KATANA_DRAWIO_HTML_TEXT_LIGHT_ON_DARK_BACKGROUND.has(color)].every(Boolean)}function katanaDrawioHasExplicitHtmlTextFontColor(style){const color=katanaDrawioColorKey(katanaDrawioStyleValue(style,"fontColor"));return!["","default"].includes(color)}function katanaDrawioHtmlTextUsesDarkBackground(style){return[katanaDrawioHtmlTextUsesTransparentFill(style),katanaDrawioIsTextShapeStyle(style)].some(Boolean)}function katanaDrawioHtmlTextUsesTransparentFill(style){return["","none"].includes(katanaDrawioColorKey(katanaDrawioStyleValue(style,"fillColor")))}function katanaDrawioCanUseAdaptiveSourceColor(color){return[katanaDrawioParsedColor(katanaDrawioColorKey(color)),"function"==typeof katanaDrawioMxUtils()?.getLightDarkColor].every(Boolean)}const KATANA_DRAWIO_HTML_TEXT_LEFT_PADDING=1,KATANA_DRAWIO_HTML_TEXT_TOP_BY_ALIGNMENT=new Map([["top",function katanaDrawioTopHtmlTextTop(box){return box.y+8}],["middle",katanaDrawioMiddleHtmlTextTop],["bottom",function katanaDrawioBottomHtmlTextTop(box){return box.y+box.height-3}]]),KATANA_DRAWIO_HTML_TEXT_ALIGN_ITEMS=new Map([["top","flex-start"],["middle","center"],["bottom","flex-end"]]),KATANA_DRAWIO_HTML_TEXT_JUSTIFY_CONTENT=new Map([["left","flex-start"],["center","center"],["right","flex-end"]]),KATANA_DRAWIO_HTML_TEXT_DARK_COLOR=new Map([["#000000","light-dark(#000000, #ffffff)"],["default","light-dark(#000000, #ffffff)"]]),KATANA_DRAWIO_HTML_TEXT_LIGHT_ON_DARK_BACKGROUND=new Set(["#000000","#ffffff","default"]);function katanaDrawioHtmlTextAlignTop(style){return"top"===katanaDrawioHtmlTextVerticalAlign(style)}function katanaDrawioUsesExplicitHtmlTextSpacing(style){return["spacing","spacingTop","spacingBottom","spacingLeft","spacingRight"].some(name=>""!==katanaDrawioStyleValue(style,name))}function katanaDrawioHtmlTextSpacing(style){return katanaDrawioHtmlTextNumberStyle(style,"spacing")}function katanaDrawioHtmlTextSpacingTop(style){return katanaDrawioHtmlTextNumberStyle(style,"spacingTop")}function katanaDrawioHtmlTextSpacingLeft(style){return katanaDrawioHtmlTextNumberStyle(style,"spacingLeft")}function katanaDrawioHtmlTextSpacingRight(style){return katanaDrawioHtmlTextNumberStyle(style,"spacingRight")}function katanaDrawioHtmlTextNumberStyle(style,name){return[Number(katanaDrawioStyleValue(style,name))].filter(Number.isFinite).concat([0])[0]}function katanaDrawioUsesTextShapeWrapInsets(style){return[katanaDrawioIsTextShapeStyle(style),"wrap"===katanaDrawioStyleValue(style,"whiteSpace"),katanaDrawioHtmlTextAlignTop(style),"hidden"!==katanaDrawioStyleValue(style,"overflow"),!katanaDrawioIsSideHtmlTextLabel(style),!katanaDrawioIsBottomHtmlTextLabel(style),!katanaDrawioIsFillHtmlTextLabel(style)].every(Boolean)}function katanaDrawioHtmlTextLabelEntry(entry){return{id:entry.id,html:katanaDrawioHtmlTextLabelHtml(entry.value),label:entry.label,edge:entry.edge,replaceExisting:(html=entry.value,[!katanaDrawioHtmlTextHasMarkup(html),String(html).includes("\\n")].every(Boolean)),style:entry.style};var html}function katanaDrawioHtmlTextLabelHtml(html){const normalizedHtml=function katanaDrawioHtmlTextNormalizedLabelHtml(html){const normalized=katanaDrawioHtmlTextHasMarkup(html)?function katanaTrimDrawioEdgeHtmlTextBreaks(html){return function katanaTrimDrawioTrailingHtmlTextBreaks(html){return String(html).replace(/(?:(?:\\s|&nbsp;)+|<br(?:\\s[^>]*)?\\s*\\/?>|<div>\\s*(?:<br(?:\\s[^>]*)?\\s*\\/?>|&nbsp;)?\\s*<\\/div>)+$/i,"")}(function katanaTrimDrawioLeadingHtmlTextBreaks(html){return String(html).replace(/^(?:(?:\\s|&nbsp;)+|<br(?:\\s[^>]*)?\\s*\\/?>|<div>\\s*(?:<br(?:\\s[^>]*)?\\s*\\/?>|&nbsp;)?\\s*<\\/div>)+/i,"")}(html))}(String(html)):function katanaDrawioEscapedPlainHtmlText(html){return function katanaDrawioPlainHtmlTextLines(html){return function katanaTrimDrawioEmptyEdgeTextLines(lines){let start=0,end=lines.length;for(;start<end&&""===lines[start].trim();)start+=1;for(;end>start&&""===lines[end-1].trim();)end-=1;return lines.slice(start,end)}(String(html).split(/\\r?\\n/))}(html).map(katanaDrawioEscapePlainHtmlTextLine).join("<br>")}(html);return normalized.replace(/&nbsp;/gi," ")}(html);return katanaDrawioIsDarkMode()?normalizedHtml.replaceAll(\'color="#000000"\',\'color="#ededed"\').replaceAll(\'color="#ffffff"\',\'color="#121212"\').replaceAll(\'color="#FFFFFF"\',\'color="#121212"\'):normalizedHtml}function katanaDrawioHtmlTextHasMarkup(html){return/<\\/?[a-zA-Z][^>]*>/.test(String(html))}function katanaDrawioEscapePlainHtmlTextLine(line){return String(line).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function katanaHasDrawioHtmlTextLabel(entry){return[entry.id,entry.html,entry.label,katanaShouldInstallDrawioHtmlTextLabel(entry)].every(Boolean)}function katanaShouldInstallDrawioHtmlTextLabel(entry){return!katanaDrawioShouldKeepNativeEdgeHtmlTextLabel(entry)&&["1"===katanaDrawioStyleValue(entry.style,"html"),entry.replaceExisting].some(Boolean)}function katanaDrawioShouldKeepNativeEdgeHtmlTextLabel(entry){return[entry.edge,katanaDrawioHtmlTextHasMarkup(entry.html)].every(Boolean)}function katanaHasDrawioNativeEdgeHtmlTextLabel(entry){return[entry.id,entry.html,entry.label].every(Boolean)}function katanaShiftDrawioNativeEdgeTextLabels(group){Array.from(group.childNodes).filter(node=>"text"===node.localName).forEach(node=>{node.setAttribute("transform","translate(-40,0)")})}function katanaHasDrawioHtmlTextLabelContext(context){return[context.box,context.fallback.length>0].every(Boolean)}function katanaApplyDrawioHtmlTextLabel(context){context.entry.replaceExisting&&function katanaRemoveDrawioHtmlTextForeignObjects(group){Array.from(group.querySelectorAll("foreignObject")).forEach(katanaRemoveDrawioNode)}(context.group);const label=function katanaCreateDrawioHtmlTextLabel(entry,box,fallback){const group=katanaCreateDrawioSvgElement("g"),switchNode=katanaCreateDrawioSvgElement("switch");return switchNode.appendChild(function katanaCreateDrawioHtmlTextForeignObject(entry,box){const foreignObject=katanaCreateDrawioSvgElement("foreignObject");return foreignObject.setAttribute("style","overflow: visible; text-align: left;"),foreignObject.setAttribute("pointer-events","none"),foreignObject.setAttribute("width","100%"),foreignObject.setAttribute("height","100%"),foreignObject.setAttribute("requiredFeatures","http://www.w3.org/TR/SVG11/feature#Extensibility"),foreignObject.appendChild(function katanaCreateDrawioHtmlTextOuterDiv(entry,box){const div=katanaCreateDrawioHtmlElement("div");return div.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),div.setAttribute("style",function katanaDrawioHtmlTextOuterStyle(style,box){return["display: flex",`align-items: unsafe ${katanaDrawioHtmlTextAlignItems(style)}`,`justify-content: unsafe ${katanaDrawioHtmlTextJustifyContent(style)}`,`width: ${katanaDrawioHtmlTextWidth(style,box)}px`,`height: ${katanaDrawioHtmlTextHeight(style,box)}px`,`padding-top: ${katanaDrawioHtmlTextTop(style,box)}px`,`margin-left: ${katanaDrawioHtmlTextLeft(style,box)}px`].join("; ")}(entry.style,box)),div.appendChild(function katanaCreateDrawioHtmlTextBoxDiv(entry,box){const div=katanaCreateDrawioHtmlElement("div");return div.setAttribute("style",function katanaDrawioHtmlTextBoxStyle(style,box){return["box-sizing: border-box","font-size: 0",`text-align: ${katanaDrawioTextAlign(style)}`,...katanaDrawioHtmlTextBoxSizeStyle(style,box),`color: ${katanaDrawioTextColor(style)}`,""].join("; ")}(entry.style,box)),div.appendChild(function katanaCreateDrawioHtmlTextContentDiv(entry){const div=katanaCreateDrawioHtmlElement("div");return div.setAttribute("data-katana-drawio-html-text","content"),div.setAttribute("style",function katanaDrawioHtmlTextContentStyle(style){return["display: inline-block",`font-size: ${katanaDrawioFontSize(style)}px`,`font-family: ${katanaDrawioHtmlFontFamily(style)}`,`color: ${katanaDrawioHtmlTextColor(style)}`,"line-height: 1.2","pointer-events: all",...katanaDrawioHtmlTextContentSizeStyle(style),`white-space: ${katanaDrawioHtmlTextWhiteSpace(style)}`,"word-wrap: normal",""].join("; ")}(entry.style)),div.innerHTML=entry.html,function katanaNormalizeDrawioHtmlTextContentColors(root){katanaDrawioIsDarkMode()&&(katanaDrawioHtmlTextContentDescendants(root).filter(node=>node.getAttribute("style")).forEach(katanaApplyDrawioHtmlTextStyleColor),katanaDrawioHtmlTextContentDescendants(root).filter(node=>node.getAttribute("color")).forEach(katanaApplyDrawioHtmlTextColorAttribute))}(div),function katanaPreserveDrawioHtmlTextDarkBackgroundColor(element,style){katanaDrawioKeepsLightHtmlTextOnDarkBackground(style,katanaDrawioColorKey(katanaDrawioTextColor(style)))&&element.setAttribute("style",katanaDrawioHtmlStyleWithColor(element.getAttribute("style"),"#ffffff"))}(div,entry.style),div}(entry)),div}(entry,box)),div}(entry,box)),foreignObject}(entry,box)),function katanaNormalizedDrawioHtmlTextFallbackNodes(nodes,entry,box){const lines=String(entry.label).split(/\\n+/).map(line=>line.trim()).filter(Boolean);return 0===lines.length?nodes:nodes.map(node=>function katanaNormalizedDrawioHtmlTextFallbackNode(node,lines,entry,box){if("text"!==node.tagName)return node;const tspans=Array.from(node.querySelectorAll("tspan"));if(0===tspans.length)return node.replaceChildren(...lines.map((line,index)=>katanaDrawioLineBreakTspan(node,line,index))),katanaRepositionDrawioHtmlTextFallbackNode(node,entry,box,lines.length),node;const mergedLines=lines.slice(0,tspans.length);if(lines.length>tspans.length){const head=lines.slice(0,tspans.length-1),tail=lines.slice(tspans.length-1).join(" ");mergedLines.splice(0,mergedLines.length,...head,tail)}return tspans.forEach((tspan,index)=>{tspan.textContent=mergedLines[index]??""}),katanaRepositionDrawioHtmlTextFallbackNode(node,entry,box,mergedLines.length),node}(node,lines,entry,box))}(fallback,entry,box).forEach(node=>{switchNode.appendChild(node)}),group.appendChild(switchNode),group}(context.entry,context.box,context.fallback);context.group.appendChild(label)}function katanaRepositionDrawioHtmlTextFallbackNode(node,entry,box,lineCount){const y=function katanaDrawioHtmlTextFallbackY(style,box,lineCount){const top=katanaDrawioHtmlTextTop(style,box),fontSize=katanaDrawioFontSize(style),alignment=katanaDrawioHtmlTextVerticalAlign(style),height=katanaDrawioHtmlTextHeight(style,box),lineDy=Number(katanaDrawioTextLineDy(1,fontSize)),lineOffset=Math.max(0,lineCount-1)*lineDy;return"top"===alignment?top+fontSize:"bottom"===alignment?top+height-lineOffset:top+height/2+fontSize/2-lineOffset/2}(entry.style,box,lineCount);node.setAttribute("y",String(Math.round(y)))}function katanaDrawioHtmlTextContentDescendants(root){return Array.from(root.querySelectorAll("*"))}function katanaApplyDrawioHtmlTextColorAttribute(element){const color=katanaDrawioHtmlTextExplicitColor(element.getAttribute("color"));color&&(element.setAttribute("style",katanaDrawioHtmlStyleWithColor(element.getAttribute("style"),color)),katanaMarkDrawioHtmlTextExplicitColor(element))}function katanaApplyDrawioHtmlTextStyleColor(element){const style=element.getAttribute("style"),color=katanaDrawioHtmlTextExplicitColor(katanaDrawioStylePropertyValue(style,"color"));color&&(element.setAttribute("style",katanaDrawioHtmlStyleWithColor(style,color)),katanaMarkDrawioHtmlTextExplicitColor(element))}function katanaMarkDrawioHtmlTextExplicitColor(element){element.setAttribute("data-katana-drawio-html-text-explicit-color","1")}function katanaDrawioHtmlTextExplicitColor(color){return[katanaDrawioIsDarkMode(),katanaDrawioHtmlTextIsExplicitWhite(color)].every(Boolean)?"#121212":[color].filter(Boolean).map(it=>katanaDrawioResolvedTextColor(katanaDrawioColorKey(it))).filter(Boolean).concat([""])[0]}function katanaDrawioHtmlTextIsExplicitWhite(color){return["#fff","#ffffff","rgb(255, 255, 255)","white"].includes(katanaDrawioColorKey(color))}function katanaDrawioHtmlStyleWithColor(style,color){const text=String(style??"").trim();return katanaDrawioStylePropertyValue(text,"color")?katanaDrawioStyleWithProperty(text,"color",color):[text,`color: ${color}`].filter(Boolean).join("; ")}function katanaCreateDrawioSvgElement(tagName){return document.createElementNS("http://www.w3.org/2000/svg",tagName)}function katanaCreateDrawioHtmlElement(tagName){return document.createElementNS("http://www.w3.org/1999/xhtml",tagName)}function katanaDrawioHtmlTableEntry(match){const attributes=katanaDrawioXmlAttributes(match[1]);return{id:katanaDrawioCellAttribute(attributes,"id"),html:katanaDrawioCellAttribute(attributes,"value"),style:katanaDrawioCellAttribute(attributes,"style")}}function katanaHasDrawioHtmlTableEntry(entry){return[entry.id,"1"===katanaDrawioStyleValue(entry.style,"html"),"fill"===katanaDrawioStyleValue(entry.style,"overflow"),entry.html.trim().toLowerCase().startsWith("<table")].every(Boolean)}function katanaDrawioHtmlTableContext(svg,entry){const group=katanaDrawioCellGroup(svg,entry.id);return{entry:entry,group:group,box:katanaDrawioHtmlTableShapeBox(group),foreignObject:katanaDrawioHtmlTableForeignObject(group)}}function katanaDrawioHtmlTableShapeBox(group){return[group].filter(Boolean).map(katanaDrawioCellShapeBox).concat([null])[0]}function katanaDrawioHtmlTableForeignObject(group){return[group].filter(Boolean).map(it=>it.querySelector("foreignObject")).concat([null])[0]}function katanaHasDrawioHtmlTableContext(context){return[context.group,context.box,context.foreignObject].every(Boolean)}function katanaApplyDrawioHtmlTable(context){const foreignObject=context.foreignObject;foreignObject.setAttribute("style","overflow: visible; text-align: left;"),foreignObject.setAttribute("pointer-events","none"),foreignObject.setAttribute("width","101%"),foreignObject.setAttribute("height","101%"),foreignObject.setAttribute("requiredFeatures","http://www.w3.org/TR/SVG11/feature#Extensibility"),function katanaReplaceDrawioHtmlTableChildren(foreignObject,entry,box){Array.from(foreignObject.childNodes).forEach(child=>{child.remove()}),foreignObject.appendChild(function katanaCreateDrawioHtmlTableOuterDiv(entry,box){const div=katanaCreateDrawioHtmlElement("div");return div.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),div.setAttribute("style",function katanaDrawioHtmlTableOuterStyle(box){return["display: flex","align-items: unsafe flex-start","justify-content: unsafe flex-start",`width: ${Math.round(box.width+2)}px`,`height: ${Math.round(box.height)}px`,`padding-top: ${Math.round(box.y)}px`,`margin-left: ${Math.round(box.x)}px`].join("; ")}(box)),div.appendChild(function katanaCreateDrawioHtmlTableBoxDiv(entry,box){const div=katanaCreateDrawioHtmlElement("div");return div.setAttribute("style",function katanaDrawioHtmlTableBoxStyle(style,box){return["box-sizing: border-box","font-size: 0",`text-align: ${katanaDrawioTextAlign(style)}`,`width: ${Math.round(box.width)}px`,`height: ${Math.round(box.height)}px`,"overflow: hidden",`color: ${katanaDrawioTextColor(style)}`,""].join("; ")}(entry.style,box)),div.appendChild(function katanaCreateDrawioHtmlTableContentDiv(entry){const div=katanaCreateDrawioHtmlElement("div");return div.setAttribute("style",function katanaDrawioHtmlTableContentStyle(style){return["display: inline-block",`font-size: ${katanaDrawioFontSize(style)}px`,`font-family: ${katanaDrawioHtmlFontFamily(style)}`,`color: ${katanaDrawioHtmlTextColor(style)}`,"line-height: 1.2","pointer-events: all","width: 100%","height: 100%","white-space: nowrap",""].join("; ")}(entry.style)),div.innerHTML=function katanaDrawioHtmlTableMarkup(html){return katanaDrawioIsDarkMode()?function katanaDrawioDarkHtmlTableMarkup(html){return KATANA_DRAWIO_HTML_TABLE_DARK_COLORS.reduce((text,entry)=>function katanaDrawioReplaceHtmlTableColor(text,entry){return text.replace(new RegExp(function katanaDrawioEscapeRegExp(value){return String(value).replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}(entry[0]),"gi"),entry[1])}(text,entry),html).replace(/color:\\s*#ffffff/gi,"color: #121212")}(html):html}(entry.html),div}(entry)),div}(entry,box)),div}(entry,box))}(foreignObject,context.entry,context.box)}const KATANA_DRAWIO_HTML_TABLE_DARK_COLORS=[["#98bf21","#4a6b00"],["#a7c942","#405e00"],["#eaf2d3","#1d2409"]];function katanaNormalizeDrawioTextBaseline(text){!function katanaNormalizeDrawioEncodedLineBreaks(text){const lines=decodeHtmlEntities(text.textContent).split(/\\n+/).filter(Boolean);lines.length<2||text.replaceChildren(...lines.map((line,index)=>katanaDrawioLineBreakTspan(text,line,index)))}(text);const y=Number(text.getAttribute("y"));Number.isFinite(y)&&text.setAttribute("y",String(y-0))}function katanaDrawioLineBreakTspan(text,line,index){const tspan=document.createElementNS("http://www.w3.org/2000/svg","tspan");return tspan.setAttribute("x",text.getAttribute("x")),tspan.setAttribute("dy",katanaDrawioTextLineDy(index,function katanaDrawioTextFontSize(text){return Number.parseFloat(text.getAttribute("font-size"))||12}(text))),tspan.textContent=line,tspan}function katanaNormalizeDrawioForeignObject(foreignObject){Array.from(foreignObject.children).forEach(katanaApplyDrawioXhtmlNamespace)}function katanaApplyDrawioXhtmlNamespace(node){node.nodeType===Node.ELEMENT_NODE&&node.setAttribute("xmlns","http://www.w3.org/1999/xhtml")}function katanaDrawioIsCellContentGroup(group){return group.parentNode?.getAttribute?.("data-cell-id")}function katanaDrawioNeedsHalfPixelTranslate(group){return[!group.getAttribute("transform"),katanaDrawioGroupHasDirectShape(group)].every(Boolean)}function katanaDrawioGroupHasDirectShape(group){return Array.from(group.children).some(child=>KATANA_DRAWIO_HALF_PIXEL_SHAPE_TAGS.has(child.localName))}function katanaApplyDrawioHalfPixelTranslate(group){group.setAttribute("transform","translate(0.5,0.5)")}function katanaDrawioRoundNearIntegerNumber(value){const number=Number(value),rounded=Math.round(number);return Math.abs(number-rounded)<=.051?String(rounded):value}const KATANA_DRAWIO_HALF_PIXEL_SHAPE_TAGS=new Set(["circle","ellipse","line","path","polygon","polyline","rect"]);function katanaPostprocessDrawioSvg(svg){!function katanaRemoveOversizedDrawioLabelBackgrounds(svg){Array.from(svg.querySelectorAll("rect")).filter(katanaIsDrawioTextLabelBackground).forEach(katanaRemoveDrawioNode),Array.from(svg.querySelectorAll("rect")).filter(katanaIsDrawioPageSizedLabelBackground).forEach(katanaRemoveDrawioNode)}(svg),function katanaPadDrawioSvgForSourceLabelOverflow(svg){const padding=function katanaDrawioSourceLeftLabelPadding(){return katanaDrawioRequestSource().includes("mxgraph.aws")?Math.ceil(Math.max(0,...katanaDrawioSourceLabelEntries().filter(katanaDrawioIsLeftSourceLabel).map(katanaDrawioSourceLabelWidth))):0}();[padding>0,katanaDrawioContentBox(svg).x<padding/2].every(Boolean)&&function katanaApplyDrawioLeftPadding(svg,padding){const box=katanaDrawioSvgBox(svg);globalThis.__katanaDrawioAppliedLeftPadding=padding,katanaTranslateDrawioContent(svg,{x:-padding,y:0}),svg.setAttribute("viewBox",`0 0 ${box.width+padding} ${box.height}`),svg.setAttribute("width",`${box.width+padding}px`)}(svg,padding)}(svg),function katanaFillMissingDrawioTextLabels(svg){katanaDrawioSourceLabelEntries().forEach(entry=>{!function katanaFillMissingDrawioCellLabel(svg,entry){[katanaDrawioCellGroup(svg,entry.id)].filter(Boolean).filter(katanaShouldInsertDrawioText).forEach(group=>{group.appendChild(function katanaCreateDrawioTextLabel(group,entry){const box=katanaDrawioCellShapeBox(group),lines=katanaDrawioTextLines(entry.label),text=function katanaDrawioTextElement(box,entry,lines){const text=document.createElementNS("http://www.w3.org/2000/svg","text"),fontSize=katanaDrawioFontSize(entry.style),position=function katanaDrawioLabelPosition(box,entry,lines,fontSize){return function katanaDrawioLabelPositioner(style){return KATANA_DRAWIO_LABEL_POSITIONERS.get(katanaDrawioStyleValue(style,"labelPosition"))??KATANA_DRAWIO_LABEL_POSITIONERS.get(katanaDrawioStyleValue(style,"verticalLabelPosition"))??katanaDrawioCenterLabelPosition}(entry.style)(box,entry,lines,fontSize)}(box,entry,lines,fontSize);return text.setAttribute("x",position.x),text.setAttribute("y",position.y),text.setAttribute("fill",katanaDrawioTextColor(entry.style)),text.setAttribute("font-family","Helvetica"),text.setAttribute("font-size",`${fontSize}px`),text.setAttribute("text-anchor",position.anchor),text}(box,entry,lines);return lines.forEach((line,index)=>{text.appendChild(function katanaCreateDrawioTextLine(text,line,index,style){const tspan=document.createElementNS("http://www.w3.org/2000/svg","tspan");return tspan.setAttribute("x",text.getAttribute("x")),tspan.setAttribute("dy",katanaDrawioTextLineDy(index,katanaDrawioFontSize(style))),tspan.textContent=line,tspan}(text,line,index,entry.style))}),text}(group,entry))})}(svg,entry)})}(svg),katanaNormalizeWrappedDrawioTextLabels(svg),function katanaInstallDrawioHtmlTextLabels(svg){(function katanaDrawioHtmlTextLabelEntries(){return katanaDrawioSourceLabelEntries().map(katanaDrawioHtmlTextLabelEntry).filter(katanaHasDrawioHtmlTextLabel)})().forEach(entry=>{!function katanaInstallDrawioHtmlTextLabel(svg,entry){[katanaDrawioCellGroup(svg,entry.id)].filter(Boolean).filter(group=>function katanaCanInstallDrawioHtmlTextLabel(group,entry){return[entry.replaceExisting,!katanaDrawioGroupHasForeignObject(group)].some(Boolean)}(group,entry)).map(group=>function katanaDrawioHtmlTextLabelContext(group,entry){return{group:group,entry:entry,box:katanaDrawioCellShapeBox(group),fallback:katanaDrawioTextNodes(group)}}(group,entry)).filter(katanaHasDrawioHtmlTextLabelContext).forEach(katanaApplyDrawioHtmlTextLabel)}(svg,entry)}),function katanaNormalizeDrawioNativeEdgeHtmlTextLabels(svg){const geometryById=function katanaDrawioSourceGeometryById(){return new Map(katanaDrawioSourceGeometryEntries().map(entry=>[entry.id,entry]))}();(function katanaDrawioNativeEdgeHtmlTextLabelEntries(){return katanaDrawioSourceLabelEntries().map(katanaDrawioHtmlTextLabelEntry).filter(katanaHasDrawioNativeEdgeHtmlTextLabel)})().filter(entry=>function katanaDrawioShouldShiftNegativeEdgeHtmlTextLabel(entry,geometryById){return[katanaDrawioShouldKeepNativeEdgeHtmlTextLabel(entry),geometryById.get(entry.id)?.x<0].every(Boolean)}(entry,geometryById)).map(entry=>katanaDrawioCellGroup(svg,entry.id)).filter(Boolean).forEach(katanaShiftDrawioNativeEdgeTextLabels)}(svg)}(svg),function katanaNormalizeDrawioHtmlTables(svg){(function katanaDrawioHtmlTableEntries(){return Array.from(katanaDrawioRequestSource().matchAll(/<mxCell\\b([^>]*)>/g)).map(katanaDrawioHtmlTableEntry).filter(katanaHasDrawioHtmlTableEntry)})().forEach(entry=>{!function katanaNormalizeDrawioHtmlTable(svg,entry){[katanaDrawioHtmlTableContext(svg,entry)].filter(katanaHasDrawioHtmlTableContext).forEach(katanaApplyDrawioHtmlTable)}(svg,entry)})}(svg),function katanaNormalizeRichDrawioTextLabels(svg){(function katanaDrawioRichTextLabelEntries(){return katanaDrawioSourceLabelEntries().map(katanaDrawioRichTextLabelEntry).filter(katanaHasRichDrawioTextLabel)})().forEach(entry=>{!function katanaNormalizeRichDrawioTextLabel(svg,entry){[katanaDrawioCellGroup(svg,entry.id)].filter(Boolean).filter(group=>!katanaDrawioGroupHasForeignObject(group)).map(katanaDrawioRichTextElement).filter(Boolean).forEach(text=>{!function katanaApplyRichDrawioTextLines(text,lines){const tspans=Array.from(text.querySelectorAll("tspan"));0!==tspans.length?tspans.forEach((tspan,index)=>{katanaApplyRichDrawioTextStyle(tspan,lines[index])}):katanaApplyRichDrawioTextStyle(text,lines[0])}(text,entry.lines)})}(svg,entry)})}(svg),function katanaNormalizeDrawioTextBaselines(svg){Array.from(svg.querySelectorAll("text")).forEach(katanaNormalizeDrawioTextBaseline)}(svg),function katanaNormalizeDrawioForeignObjects(svg){Array.from(svg.querySelectorAll("foreignObject")).forEach(katanaNormalizeDrawioForeignObject)}(svg),function katanaNormalizeDrawioGeometry(svg){(function katanaDrawioNeedsNearIntegerGeometryRounding(){return katanaDrawioRequestSource().includes("mxgraph.infographic")})()&&function katanaRoundDrawioNearIntegerPaths(svg){Array.from(svg.querySelectorAll("path")).filter(path=>path.getAttribute("d")).forEach(path=>{path.setAttribute("d",function katanaDrawioRoundNearIntegerPath(data){return String(data).replace(/-?\\d+\\.\\d+/g,katanaDrawioRoundNearIntegerNumber)}(path.getAttribute("d")))})}(svg),katanaDrawioRequestSource().includes("mxgraph.aws")&&Array.from(svg.querySelectorAll("g")).filter(katanaDrawioIsCellContentGroup).filter(katanaDrawioNeedsHalfPixelTranslate).forEach(katanaApplyDrawioHalfPixelTranslate)}(svg),function katanaShouldCropDrawioSvgToContent(svg){return!katanaDrawioRequestSource().includes("mxgraph.aws")&&(!!function katanaDrawioPageBoundsNeedContentCrop(svg){const sourceBox=katanaDrawioSourceContentBox(svg),svgBox=katanaDrawioSvgBox(svg);return[katanaDrawioSourceHasPageBounds(),katanaDrawioSourceIsDeviceTemplate(),katanaDrawioSourceHasTransparentPageBackground(),1===katanaDrawioSourceModelCount(),sourceBox,[svgBox.width>1.25*sourceBox?.width,svgBox.height>1.25*sourceBox?.height].some(Boolean)].every(Boolean)}(svg)||!katanaDrawioSourceHasPageBounds()&&(!katanaDrawioSourceDisablesPageBounds()||function katanaDrawioDisabledPageBoundsNeedCrop(svg){const sourceBox=katanaDrawioSourceContentBox(svg),svgBox=katanaDrawioSvgBox(svg);return[1===katanaDrawioSourceModelCount(),sourceBox,[svgBox.width>1.25*sourceBox?.width,svgBox.height>1.25*sourceBox?.height].some(Boolean)].every(Boolean)}(svg)))}(svg)&&function katanaCropDrawioSvgToContent(svg){!function katanaApplyDrawioCrop(svg,box){const paddedBox=function katanaDrawioExportPaddedBox(box){return{width:box.width+(katanaDrawioShouldApplyShadowExportPadding()?10:0)+1,height:box.height+(function katanaDrawioHasExternalImageSource(){return/(?:^|;)image=https?:\\/\\//.test(katanaDrawioRequestSource())}()?11:0)+(katanaDrawioShouldApplyShadowExportPadding()?11:0)+1}}(box);katanaTranslateDrawioContent(svg,box),svg.setAttribute("viewBox",`0 0 ${paddedBox.width} ${paddedBox.height}`),svg.setAttribute("width",`${paddedBox.width}px`),svg.setAttribute("height",`${paddedBox.height}px`)}(svg,function katanaDrawioCropBox(svg){return function katanaDrawioAlignedCropBox(box){return function katanaDrawioHasPreservedTopPadding(box){return[0===box.x,box.y>0,box.y<=12].every(Boolean)}(box)?{x:box.x,y:0,width:box.width,height:box.height+box.y}:function katanaDrawioHasOnePixelTopLeftCrop(box){return[1===box.x,1===box.y].every(Boolean)}(box)?{x:0,y:0,width:box.width+1,height:box.height+1}:box}(KATANA_DRAWIO_CROP_BOX_READERS[Number(function katanaDrawioShouldMeasureRenderedContent(svg){return[katanaDrawioRequestSource().includes("mxgraph.aws3d."),katanaDrawioNeedsMeasuredContentBox(svg)].some(Boolean)}(svg))](svg))}(svg))}(svg),function katanaAlignDrawioPageSvgToSourceOrigin(svg){if(!katanaDrawioSourceHasPageBounds())return;if(!function katanaDrawioShouldAlignPageSourceOrigin(){return[katanaDrawioSourceIsDeviceTemplate(),katanaDrawioSourceHasPageBounds(),katanaDrawioSourceHasTransparentPageBackground(),1===katanaDrawioSourceModelCount(),1!==katanaDrawioSourcePageScale()||/(?:^|[;"])shape=image(?:;|")/.test(katanaDrawioRequestSource())].every(Boolean)}())return;const entries=function katanaDrawioSourceVertexGeometryEntries(){return katanaDrawioSourceGeometryEntries().filter(katanaDrawioIsSourceVertexGeometryEntry)}(),sourceBox=katanaDrawioUnionBox(entries),origin=function katanaDrawioMeasuredSourceOrigin(svg,entries){const offset=katanaDrawioSourceCropOffset(svg,entries);return offset?{x:-offset.x,y:-offset.y}:null}(svg,entries);if(!function katanaCanAlignDrawioPageSourceOrigin(sourceBox,origin){return[sourceBox,origin,Number.isFinite(sourceBox?.x),Number.isFinite(origin?.x),sourceBox?.x>0,sourceBox?.x-origin?.x>1].every(Boolean)}(sourceBox,origin))return;const offset=sourceBox.x-origin.x,box=katanaDrawioSvgBox(svg),width=Math.max(1,Math.round(box.width-offset));katanaTranslateDrawioContent(svg,{x:offset,y:0}),svg.setAttribute("viewBox",`${box.x} ${box.y} ${width} ${box.height}`),svg.setAttribute("width",`${width}px`)}(svg),function katanaAlignDrawioDisabledPageInfographicTop(svg){(function katanaDrawioNeedsDisabledPageInfographicTopAlign(svg){return[katanaDrawioSourceDisablesPageBounds(),katanaDrawioRequestSource().includes("mxgraph.infographic"),!katanaDrawioNeedsExportTopPadding(svg),katanaDrawioContentBox(svg).y<=2].every(Boolean)})(svg)&&katanaTranslateDrawioContent(svg,{x:0,y:-1})}(svg),function katanaPadDrawioSvgForExportTopPadding(svg){if(!katanaDrawioNeedsExportTopPadding(svg))return;const box=katanaDrawioSvgBox(svg);svg.setAttribute("viewBox",`${box.x} ${box.y-KATANA_DRAWIO_EXPORT_TOP_PADDING} ${box.width} ${box.height+KATANA_DRAWIO_EXPORT_TOP_PADDING}`),svg.setAttribute("height",`${box.height+KATANA_DRAWIO_EXPORT_TOP_PADDING}px`)}(svg),function katanaPadDrawioSvgForTextBottomOverflow(svg){const box=katanaDrawioSvgBox(svg),bottom=Math.ceil(Math.max(box.y+box.height,...function katanaDrawioTextBottomEstimates(svg){return Array.from(svg.querySelectorAll("text")).map(katanaDrawioTextBottomEstimate).filter(Number.isFinite)}(svg),...function katanaDrawioHtmlTextBottomEstimates(svg){return Array.from(svg.querySelectorAll("foreignObject")).map(katanaDrawioHtmlTextBottomEstimate).filter(Number.isFinite)}(svg))),height=bottom-box.y;height<=box.height||(svg.setAttribute("viewBox",`${box.x} ${box.y} ${box.width} ${height}`),svg.setAttribute("height",`${height}px`))}(svg),function katanaApplyDrawioShadows(svg){Array.from(svg.querySelectorAll("g")).filter(katanaDrawioElementHasCellId).filter(katanaDrawioElementCellHasShadowStyle).map(katanaDrawioShadowTarget).filter(Boolean).forEach(katanaSetDrawioShadowStyle)}(svg),function katanaNormalizeDrawioSvgColors(svg){[svg,...svg.querySelectorAll("*")].forEach(katanaNormalizeDrawioElementColors),function katanaRestoreDrawioHtmlTextSourceColors(svg){Array.from(svg.querySelectorAll("foreignObject div")).filter(katanaDrawioHasHtmlTextContentColor).map(katanaDrawioHtmlTextSourceColorEntry).filter(entry=>entry.color).forEach(katanaApplyDrawioHtmlTextSourceColor)}(svg)}(svg),function katanaNormalizeDrawioAndroidDeviceScreens(svg){Array.from(svg.querySelectorAll("path")).filter(path=>function katanaDrawioIsAndroidDeviceScreenFill(element,name,value){return[katanaDrawioIsDarkMode(),"path"===element.localName,"fill"===name,KATANA_DRAWIO_ANDROID_DEVICE_SCREEN_COLORS.has(value),katanaDrawioHasAndroidDeviceSource(),katanaDrawioPathDataArea(element)>1e4].every(Boolean)}(path,"fill",katanaDrawioColorKey(path.getAttribute("fill")))).forEach(path=>{path.setAttribute("fill","transparent")})}(svg),function katanaInstallDrawioPageBackground(svg){const box=katanaDrawioSvgBox(svg),color=function katanaDrawioPageBackgroundColor(svg){return[(style=svg.getAttribute("style"),[String(style).match(/background(?:-color)?:\\s*([^;]+)/)].filter(Boolean).map(katanaDrawioMatchValue).concat([""])[0]),globalThis.__katanaDrawioRequest?.background??""].filter(katanaIsVisibleDrawioBackground)[0];var style}(svg);if(!color)return;const rect=function katanaCreateDrawioBackgroundRect(box,color){const rect=document.createElementNS("http://www.w3.org/2000/svg","rect");return rect.setAttribute("data-katana-drawio-background","true"),rect.setAttribute("x",box.x),rect.setAttribute("y",box.y),rect.setAttribute("width",box.width),rect.setAttribute("height",box.height),rect.setAttribute("fill",color),rect}(box,color);(function katanaSetDrawioPageBackgroundStyle(svg,color){svg.setAttribute("style",`background: ${color}; background-color: ${color};`)})(svg,color),svg.insertBefore(rect,svg.firstChild)}(svg)}function katanaDrawioSourceHasPageBounds(){return/<mxGraphModel\\b[^>]*\\bpage="1"/.test(katanaDrawioRequestSource())}function katanaDrawioSourceDisablesPageBounds(){return/<mxGraphModel\\b[^>]*\\bpage="0"/.test(katanaDrawioRequestSource())}function katanaDrawioSourceIsDeviceTemplate(){return/<mxfile\\b[^>]*\\btype="device"/.test(katanaDrawioRequestSource())}function katanaDrawioSourceHasTransparentPageBackground(){return/<mxGraphModel\\b[^>]*\\bbackground="none"/.test(katanaDrawioRequestSource())}function katanaDrawioSourceModelCount(){return(katanaDrawioRequestSource().match(/<mxGraphModel\\b/g)??[]).length}function katanaDrawioIsLeftSourceLabel(entry){return"left"===katanaDrawioStyleValue(entry.style,"labelPosition")}function katanaDrawioSourceLabelWidth(entry){const fontSize=katanaDrawioFontSize(entry.style);return Math.max(0,...katanaDrawioTextLines(entry.label).map(line=>String(line).trim().length*fontSize*.5))}const KATANA_DRAWIO_EXPORT_TOP_PADDING=10;function katanaDrawioNeedsExportTopPadding(svg){return[katanaDrawioContentBox(svg).y<=1,[[katanaDrawioSourceDisablesPageBounds(),katanaDrawioRequestSource().includes("mxgraph.infographic"),katanaDrawioSourceMinimumTop()>0].every(Boolean),katanaDrawioHasDarkCubePageTop()].some(Boolean)].every(Boolean)}function katanaDrawioHasDarkCubePageTop(){return[katanaDrawioSourceHasPageBounds(),/<mxGraphModel\\b[^>]*\\bbackground="#1A1A1A"/i.test(katanaDrawioRequestSource()),katanaDrawioRequestSource().includes("shape=cube;")].every(Boolean)}function katanaDrawioAppliedLeftPadding(){return Number(globalThis.__katanaDrawioAppliedLeftPadding??0)}function katanaDrawioSourcePageScale(){const match=katanaDrawioRequestSource().match(/<mxGraphModel\\b[^>]*\\bpageScale="([^"]+)"/);return match?Number(match[1]):1}function katanaDrawioTextBottomEstimate(text){return katanaDrawioCoordinateAttribute(function katanaDrawioNodeAttributes(node){return new Map(["x","y"].map(name=>[name,node?.getAttribute?.(name)??""]).filter(entry=>""!==entry[1]))}(text),"y")+function katanaDrawioInheritedFontSize(node){return[katanaDrawioElementCellFontSize(node),...katanaDrawioElementAncestors(node).map(katanaDrawioNodeFontSize)].filter(Number.isFinite).concat([0])[0]}(text)+3}function katanaDrawioHtmlTextBottomEstimate(foreignObject){return function katanaDrawioHtmlTextOuterTop(foreignObject){return[...Array.from(foreignObject.querySelectorAll("div"))].map(div=>katanaDrawioStylePropertyValue(String(div.getAttribute("style")??""),"padding-top")).filter(Boolean).map(katanaDrawioCssPixels).filter(Number.isFinite).concat([Number.NaN])[0]}(foreignObject)+function katanaDrawioHtmlTextContentFontSize(foreignObject){return[...Array.from(foreignObject.querySelectorAll("div"))].filter(div=>"content"===div.getAttribute("data-katana-drawio-html-text")).map(div=>katanaDrawioStylePropertyValue(String(div.getAttribute("style")??""),"font-size")).filter(Boolean).map(katanaDrawioCssPixels).filter(Number.isFinite).concat([Number.NaN])[0]}(foreignObject)+3}function katanaDrawioElementCellFontSize(node){return Number(katanaDrawioElementCellStyleValue(node,"fontSize"))}function katanaDrawioNodeFontSize(node){return katanaDrawioCssPixels(node?.getAttribute?.("font-size"))}function katanaDrawioMatchValue(match){return match[1].trim()}function katanaIsVisibleDrawioBackground(color){return!["","transparent"].includes(String(color).toLowerCase())}function katanaDrawioSvgBox(svg){return function katanaParsedDrawioViewBox(value){return[String(value).trim().split(/\\s+/).map(Number)].filter(katanaIsDrawioBoxParts).map(katanaDrawioBoxFromParts).concat([null])[0]}(svg.getAttribute("viewBox"))??function katanaDrawioSizeBox(svg){return{x:0,y:0,width:katanaDrawioCssPixels(svg.getAttribute("width")),height:katanaDrawioCssPixels(svg.getAttribute("height"))}}(svg)}function katanaIsDrawioBoxParts(parts){return[4===parts.length,parts.every(Number.isFinite)].every(Boolean)}function katanaDrawioBoxFromParts(parts){return{x:parts[0],y:parts[1],width:parts[2],height:parts[3]}}function katanaDrawioCssPixels(value){return[Number(String(value).replace(/px$/,""))].filter(Number.isFinite).concat([0])[0]}function katanaDrawioSourceForViewer(source){const xml=String(source).trim().replace(/^<\\?xml[^>]*>\\s*/i,"");return function katanaDrawioUncompressedModel(xml){const start=xml.indexOf("<mxGraphModel"),end=xml.indexOf("</mxGraphModel>");return function katanaHasDrawioModelRange(start,end){return[start>=0,end>=start].every(Boolean)}(start,end)?xml.slice(start,end+15):null}(xml)??xml}globalThis.katanaRunDrawioRuntime=function katanaRunDrawioRuntime(){return katanaInstallDrawioRuntimeAdapter(),function katanaRenderDrawioSvg(){return function katanaViewerSvgMarkup(viewer){const svg=viewer.graph.getSvg();return function katanaConfigureDrawioSvg(svg){svg.setAttribute("role","img"),svg.setAttribute("aria-roledescription","drawio")}(svg),katanaPostprocessDrawioSvg(svg),(new XMLSerializer).serializeToString(svg)}(function katanaCreateDrawioViewer(container){const state={viewer:null};return GraphViewer.createViewerForElement(container,viewer=>{state.viewer=viewer}),function katanaRequiredDrawioViewer(state,container){if(state.viewer?.graph)return state.viewer;throw new Error(function katanaDrawioViewerError(container){return`Draw.io viewer failed: ${container.innerText||"Draw.io viewer did not produce SVG"}`}(container))}(state,container)}(function katanaCreateDrawioViewerContainer(source){const container=document.createElement("div");return container.setAttribute("id","graph-container"),container.setAttribute("class","mxgraph"),container.setAttribute("data-mxgraph",JSON.stringify(function katanaDrawioViewerConfig(source){return{xml:katanaDrawioSourceForViewer(source),toolbar:"","auto-fit":!1,"auto-crop":!1,"auto-origin":!0,"check-visible-state":!1}}(source))),document.body.appendChild(container),container}(function katanaDrawioRenderRequest(){const request=globalThis.__katanaDrawioRequest;return function katanaAssertDrawioRequest(request){if(!request?.source)throw new Error("Draw.io render request is missing")}(request),function katanaAssertDrawioViewerRuntime(){if("function"!=typeof GraphViewer)throw new Error("Draw.io viewer runtime is not initialized")}(),request}().source)))}()};');