koboyo 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +26 -0
  2. package/assets/editor/assets/ContextMenuTrigger-CXUL1E23.js +1 -0
  3. package/assets/editor/assets/{IconHelp-CaEwHrsN.js → IconHelp-4FIVl1rh.js} +2 -2
  4. package/assets/editor/assets/IconReplace-CYUD1RLF.js +1 -0
  5. package/assets/editor/assets/MenuSubmenuTrigger-BFlIkXYg.js +1 -0
  6. package/assets/editor/assets/{PopoverPopup-B3Y0VRYc.js → PopoverPopup-1zO38CRl.js} +1 -1
  7. package/assets/editor/assets/asset-glyph-DjBHkQcP.js +1 -0
  8. package/assets/editor/assets/build-pips-BRf3pMnt.js +1 -0
  9. package/assets/editor/assets/build-visibility-CAmmsnmF.js +1 -0
  10. package/assets/editor/assets/builders-DrWdKwLQ.js +1 -0
  11. package/assets/editor/assets/{chart-4iRduYdU.js → chart-CKIxcbcM.js} +4 -4
  12. package/assets/editor/assets/{chrome-layout-BzPU9far.js → chrome-layout-D5dql-y4.js} +1 -1
  13. package/assets/editor/assets/code-panel-BFikzGNv.js +18 -0
  14. package/assets/editor/assets/color-swatches-CZKb4DxX.js +1 -0
  15. package/assets/editor/assets/{command-palette-BR-_ChOL.js → command-palette-Uat68wmJ.js} +1 -1
  16. package/assets/editor/assets/connector-labels-DqVssnYz.js +2 -0
  17. package/assets/editor/assets/{copy-image-dialog-BzGP7Xw8.js → copy-image-dialog-C0fXdR1a.js} +1 -1
  18. package/assets/editor/assets/core-C1TxysMz.js +1 -0
  19. package/assets/editor/assets/diagram-fingerprint-B-HB8UbR.js +3 -0
  20. package/assets/editor/assets/{edit-C0sBxxsg.js → edit-B4DMFSZr.js} +1 -1
  21. package/assets/editor/assets/editor-DAJETlQW.js +1 -0
  22. package/assets/editor/assets/{elk-worker-loader-CVBdN1je.js → elk-worker-loader-BCdkmVMX.js} +1 -1
  23. package/assets/editor/assets/embed-input-D77Udvni.js +1 -0
  24. package/assets/editor/assets/export-FQTXirjn.js +2 -0
  25. package/assets/editor/assets/{export-dialog-x2n2a4KX.js → export-dialog-KYLeNY3G.js} +1 -1
  26. package/assets/editor/assets/export-u442sUQs.js +6 -0
  27. package/assets/editor/assets/flow-layer-B4Q8rktl.js +1 -0
  28. package/assets/editor/assets/flow-panel-DbnavW4w.js +1 -0
  29. package/assets/editor/assets/flow-stage-CSTrNMZF.js +1 -0
  30. package/assets/editor/assets/{flow-start-CpAvU-9P.js → flow-start-ByhFxEeV.js} +1 -1
  31. package/assets/editor/assets/{flows-Cj7AFMIA.js → flows-CGl4r-xb.js} +1 -1
  32. package/assets/editor/assets/{frames-Cp1QD3LR.js → frames-DRSLvE9E.js} +1 -1
  33. package/assets/editor/assets/generate-DHP90nDk.js +26 -0
  34. package/assets/editor/assets/{icon-picker-Cg39IKNJ.js → icon-picker-DIkw2xYL.js} +1 -1
  35. package/assets/editor/assets/{image-library-JQu_tb8P.js → image-library-BmoSPV9c.js} +1 -1
  36. package/assets/editor/assets/index-DFwoT1_W.js +25 -0
  37. package/assets/editor/assets/layout-offthread-JPTCbsLL.js +18 -0
  38. package/assets/editor/assets/menu-4xb5HtA1.js +1 -0
  39. package/assets/editor/assets/mermaid-paste-2cCwweY0.js +1 -0
  40. package/assets/editor/assets/panel-controls-B0Ccd0XF.js +1 -0
  41. package/assets/editor/assets/{panel-shell-BnMOHgWM.js → panel-shell-COqmheb-.js} +1 -1
  42. package/assets/editor/assets/plan-D4Jyzo5X.js +1 -0
  43. package/assets/editor/assets/presentation-DNmdm11D.js +1 -0
  44. package/assets/editor/assets/{presenter-keys-Bs3LnmOa.js → presenter-keys-DLNIsrm5.js} +1 -1
  45. package/assets/editor/assets/reflow-C6bvnSVm.js +1 -0
  46. package/assets/editor/assets/registry-d5KleeyB.js +1 -0
  47. package/assets/editor/assets/rich-paste-route-Bx69sREx.js +1 -0
  48. package/assets/editor/assets/ride-overlay-C1TrM7Ki.js +1 -0
  49. package/assets/editor/assets/selection-overlay-primitives-CfOaP5_G.js +1 -0
  50. package/assets/editor/assets/shape-meta-YgfIm0bQ.js +1 -0
  51. package/assets/editor/assets/shape-render-DZscezZk.js +1 -0
  52. package/assets/editor/assets/shapes-D5w8NTQQ.js +11 -0
  53. package/assets/editor/assets/{slide-notes-dialog-BQBXpep6.js → slide-notes-dialog-43EMJFJV.js} +1 -1
  54. package/assets/editor/assets/slides-DDNzjFz9.js +5 -0
  55. package/assets/editor/assets/slides-panel-DANnu_nw.js +26 -0
  56. package/assets/editor/assets/text-breaks-DhCXtQrJ.js +7 -0
  57. package/assets/editor/assets/{theme-palette-Dl_G_VIJ.js → theme-palette-DEq19D0h.js} +1 -1
  58. package/assets/editor/assets/tidy-browser-BdlwTfCT.js +1 -0
  59. package/assets/editor/assets/tidy-scope-REEad7oC.js +1 -0
  60. package/assets/editor/assets/{tool-catalog-DXPhX2S1.js → tool-catalog-CIjdZm_C.js} +1 -1
  61. package/assets/editor/assets/{tool-drawer-CWOX_njp.js → tool-drawer-B-Ys7Rsn.js} +1 -1
  62. package/assets/editor/assets/{tooltip-CyBz17g8.js → tooltip-CKCG8vcp.js} +1 -1
  63. package/assets/editor/assets/tree-BWJsAqkV.js +1 -0
  64. package/assets/editor/assets/use-export-command-BR-A4kAa.js +2 -0
  65. package/assets/editor/assets/{use-grid-keyboard-nav-DhQKecO1.js → use-grid-keyboard-nav-B0jjlh8Q.js} +0 -0
  66. package/assets/editor/assets/{use-icon-node-BxqH7H27.js → use-icon-node-uhKPP4Ki.js} +1 -1
  67. package/assets/editor/assets/{use-key-held-094C3Mn3.js → use-key-held-DaUTxGze.js} +1 -1
  68. package/assets/editor/assets/useTriggerFocusGuards-Mibi8yYw.js +1 -0
  69. package/assets/editor/assets/web-card-BTru0lge.js +1 -0
  70. package/assets/editor/assets/web-card-font-BbZEq3En.js +1 -0
  71. package/assets/editor/assets/web-controls-BjBov-C2.js +1 -0
  72. package/assets/editor/assets/web-embed-dialog-sT-1yK5o.js +1 -0
  73. package/assets/editor/assets/web-embed-url-CHu4SU82.js +1 -0
  74. package/assets/editor/assets/web-embeds-I3saJ_yp.js +1 -0
  75. package/assets/editor/assets/web-html-dialog-B5Hb3RGw.js +1 -0
  76. package/assets/editor/assets/web-runtime-wPi8lWzO.js +1 -0
  77. package/assets/editor/assets/web-widget-limits-DeMquLIR.js +1 -0
  78. package/assets/editor/assets/web-widgets-DsFUBhiq.js +325 -0
  79. package/assets/editor/assets/widget-source-C3N9ZKTz.js +2 -0
  80. package/assets/editor/assets/widget-target-C9a207gT.js +1 -0
  81. package/assets/editor/index.html +41 -35
  82. package/dist/koboyo.js +565 -232
  83. package/package.json +3 -3
  84. package/skills/koboyo/SKILL.md +8 -3
  85. package/skills/koboyo/references/architecture.md +1 -1
  86. package/skills/koboyo/references/bpmn.md +1 -1
  87. package/skills/koboyo/references/chart.md +1 -1
  88. package/skills/koboyo/references/cycle.md +1 -1
  89. package/skills/koboyo/references/erd.md +1 -1
  90. package/skills/koboyo/references/flowchart.md +1 -1
  91. package/skills/koboyo/references/funnel.md +1 -1
  92. package/skills/koboyo/references/gantt.md +1 -1
  93. package/skills/koboyo/references/gitgraph.md +1 -1
  94. package/skills/koboyo/references/journey.md +1 -1
  95. package/skills/koboyo/references/matrix.md +1 -1
  96. package/skills/koboyo/references/mindmap.md +1 -1
  97. package/skills/koboyo/references/orgchart.md +1 -1
  98. package/skills/koboyo/references/pyramid.md +1 -1
  99. package/skills/koboyo/references/sankey.md +1 -1
  100. package/skills/koboyo/references/sequence.md +1 -1
  101. package/skills/koboyo/references/statemachine.md +1 -1
  102. package/skills/koboyo/references/timeline.md +1 -1
  103. package/skills/koboyo/references/venn.md +1 -1
  104. package/skills/koboyo/references/wireframe.md +1 -1
  105. package/assets/editor/assets/MenuSubmenuTrigger-KacA9GM8.js +0 -1
  106. package/assets/editor/assets/asset-glyph-C1E6cGwM.js +0 -1
  107. package/assets/editor/assets/build-pips-BV-uwXlP.js +0 -1
  108. package/assets/editor/assets/build-visibility-DyML9SHt.js +0 -1
  109. package/assets/editor/assets/builders-DMHAOPEv.js +0 -1
  110. package/assets/editor/assets/code-panel-koBUgEWp.js +0 -43
  111. package/assets/editor/assets/connector-labels-CrEgadsC.js +0 -2
  112. package/assets/editor/assets/core-CmsJyU_-.js +0 -1
  113. package/assets/editor/assets/diagram-fingerprint-WGQ5iVXx.js +0 -3
  114. package/assets/editor/assets/editor-BeufBV54.js +0 -1
  115. package/assets/editor/assets/export-Bce6ra0N.js +0 -2
  116. package/assets/editor/assets/export-K2VWg76n.js +0 -6
  117. package/assets/editor/assets/flow-layer-ewaL7g2y.js +0 -1
  118. package/assets/editor/assets/flow-panel-BzXNGGke.js +0 -1
  119. package/assets/editor/assets/flow-stage-Ba_CAggI.js +0 -1
  120. package/assets/editor/assets/index-CBPPqsiR.js +0 -24
  121. package/assets/editor/assets/layout-offthread-mRHRulkS.js +0 -18
  122. package/assets/editor/assets/menu-B9BAk63v.js +0 -1
  123. package/assets/editor/assets/panel-controls-DWVXiNUZ.js +0 -1
  124. package/assets/editor/assets/plan-CkgM52Yh.js +0 -1
  125. package/assets/editor/assets/presentation-DJUO0t7I.js +0 -1
  126. package/assets/editor/assets/reflow-DaYiVkwp.js +0 -1
  127. package/assets/editor/assets/registry-rEGZW7Ab.js +0 -1
  128. package/assets/editor/assets/ride-overlay-Hx90v4ZK.js +0 -1
  129. package/assets/editor/assets/selection-overlay-primitives-BRp854AD.js +0 -1
  130. package/assets/editor/assets/shape-meta-COE2ATNh.js +0 -1
  131. package/assets/editor/assets/slides-D686obFO.js +0 -15
  132. package/assets/editor/assets/slides-panel-BEJCevJi.js +0 -26
  133. package/assets/editor/assets/text-breaks-DM4W6y5f.js +0 -7
  134. package/assets/editor/assets/tidy-browser-dF3BON7J.js +0 -1
  135. package/assets/editor/assets/tidy-scope-BGG3ZXvZ.js +0 -1
  136. package/assets/editor/assets/tree-KSgPjntC.js +0 -1
  137. package/assets/editor/assets/use-export-command-sC9UHj3_.js +0 -2
  138. package/assets/editor/assets/web-controls-CLE9zr7i.js +0 -1
  139. package/assets/editor/assets/web-embed-dialog-XUNelFFM.js +0 -1
  140. package/assets/editor/assets/web-html-dialog-BcAyzH5D.js +0 -1
  141. package/assets/editor/assets/web-shape-C941TGTy.js +0 -1
  142. package/assets/editor/assets/widget-source-CHujvUeA.js +0 -1
@@ -1 +0,0 @@
1
- import{$r as e,$t as t,A as n,E as r,J as i,Nr as a,O as o,Qr as s,Qt as c,U as l,Ut as u,Xt as d,Y as f,ai as p,an as m,en as h,ii as g,in as _,j as v,ni as y,oi as b,sn as x}from"./slides-D686obFO.js";import{G as S,V as C,Y as w,Z as T,it as ee}from"./style-BENGW2ZV.js";var te=[`solid`,`dashed`,`dotted`,`none`],ne=[`curved`,`elbow`],re=[`arrow`,`sweep`,`triangle`,`triangleOutline`,`diamond`,`diamondOutline`,`circle`,`circleOutline`,`bar`,`cross`,`crowOne`,`crowMany`,`crowOneOrMany`,`crowOnlyOne`,`crowZeroOrOne`,`crowZeroOrMany`],ie=[`pastel`,`bold`,`outline`,`shadow`],ae=[`left`,`center`,`right`],oe=[`top`,`middle`,`bottom`],se=[`n`,`s`,`e`,`w`,`ne`,`nw`,`se`,`sw`],ce=`rectangle.ellipse.diamond.triangle.oval.parallelogram.trapezoid.cylinder.note.hexagon.star.checkbox.crossbox.heart.cloud.arrow-up.arrow-down.arrow-left.arrow-right.plus.speech-bubble.bolt.queue.callout.document.predefined-process.manual-input.pentagon.chevron.octagon.cube.actor.double-circle.card.delay.fork-join.multi-document.multi-process.package.component.brace`.split(`.`),le=[`fade`,`rise`,`scale`,`pop`,`blur`,`wipe`,`draw`,`type`,`pulse`,`shake`,`glow`],ue=[`up`,`down`,`left`,`right`],de=[`enter`,`emphasis`,`exit`],fe=[`sharp`,`rounded`],pe=[`simple`,`phone`,`tablet`,`browser`,`window`,`lanes`,`vlanes`,`boundary`],me=[`call`,`async`,`reply`],he=[`bar`,`line`,`area`,`scatter`,`pie`,`donut`,`radar`,`quadrant`],ge=[`number`,`percent`,`currency`],_e=`button.input.search.checkbox.radio.toggle.dropdown.slider.navbar.tabs.image.avatar.heading.paragraph.divider.link.textarea.stepper.badge.progress.breadcrumbs.pagination.rating.card.list.alert.menu.tooltip.accordion.datepicker.sidebar.scrollbar.segmented.tabbar.statusbar.fab.stepbadge`.split(`.`),ve=[`embed`,`html`],E=131072,ye=`allow-scripts`,D=[`cdn.jsdelivr.net`,`unpkg.com`,`cdnjs.cloudflare.com`,`cdn.tailwindcss.com`,`esm.sh`],O=[...D,`fonts.googleapis.com`],be=[`fonts.gstatic.com`,...D],xe=`https://koboyo.com`,Se=`koboyo-widget`,Ce=`koboyo-editor`;function we(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.source===`koboyo-widget`&&(t.type===`ready`||t.type===`rendered`)}`${E}${xe}${Ce}${Se}${Se}`;var Te=2048;function Ee(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t)return null;let n=t.html;return typeof n!=`string`||k(n)>131072?null:n}function De(e,t){if(e.length>Te)return!1;if(t!==void 0)return e.startsWith(t)&&!e.slice(t.length).includes(`..`);try{return new URL(e).protocol===`https:`}catch{return!1}}async function Oe(e,t={}){if(!De(e,t.prefix))return null;let n=t.fetch??fetch;try{let r=await n(e,{credentials:`omit`,referrerPolicy:`no-referrer`,signal:t.signal});return r.ok?Ee(await r.text()):null}catch{return null}}function ke(e,t,n){let r=`${Math.round(t)}x${Math.round(n)}\n${e}`,i=3735928559,a=1103547991;for(let e=0;e<r.length;e+=1){let t=r.charCodeAt(e);i=Math.imul(i^t,2654435761),a=Math.imul(a^t,1597334677)}return i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(a^a>>>13,3266489909),a=Math.imul(a^a>>>16,2246822507),a^=Math.imul(i^i>>>13,3266489909),(4294967296*(2097151&a)+(i>>>0)).toString(36)}function k(e){let t=0;for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);r<128?t+=1:r<2048?t+=2:r>=55296&&r<=56319&&(e.charCodeAt(n+1)&64512)==56320?(t+=4,n+=1):t+=3}return t}var Ae=[[/\bfetch\s*\(/,`fetch()`],[/\bXMLHttpRequest\b/,`XMLHttpRequest`],[/\bWebSocket\b/,`WebSocket`],[/\bEventSource\b/,`EventSource`]];function A(e,t){let n=RegExp(`\\s${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,`i`).exec(e);return n?n[1]??n[2]??n[3]??``:null}function j(e,t){let n=e.trim();if(/^data:/i.test(n))return null;let r;try{r=new URL(n.startsWith(`//`)?`https:${n}`:n)}catch{return`"${n}" is a relative path, and a widget has no files of its own`}return r.protocol===`https:`?t.has(r.hostname.toLowerCase())?null:`${r.hostname} isn't on the allowed list`:`"${n}" isn't https`}var je=new Set(D),Me=new Set([...O,...be]);function Ne(e){let t=[],n=k(e);n>131072&&t.push(`The HTML is ${Math.ceil(n/1024)} KB; a widget can be at most ${E/1024} KB.`);for(let[n,r]of Ae)n.test(e)&&t.push(`It uses ${r}, but widgets have no network access, so it will fail. Inline the data instead.`);for(let n of e.match(/<script\b[^>]*>/gi)??[]){let e=A(n,`src`),r=e===null?null:j(e,je);r&&t.push(`A script won't load: ${r}. Scripts can come from ${D.join(`, `)}.`)}for(let n of e.match(/<link\b[^>]*>/gi)??[]){let e=A(n,`href`),r=e===null?null:j(e,Me);r&&t.push(`A stylesheet won't load: ${r}. Styles can come from ${O.join(`, `)}.`)}return/<form\b[^>]*\saction\s*=/i.test(e)&&t.push(`A form has an action, but widgets can't submit forms anywhere.`),/\b(?:top|parent)\.location\b/.test(e)&&t.push(`It tries to navigate the page around it, which widgets can't do.`),t}function M(e){return`kind`in e&&e.kind===`path`}function Pe(e){return e.type===`line`?e.points:e.type===`arrow`?[{x:e.x,y:e.y},{x:e.x2,y:e.y2}]:null}function N(e,t){let n=Pe(e)??[C(m(e))],r=Math.max(0,Math.min(t.seg,n.length-2)),i=n[r],a=n[r+1]??i,o=S(t.t);return{x:i.x+(a.x-i.x)*o,y:i.y+(a.y-i.y)*o}}function P(e,t){return t?M(e)?t.type===`line`||t.type===`arrow`:t.type!==`arrow`:!1}function Fe(e,t,r){let i=new Set,a=[r];for(;a.length>0;){let r=a.pop();if(r===t)return!0;if(i.has(r))continue;i.add(r);let o=n(e,r);o?.type===`arrow`&&(o.startBinding&&a.push(o.startBinding.shapeId),o.endBinding&&a.push(o.endBinding.shapeId))}return!1}function Ie(e,t){let n=Math.abs(t.x-e.x),r=Math.abs(t.x-(e.x+e.width)),i=Math.abs(t.y-e.y),a=Math.abs(t.y-(e.y+e.height)),o=Math.min(n,r,i,a);return o===n?{x:-1,y:0}:o===r?{x:1,y:0}:o===i?{x:0,y:-1}:{x:0,y:1}}function F(e,t){return e.type===`icon`?h(e,t):e.type===`control`&&e.kind===`lifeline`?f(e):m(e,t)}function I(e,t){return C(m(e,t))}var L=6,R=14;function z(e){return e.type===`text`?R:L}var Le=new Set(a);function B(e,t,n){let r=n===`start`?t.startArrow:t.endArrow,i=n===`start`?t.startHead:t.endHead;return r&&i&&Le.has(i)?0:z(e)}function V(e){if(e.type!==`rectangle`)return null;let t=e.kind;return t!==`diamond`&&t!==`ellipse`&&t!==`double-circle`?null:t}function H(e,t){return e===`diamond`?1-t:Math.sqrt(Math.max(0,1-t*t))}function Re(e,t,n){let r=V(e);if(r===null)return n;let i=Ie(t,n),a=t.x+t.width/2,o=t.y+t.height/2,s=i.x!==0,c=s?t.width/2:t.height/2,l=s?t.height/2:t.width/2,u=s?n.y-o:n.x-a,d=H(r,l===0?0:Math.min(1,Math.abs(u)/l)),f=s?i.x:i.y;return s?{x:a+f*c*d,y:n.y}:{x:n.x,y:o+f*c*d}}var U=.002;function W(e,t,n=0,r){let i=F(e,r),a=q(i,t);if(t.x>U&&t.x<1-U&&t.y>U&&t.y<1-U)return K(e,a,r);let o=Re(e,i,a),s=e.type===`text`?Math.max(n,R):n;if(s<=0)return K(e,o,r);let c=Ie(i,a);return K(e,{x:o.x+c.x*s,y:o.y+c.y*s},r)}var ze=.2;function Be(e,t){return J(F(e,t),I(e,t))}function Ve(e,t,n){let r=Be(e,n);return Math.abs(t.x-r.x)<=ze&&Math.abs(t.y-r.y)<=ze}function He(e){let t=S(e.x),n=S(e.y),r=t,i=1-t,a=n,o=1-n,s=Math.min(r,i,a,o);return s===r?{x:0,y:n}:s===i?{x:1,y:n}:s===a?{x:t,y:0}:{x:t,y:1}}function G(e,t,n){let r=x(e)*Math.PI/180;return r?_(t,C(m(e,n)),-r):t}function K(e,t,n){let r=x(e)*Math.PI/180;return r?_(t,C(m(e,n)),r):t}function q(e,t){return{x:e.x+t.x*e.width,y:e.y+t.y*e.height}}function J(e,t){return{x:e.width===0?.5:(t.x-e.x)/e.width,y:e.height===0?.5:(t.y-e.y)/e.height}}function Ue(e,t){return!e||t.has(e.shapeId)?!1:M(e)?!0:e.precise}function We(e,t){return e.type===`arrow`&&Ue(e.startBinding,t)&&Ue(e.endBinding,t)}function Ge(e,t,n){let r=Pe(t);if(!r||r.length<2)return null;let i=Math.max(0,Math.min(e.seg,r.length-2)),a=r[i],o=r[i+1],s=o.x-a.x,c=o.y-a.y,l=Math.hypot(s,c);if(l<1e-6)return null;let u=(n.x*s+n.y*c)/l;return{...e,seg:i,t:S(e.t+u/l)}}function Ke(e,t,n,r){if(x(t)!==0)return null;let i=F(t,r),{anchor:a}=e;if(Y(t))return i.height>0?{...e,anchor:{x:a.x,y:S(a.y+n.y/i.height)}}:null;let o=.001,s=a.x<=o||a.x>=1-o,c=a.y<=o||a.y>=1-o;return s&&(!c||Math.abs(n.y)>=Math.abs(n.x))&&i.height>0?{...e,anchor:{x:a.x,y:S(a.y+n.y/i.height)},port:void 0}:c&&i.width>0?{...e,anchor:{x:S(a.x+n.x/i.width),y:a.y},port:void 0}:null}function qe(e,t,n,r){return M(e)?Ge(e,t,n):Ke(e,t,n,r)}function Je(e,t,r,i,a){if(!We(e,i))return null;let o=e,s=o.startBinding?.shapeId,c=o.endBinding?.shapeId,l=s?n(r,s):void 0,u=c?n(r,c):void 0;if(!l||!u||!o.startBinding||!o.endBinding)return null;let d=qe(o.startBinding,l,t,a),f=qe(o.endBinding,u,t,a);return!d||!f?null:{...o,startBinding:d,endBinding:f}}function Ye(e,t,n,r,i){let a=Je(e,t,n,r,i);if(a)return a;let o=u(e,t);if(o.type!==`arrow`)return o;let s=e=>e&&r.has(e.shapeId)?e:null,c=s(o.startBinding),l=s(o.endBinding);return c===o.startBinding&&l===o.endBinding?o:{...o,startBinding:c,endBinding:l}}function Xe(e,n,r,i){for(let a=e.length-1;a>=0;--a){let o=e[a];if(o.type===`arrow`||o.type===`line`||o.type===`draw`||o.type===`polygon`||o.type===`figure`||r&&o.id===r||!t(o)&&!T(n,c(o)))continue;let s=o.type===`icon`?h(o,i):m(o,i);if(T(G(o,n,i),s))return o}return null}var Ze={n:{x:.5,y:0},s:{x:.5,y:1},e:{x:1,y:.5},w:{x:0,y:.5},ne:{x:1,y:0},nw:{x:0,y:0},se:{x:1,y:1},sw:{x:0,y:1}},Qe=8;function $e(e,t){return e.x===0||e.x===1?Math.abs(e.y-.5)*t.height<=Qe?{x:e.x,y:.5}:e:Math.abs(e.x-.5)*t.width<=Qe?{x:.5,y:e.y}:e}function et(e,t,n){if(e.type!==`control`||e.kind!==`entity`||t.x!==0&&t.x!==1)return t;let r=l(e);if(r.length===0)return t;let i=n.y+t.y*n.height,a=r.reduce((e,t)=>Math.abs(t.cy-i)<Math.abs(e.cy-i)?t:e);return{x:t.x,y:S((a.cy-n.y)/n.height)}}function tt(e,t,n){return et(e,$e(He(t),n),n)}function nt(e,t,n){let r=F(e,n),i=J(r,G(e,t,n));return e.type===`control`&&e.kind===`lifeline`?{shapeId:e.id,anchor:{x:.5,y:S(i.y)},precise:!0}:Ve(e,i,n)?{shapeId:e.id,anchor:{x:S(i.x),y:S(i.y)},precise:!1}:{shapeId:e.id,anchor:tt(e,i,r),precise:!0}}function rt(e){return e.port?Ze[e.port]:e.anchor}function it(e,t,n){let r=F(e,n);if(e.type===`control`&&e.kind===`lifeline`){let i=J(r,G(e,t,n));return{x:r.x+r.width/2,y:r.y+S(i.y)*r.height}}let i=J(r,G(e,t,n));return Ve(e,i,n)?I(e,n):K(e,q(r,tt(e,i,r)),n)}function at(e,t=L){return w(e,t)}function Y(e){return e.type===`control`&&e.kind===`lifeline`}function ot(e,t,n,r){let a=F(e),o=a.x+a.width/2,s=a.y+S(t)*a.height,c=e.type===`control`?i(e,s):null,l=n.x<=o;return{x:(c?l?c.x:c.x+c.width:o)+(l?-r:r),y:s}}function X(e,t,n){if(M(t))return N(e,t);if(Y(e)&&t.precise){let n=F(e);return{x:n.x+n.width/2,y:n.y+S(t.anchor.y)*n.height}}return t.precise?W(e,rt(t),z(e),n):I(e,n)}function Z(e,t,n,r=z(e),i){return M(t)?N(e,t):Y(e)&&t.precise?ot(e,t.anchor.y,n,r):t.precise?W(e,rt(t),r,i):K(e,ee(at(F(e,i),r),I(e,i),G(e,n,i)),i)}function Q(e,t,n,r,i){let a=at(F(e,i),r),o=n?1/64:-1/64,s=+!n;for(let n=1;n<=64;n+=1){let n=s+o;if(!T(G(e,t.pointAt(n),i),a)){let r=s,o=n;for(let n=0;n<16;n+=1){let n=(r+o)/2;T(G(e,t.pointAt(n),i),a)?r=n:o=n}return r}if(s=n,n<=0||n>=1)break}return+!n}function st(e,t,r,i,a){let o=e=>a?a.get(e):n(t,e),s=e.startBinding?o(e.startBinding.shapeId):void 0,c=e.endBinding?o(e.endBinding.shapeId):void 0;return{start:e.startBinding&&P(e.startBinding,s)?r(s,e.startBinding,`start`):i({x:e.x,y:e.y}),end:e.endBinding&&P(e.endBinding,c)?r(c,e.endBinding,`end`):i({x:e.x2,y:e.y2})}}function ct(e,t,n,r){return st(e,t,(e,t)=>X(e,t,r),e=>e,n)}function lt(e,t){let n=F(e,t),r=x(e)*Math.PI/180;return r?d(n,C(m(e,t)),r):n}function ut(e,t,n){return e.type===`icon`?J(m(e,n),q(F(e,n),t)):t}function dt(e,t){let n=e.x-.5,r=e.y-.5;if(t){let e=t*Math.PI/180,i=Math.cos(e),a=Math.sin(e),o=n*i-r*a,s=n*a+r*i;n=o,r=s}return Math.abs(n)<1e-6&&Math.abs(r)<1e-6?null:Math.abs(n)>Math.abs(r)-1e-4?n<0?`left`:`right`:r<0?`top`:`bottom`}function ft(e,t){if(x(e)!==0)return;let n=V(e);if(n===null)return;let r=m(e),i=r.x+r.width/2,a=r.y+r.height/2,o=r.width/2,s=r.height/2,c=t===`left`||t===`right`,l=t===`right`||t===`bottom`?1:-1;return e=>{let t=c?i:a,r=c?o:s,u=c?a:i,d=c?s:o,f=d===0?0:Math.min(1,Math.abs(e-u)/d),p=H(n,f);return t+l*r*p}}function $(e,t,n,r=z(e),i){if(M(t))return g(N(e,t),n);let a=t.precise?dt(ut(e,t.anchor,i),x(e)):null;return{bounds:lt(e,i),target:t.precise?W(e,t.anchor,0,i):I(e,i),gap:r,minEnd:n*y,side:a,outline:a?ft(e,a):void 0,isPoint:!1}}function pt(e,t,n,r){return st(e,t,(t,n,i)=>$(t,n,e.strokeWidth,B(t,e,i),r),t=>g(t,e.strokeWidth),n)}function mt(e,t,n,r){let i=pt(e,t,n,r);return b(i.start,i.end,e.elbowMid??.5)}function ht(e,t){return{...e,elbowPoints:t,elbowRoute:t,elbowMidHandle:void 0,x:t[0].x,y:t[0].y,x2:t[t.length-1].x,y2:t[t.length-1].y}}function gt(e){return{...e,elbowPoints:void 0,elbowRoute:void 0,elbowMidHandle:void 0}}function _t(e,t,n,r){if(!e.elbowPoints)return e;let i=pt(e,t,n,r),a=p(e.elbowPoints,i.start,i.end);return a?ht(e,a):gt(e)}var vt=24;function yt(e,t,n){let r=e.x+e.width,i=t.x,a=e.y+n.fromTop*e.height,o=Math.max(1,n.fromSpan*e.height),s=t.y+n.toTop*t.height,c=Math.max(1,n.toSpan*t.height),l=r+(i-r)/3,u=i-(i-r)/3,d=(e,t,n)=>{let r=1-e;return r*r*r*t+3*r*r*e*t+3*r*e*e*n+e*e*e*n},f=e=>{let t=1-e;return t*t*t*r+3*t*t*e*l+3*t*e*e*u+e*e*e*i},p=[],m=[];for(let e=0;e<=vt;e+=1){let t=e/vt,n=f(t);p.push({x:n,y:d(t,a,s)}),m.push({x:n,y:d(t,a+o,s+c)})}return[...p,...m.reverse()]}function bt(e,t,n){let r=e.band;if(!r||n&&!n.has(e.id)&&!n.has(r.from)&&!n.has(r.to))return e;let i=t.get(r.from),a=t.get(r.to);if(!i||!a||!xt(i)||!xt(a))return e;let o=yt(i,a,r);return St(o,e.points)?e:{...e,points:o}}function xt(e){return`width`in e&&`height`in e&&`x`in e&&`y`in e}function St(e,t){return e.length===t.length&&e.every((e,n)=>e.x===t[n].x&&e.y===t[n].y)}function Ct(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(Math.abs(e[n].x-t[n].x)>.01||Math.abs(e[n].y-t[n].y)>.01)return!1;return!0}function wt(e,t,n,r){if(t==null){let t=e;for(let e=0;e<4;e+=1){let e=jt(t,n);if(e===t)break;t=e}return t}if(t.size===0)return e;let i=e,a=t;for(let e=0;e<4&&a.size>0;e+=1){let t=Nt(i,a,n,e===0?r:void 0);if(t.shapes===i)break;i=t.shapes,a=t.moved}return i}function Tt(e){let t=new Set(e.map(e=>e.id)),n=new Set;for(let r of e)if(r.type===`arrow`){let{startBinding:e,endBinding:i}=r;e&&i&&t.has(e.shapeId)&&t.has(i.shapeId)&&n.add(r.id)}else r.type===`polygon`&&r.band&&t.has(r.band.from)&&t.has(r.band.to)&&n.add(r.id);return n}function Et(e,t){return!!(t.has(e.id)||e.startBinding&&t.has(e.startBinding.shapeId)||e.endBinding&&t.has(e.endBinding.shapeId))}function Dt(e,t,n,r,i,a,o,s){let{x:c,y:l,x2:u,y2:d}=e;if(t&&n){let r=Z(t,n,o,B(t,e,`start`),s);c=r.x,l=r.y}if(r&&i){let t=Z(r,i,a,B(r,e,`end`),s);u=t.x,d=t.y}return{x:c,y:l,x2:u,y2:d}}function Ot(e,t,n,r,i,a,o,s){let{x:c,y:l,x2:u,y2:d}=e,f=e.elbowPoints,m=e.elbowRoute,h=e.elbowMidHandle,_=t&&n?$(t,n,e.strokeWidth,B(t,e,`start`),s):g({x:e.x,y:e.y},e.strokeWidth),v=r&&i?$(r,i,e.strokeWidth,B(r,e,`end`),s):g({x:e.x2,y:e.y2},e.strokeWidth),y=null;if(f&&f.length>=3&&t&&t===r){let e=(e,t)=>e.map(n=>({x:n.x+t.x-e[0].x,y:n.y+t.y-e[0].y})),t=p(e(f,_.target),_,v)?.[0];t&&(f=e(f,t))}if(f&&f.length>=3)y=p(f,_,v),y||(f=void 0);else if(f){let e=e=>!e||M(e)||e.precise;e(n)&&e(i)?y=[{x:_.target.x,y:_.target.y},{x:v.target.x,y:v.target.y}]:f=void 0}if(y)({elbowPoints:f,elbowRoute:m,elbowMidHandle:h,x:c,y:l,x2:u,y2:d}=ht(e,y));else{let f=b(_,v,e.elbowMid??.5);f.route&&f.route.length>=2?(m=f.route,h=f.midHandle??void 0,c=f.route[0].x,l=f.route[0].y,u=f.route[f.route.length-1].x,d=f.route[f.route.length-1].y):(m=void 0,h=void 0,{x:c,y:l,x2:u,y2:d}=Dt(e,t,n,r,i,a,o,s))}return{x:c,y:l,x2:u,y2:d,bend:e.bend,bendAlong:e.bendAlong,bow:e.bow,bowAlong:e.bowAlong,elbowPoints:f,elbowRoute:m,elbowMidHandle:h}}function kt(t,n,r,i,a,o,c,l){let{x:u,y:d,x2:f,y2:p}=t,m=t.bend,h=t.bendAlong,g=t.bow??t.bend??0,_=t.bowAlong??t.bendAlong??0,v=g,y=_,b=s(o,c,g,_),x=!1;if(b){let o=n&&r&&!M(r)?Q(n,b,!0,B(n,t,`start`),l):0,s=i&&a&&!M(a)?Q(i,b,!1,B(i,t,`end`),l):1;if(s-o>.02){let t=b.pointAt(o),n=b.pointAt(s);if(u=t.x,d=t.y,f=n.x,p=n.y,_===0)m=e(t,n,b.pointAt((o+s)/2)).bow,h=0;else if(b.apexT>o+.01&&b.apexT<s-.01){let r=e(t,n,b.apex);m=r.bow,h=r.bowAlong}else m=e(t,n,b.pointAt((o+s)/2)).bow,h=0;x=!0}}return x||({x:u,y:d,x2:f,y2:p}=Dt(t,n,r,i,a,o,c,l),m=0,h=0),{x:u,y:d,x2:f,y2:p,bend:m,bendAlong:h,bow:v,bowAlong:y,elbowPoints:t.elbowPoints,elbowRoute:void 0,elbowMidHandle:void 0}}function At(e,t,n,r){if(e.type===`polygon`)return bt(e,t,n);if(e.type!==`arrow`||!e.startBinding&&!e.endBinding||n&&!Et(e,n))return e;let i=e.startBinding,a=e.endBinding,o=i?t.get(i.shapeId):void 0,s=a?t.get(a.shapeId):void 0;i&&!P(i,o)&&(i=null),a&&!P(a,s)&&(a=null);let c=o&&i?X(o,i,r):{x:e.x,y:e.y},l=s&&a?X(s,a,r):{x:e.x2,y:e.y2},u=(e.bendStyle===`elbow`?Ot:kt)(e,o,i,s,a,c,l,r),{x:d,y:f,x2:p,y2:m,bend:h,bendAlong:g,bow:_,bowAlong:v}=u,y=u.elbowPoints,b=u.elbowRoute,x=u.elbowMidHandle,S=!Ct(b,e.elbowRoute);S||(b=e.elbowRoute);let C=!Ct(y,e.elbowPoints);C||(y=e.elbowPoints);let w=!Pt(x,e.elbowMidHandle);return w||(x=e.elbowMidHandle),d===e.x&&f===e.y&&p===e.x2&&m===e.y2&&h===e.bend&&g===e.bendAlong&&_===e.bow&&v===e.bowAlong&&!S&&!C&&!w&&i===e.startBinding&&a===e.endBinding?e:{...e,x:d,y:f,x2:p,y2:m,bend:h,bendAlong:g,bow:_,bowAlong:v,elbowPoints:y,elbowRoute:b,elbowMidHandle:x,startBinding:i,endBinding:a}}function jt(e,t){let n=new Map(e.map(e=>[e.id,e])),r=!1,i=e.map(e=>{let i=At(e,n,null,t);return i!==e&&(r=!0),i});return r?i:e}function Mt(e,t){return e.type===`arrow`?(e.startBinding!==null||e.endBinding!==null)&&Et(e,t):e.type===`polygon`&&e.band?t.has(e.id)||t.has(e.band.from)||t.has(e.band.to):!1}function Nt(e,t,n,i){let{position:a,dependents:s}=v(e),c=new Set,l=n=>{if(n===void 0||c.has(n))return;let r=e[n];Mt(r,t)&&!i?.has(r.id)&&c.add(n)};for(let e of t){l(a.get(e));for(let t of s.get(e)??[])l(a.get(t))}let u=new Set;if(c.size===0)return{shapes:e,moved:u};let d=new Map;for(let t of c)for(let n of r(e[t])){let t=a.get(n);t!==void 0&&d.set(n,e[t])}let f=null,p=[];for(let r of c){let i=e[r],a=At(i,d,t,n);a!==i&&(f??=e.slice(),f[r]=a,p.push(r),u.add(i.id))}return f?(o(e,f,p),{shapes:f,moved:u}):{shapes:e,moved:u}}function Pt(e,t){return e===t?!0:!e||!t?!1:e.axis===t.axis&&Math.abs(e.x-t.x)<=.01&&Math.abs(e.y-t.y)<=.01&&Math.abs(e.span-t.span)<=.01}export{he as A,oe as B,k as C,de as D,le as E,pe as F,_e as H,ce as I,ge as L,te as M,ie as N,re as O,me as P,se as R,Ne as S,ue as T,ve as V,E as _,Fe as a,we as b,We as c,Ye as d,Xe as f,Ce as g,Z as h,ct as i,fe as j,ne as k,mt as l,_t as m,Tt as n,nt as o,X as p,yt as r,it as s,wt as t,M as u,ye as v,ke as w,De as x,Oe as y,ae as z};
@@ -1 +0,0 @@
1
- import{Ar as e,At as t,B as n,Bn as r,Ct as i,Hn as a,I as o,Mr as s,P as c,Tt as l,Wn as u,_t as d,an as f,at as p,bt as m,ct as h,dt as g,et as ee,ft as te,gt as _,ht as ne,it as v,jr as y,lt as re,mt as b,nt as ie,pt as ae,rt as x,st as S,tt as C,ut as oe,vt as w,xt as T,yt as se}from"./slides-D686obFO.js";import{B as E,G as D,b as O}from"./style-BENGW2ZV.js";function k(e){return(e.value??0)>=.5}function ce(e){let{bounds:t,shape:n,ink:r}=e,i=[],a=S(n);if(a&&i.push({kind:`rect`,x:t.x,y:t.y,width:t.width,height:t.height,rx:10,fill:a}),i.push(..._(e,s(t.x,t.y,t.width,t.height,10),r)),n.label){let o=a?E(a):r;i.push(w(e,t.x+t.width/2,t.y+t.height/2,n.label,o,{anchor:`middle`}))}return i}function A(e,t=12){let{bounds:n,shape:r,ink:i}=e,a=_(e,s(n.x,n.y,n.width,n.height,6),i);return r.label&&a.push(w(e,n.x+t,n.y+n.height/2,r.label,v)),a}function le(t){let{bounds:n,ink:r}=t,i=te(n),a=n.x+12+i,o=n.y+n.height/2-i*.4,s=A(t,ae(n));return s.push(..._(t,e(a,o,i),r,C)),s.push(..._(t,y(a+i*.72,o+i*.72,a+i*1.7,o+i*1.7),r,C)),s}function ue(e){let{bounds:t,shape:n,ink:r}=e,i=t.x,a=t.y+t.height/2-22/2,o=_(e,s(i,a,22,22,4),r);if(k(n)){let t=`M ${i+22*.22} ${a+22*.55} L ${i+22*.45} ${a+22*.75} L ${i+22*.8} ${a+22*.25}`;o.push(..._(e,t,r,2.2))}return n.label&&o.push(w(e,i+22+10,t.y+t.height/2,n.label,r)),o}function de(t){let{bounds:n,shape:r,ink:i}=t,a=n.x+11,o=n.y+n.height/2,s=_(t,e(a,o,11),i);return k(r)&&s.push({kind:`circle`,cx:a,cy:o,r:4.5,fill:i}),r.label&&s.push(w(t,a+11+10,o,r.label,i)),s}function fe(t){let{bounds:n,shape:i,ink:a}=t,o=se(n),c=o*1.9,l=n.x,u=n.y+n.height/2-o/2,d=n.y+n.height/2,f=k(i),p=[];f&&p.push({kind:`rect`,x:l,y:u,width:c,height:o,rx:o/2,fill:S(i)??`#4dabf7`}),p.push(..._(t,s(l,u,c,o,o/2),a));let h=o/2-4,g=f?l+c-o/2:l+o/2;return p.push({kind:`circle`,cx:g,cy:d,r:h,fill:r.paper}),p.push(..._(t,e(g,d,h),a,C)),i.label&&p.push(w(t,n.x+m(n),d,i.label,a)),p}function pe(e){let{bounds:t,shape:n,ink:r}=e,i=t.y+t.height/2,a=t.x+t.width,o=_(e,s(t.x,t.y,t.width,t.height,6),r);n.label&&o.push(w(e,t.x+12,i,n.label,r));let c=`M ${a-25} ${i-4} L ${a-18} ${i+4} L ${a-11} ${i-4}`;return o.push(..._(e,c,r,C)),o}function me(t){let{bounds:n,shape:i,ink:a}=t,o=D(i.value??.5),s=n.y+n.height/2+(i.label?n.height*.12:0),c=n.x+8,l=n.x+n.width-8,u=c+o*(l-c),d=_(t,y(c,s,l,s),v,C);return d.push({kind:`line`,x1:c,y1:s,x2:u,y2:s,stroke:a,width:3}),d.push({kind:`circle`,cx:u,cy:s,r:8,fill:r.paper}),d.push(..._(t,e(u,s,8),a,C)),i.label&&d.push(w(t,n.x,n.y+2,i.label,v,{size:i.fontSize*.7,baseline:`hanging`})),d}function he(t){let{bounds:n,ink:r}=t,i=n.x+n.width/2,a=n.y+n.height/2,o=Math.min(n.width,n.height)/2-2,s=_(t,e(i,a,o),r);s.push(..._(t,e(i,a-o*.3,o*.32),r,C));let c=`M ${i-o*.55} ${a+o*.72} A ${o*.55} ${o*.55} 0 0 1 ${i+o*.55} ${a+o*.72}`;return s.push(..._(t,c,r,C)),s}function ge(e){let{bounds:t,shape:n,ink:r}=e;return n.label?[w(e,t.x,t.y+t.height/2,n.label,r,{size:n.fontSize*ie})]:[]}function _e(e,t,n,r){let i=(e+t)/2;return`M ${e} ${n} Q ${i} ${n-r} ${t} ${n} Q ${i} ${n+r} ${e} ${n} Z`}function ve(e,t,n,r){return{kind:`path`,d:_e(e,t,n,r),fill:v,stroke:`none`}}function ye(e){let{bounds:t,shape:n,ink:r}=e;if(n.label){let a=n.fontSize*.9,o=a*1.4,s=i(n.label,t.width,a),c=Math.max(1,Math.floor(t.height/o));return s.slice(0,c).map((n,i)=>w(e,t.x,t.y+o*(i+.6),n,r,{size:a}))}let a=n.fontSize*1.4,o=Math.max(2,Math.floor(t.height/a)),s=[];for(let e=0;e<o;e+=1){let n=t.y+a*(e+.7),r=e===o-1?.6:1;s.push(ve(t.x,t.x+t.width*r,n,3))}return s}function j(e,t,n){let r=n*.45,i=[];for(let a=0;a<10;a+=1){let o=a%2==0?n:r,s=-Math.PI/2+a*Math.PI/5,c=e+Math.cos(s)*o,l=t+Math.sin(s)*o;i.push(`${a===0?`M`:`L`} ${c} ${l}`)}return`${i.join(` `)} Z`}function be(e){let{bounds:t}=e,n=t.y+t.height/2;return _(e,y(t.x,n,t.x+t.width,n),v,C)}function xe(e){let{bounds:t,shape:n}=e;if(!n.label)return[];let r=t.x+t.width/2,i=t.y+t.height/2,a=Math.min(t.width,n.label.length*n.fontSize*.55),o=i+n.fontSize*.6;return[w(e,r,i,n.label,O,{anchor:`middle`}),..._(e,y(r-a/2,o,r+a/2,o),O,C)]}function M(e){let{bounds:t,shape:n,ink:r}=e,a=_(e,s(t.x,t.y,t.width,t.height,6),r),o=n.fontSize*.9,c=o*1.4;if(n.label){let s=i(n.label,t.width-24,o),l=Math.max(1,Math.floor((t.height-12)/c));s.slice(0,l).forEach((n,i)=>{a.push(w(e,t.x+12,t.y+12+c*(i+.5),n,r,{size:o}))})}else a.push(w(e,t.x+12,t.y+12+c*.5,`Type here…`,v,{size:o}));let l=t.x+t.width-6,u=t.y+t.height-6;return a.push(..._(e,y(l-6,u,l,u-6),v,C)),a.push(..._(e,y(l-11,u,l,u-11),v,C)),a}function Se(e){let{bounds:t,shape:n,ink:r}=e,i=t.y+t.height/2,a=ne(t),o=t.x+a,c=t.x+t.width-a,l=_(e,s(t.x,t.y,t.width,t.height,6),r);l.push(..._(e,y(o,t.y,o,t.y+t.height),r,C)),l.push(..._(e,y(c,t.y,c,t.y+t.height),r,C));let u=t.x+a/2,d=t.x+t.width-a/2,f=Math.min(n.fontSize*.42,a*.4,t.height*.3);return l.push(..._(e,y(u-f,i,u+f,i),r,2.2)),l.push(..._(e,y(d-f,i,d+f,i),r,2.2)),l.push(..._(e,y(d,i-f,d,i+f),r,2.2)),n.label&&l.push(w(e,(o+c)/2,i,n.label,r,{anchor:`middle`})),l}function Ce(e){let{bounds:t,shape:n,ink:r}=e,i=t.height/2,a=S(n),o=[];return a&&o.push({kind:`rect`,x:t.x,y:t.y,width:t.width,height:t.height,rx:i,fill:a}),o.push(..._(e,s(t.x,t.y,t.width,t.height,i),r)),n.label&&o.push(w(e,t.x+t.width/2,t.y+t.height/2,n.label,r,{anchor:`middle`,size:n.fontSize*ee})),o}var N=`#ffd43b`;function we(e){let{bounds:t,shape:n}=e,r=t.x+t.width/2,i=t.y+t.height/2,a=Math.min(t.width,t.height)/2,o=S(n)??`#ffd43b`,s=l(r,i,a,n,e.nextSalt()).map(e=>({kind:`path`,d:e,fill:o,stroke:`none`}));return n.label&&s.push(w(e,r,i,n.label,E(o),{anchor:`middle`,size:a*.95})),s}function Te(e){let{bounds:t,shape:n,ink:r}=e,i=D(n.value??.6),a=Math.min(t.height,14),o=t.y+t.height/2-a/2,c=a/2,l=[],u=Math.max(a,t.width*i);return l.push({kind:`rect`,x:t.x,y:o,width:u,height:a,rx:c,fill:S(n)??r}),l.push(..._(e,s(t.x,o,t.width,a,c),r,C)),l}function Ee(e){let{bounds:t,shape:n,ink:r}=e,i=Math.max(0,Math.min(5,Math.round(n.value??3))),a=t.y+t.height/2,o=t.width/5,s=Math.min(o,t.height)*.42,c=[];for(let l=0;l<5;l+=1){let u=t.x+o*(l+.5);l<i&&c.push({kind:`path`,d:j(u,a,s),fill:S(n)??r}),c.push(..._(e,j(u,a,s),r,C))}return c}function De(e){let{bounds:t,shape:n,ink:r}=e,i=D(n.value??.3),a=t.width/2,o=_(e,s(t.x,t.y,t.width,t.height,a),v,C),c=Math.max(t.width*1.5,t.height*.32),l=t.y+i*(t.height-c);return o.push({kind:`rect`,x:t.x,y:l,width:t.width,height:c,rx:a,fill:S(n)??r}),o.push(..._(e,s(t.x,l,t.width,c,a),r,C)),o}var Oe={button:ce,input:A,search:le,checkbox:ue,radio:de,toggle:fe,dropdown:pe,slider:me,avatar:he,heading:ge,paragraph:ye,divider:be,link:xe,textarea:M,stepper:Se,badge:Ce,progress:Te,rating:Ee,scrollbar:De,stepbadge:we},P=`rectangle.ellipse.circle.diamond.cylinder.queue.callout.hexagon.parallelogram.trapezoid.triangle.cloud.star.speech-bubble.note.sticky.checkbox.crossbox.heart.arrow-up.arrow-down.arrow-left.arrow-right.plus.bolt.document.predefined-process.manual-input.pentagon.chevron.octagon.cube.actor.double-circle.card.delay.fork-join.multi-document.multi-process.package.component.brace`.split(`.`),ke=[`browser`,`phone`,`window`,`tablet`],Ae={architecture:`architecture`,graph:`architecture`,flowchart:`flowchart`,flow:`flowchart`,bpmn:`bpmn`,orgchart:`orgchart`,org:`orgchart`,statemachine:`statemachine`,state:`statemachine`,fsm:`statemachine`,sequence:`sequence`,erd:`erd`,class:`erd`,uml:`erd`,wireframe:`wireframe`},je=[`architecture`,`flowchart`,`bpmn`,`orgchart`,`statemachine`,`sequence`,`erd`,`wireframe`],F=[`blue`,`green`,`red`,`orange`,`violet`,`teal`,`pink`,`yellow`,`gray`];function I(e){return Object.fromEntries(e.map(e=>[e,e]))}var Me={...I(F),grey:`gray`,purple:`violet`},Ne={...I(P),box:`rectangle`,oval:`ellipse`,decision:`diamond`,database:`cylinder`,db:`cylinder`,storage:`cylinder`,process:`rectangle`,terminator:`ellipse`,start:`ellipse`,end:`ellipse`,data:`parallelogram`,io:`parallelogram`,prep:`hexagon`,preparation:`hexagon`,crossedbox:`crossbox`,lightning:`bolt`,cross:`plus`,doc:`document`,subroutine:`predefined-process`,offpage:`pentagon`,"off-page":`pentagon`,stop:`octagon`,box3d:`cube`,person:`actor`,activity:`rectangle`,event:`ellipse`,gateway:`diamond`,doublecircle:`double-circle`,ring:`double-circle`,"notched-rectangle":`card`,fork:`fork-join`,join:`fork-join`,"stacked-document":`multi-document`,documents:`multi-document`,"stacked-rectangle":`multi-process`,processes:`multi-process`},Pe={app:`app-window`,money:`banknote`};function Fe(e){let t=e.replace(`/`,`:`),n=/^(tech|aws|gcp|azure)-(.+)$/.exec(t);return n?`${n[1]}:${n[2]}`:Pe[t]??t}var Ie=[`pastel`,`bold`,`outline`],Le=[`sharp`,`rounded`],Re=[`arrow`,`circle`,`cross`],ze=[`right`,`down`,`left`,`up`],Be=[`loop`,`alt`,`opt`,`par`,`break`],Ve=[`public`,`private`,`protected`,`package`],He={public:`+`,private:`-`,protected:`#`,package:`~`},Ue=[`zeroOrOne`,`one`,`zeroOrMany`,`oneOrMany`],We=[`inheritance`,`realization`,`composition`,`aggregation`,`dependency`,`association`];function Ge(e){if(e.fromCard||e.toCard)return{from:e.fromCard??`one`,to:e.toCard??`one`};switch(e.cardinality){case`1:1`:return{from:`one`,to:`one`};case`1:N`:return{from:`one`,to:`oneOrMany`};case`N:M`:return{from:`oneOrMany`,to:`oneOrMany`};default:return null}}var Ke=[`full`,`twoThirds`,`half`,`third`],L=[`info`,`success`,`warning`,`error`],qe=[`timeline`,`journey`,`cycle`,`funnel`,`pyramid`,`venn`,`matrix`],Je={min:0,max:5,default:3},Ye=[`normal`,`reverse`,`highlight`],Xe=[`done`,`active`,`critical`,`milestone`];function Ze(e){let{bounds:t,shape:n,ink:r}=e,i=t.x+t.width,a=t.y+t.height,o=_(e,s(t.x,t.y,t.width,t.height,4),r);return o.push(..._(e,y(t.x,t.y,i,a),r,C)),o.push(..._(e,y(i,t.y,t.x,a),r,C)),n.label&&o.push(w(e,t.x+t.width/2,t.y+t.height/2+Math.min(t.height*.25,n.fontSize*1.4),n.label,v,{size:n.fontSize*.8,anchor:`middle`})),o}var R=`Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.`,z=1.3;function B(e,t){return Math.min(e.height*.5,Math.max(0,e.height-t*4))}function V(e){let t=f(e),n=e.fontSize,r=e.fontSize*.85,i=t.x+12,a=t.width-24,o=t.y+B(t,e.fontSize)+8,s=t.y+t.height-6,c=n*z,l=Math.max(1,e.label.trim()?T(e.label.trim(),a,n).length:1),u=Math.min(l*c,s-o),d=Math.min(o+u+4,s);return{title:{field:`label`,x:i,y:o,width:a,height:u,fontSize:n},body:{field:`body`,x:i,y:d,width:a,height:Math.max(r,s-d),fontSize:r}}}function H(e,t,n,r){let i=n.trim();if(!i)return[];let a=t.fontSize*z,o=Math.max(1,Math.floor(t.height/a));return T(i,t.width,t.fontSize).slice(0,o).map((n,i)=>w(e,t.x,t.y+a*i+2,n,r,{size:t.fontSize,baseline:`hanging`,testId:t.field===`body`?`card-body`:`card-title`}))}function Qe(e){let{bounds:t,shape:n,ink:r}=e,i=t.x+t.width,a=t.y+B(t,n.fontSize),o=g(e,10);o.push(..._(e,y(t.x,a,i,a),r,C)),o.push(..._(e,y(t.x,t.y,i,a),v,C)),o.push(..._(e,y(i,t.y,t.x,a),v,C));let s=V(n);return o.push(...H(e,s.title,n.label,r)),o.push(...H(e,s.body,n.body??``,v)),o}function $e(e){let{bounds:t,shape:n,ink:r}=e,i=b(n.label),a=g(e,6);if(i.length===0)return a;let o=t.height/i.length;return i.forEach((n,s)=>{let c=t.y+o*s,l=c+o/2,u=t.x+12;a.push({kind:`circle`,cx:u,cy:l,r:2.4,fill:v}),a.push(w(e,u+12,l,n,r)),s<i.length-1&&a.push(..._(e,y(t.x,c+o,t.x+t.width,c+o),v,1))}),a}var et={info:{label:`Info`,tint:`#e7f5ff`,ink:`#1971c2`},success:{label:`Success`,tint:`#ebfbee`,ink:`#2f9e44`},warning:{label:`Warning`,tint:`#fff9db`,ink:`#f08c00`},error:{label:`Error`,tint:`#fff5f5`,ink:`#e03131`}},U=L.map(e=>({key:e,...et[e]}));function tt(e){return U[Math.max(0,Math.min(U.length-1,Math.round(e.value??0)))]}function nt(t,n,r,i,a,o){let s=[];return n===`warning`?s.push(..._(t,`M ${r} ${i-a} L ${r+a} ${i+a*.85} L ${r-a} ${i+a*.85} Z`,o,C)):s.push(..._(t,e(r,i,a),o,C)),n===`success`?(s.push(..._(t,`M ${r-a*.45} ${i} L ${r-a*.1} ${i+a*.4} L ${r+a*.5} ${i-a*.4}`,o,2)),s):n===`info`?(s.push({kind:`circle`,cx:r,cy:i-a*.45,r:1.5,fill:o}),s.push(..._(t,y(r,i-a*.1,r,i+a*.5),o,2)),s):n===`warning`?(s.push(..._(t,y(r,i-a*.08,r,i+a*.28),o,2)),s.push({kind:`circle`,cx:r,cy:i+a*.5,r:1.4,fill:o}),s):(s.push(..._(t,y(r,i-a*.42,r,i+a*.12),o,2)),s.push({kind:`circle`,cx:r,cy:i+a*.42,r:1.4,fill:o}),s)}function rt(e){let{bounds:t,shape:n}=e,r=tt(n),i=t.y+t.height/2,a=[{kind:`rect`,x:t.x,y:t.y,width:t.width,height:t.height,rx:8,fill:r.tint}];a.push(..._(e,s(t.x,t.y,t.width,t.height,8),r.ink));let o=re(t),c=t.x+o+12;if(a.push(...nt(e,r.key,c,i,o,r.ink)),n.label){let o=t.x+oe(t);a.push(w(e,o,i,n.label,r.ink,{size:n.fontSize*.92}))}return a}function it(e){let{bounds:t,shape:n,ink:r}=e,i=b(n.label),a=g(e,8);if(i.length===0)return a;let o=t.height/i.length,s=h(n,i.length);return i.forEach((n,i)=>{let c=t.y+o*i,l=c+o/2;i===s&&a.push({kind:`rect`,x:t.x+4,y:c+3,width:t.width-8,height:o-6,rx:5,fill:x}),a.push(w(e,t.x+12,l,n,r))}),a}function at(e){let{bounds:t,shape:n,ink:r}=e,i=t.height-8,a=t.x+t.width/2,o=[],s=S(n),c=t.x,l=t.x+t.width,u=t.y,d=t.y+i,f=Math.min(6,i/2,t.width/2),p=`M ${c+f} ${u} H ${l-f} Q ${l} ${u} ${l} ${u+f} V ${d-f} Q ${l} ${d} ${l-f} ${d} H ${a+8} L ${a} ${d+8} L ${a-8} ${d} H ${c+f} Q ${c} ${d} ${c} ${d-f} V ${u+f} Q ${c} ${u} ${c+f} ${u} Z`;if(s&&(o.push({kind:`rect`,x:c,y:u,width:t.width,height:i,rx:f,fill:s}),o.push({kind:`path`,d:`M ${a-8} ${d} L ${a} ${d+8} L ${a+8} ${d} Z`,fill:s,stroke:`none`})),o.push(..._(e,p,r)),n.label){let c=s?E(s):r;o.push(w(e,a,t.y+i/2,n.label,c,{anchor:`middle`,size:n.fontSize*.9}))}return o}function ot(e){let{bounds:t,shape:n,ink:r}=e,i=b(n.label),a=g(e,8);if(i.length===0)return a;let o=h(n,i.length),s=Math.min(38,t.height/i.length),c=Math.max(0,t.height-s*i.length),l=t.x+t.width,u=t.y;return i.forEach((d,f)=>{let p=u+s/2,m=l-20,h=f===o,g=h?`M ${m-5} ${p-3} L ${m} ${p+3} L ${m+5} ${p-3}`:`M ${m-3} ${p-5} L ${m+3} ${p} L ${m-3} ${p+5}`;if(a.push(w(e,t.x+12,p,d,r)),a.push(..._(e,g,v,C)),u+=s,h&&c>0){let r=Math.max(1,Math.floor(c/(n.fontSize*1.4)));for(let i=0;i<r;i+=1){let o=u+n.fontSize*1.4*(i+.6);if(o>u+c)break;let s=i===r-1?.6:.92;a.push(..._(e,y(t.x+12,o,t.x+t.width*s,o),v,1))}u+=c}f<i.length-1&&a.push(..._(e,y(t.x,u,l,u),v,1))}),a}var st=`Are you sure you want to continue?`;function W(e){return Math.min(46,e.height*.24)}function G(e){return Math.min(56,e.height*.28)}function K(e){let t=e.x+e.width,n=e.y+e.height,r=G(e),i=n-r,a=Math.min(34,r-14),o=i+(r-a)/2,s=Math.min(88,(e.width-24-10)/2);if(s<=24)return null;let c=t-12-s;return{secondary:{x:c-10-s,y:o,width:s,height:a},primary:{x:c,y:o,width:s,height:a}}}function q(e){return e.primaryLabel??`OK`}function J(e){return e.secondaryLabel??`Cancel`}function ct(e){let{bounds:t,shape:n,ink:r}=e,i=t.x+t.width,o=t.y+t.height,c=W(t),l=o-G(t),u=g(e,12);n.label&&u.push(w(e,t.x+12,t.y+c/2,n.label,r,{testId:`card-title`}));let d=i-12-4,f=t.y+c/2;u.push(..._(e,y(d-5,f-5,d+5,f+5),v,C)),u.push(..._(e,y(d+5,f-5,d-5,f+5),v,C)),u.push(..._(e,y(t.x,t.y+c,i,t.y+c),v,1));let p=n.body??``;if(p){let i=n.fontSize*.92,a=i*1.4,o=t.y+c+10,s=T(p,t.width-24,i),d=Math.max(1,Math.floor((l-o)/a));s.slice(0,d).forEach((n,s)=>u.push(w(e,t.x+12,o+a*(s+.5),n,r,{size:i,testId:`card-body`})))}u.push(..._(e,y(t.x,l,i,l),v,1));let m=K(t);if(m){let{secondary:t,primary:i}=m,o=n.fontSize*.82,c=a(r)??E(r);u.push({kind:`rect`,x:i.x,y:i.y,width:i.width,height:i.height,rx:8,fill:r}),u.push(..._(e,s(i.x,i.y,i.width,i.height,8),r)),u.push(..._(e,s(t.x,t.y,t.width,t.height,8),r));let l=q(n),d=J(n);l&&u.push(w(e,i.x+i.width/2,i.y+i.height/2,l,c,{anchor:`middle`,size:o,testId:`modal-primary`})),d&&u.push(w(e,t.x+t.width/2,t.y+t.height/2,d,r,{anchor:`middle`,size:o,testId:`modal-secondary`}))}return u}var lt={image:Ze,card:Qe,list:$e,alert:rt,menu:it,tooltip:at,accordion:ot,modal:ct};function ut(e){let{bounds:t,shape:n,ink:r}=e,i=t.y+t.height/2,a=_(e,s(t.x,t.y,t.width,t.height,8),r),o=b(n.label),c=h(n,o.length);return o.forEach((n,s)=>{let l=t.x+t.width*(s+.5)/o.length;a.push(w(e,l,i,n,s===c?r:v,{anchor:`middle`}))}),a}var dt=14;function ft(e){let{bounds:t,shape:n,ink:r}=e,i=t.y+t.height/2,a=t.y+t.height-1,o=[{kind:`line`,x1:t.x,y1:a,x2:t.x+t.width,y2:a,stroke:v,width:1}],s=b(n.label);if(s.length>0){let c=h(n,s.length),l=n.fontSize*.55,u=t.x;s.forEach((t,n)=>{let s=t.length*l+dt*2;n===c&&o.push(..._(e,y(u+4,a,u+s-4,a),r,2.5)),o.push(w(e,u+s/2,i,t,n===c?r:v,{anchor:`middle`})),u+=s})}return o}function pt(e){let{bounds:t,shape:n,ink:r}=e,i=t.y+t.height/2,a=b(n.label),o=n.fontSize*.4,s=[],c=t.x;return a.forEach((t,n)=>{let l=n===a.length-1;s.push(w(e,c,i,t,l?r:v,{anchor:`start`})),c+=d(e,t),l||(c+=o,s.push(w(e,c,i,`/`,v,{anchor:`start`})),c+=d(e,`/`)+o)}),s}function mt(e){let{bounds:t,shape:n,ink:r}=e,i=t.y+t.height/2,a=b(n.label),o=t.height*.5,c=[],l=t.x+o*.5;c.push(..._(e,`M ${l+3} ${i-5} L ${l-3} ${i} L ${l+3} ${i+5}`,v,C));let u=t.x+t.width-o*.5;if(c.push(..._(e,`M ${u-3} ${i-5} L ${u+3} ${i} L ${u-3} ${i+5}`,v,C)),a.length>0){let l={x:t.x+o,width:t.width-o*2},u=l.width/a.length,d=h(n,a.length),f=Math.min(t.height,u)*.82;a.forEach((t,a)=>{let o=l.x+u*(a+.5);a===d&&c.push(..._(e,s(o-f/2,i-f/2,f,f,5),r,C)),c.push(w(e,o,i,t,a===d?r:v,{anchor:`middle`,size:n.fontSize*.85}))})}return c}function ht(e){let{bounds:t,shape:n,ink:r}=e,i=t.x+t.width,a=Math.min(34,t.height*.2),o=_(e,s(t.x,t.y,t.width,t.height,8),r),c=t.y+a/2;o.push(..._(e,`M ${t.x+18} ${c-4} L ${t.x+12} ${c} L ${t.x+18} ${c+4}`,v,C)),o.push(..._(e,`M ${i-18} ${c-4} L ${i-12} ${c} L ${i-18} ${c+4}`,v,C)),o.push(w(e,t.x+t.width/2,c,n.label||`Month`,v,{anchor:`middle`,size:n.fontSize*.85})),o.push(..._(e,y(t.x,t.y+a,i,t.y+a),v,1));let l=t.y+a+8,u=t.y+t.height-l-8,d=t.width/7,f=u/5,p=Math.min(d,f)*.16,m=Math.round((n.value??.4)*34);for(let e=0;e<5;e+=1)for(let i=0;i<7;i+=1){let a=t.x+d*(i+.5),s=l+f*(e+.5);e*7+i===m?o.push({kind:`circle`,cx:a,cy:s,r:p*1.8,fill:S(n)??r}):o.push({kind:`circle`,cx:a,cy:s,r:p,fill:v})}return o}function gt(e){let{bounds:t,shape:n,ink:r}=e,i=b(n.label),a=g(e,8);if(i.length===0)return a;let o=t.y+12,s=Math.min(40,(t.height-24)/i.length),c=h(n,i.length);return i.forEach((i,l)=>{let u=o+s*l,d=u+s/2;l===c&&a.push({kind:`rect`,x:t.x+6,y:u+3,width:t.width-12,height:s-6,rx:6,fill:x});let f=t.x+12+2;a.push({kind:`circle`,cx:f,cy:d,r:3,fill:l===c?r:v}),a.push(w(e,f+14,d,i,l===c?r:v,{size:n.fontSize*.9}))}),a}function Y(e){let{bounds:t,shape:n,ink:r}=e,i=b(n.label),a=Math.max(i.length,1),o=t.width/a,c=Math.min(8,t.height/2),l=t.y+t.height/2,u=h(n,i.length),d=S(n)??`#4dabf7`,f=[];i.length>0&&f.push({kind:`rect`,x:t.x+u*o,y:t.y,width:o,height:t.height,rx:u===0||u===a-1?c:0,fill:d}),f.push(..._(e,s(t.x,t.y,t.width,t.height,c),r));for(let n=1;n<a;n+=1){let i=t.x+n*o;f.push(..._(e,y(i,t.y,i,t.y+t.height),r,C))}return i.forEach((n,r)=>{let i=t.x+(r+.5)*o,a=r===u?E(d):v;f.push(w(e,i,l,n,a,{anchor:`middle`}))}),f}function _t(t){let{bounds:n,shape:r,ink:i}=t,a=b(r.label),o=Math.max(a.length,1),s=n.width/o,c=h(r,a.length),l=_(t,y(n.x,n.y,n.x+n.width,n.y),v,C),u=Math.min(8,n.height*.18),d=n.y+n.height*.4;return a.forEach((a,o)=>{let f=n.x+(o+.5)*s,p=o===c?i:v;l.push(..._(t,e(f,d,u),p,C)),l.push(w(t,f,n.y+n.height*.8,a,p,{anchor:`middle`,size:r.fontSize*.78}))}),l}function vt(e){let{bounds:t,shape:n,ink:r}=e,i=t.y+t.height/2,a=n.label&&n.label.length>0?n.label:`9:41`,o=[w(e,t.x+8,i,a,r,{size:n.fontSize*p})],c=t.x+t.width-8,l=Math.min(11,t.height*.5),u=l*2,d=c-u-2,f=i-l/2;o.push(..._(e,s(d,f,u,l,2),r,C)),o.push({kind:`rect`,x:d+u+1.5,y:i-l*.2,width:2,height:l*.4,fill:r}),o.push({kind:`rect`,x:d+1.5,y:f+1.5,width:(u-3)*.6,height:l-3,fill:r});let m=i+5,h=d-30;for(let e=0;e<4;e+=1){let t=3+e*2.2;o.push({kind:`rect`,x:h,y:m-t,width:3,height:t,fill:r}),h+=5}return o}function yt(t){let{bounds:n,shape:r,ink:i}=t,a=n.x+n.width/2,o=n.y+n.height/2,s=Math.min(n.width,n.height)/2-2,c=S(r),l=[];c&&l.push({kind:`circle`,cx:a,cy:o,r:s,fill:c}),l.push(..._(t,e(a,o,s),i));let u=s*.42,d=c?E(c):i;return l.push(..._(t,y(a-u,o,a+u,o),d,2.5)),l.push(..._(t,y(a,o-u,a,o+u),d,2.5)),l}var bt={navbar:ut,tabs:ft,breadcrumbs:pt,pagination:mt,datepicker:ht,sidebar:gt,segmented:Y,tabbar:_t,statusbar:vt,fab:yt},X=`#1e1e1e`,xt={...Oe,...bt,...lt,...n};function St(e,t){let n=f(e),r=0,i={shape:e,bounds:n,ink:u(e.color===`transparent`?X:e.color),text:t,nextSalt:()=>(r+=1,r)};return xt[e.kind](i)}var Z={button:{width:140,height:46},input:{width:220,height:46},search:{width:220,height:46},checkbox:{width:160,height:32},radio:{width:160,height:32},toggle:{width:140,height:36},dropdown:{width:200,height:46},slider:{width:220,height:42},navbar:{width:360,height:52},tabs:{width:320,height:46},image:{width:240,height:160},avatar:{width:72,height:72},heading:{width:240,height:46},paragraph:{width:280,height:84},divider:{width:240,height:16},link:{width:120,height:28},textarea:{width:240,height:110},stepper:{width:140,height:46},badge:{width:76,height:28},progress:{width:240,height:16},breadcrumbs:{width:280,height:32},pagination:{width:240,height:40},rating:{width:150,height:32},card:{width:240,height:200},list:{width:240,height:150},alert:{width:320,height:56},menu:{width:200,height:150},tooltip:{width:160,height:48},accordion:{width:280,height:170},datepicker:{width:240,height:220},sidebar:{width:180,height:280},scrollbar:{width:14,height:220},segmented:{width:240,height:36},tabbar:{width:360,height:56},statusbar:{width:320,height:28},fab:{width:56,height:56},modal:{width:320,height:210},stepbadge:{width:44,height:44},entity:{width:200,height:176},lifeline:{width:150,height:300},fragment:{width:300,height:180}},Q={button:`Button`,input:`Type here…`,search:`Search…`,dropdown:`Select…`,heading:`Heading`,navbar:`Home | About | Contact`,tabs:`First | Second`,checkbox:`Checkbox`,radio:`Option`,toggle:`Toggle`,link:`Link text`,badge:`New`,breadcrumbs:`Home | Library | Item`,pagination:`1 | 2 | 3 | 4`,card:`Card title`,list:`Item one | Item two | Item three`,alert:`Heads up. Something needs attention.`,menu:`New | Open | Save | Close`,tooltip:`Tooltip text`,accordion:`Section one | Section two | Section three`,sidebar:`Dashboard | Projects | Team | Settings`,segmented:`Day | Week | Month`,tabbar:`Home | Search | Profile`,statusbar:`9:41`,modal:`Dialog title`,stepbadge:`1`,entity:`User`,lifeline:`Participant`,fragment:`opt`},$={button:{resize:`free`,fill:!0,font:!0,label:!0},input:{resize:`width`,fill:!1,font:!0,label:!0},search:{resize:`width`,fill:!1,font:!0,label:!0},checkbox:{resize:`width`,fill:!1,font:!0,label:!0,value:`toggle`},radio:{resize:`width`,fill:!1,font:!0,label:!0,value:`toggle`},toggle:{resize:`width`,fill:!0,font:!0,label:!0,value:`toggle`},dropdown:{resize:`width`,fill:!1,font:!0,label:!0},slider:{resize:`width`,fill:!1,font:!0,label:!0,value:`range`},navbar:{resize:`width`,fill:!1,font:!0,label:!0,value:`index`},tabs:{resize:`width`,fill:!1,font:!0,label:!0,value:`index`},image:{resize:`free`,fill:!1,font:!0,label:!0},avatar:{resize:`aspect`,fill:!1,font:!1,label:!1},heading:{resize:`free`,fill:!1,font:!0,label:!0},paragraph:{resize:`free`,fill:!1,font:!0,label:!0},divider:{resize:`width`,fill:!1,font:!1,label:!1},link:{resize:`width`,fill:!1,font:!0,label:!0},textarea:{resize:`free`,fill:!1,font:!0,label:!0},stepper:{resize:`width`,fill:!1,font:!0,label:!0},badge:{resize:`width`,fill:!0,font:!0,label:!0},progress:{resize:`width`,fill:!0,font:!1,label:!1,value:`range`},breadcrumbs:{resize:`width`,fill:!1,font:!0,label:!0},pagination:{resize:`width`,fill:!1,font:!0,label:!0,value:`index`},rating:{resize:`width`,fill:!0,font:!1,label:!1,value:`stars`},card:{resize:`free`,fill:!0,font:!0,label:!0},list:{resize:`free`,fill:!0,font:!0,label:!0},alert:{resize:`width`,fill:!1,font:!0,label:!0,value:`alert`},menu:{resize:`free`,fill:!0,font:!0,label:!0,value:`index`},tooltip:{resize:`width`,fill:!0,font:!0,label:!0},accordion:{resize:`free`,fill:!0,font:!0,label:!0,value:`index`},datepicker:{resize:`free`,fill:!1,font:!1,label:!1},sidebar:{resize:`free`,fill:!0,font:!0,label:!0,value:`index`},scrollbar:{resize:`height`,fill:!0,font:!1,label:!1,value:`range`},segmented:{resize:`width`,fill:!0,font:!0,label:!0,value:`index`},tabbar:{resize:`width`,fill:!1,font:!0,label:!0,value:`index`},statusbar:{resize:`width`,fill:!1,font:!0,label:!0},fab:{resize:`aspect`,fill:!0,font:!1,label:!1},modal:{resize:`free`,fill:!0,font:!0,label:!0},stepbadge:{resize:`aspect`,fill:!0,font:!0,label:!0},entity:{resize:`free`,fill:!0,font:!0,label:!0},lifeline:{resize:`free`,fill:!0,font:!0,label:!0,value:`activation`},fragment:{resize:`free`,fill:!0,font:!0,label:!0,value:`operator`}};function Ct(e){return $[e].label}function wt(e,n,r){let i=Z[e];return{id:t(),type:`control`,kind:e,x:n.x,y:n.y,width:i.width,height:i.height,rotation:0,label:Q[e]??``,...e===`card`?{body:R}:{},...e===`modal`?{body:st}:{},...e===`entity`?{body:c}:{},...e===`fragment`?{fill:o}:{},...e===`stepbadge`?{fill:N}:{},fontSize:16,fontFamily:r.fontFamily,color:r.color===`transparent`?X:r.color,opacity:r.opacity,value:Tt(e)}}function Tt(e){if(e===`toggle`||e===`checkbox`||e===`radio`)return 1;if(e===`slider`||e===`progress`)return .6;if(e===`scrollbar`)return .3;if(e===`rating`)return 3;if(e===`alert`||e===`navbar`||e===`tabs`||e===`pagination`||e===`menu`||e===`accordion`||e===`sidebar`||e===`segmented`||e===`tabbar`)return 0}export{Le as A,Xe as C,Je as D,qe as E,He as F,Ve as I,Ge as L,P as M,Ne as N,F as O,Be as P,Fe as R,Ae as S,ke as T,We as _,Ct as a,Re as b,R as c,G as d,W as f,je as g,L as h,St as i,Ie as j,Me as k,V as l,J as m,Q as n,wt as o,q as p,Z as r,U as s,$ as t,K as u,Ke as v,Ye as w,Ue as x,ze as y,N as z};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./react-lCSYwAWP.js";import{t as n}from"./jsx-runtime-DKdBMi_L.js";import{o as r,s as i}from"./editor-BeufBV54.js";import{C as a,Kr as o,Ur as s,an as c,in as l,mn as u,sn as d,w as f}from"./slides-D686obFO.js";import{H as p,J as m,K as h,Q as g,W as ee}from"./style-BENGW2ZV.js";import{n as te}from"./renderer-environment-D3n3hbug.js";import{r as ne,s as re,t as ie}from"./IconHelp-CaEwHrsN.js";import{t as ae}from"./editable-target-BTLnvKNi.js";import{t as _}from"./createReactComponent-C51FAx3B.js";import{n as oe,r as v,t as se}from"./IconTrash-C8w6ThWx.js";import{t as ce}from"./IconArrowLeft-B4Zcy-Fc.js";import{n as le,t as ue}from"./IconPlayerStopFilled-D4qdct2R.js";import{t as de}from"./IconEraser-CYfXj27R.js";import{t as fe}from"./IconFocusCentered-Cn8rbfRI.js";import{t as pe}from"./IconPencil-D_pQsAyv.js";import{t as me}from"./IconX-KrRqxr2j.js";import{t as he}from"./IconPlayerPlayFilled-DVAWmYt7.js";import{t as ge}from"./storage-CvDRYh5V.js";import{s as y}from"./chrome-C2RCq3SI.js";import{i as _e,n as b,r as x,t as S}from"./DialogRoot-DUeVfNhS.js";import{n as C,t as ve}from"./DialogTitle-D5au2NAn.js";import{t as w}from"./DialogDescription-Ddhk2rmF.js";import{n as ye}from"./connector-labels-CrEgadsC.js";var T=_(`outline`,`volume-off`,`VolumeOff`,[[`path`,{d:`M15 8a5 5 0 0 1 1.912 4.934m-1.377 2.602a5 5 0 0 1 -.535 .464`,key:`svg-0`}],[`path`,{d:`M17.7 5a9 9 0 0 1 2.362 11.086m-1.676 2.299a9 9 0 0 1 -.686 .615`,key:`svg-1`}],[`path`,{d:`M9.069 5.054l.431 -.554a.8 .8 0 0 1 1.5 .5v2m0 4v8a.8 .8 0 0 1 -1.5 .5l-3.5 -4.5h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l1.294 -1.664`,key:`svg-2`}],[`path`,{d:`M3 3l18 18`,key:`svg-3`}]]),be=_(`outline`,`volume`,`Volume`,[[`path`,{d:`M15 8a5 5 0 0 1 0 8`,key:`svg-0`}],[`path`,{d:`M17.7 5a9 9 0 0 1 0 14`,key:`svg-1`}],[`path`,{d:`M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a.8 .8 0 0 1 1.5 .5v14a.8 .8 0 0 1 -1.5 .5l-3.5 -4.5`,key:`svg-2`}]]),E=e(t(),1),D=200,xe=24,O=48,k=new Set([`ellipse`,`oval`,`double-circle`,`delay`]);function A(e,t){return`${e}:${t}`}function j(e){if(e.bendStyle===`elbow`)return o(e);let t={x:e.x,y:e.y},n={x:e.x2,y:e.y2};if(Math.abs(e.bend)<.5)return[t,n];let r=s(e),i={x:2*r.x-(t.x+n.x)/2,y:2*r.y-(t.y+n.y)/2},a=[];for(let e=0;e<=xe;e++){let r=e/xe,o=1-r;a.push({x:o*o*t.x+2*o*r*i.x+r*r*n.x,y:o*o*t.y+2*o*r*i.y+r*r*n.y})}return a}function M(e,t){let{x:n,y:r,width:i,height:a}=t,o=e.type===`rectangle`?e.kind:null;if(o&&k.has(o)){let e=[];for(let t=0;t<=O;t++){let o=t/O*Math.PI*2;e.push({x:n+i/2+Math.cos(o)*i/2,y:r+a/2+Math.sin(o)*a/2})}return e}return o===`diamond`?[{x:n+i/2,y:r},{x:n+i,y:r+a/2},{x:n+i/2,y:r+a},{x:n,y:r+a/2},{x:n+i/2,y:r}]:o===`triangle`?[{x:n+i/2,y:r},{x:n+i,y:r+a},{x:n,y:r+a},{x:n+i/2,y:r}]:[{x:n,y:r},{x:n+i,y:r},{x:n+i,y:r+a},{x:n,y:r+a},{x:n,y:r}]}var N=6;function P(e){if(e.length<3)return e;let t=[e[0]];for(let n=1;n<e.length-1;n++){let r=t[t.length-1];Math.hypot(e[n].x-r.x,e[n].y-r.y)>=N&&t.push(e[n])}return t.push(e[e.length-1]),t}function Se(e){if(e.type===`draw`)return[P(e.points)];if(e.type===`line`)return[e.points];if(e.type===`polygon`)return e.points.length>2?[[...e.points,e.points[0]]]:[];if(e.type===`arrow`)return[j(e)];if(e.type===`text`||e.type===`figure`||!u(e)&&e.type!==`table`)return[];let t=c(e),n=M(e,t),r=d(e);if(!r)return[n];let i={x:t.x+t.width/2,y:t.y+t.height/2},a=r*Math.PI/180;return[n.map(e=>l(e,i,a))]}function F(e,t){let n=Math.floor(Math.min(t.a.x,t.b.x)/D),r=Math.floor(Math.max(t.a.x,t.b.x)/D),i=Math.floor(Math.min(t.a.y,t.b.y)/D),a=Math.floor(Math.max(t.a.y,t.b.y)/D);for(let o=n;o<=r;o++)for(let n=i;n<=a;n++){let r=A(o,n),i=e.get(r);i?i.push(t):e.set(r,[t])}}function Ce(e,t){for(let n=1;n<t.length;n++){let r=t[n-1],i=t[n];!Number.isFinite(r.x+r.y+i.x+i.y)||r.x===i.x&&r.y===i.y||(F(e.cells,{a:r,b:i}),e.bottom=Math.max(e.bottom,r.y,i.y),e.empty=!1)}}function we(e){return e.flatMap(Se)}function Te(e,t=[]){let n={cells:new Map,bottom:-1/0,empty:!0};for(let t of e)Ce(n,t);for(let e of t)Ce(n,P(e));return n}function I(e,t,n){let r=Math.floor((t.x-n)/D),i=Math.floor((t.x+n)/D),a=Math.floor((t.y-n)/D),o=Math.floor((t.y+n)/D),s=[];for(let t=r;t<=i;t++)for(let n=a;n<=o;n++){let r=e.cells.get(A(t,n));r&&s.push(...r)}return s}function Ee(e,t){let n=Math.floor(t.x/D),r=Math.floor(e.bottom/D);for(let i=Math.floor(t.y/D);i<=r;i++)for(let{a:r,b:a}of e.cells.get(A(n,i))??[]){let e=Math.min(r.x,a.x),n=Math.max(r.x,a.x);if(t.x<e||t.x>n)continue;let i=n===e?0:(t.x-r.x)/(a.x-r.x);if(Math.max(r.y,a.y)>=t.y&&r.y+(a.y-r.y)*i>=t.y)return!0}return!1}var De=1500,L={x:8,y:-40},Oe={x:11,y:-29},R=7,ke=.1,Ae=.02,z=5e3,je=32,Me=1300,Ne=1100,Pe=650,B=7,V=10,H=1,Fe=.15,U=2.5,Ie=3,Le=8,Re=1.2,ze=1700,Be=2400,Ve=.2,He=620,Ue=.15,We=1.4,Ge=700,Ke=4e3,qe=160,Je={left:!1,right:!1,boost:!1,duck:!1};function Ye(e,t){return{position:{...e},velocity:{...t},grounded:!1,normal:null}}function Xe(e,t){return{...Ye(e,t),spin:0}}function Ze(e){let t={x:0,y:0};return{left:Xe({x:e.x-23,y:e.y},t),right:Xe({x:e.x+23,y:e.y},t),facing:1,ducking:!1,rider:null,crashedFor:0,jumpBuffer:0,outcome:`riding`,distance:0,topSpeed:0,air:0,longestAir:0,angle:0,airTurn:0,groundTurn:0,leanLock:0,wasGrounded:!1,touchedDown:!1,lastGroundY:e.y,startY:e.y,trail:[{...e}],events:[]}}function W(e){return Math.hypot(e.x,e.y)}function G(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Qe(e){return G(e.left.position,e.right.position,.5)}function $e(e){return W(G(e.left.velocity,e.right.velocity,.5))}function et(e,t,n){let r=G(e,t,.5),i=Math.atan2(t.y-e.y,t.x-e.x),a=Math.cos(i),o=Math.sin(i);return{x:r.x+n.x*a-n.y*o,y:r.y+n.x*o+n.y*a}}function tt(e,t){let{position:n,velocity:r}=e;r.y+=De*t,r.x*=1-Ae*t,r.y*=1-Ae*t;let i=W(r);i>z&&(r.x=r.x/i*z,r.y=r.y/i*z),n.x+=r.x*t,n.y+=r.y*t}function nt(e,t,n,r){let{position:i,velocity:a}=e,o=0,s=0;for(let e of I(t,i,n)){let t=h(i,e.a,e.b),r=i.x-t.x,c=i.y-t.y,l=Math.hypot(r,c);if(l>=n)continue;let u,d;if(l>1e-6)u=r/l,d=c/l;else{let t=e.b.x-e.a.x,n=e.b.y-e.a.y,r=Math.hypot(t,n);u=n/r,d=-t/r,d>0&&(u=-u,d=-d)}i.x+=u*(n-l),i.y+=d*(n-l);let f=a.x*u+a.y*d;f<0&&(a.x-=1.1*f*u,a.y-=1.1*f*d),o+=u,s+=d}let c=Math.hypot(o,s);e.grounded=c>0,e.normal=e.grounded?{x:o/c,y:s/c}:null,e.grounded&&(a.x*=1-ke*r,a.y*=1-ke*r)}function rt(e,t,n){return I(e,t,n).some(e=>m(h(t,e.a,e.b),t)<n)}function K(e,t){let n=t.position.x-e.position.x,r=t.position.y-e.position.y,i=Math.hypot(n,r)||1;return{x:n/i,y:r/i}}function it(e,t){let n=t.position.x-e.position.x,r=t.position.y-e.position.y,i=Math.hypot(n,r)||1,a=n/i,o=r/i,s=(i-46)/2;e.position.x+=a*s,e.position.y+=o*s,t.position.x-=a*s,t.position.y-=o*s;let c=(t.velocity.x-e.velocity.x)*a+(t.velocity.y-e.velocity.y)*o;t.velocity.x-=a*c*.5,t.velocity.y-=o*c*.5,e.velocity.x+=a*c*.5,e.velocity.y+=o*c*.5}function at(e,t,n){let{left:r,right:i}=e,a=K(r,i),o=!!t.right-+!!t.left,s=r.grounded||i.grounded;o!==0&&s&&(e.facing=o>0?1:-1);let c={x:a.x*e.facing,y:a.y*e.facing};if(o!==0&&s)for(let e of[r,i]){if(!e.normal)continue;let t=-e.normal.y,r=e.normal.x;t*c.x+r*c.y<0&&(t=-t,r=-r),e.velocity.x*t+e.velocity.y*r<Ne&&(e.velocity.x+=t*Me*n,e.velocity.y+=r*Me*n)}if(o!==0&&!s&&(r.velocity.x+i.velocity.x)/2*o<Ne)for(let e of[r,i])e.velocity.x+=o*Pe*n;if(t.boost&&(r.velocity.x+i.velocity.x)/2*c.x+(r.velocity.y+i.velocity.y)/2*c.y<Be)for(let e of[r,i])e.velocity.x+=c.x*ze*n,e.velocity.y+=c.y*ze*n}function ot(e,t,n){return((t.velocity.x-e.velocity.x)*-n.y+(t.velocity.y-e.velocity.y)*n.x)/46}function st(e,t,n,r,i){let a=(i-r)*23;t.velocity.x+=-n.y*a,t.velocity.y+=n.x*a,e.velocity.x-=-n.y*a,e.velocity.y-=n.x*a}function ct(e,t){let{left:n,right:r}=e,i=K(n,r),a=ot(n,r,i),o=Math.atan2(i.y,i.x),s=ee(-o*U,-3,Ie);st(n,r,i,a,Math.abs(o)>Re&&a*o>0?s:a+(s-a)*Math.min(1,Le*t))}function lt(e,t,n){let{left:r,right:i}=e,a=K(r,i),o=ot(r,i,a);st(r,i,a,o,o+(t*B-o)*Math.min(1,V*n))}function ut(e){let t=K(e.left,e.right);return Math.atan2(t.y,t.x)}function dt(e,t){let n=t-e;return n>Math.PI?n-=Math.PI*2:n<-Math.PI&&(n+=Math.PI*2),n}function ft(e,t=0){return Math.floor((Math.abs(e)+t)/(Math.PI*2))}function pt(e){e.outcome===`riding`&&(e.jumpBuffer=Ue)}function mt(e){let{left:t,right:n}=e;if(e.jumpBuffer<=0||!t.grounded&&!n.grounded)return;let r=K(t,n);for(let e of[t,n])e.velocity.x+=r.y*He,e.velocity.y-=r.x*He;e.jumpBuffer=0,e.events.push({kind:`jump`})}function ht(e,t,n,r){if(e.outcome===`fell`)return;let i=Math.max(W(e.left.velocity),W(e.right.velocity),e.rider?W(e.rider.velocity):0),a=Math.min(je,Math.max(1,Math.ceil(i*r/(11*.4)))),o=r/a;for(let r=0;r<a;r++){let r=Qe(e);if(e.outcome===`riding`){e.ducking=n.duck,at(e,n,o);let t=!!n.right-+!!n.left,r=!e.left.grounded&&!e.right.grounded;r&&e.wasGrounded&&(e.leanLock=t),t!==e.leanLock&&(e.leanLock=0),e.wasGrounded=!r,e.touchedDown||=!r,r&&(t!==0&&e.leanLock===0&&e.touchedDown?lt(e,t,o):ct(e,o)),mt(e)}tt(e.left,o),tt(e.right,o),it(e.left,e.right),nt(e.left,t,11,o),nt(e.right,t,11,o);let i=K(e.left,e.right);for(let t of[e.left,e.right]){let e=t.velocity.x*i.x+t.velocity.y*i.y;t.spin+=e/11*o}let a=ut(e),s=dt(e.angle,a);if(e.angle=a,e.left.grounded||e.right.grounded?e.groundTurn+=s:(e.airTurn+=s,e.air<=Fe&&(e.groundTurn+=s)),e.outcome===`riding`){let t=Qe(e);e.distance+=m(r,t)}if(e.rider)tt(e.rider,o),nt(e.rider,t,R,o);else{let n=e.ducking?Oe:L,r=et(e.left.position,e.right.position,{x:n.x*e.facing,y:n.y});if(rt(t,r,R)){let t=G(e.left.velocity,e.right.velocity,.5);e.rider=Ye(r,{x:t.x,y:t.y-250}),e.outcome=`crashed`,e.events.push({kind:`crash`})}}}let s=Qe(e);if(e.outcome===`riding`&&(e.topSpeed=Math.max(e.topSpeed,$e(e))),e.left.grounded||e.right.grounded){if(e.outcome===`riding`){e.air>Ve&&e.events.push({kind:`land`,strength:Math.min(1,e.air/1.2),air:e.air});let t=ft(e.airTurn,H);if(t>0){let n=e.airTurn*e.facing>0?`frontflip`:`backflip`;e.events.push({kind:`trick`,trick:{kind:n,count:t}})}ft(e.groundTurn)>0&&(e.events.push({kind:`trick`,trick:{kind:`loop`}}),e.groundTurn-=Math.sign(e.groundTurn)*Math.PI*2)}e.air=0,e.airTurn=0,e.lastGroundY=s.y}else e.outcome===`riding`&&(e.air+=r,e.longestAir=Math.max(e.longestAir,e.air),e.air>Fe&&(e.groundTurn=0));e.outcome===`crashed`&&(e.crashedFor+=r),e.jumpBuffer=Math.max(0,e.jumpBuffer-r);let c=e.trail[e.trail.length-1];m(c,s)>6&&(e.trail.push(s),e.trail.length>qe&&e.trail.shift());let l=Math.max(t.bottom,e.startY)+Ke,u=s.y-e.lastGroundY>Ge&&!Ee(t,s);(s.y>l||u)&&(e.outcome=`fell`)}function gt(e){return e.outcome===`fell`||e.crashedFor>We}function q(e){return G(e.left,e.right,.5)}function _t(e){return{left:{x:e.x-23,y:e.y},right:{x:e.x+23,y:e.y},leftSpin:0,rightSpin:0,facing:1,ducking:!1,rider:null,riderSpin:0}}function vt(e){return{left:{...e.left.position},right:{...e.right.position},leftSpin:e.left.spin,rightSpin:e.right.spin,facing:e.facing,ducking:e.ducking,rider:e.rider?{...e.rider.position}:null,riderSpin:e.crashedFor*9}}function yt(e,t,n){return{left:G(e.left,t.left,n),right:G(e.right,t.right,n),leftSpin:e.leftSpin+(t.leftSpin-e.leftSpin)*n,rightSpin:e.rightSpin+(t.rightSpin-e.rightSpin)*n,facing:t.facing,ducking:t.ducking,rider:t.rider?G(e.rider??t.rider,t.rider,n):null,riderSpin:e.riderSpin+(t.riderSpin-e.riderSpin)*n}}var J=n(),bt=`#e03131`,xt=`#f76707`,Y=`var(--canvas-ink)`;function St(e){let{x:t,spin:n}=e;return(0,J.jsxs)(`g`,{transform:`translate(${t} 0) rotate(${n*180/Math.PI})`,children:[(0,J.jsx)(`circle`,{r:10,fill:`none`,stroke:Y,strokeWidth:2.5}),(0,J.jsx)(`path`,{d:`M -9 0 L 9 0 M 0 -9 L 0 9`,stroke:Y,strokeWidth:1,opacity:.6})]})}function Ct(e){let{rearSpin:t,frontSpin:n,riding:r,boosting:i,ducking:a}=e,o={x:-3,y:2},s=t*.6,c=e=>({x:o.x+Math.cos(s+e)*6,y:o.y+Math.sin(s+e)*6}),l=c(0),u=c(Math.PI),d=a?{x:-7,y:-17}:{x:-7,y:-20},f=a?{x:6,y:-23}:{x:4,y:-34},p=a?Oe:L,m=a?`M 6 -24 L -7 -23 L -12 -19`:`M 5 -33 L -8 -31 L -13 -27`,h=e=>{let t={x:(d.x+e.x)/2+6,y:(d.y+e.y)/2-3};return`M ${d.x} ${d.y} L ${t.x} ${t.y} L ${e.x} ${e.y}`};return(0,J.jsxs)(`g`,{strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`,children:[i&&(0,J.jsx)(`path`,{d:`M -30 -19 L ${-44-(Math.sin(t*7)+1)*5} -16 L -30 -13 Z`,fill:xt,stroke:xt,strokeWidth:1.5}),(0,J.jsx)(`rect`,{x:-30,y:-19,width:16,height:6,rx:3,fill:`var(--canvas-bg)`,stroke:Y,strokeWidth:2}),(0,J.jsx)(St,{x:-23,spin:t}),(0,J.jsx)(St,{x:23,spin:n}),r&&(0,J.jsx)(`path`,{d:h(u),stroke:Y,strokeWidth:2.5,opacity:.45}),(0,J.jsx)(`path`,{d:`M -23 0 L ${o.x} ${o.y} L 14 -16 L 23 0 M -23 0 L -8 -17 L ${o.x} ${o.y} M -12 -18 L -4 -18 M 14 -16 L 12 -23 L 18 -24`,stroke:Y,strokeWidth:2.5}),r&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`path`,{d:`${h(l)} M ${d.x} ${d.y} L ${f.x} ${f.y} L 16 -23`,stroke:Y,strokeWidth:2.5}),(0,J.jsx)(`circle`,{cx:p.x,cy:p.y,r:6,fill:`var(--canvas-bg)`,stroke:Y,strokeWidth:2.5}),(0,J.jsx)(`path`,{d:m,stroke:`#e03131`,strokeWidth:3})]})]})}function wt(){return(0,J.jsxs)(`g`,{strokeLinecap:`round`,fill:`none`,stroke:Y,strokeWidth:2.5,children:[(0,J.jsx)(`circle`,{r:6,fill:`var(--canvas-bg)`}),(0,J.jsx)(`path`,{d:`M 0 6 L 0 20 M 0 11 L -9 16 M 0 11 L 9 14 M 0 20 L -6 30 M 0 20 L 7 29`}),(0,J.jsx)(`path`,{d:`M -3 6 L -14 9`,stroke:bt,strokeWidth:3})]})}function Tt(e,t){let n=[e[0]];for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r],o=Math.ceil(m(i,a)/t);for(let e=1;e<=o;e++){let t=e/o;n.push({x:i.x+(a.x-i.x)*t,y:i.y+(a.y-i.y)*t})}}return n}function Et(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return{minX:t,minY:n,maxX:r,maxY:i}}function Dt(e,t,n,r){let i=[],a=!1;for(let o of e){let e=Et(o);if(!(Math.min(t.x,n.x)-r<=e.maxX&&Math.max(t.x,n.x)+r>=e.minX&&Math.min(t.y,n.y)-r<=e.maxY&&Math.max(t.y,n.y)+r>=e.minY)){i.push(o);continue}let s=[],c=!1;for(let e of Tt(o,r/2))g(e,t,n)<=r?(c=!0,s.length>1&&i.push(s),s=[]):s.push(e);if(!c){i.push(o);continue}a=!0,s.length>1&&i.push(s)}return a?i:e}function Ot(e,t){let n=e;for(let e of t)for(let t=0;t<e.points.length;t++)n=Dt(n,e.points[Math.max(0,t-1)],e.points[t],e.radius);return n}var kt=260,At=2.2,jt={smoke:-60,dust:500,spark:900};function X(e,t,n,r,i,a,o,s){for(let c=0;c<r;c++){let r=Math.random()*Math.PI*2,c=Math.random()*a;e.push({kind:t,x:n.x+(Math.random()-.5)*4,y:n.y+(Math.random()-.5)*4,vx:i.x+Math.cos(r)*c,vy:i.y+Math.sin(r)*c,age:0,life:o*(.6+Math.random()*.8),size:s*(.7+Math.random()*.6)})}e.length>kt&&e.splice(0,e.length-kt)}function Mt(e,t){let n=0;for(let r of e)r.age+=t,!(r.age>=r.life)&&(r.vx*=1-At*t,r.vy=r.vy*(1-At*t)+jt[r.kind]*t,r.x+=r.vx*t,r.y+=r.vy*t,e[n++]=r);e.length=n}var Z=.05;function Nt(e,t){let n=e.createBuffer(1,e.sampleRate*t,e.sampleRate),r=n.getChannelData(0);for(let e=0;e<r.length;e++)r[e]=Math.random()*2-1;return n}function Pt(e,t){let n=e.createBufferSource();return n.buffer=t,n.loop=!0,n.start(),n}function Ft(e){let t=typeof window>`u`?void 0:window.AudioContext??window.webkitAudioContext;if(!t)return null;let n=new t;n.resume().catch(()=>void 0);let r=n.createGain();r.gain.value=e?0:.6,r.connect(n.destination);let i=Nt(n,2),a=n.createBiquadFilter();a.type=`lowpass`,a.frequency.value=300;let o=n.createGain();o.gain.value=0,Pt(n,i).connect(a).connect(o).connect(r);let s=n.createOscillator();s.type=`sawtooth`,s.frequency.value=70;let c=n.createBiquadFilter();c.type=`lowpass`,c.frequency.value=700;let l=n.createGain();l.gain.value=0,s.connect(c).connect(l).connect(r),s.start();let u=n.createBiquadFilter();u.type=`bandpass`,u.frequency.value=1800,u.Q.value=.7;let d=n.createGain();d.gain.value=0,Pt(n,i).connect(u).connect(d).connect(r);let f=(e,t,i,a)=>{let o=n.currentTime,s=n.createOscillator();s.type=`sine`,s.frequency.setValueAtTime(e,o),s.frequency.exponentialRampToValueAtTime(t,o+a);let c=n.createGain();c.gain.setValueAtTime(i,o),c.gain.exponentialRampToValueAtTime(.001,o+a),s.connect(c).connect(r),s.start(o),s.stop(o+a)},p=(e,t,a)=>{let o=n.currentTime,s=n.createBufferSource();s.buffer=i;let c=n.createBiquadFilter();c.type=`lowpass`,c.frequency.value=e;let l=n.createGain();l.gain.setValueAtTime(t,o),l.gain.exponentialRampToValueAtTime(.001,o+a),s.connect(c).connect(l).connect(r),s.start(o),s.stop(o+a)};return{update:({speed:e,grounded:t,boosting:r,running:i})=>{let c=n.currentTime,u=Math.min(1,e/1500);o.gain.setTargetAtTime(i&&t?.05+u*.25:0,c,Z),a.frequency.setTargetAtTime(250+u*1400,c,Z);let f=i&&r;l.gain.setTargetAtTime(f?.1:0,c,Z),s.frequency.setTargetAtTime(60+u*90,c,Z),d.gain.setTargetAtTime(f?.18:0,c,Z)},land:e=>{f(140,45,.25+e*.45,.25),p(900,.15+e*.2,.18)},jump:()=>{f(180,520,.3,.14),p(2400,.08,.1)},trick:()=>{let e=n.currentTime;[660,990].forEach((t,i)=>{let a=e+i*.09,o=n.createOscillator();o.type=`triangle`,o.frequency.setValueAtTime(t,a);let s=n.createGain();s.gain.setValueAtTime(.001,e),s.gain.setValueAtTime(.18,a),s.gain.exponentialRampToValueAtTime(.001,a+.22),o.connect(s).connect(r),o.start(a),o.stop(a+.24)})},crash:()=>{p(1400,.6,.6),f(110,35,.7,.45)},setMuted:e=>{r.gain.setTargetAtTime(e?0:.6,n.currentTime,Z)},close:()=>{n.close().catch(()=>void 0)}}}var It=1/120,Lt=.05,Rt=5,zt=.25,Bt=260,Vt=48,Ht={x:-32,y:-16},Ut=100,Wt=150,Gt=50,Kt=1,qt=1.4,Jt=40,Yt=22;function Xt(e){return e.lift+e.age/qt*Jt}function Zt(e){if(e.kind===`loop`)return`Loop!`;let t=e.kind===`backflip`?`Backflip`:`Frontflip`;return e.count>1?`${e.count}× ${t}!`:`${t}!`}function Qt(e){return e.kind===`loop`?Wt:Ut*e.count*e.count}function $t(){let e=0,t=null,n={bike:null,pose:null,blendFrom:null,controls:{...Je},particles:[],callouts:[],score:0,running:!1,following:!0,returning:!1,play(e,r){t??=Ft(r),n.bike=Ze(e),n.pose=vt(n.bike),n.blendFrom=null,n.returning=!1,n.following=!0,n.running=!0,n.score=0,n.callouts=[]},stop(e){let r=n.bike,i=r?{distance:r.distance,topSpeed:r.topSpeed,longestAir:r.longestAir,score:n.score,outcome:e}:null;return n.bike=null,n.pose=null,n.controls={...Je},t?.update({speed:0,grounded:!1,boosting:!1,running:!1}),n.returning=n.following,n.running=!1,i},setMuted(e){t?.setMuted(e)},close(){t?.close(),t=null},tick(t,r,a,o,s){let c=Math.min(Lt,t),l=n.bike,u=null;if(l&&n.running){for(e+=c;e>=It;)n.blendFrom=vt(l),ht(l,r,n.controls,It),e-=It;let t=vt(l);if(n.pose=yt(n.blendFrom??t,t,e/It),i(l,t),gt(l))return{camera:null,ended:n.stop(l.outcome===`fell`?`fell`:`crashed`),moved:!1};!n.following&&en(q(n.pose),a,o)&&(n.following=!0),n.following&&(u=tn(l,n.pose))}else e=0,n.returning&&s&&(u=s);let d=null;if(u){let e=1-Math.exp(-c*Rt),t=a.width/2-u.x*o.zoom-o.x,r=a.height/2-u.y*o.zoom-o.y;!n.running&&Math.hypot(t,r)<1&&(n.returning=!1),d={...o,x:o.x+t*e,y:o.y+r*e}}if(n.particles.length>0&&Mt(n.particles,c),n.callouts.length>0){for(let e of n.callouts)e.age+=c;n.callouts=n.callouts.filter(e=>e.age<qt)}return{camera:d,ended:null,moved:n.running||n.particles.length>0||n.callouts.length>0}}};function r(e,t,r){n.score+=t;let i=q(r),a=0,o=n.callouts.map(Xt).sort((e,t)=>e-t);for(let e of o)e<a+Yt&&(a=Math.max(a,e+Yt));n.callouts.push({text:`${e} +${t}`,at:{x:i.x,y:i.y-60},age:0,lift:a})}function i(e,i){let a=n.particles,o=n.controls.boost&&e.outcome===`riding`;if(o){let t=et(i.left,i.right,{x:Ht.x*e.facing,y:Ht.y}),n={x:(e.left.velocity.x+e.right.velocity.x)*.15,y:(e.left.velocity.y+e.right.velocity.y)*.15};X(a,`smoke`,t,2,n,90,.9,7),X(a,`spark`,t,1,n,160,.25,2.5)}for(let n of e.events)if(n.kind===`jump`){t?.jump();for(let e of[i.left,i.right])X(a,`dust`,{x:e.x,y:e.y+11},4,{x:0,y:-40},120,.45,3.5)}else if(n.kind===`trick`)t?.trick(),r(Zt(n.trick),Qt(n.trick),i);else if(n.kind===`land`){n.air>=Kt&&r(`Big air ${n.air.toFixed(1)}s`,Math.round(n.air*Gt),i),t?.land(n.strength);for(let e of[i.left,i.right])X(a,`dust`,{x:e.x,y:e.y+11},6,{x:0,y:-80},160+n.strength*200,.6,4)}else t?.crash(),X(a,`dust`,i.rider??q(i),18,{x:0,y:-120},320,.8,5);e.events.length=0,t?.update({speed:$e(e),grounded:e.left.grounded||e.right.grounded,boosting:o,running:e.outcome===`riding`})}return n}function en(e,t,n){let r=e.x*n.zoom+n.x,i=e.y*n.zoom+n.y;return r<Vt||i<Vt||r>t.width-Vt||i>t.height-Vt}function tn(e,t){let n=q(t),r={x:(e.left.velocity.x+e.right.velocity.x)/2,y:(e.left.velocity.y+e.right.velocity.y)/2},i=Math.min(1,Bt/(Math.hypot(r.x,r.y)*zt||1));return{x:n.x+r.x*zt*i,y:n.y+r.y*zt*i}}var nn=e=>Math.round(e/50),rn=e=>Math.round(e/10);function Q(e){let{label:t,value:n,fresh:r}=e;return(0,J.jsxs)(`span`,{className:`flex items-baseline gap-1`,children:[(0,J.jsx)(`span`,{className:`tabular-nums ${r?`font-semibold text-[var(--canvas-selection)]`:`text-[var(--chrome-fg-900)]`}`,children:n}),(0,J.jsx)(`span`,{className:`text-[var(--chrome-fg-500)]`,children:t})]})}function an(e){let{live:t,last:n,best:r,newBest:i,hint:a}=e;return(0,J.jsx)(`div`,{className:`pointer-events-none flex flex-col items-center ${re}`,children:(0,J.jsxs)(`div`,{"data-overlay":!0,"data-ride-hud":!0,onPointerDown:e=>e.stopPropagation(),className:`pointer-events-auto flex h-8 items-center gap-3 rounded-xl px-3 text-[12px] text-[var(--chrome-fg-600)] ${y}`,children:[t&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{label:`km/h`,value:String(rn(t.speed))}),(0,J.jsx)(Q,{label:`m`,value:String(nn(t.distance))}),(0,J.jsx)(Q,{label:`s air`,value:t.longestAir.toFixed(1)}),(0,J.jsx)(Q,{label:`pts`,value:String(t.score)})]}),!t&&n&&(0,J.jsxs)(J.Fragment,{children:[(i.distance||i.score)&&(0,J.jsx)(`span`,{className:`font-semibold text-[var(--canvas-selection)]`,children:`New best!`}),(0,J.jsx)(Q,{label:`m last`,value:String(nn(n.distance))}),n.score>0&&(0,J.jsx)(Q,{label:`pts`,value:String(n.score)}),(0,J.jsx)(Q,{label:`m best`,value:String(nn(r.distance)),fresh:i.distance}),r.score>0&&(0,J.jsx)(Q,{label:`pts best`,value:String(r.score),fresh:i.score})]}),a&&(0,J.jsx)(`span`,{className:`text-[var(--chrome-fg-500)]`,children:a})]})})}function $(e){let{label:t,title:n,active:r,onClick:i,children:a}=e;return(0,J.jsx)(`button`,{type:`button`,"aria-label":t,"aria-pressed":r,title:n,onClick:i,className:`flex h-9 min-w-9 cursor-pointer touch-none select-none items-center justify-center rounded-lg px-2 transition-colors ${r?`bg-[var(--canvas-selection)]/15 text-[var(--canvas-selection)]`:`text-[var(--chrome-fg-600)] hover:bg-[var(--chrome-hover)] hover:text-[var(--chrome-fg-900)]`}`,children:a})}function on(e){let{inkTool:t,hasDrawings:n,running:r,following:i,muted:a}=e,{onInkTool:o,onResetDrawings:s,onPlay:c,onStop:l}=e,{onFollow:u,onToggleMuted:d,onExit:f,onHelp:p}=e;return(0,J.jsxs)(`div`,{"data-overlay":!0,"data-ride-hud":!0,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),className:`pointer-events-auto absolute bottom-[calc(1rem+env(safe-area-inset-bottom))] left-1/2 flex -translate-x-1/2 items-center gap-1 rounded-xl p-1 ${y}`,children:[(0,J.jsx)($,{label:`Pen`,title:`Pen (P) — ride mode drawings aren't saved`,active:t===`pen`,onClick:()=>o(`pen`),children:(0,J.jsx)(pe,{size:18,stroke:1.75})}),(0,J.jsx)($,{label:`Eraser`,title:`Eraser (E)`,active:t===`eraser`,onClick:()=>o(`eraser`),children:(0,J.jsx)(de,{size:18,stroke:1.75})}),n&&(0,J.jsx)($,{label:`Reset drawings`,title:`Clear ride drawings and bring back anything erased`,onClick:s,children:(0,J.jsx)(se,{size:18,stroke:1.75})}),(0,J.jsx)(`span`,{className:`mx-1 h-5 w-px bg-[var(--chrome-ring)]`}),(0,J.jsxs)(`button`,{type:`button`,"data-testid":`ride-play`,"aria-label":r?`Stop`:`Play`,title:r?`Back to the start`:`Play (Space)`,onClick:r?l:c,className:`flex h-9 cursor-pointer items-center gap-1.5 rounded-lg bg-[var(--canvas-selection)] px-3 text-[13px] font-medium text-white transition-opacity hover:opacity-90`,children:[r?(0,J.jsx)(ue,{size:14}):(0,J.jsx)(he,{size:14}),r?`Stop`:`Play`]}),r&&!i&&(0,J.jsx)($,{label:`Follow the bike`,title:`Follow the bike`,onClick:u,children:(0,J.jsx)(fe,{size:18,stroke:1.75})}),(0,J.jsx)(`span`,{className:`mx-1 h-5 w-px bg-[var(--chrome-ring)]`}),(0,J.jsx)($,{label:a?`Unmute`:`Mute`,title:a?`Sound off`:`Sound on`,onClick:d,children:a?(0,J.jsx)(T,{size:18,stroke:1.75}):(0,J.jsx)(be,{size:18,stroke:1.75})}),(0,J.jsx)($,{label:`How to play`,title:`How to play (?)`,onClick:p,children:(0,J.jsx)(ie,{size:18,stroke:1.75})}),(0,J.jsx)($,{label:`Exit ride mode`,title:`Exit ride mode (Esc)`,onClick:f,children:(0,J.jsx)(me,{size:18,stroke:1.75})})]})}var sn=(0,E.memo)(on),cn={"←":ce,"→":le,"↑":oe,"↓":v};function ln(e){let t=cn[e.name];return(0,J.jsx)(`kbd`,{className:`flex h-6 min-w-6 items-center justify-center rounded-md bg-[var(--chrome-hover)] px-1.5 text-[11px] text-[var(--chrome-fg-600)] ring-1 ring-[var(--chrome-ring)]`,children:t?(0,J.jsx)(t,{size:13,stroke:2}):e.name})}var un=[[[[`Space`],`Start playing`],[[`←`,`→`],`Drive`],[[`↑`],`Jump`],[[`R`],`Restart`],[[`B`],`Move bike to cursor`],[[`P`],`Pen`],[[`E`],`Eraser`]],[[[`↓`],`Duck`],[[`Shift`],`Boost`],[[`←`,`→`],`Flip, in the air`],[[`⌘`,`Z`],`Undo a stroke`],[[`?`],`These shortcuts`],[[`Esc`],`Leave ride mode`]]];function dn(){return(0,J.jsxs)(`svg`,{viewBox:`0 0 420 96`,className:`h-24 w-full`,"aria-hidden":!0,children:[(0,J.jsx)(`path`,{d:`M 0 82 L 150 82 Q 250 82 300 40`,fill:`none`,stroke:`var(--canvas-selection)`,strokeWidth:3,strokeLinecap:`round`}),(0,J.jsx)(`g`,{transform:`translate(110 71)`,children:(0,J.jsx)(Ct,{rearSpin:0,frontSpin:0,riding:!0,boosting:!1,ducking:!1})})]})}var fn=(0,E.memo)(function(e){let{open:t,onClose:n}=e;return(0,J.jsx)(S,{open:t,onOpenChange:e=>{e||n()},children:(0,J.jsxs)(b,{children:[(0,J.jsx)(_e,{"data-overlay":!0,className:`fixed inset-0 z-50 bg-gray-900/15`}),(0,J.jsxs)(x,{"data-overlay":!0,"data-testid":`ride-guide`,onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),n())},className:`fixed left-1/2 top-1/2 z-50 flex w-[min(480px,92vw)] overflow-hidden -translate-x-1/2 -translate-y-1/2 flex-col gap-4 rounded-2xl bg-[var(--chrome-popup)] p-5 outline-none ring-1 ring-[var(--chrome-ring)]`,children:[(0,J.jsx)(`div`,{className:`-mx-5 -mt-5 rounded-t-2xl bg-[var(--chrome-hover)] px-5 pt-4`,children:(0,J.jsx)(dn,{})}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(ve,{className:`text-[15px] font-medium text-[var(--chrome-fg-900)]`,children:`Ride your canvas`}),(0,J.jsx)(w,{className:`text-[13px] leading-relaxed text-[var(--chrome-fg-500)]`,children:`Nothing you draw or erase changes your work.`})]}),(0,J.jsx)(`div`,{className:`grid grid-cols-2 gap-x-6`,children:un.map((e,t)=>(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(([e,t])=>(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[13px] text-[var(--chrome-fg-600)]`,children:[(0,J.jsx)(`span`,{children:t}),(0,J.jsx)(`span`,{className:`flex gap-1`,children:e.map(e=>(0,J.jsx)(ln,{name:e},e))})]},t))},t))}),(0,J.jsx)(C,{className:`h-9 w-full cursor-pointer rounded-xl bg-[var(--chrome-fg-900)] text-[13px] font-medium text-[var(--chrome-popup)] outline-none transition-opacity hover:opacity-90 active:scale-[0.99]`,children:`Start Playing`})]})]})})}),pn=new Set([`ArrowLeft`,`KeyA`]),mn=new Set([`ArrowRight`,`KeyD`]),hn=new Set([`ArrowUp`,`KeyW`,`Space`]),gn=new Set([`ShiftLeft`,`ShiftRight`]),_n=new Set([`ArrowDown`,`KeyS`]),vn=new Set([`Equal`,`Minus`,`Digit0`,`Digit1`]);function yn(e){return pn.has(e)?`left`:mn.has(e)?`right`:gn.has(e)?`boost`:_n.has(e)?`duck`:null}function bn(e,t,n){let r=(0,E.useRef)(t);r.current=t;let i=(0,E.useRef)(n);i.current=n,(0,E.useEffect)(()=>{let t=t=>{if(i.current||ae(t.target))return;let n=t.metaKey||t.ctrlKey;if(n&&vn.has(t.code)||t.shiftKey&&!n&&t.code===`KeyR`)return;t.stopImmediatePropagation();let a=r.current;if(t.key===`Escape`){t.preventDefault(),a.escape();return}if(n&&t.code===`KeyZ`){t.preventDefault(),a.undo();return}if(!n&&t.code===`KeyP`){a.pickTool(`pen`);return}if(!n&&t.code===`KeyE`){a.pickTool(`eraser`);return}if(!n&&t.code===`KeyB`){a.placeBike();return}if(t.key===`?`){t.preventDefault(),a.help();return}let o=e.bike;if(!n&&t.code===`KeyR`){t.preventDefault(),t.repeat||a.restart();return}if(t.code===`Space`&&!e.running){t.preventDefault(),t.repeat||a.play();return}if(!e.running||!o)return;let s=yn(t.code);if(!(!hn.has(t.code)&&!s)){if(t.preventDefault(),t.repeat||(e.following=!0),s){e.controls[s]=!0;return}t.repeat||pt(o)}},n=t=>{let n=yn(t.code);n&&(e.controls[n]=!1)},a=()=>{e.controls={...Je}};return window.addEventListener(`keydown`,t,!0),window.addEventListener(`keyup`,n,!0),window.addEventListener(`blur`,a),()=>{window.removeEventListener(`keydown`,t,!0),window.removeEventListener(`keyup`,n,!0),window.removeEventListener(`blur`,a)}},[e])}var xn=`koboyo.ride-muted`,Sn=`koboyo.ride-guide-seen`,Cn={smoke:`#adb5bd`,dust:`#b08968`,spark:`#f76707`},wn=`var(--canvas-selection)`,Tn=12,En=50,Dn=3,On=new WeakMap;function kn(e){return e.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `)}var An=(0,E.memo)(function(e){let{ink:t,cuts:n,inkWidth:r}=e;return(0,J.jsxs)(J.Fragment,{children:[n.map((e,t)=>(0,J.jsx)(`path`,{d:kn(e.points.length>1?e.points:[e.points[0],e.points[0]]),fill:`none`,stroke:`var(--canvas-bg)`,strokeWidth:e.radius*2,strokeLinecap:`round`,strokeLinejoin:`round`},t)),t.map((e,t)=>(0,J.jsx)(`path`,{"data-testid":`ride-ink`,d:kn(e),fill:`none`,stroke:wn,strokeWidth:r,vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`},t))]})});function jn(e,t){return e.map((e,n)=>{let r=f(e,t);return`${n===0?`M`:`L`} ${r.x} ${r.y}`}).join(` `)}function Mn(e,t){let n=c(e);return e.type!==`arrow`&&e.type!==`line`?[n]:[n,...ye(e,t)]}function Nn(){let e=i(),t=te(),n=r(e=>e.viewport),o=r(e=>e.shapes),s=(0,E.useRef)(null),[c]=(0,E.useState)(()=>On.get(e)),l=(0,E.useRef)(c?.start??null),[u]=(0,E.useState)($t),d=(0,E.useRef)(null),h=(0,E.useRef)(null),g=(0,E.useRef)(null),ee=(0,E.useRef)(0),re=(0,E.useRef)(null),ie=(0,E.useRef)([]),[_,oe]=(0,E.useState)(!1),[v,se]=(0,E.useState)(!0),ce=(0,E.useRef)(v);ce.current=v;let[le,ue]=(0,E.useState)(null),[de,fe]=(0,E.useState)(c?.best??{distance:0,score:0}),[pe,me]=(0,E.useState)({distance:!1,score:!1}),he=(0,E.useRef)(de);he.current=de;let[y,_e]=(0,E.useState)(()=>ge.getString(xn)===`1`),b=(0,E.useMemo)(()=>we(o),[o]),[x,S]=(0,E.useState)(()=>({ink:c?.ink??[],cuts:c?.cuts??[],lines:c?Ot(b,c.cuts):b})),{ink:C,cuts:ve}=x,[w,ye]=(0,E.useState)(`pen`),[T,be]=(0,E.useState)(null),[D,xe]=(0,E.useState)(()=>ge.getString(Sn)!==`1`),[,O]=(0,E.useState)(0);(0,E.useEffect)(()=>{S(e=>e.lines===b&&e.cuts.length===0?e:{...e,lines:Ot(b,e.cuts)})},[b]);let k=(0,E.useMemo)(()=>Te(x.lines,C),[x.lines,C]),A=(0,E.useRef)(x),j=(0,E.useRef)(b);j.current=b,A.current=x;let M=(0,E.useCallback)(()=>{let e=ie.current;e.push(A.current),e.length>En&&e.shift()},[]),N=(0,E.useRef)(k);N.current=k;let P=(0,E.useCallback)(e=>{u.following=e,se(e)},[u]),Se=(0,E.useCallback)(()=>{_e(e=>{let t=!e;return ge.setString(xn,t?`1`:`0`),u.setMuted(t),t})},[u]);(0,E.useEffect)(()=>()=>u.close(),[u]),(0,E.useEffect)(()=>()=>{On.set(e,{ink:A.current.ink,cuts:A.current.cuts,start:l.current,best:he.current})},[e]),(0,E.useLayoutEffect)(()=>{let t=s.current;if(!t)return;let n=t.getBoundingClientRect(),r=e.getState().viewport,i=e=>e.x>=0&&e.y>=0&&e.x<=n.width&&e.y<=n.height,o=ne.at&&{x:ne.at.x-n.left,y:ne.at.y-n.top};if(o&&i(o)){l.current=a(o,r),O(e=>e+1);return}let c=l.current;c&&i(f(c,r))||(l.current=a({x:n.width*.3,y:n.height*.4},r),O(e=>e+1))},[e]),(0,E.useEffect)(()=>{e.getState().setSelectedIds(new Set)},[e]),(0,E.useEffect)(()=>{let e=e=>{ae(e.target)||e.stopImmediatePropagation()};return window.addEventListener(`paste`,e,!0),window.addEventListener(`cut`,e,!0),()=>{window.removeEventListener(`paste`,e,!0),window.removeEventListener(`cut`,e,!0)}},[]);let F=(0,E.useCallback)(()=>{let e=l.current;e&&(u.play(e,y),P(!0),oe(!0),me({distance:!1,score:!1}))},[u,y,P]),I=(0,E.useCallback)(e=>{if(e){let t=he.current,n={distance:e.distance>t.distance&&t.distance>0,score:e.score>t.score&&t.score>0};ue(e),me(n),fe({distance:Math.max(t.distance,e.distance),score:Math.max(t.score,e.score)})}oe(!1)},[]),De=(0,E.useCallback)(()=>I(u.stop(`stopped`)),[u,I]),Oe=(0,E.useCallback)(()=>{u.running&&I(u.stop(`stopped`)),F()},[u,I,F]),R=(0,E.useCallback)(()=>e.getState().setRideMode(!1),[e]),ke=(0,E.useCallback)(()=>{u.running&&I(u.stop(`stopped`)),u.controls={...Je},xe(!0)},[u,I]),Ae=(0,E.useCallback)(()=>{ge.setString(Sn,`1`),xe(!1)},[]);bn(u,{escape:()=>{if(h.current){h.current=null,O(e=>e+1);return}R()},undo:()=>{let e=ie.current.pop();e&&S({...e,lines:Ot(j.current,e.cuts)})},pickTool:ye,placeBike:()=>{let e=re.current;!e||u.running||(l.current=e,O(e=>e+1))},play:F,restart:Oe,help:ke},D),(0,E.useEffect)(()=>{let e=s.current?.parentElement;if(!e)return;let t=e=>{e.target instanceof Element&&e.target.closest(`[data-ride-hud]`)||(u.returning=!1,u.running&&u.following&&P(!1))};return e.addEventListener(`pointerdown`,t,!0),e.addEventListener(`wheel`,t,{capture:!0,passive:!0}),()=>{e.removeEventListener(`pointerdown`,t,!0),e.removeEventListener(`wheel`,t,!0)}},[u,P]),(0,E.useEffect)(()=>{let t=0,n=performance.now(),r=i=>{t=requestAnimationFrame(r);let a=(i-n)/1e3;n=i;let o=s.current;if(!o)return;let c=u.tick(a,N.current,{width:o.clientWidth,height:o.clientHeight},e.getState().viewport,l.current);if(c.ended){I(c.ended);return}if(u.following&&!ce.current&&P(!0),c.camera){e.getState().setViewport(c.camera);return}c.moved&&O(e=>e+1)};return t=requestAnimationFrame(r),()=>cancelAnimationFrame(t)},[u,e,I,P]);let z=t=>{let n=s.current?.getBoundingClientRect();return a({x:t.clientX-(n?.left??0),y:t.clientY-(n?.top??0)},e.getState().viewport)},je=(n,r,i)=>{let a=Tn/e.getState().viewport.zoom,o={x:Math.min(n.x,r.x)-a,y:Math.min(n.y,r.y)-a,width:Math.abs(r.x-n.x)+a*2,height:Math.abs(r.y-n.y)+a*2},s=e.getState().shapes.some(e=>Mn(e,t.text).some(e=>p(e,o)));S(e=>{let t=Dt(e.ink,n,r,a);if(!s)return t===e.ink?e:{...e,ink:t};let o=e.cuts[e.cuts.length-1];return{ink:t,cuts:o?.gesture===i?[...e.cuts.slice(0,-1),{...o,points:[...o.points,r]}]:[...e.cuts,{gesture:i,radius:a,points:[n,r]}],lines:Dt(e.lines,n,r,a)}})},Me=()=>{let e=h.current;if(h.current=null,e&&e.points.length>1){let t=e.points;M(),S(e=>({...e,ink:[...e.ink,t]}))}else O(e=>e+1)},Ne=(0,E.useCallback)(()=>P(!0),[P]),Pe=(0,E.useCallback)(()=>{M(),S({ink:[],cuts:[],lines:j.current})},[M]),B=l.current,V=u.bike,H=_?u.pose:B?_t(B):null,Fe=H?q(H):null,U=Fe?f(Fe,n):null,Ie=H?Math.atan2(H.right.y-H.left.y,H.right.x-H.left.x):0,Le=H?.rider?f(H.rider,n):null,Re=h.current,ze=_&&V?.outcome===`riding`&&u.controls.boost,Be=Math.max(1.5,3*n.zoom),Ve;return Ve=_?V?.outcome===`crashed`?`Ouch!`:``:k.empty||B&&!Ee(k,B)?`Draw a track under the bike, then press Play`:le?.outcome===`crashed`?`Crashed! Press Play to go again`:le?.outcome===`fell`?`Fell off the world. Press Play to go again`:`Drag the bike, or press B to park it under the cursor. Space to play`,(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{ref:s,"data-testid":`ride-overlay`,className:`absolute inset-0 ${w===`pen`?`cursor-crosshair`:`cursor-none`}`,onPointerDown:e=>{if(e.button!==0)return;e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId);let t=z(e);if(w===`pen`)h.current={pointerId:e.pointerId,points:[t]};else{M();let n=++ee.current;g.current={pointerId:e.pointerId,last:t,gesture:n},je(t,t,n)}},onPointerMove:t=>{t.buttons<=1&&t.stopPropagation();let n=z(t);re.current=n,w===`eraser`&&be(n);let r=h.current;if(r&&r.pointerId===t.pointerId){let t=r.points[r.points.length-1],i=Dn/e.getState().viewport.zoom;m(t,n)>=i&&(r.points.push(n),Ce(N.current,[t,n]),O(e=>e+1))}else g.current?.pointerId===t.pointerId&&(je(g.current.last,n,g.current.gesture),g.current.last=n)},onPointerUp:e=>{if(h.current?.pointerId===e.pointerId&&Me(),g.current?.pointerId===e.pointerId){g.current=null;let e=ie.current;e[e.length-1]===A.current&&e.pop()}},onPointerCancel:()=>{h.current=null,g.current=null},onPointerLeave:()=>{re.current=null,be(null)},onDoubleClick:e=>e.stopPropagation(),onContextMenu:e=>{e.preventDefault(),e.stopPropagation()},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:e=>{e.preventDefault(),e.stopPropagation()},children:[(0,J.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0 h-full w-full`,children:[(0,J.jsxs)(`g`,{transform:`translate(${n.x} ${n.y}) scale(${n.zoom})`,children:[(0,J.jsx)(An,{ink:C,cuts:ve,inkWidth:Be}),Re&&(0,J.jsx)(`path`,{d:kn(Re.points),fill:`none`,stroke:wn,strokeWidth:Be,vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),w===`eraser`&&T&&(0,J.jsx)(`circle`,{cx:f(T,n).x,cy:f(T,n).y,r:Tn,fill:`none`,stroke:`var(--chrome-fg-500)`,strokeWidth:1.5}),_&&V&&V.trail.length>1&&(0,J.jsx)(`path`,{d:jn(V.trail,n),fill:`none`,stroke:`#e03131`,strokeOpacity:.3,strokeWidth:Math.max(1.5,3*n.zoom),strokeLinecap:`round`,strokeLinejoin:`round`}),u.particles.map((e,t)=>{let r=f(e,n),i=e.age/e.life,a=e.kind===`smoke`?1+i*2:1;return(0,J.jsx)(`circle`,{cx:r.x,cy:r.y,r:e.size*a*n.zoom,fill:Cn[e.kind],opacity:(1-i)*(e.kind===`smoke`?.45:.8)},t)}),H&&U&&(0,J.jsx)(`g`,{opacity:_?1:.85,transform:`translate(${U.x} ${U.y}) rotate(${Ie*180/Math.PI}) scale(${n.zoom*H.facing} ${n.zoom})`,children:(0,J.jsx)(Ct,{rearSpin:H.facing===1?H.leftSpin:-H.rightSpin,frontSpin:H.facing===1?H.rightSpin:-H.leftSpin,riding:!H.rider,boosting:ze,ducking:H.ducking})}),u.callouts.map((e,t)=>{let r=f(e.at,n),i=e.age/qt;return(0,J.jsx)(`text`,{x:r.x,y:r.y-Xt(e),textAnchor:`middle`,fontSize:16,fontWeight:700,fill:`var(--canvas-selection)`,stroke:`var(--canvas-bg)`,strokeWidth:4,paintOrder:`stroke`,opacity:Math.min(1,(1-i)*2),children:e.text},t)}),H&&Le&&(0,J.jsx)(`g`,{transform:`translate(${Le.x} ${Le.y}) rotate(${H.riderSpin*180/Math.PI}) scale(${n.zoom})`,children:(0,J.jsx)(wt,{})})]}),!_&&U&&(0,J.jsx)(`div`,{"data-ride-hud":!0,"data-testid":`ride-start-handle`,title:`Drag to move the start`,className:`pointer-events-auto absolute cursor-grab touch-none active:cursor-grabbing`,style:{left:U.x-34*n.zoom,top:U.y+(L.y-8)*n.zoom,width:68*n.zoom,height:(11-L.y+8)*n.zoom},onPointerDown:e=>{if(e.stopPropagation(),e.button!==0||!l.current)return;e.currentTarget.setPointerCapture(e.pointerId);let t=z(e);d.current={pointerId:e.pointerId,offset:{x:t.x-l.current.x,y:t.y-l.current.y}}},onPointerMove:e=>{let t=d.current;if(!t||t.pointerId!==e.pointerId)return;e.stopPropagation();let n=z(e);l.current={x:n.x-t.offset.x,y:n.y-t.offset.y},O(e=>e+1)},onPointerUp:()=>{d.current=null},onPointerCancel:()=>{d.current=null},onDoubleClick:e=>e.stopPropagation()}),(0,J.jsx)(an,{live:_&&V?{speed:$e(V),distance:V.distance,longestAir:V.longestAir,score:u.score}:null,last:le,best:de,newBest:pe,hint:Ve}),(0,J.jsx)(sn,{inkTool:w,hasDrawings:C.length>0||ve.length>0,running:_,following:v,muted:y,onInkTool:ye,onResetDrawings:Pe,onPlay:F,onStop:De,onFollow:Ne,onToggleMuted:Se,onExit:R,onHelp:ke})]}),(0,J.jsx)(fn,{open:D,onClose:Ae})]})}export{Nn as RideOverlay};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./react-lCSYwAWP.js";import{t as n}from"./jsx-runtime-DKdBMi_L.js";import{a as r}from"./editor-BeufBV54.js";import{an as i,en as a,in as o,sn as s}from"./slides-D686obFO.js";import{Z as c}from"./style-BENGW2ZV.js";import{t as l}from"./registry-rEGZW7Ab.js";var u=e(t(),1);function d(e,t){let n=i(e,t),r=a(e,t),c=s(e)*Math.PI/180;if(!c)return{body:n,footprint:r,toLocal:e=>e,toWorld:e=>e};let l={x:n.x+n.width/2,y:n.y+n.height/2};return{body:n,footprint:r,toLocal:e=>o(e,l,-c),toWorld:e=>o(e,l,c)}}function f(e,t,n){let r=d(e,n);return c(r.toLocal(t),r.footprint)}function p(e){function t(){document.hidden&&e()}return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,t)}}var m=n(),h=`coarse:before:absolute coarse:before:-inset-[18px] coarse:before:content-['']`,g=[{handle:`nw`,cursor:`nwse-resize`},{handle:`ne`,cursor:`nesw-resize`},{handle:`sw`,cursor:`nesw-resize`},{handle:`se`,cursor:`nwse-resize`}],_=[{handle:`n`,cursor:`ns-resize`},{handle:`w`,cursor:`ew-resize`},{handle:`e`,cursor:`ew-resize`},{handle:`s`,cursor:`ns-resize`}],v=[{handle:`n`,cursor:`ns-resize`},{handle:`w`,cursor:`ew-resize`},{handle:`e`,cursor:`ew-resize`},{handle:`s`,cursor:`ns-resize`}],y=_.filter(e=>e.handle===`w`||e.handle===`e`),b=_.filter(e=>e.handle===`n`||e.handle===`s`);function x(e){if(e.type!==`control`)return{edges:e.type===`text`?v:_,corners:g};switch(l[e.kind].resize){case`width`:return{edges:y,corners:[]};case`height`:return{edges:b,corners:[]};case`aspect`:return{edges:[],corners:g};default:return{edges:_,corners:g}}}function S(e,t,n,r=0){let i=t/2;e.includes(`w`)?i=-r:e.includes(`e`)&&(i=t+r);let a=n/2;return e.includes(`n`)?a=-r:e.includes(`s`)&&(a=n+r),{x:i,y:a}}function C(e,t){if(e.type===`text`){let n=t?.textBounds(e.id);if(n)return{x:e.x,y:e.y,width:n.width,height:n.height}}return e.type===`icon`?a(e,t):i(e,t)}function w(e,t,n,r){let a=i(e,r);return{x:(a.x+a.width/2-t.x)*n,y:(a.y+a.height/2-t.y)*n}}function T(e,t){let n=C(e,t);return[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x+n.width,y:n.y+n.height},{x:n.x,y:n.y+n.height}].map(d(e,t).toWorld).reduce((e,t)=>t.y<e.y-.5||Math.abs(t.y-e.y)<=.5&&t.x<e.x?t:e)}var E=[`ew-resize`,`nwse-resize`,`ns-resize`,`nesw-resize`],D={e:0,se:45,s:90,sw:135,w:180,nw:225,n:270,ne:315};function O(e,t){let n=(((D[e]??0)+t)%180+180)%180;return E[Math.round(n/45)%4]}function k(e){let t=r().measurement,[n,i]=(0,u.useState)(()=>C(e,t));return(0,u.useLayoutEffect)(()=>{let n=C(e,t);i(e=>e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height?e:n)},[e,t]),n}var A=15;function j(e,t){return t===void 0?0:Math.max(0,t-(e-A/2))}function M(e){let{position:t,cursor:n,round:r,testId:i,minHitTop:a,onPointerDown:o,onDoubleClick:s}=e,c=j(t.y,a),l=a===void 0?void 0:Math.min(0,Math.max(-15,a-(t.y+c-A/2)));return(0,m.jsx)(`div`,{"data-testid":i,onPointerDown:o,onDoubleClick:s?e=>{e.stopPropagation(),s()}:void 0,className:`absolute flex h-[15px] w-[15px] -translate-x-1/2 -translate-y-1/2 items-center justify-center coarse:before:absolute coarse:before:-inset-[15px] coarse:before:top-[var(--handle-touch-top,-15px)] coarse:before:content-['']`,style:{left:t.x,top:t.y+c,cursor:n,pointerEvents:`all`,...l===void 0?{}:{"--handle-touch-top":`${l}px`}},children:(0,m.jsx)(`div`,{className:`pointer-events-none h-[9px] w-[9px] border border-[var(--canvas-selection)] bg-white ${r?`rounded-full`:`rounded-[2px]`}`,style:c?{translate:`0 ${-c}px`}:void 0})})}function N(e){let{position:t,onPointerDown:n}=e;return(0,m.jsxs)(`div`,{"data-testid":`sticky-duplicate`,onPointerDown:n,className:`group absolute flex h-[22px] w-[22px] -translate-x-1/2 -translate-y-1/2 items-center justify-center`,style:{left:t.x,top:t.y,cursor:`grab`,pointerEvents:`all`},children:[(0,m.jsx)(`div`,{className:`absolute inset-0 rounded-full bg-[var(--canvas-selection)]/25 opacity-0 transition-opacity group-hover:opacity-100`}),(0,m.jsx)(`div`,{className:`h-[7px] w-[7px] rounded-full bg-[var(--canvas-selection)]`})]})}var P=7,F=10,I=10,L=8,R=12,z=8;function B(){return typeof window<`u`&&window.matchMedia(`(pointer: coarse)`).matches}function V(e){return e?B()?{inward:0,outward:R}:{inward:0,outward:L}:B()?{inward:F,outward:I}:{inward:3,outward:P}}function H(e,t){let n=V(e);if(t===void 0||n.outward<=t)return n;let r=Math.max(0,t);return{inward:n.inward+n.outward-r,outward:r}}function U(e){return 4*e}function W(e){let{edge:t,cursor:n,testId:r,along:i,across:a,inset:o,outwardLimit:s,onPointerDown:c}=e,l=o??(i<24?0:z),{inward:u,outward:d}=H(a<24,s);return(0,m.jsx)(`div`,{"data-testid":r,onPointerDown:c,className:`absolute`,style:{...t===`w`||t===`e`?{top:l,bottom:l,width:u+d,[t===`w`?`left`:`right`]:-d}:{left:l,right:l,height:u+d,[t===`n`?`top`:`bottom`]:-d},cursor:n,pointerEvents:`all`}})}function G(){return B()?20:14}var K=`url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width%3D'24'%20height%3D'24'%20viewBox%3D'0%200%2024%2024'%20fill%3D'none'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%3E%3Cg%20stroke%3D'white'%20stroke-width%3D'4'%3E%3Cpolyline%20points%3D'23%204%2023%2010%2017%2010'%2F%3E%3Cpath%20d%3D'M20.49%2015a9%209%200%201%201-2.12-9.36L23%2010'%2F%3E%3C%2Fg%3E%3Cg%20stroke%3D'black'%20stroke-width%3D'2'%3E%3Cpolyline%20points%3D'23%204%2023%2010%2017%2010'%2F%3E%3Cpath%20d%3D'M20.49%2015a9%209%200%201%201-2.12-9.36L23%2010'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") 12 12, grabbing`;function q(e){let{position:t,onPointerDown:n,testId:r}=e;return(0,m.jsx)(`div`,{"data-testid":r,onPointerDown:n,className:`absolute h-[9px] w-[9px] -translate-x-1/2 -translate-y-1/2 rounded-full border border-[var(--canvas-selection)] bg-white ${h}`,style:{left:t.x,top:t.y,cursor:K,pointerEvents:`all`}})}export{p as _,M as a,x as c,w as d,U as f,C as g,k as h,W as i,S as l,O as m,_ as n,q as o,T as p,N as r,h as s,g as t,G as u,f as v,d as y};
@@ -1 +0,0 @@
1
- import{Dn as e,Pn as t}from"./slides-D686obFO.js";function n(n){let r=n.type===`text`?n.text:`label`in n&&typeof n.label==`string`?n.label:`text`in n&&typeof n.text==`string`?n.text:``;return e(r)?t(r):r}function r(e){return e.type===`rectangle`?e.kind:e.type===`figure`?`frame`:e.type===`web`?e.kind===`html`?`widget`:`embed`:e.type}var i=34;function a(e){let t=n(e).replace(/\s+/g,` `).trim();return t?t.length>i?`${t.slice(0,i-1)}…`:t:e.type===`icon`&&e.name?o(e.name):o(r(e))}function o(e){let t=e.replace(/[-_]+/g,` `).trim();return t.charAt(0).toUpperCase()+t.slice(1)}export{n,a as t};
@@ -1,15 +0,0 @@
1
- import{B as e,F as t,G as n,H as r,J as i,M as a,P as o,V as s,W as c,X as l,Z as u,a as d,et as f,nt as p,q as m,r as h,rt as g,s as _,st as v,tt as y}from"./style-BENGW2ZV.js";var ee=2048,b=`strict-origin-when-cross-origin`,x=`allow-scripts allow-same-origin allow-popups allow-presentation`,S=`${x} allow-forms`,C=`allow-scripts allow-same-origin allow-popups`,w=`fullscreen; picture-in-picture; encrypted-media; clipboard-write; autoplay`,T=`fullscreen`,E=[`koboyo.com`,`koboyousercontent.com`];function D(e){if(e.length>2048)return null;let t;try{t=new URL(e)}catch{return null}return t.protocol!==`https:`||t.username!==``||t.password!==``?null:t}function te(e){return e.hostname.toLowerCase().replace(/\.$/,``)}function ne(e){return E.some(t=>e===t||e.endsWith(`.${t}`))}function O(e){return e.pathname.split(`/`).filter(e=>e!==``)}var k=new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`,`music.youtube.com`,`youtube-nocookie.com`,`www.youtube-nocookie.com`]),re=/^[A-Za-z0-9_-]{11}$/;function ie(e){let t=e.searchParams.get(`t`)??e.searchParams.get(`start`)??``;if(/^\d+s?$/.test(t))return Number.parseInt(t,10);let n=/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(t);if(!n||t===``)return 0;let[,r=`0`,i=`0`,a=`0`]=n;return Number(r)*3600+Number(i)*60+Number(a)}function ae(e,t){let n=O(e),r=null,i=!1;if(t===`youtu.be`?r=n[0]??null:k.has(t)&&(n[0]===`watch`?r=e.searchParams.get(`v`):n[0]===`embed`||n[0]===`live`||n[0]===`v`?r=n[1]??null:n[0]===`shorts`&&(r=n[1]??null,i=!0)),!r||!re.test(r))return null;let a=ie(e);return{provider:`youtube`,label:`YouTube video`,src:`https://www.youtube-nocookie.com/embed/${r}${a>0?`?start=${a}`:``}`,width:i?315:560,height:i?560:315,keepAspect:!0,video:!0,thumbnail:`https://i.ytimg.com/vi/${r}/hqdefault.jpg`}}function oe(e,t){let n=O(e),r,i=null;if(t===`vimeo.com`||t===`www.vimeo.com`?(r=n[0],i=n[1]??null):t===`player.vimeo.com`&&n[0]===`video`&&(r=n[1],i=e.searchParams.get(`h`)),!r||!/^\d+$/.test(r))return null;let a=i&&/^[0-9a-f]+$/i.test(i)?`?h=${i}`:``;return{provider:`vimeo`,label:`Vimeo video`,src:`https://player.vimeo.com/video/${r}${a}`,width:640,height:360,keepAspect:!0,video:!0}}function se(e,t){if(t!==`loom.com`&&t!==`www.loom.com`)return null;let[n,r]=O(e);return n!==`share`&&n!==`embed`||!r||!/^[A-Za-z0-9]+$/.test(r)?null:{provider:`loom`,label:`Loom video`,src:`https://www.loom.com/embed/${r}`,width:640,height:360,keepAspect:!0,video:!0}}var ce=new Set([`file`,`design`,`proto`,`board`]);function le(e,t){if(t!==`figma.com`&&t!==`www.figma.com`)return null;let n=O(e);if(n[0]===`embed`){let t=D(e.searchParams.get(`url`)??``);return!t||O(t)[0]===`embed`?null:le(t,te(t))}return!ce.has(n[0]??``)||!n[1]?null:{provider:`figma`,label:n[0]===`board`?`FigJam board`:`Figma file`,src:`https://www.figma.com/embed?embed_host=koboyo&url=${encodeURIComponent(e.href)}`,width:800,height:450,keepAspect:!1,video:!1,forms:!0}}function ue(e,t){if(t!==`codepen.io`)return null;let[n,r,i]=O(e),a=new Set([`pen`,`full`,`details`,`embed`]);return!n||!/^[A-Za-z0-9_-]+$/.test(n)||!a.has(r??``)||!i||!/^[A-Za-z0-9]+$/.test(i)?null:{provider:`codepen`,label:`CodePen`,src:`https://codepen.io/${n}/embed/${i}?default-tab=result`,width:800,height:450,keepAspect:!1,video:!1}}function de(e,t){if(t!==`codesandbox.io`)return null;let n=O(e),r;return n[0]===`s`||n[0]===`embed`?r=n[1]:n[0]===`p`&&n[1]===`sandbox`&&(r=n[2]),!r||!/^[A-Za-z0-9-]+$/.test(r)?null:{provider:`codesandbox`,label:`CodeSandbox`,src:`https://codesandbox.io/embed/${r}`,width:800,height:500,keepAspect:!1,video:!1,forms:!0}}function fe(e,t){return t!==`google.com`&&t!==`www.google.com`||e.pathname!==`/maps/embed`||!e.searchParams.get(`pb`)?null:{provider:`google-maps`,label:`Google Map`,src:e.href,width:600,height:450,keepAspect:!1,video:!1}}var pe=new Set([`track`,`album`,`playlist`,`episode`]);function me(e,t){if(t!==`open.spotify.com`)return null;let n=O(e);n[0]===`embed`&&(n=n.slice(1)),n[0]?.startsWith(`intl-`)&&(n=n.slice(1));let[r,i]=n;if(!r||!pe.has(r)||!i||!/^[A-Za-z0-9]+$/.test(i))return null;let a=r===`track`||r===`episode`;return{provider:`spotify`,label:`Spotify`,src:`https://open.spotify.com/embed/${r}/${i}`,width:400,height:a?152:352,keepAspect:!1,video:!1}}var he=[ae,oe,se,le,ue,de,fe,me];function ge(e){let t=D(e.trim());if(!t)return null;let n=te(t);if(n===``||ne(n))return null;let r=t.href;for(let e of he){let i=e(t,n);if(!i)continue;let{forms:a,...o}=i;return{...o,canonical:r,sandbox:a?S:x,allow:w}}return{provider:`generic`,label:n.replace(/^www\./,``),src:r,canonical:r,width:800,height:600,keepAspect:!1,sandbox:C,allow:T,video:!1}}function _e(e){let t=/<iframe\b[^>]*>/i.exec(e);if(!t)return null;let n=/\ssrc\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/i.exec(t[0]);if(!n)return null;let r=ve((n[1]??n[2]??n[3]??``).trim()),i=D(r.startsWith(`//`)?`https:${r}`:r);return i?i.href:null}function ve(e){return e.replace(/&quot;/g,`"`).replace(/&#0*39;/g,`'`).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&amp;/g,`&`)}function ye(e){return 9+e*2.2}var be={arrow:.84,sweep:.88,triangle:1,triangleOutline:1,diamond:1,diamondOutline:1,circle:.8,circleOutline:.8,bar:0,cross:.69,crowOne:.55,crowOnlyOne:.9,crowMany:1,crowOneOrMany:1.3,crowZeroOrOne:1.3,crowZeroOrMany:1.7},xe=.5,Se=.32;function Ce(e,t,n,r=1/0){let i=Math.max(be[t],xe);return Math.min(e,n*Se/i,r/i)}var A=36,we=10.5,Te=1.5,Ee=3;function De(e){return{minX:e.x,minY:e.y,maxX:e.x+e.width,maxY:e.y+e.height}}function Oe(e,t){return{minX:e.minX-t,minY:e.minY-t,maxX:e.maxX+t,maxY:e.maxY+t}}function ke(e,t){return{minX:Math.min(e.minX,t.minX),minY:Math.min(e.minY,t.minY),maxX:Math.max(e.maxX,t.maxX),maxY:Math.max(e.maxY,t.maxY)}}function Ae(e){return{x:(e.minX+e.maxX)/2,y:(e.minY+e.maxY)/2}}function je(e,t,n=0){return t.x>=e.minX-n&&t.x<=e.maxX+n&&t.y>=e.minY-n&&t.y<=e.maxY+n}function Me(e,t){return e>=t.min&&e<=t.max}function Ne(e){return e.max-e.min}function Pe(e,t){return t.min<=e.min&&e.max<=t.max?[]:e.min<=t.min&&t.max<=e.max?[{min:e.min,max:t.min},{min:t.max,max:e.max}]:t.max<=e.min||t.min>=e.max?[e]:Me(e.min,t)?[{min:t.max,max:e.max}]:[{min:e.min,max:t.min}]}function Fe(e,t,n){return e+(t-e)*n}var Ie=[`right`,`bottom`,`left`,`top`],Le={top:{sign:-1,main:`minY`,far:`maxY`,crossLo:`minX`,crossHi:`maxX`,crossAxis:`x`},bottom:{sign:1,main:`maxY`,far:`minY`,crossLo:`minX`,crossHi:`maxX`,crossAxis:`x`},left:{sign:-1,main:`minX`,far:`maxX`,crossLo:`minY`,crossHi:`maxY`,crossAxis:`y`},right:{sign:1,main:`maxX`,far:`minX`,crossLo:`minY`,crossHi:`maxY`,crossAxis:`y`}};function Re(e,t,n){let r=Le[n],i=e.box[r.main],a=e.isPoint?null:i+r.sign*A,o={min:e.box[r.crossLo],max:e.box[r.crossHi]},s={min:Math.min(t.box[r.main],t.box[r.far]),max:Math.max(t.box[r.main],t.box[r.far])};t.isPoint||(r.sign>0?s.min-=we*2:s.max+=we*2);let c={min:t.box[r.crossLo]-A,max:t.box[r.crossHi]+A};if(Me(i,s)&&!e.isPoint&&!t.isPoint){let e=Pe(o,c);if(e.length===0)return null;o=e.length===2&&Ne(e[1])>Ne(e[0])?e[1]:e[0]}let l=e.target[r.crossAxis];return Me(l,o)?{value:i,expanded:a,cross:o,crossTarget:l}:null}function ze(e,t){return{top:Re(e,t,`top`),right:Re(e,t,`right`),bottom:Re(e,t,`bottom`),left:Re(e,t,`left`)}}function Be(e,t){return t===null?!!(e.top||e.right||e.bottom||e.left):!!e[t]}function Ve(e){return e.isPoint?e:{box:{minX:e.target.x,minY:e.target.y,maxX:e.target.x,maxY:e.target.y},target:e.target,gap:0,minEnd:e.minEnd,side:null,isPoint:!0}}var He={sx:1,sy:1,swap:!1},Ue={sx:1,sy:-1,swap:!1},We={sx:-1,sy:1,swap:!0},Ge={sx:-1,sy:-1,swap:!1},Ke={sx:1,sy:-1,swap:!0};function qe(e,t){let n=e.sx*t.x,r=e.sy*t.y;return e.swap?{x:r,y:n}:{x:n,y:r}}function Je(e,t){let n=e.swap?t.y:t.x,r=e.swap?t.x:t.y;return{x:e.sx*n,y:e.sy*r}}function Ye(e,t){if(e.sx===-1){let e=t.minX;t.minX=-t.maxX,t.maxX=-e}if(e.sy===-1){let e=t.minY;t.minY=-t.maxY,t.maxY=-e}if(e.swap){let e=t.minX;t.minX=t.minY,t.minY=e,e=t.maxX,t.maxX=t.maxY,t.maxY=e}}function Xe(e){e&&(e.value=-e.value,e.expanded=e.expanded===null?null:-e.expanded)}function Ze(e){if(!e)return;let t=e.cross.min;e.cross.min=-e.cross.max,e.cross.max=-t,e.crossTarget=-e.crossTarget}function Qe(e,t){if(e.sx===-1){let e=t.left;t.left=t.right,t.right=e,Xe(t.left),Xe(t.right),Ze(t.top),Ze(t.bottom)}if(e.sy===-1){let e=t.top;t.top=t.bottom,t.bottom=e,Xe(t.top),Xe(t.bottom),Ze(t.left),Ze(t.right)}if(e.swap){let e=t.left;t.left=t.top,t.top=e,e=t.right,t.right=t.bottom,t.bottom=e}}function $e(e,t){if(Ye(t,e.a.box),Ye(t,e.a.grown),Ye(t,e.b.box),Ye(t,e.b.grown),Ye(t,e.common.box),Ye(t,e.common.grown),Qe(t,e.a.edges),Qe(t,e.b.edges),e.bias=qe(t,e.bias),t.sx===-1&&(e.gapX=-e.gapX,e.midX=e.midX===null?null:-e.midX),t.sy===-1&&(e.gapY=-e.gapY,e.midY=e.midY===null?null:-e.midY),t.swap){let t=e.gapX;e.gapX=e.gapY,e.gapY=t,t=e.midX,e.midX=e.midY,e.midY=t}}function et(e,t){$e(e,t),e.applied.push(t)}function tt(e){return e.swap?{sx:e.sy,sy:e.sx,swap:!0}:e}function nt(e){for(;e.applied.length>0;){let t=e.applied.pop();t&&$e(e,tt(t))}}function rt(e,t,n){let r={x:t,y:n};for(let t=e.applied.length-1;t>=0;--t)r=Je(e.applied[t],r);return r}var j=.01,M=class{work;pts=[];mid=null;constructor(e){this.work=e}to(e,t){return this.pts.push(rt(this.work,e,t)),this}tagMid(e){let t=this.pts[this.pts.length-2],n=this.pts[this.pts.length-1],r=0;for(let e of this.work.applied)e.swap&&(r+=1);return this.mid={x:(t.x+n.x)/2,y:(t.y+n.y)/2,axis:r%2==1?e===`x`?`y`:`x`:e,span:Math.abs(t.x-n.x)+Math.abs(t.y-n.y)},this}done(){let e=Ct(this.pts),t=0;for(let n=0;n<e.length-1;n+=1)t+=Math.abs(e[n+1].x-e[n].x)+Math.abs(e[n+1].y-e[n].y);return{points:e,dist:t,mid:this.mid}}};function it(e){let t=e.a.edges.right,n=e.b.edges.left;if(!t||!n||t.crossTarget>n.crossTarget&&(et(e,Ue),t=e.a.edges.right,n=e.b.edges.left,!t||!n))return null;if(e.gapX>0&&e.midX!==null)return new M(e).to(t.value,t.crossTarget).to(e.midX,t.crossTarget).to(e.midX,n.crossTarget).tagMid(`x`).to(n.value,n.crossTarget).done();if(t.expanded===null||n.expanded===null)return null;if(e.midY!==null)return new M(e).to(t.value,t.crossTarget).to(t.expanded,t.crossTarget).to(t.expanded,e.midY).to(n.expanded,e.midY).tagMid(`y`).to(n.expanded,n.crossTarget).to(n.value,n.crossTarget).done();let r=Math.abs(t.value-e.common.grown.maxX)+Math.abs(t.crossTarget-e.common.grown.maxY)+Math.abs(e.common.grown.maxX-n.expanded)+Math.abs(e.common.grown.maxY-n.crossTarget)+A+6,i=A+Math.abs(t.crossTarget-e.common.grown.minY)+Math.abs(t.expanded-e.common.grown.minX)+Math.abs(e.common.grown.minY-n.crossTarget)+Math.abs(e.common.grown.minX-n.value)+6+e.bias.y,a=e.gapX<0&&e.midX!==null?A+Math.abs(t.crossTarget-e.a.grown.maxY)+(e.common.grown.maxX-e.common.grown.minX)+Math.abs(e.a.grown.maxY-e.b.grown.minY)+Math.abs(e.b.grown.minY-n.crossTarget)+A+8:1/0;return r<i&&r<a?new M(e).to(t.value,t.crossTarget).to(e.common.grown.maxX,t.crossTarget).to(e.common.grown.maxX,e.common.grown.maxY).to(n.expanded,e.common.grown.maxY).to(n.expanded,n.crossTarget).to(n.value,n.crossTarget).done():i<a?new M(e).to(t.value,t.crossTarget).to(t.expanded,t.crossTarget).to(t.expanded,e.common.grown.minY).to(e.common.grown.minX,e.common.grown.minY).to(e.common.grown.minX,n.crossTarget).to(n.value,n.crossTarget).done():e.midX===null?null:new M(e).to(t.value,t.crossTarget).to(t.expanded,t.crossTarget).to(t.expanded,e.a.grown.maxY).to(e.midX,e.a.grown.maxY).to(e.midX,e.b.grown.minY).tagMid(`y`).to(n.expanded,e.b.grown.minY).to(n.expanded,n.crossTarget).to(n.value,n.crossTarget).done()}function at(e){let t=e.a.edges.right,n=e.b.edges.top;if(!t||!n)return null;if(t.crossTarget<(n.expanded??n.value)&&n.crossTarget>(t.expanded??t.value)||e.a.isPoint&&je(e.b.grown,Ae(e.a.box)))return new M(e).to(t.value,t.crossTarget).to(n.crossTarget,t.crossTarget).to(n.crossTarget,n.value).done();if(e.gapX>0&&e.midX!==null&&n.expanded!==null)return new M(e).to(t.value,t.crossTarget).to(e.midX,t.crossTarget).to(e.midX,n.expanded).tagMid(`x`).to(n.crossTarget,n.expanded).to(n.crossTarget,n.value).done();if(e.gapY>0&&t.expanded!==null&&n.crossTarget<t.expanded&&e.midY!==null)return new M(e).to(t.value,t.crossTarget).to(t.expanded,t.crossTarget).to(t.expanded,e.midY).to(n.crossTarget,e.midY).tagMid(`y`).to(n.crossTarget,n.value).done();let r=Math.abs(t.value-e.common.grown.maxX)+Math.abs(t.crossTarget-e.common.grown.minY)+Math.abs(n.crossTarget-e.common.grown.maxX)+Math.abs(n.value-e.common.grown.minY),i=t.expanded!==null&&e.midY!==null&&n.expanded!==null?Math.abs(t.value-t.expanded)+Math.abs(e.b.grown.minX-t.expanded)+Math.abs(e.b.grown.minX-n.crossTarget)+Math.abs(t.crossTarget-e.b.grown.minY)+Math.abs(n.value-n.expanded):1/0,a=t.expanded!==null&&e.midX!==null&&n.expanded!==null?Math.abs(t.value-e.common.grown.maxX)+Math.abs(t.crossTarget-e.a.grown.maxY)+Math.abs(t.expanded-n.crossTarget)+Math.abs(e.a.grown.maxY-n.expanded)+Math.abs(n.expanded-n.value):1/0;return r<i&&r<a?new M(e).to(t.value,t.crossTarget).to(e.common.grown.maxX,t.crossTarget).to(e.common.grown.maxX,e.common.grown.minY).to(n.crossTarget,e.common.grown.minY).to(n.crossTarget,n.value).done():n.expanded!==null&&t.expanded!==null&&e.midY!==null&&i<a?new M(e).to(t.value,t.crossTarget).to(t.expanded,t.crossTarget).to(t.expanded,e.midY).to(e.b.grown.minX,e.midY).tagMid(`y`).to(e.b.grown.minX,n.expanded).to(n.crossTarget,n.expanded).to(n.crossTarget,n.value).done():n.expanded!==null&&t.expanded!==null&&e.midX!==null?new M(e).to(t.value,t.crossTarget).to(t.expanded,t.crossTarget).to(t.expanded,e.a.grown.maxY).to(e.midX,e.a.grown.maxY).to(e.midX,n.expanded).tagMid(`x`).to(n.crossTarget,n.expanded).to(n.crossTarget,n.value).done():null}function ot(e){return et(e,Ue),at(e)}function st(e){let t=e.a.edges.right,n=e.b.edges.right;if(!t||!n)return null;if((e.gapX<=0||t.crossTarget>e.b.grown.maxY||t.crossTarget<e.b.grown.minY)&&(n.value>e.a.box.minX||n.crossTarget>e.a.grown.maxY||n.crossTarget<e.a.grown.minY))return new M(e).to(t.value,t.crossTarget).to(e.common.grown.maxX,t.crossTarget).to(e.common.grown.maxX,n.crossTarget).to(n.value,n.crossTarget).done();if(e.midX===null)return null;if(n.expanded!==null&&e.gapX>=0){let r=Math.abs(n.crossTarget-e.b.grown.maxY)+Math.abs(t.crossTarget-e.b.grown.maxY)<Math.abs(n.crossTarget-e.b.grown.minY)+Math.abs(t.crossTarget-e.b.grown.minY)?e.b.grown.maxY:e.b.grown.minY;return new M(e).to(t.value,t.crossTarget).to(e.midX,t.crossTarget).to(e.midX,r).tagMid(`x`).to(n.expanded,r).to(n.expanded,n.crossTarget).to(n.value,n.crossTarget).done()}if(t.expanded!==null&&e.gapX<=0){let r=Math.abs(n.crossTarget-e.a.grown.maxY)+Math.abs(t.crossTarget-e.a.grown.maxY)<Math.abs(n.crossTarget-e.a.grown.minY)+Math.abs(t.crossTarget-e.a.grown.minY)?e.a.grown.maxY:e.a.grown.minY;return new M(e).to(t.value,t.crossTarget).to(t.expanded,t.crossTarget).to(t.expanded,r).to(e.midX,r).to(e.midX,n.crossTarget).tagMid(`x`).to(n.value,n.crossTarget).done()}return null}var ct={top:{top:[Ke,st],left:[Ke,at],bottom:[Ke,it],right:[Ke,ot]},right:{top:[He,at],right:[He,st],bottom:[He,ot],left:[He,it]},bottom:{top:[We,it],left:[We,ot],bottom:[We,st],right:[We,at]},left:{top:[Ge,ot],left:[Ge,st],bottom:[Ge,at],right:[Ge,it]}};function N(e,t,n){let[r,i]=ct[t][n];et(e,r);let a=i(e);return nt(e),a}function lt(e,t){let n=null,r=1/0,i=1/0,a=0;for(let[o,s]of t){a+=1;let t=N(e,o,s);t&&(t.points.length<r?(r=t.points.length,i=t.dist,n=t):t.points.length===r&&t.dist+a<i&&(i=t.dist,n=t))}return n}function ut(e,t){let n=e.a.edges[t];if(!n)return;let r=n.expanded??n.value,i=e=>t===`right`?r<=e:r>=e,a=e.b.edges.top;if(a&&i(a.crossTarget)&&n.crossTarget<=(a.expanded??a.value))return N(e,t,`top`);let o=e.b.edges.bottom;if(o&&i(o.crossTarget)&&n.crossTarget>=(o.expanded??o.value))return N(e,t,`bottom`)}function dt(e){let t=null;if(Math.abs(e.gapX)+1>Math.abs(e.gapY)&&e.midX!==null)t=e.gapX>0?N(e,`right`,`left`):N(e,`left`,`right`);else if(e.a.isPoint&&e.b.isPoint)t=e.gapY>0?N(e,`bottom`,`top`):N(e,`top`,`bottom`);else{let n=ut(e,`right`);n===void 0&&(n=ut(e,`left`)),n===void 0?e.gapY>0&&e.midY!==null?t=N(e,`bottom`,`top`):e.gapY<0&&e.midY!==null&&(t=N(e,`top`,`bottom`)):t=n}if(t)return t;let n=Ie.filter(t=>e.a.edges[t]),r=Ie.filter(t=>e.b.edges[t]);return lt(e,n.flatMap(e=>r.map(t=>[e,t])))}function ft(e,t){let n=null;return t===`right`?n=e.gapX>0&&e.gapX>Math.abs(e.gapY)&&e.midX!==null?N(e,`right`,`left`):ut(e,`right`)??null:t===`left`&&(n=e.gapX<0&&Math.abs(e.gapX)>Math.abs(e.gapY)&&e.midX!==null?N(e,`left`,`right`):ut(e,`left`)??null),n||lt(e,{top:[`bottom`,`right`,`left`,`top`],bottom:[`top`,`right`,`left`,`bottom`],left:[`right`,`bottom`,`left`,`top`],right:[`left`,`bottom`,`right`,`top`]}[t].map(e=>[t,e]))}var pt={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function mt(e,t,n){return N(e,t,n)||(e.a.isPoint&&e.b.isPoint?lt(e,[[pt[t],pt[n]],[t,pt[n]],[pt[t],n]]):e.a.isPoint?N(e,pt[t],n):e.b.isPoint?N(e,t,pt[n]):null)}function ht(e,t,n){if(n.isPoint||n.gap<=0||e.length<2)return;let r=t?e[0]:e[e.length-1],i=t?e[1]:e[e.length-2],a=c(Math.abs(r.x-i.x)+Math.abs(r.y-i.y)-n.minEnd,0,n.gap);if(a<=0)return;let o=Math.sign(i.x-r.x),s=Math.sign(i.y-r.y);r.x+=o*a,r.y+=s*a}function gt(e,t,n){if(!n.outline||!n.side||n.isPoint||e.length<2)return;let r=t?e[0]:e[e.length-1],i=t?e[1]:e[e.length-2];if(n.side===`left`||n.side===`right`){if(Math.abs(r.y-i.y)>j)return;r.x=n.outline(r.y)}else{if(Math.abs(r.x-i.x)>j)return;r.y=n.outline(r.x)}}function _t(e,t,n){if(e.length<3)return;let r=t?e[0]:e[e.length-1],i=t?e[1]:e[e.length-2];if(!(Math.abs(r.x-i.x)+Math.abs(r.y-i.y)>=n)&&(e.splice(t?1:e.length-2,1),e.length>=3)){let n=t?e[1]:e[e.length-2];Math.abs(r.x-i.x)<j?n.y=r.y:n.x=r.x}}function vt(e,t){let n=t.box.minX-e.box.maxX;n<0&&(n=-Math.max(0,e.box.minX-t.box.maxX));let r=t.box.minY-e.box.maxY;return r<0&&(r=-Math.max(0,e.box.minY-t.box.maxY)),{gapX:n,gapY:r}}var yt={x:{lo:`minX`,hi:`maxX`},y:{lo:`minY`,hi:`maxY`}};function bt(e,t,n,r,i,a,o,s,c){let{lo:l,hi:u}=yt[e];return t>n?{a:r.isPoint?r.box[u]+s:a[u],b:i.isPoint?i.box[l]-c:o[l]}:t<-n?{a:r.isPoint?r.box[l]-s:a[l],b:i.isPoint?i.box[u]+c:o[u]}:null}function xt(e,t,n,r){if(!e||e.points.length<2)return null;let i=e.points;return gt(i,!0,t),gt(i,!1,n),ht(i,!0,t),ht(i,!1,n),_t(i,!0,t.minEnd),_t(i,!1,n.minEnd),r&&i.reverse(),i}function St(e,t,n){let r={box:De(e.bounds),target:{x:e.target.x,y:e.target.y},gap:e.gap,minEnd:e.minEnd,side:e.side,outline:e.outline,isPoint:e.isPoint},i={box:De(t.bounds),target:{x:t.target.x,y:t.target.y},gap:t.gap,minEnd:t.minEnd,side:t.side,outline:t.outline,isPoint:t.isPoint},a=!r.side&&!!i.side,o=a?i:r,s=a?r:i,c=ze(o,s),l=ze(s,o);(!Be(c,o.side)||!Be(l,s.side))&&(Be(c,o.side)||(s=Ve(s)),Be(l,s.side)||(o=Ve(o)),je(s.box,o.target,A)&&(s=Ve(s)),je(o.box,s.target,A)&&(o=Ve(o)),c=ze(o,s),l=ze(s,o));let u=o.isPoint?o.box:Oe(o.box,A),d=s.isPoint?s.box:Oe(s.box,A),{gapX:f,gapY:p}=vt(o,s),m=o.minEnd*Ee,h=s.minEnd*Ee,g=(o.isPoint?m:we)+(s.isPoint?h:we),_=bt(`x`,f,g,o,s,u,d,m,h),v=bt(`y`,p,g,o,s,u,d,m,h),y=a?1-n:n,ee=_?Fe(_.a,_.b,y):null,b=v?Fe(v.a,v.b,y):null,x={a:{box:o.box,grown:u,edges:c,isPoint:o.isPoint},b:{box:s.box,grown:d,edges:l,isPoint:s.isPoint},common:{box:ke(o.box,s.box),grown:ke(u,d)},gapX:f,gapY:p,midX:ee,midY:b,bias:{x:1,y:1},applied:[]},S=null;return o.side&&s.side?S=mt(x,o.side,s.side):o.side&&(S=ft(x,o.side)),S||=dt(x),{route:xt(S,o,s,a),midHandle:S?.mid??null,midXRange:_?a?{lo:_.b,hi:_.a}:{lo:_.a,hi:_.b}:null,midYRange:v?a?{lo:v.b,hi:v.a}:{lo:v.a,hi:v.b}:null}}function Ct(e){let t=[];for(let n of e){let e=t[t.length-1],r=t[t.length-2];if(!e){t.push({x:n.x,y:n.y});continue}let i=Math.abs(n.x-e.x)<j,a=Math.abs(n.y-e.y)<j;if(!(i&&a)){if(r&&i&&Math.abs(n.x-r.x)<j){e.y=n.y;continue}if(r&&a&&Math.abs(n.y-r.y)<j){e.x=n.x;continue}t.push({x:n.x,y:n.y})}}return t}function wt(e,t,n,r){if(n.isPoint)return Math.sign(e-r)===t?r:null;let i=r+t*n.gap;return Math.sign(e-i)===t?i:Math.sign(e-r)===t&&Math.abs(e-r)>j?r+(e-r)/2:null}function Tt(e,t,n){let r=n?e[0]:e[e.length-1],i=n?e[1]:e[e.length-2],a=Math.abs(i.y-r.y)<=j;if(a===Math.abs(i.x-r.x)<=j||t.side&&(t.side===`left`||t.side===`right`)!==a)return!1;if(a){let e=Math.sign(i.x-r.x),n=wt(i.x,e,t,!t.isPoint&&t.outline?t.outline(t.target.y):t.isPoint?t.target.x:e>0?t.bounds.x+t.bounds.width:t.bounds.x);return n===null?!1:(r.x=n,r.y=t.target.y,i.y=t.target.y,!0)}let o=Math.sign(i.y-r.y),s=wt(i.y,o,t,!t.isPoint&&t.outline?t.outline(t.target.x):t.isPoint?t.target.y:o>0?t.bounds.y+t.bounds.height:t.bounds.y);return s===null?!1:(r.y=s,r.x=t.target.x,i.x=t.target.x,!0)}function Et(e,t,n){if(e.length<3)return null;let r=e.map(e=>({x:e.x,y:e.y}));if(!Tt(r,t,!0)||!Tt(r,n,!1))return null;let i=Ct(r);if(i.length<3)return null;for(let e=0;e<i.length-1;e+=1)if(Math.abs(i[e+1].x-i[e].x)>j&&Math.abs(i[e+1].y-i[e].y)>j)return null;return i}function Dt(e,t,n){if(e.length<2||t<0||t>e.length-2)return null;let r=e.map(e=>({x:e.x,y:e.y})),i=r[t],a=r[t+1],o=a.x-i.x,s=a.y-i.y,c=Math.abs(s)<=Math.abs(o),l=Math.abs(c?o:s);if(l<j)return null;let u=Math.min(A,l/2);if(t===e.length-2){let e=r[r.length-1],t=c?{x:e.x-Math.sign(o)*u,y:e.y}:{x:e.x,y:e.y-Math.sign(s)*u};r.splice(r.length-1,0,{...t},{...t})}let d=t;if(t===0){let e=r[0],t=c?{x:e.x+Math.sign(o)*u,y:e.y}:{x:e.x,y:e.y+Math.sign(s)*u};r.splice(1,0,{...t},{...t}),d=2}let f=r[d],p=r[d+1];c?(f.y=n,p.y=n):(f.x=n,p.x=n);let m=Ct(r);return m.length<2?null:m}function Ot(e,t){return{bounds:{x:e.x,y:e.y,width:0,height:0},target:{x:e.x,y:e.y},gap:0,minEnd:t*Te,side:null,isPoint:!0}}var kt=18,At=.58,jt=.15,Mt=.16,Nt=.5,Pt=.68;function Ft(e,t,n){let r={x:-Math.sin(t),y:Math.cos(t)},i=r=>{let i=t+At*r;return{x:e.x-n*Math.cos(i),y:e.y-n*Math.sin(i)}},a=t=>({x:t.x+(e.x-t.x)*Mt,y:t.y+(e.y-t.y)*Mt}),o=t=>{let i=Math.sign((t.x-e.x)*r.x+(t.y-e.y)*r.y);return{x:e.x+r.x*i*n*jt,y:e.y+r.y*i*n*jt}},s=i(-1),c=i(1),l=a(s),u=a(c),d=o(s),f=o(c);return`M ${s.x} ${s.y} C ${l.x} ${l.y} ${d.x} ${d.y} ${e.x} ${e.y} C ${f.x} ${f.y} ${u.x} ${u.y} ${c.x} ${c.y}`}function It(e,t,n){let r={x:-Math.sin(t),y:Math.cos(t)},i=i=>{let a=t+Nt*i,o={x:e.x-n*Math.cos(a),y:e.y-n*Math.sin(a)},s={x:(o.x+e.x)/2,y:(o.y+e.y)/2},c=((s.x-e.x)*r.x+(s.y-e.y)*r.y)*Pt,l={x:s.x-r.x*c,y:s.y-r.y*c};return`M ${o.x} ${o.y} Q ${l.x} ${l.y} ${e.x} ${e.y}`};return`${i(-1)} ${i(1)}`}function Lt(e){return{x:(e.x+e.x2)/2,y:(e.y+e.y2)/2}}function Rt(e,t){return p(e,f(e)*n(t)).point}function zt(e){let t=e.labelAlong;if(e.bendStyle===`elbow`)return Rt(P(e),t??.5);let r=F(e);if(r)return t===void 0?r.apex:r.pointAt(t);if(t===void 0)return Lt(e);let i=n(t);return{x:e.x+(e.x2-e.x)*i,y:e.y+(e.y2-e.y)*i}}function Bt(e,t){if(e.bendStyle===`elbow`)return m(P(e),t);let r=F(e);if(r)return nn(r,t);let i=e.x2-e.x,a=e.y2-e.y,o=i*i+a*a;return o<1e-9?.5:n(((t.x-e.x)*i+(t.y-e.y)*a)/o)}var Vt=22,Ht=10;function Ut(e,t){let n=Math.hypot(t.x,t.y)||1;return{x:e.x+t.y/n*Ht,y:e.y-t.x/n*Ht}}function Wt(e,t){if(e.bendStyle===`elbow`){let n=P(e),r=t===`start`?n:[...n].reverse(),i=p(r,Math.min(Vt,f(r)*.4));return Ut(i.point,i.dir)}let n={x:e.x,y:e.y},r={x:e.x2,y:e.y2},a=i(n,r)||1,o=F(e);if(!o){let e=Math.min(Vt,a*.4);return t===`start`?Ut(v(n,r,e),{x:r.x-n.x,y:r.y-n.y}):Ut(v(r,n,e),{x:n.x-r.x,y:n.y-r.y})}let s=Math.min(Vt/a,.4),c=t===`start`?o.pointAt(s):o.pointAt(1-s),l=t===`start`?o.pointAt(s+.02):o.pointAt(1-s-.02);return Ut(c,{x:l.x-c.x,y:l.y-c.y})}function Gt(e){let t=e.x2-e.x,n=e.y2-e.y,r=Math.hypot(t,n)||1,i={x:t/r,y:n/r};return{dir:i,normal:{x:-i.y,y:i.x}}}function Kt(e){return St(Ot({x:e.x,y:e.y},e.strokeWidth),Ot({x:e.x2,y:e.y2},e.strokeWidth),e.elbowMid??.5)}function P(e){if(e.elbowPoints&&e.elbowPoints.length>=2)return e.elbowPoints.map(e=>({x:e.x,y:e.y}));if(e.elbowRoute&&e.elbowRoute.length>=2)return e.elbowRoute.map(e=>({x:e.x,y:e.y}));let t=Kt(e);return t.route&&t.route.length>=2?t.route:[{x:e.x,y:e.y},{x:e.x2,y:e.y2}]}function qt(e){return e.elbowPoints?null:e.startBinding||e.endBinding?e.elbowMidHandle??null:Kt(e).midHandle}var Jt=.4;function Yt(e){return c(e||0,-.4,Jt)}function Xt(e){let t=Lt(e),{dir:n,normal:r}=Gt(e),a=i({x:e.x,y:e.y},{x:e.x2,y:e.y2}),o=Yt(e.bendAlong)*a;return{x:t.x+n.x*o+r.x*e.bend,y:t.y+n.y*o+r.y*e.bend}}var Zt=Math.PI*2,Qt=e=>(e%Zt+Zt)%Zt;function $t(e,t,n){let r=Math.atan2(e.y-t.y,e.x-t.x);return-Math.sin(r)*n.x+Math.cos(r)*n.y>0}function en(e,t,n,r){let a=i(n,e),o=Math.atan2(e.y-n.y,e.x-n.x),s=Math.atan2(t.y-n.y,t.x-n.x),c=r?Qt(s-o):-Qt(o-s);return{from:e,to:t,center:n,r:a,a0:o,delta:c,len:Math.abs(c)*a}}function tn(e,t,r,a){let o=i(e,t);if(o<1||Math.abs(r)<.5)return null;let s={x:(t.x-e.x)/o,y:(t.y-e.y)/o},c={x:-s.y,y:s.x},l={x:(e.x+t.x)/2,y:(e.y+t.y)/2},u=Yt(a)*o,d={x:l.x+s.x*u+c.x*r,y:l.y+s.y*u+c.y*r},f;if(Math.abs(u)<.5){let n=o/2,i=(r*r-n*n)/(2*r),a={x:l.x+c.x*i,y:l.y+c.y*i};f=[en(e,t,a,$t(d,a,s))]}else{let n=e=>{let t=e.x-d.x,n=e.y-d.y,r=c.x*t+c.y*n;if(Math.abs(r)<.25||Math.hypot(t,n)<1)return null;let i=(t*t+n*n)/(2*r);return{x:d.x+c.x*i,y:d.y+c.y*i}},r=n(e),i=n(t);if(!r||!i)return null;f=[en(e,d,r,$t(d,r,s)),en(d,t,i,$t(d,i,s))]}let p=f.reduce((e,t)=>e+t.len,0);if(p<1)return null;let m=f[f.length-1];return{apex:d,apexT:f.length===2?f[0].len/p:.5,length:p,segments:f,pointAt:e=>{let r=n(e)*p;for(let e of f){if(r<=e.len||e===m){let t=e.len?Math.min(1,r/e.len):0,n=e.a0+e.delta*t;return{x:e.center.x+e.r*Math.cos(n),y:e.center.y+e.r*Math.sin(n)}}r-=e.len}return{x:t.x,y:t.y}}}}function nn(e,t){let n=0,r=.5,a=1/0;for(let o of e.segments){let s=Math.abs(o.delta),c=Math.atan2(t.y-o.center.y,t.x-o.center.x),l=o.delta>=0?Qt(c-o.a0):Qt(o.a0-c),u;u=s<1e-9?0:l<=s?l/s:i(t,o.from)<=i(t,o.to)?0:1;let d=o.a0+o.delta*u,f=i(t,{x:o.center.x+o.r*Math.cos(d),y:o.center.y+o.r*Math.sin(d)});f<a&&(a=f,r=(n+u*o.len)/e.length),n+=o.len}return r}function F(e){return tn({x:e.x,y:e.y},{x:e.x2,y:e.y2},e.bend,e.bendAlong??0)}function rn(e,t,n){let r=i(e,t)||1,a={x:(t.x-e.x)/r,y:(t.y-e.y)/r},o={x:-a.y,y:a.x},s={x:(e.x+t.x)/2,y:(e.y+t.y)/2},c=n.x-s.x,l=n.y-s.y;return{bow:c*o.x+l*o.y,bowAlong:Yt((c*a.x+l*a.y)/r)}}function an(e,t,n){return Math.abs(e*t)<=n?0:e}function on(e,t){let n=t===`from`?e.a0:e.a0+e.delta,r=e.delta>=0?1:-1;return{x:-Math.sin(n)*r,y:Math.cos(n)*r}}function sn(e){return Xt(e)}function cn(e,t){let n=rn({x:e.x,y:e.y},{x:e.x2,y:e.y2},t);return{bend:n.bow,bendAlong:n.bowAlong}}function ln(e,t){if(e.length<2)return``;let n=`M ${e[0].x} ${e[0].y}`;for(let r=1;r<e.length-1;r+=1){let a=e[r-1],o=e[r],s=e[r+1],c=Math.min(t,i(a,o)/2,i(o,s)/2),l=v(o,a,c),u=v(o,s,c);n+=` L ${l.x} ${l.y} Q ${o.x} ${o.y} ${u.x} ${u.y}`}let r=e[e.length-1];return n+=` L ${r.x} ${r.y}`,n}function un(e){if(e.bendStyle===`elbow`){let t=P(e);if(t.length>=2)return ln(t,kt)}let t=e.bendStyle===`elbow`?null:F(e);if(!t)return`M ${e.x} ${e.y} L ${e.x2} ${e.y2}`;let n=`M ${t.segments[0].from.x} ${t.segments[0].from.y}`;for(let e of t.segments){let t=+(Math.abs(e.delta)>Math.PI),r=+(e.delta>0);n+=` A ${e.r} ${e.r} 0 ${t} ${r} ${e.to.x} ${e.to.y}`}return n}function dn(e,t,n,r){if(e.length>n){let a=r?1-n/e.length:n/e.length,o=e.pointAt(a);if(i(o,t)>1e-6)return Math.atan2(t.y-o.y,t.x-o.x)}if(r){let t=on(e.segments[e.segments.length-1],`to`);return Math.atan2(t.y,t.x)}let a=on(e.segments[0],`from`);return Math.atan2(-a.y,-a.x)}function fn(e,t){let n=t===`end`,r=n?{x:e.x2,y:e.y2}:{x:e.x,y:e.y},a=(n?e.endHead:e.startHead)??`arrow`,o=ye(e.strokeWidth),s=n?Math.atan2(e.y2-e.y,e.x2-e.x):Math.atan2(e.y-e.y2,e.x-e.x2);if(e.bendStyle===`elbow`){let t=P(e);return{tip:r,angle:y(t,n)??s,length:Ce(o,a,f(t),g(t,n))}}let c=F(e);if(!c)return{tip:r,angle:s,length:Ce(o,a,i({x:e.x,y:e.y},{x:e.x2,y:e.y2}))};let l=Ce(o,a,c.length);return{tip:r,angle:dn(c,r,l,n),length:l}}var pn=[0,Math.PI/2,Math.PI,-Math.PI/2];function mn(e){let t=[e.from,e.to];for(let n of pn)(e.delta>=0?Qt(n-e.a0):Qt(e.a0-n))>Math.abs(e.delta)||t.push({x:e.center.x+e.r*Math.cos(n),y:e.center.y+e.r*Math.sin(n)});return t}function hn(e){if(e.bendStyle===`elbow`)return P(e);let t=F(e);return t?t.segments.flatMap(mn):[{x:e.x,y:e.y},{x:e.x2,y:e.y2},Xt(e)]}function gn(e){let t=hn(e),n=t.map(e=>e.x),r=t.map(e=>e.y),i=Math.min(...n),a=Math.min(...r);return{x:i,y:a,width:Math.max(...n)-i,height:Math.max(...r)-a}}function _n(e){return y(e,!0)??0}function vn(e){return y(e,!1)??0}function yn(e,t){return e.length===0?{x:0,y:0}:p(e,f(e)*n(t??.5)).point}function bn(e){return e.length===0?``:e.reduce((e,t,n)=>e+`${n===0?`M`:`L`} ${t.x} ${t.y} `,``)}function xn(e){let t=[];for(let n of e){let e=t[t.length-1];(!e||Math.abs(e.x-n.x)>.01||Math.abs(e.y-n.y)>.01)&&t.push(n)}return t}var Sn=[`arrow`,`sweep`,`triangle`,`triangleOutline`],Cn=[`circle`,`circleOutline`,`diamond`,`diamondOutline`,`bar`,`cross`],wn=[`crowOne`,`crowMany`,`crowOneOrMany`,`crowOnlyOne`,`crowZeroOrOne`,`crowZeroOrMany`];function Tn(e){let t={x:Math.cos(e),y:Math.sin(e)};return{dir:t,normal:{x:-t.y,y:t.x}}}function En(e){let[t,...n]=e;return`M ${t.x} ${t.y} `+n.map(e=>`L ${e.x} ${e.y} `).join(``)+`Z`}function Dn(e,t){return`M ${e.x-t} ${e.y} a ${t} ${t} 0 1 0 ${t*2} 0 a ${t} ${t} 0 1 0 ${-t*2} 0 Z`}function On(e,t,n,r){let{dir:i,normal:a}=Tn(n),o=r,s=e=>({x:t.x-i.x*e,y:t.y-i.y*e}),c=(e,t)=>{let n=s(e),r={x:n.x+a.x*t,y:n.y+a.y*t},i={x:n.x-a.x*t,y:n.y-a.y*t};return`M ${r.x} ${r.y} L ${i.x} ${i.y}`},l=(e,n)=>{let r=s(e),i={x:t.x+a.x*n,y:t.y+a.y*n},o={x:t.x-a.x*n,y:t.y-a.y*n};return`M ${i.x} ${i.y} L ${r.x} ${r.y} L ${o.x} ${o.y}`},u=(e,t=`none`)=>({d:e,fill:t}),d=s(o);switch(e){case`arrow`:return[u(Ft(t,n,o))];case`sweep`:return[u(It(t,n,o))];case`triangle`:case`triangleOutline`:{let n=o*.42;return[u(En([t,{x:d.x+a.x*n,y:d.y+a.y*n},{x:d.x-a.x*n,y:d.y-a.y*n}]),e===`triangle`?`solid`:`white`)]}case`diamond`:case`diamondOutline`:{let n=o*.34,r=s(o/2);return[u(En([t,{x:r.x+a.x*n,y:r.y+a.y*n},d,{x:r.x-a.x*n,y:r.y-a.y*n}]),e===`diamond`?`solid`:`white`)]}case`circle`:case`circleOutline`:{let t=o*.4;return[u(Dn(s(t),t),e===`circle`?`solid`:`white`)]}case`bar`:return[u(c(0,o*.5))];case`cross`:{let e=o*.4,t=t=>{let n=i.x*t+a.x,r=i.y*t+a.y,o=Math.hypot(n,r)||1,c=n/o*e,l=r/o*e,u=s(e);return`M ${u.x-c} ${u.y-l} L ${u.x+c} ${u.y+l}`};return[u(t(1)),u(t(-1))]}case`crowOne`:return[u(c(o*.55,o*.45))];case`crowOnlyOne`:return[u(c(o*.45,o*.45)),u(c(o*.9,o*.45))];case`crowMany`:return[u(l(o,o*.5))];case`crowOneOrMany`:return[u(l(o,o*.5)),u(c(o*1.3,o*.45))];case`crowZeroOrOne`:{let e=o*.3;return[u(c(o*.4,o*.45)),u(Dn(s(o),e),`white`)]}case`crowZeroOrMany`:{let e=o*.3;return[u(l(o*.85,o*.5)),u(Dn(s(o*1.4),e),`white`)]}}}function kn(e){let t=[];if(e.endArrow){let n=fn(e,`end`);t.push(...On(e.endHead??`arrow`,n.tip,n.angle,n.length))}if(e.startArrow){let n=fn(e,`start`);t.push(...On(e.startHead??`arrow`,n.tip,n.angle,n.length))}return t}function An(e){let t=e.points;if(t.length<2)return[];let n=ye(e.strokeWidth),r=f(t),i=[];if(e.endArrow){let a=e.endHead??`arrow`;i.push(...On(a,t[t.length-1],_n(t),Ce(n,a,r,g(t,!0))))}if(e.startArrow){let a=e.startHead??`arrow`;i.push(...On(a,t[0],vn(t),Ce(n,a,r,g(t,!1))))}return i}function jn(e,t){return e===`solid`?t:e===`white`?`#ffffff`:`none`}function Mn(e,t,n){if(e&&e.length){let[r,i]=t,a=Math.PI/180*n,o=Math.cos(a),s=Math.sin(a);for(let t of e){let[e,n]=t;t[0]=(e-r)*o-(n-i)*s+r,t[1]=(e-r)*s+(n-i)*o+i}}}function Nn(e,t){return e[0]===t[0]&&e[1]===t[1]}function Pn(e,t,n,r=1){let i=n,a=Math.max(t,.1),o=e[0]&&e[0][0]&&typeof e[0][0]==`number`?[e]:e,s=[0,0];if(i)for(let e of o)Mn(e,s,i);let c=function(e,t,n){let r=[];for(let t of e){let e=[...t];Nn(e[0],e[e.length-1])||e.push([e[0][0],e[0][1]]),e.length>2&&r.push(e)}let i=[];t=Math.max(t,.1);let a=[];for(let e of r)for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(n[1]!==r[1]){let e=Math.min(n[1],r[1]);a.push({ymin:e,ymax:Math.max(n[1],r[1]),x:e===n[1]?n[0]:r[0],islope:(r[0]-n[0])/(r[1]-n[1])})}}if(a.sort(((e,t)=>e.ymin<t.ymin?-1:e.ymin>t.ymin?1:e.x<t.x?-1:e.x>t.x?1:e.ymax===t.ymax?0:(e.ymax-t.ymax)/Math.abs(e.ymax-t.ymax))),!a.length)return i;let o=[],s=a[0].ymin,c=0;for(;o.length||a.length;){if(a.length){let e=-1;for(let t=0;t<a.length&&!(a[t].ymin>s);t++)e=t;a.splice(0,e+1).forEach((e=>{o.push({s,edge:e})}))}if(o=o.filter((e=>!(e.edge.ymax<=s))),o.sort(((e,t)=>e.edge.x===t.edge.x?0:(e.edge.x-t.edge.x)/Math.abs(e.edge.x-t.edge.x))),(n!==1||c%t==0)&&o.length>1)for(let e=0;e<o.length;e+=2){let t=e+1;if(t>=o.length)break;let n=o[e].edge,r=o[t].edge;i.push([[Math.round(n.x),s],[Math.round(r.x),s]])}s+=n,o.forEach((e=>{e.edge.x=e.edge.x+n*e.edge.islope})),c++}return i}(o,a,r);if(i){for(let e of o)Mn(e,s,-i);(function(e,t,n){let r=[];e.forEach((e=>r.push(...e))),Mn(r,t,n)})(c,s,-i)}return c}function Fn(e,t){let n=t.hachureAngle+90,r=t.hachureGap;r<0&&(r=4*t.strokeWidth),r=Math.round(Math.max(r,.1));let i=1;return t.roughness>=1&&(t.randomizer?.next()||Math.random())>.7&&(i=r),Pn(e,r,n,i||1)}var In=class{constructor(e){this.helper=e}fillPolygons(e,t){return this._fillPolygons(e,t)}_fillPolygons(e,t){let n=Fn(e,t);return{type:`fillSketch`,ops:this.renderLines(n,t)}}renderLines(e,t){let n=[];for(let r of e)n.push(...this.helper.doubleLineOps(r[0][0],r[0][1],r[1][0],r[1][1],t));return n}};function Ln(e){let t=e[0],n=e[1];return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}var Rn=class extends In{fillPolygons(e,t){let n=t.hachureGap;n<0&&(n=4*t.strokeWidth),n=Math.max(n,.1);let r=Fn(e,Object.assign({},t,{hachureGap:n})),i=Math.PI/180*t.hachureAngle,a=[],o=.5*n*Math.cos(i),s=.5*n*Math.sin(i);for(let[e,t]of r)Ln([e,t])&&a.push([[e[0]-o,e[1]+s],[...t]],[[e[0]+o,e[1]-s],[...t]]);return{type:`fillSketch`,ops:this.renderLines(a,t)}}},zn=class extends In{fillPolygons(e,t){let n=this._fillPolygons(e,t),r=Object.assign({},t,{hachureAngle:t.hachureAngle+90}),i=this._fillPolygons(e,r);return n.ops=n.ops.concat(i.ops),n}},Bn=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=Fn(e,t=Object.assign({},t,{hachureAngle:0}));return this.dotsOnLines(n,t)}dotsOnLines(e,t){let n=[],r=t.hachureGap;r<0&&(r=4*t.strokeWidth),r=Math.max(r,.1);let i=t.fillWeight;i<0&&(i=t.strokeWidth/2);let a=r/4;for(let o of e){let e=Ln(o),s=e/r,c=Math.ceil(s)-1,l=e-c*r,u=(o[0][0]+o[1][0])/2-r/4,d=Math.min(o[0][1],o[1][1]);for(let e=0;e<c;e++){let o=d+l+e*r,s=u-a+2*Math.random()*a,c=o-a+2*Math.random()*a,f=this.helper.ellipse(s,c,i,i,t);n.push(...f.ops)}}return{type:`fillSketch`,ops:n}}},Vn=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=Fn(e,t);return{type:`fillSketch`,ops:this.dashedLine(n,t)}}dashedLine(e,t){let n=t.dashOffset<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashOffset,r=t.dashGap<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashGap,i=[];return e.forEach((e=>{let a=Ln(e),o=Math.floor(a/(n+r)),s=(a+r-o*(n+r))/2,c=e[0],l=e[1];c[0]>l[0]&&(c=e[1],l=e[0]);let u=Math.atan((l[1]-c[1])/(l[0]-c[0]));for(let e=0;e<o;e++){let a=e*(n+r),o=a+n,l=[c[0]+a*Math.cos(u)+s*Math.cos(u),c[1]+a*Math.sin(u)+s*Math.sin(u)],d=[c[0]+o*Math.cos(u)+s*Math.cos(u),c[1]+o*Math.sin(u)+s*Math.sin(u)];i.push(...this.helper.doubleLineOps(l[0],l[1],d[0],d[1],t))}})),i}},Hn=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=t.hachureGap<0?4*t.strokeWidth:t.hachureGap,r=t.zigzagOffset<0?n:t.zigzagOffset,i=Fn(e,t=Object.assign({},t,{hachureGap:n+r}));return{type:`fillSketch`,ops:this.zigzagLines(i,r,t)}}zigzagLines(e,t,n){let r=[];return e.forEach((e=>{let i=Ln(e),a=Math.round(i/(2*t)),o=e[0],s=e[1];o[0]>s[0]&&(o=e[1],s=e[0]);let c=Math.atan((s[1]-o[1])/(s[0]-o[0]));for(let e=0;e<a;e++){let i=2*e*t,a=2*(e+1)*t,s=Math.sqrt(2*t**2),l=[o[0]+i*Math.cos(c),o[1]+i*Math.sin(c)],u=[o[0]+a*Math.cos(c),o[1]+a*Math.sin(c)],d=[l[0]+s*Math.cos(c+Math.PI/4),l[1]+s*Math.sin(c+Math.PI/4)];r.push(...this.helper.doubleLineOps(l[0],l[1],d[0],d[1],n),...this.helper.doubleLineOps(d[0],d[1],u[0],u[1],n))}})),r}},I={},Un=class{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}},Wn=0,Gn=1,Kn=2,qn={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Jn(e,t){return e.type===t}function Yn(e){let t=[],n=function(e){let t=[];for(;e!==``;)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:Wn,text:RegExp.$1},e=e.substr(RegExp.$1.length);else{if(!e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];t[t.length]={type:Gn,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length)}return t[t.length]={type:Kn,text:``},t}(e),r=`BOD`,i=0,a=n[i];for(;!Jn(a,Kn);){let o=0,s=[];if(r===`BOD`){if(a.text!==`M`&&a.text!==`m`)return Yn(`M0,0`+e);i++,o=qn[a.text],r=a.text}else Jn(a,Gn)?o=qn[r]:(i++,o=qn[a.text],r=a.text);if(!(i+o<n.length))throw Error(`Path data ended short`);for(let e=i;e<i+o;e++){let t=n[e];if(!Jn(t,Gn))throw Error(`Param not a number: `+r+`,`+t.text);s[s.length]=+t.text}if(typeof qn[r]!=`number`)throw Error(`Bad segment: `+r);{let e={key:r,data:s};t.push(e),i+=o,a=n[i],r===`M`&&(r=`L`),r===`m`&&(r=`l`)}}return t}function Xn(e){let t=0,n=0,r=0,i=0,a=[];for(let{key:o,data:s}of e)switch(o){case`M`:a.push({key:`M`,data:[...s]}),[t,n]=s,[r,i]=s;break;case`m`:t+=s[0],n+=s[1],a.push({key:`M`,data:[t,n]}),r=t,i=n;break;case`L`:a.push({key:`L`,data:[...s]}),[t,n]=s;break;case`l`:t+=s[0],n+=s[1],a.push({key:`L`,data:[t,n]});break;case`C`:a.push({key:`C`,data:[...s]}),t=s[4],n=s[5];break;case`c`:{let e=s.map(((e,r)=>r%2?e+n:e+t));a.push({key:`C`,data:e}),t=e[4],n=e[5];break}case`Q`:a.push({key:`Q`,data:[...s]}),t=s[2],n=s[3];break;case`q`:{let e=s.map(((e,r)=>r%2?e+n:e+t));a.push({key:`Q`,data:e}),t=e[2],n=e[3];break}case`A`:a.push({key:`A`,data:[...s]}),t=s[5],n=s[6];break;case`a`:t+=s[5],n+=s[6],a.push({key:`A`,data:[s[0],s[1],s[2],s[3],s[4],t,n]});break;case`H`:a.push({key:`H`,data:[...s]}),t=s[0];break;case`h`:t+=s[0],a.push({key:`H`,data:[t]});break;case`V`:a.push({key:`V`,data:[...s]}),n=s[0];break;case`v`:n+=s[0],a.push({key:`V`,data:[n]});break;case`S`:a.push({key:`S`,data:[...s]}),t=s[2],n=s[3];break;case`s`:{let e=s.map(((e,r)=>r%2?e+n:e+t));a.push({key:`S`,data:e}),t=e[2],n=e[3];break}case`T`:a.push({key:`T`,data:[...s]}),t=s[0],n=s[1];break;case`t`:t+=s[0],n+=s[1],a.push({key:`T`,data:[t,n]});break;case`Z`:case`z`:a.push({key:`Z`,data:[]}),t=r,n=i}return a}function Zn(e){let t=[],n=``,r=0,i=0,a=0,o=0,s=0,c=0;for(let{key:l,data:u}of e){switch(l){case`M`:t.push({key:`M`,data:[...u]}),[r,i]=u,[a,o]=u;break;case`C`:t.push({key:`C`,data:[...u]}),r=u[4],i=u[5],s=u[2],c=u[3];break;case`L`:t.push({key:`L`,data:[...u]}),[r,i]=u;break;case`H`:r=u[0],t.push({key:`L`,data:[r,i]});break;case`V`:i=u[0],t.push({key:`L`,data:[r,i]});break;case`S`:{let e=0,a=0;n===`C`||n===`S`?(e=r+(r-s),a=i+(i-c)):(e=r,a=i),t.push({key:`C`,data:[e,a,...u]}),s=u[0],c=u[1],r=u[2],i=u[3];break}case`T`:{let[e,a]=u,o=0,l=0;n===`Q`||n===`T`?(o=r+(r-s),l=i+(i-c)):(o=r,l=i);let d=r+2*(o-r)/3,f=i+2*(l-i)/3,p=e+2*(o-e)/3,m=a+2*(l-a)/3;t.push({key:`C`,data:[d,f,p,m,e,a]}),s=o,c=l,r=e,i=a;break}case`Q`:{let[e,n,a,o]=u,l=r+2*(e-r)/3,d=i+2*(n-i)/3,f=a+2*(e-a)/3,p=o+2*(n-o)/3;t.push({key:`C`,data:[l,d,f,p,a,o]}),s=e,c=n,r=a,i=o;break}case`A`:{let e=Math.abs(u[0]),n=Math.abs(u[1]),a=u[2],o=u[3],s=u[4],c=u[5],l=u[6];e===0||n===0?(t.push({key:`C`,data:[r,i,c,l,c,l]}),r=c,i=l):(r!==c||i!==l)&&($n(r,i,c,l,e,n,a,o,s).forEach((function(e){t.push({key:`C`,data:e})})),r=c,i=l);break}case`Z`:t.push({key:`Z`,data:[]}),r=a,i=o}n=l}return t}function Qn(e,t,n){return[e*Math.cos(n)-t*Math.sin(n),e*Math.sin(n)+t*Math.cos(n)]}function $n(e,t,n,r,i,a,o,s,c,l){let u=(d=o,Math.PI*d/180);var d;let f=[],p=0,m=0,h=0,g=0;if(l)[p,m,h,g]=l;else{[e,t]=Qn(e,t,-u),[n,r]=Qn(n,r,-u);let o=(e-n)/2,l=(t-r)/2,d=o*o/(i*i)+l*l/(a*a);d>1&&(d=Math.sqrt(d),i*=d,a*=d);let f=i*i,_=a*a,v=f*_-f*l*l-_*o*o,y=f*l*l+_*o*o,ee=(s===c?-1:1)*Math.sqrt(Math.abs(v/y));h=ee*i*l/a+(e+n)/2,g=ee*-a*o/i+(t+r)/2,p=Math.asin(parseFloat(((t-g)/a).toFixed(9))),m=Math.asin(parseFloat(((r-g)/a).toFixed(9))),e<h&&(p=Math.PI-p),n<h&&(m=Math.PI-m),p<0&&(p=2*Math.PI+p),m<0&&(m=2*Math.PI+m),c&&p>m&&(p-=2*Math.PI),!c&&m>p&&(m-=2*Math.PI)}let _=m-p;if(Math.abs(_)>120*Math.PI/180){let e=m,t=n,s=r;m=c&&m>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,f=$n(n=h+i*Math.cos(m),r=g+a*Math.sin(m),t,s,i,a,o,0,c,[m,e,h,g])}_=m-p;let v=Math.cos(p),y=Math.sin(p),ee=Math.cos(m),b=Math.sin(m),x=Math.tan(_/4),S=4/3*i*x,C=4/3*a*x,w=[e,t],T=[e+S*y,t-C*v],E=[n+S*b,r-C*ee],D=[n,r];if(T[0]=2*w[0]-T[0],T[1]=2*w[1]-T[1],l)return[T,E,D].concat(f);{f=[T,E,D].concat(f);let e=[];for(let t=0;t<f.length;t+=3){let n=Qn(f[t][0],f[t][1],u),r=Qn(f[t+1][0],f[t+1][1],u),i=Qn(f[t+2][0],f[t+2][1],u);e.push([n[0],n[1],r[0],r[1],i[0],i[1]])}return e}}var er={randOffset:function(e,t){return L(e,t)},randOffsetWithRange:function(e,t,n){return pr(e,t,n)},ellipse:function(e,t,n,r,i){return or(e,t,i,ar(n,r,i)).opset},doubleLineOps:function(e,t,n,r,i){return R(e,t,n,r,i,!0)}};function tr(e,t,n,r,i){return{type:`path`,ops:R(e,t,n,r,i)}}function nr(e,t,n){let r=(e||[]).length;if(r>2){let i=[];for(let t=0;t<r-1;t++)i.push(...R(e[t][0],e[t][1],e[t+1][0],e[t+1][1],n));return t&&i.push(...R(e[r-1][0],e[r-1][1],e[0][0],e[0][1],n)),{type:`path`,ops:i}}return r===2?tr(e[0][0],e[0][1],e[1][0],e[1][1],n):{type:`path`,ops:[]}}function rr(e,t,n,r,i){return function(e,t){return nr(e,!0,t)}([[e,t],[e+n,t],[e+n,t+r],[e,t+r]],i)}function ir(e,t){if(e.length){let n=typeof e[0][0]==`number`?[e]:e,r=hr(n[0],1*(1+.2*t.roughness),t),i=t.disableMultiStroke?[]:hr(n[0],1.5*(1+.22*t.roughness),dr(t));for(let e=1;e<n.length;e++){let a=n[e];if(a.length){let e=hr(a,1*(1+.2*t.roughness),t),n=t.disableMultiStroke?[]:hr(a,1.5*(1+.22*t.roughness),dr(t));for(let t of e)t.op!==`move`&&r.push(t);for(let e of n)e.op!==`move`&&i.push(e)}}return{type:`path`,ops:r.concat(i)}}return{type:`path`,ops:[]}}function ar(e,t,n){let r=Math.sqrt(2*Math.PI*Math.sqrt(((e/2)**2+(t/2)**2)/2)),i=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*r)),a=2*Math.PI/i,o=Math.abs(e/2),s=Math.abs(t/2),c=1-n.curveFitting;return o+=L(o*c,n),s+=L(s*c,n),{increment:a,rx:o,ry:s}}function or(e,t,n,r){let[i,a]=_r(r.increment,e,t,r.rx,r.ry,1,r.increment*pr(.1,pr(.4,1,n),n),n),o=gr(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){let[i]=_r(r.increment,e,t,r.rx,r.ry,1.5,0,n),a=gr(i,null,n);o=o.concat(a)}return{estimatedPoints:a,opset:{type:`path`,ops:o}}}function sr(e,t,n,r,i,a,o,s,c){let l=e,u=t,d=Math.abs(n/2),f=Math.abs(r/2);d+=L(.01*d,c),f+=L(.01*f,c);let p=i,m=a;for(;p<0;)p+=2*Math.PI,m+=2*Math.PI;m-p>2*Math.PI&&(p=0,m=2*Math.PI);let h=2*Math.PI/c.curveStepCount,g=Math.min(h/2,(m-p)/2),_=vr(g,l,u,d,f,p,m,1,c);if(!c.disableMultiStroke){let e=vr(g,l,u,d,f,p,m,1.5,c);_.push(...e)}return o&&(s?_.push(...R(l,u,l+d*Math.cos(p),u+f*Math.sin(p),c),...R(l,u,l+d*Math.cos(m),u+f*Math.sin(m),c)):_.push({op:`lineTo`,data:[l,u]},{op:`lineTo`,data:[l+d*Math.cos(p),u+f*Math.sin(p)]})),{type:`path`,ops:_}}function cr(e,t){let n=Zn(Xn(Yn(e))),r=[],i=[0,0],a=[0,0];for(let{key:e,data:o}of n)switch(e){case`M`:a=[o[0],o[1]],i=[o[0],o[1]];break;case`L`:r.push(...R(a[0],a[1],o[0],o[1],t)),a=[o[0],o[1]];break;case`C`:{let[e,n,i,s,c,l]=o;r.push(...yr(e,n,i,s,c,l,a,t)),a=[c,l];break}case`Z`:r.push(...R(a[0],a[1],i[0],i[1],t)),a=[i[0],i[1]]}return{type:`path`,ops:r}}function lr(e,t){let n=[];for(let r of e)if(r.length){let e=t.maxRandomnessOffset||0,i=r.length;if(i>2){n.push({op:`move`,data:[r[0][0]+L(e,t),r[0][1]+L(e,t)]});for(let a=1;a<i;a++)n.push({op:`lineTo`,data:[r[a][0]+L(e,t),r[a][1]+L(e,t)]})}}return{type:`fillPath`,ops:n}}function ur(e,t){return function(e,t){let n=e.fillStyle||`hachure`;if(!I[n])switch(n){case`zigzag`:I[n]||(I[n]=new Rn(t));break;case`cross-hatch`:I[n]||(I[n]=new zn(t));break;case`dots`:I[n]||(I[n]=new Bn(t));break;case`dashed`:I[n]||(I[n]=new Vn(t));break;case`zigzag-line`:I[n]||(I[n]=new Hn(t));break;default:n=`hachure`,I[n]||(I[n]=new In(t))}return I[n]}(t,er).fillPolygons(e,t)}function dr(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function fr(e){return e.randomizer||=new Un(e.seed||0),e.randomizer.next()}function pr(e,t,n,r=1){return n.roughness*r*(fr(n)*(t-e)+e)}function L(e,t,n=1){return pr(-e,e,t,n)}function R(e,t,n,r,i,a=!1){let o=a?i.disableMultiStrokeFill:i.disableMultiStroke,s=mr(e,t,n,r,i,!0,!1);if(o)return s;let c=mr(e,t,n,r,i,!0,!0);return s.concat(c)}function mr(e,t,n,r,i,a,o){let s=(e-n)**2+(t-r)**2,c=Math.sqrt(s),l=1;l=c<200?1:c>500?.4:-.0016668*c+1.233334;let u=i.maxRandomnessOffset||0;u*u*100>s&&(u=c/10);let d=u/2,f=.2+.2*fr(i),p=i.bowing*i.maxRandomnessOffset*(r-t)/200,m=i.bowing*i.maxRandomnessOffset*(e-n)/200;p=L(p,i,l),m=L(m,i,l);let h=[],g=()=>L(d,i,l),_=()=>L(u,i,l),v=i.preserveVertices;return a&&(o?h.push({op:`move`,data:[e+(v?0:g()),t+(v?0:g())]}):h.push({op:`move`,data:[e+(v?0:L(u,i,l)),t+(v?0:L(u,i,l))]})),o?h.push({op:`bcurveTo`,data:[p+e+(n-e)*f+g(),m+t+(r-t)*f+g(),p+e+2*(n-e)*f+g(),m+t+2*(r-t)*f+g(),n+(v?0:g()),r+(v?0:g())]}):h.push({op:`bcurveTo`,data:[p+e+(n-e)*f+_(),m+t+(r-t)*f+_(),p+e+2*(n-e)*f+_(),m+t+2*(r-t)*f+_(),n+(v?0:_()),r+(v?0:_())]}),h}function hr(e,t,n){if(!e.length)return[];let r=[];r.push([e[0][0]+L(t,n),e[0][1]+L(t,n)]),r.push([e[0][0]+L(t,n),e[0][1]+L(t,n)]);for(let i=1;i<e.length;i++)r.push([e[i][0]+L(t,n),e[i][1]+L(t,n)]),i===e.length-1&&r.push([e[i][0]+L(t,n),e[i][1]+L(t,n)]);return gr(r,null,n)}function gr(e,t,n){let r=e.length,i=[];if(r>3){let a=[],o=1-n.curveTightness;i.push({op:`move`,data:[e[1][0],e[1][1]]});for(let t=1;t+2<r;t++){let n=e[t];a[0]=[n[0],n[1]],a[1]=[n[0]+(o*e[t+1][0]-o*e[t-1][0])/6,n[1]+(o*e[t+1][1]-o*e[t-1][1])/6],a[2]=[e[t+1][0]+(o*e[t][0]-o*e[t+2][0])/6,e[t+1][1]+(o*e[t][1]-o*e[t+2][1])/6],a[3]=[e[t+1][0],e[t+1][1]],i.push({op:`bcurveTo`,data:[a[1][0],a[1][1],a[2][0],a[2][1],a[3][0],a[3][1]]})}if(t&&t.length===2){let e=n.maxRandomnessOffset;i.push({op:`lineTo`,data:[t[0]+L(e,n),t[1]+L(e,n)]})}}else r===3?(i.push({op:`move`,data:[e[1][0],e[1][1]]}),i.push({op:`bcurveTo`,data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):r===2&&i.push(...mr(e[0][0],e[0][1],e[1][0],e[1][1],n,!0,!0));return i}function _r(e,t,n,r,i,a,o,s){let c=[],l=[];if(s.roughness===0){e/=4,l.push([t+r*Math.cos(-e),n+i*Math.sin(-e)]);for(let a=0;a<=2*Math.PI;a+=e){let e=[t+r*Math.cos(a),n+i*Math.sin(a)];c.push(e),l.push(e)}l.push([t+r*Math.cos(0),n+i*Math.sin(0)]),l.push([t+r*Math.cos(e),n+i*Math.sin(e)])}else{let u=L(.5,s)-Math.PI/2;l.push([L(a,s)+t+.9*r*Math.cos(u-e),L(a,s)+n+.9*i*Math.sin(u-e)]);let d=2*Math.PI+u-.01;for(let o=u;o<d;o+=e){let e=[L(a,s)+t+r*Math.cos(o),L(a,s)+n+i*Math.sin(o)];c.push(e),l.push(e)}l.push([L(a,s)+t+r*Math.cos(u+2*Math.PI+.5*o),L(a,s)+n+i*Math.sin(u+2*Math.PI+.5*o)]),l.push([L(a,s)+t+.98*r*Math.cos(u+o),L(a,s)+n+.98*i*Math.sin(u+o)]),l.push([L(a,s)+t+.9*r*Math.cos(u+.5*o),L(a,s)+n+.9*i*Math.sin(u+.5*o)])}return[l,c]}function vr(e,t,n,r,i,a,o,s,c){let l=a+L(.1,c),u=[];u.push([L(s,c)+t+.9*r*Math.cos(l-e),L(s,c)+n+.9*i*Math.sin(l-e)]);for(let a=l;a<=o;a+=e)u.push([L(s,c)+t+r*Math.cos(a),L(s,c)+n+i*Math.sin(a)]);return u.push([t+r*Math.cos(o),n+i*Math.sin(o)]),u.push([t+r*Math.cos(o),n+i*Math.sin(o)]),gr(u,null,c)}function yr(e,t,n,r,i,a,o,s){let c=[],l=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],u=[0,0],d=s.disableMultiStroke?1:2,f=s.preserveVertices;for(let p=0;p<d;p++)p===0?c.push({op:`move`,data:[o[0],o[1]]}):c.push({op:`move`,data:[o[0]+(f?0:L(l[0],s)),o[1]+(f?0:L(l[0],s))]}),u=f?[i,a]:[i+L(l[p],s),a+L(l[p],s)],c.push({op:`bcurveTo`,data:[e+L(l[p],s),t+L(l[p],s),n+L(l[p],s),r+L(l[p],s),u[0],u[1]]});return c}function br(e){return[...e]}function xr(e,t=0){let n=e.length;if(n<3)throw Error(`A curve must have at least three points.`);let r=[];if(n===3)r.push(br(e[0]),br(e[1]),br(e[2]),br(e[2]));else{let n=[];n.push(e[0],e[0]);for(let t=1;t<e.length;t++)n.push(e[t]),t===e.length-1&&n.push(e[t]);let i=[],a=1-t;r.push(br(n[0]));for(let e=1;e+2<n.length;e++){let t=n[e];i[0]=[t[0],t[1]],i[1]=[t[0]+(a*n[e+1][0]-a*n[e-1][0])/6,t[1]+(a*n[e+1][1]-a*n[e-1][1])/6],i[2]=[n[e+1][0]+(a*n[e][0]-a*n[e+2][0])/6,n[e+1][1]+(a*n[e][1]-a*n[e+2][1])/6],i[3]=[n[e+1][0],n[e+1][1]],r.push(i[1],i[2],i[3])}}return r}function Sr(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2}function Cr(e,t,n){let r=Sr(t,n);if(r===0)return Sr(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),Sr(e,z(t,n,i))}function z(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function wr(e,t,n,r){let i=r||[];if(function(e,t){let n=e[t+0],r=e[t+1],i=e[t+2],a=e[t+3],o=3*r[0]-2*n[0]-a[0];o*=o;let s=3*r[1]-2*n[1]-a[1];s*=s;let c=3*i[0]-2*a[0]-n[0];c*=c;let l=3*i[1]-2*a[1]-n[1];return l*=l,o<c&&(o=c),s<l&&(s=l),o+s}(e,t)<n){let n=e[t+0];i.length?(a=i[i.length-1],o=n,Math.sqrt(Sr(a,o)))>1&&i.push(n):i.push(n),i.push(e[t+3])}else{let r=.5,a=e[t+0],o=e[t+1],s=e[t+2],c=e[t+3],l=z(a,o,r),u=z(o,s,r),d=z(s,c,r),f=z(l,u,r),p=z(u,d,r),m=z(f,p,r);wr([a,l,f,m],0,n,i),wr([m,p,d,c],0,n,i)}var a,o;return i}function Tr(e,t){return Er(e,0,e.length,t)}function Er(e,t,n,r,i){let a=i||[],o=e[t],s=e[n-1],c=0,l=1;for(let r=t+1;r<n-1;++r){let t=Cr(e[r],o,s);t>c&&(c=t,l=r)}return Math.sqrt(c)>r?(Er(e,t,l+1,r,a),Er(e,l,n,r,a)):(a.length||a.push(o),a.push(s)),a}function Dr(e,t=.15,n){let r=[],i=(e.length-1)/3;for(let n=0;n<i;n++)wr(e,3*n,t,r);return n&&n>0?Er(r,0,r.length,n):r}var B=`none`,Or=class{constructor(e){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:`#000`,strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:`hachure`,fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}_d(e,t,n){return{shape:e,sets:t||[],options:n||this.defaultOptions}}line(e,t,n,r,i){let a=this._o(i);return this._d(`line`,[tr(e,t,n,r,a)],a)}rectangle(e,t,n,r,i){let a=this._o(i),o=[],s=rr(e,t,n,r,a);if(a.fill){let i=[[e,t],[e+n,t],[e+n,t+r],[e,t+r]];a.fillStyle===`solid`?o.push(lr([i],a)):o.push(ur([i],a))}return a.stroke!==B&&o.push(s),this._d(`rectangle`,o,a)}ellipse(e,t,n,r,i){let a=this._o(i),o=[],s=ar(n,r,a),c=or(e,t,a,s);if(a.fill)if(a.fillStyle===`solid`){let n=or(e,t,a,s).opset;n.type=`fillPath`,o.push(n)}else o.push(ur([c.estimatedPoints],a));return a.stroke!==B&&o.push(c.opset),this._d(`ellipse`,o,a)}circle(e,t,n,r){let i=this.ellipse(e,t,n,n,r);return i.shape=`circle`,i}linearPath(e,t){let n=this._o(t);return this._d(`linearPath`,[nr(e,!1,n)],n)}arc(e,t,n,r,i,a,o=!1,s){let c=this._o(s),l=[],u=sr(e,t,n,r,i,a,o,!0,c);if(o&&c.fill)if(c.fillStyle===`solid`){let o=Object.assign({},c);o.disableMultiStroke=!0;let s=sr(e,t,n,r,i,a,!0,!1,o);s.type=`fillPath`,l.push(s)}else l.push(function(e,t,n,r,i,a,o){let s=e,c=t,l=Math.abs(n/2),u=Math.abs(r/2);l+=L(.01*l,o),u+=L(.01*u,o);let d=i,f=a;for(;d<0;)d+=2*Math.PI,f+=2*Math.PI;f-d>2*Math.PI&&(d=0,f=2*Math.PI);let p=(f-d)/o.curveStepCount,m=[];for(let e=d;e<=f;e+=p)m.push([s+l*Math.cos(e),c+u*Math.sin(e)]);return m.push([s+l*Math.cos(f),c+u*Math.sin(f)]),m.push([s,c]),ur([m],o)}(e,t,n,r,i,a,c));return c.stroke!==B&&l.push(u),this._d(`arc`,l,c)}curve(e,t){let n=this._o(t),r=[],i=ir(e,n);if(n.fill&&n.fill!==B)if(n.fillStyle===`solid`){let t=ir(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));r.push({type:`fillPath`,ops:this._mergedShape(t.ops)})}else{let t=[],i=e;if(i.length){let e=typeof i[0][0]==`number`?[i]:i;for(let r of e)r.length<3?t.push(...r):r.length===3?t.push(...Dr(xr([r[0],r[0],r[1],r[2]]),10,(1+n.roughness)/2)):t.push(...Dr(xr(r),10,(1+n.roughness)/2))}t.length&&r.push(ur([t],n))}return n.stroke!==B&&r.push(i),this._d(`curve`,r,n)}polygon(e,t){let n=this._o(t),r=[],i=nr(e,!0,n);return n.fill&&(n.fillStyle===`solid`?r.push(lr([e],n)):r.push(ur([e],n))),n.stroke!==B&&r.push(i),this._d(`polygon`,r,n)}path(e,t){let n=this._o(t),r=[];if(!e)return this._d(`path`,r,n);e=(e||``).replace(/\n/g,` `).replace(/(-\s)/g,`-`).replace(`/(ss)/g`,` `);let i=n.fill&&n.fill!==`transparent`&&n.fill!==B,a=n.stroke!==B,o=!!(n.simplification&&n.simplification<1),s=function(e,t,n){let r=Zn(Xn(Yn(e))),i=[],a=[],o=[0,0],s=[],c=()=>{s.length>=4&&a.push(...Dr(s,t)),s=[]},l=()=>{c(),a.length&&(i.push(a),a=[])};for(let{key:e,data:t}of r)switch(e){case`M`:l(),o=[t[0],t[1]],a.push(o);break;case`L`:c(),a.push([t[0],t[1]]);break;case`C`:if(!s.length){let e=a.length?a[a.length-1]:o;s.push([e[0],e[1]])}s.push([t[0],t[1]]),s.push([t[2],t[3]]),s.push([t[4],t[5]]);break;case`Z`:c(),a.push([o[0],o[1]])}if(l(),!n)return i;let u=[];for(let e of i){let t=Tr(e,n);t.length&&u.push(t)}return u}(e,1,o?4-4*(n.simplification||1):(1+n.roughness)/2),c=cr(e,n);if(i)if(n.fillStyle===`solid`)if(s.length===1){let t=cr(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));r.push({type:`fillPath`,ops:this._mergedShape(t.ops)})}else r.push(lr(s,n));else r.push(ur(s,n));return a&&(o?s.forEach((e=>{r.push(nr(e,!1,n))})):r.push(c)),this._d(`path`,r,n)}opsToPath(e,t){let n=``;for(let r of e.ops){let e=typeof t==`number`&&t>=0?r.data.map((e=>+e.toFixed(t))):r.data;switch(r.op){case`move`:n+=`M${e[0]} ${e[1]} `;break;case`bcurveTo`:n+=`C${e[0]} ${e[1]}, ${e[2]} ${e[3]}, ${e[4]} ${e[5]} `;break;case`lineTo`:n+=`L${e[0]} ${e[1]} `}}return n.trim()}toPaths(e){let t=e.sets||[],n=e.options||this.defaultOptions,r=[];for(let e of t){let t=null;switch(e.type){case`path`:t={d:this.opsToPath(e),stroke:n.stroke,strokeWidth:n.strokeWidth,fill:B};break;case`fillPath`:t={d:this.opsToPath(e),stroke:B,strokeWidth:0,fill:n.fill||B};break;case`fillSketch`:t=this.fillSketch(e,n)}t&&r.push(t)}return r}fillSketch(e,t){let n=t.fillWeight;return n<0&&(n=t.strokeWidth/2),{d:this.opsToPath(e),stroke:t.fill||B,strokeWidth:n,fill:B}}_mergedShape(e){return e.filter(((e,t)=>t===0||e.op!==`move`))}},kr=class{constructor(e,t){this.canvas=e,this.ctx=this.canvas.getContext(`2d`),this.gen=new Or(t)}draw(e){let t=e.sets||[],n=e.options||this.getDefaultOptions(),r=this.ctx,i=e.options.fixedDecimalPlaceDigits;for(let a of t)switch(a.type){case`path`:r.save(),r.strokeStyle=n.stroke===`none`?`transparent`:n.stroke,r.lineWidth=n.strokeWidth,n.strokeLineDash&&r.setLineDash(n.strokeLineDash),n.strokeLineDashOffset&&(r.lineDashOffset=n.strokeLineDashOffset),this._drawToContext(r,a,i),r.restore();break;case`fillPath`:{r.save(),r.fillStyle=n.fill||``;let t=e.shape===`curve`||e.shape===`polygon`||e.shape===`path`?`evenodd`:`nonzero`;this._drawToContext(r,a,i,t),r.restore();break}case`fillSketch`:this.fillSketch(r,a,n)}}fillSketch(e,t,n){let r=n.fillWeight;r<0&&(r=n.strokeWidth/2),e.save(),n.fillLineDash&&e.setLineDash(n.fillLineDash),n.fillLineDashOffset&&(e.lineDashOffset=n.fillLineDashOffset),e.strokeStyle=n.fill||``,e.lineWidth=r,this._drawToContext(e,t,n.fixedDecimalPlaceDigits),e.restore()}_drawToContext(e,t,n,r=`nonzero`){e.beginPath();for(let r of t.ops){let t=typeof n==`number`&&n>=0?r.data.map((e=>+e.toFixed(n))):r.data;switch(r.op){case`move`:e.moveTo(t[0],t[1]);break;case`bcurveTo`:e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]);break;case`lineTo`:e.lineTo(t[0],t[1])}}t.type===`fillPath`?e.fill(r):e.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(e,t,n,r,i){let a=this.gen.line(e,t,n,r,i);return this.draw(a),a}rectangle(e,t,n,r,i){let a=this.gen.rectangle(e,t,n,r,i);return this.draw(a),a}ellipse(e,t,n,r,i){let a=this.gen.ellipse(e,t,n,r,i);return this.draw(a),a}circle(e,t,n,r){let i=this.gen.circle(e,t,n,r);return this.draw(i),i}linearPath(e,t){let n=this.gen.linearPath(e,t);return this.draw(n),n}polygon(e,t){let n=this.gen.polygon(e,t);return this.draw(n),n}arc(e,t,n,r,i,a,o=!1,s){let c=this.gen.arc(e,t,n,r,i,a,o,s);return this.draw(c),c}curve(e,t){let n=this.gen.curve(e,t);return this.draw(n),n}path(e,t){let n=this.gen.path(e,t);return this.draw(n),n}},Ar=`http://www.w3.org/2000/svg`,jr=class{constructor(e,t){this.svg=e,this.gen=new Or(t)}draw(e){let t=e.sets||[],n=e.options||this.getDefaultOptions(),r=this.svg.ownerDocument||window.document,i=r.createElementNS(Ar,`g`),a=e.options.fixedDecimalPlaceDigits;for(let o of t){let t=null;switch(o.type){case`path`:t=r.createElementNS(Ar,`path`),t.setAttribute(`d`,this.opsToPath(o,a)),t.setAttribute(`stroke`,n.stroke),t.setAttribute(`stroke-width`,n.strokeWidth+``),t.setAttribute(`fill`,`none`),n.strokeLineDash&&t.setAttribute(`stroke-dasharray`,n.strokeLineDash.join(` `).trim()),n.strokeLineDashOffset&&t.setAttribute(`stroke-dashoffset`,`${n.strokeLineDashOffset}`);break;case`fillPath`:t=r.createElementNS(Ar,`path`),t.setAttribute(`d`,this.opsToPath(o,a)),t.setAttribute(`stroke`,`none`),t.setAttribute(`stroke-width`,`0`),t.setAttribute(`fill`,n.fill||``),e.shape!==`curve`&&e.shape!==`polygon`||t.setAttribute(`fill-rule`,`evenodd`);break;case`fillSketch`:t=this.fillSketch(r,o,n)}t&&i.appendChild(t)}return i}fillSketch(e,t,n){let r=n.fillWeight;r<0&&(r=n.strokeWidth/2);let i=e.createElementNS(Ar,`path`);return i.setAttribute(`d`,this.opsToPath(t,n.fixedDecimalPlaceDigits)),i.setAttribute(`stroke`,n.fill||``),i.setAttribute(`stroke-width`,r+``),i.setAttribute(`fill`,`none`),n.fillLineDash&&i.setAttribute(`stroke-dasharray`,n.fillLineDash.join(` `).trim()),n.fillLineDashOffset&&i.setAttribute(`stroke-dashoffset`,`${n.fillLineDashOffset}`),i}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(e,t){return this.gen.opsToPath(e,t)}line(e,t,n,r,i){let a=this.gen.line(e,t,n,r,i);return this.draw(a)}rectangle(e,t,n,r,i){let a=this.gen.rectangle(e,t,n,r,i);return this.draw(a)}ellipse(e,t,n,r,i){let a=this.gen.ellipse(e,t,n,r,i);return this.draw(a)}circle(e,t,n,r){let i=this.gen.circle(e,t,n,r);return this.draw(i)}linearPath(e,t){let n=this.gen.linearPath(e,t);return this.draw(n)}polygon(e,t){let n=this.gen.polygon(e,t);return this.draw(n)}arc(e,t,n,r,i,a,o=!1,s){let c=this.gen.arc(e,t,n,r,i,a,o,s);return this.draw(c)}curve(e,t){let n=this.gen.curve(e,t);return this.draw(n)}path(e,t){let n=this.gen.path(e,t);return this.draw(n)}},Mr={canvas:(e,t)=>new kr(e,t),svg:(e,t)=>new jr(e,t),generator:e=>new Or(e),newSeed:()=>Or.newSeed()};function V(e,t,n,r,i){let a=Math.max(0,Math.min(i,n/2,r/2));return a===0?`M ${e} ${t} L ${e+n} ${t} L ${e+n} ${t+r} L ${e} ${t+r} Z`:`M ${e+a} ${t} L ${e+n-a} ${t} Q ${e+n} ${t} ${e+n} ${t+a} L ${e+n} ${t+r-a} Q ${e+n} ${t+r} ${e+n-a} ${t+r} L ${e+a} ${t+r} Q ${e} ${t+r} ${e} ${t+r-a} L ${e} ${t+a} Q ${e} ${t} ${e+a} ${t} Z`}function Nr(e,t,n,r,i){let a=Math.max(0,Math.min(i,n/2,r));return`M ${e} ${t+r} L ${e} ${t+a} Q ${e} ${t} ${e+a} ${t} L ${e+n-a} ${t} Q ${e+n} ${t} ${e+n} ${t+a} L ${e+n} ${t+r} Z`}function Pr(e,t,n){return`M ${e-n} ${t} A ${n} ${n} 0 1 0 ${e+n} ${t} A ${n} ${n} 0 1 0 ${e-n} ${t} Z`}function Fr(e,t,n,r){return`M ${e} ${t} L ${n} ${r}`}function Ir(e,t=0){if(e.length<3||t<=0)return e.map((e,t)=>`${t?`L`:`M`} ${e[0]} ${e[1]}`).join(` `)+` Z`;let n=(e,t,n)=>{let r=Math.hypot(t[0]-e[0],t[1]-e[1])||1;return[e[0]+(t[0]-e[0])/r*n,e[1]+(t[1]-e[1])/r*n]},r=[];for(let i=0;i<e.length;i+=1){let a=e[(i-1+e.length)%e.length],o=e[i],s=e[(i+1)%e.length],c=Math.min(t,Math.hypot(o[0]-a[0],o[1]-a[1])/2,Math.hypot(o[0]-s[0],o[1]-s[1])/2),l=n(o,a,c),u=n(o,s,c);r.push(`${i?`L`:`M`} ${l[0]} ${l[1]}`),r.push(`Q ${o[0]} ${o[1]} ${u[0]} ${u[1]}`)}return r.join(` `)+` Z`}var Lr={M:[`x`,`y`],L:[`x`,`y`],Q:[`x`,`y`,`x`,`y`],C:[`x`,`y`,`x`,`y`,`x`,`y`],A:[`keep`,`keep`,`rotation`,`keep`,`sweep`,`x`,`y`],Z:[]},Rr=/([A-Za-z])([^A-Za-z]*)/g,zr=/[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g;function Br(e){if(!Number.isFinite(e))return`0`;let t=Math.round(e*1e4)/1e4;return Object.is(t,-0)?`0`:String(t)}function Vr(e,t,n,r){if(!n&&!r)return e;let i=t.x+t.width/2,a=t.y+t.height/2,o=n!==r,s=[];Rr.lastIndex=0;for(let t=Rr.exec(e);t;t=Rr.exec(e)){let c=t[1],l=Lr[c];if(!l)return e;let u=t[2].match(zr)?.map(Number)??[];if(l.length===0||u.length===0){s.push(c);continue}let d=u.map((e,t)=>{let s=l[t%l.length];return s===`x`?Br(n?2*i-e:e):s===`y`?Br(r?2*a-e:e):s===`rotation`?Br(o?-e:e):s===`sweep`&&o?String(+!e):Br(e)});s.push(`${c} ${d.join(` `)}`)}return s.join(` `)}var Hr=`rectangle.ellipse.diamond.triangle.oval.parallelogram.trapezoid.cylinder.queue.note.callout.hexagon.star.checkbox.crossbox.heart.cloud.arrow-up.arrow-down.arrow-left.arrow-right.plus.speech-bubble.bolt.document.predefined-process.manual-input.pentagon.chevron.octagon.cube.actor.double-circle.card.delay.fork-join.multi-document.multi-process.package.component.brace`.split(`.`);function H(e,t=0){return Ir(e,t)}function Ur(e){let t=e.x+e.width/2,n=e.y+e.height/2,r=e.width/2,i=e.height/2,a=[];for(let e=0;e<10;e+=1){let o=e%2==0?1:.42,s=-Math.PI/2+e*Math.PI/5;a.push([t+Math.cos(s)*r*o,n+Math.sin(s)*i*o])}return H(a)}function Wr(e){return Math.min(e.width*.1,e.height*.25)}function Gr(e){return Math.min(e.height*.34,e.width*.25)}function Kr(e){let{x:t,y:n,width:r,height:i}=e,a=e=>t+e*r,o=e=>n+e*i;return`M ${a(.5)} ${o(.28)} C ${a(.5)} ${o(.16)} ${a(.4)} ${o(.04)} ${a(.25)} ${o(.04)} C ${a(.06)} ${o(.04)} ${a(0)} ${o(.2)} ${a(0)} ${o(.32)} C ${a(0)} ${o(.52)} ${a(.2)} ${o(.68)} ${a(.5)} ${o(.96)} C ${a(.8)} ${o(.68)} ${a(1)} ${o(.52)} ${a(1)} ${o(.32)} C ${a(1)} ${o(.2)} ${a(.94)} ${o(.04)} ${a(.75)} ${o(.04)} C ${a(.6)} ${o(.04)} ${a(.5)} ${o(.16)} ${a(.5)} ${o(.28)} Z`}function qr(e){return V(e.x,e.y,e.width,e.height,Math.min(6,e.width/2,e.height/2))}function Jr(e){let{x:t,y:n,width:r,height:i}=e,a=e=>t+e*r,o=e=>n+e*i;return`M ${a(.23)} ${o(1)} C ${a(.1)} ${o(1)} ${a(0)} ${o(.85)} ${a(0)} ${o(.66)} C ${a(0)} ${o(.47)} ${a(.1)} ${o(.31)} ${a(.23)} ${o(.31)} C ${a(.25)} ${o(.17)} ${a(.32)} ${o(.06)} ${a(.42)} ${o(.02)} C ${a(.51)} ${o(0)} ${a(.61)} ${o(.01)} ${a(.69)} ${o(.1)} C ${a(.76)} ${o(.19)} ${a(.8)} ${o(.33)} ${a(.78)} ${o(.46)} L ${a(.83)} ${o(.46)} C ${a(.92)} ${o(.46)} ${a(1)} ${o(.58)} ${a(1)} ${o(.73)} C ${a(1)} ${o(.88)} ${a(.92)} ${o(1)} ${a(.83)} ${o(1)} Z`}function Yr(e,t){let n=t===`left`||t===`right`,r=n?e.width:e.height,i=n?e.height:e.width;return Math.min(i,r/2)}function Xr(e,t,n=0){let{x:r,y:i,width:a,height:o}=e,s=t===`left`||t===`right`,c=s?a:o,l=s?o:a,u=Yr(e,t),d=l*.25,f=l/2;return H([[0,f-d],[c-u,f-d],[c-u,0],[c,f],[c-u,l],[c-u,f+d],[0,f+d]].map(([e,n])=>t===`right`?[r+e,i+n]:t===`left`?[r+c-e,i+n]:t===`down`?[r+n,i+e]:[r+n,i+c-e]),n)}function Zr(e,t=0){let{x:n,y:r,width:i,height:a}=e,o=i*.32,s=a*.32;return H([[n+o,r],[n+i-o,r],[n+i-o,r+s],[n+i,r+s],[n+i,r+a-s],[n+i-o,r+a-s],[n+i-o,r+a],[n+o,r+a],[n+o,r+a-s],[n,r+a-s],[n,r+s],[n+o,r+s]],t)}function Qr(e){let{x:t,y:n,width:r,height:i}=e,a=(e,a)=>[t+e*r,n+a*i];return H([a(.56,0),a(0,.6),a(.5,.6),a(.44,1),a(1,.4),a(.5,.4)])}var $r=.16;function ei(e){let{x:t,y:n,width:r,height:i}=e,a=i*$r,o=n+i-a,s=e=>t+e*r;return`M ${t} ${n} L ${t+r} ${n} L ${t+r} ${o} C ${s(.72)} ${o-a*1.4} ${s(.56)} ${o+a*1.4} ${s(.4)} ${o} C ${s(.26)} ${o-a*1.4} ${s(.12)} ${o+a*1.1} ${t} ${o} Z`}function ti(e){let{x:t,y:n,width:r,height:i}=e,a=Math.min(r*.12,16);return`M ${t+a} ${n} L ${t+a} ${n+i} M ${t+r-a} ${n} L ${t+r-a} ${n+i}`}function ni(e){let{x:t,y:n,width:r,height:i}=e;return H([[t,n+i*.28],[t+r,n],[t+r,n+i],[t,n+i]])}function ri(e){return Math.min(e.width*.22,e.height*.6)}function ii(e,t=0){let{x:n,y:r,width:i,height:a}=e,o=ri(e);return H([[n,r],[n+i-o,r],[n+i,r+a/2],[n+i-o,r+a],[n,r+a]],t)}function ai(e){return Math.min(e.width*.24,e.height*.6)}function oi(e,t=0){let{x:n,y:r,width:i,height:a}=e,o=ai(e);return H([[n,r],[n+i-o,r],[n+i,r+a/2],[n+i-o,r+a],[n,r+a],[n+o,r+a/2]],t)}function si(e,t=0){let{x:n,y:r,width:i,height:a}=e,o=Math.min(i,a)*.29;return H([[n+o,r],[n+i-o,r],[n+i,r+o],[n+i,r+a-o],[n+i-o,r+a],[n+o,r+a],[n,r+a-o],[n,r+o]],t)}function ci(e){return Math.min(e.width,e.height)*.26}function li(e){let{x:t,y:n,width:r,height:i}=e,a=ci(e);return H([[t,n+a],[t+a,n],[t+r,n],[t+r,n+i-a],[t+r-a,n+i],[t,n+i]])}function ui(e){let{x:t,y:n,width:r,height:i}=e,a=ci(e);return`M ${t} ${n+a} L ${t+r-a} ${n+a} L ${t+r} ${n} M ${t+r-a} ${n+a} L ${t+r-a} ${n+i}`}var di=.72;function fi(e){let{x:t,y:n,width:r}=e,i=e.height*di,a=t+r/2,o=Math.min(r*.22,i*.16),s=n+o+i*.04,c=s+o,l=n+i*.44,u=n+i*.64,d=n+i*.98,f=r*.3,p=r*.22;return`M ${a-o} ${s} A ${o} ${o} 0 1 0 ${a+o} ${s} A ${o} ${o} 0 1 0 ${a-o} ${s} M ${a} ${c} L ${a} ${u} M ${a-f} ${l} L ${a+f} ${l} M ${a} ${u} L ${a-p} ${d} M ${a} ${u} L ${a+p} ${d}`}var pi=.82,mi=.78;function hi(e,t,n,r){let{x:i,y:a,width:o,height:s}=e,c=a+s*t,l=Math.min(n,o/4,(c-a)/2);return`M ${i+l} ${a} L ${i+o-l} ${a} Q ${i+o} ${a} ${i+o} ${a+l} L ${i+o} ${c-l} Q ${i+o} ${c} ${i+o-l} ${c} L ${i+o*r[0]} ${c} L ${i+o*r[1]} ${a+s} L ${i+o*r[2]} ${c} L ${i+l} ${c} Q ${i} ${c} ${i} ${c-l} L ${i} ${a+l} Q ${i} ${a} ${i+l} ${a} Z`}function gi(e){return hi(e,pi,10,[.24,.04,.14])}function _i(e){return hi(e,mi,12,[.4,.22,.26])}function vi(e){let t=e.y+e.height/2,n=e.width/2,r=e.height/2;return`M ${e.x} ${t} A ${n} ${r} 0 1 0 ${e.x+e.width} ${t} A ${n} ${r} 0 1 0 ${e.x} ${t} Z`}function yi(e){let{x:t,y:n,width:r,height:i}=e,a=Math.min(r,i)*.2;return H([[t+a,n],[t+r,n],[t+r,n+i],[t,n+i],[t,n+a]])}function bi(e){return Math.min(e.height/2,e.width/2)}function xi(e){let{x:t,y:n,width:r,height:i}=e,a=bi(e),o=r-a;return`M ${t} ${n} L ${t+o} ${n} A ${a} ${a} 0 0 1 ${t+o} ${n+i} L ${t} ${n+i} Z`}function Si(e){return Ai(e)}function Ci(e){return Math.min(Math.min(e.width,e.height)*.08,9)}function wi(e,t,n){let r=n??Ci(e);return t({x:e.x,y:e.y+2*r,width:e.width-2*r,height:e.height-2*r})}function Ti(e,t,n,r){let i=n??Ci(e),a=e.width-2*i,o=e.height-2*i,s=r??e.y+e.height;return`${Ei(e.x+2*i,e.y,a,o,i,s)} ${Ei(e.x+i,e.y+i,a,o,i,s)} ${wi(e,t,i)}`}function Ei(e,t,n,r,i,a){let o=e+n,s=Math.min(t+r,a);return`M ${e} ${t+i} L ${e} ${t} L ${o} ${t} L ${o} ${s} L ${o-i} ${s}`}function Di(e,t){return e.y+2*t+(e.height-2*t)*(1-$r)}var Oi=.12;function ki(e,t){let n=Math.min(e.width,e.height)*t;return vi(e)+` `+vi({x:e.x+n,y:e.y+n,width:e.width-2*n,height:e.height-2*n})}function Ai(e){return V(e.x,e.y,e.width,e.height,Math.min(4,e.width/2,e.height/2))}function ji(e){return Math.min(e.height*.24,26)}function Mi(e){return Math.min(e.width*.45,96)}function Ni(e){let{x:t,y:n,width:r,height:i}=e,a=ji(e),o=Mi(e);return H([[t,n],[t+o,n],[t+o,n+a],[t+r,n+a],[t+r,n+i],[t,n+i]])}function Pi(e){return Math.min(e.width*.16,22)}function Fi(e){let{x:t,y:n,width:r,height:i}=e,a=Pi(e),o=Math.min(i*.16,14)/2,s=n+i*.32,c=n+i*.68,l=`M ${t} ${n} L ${t+r} ${n} L ${t+r} ${n+i} L ${t} ${n+i} L ${t} ${c+o} M ${t} ${c-o} L ${t} ${s+o} M ${t} ${s-o} L ${t} ${n}`,u=e=>`M ${t-a/2} ${e-o} L ${t+a/2} ${e-o} L ${t+a/2} ${e+o} L ${t-a/2} ${e+o} Z`;return`${l} ${u(s)} ${u(c)}`}function Ii(e){return Math.min(e.width*.3,16)}function Li(e){let{x:t,y:n,height:r}=e,i=Ii(e),a=n+r/2,o=t+i,s=t+i*.4;return`M ${o} ${n} Q ${s} ${n} ${s} ${n+r*.22} L ${s} ${a-r*.06} Q ${s} ${a} ${t} ${a} Q ${s} ${a} ${s} ${a+r*.06} L ${s} ${n+r*.78} Q ${s} ${n+r} ${o} ${n+r}`}var Ri=new Set([`diamond`,`triangle`,`parallelogram`,`trapezoid`,`hexagon`,`pentagon`,`octagon`,`chevron`,`plus`,`arrow-up`,`arrow-down`,`arrow-left`,`arrow-right`]);function zi(e){return e===`rectangle`||Ri.has(e)}function Bi(e){return e===`rectangle`?`rounded`:`sharp`}function Vi(e){return e===`rounded`?7:0}var Hi={triangle:{y:!0},parallelogram:{x:!0,y:!0},trapezoid:{y:!0},cylinder:{y:!0},note:{x:!0,y:!0},star:{y:!0},checkbox:{x:!0,y:!0},heart:{y:!0},cloud:{x:!0,y:!0},"arrow-up":{y:!0},"arrow-down":{y:!0},"arrow-left":{x:!0},"arrow-right":{x:!0},"speech-bubble":{x:!0,y:!0},bolt:{x:!0,y:!0},queue:{x:!0},callout:{x:!0,y:!0},document:{x:!0,y:!0},"manual-input":{x:!0,y:!0},pentagon:{x:!0},chevron:{x:!0},cube:{x:!0,y:!0},actor:{y:!0},card:{x:!0,y:!0},delay:{x:!0},"multi-document":{x:!0,y:!0},"multi-process":{x:!0,y:!0},package:{x:!0,y:!0},component:{x:!0},brace:{x:!0}};function Ui(e){let t=Hi[e];return{x:t?.x===!0,y:t?.y===!0}}function U(e,t,n,r){if(r?.x||r?.y)return Vr(U(e,t,n),t,!!r.x,!!r.y);let{x:i,y:a,width:o,height:s}=t,c=i+o/2,l=a+s/2,u=Vi(n);switch(e){case`ellipse`:return vi(t);case`oval`:return V(i,a,o,s,Math.min(o,s)/2);case`diamond`:return H([[c,a],[i+o,l],[c,a+s],[i,l]],u);case`triangle`:return H([[c,a],[i+o,a+s],[i,a+s]],u);case`parallelogram`:{let e=Math.min(o*.25,s);return H([[i+e,a],[i+o,a],[i+o-e,a+s],[i,a+s]],u)}case`trapezoid`:{let e=o*.22;return H([[i+e,a],[i+o-e,a],[i+o,a+s],[i,a+s]],u)}case`hexagon`:{let e=Math.min(o*.25,o/2);return H([[i+e,a],[i+o-e,a],[i+o,l],[i+o-e,a+s],[i+e,a+s],[i,l]],u)}case`star`:return Ur(t);case`checkbox`:case`crossbox`:return qr(t);case`heart`:return Kr(t);case`cloud`:return Jr(t);case`arrow-up`:case`arrow-down`:case`arrow-left`:case`arrow-right`:return Xr(t,e.slice(6),u);case`plus`:return Zr(t,u);case`speech-bubble`:return _i(t);case`callout`:return gi(t);case`bolt`:return Qr(t);case`document`:return ei(t);case`manual-input`:return ni(t);case`pentagon`:return ii(t,u);case`predefined-process`:return V(i,a,o,s,Math.min(3,o/2,s/2));case`chevron`:return oi(t,u);case`octagon`:return si(t,u);case`cube`:return li(t);case`actor`:return V(i,a,o,s,Math.min(o,s)/2.4);case`note`:{let e=Math.min(o,s)*.26;return`M ${i} ${a} L ${i+o-e} ${a} L ${i+o} ${a+e} L ${i+o} ${a+s} L ${i} ${a+s} Z`}case`cylinder`:{let e=Wr(t),n=o/2,r=a+e,c=a+s-e;return`M ${i} ${r} L ${i} ${c} A ${n} ${e} 0 0 0 ${i+o} ${c} L ${i+o} ${r} A ${n} ${e} 0 0 0 ${i} ${r} Z`}case`queue`:{let e=Gr(t),n=s/2,r=i+e,c=i+o-e;return`M ${r} ${a} L ${c} ${a} A ${e} ${n} 0 0 1 ${c} ${a+s} L ${r} ${a+s} A ${e} ${n} 0 0 1 ${r} ${a} Z`}case`double-circle`:return vi(t);case`card`:return yi(t);case`delay`:return xi(t);case`fork-join`:return Si(t);case`multi-process`:return wi(t,Ai);case`multi-document`:return wi(t,ei);case`package`:return Ni(t);case`component`:return Ai(t);case`brace`:return Ai(t);default:return V(i,a,o,s,n===`sharp`?0:Math.min(12,o/2,s/2))}}function Wi(e,t,n,r){if(r?.x||r?.y)return Vr(Wi(e,t,n),t,!!r.x,!!r.y);let{x:i,y:a,width:o,height:s}=t;if(e===`cylinder`){let r=Wr(t),s=o/2,c=a+r;return U(e,t,n)+` M ${i} ${c} A ${s} ${r} 0 0 0 ${i+o} ${c}`}if(e===`queue`){let r=Gr(t),o=s/2,c=i+r;return U(e,t,n)+` M ${c} ${a} A ${r} ${o} 0 0 1 ${c} ${a+s}`}if(e===`note`){let r=Math.min(o,s)*.26;return U(e,t,n)+` M ${i+o-r} ${a} L ${i+o-r} ${a+r} L ${i+o} ${a+r}`}if(e===`crossbox`){let r=o*.06,c=s*.06;return U(e,t,n)+` M ${i+r} ${a+c} L ${i+o-r} ${a+s-c} M ${i+o-r} ${a+c} L ${i+r} ${a+s-c}`}if(e===`checkbox`)return U(e,t,n)+` M ${i+o*.24} ${a+s*.52} L ${i+o*.44} ${a+s*.72} L ${i+o*.78} ${a+s*.28}`;if(e===`predefined-process`)return U(e,t,n)+` `+ti(t);if(e===`cube`)return U(e,t,n)+` `+ui(t);if(e===`actor`)return fi(t);if(e===`double-circle`)return ki(t,Oi);if(e===`multi-process`)return Ti(t,Ai);if(e===`multi-document`)return Ti(t,ei,void 0,Di(t,Ci(t)));if(e===`package`){let r=ji(t),i=Mi(t);return U(e,t,n)+` M ${t.x} ${t.y+r} L ${t.x+i} ${t.y+r}`}return e===`component`?Fi(t):e===`brace`?Li(t):U(e,t,n)}function Gi(e){if(e===`arrow-up`||e===`arrow-down`||e===`bolt`||e===`actor`)return Wi(e,{x:5,y:4,width:14,height:16});if(e===`plus`||e===`checkbox`||e===`crossbox`||e===`heart`)return Wi(e,{x:5,y:5,width:14,height:14});if(e===`double-circle`)return ki({x:4,y:4,width:16,height:16},.26);if(e===`multi-process`)return Ki({x:4,y:5,width:15,height:13},Ai,4);if(e===`multi-document`){let e={x:4,y:5,width:15,height:13};return Ki(e,ei,4,e.y+4+(e.height-4)*(1-$r))}return e===`fork-join`?Si({x:4,y:9,width:16,height:6}):Wi(e,{x:4,y:5,width:16,height:14})}function Ki(e,t,n,r){let i=e.width-n,a=e.height-n,o=t({x:e.x,y:e.y+n,width:i,height:a});return`${Ei(e.x+n,e.y,i,a,n,r??e.y+a)} ${o}`}var{PI:qi}=Math,Ji=qi+1e-4,Yi=.5,Xi=[1,1];function Zi(e,t,n,r=e=>e){return e*r(.5-t*(.5-n))}var{min:Qi}=Math;function $i(e,t,n){let r=Qi(1,t/n);return Qi(1,e+(Qi(1,1-r)-e)*(r*.275))}function ea(e){return[-e[0],-e[1]]}function W(e,t){return[e[0]+t[0],e[1]+t[1]]}function ta(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function G(e,t){return[e[0]-t[0],e[1]-t[1]]}function na(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function K(e,t){return[e[0]*t,e[1]*t]}function ra(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function ia(e,t){return[e[0]/t,e[1]/t]}function aa(e){return[e[1],-e[0]]}function oa(e,t){let n=t[0];return e[0]=t[1],e[1]=-n,e}function sa(e,t){return e[0]*t[0]+e[1]*t[1]}function ca(e,t){return e[0]===t[0]&&e[1]===t[1]}function la(e){return Math.hypot(e[0],e[1])}function ua(e,t){let n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function da(e){return ia(e,la(e))}function fa(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function pa(e,t,n){let r=Math.sin(n),i=Math.cos(n),a=e[0]-t[0],o=e[1]-t[1],s=a*i-o*r,c=a*r+o*i;return[s+t[0],c+t[1]]}function ma(e,t,n,r){let i=Math.sin(r),a=Math.cos(r),o=t[0]-n[0],s=t[1]-n[1],c=o*a-s*i,l=o*i+s*a;return e[0]=c+n[0],e[1]=l+n[1],e}function ha(e,t,n){return W(e,K(G(t,e),n))}function ga(e,t,n,r){let i=n[0]-t[0],a=n[1]-t[1];return e[0]=t[0]+i*r,e[1]=t[1]+a*r,e}function _a(e,t,n){return W(e,K(t,n))}var q=[0,0],J=[0,0],Y=[0,0];function va(e,t){let n=_a(e,da(aa(G(e,W(e,[1,1])))),-t),r=[],i=1/13;for(let t=i;t<=1;t+=i)r.push(pa(n,e,Ji*2*t));return r}function ya(e,t,n){let r=[],i=1/n;for(let n=i;n<=1;n+=i)r.push(pa(t,e,Ji*n));return r}function ba(e,t,n){let r=G(t,n),i=K(r,.5),a=K(r,.51);return[G(e,i),G(e,a),W(e,a),W(e,i)]}function xa(e,t,n,r){let i=[],a=_a(e,t,n),o=1/r;for(let t=o;t<1;t+=o)i.push(pa(a,e,Ji*3*t));return i}function Sa(e,t,n){return[W(e,K(t,n)),W(e,K(t,n*.99)),G(e,K(t,n*.99)),G(e,K(t,n))]}function Ca(e,t,n){return e===!1||e===void 0?0:e===!0?Math.max(t,n):e}function wa(e,t,n){return e.slice(0,10).reduce((e,r)=>{let i=r.pressure;return t&&(i=$i(e,r.distance,n)),(e+i)/2},e[0].pressure)}function Ta(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:a=!0,easing:o=e=>e,start:s={},end:c={},last:l=!1}=t,{cap:u=!0,easing:d=e=>e*(2-e)}=s,{cap:f=!0,easing:p=e=>--e*e*e+1}=c;if(e.length===0||n<=0)return[];let m=e[e.length-1].runningLength,h=Ca(s.taper,n,m),g=Ca(c.taper,n,m),_=(n*r)**2,v=[],y=[],ee=wa(e,a,n),b=Zi(n,i,e[e.length-1].pressure,o),x,S=e[0].vector,C=e[0].point,w=C,T=C,E=w,D=!1;for(let t=0;t<e.length;t++){let{pressure:r}=e[t],{point:s,vector:c,distance:l,runningLength:u}=e[t],f=t===e.length-1;if(!f&&m-u<3)continue;i?(a&&(r=$i(ee,l,n)),b=Zi(n,i,r,o)):b=n/2,x===void 0&&(x=b);let te=u<h?d(u/h):1,ne=m-u<g?p((m-u)/g):1;b=Math.max(.01,b*Math.min(te,ne));let O=(f?e[t]:e[t+1]).vector,k=f?1:sa(c,O),re=sa(c,S)<0&&!D,ie=k!==null&&k<0;if(re||ie){oa(q,S),ra(q,q,b);for(let e=0;e<=1;e+=.07692307692307693)na(J,s,q),ma(J,J,s,Ji*e),T=[J[0],J[1]],v.push(T),ta(Y,s,q),ma(Y,Y,s,Ji*-e),E=[Y[0],Y[1]],y.push(E);C=T,w=E,ie&&(D=!0);continue}if(D=!1,f){oa(q,c),ra(q,q,b),v.push(G(s,q)),y.push(W(s,q));continue}ga(q,O,c,k),oa(q,q),ra(q,q,b),na(J,s,q),T=[J[0],J[1]],(t<=1||ua(C,T)>_)&&(v.push(T),C=T),ta(Y,s,q),E=[Y[0],Y[1]],(t<=1||ua(w,E)>_)&&(y.push(E),w=E),ee=r,S=c}let te=[e[0].point[0],e[0].point[1]],ne=e.length>1?[e[e.length-1].point[0],e[e.length-1].point[1]]:W(e[0].point,[1,1]),O=[],k=[];if(e.length===1){if(!(h||g)||l)return va(te,x||b)}else{h||g&&e.length===1||(u?O.push(...ya(te,y[0],13)):O.push(...ba(te,v[0],y[0])));let t=aa(ea(e[e.length-1].vector));g||h&&e.length===1?k.push(ne):f?k.push(...xa(ne,t,b,29)):k.push(...Sa(ne,t,b))}return v.concat(k,y.reverse(),O)}var Ea=[0,0];function Da(e){return e!=null&&e>=0}function Oa(e,t={}){let{streamline:n=.5,size:r=16,last:i=!1}=t;if(e.length===0)return[];let a=.15+(1-n)*.85,o=Array.isArray(e[0])?e:e.map(({x:e,y:t,pressure:n=Yi})=>[e,t,n]);if(o.length===2){let e=o[1];o=o.slice(0,-1);for(let t=1;t<5;t++)o.push(ha(o[0],e,t/4))}o.length===1&&(o=[...o,[...W(o[0],Xi),...o[0].slice(2)]]);let s=[{point:[o[0][0],o[0][1]],pressure:Da(o[0][2])?o[0][2]:.25,vector:[...Xi],distance:0,runningLength:0}],c=!1,l=0,u=s[0],d=o.length-1;for(let e=1;e<o.length;e++){let t=i&&e===d?[o[e][0],o[e][1]]:ha(u.point,o[e],a);if(ca(u.point,t))continue;let n=fa(t,u.point);if(l+=n,e<d&&!c){if(l<r)continue;c=!0}na(Ea,u.point,t),u={point:t,pressure:Da(o[e][2])?o[e][2]:Yi,vector:da(Ea),distance:n,runningLength:l},s.push(u)}return s[0].vector=s[1]?.vector||[0,0],s}function ka(e,t={}){return Ta(Oa(e,t),t)}function Aa(e){return e.highlighter?e.strokeWidth*3:e.strokeWidth}function ja(e){if(e.length<3)return``;let t=`M${(e[0][0]+e[1][0])/2} ${(e[0][1]+e[1][1])/2}`;for(let n=1;n<=e.length;n+=1){let[r,i]=e[n%e.length],[a,o]=e[(n+1)%e.length];t+=`Q${r} ${i} ${(r+a)/2} ${(i+o)/2}`}return t+`Z`}function Ma(e){return{size:Aa(e)*2,thinning:0,smoothing:.5,streamline:.5,simulatePressure:!1,last:!0}}function Na(e){return ja(ka(e.points.map(e=>[e.x,e.y]),Ma(e)))}function Pa(e){let t=Oa(e.points.map(e=>[e.x,e.y]),Ma(e)).map(e=>e.point);if(t.length<2)return``;let n=`M${t[0][0]} ${t[0][1]}`;for(let e=1;e<t.length-1;e+=1){let[r,i]=t[e],[a,o]=t[e+1];n+=`Q${r} ${i} ${(r+a)/2} ${(i+o)/2}`}let r=t[t.length-1];return`${n}L${r[0]} ${r[1]}`}function Fa(e){if(e.length===0)return{x:0,y:0,width:0,height:0};let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return{x:t,y:n,width:r-t,height:i-n}}var Ia={top:0,right:0,bottom:0,left:0},La=.46,Ra=.28,za=.2,Ba=.35,Va=.4,Ha=.35;function Ua(e,t,n,r){let i=Wa(e,t,n);return!r?.x&&!r?.y?i:{top:r.y?i.bottom:i.top,right:r.x?i.left:i.right,bottom:r.y?i.top:i.bottom,left:r.x?i.right:i.left}}function Wa(e,t,n){let r={x:0,y:0,width:t,height:n};if(e===`multi-process`){let e=Ci(r);return{top:2*e,right:2*e,bottom:0,left:0}}if(e===`multi-document`){let e=Ci(r);return{top:2*e,right:2*e,bottom:(n-2*e)*$r,left:0}}if(e===`cube`){let e=ci(r);return{top:e,right:e,bottom:0,left:0}}if(e===`double-circle`){let e=Math.min(t,n)*Oi+6;return{top:e,right:e,bottom:e,left:e}}if(e===`cylinder`)return{top:2*Wr(r),right:0,bottom:0,left:0};if(e===`queue`){let e=Gr(r);return{top:0,right:e,bottom:0,left:2*e}}if(e===`document`)return{top:0,right:0,bottom:n*$r,left:0};if(e===`speech-bubble`)return{top:0,right:0,bottom:n*(1-mi),left:0};if(e===`callout`)return{top:0,right:0,bottom:n*(1-pi),left:0};if(e===`actor`)return{top:n*di,right:0,bottom:0,left:0};if(e===`triangle`)return{top:n*La,right:0,bottom:0,left:0};if(e===`cloud`)return{top:n*Ra,right:0,bottom:0,left:0};if(e===`pentagon`)return{top:0,right:ri(r),bottom:0,left:0};if(e===`chevron`)return{top:0,right:0,bottom:0,left:ai(r)*Ha};if(e===`manual-input`)return{top:n*za,right:0,bottom:0,left:0};if(e===`delay`)return{top:0,right:bi(r)*Va,bottom:0,left:0};if(e===`package`)return{top:ji(r),right:0,bottom:0,left:0};if(e===`component`)return{top:0,right:0,bottom:0,left:Pi(r)+4};if(e===`brace`)return{top:0,right:0,bottom:0,left:Ii(r)+8};if(e===`arrow-up`||e===`arrow-down`||e===`arrow-left`||e===`arrow-right`){let t=Yr(r,e.slice(6))*Ba;return e===`arrow-right`?{top:0,right:t,bottom:0,left:0}:e===`arrow-left`?{top:0,right:0,bottom:0,left:t}:e===`arrow-up`?{top:t,right:0,bottom:0,left:0}:{top:0,right:0,bottom:t,left:0}}return Ia}var Ga=14*.3;function Ka(e){return Math.max(14,Math.round(e))}function qa(e){return Math.max(6,Math.round(e*.35))}var Ja={ellipse:{fx:.146,fy:.146},diamond:{fx:.25,fy:.25},triangle:{fx:.25,fy:.5},parallelogram:{fx:.2,fy:0},trapezoid:{fx:.18,fy:0},hexagon:{fx:.25,fy:0},star:{fx:.3,fy:.18},heart:{fx:.22,fy:.1},cloud:{fx:.16,fy:.22},"speech-bubble":{fx:.05,fy:.05},bolt:{fx:.32,fy:.12},plus:{fx:.33,fy:.02},"arrow-up":{fx:.5,fy:.3},"arrow-down":{fx:.25,fy:.25},"arrow-left":{fx:.45,fy:.25},"arrow-right":{fx:.25,fy:.25}};function Ya(e,t,n,r){if(r?.x||r?.y){let i=Ya(e,t,n);return{x:r.x?t-i.x:i.x,y:r.y?n-i.y:i.y}}if(e===`oval`){let e=n/2*(1-Math.SQRT1_2);return{x:e,y:e}}if(e===`cylinder`)return{x:0,y:Wr({x:0,y:0,width:t,height:n})};if(e===`queue`)return{x:Gr({x:0,y:0,width:t,height:n}),y:0};let i=Ja[e]??{fx:0,fy:0};return{x:i.fx*t,y:i.fy*n}}var Xa=1.25,Za=1.15;function Qa(e){let{kind:t,width:n,height:r,fontSize:i,lineHeight:a,textPadding:o,flipX:s,flipY:c}=e,l=Ua(t,n,r,{x:s,y:c}),u=o??6,d=r-l.top-l.bottom-u*2,f=Math.floor(d/(a??1.25));return Math.max(8,Math.min(i,f))}var $a=.917,eo=.292,to=($a-eo)/2;function no(e,t){return e*t/2+e*to}function ro(e){if(!e)return null;let t=e.trim();return t?/^(https?:|mailto:)/i.test(t)?t:/^[\w-]+(\.[\w-]+)+([/?#].*)?$/.test(t)?`https://${t}`:null:null}var io={blue:`#e7f5ff`,green:`#ebfbee`,red:`#fff5f5`,orange:`#fff4e6`,violet:`#f3f0ff`,teal:`#e6fcf5`,pink:`#fff0f6`,yellow:`#fff9db`,gray:`#f8f9fa`},ao={blue:a.blue.bold,green:a.green.bold,red:a.red.bold,orange:a.orange.bold,violet:a.purple.bold,teal:a.teal.bold,pink:a.pink.bold,yellow:a.yellow.bold,gray:a.gray.bold},oo=`#1e1e1e`,X={ink:`token:ink`,inkMuted:`token:ink-muted`,inkInverse:`token:ink-inverse`,paper:`token:paper`,paperGrid:`token:paper-grid`,paperLine:`token:paper-line`},so={[X.ink]:{var:`var(--canvas-ink)`,key:`ink`,lit:`#1e1e1e`},[X.inkMuted]:{var:`var(--canvas-ink-muted)`,key:`inkMuted`,lit:`#495057`},[X.inkInverse]:{var:`var(--canvas-ink-inverse)`,key:`inkInverse`,lit:`#ffffff`},[X.paper]:{var:`var(--paper-bg)`,key:`paperBg`,lit:`#ffffff`},[X.paperGrid]:{var:`var(--paper-grid)`,key:`paperGrid`,lit:`#eceef0`},[X.paperLine]:{var:`var(--paper-line)`,key:`paperLine`,lit:`#dee2e6`}},co=Object.fromEntries(Object.values(so).map(e=>[e.key,e.lit]));function lo(e){return so[e]?.var??e}function uo(e){return e===void 0?void 0:lo(e)}function fo(e){return Object.values(so).find(t=>t.var===e)?.lit??e}function po(e,t){let n=so[e];return n?t?t[n.key]:n.lit:e}var mo={"#1e1e1e":X.ink,"#495057":X.inkMuted,"#ffffff":X.inkInverse},ho={"#ffffff":X.paper,"#eceef0":X.paperGrid,"#dee2e6":X.paperLine};function go(e){return mo[e]??e}function _o(e){return lo(go(e))}function vo(e){return e===X.inkInverse?X.ink:so[e]?X.paper:void 0}function yo(e,t){return po(go(e),t)}function bo(e){return uo(e===void 0?void 0:ho[e]??e)}function xo(e,t){return po(ho[e]??e,t)}var So=new Map(Object.keys(io).map(e=>[io[e],ao[e]]));function Co(e){if(e===`#ffffff`)return lo(X.paper);if(t(e,0)>.9){let t=So.get(e);return`color-mix(in srgb, ${e} var(--paper-tint-strength), ${t?`color-mix(in srgb, ${t} var(--paper-hue-strength), var(--canvas-bg))`:`var(--canvas-bg)`})`}return lo(e)}var wo=.08,To=.1;function Eo(e,n){if(e!==`#ffffff`&&t(e,0)>.9&&t(n.bg,1)<.5){let t=So.get(e);return jo(e,t?jo(t,n.bg,To):n.bg,wo)}return po(e===`#ffffff`?X.paper:e,n)}var Do=.32,Oo=.4;function ko(e){return{pastel:e.pastel,fill:`color-mix(in srgb, ${e.pastel} var(--node-pastel-strength), color-mix(in srgb, ${e.bold} var(--node-hue-strength), var(--canvas-bg)))`,stroke:`color-mix(in srgb, var(--canvas-ink) var(--node-stroke-ink), ${e.bold})`}}function Ao(e,n){return t(n.bg,1)>=.5?{pastel:e.pastel,fill:e.pastel,stroke:n.ink}:{pastel:e.pastel,fill:jo(e.bold,n.bg,Do),stroke:jo(n.ink,e.bold,Oo)}}function jo(e,t,n){let r=o(e),i=o(t);if(!r||!i)return t;let a=(e,t)=>Math.round(e*n+t*(1-n)).toString(16).padStart(2,`0`);return`#${a(r.r,i.r)}${a(r.g,i.g)}${a(r.b,i.b)}`}function Mo(e){return e&&t(e.paperBg,0)<.5?`screen`:`multiply`}function No(e,t,n,r,i,a){if(a&&e===`stroke`&&t===`#1e1e1e`)return a.stroke;if(a&&e===`fill`&&t===a.pastel)return a.fill;if(e===`stroke`)return r(t);if(e===`fill`){if(n===`paper`)return i(t);if(n===`ink`)return r(t)}return t}var Po=RegExp(`<(?:${[`strong`,`em`,`u`,`s`,`code`,`mark`,`a`,`span`,`i`,`b`,`del`,`strike`,`ul`,`ol`,`li`,`br`,`div`,`p`].join(`|`)})\\b`,`i`);function Fo(e){return Po.test(e)}function Io(e){return e.replace(/\u200B/g,``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function Lo(e){return Io(e).replace(/"/g,`&quot;`)}function Ro(e){return`<ul>${e.map(e=>`<li>${Io(e)}</li>`).join(``)}</ul>`}function zo(e){if(!e)return null;let t=e.trim().match(/^(\d+(?:\.\d+)?)px$/);if(!t)return null;let n=Math.round(Number(t[1]));return n<8||n>240?null:n}function Bo(e,t){return t===1?e:e.replace(/font-size:\s*(\d+(?:\.\d+)?)px/gi,(e,n)=>`font-size:${Math.round(c(Number(n)*t,8,240))}px`)}function Vo(e){if(!e)return null;let t=e.trim().toLowerCase();return/^#[0-9a-f]{3,8}$/.test(t)||/^rgba?\([\d.,\s%/]+\)$/.test(t)?t:null}function Ho(e){let t=``;return e.childNodes.forEach(e=>{t+=Wo(e)}),t}function Uo(e){let t=e.tagName.toLowerCase()===`ol`?`ol`:`ul`,n=t===`ul`&&e.hasAttribute(`data-checklist`),r=``;return e.childNodes.forEach(e=>{if(e.nodeType===1&&e.tagName.toLowerCase()===`li`){let t=n&&e.hasAttribute(`data-checked`);r+=`<li${t?` data-checked="true"`:``}>${Ho(e)}</li>`}}),r?`<${t}${n?` data-checklist="true"`:``}>${r}</${t}>`:``}function Wo(e){if(e.nodeType===3)return Io(e.nodeValue??``);if(e.nodeType!==1)return``;let t=e,n=t.tagName.toLowerCase();if(n===`br`)return`<br>`;let r=Ho(t);if(n===`em`||n===`i`)return r?`<em>${r}</em>`:``;if(n===`code`)return r?`<code>${r}</code>`:``;if(n===`mark`)return r?`<mark>${r}</mark>`:``;if(n===`b`||n===`strong`)return r?`<strong>${r}</strong>`:``;if(n===`u`)return r?`<u>${r}</u>`:``;if(n===`s`||n===`del`||n===`strike`)return r?`<s>${r}</s>`:``;if(n===`a`){let e=ro(t.getAttribute(`href`));return e&&r?`<a href="${Lo(e)}">${r}</a>`:r}if(n===`ul`||n===`ol`)return Uo(t);if(n===`span`){if(!r)return``;let e=r,n=t.style;n.fontStyle===`italic`&&(e=`<em>${e}</em>`),`${n.textDecorationLine} ${n.textDecoration}`.includes(`line-through`)&&(e=`<s>${e}</s>`),Vo(n.backgroundColor)&&(e=`<mark>${e}</mark>`);let i=Vo(n.color);i&&(e=`<span style="color:${i}">${e}</span>`);let a=zo(n.fontSize);return a&&(e=`<span style="font-size:${a}px">${e}</span>`),e}return r}function Go(e){let t=``,n=()=>t===``||/(?:<br>|\n|<\/ul>|<\/ol>)$/.test(t),r=()=>{n()||(t+=`<br>`)};return e.childNodes.forEach(e=>{if(e.nodeType===1){let n=e.tagName.toLowerCase();if(n===`div`||n===`p`){r(),t+=Ho(e);return}if(n===`ul`||n===`ol`){t+=Uo(e);return}}t+=Wo(e)}),t}function Ko(){return Promise.resolve()}function qo(){return globalThis.DOMParser!==void 0}function Jo(e){let t=globalThis.DOMParser;if(!t)throw Error(`No HTML parser available: this environment has no global DOMParser. Install one with setHtmlParser (see @koboyo/renderer/adapters/node).`);return new t().parseFromString(e,`text/html`).body}function Yo(e){return Jo(e)}function Xo(e){return Go(Yo(e))}function Zo(e){return e?Fo(e)?Xo(e).replaceAll(`<a href="`,`<a target="_blank" rel="noopener noreferrer" href="`).replace(/<span style="color:([^"]+)">/g,(e,t)=>{let n=go(Qo(t));return n.startsWith(`token:`)?`<span data-ink="${n.slice(6)}" style="color:${t}">`:e}):Io(e):``}function Qo(e){let t=/^rgba?\((\d+),\s*(\d+),\s*(\d+)\)$/.exec(e);return t?`#${t.slice(1).map(e=>Number(e).toString(16).padStart(2,`0`)).join(``)}`:e}function $o(e,t=0){let n=``;return e.childNodes.forEach(e=>{if(e.nodeType===3){n+=(e.nodeValue??``).replace(/\u200B/g,``);return}if(e.nodeType!==1)return;let r=e,i=r.tagName.toLowerCase();if(i===`br`){n+=`
2
- `;return}if(i===`li`){n&&!n.endsWith(`
3
- `)&&(n+=`
4
- `);let e=r.parentElement?.hasAttribute(`data-checklist`)?r.hasAttribute(`data-checked`)?`☑`:`☐`:`•`;n+=`${` `.repeat(Math.max(0,t-1))}${e} ${$o(r,t)}`;return}if(i===`div`||i===`p`||i===`ul`||i===`ol`){n&&!n.endsWith(`
5
- `)&&(n+=`
6
- `),n+=$o(r,i===`ul`||i===`ol`?t+1:t);return}n+=$o(r,t)}),n}function es(e){return e?Fo(e)?$o(Yo(e)):e:``}function ts(e){return es(e).trim().length===0}function ns(e){return Fo(e)?e.replace(/\u200B/g,``).replace(/<(?:br|\/li|\/div|\/p|\/ul|\/ol)[^>]*>/gi,`
7
- `).replace(/<li[^>]*>/gi,`• `).replace(/<[^>]+>/g,``).replace(/&[a-z#0-9]+;/gi,`*`).replace(/\n+/g,`
8
- `).replace(/^\n|\n$/g,``):e}function rs(e){return qo()?es(e):ns(e)}function is(e){if(!e||!Fo(e))return e;let t=Yo(e);return t.querySelectorAll(`span`).forEach(e=>{e.style.color=``}),Go(t)}function as(e,t){let n=Yo(Zo(e)),r=n.querySelectorAll(`ul[data-checklist] > li`)[t];return r?(r.hasAttribute(`data-checked`)?r.removeAttribute(`data-checked`):r.setAttribute(`data-checked`,`true`),Go(n)):null}function os(e,t){let n=e=>t===`strong`?e.bold:t===`em`?e.italic:t===`u`?e.underline:e.strike,r=!1;for(let t of ds(e))for(let e of t.runs)if(e.text.trim()!==``&&(r=!0,!n(e)))return!1;return r}function ss(e,t){let n=e.parentElement;for(;n;){if(n.tagName.toLowerCase()===t)return!0;n=n.parentElement}return!1}function cs(e,t,n){if(n)return ls(e,t)??e;let r=Yo(Zo(e));return r.querySelectorAll(t).forEach(e=>{let t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}),Go(r)}function ls(e,t,n={}){let r=Yo(Zo(e)),i=[],a=e=>{e.childNodes.forEach(e=>{e.nodeType===3?(e.nodeValue??``).length>0&&i.push(e):e.nodeType===1&&a(e)})};a(r);let o=0,s=1/0;if(n.match!==void 0){let e=i.map(e=>e.nodeValue??``).join(``),t=n.match?e.toLowerCase().indexOf(n.match.toLowerCase()):-1;if(t<0)return null;o=t,s=t+n.match.length}let c=r.ownerDocument;if(!c)return Go(r);let l=0;for(let e of i){let r=e.nodeValue??``,i=Math.max(0,o-l),a=Math.min(r.length,s-l);l+=r.length;let u=e.parentNode;if(i>=a||!u||t!==`span`&&ss(e,t))continue;let d=c.createElement(t);for(let[e,t]of Object.entries(n.attributes??{}))d.setAttribute(e,t);d.appendChild(c.createTextNode(r.slice(i,a))),i>0&&u.insertBefore(c.createTextNode(r.slice(0,i)),e),u.insertBefore(d,e),a<r.length&&u.insertBefore(c.createTextNode(r.slice(a)),e),u.removeChild(e)}return Go(r)}var us={bold:!1,italic:!1,underline:!1,strike:!1,code:!1,highlight:!1};function ds(e){let t=Yo(Zo(e)),n=[{runs:[]}],r=0,i=(e,t)=>{n.push({runs:[],marker:e,checked:t||void 0,depth:r||void 0})},a=(e,t)=>{let a=n[n.length-1];if(a.runs.length===0&&!a.marker){a.marker=e,a.checked=t||void 0,a.depth=r||void 0;return}i(e,t)},o=(e,t)=>{e.split(`
9
- `).forEach((e,r)=>{r>0&&i(),e&&n[n.length-1].runs.push({text:e,...t})})},s=(e,t)=>{e.childNodes.forEach(e=>{if(e.nodeType===3){o((e.nodeValue??``).replace(/\u200B/g,``),t);return}if(e.nodeType!==1)return;let c=e,l=c.tagName.toLowerCase();if(l===`br`){i();return}if(l===`em`||l===`i`){s(c,{...t,italic:!0});return}if(l===`strong`||l===`b`){s(c,{...t,bold:!0});return}if(l===`u`){s(c,{...t,underline:!0});return}if(l===`s`||l===`del`||l===`strike`){s(c,{...t,strike:!0});return}if(l===`code`){s(c,{...t,code:!0});return}if(l===`mark`){s(c,{...t,highlight:!0});return}if(l===`a`){s(c,{...t,href:ro(c.getAttribute(`href`))??t.href});return}if(l===`span`){s(c,{...t,color:Vo(c.style.color)??t.color,fontSize:zo(c.style.fontSize)??t.fontSize});return}if(l===`ul`||l===`ol`){let e=l===`ul`&&c.hasAttribute(`data-checklist`),n=1;c.childNodes.forEach(i=>{i.nodeType===1&&i.tagName.toLowerCase()===`li`&&(e?a({kind:`checkbox`},i.hasAttribute(`data-checked`)):a(l===`ol`?{kind:`number`,text:`${n++}.`}:{kind:`bullet`}),r+=1,s(i,t),--r)}),i();return}if(l===`div`||l===`p`){(n[n.length-1].runs.length>0||n[n.length-1].marker)&&i(),s(c,t);return}s(c,t)})};for(s(t,us);n.length>1;){let e=n[n.length-1];if(e.runs.length===0&&!e.marker)n.pop();else break}return n}var fs=`93B[bw]4ABK]0B2IVCVYXUXMVU23]]]OuX_bc]Wec<R[UpefZhbXWcYtTVXBG?PY1TTQUW<US56M4lTTUVAM<SL^KILG3Ga`,ps=32,ms=126,hs=.55,gs=1;function _s(e){return e>=11904&&e<=42191||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65280&&e<=65376||e>=126976}function vs(e,t){let n=0;for(let t of e){let e=t.codePointAt(0)??0;if(e>=ps&&e<=ms){n+=(fs.charCodeAt(e-ps)-32)/100;continue}n+=_s(e)?gs:hs}return n*t}var ys={rectangle:{geometry:`box`,color:!0,fill:!0,stroke:!0,dash:!0,font:`stored`,arrowEnds:!1,textField:`label`,edit:`text`,search:`label`,hit:`bounds`,animate:`box`,rotatable:!0},arrow:{geometry:`connector`,color:!0,fill:!1,stroke:!0,dash:!0,font:`optional`,arrowEnds:!0,textField:`label`,edit:`text`,search:`label`,hit:`stroke`,animate:`path`,rotatable:!0},text:{geometry:`text`,color:!0,fill:!1,stroke:!1,dash:!1,font:`stored`,arrowEnds:!1,textField:`text-or-delete`,edit:`text`,search:`text`,hit:`bounds`,animate:`text`,rotatable:!0},sticky:{geometry:`box`,color:!1,fill:!0,stroke:!1,dash:!1,font:`stored`,arrowEnds:!1,textField:`text`,edit:`text`,search:`text`,hit:`bounds`,animate:`text`,rotatable:!0},draw:{geometry:`points`,color:!0,fill:!1,stroke:!0,dash:!1,font:`none`,arrowEnds:!1,textField:`text-or-delete`,edit:`none`,search:`none`,hit:`stroke`,animate:`path`,rotatable:!0},polygon:{geometry:`points`,color:!0,fill:!0,stroke:!0,dash:!1,font:`none`,arrowEnds:!1,textField:`text-or-delete`,edit:`vertices`,search:`none`,hit:`bounds`,animate:`box`,rotatable:!0},line:{geometry:`points`,color:!0,fill:!1,stroke:!0,dash:!0,font:`optional`,arrowEnds:!0,textField:`label`,edit:`none`,search:`label`,hit:`stroke`,animate:`path`,rotatable:!0},image:{geometry:`box`,color:!1,fill:!1,stroke:!1,dash:!1,font:`none`,arrowEnds:!1,textField:`text-or-delete`,edit:`crop`,search:`none`,hit:`bounds`,animate:`box`,rotatable:!0},icon:{geometry:`box`,color:!0,fill:!1,stroke:!0,dash:!1,font:`stored`,arrowEnds:!1,textField:`label`,edit:`none`,search:`label-and-name`,hit:`bounds`,animate:`box`,rotatable:!0},figure:{geometry:`box`,color:!0,fill:!1,stroke:!1,dash:!1,font:`none`,arrowEnds:!1,textField:`label`,edit:`none`,search:`label`,hit:`outline`,animate:`box`,rotatable:!1},table:{geometry:`table`,color:!0,fill:!1,stroke:!1,dash:!1,font:`stored`,arrowEnds:!1,textField:`text-or-delete`,edit:`none`,search:`cells`,hit:`bounds`,animate:`box`,rotatable:!1},chart:{geometry:`box`,color:!0,fill:!1,stroke:!1,dash:!1,font:`stored`,arrowEnds:!1,textField:`text-or-delete`,edit:`none`,search:`cells`,hit:`bounds`,animate:`box`,rotatable:!0},control:{geometry:`box`,color:!0,fill:!1,stroke:!1,dash:!1,font:`stored`,arrowEnds:!1,textField:`label`,edit:`none`,search:`label`,hit:`bounds`,animate:`box`,rotatable:!0},web:{geometry:`box`,color:!1,fill:!1,stroke:!1,dash:!1,font:`none`,arrowEnds:!1,textField:`label`,edit:`interact`,search:`label`,hit:`bounds`,animate:`box`,rotatable:!1}};function bs(e){return e.type===`control`&&e.kind===`lifeline`?!1:ys[e.type].rotatable}function xs(e){return ys[e.type].geometry===`box`}function Ss(e){return ys[e.type].fill}function Cs(e){return e.type===`figure`||e.type===`control`}function ws(e){return{strokeWidth:e.strokeWidth??1.5,dash:e.dash??`solid`}}var Ts={fade:[`box`,`path`,`text`],rise:[`box`,`path`,`text`],scale:[`box`,`path`,`text`],pop:[`box`,`path`,`text`],blur:[`box`,`path`,`text`],wipe:[`box`,`path`,`text`],draw:[`path`],type:[`text`],pulse:[`box`,`path`,`text`],shake:[`box`,`path`,`text`],glow:[`box`,`path`,`text`]};function Es(e,t){return Ts[t].includes(ys[e.type].animate)}var Ds={fade:[`enter`,`exit`],rise:[`enter`,`exit`],scale:[`enter`,`exit`],pop:[`enter`],blur:[`enter`,`exit`],wipe:[`enter`,`exit`],draw:[`enter`,`exit`],type:[`enter`,`exit`],pulse:[`emphasis`],shake:[`emphasis`],glow:[`emphasis`]};function Os(e,t){return Ds[e]?.includes(t)??!1}function ks(e){return e.type===`rectangle`&&e.fill===`transparent`}function As(e){throw Error(`Unhandled shape type: ${e.type??`unknown`}`)}function Z(e,t){if(xs(e))return{x:Math.min(e.x,e.x+e.width),y:Math.min(e.y,e.y+e.height),width:Math.abs(e.width),height:Math.abs(e.height)};if(e.type===`arrow`)return gn(e);if(e.type===`draw`||e.type===`polygon`||e.type===`line`)return Fa(e.points);if(e.type===`table`)return{x:e.x,y:e.y,width:e.colWidths.reduce((e,t)=>e+t,0),height:e.rowHeights.reduce((e,t)=>e+t,0)};if(e.type===`text`){let n=t?.textBounds(e.id);if(n)return{x:e.x,y:e.y,width:n.width,height:n.height};let r=ns(e.text).split(`
10
- `),i=r.reduce((e,t)=>Math.max(e,t.length),0);return{x:e.x,y:e.y,width:e.width??Math.max(i*e.fontSize*.55,e.fontSize),height:Math.max(r.length*e.fontSize*(e.lineHeight??1.15),e.height??0)}}return As(e)}function js(e,t,n){let r=Math.cos(n),i=Math.sin(n),a=e.x-t.x,o=e.y-t.y;return{x:t.x+a*r-o*i,y:t.y+a*i+o*r}}function Ms(e){let t=Z(e);return{x:t.x+t.width/2,y:t.y+t.height/2}}function Ns(e){return bs(e)&&(xs(e)||e.type===`text`||e.type===`table`)?e.rotation??0:0}function Ps(e){return bs(e)&&(xs(e)||e.type===`text`||e.type===`table`)}function Fs(e){return Math.max(2,Math.round(e*.2))}function Is(e,t){let n=Z(e,t);if(e.type===`icon`&&e.label){let r=n.x+n.width/2,i=e.fontSize??36,a,o,s=t?.iconLabelBounds(e.id);if(s)a=s.width,o=s.height;else{let t=rs(e.label).split(`
11
- `),n=Math.max(i*.58,...t.map(e=>vs(e,i)));a=Math.min(n,200),o=Math.round(i*1.45+(t.length-1)*i*Xa)}let c=Math.min(n.x,r-a/2),l=Math.max(n.x+n.width,r+a/2),u=n.y+n.height+Fs(i)+o;return{x:c,y:n.y,width:l-c,height:u-n.y}}return n}var Ls=new WeakMap;function Rs(e){return e.type===`text`||e.type===`icon`&&!!e.label}function zs(e,t){if(Rs(e))return Bs(e,t);let n=Ls.get(e);if(n)return n;let r=Bs(e);return Ls.set(e,r),r}function Bs(e,t){let n=Is(e,t),r=Ns(e);if(!r)return n;let i=Z(e,t);return Vs(n,{x:i.x+i.width/2,y:i.y+i.height/2},r*Math.PI/180)}function Vs(e,t,n){let r=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}].map(e=>js(e,t,n)),i=r.map(e=>e.x),a=r.map(e=>e.y),o=Math.min(...i),s=Math.min(...a);return{x:o,y:s,width:Math.max(...i)-o,height:Math.max(...a)-s}}function Hs(e,t){if(!t)return e;let n=t*Math.PI/180;return Vs(e,{x:e.x+e.width/2,y:e.y+e.height/2},n)}var Us=new WeakMap;function Ws(e){let t=Us.get(e);if(t)return t;let n=Gs(e);return Us.set(e,n),n}function Gs(e){return Hs(Z(e),Ns(e))}function Ks(e){return Number.isFinite(Ns(e))&&l(Z(e))}function qs(e){for(let t of e)if(!Ks(t))return e.filter(Ks);return e}function Js(e,t){if(e.length===0)return null;let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let o of e){let e=zs(o,t);l(e)&&(n=Math.min(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x+e.width),a=Math.max(a,e.y+e.height))}return n===1/0?null:{x:n,y:r,width:i-n,height:a-r}}function Ys(e){return{x:e.includes(`e`)?1:e.includes(`w`)?-1:0,y:e.includes(`s`)?1:e.includes(`n`)?-1:0}}function Xs(e,t,n){return Math.max(0,(e-t)*n)}function Zs(e,t,n,r){let i=e.x,a=e.y,o=e.x+e.width,s=e.y+e.height;t.includes(`w`)&&(i=n.x),t.includes(`e`)&&(o=n.x),t.includes(`n`)&&(a=n.y),t.includes(`s`)&&(s=n.y);let c=r?.width??0,l=r?.height??0;return o-i<c&&(t.includes(`w`)?i=o-c:o=i+c),s-a<l&&(t.includes(`n`)?a=s-l:s=a+l),{x:Math.min(i,o),y:Math.min(a,s),width:Math.abs(o-i),height:Math.abs(s-a)}}function Qs(e,t,n,r,i=!1){let{box:a,fontSize:o,width:s,height:l}=r,u=a.x+a.width/2,d=a.y+a.height/2,f=Ys(t);if(t===`n`||t===`s`){let r=t===`s`?a.y:a.y+a.height,i=Math.max(o,Xs(n.y,r,f.y));return{...e,y:f.y===1?r:r-i,height:i}}if(t===`w`||t===`e`){if(i){let t=Math.abs(n.x-u);return{...e,x:u-t,width:Math.max(o,t*2)}}let r=t===`e`?a.x:a.x+a.width,s=Math.max(o,Xs(n.x,r,f.x));return{...e,x:f.x===1?r:r-s,width:s}}let p=t===`ne`||t===`se`?a.x:a.x+a.width,m=t===`sw`||t===`se`?a.y:a.y+a.height,h=c(o*(i?Math.max(Math.abs(n.x-u)/(a.width/2||1),Math.abs(n.y-d)/(a.height/2||1)):Math.max(Xs(n.x,p,f.x)/(a.width||1),Xs(n.y,m,f.y)/(a.height||1))),8,240),g=h/o,_=a.width*g,v=a.height*g,y={...e,fontSize:h,text:Bo(e.text,g)};return i?(y.x=u-_/2,y.y=d-v/2):(y.x=p===a.x?a.x:p-_,y.y=m===a.y?a.y:m-v),s!=null&&(y.width=s*g),l!=null&&(y.height=l*g),y}function $s(e){return e.height==null?e.width==null?`auto-width`:`auto-height`:`fixed`}function ec(e,t){let n=Z(e);if(t===`auto-width`){if(e.width==null&&e.height==null)return e;let t={...e};return delete t.width,delete t.height,t}if(t===`auto-height`){if(e.width!=null&&e.height==null)return e;let t={...e};return delete t.height,t.width??=n.width,t}return e.width!=null&&e.height!=null?e:{...e,width:e.width??n.width,height:e.height??n.height}}function tc(e,t){if(e.type===`arrow`){let n={...e,x:e.x+t.x,y:e.y+t.y,x2:e.x2+t.x,y2:e.y2+t.y};return e.elbowPoints&&(n.elbowPoints=e.elbowPoints.map(e=>({x:e.x+t.x,y:e.y+t.y}))),e.elbowRoute&&(n.elbowRoute=e.elbowRoute.map(e=>({x:e.x+t.x,y:e.y+t.y}))),e.elbowMidHandle&&(n.elbowMidHandle={...e.elbowMidHandle,x:e.elbowMidHandle.x+t.x,y:e.elbowMidHandle.y+t.y}),n}return e.type===`draw`||e.type===`polygon`||e.type===`line`?{...e,points:e.points.map(e=>({x:e.x+t.x,y:e.y+t.y}))}:xs(e)||e.type===`text`||e.type===`table`?{...e,x:e.x+t.x,y:e.y+t.y}:As(e)}function nc(e,t,n){if(e.type===`arrow`){let r=js({x:e.x,y:e.y},t,n),i=js({x:e.x2,y:e.y2},t,n);return{...e,x:r.x,y:r.y,x2:i.x,y2:i.y,elbowPoints:void 0,elbowRoute:void 0,elbowMidHandle:void 0}}if(e.type===`draw`||e.type===`polygon`||e.type===`line`)return{...e,points:e.points.map(e=>js(e,t,n))};let r=Z(e),i=js({x:r.x+r.width/2,y:r.y+r.height/2},t,n),a={...e,x:i.x-r.width/2,y:i.y-r.height/2};return bs(e)?{...a,rotation:(e.rotation??0)+n*180/Math.PI}:a}function rc(e,t,n,r){let i=e=>t.x+(e-t.x)*n,a=e=>t.y+(e-t.y)*r;if(e.type===`arrow`)return{...e,x:i(e.x),y:a(e.y),x2:i(e.x2),y2:a(e.y2),bend:e.bend*(n+r)*.5,bow:e.bow==null?e.bow:e.bow*(n+r)*.5,elbowPoints:e.elbowPoints?.map(e=>({x:i(e.x),y:a(e.y)})),elbowRoute:void 0,elbowMidHandle:void 0};if(e.type===`text`){let t={...e,x:i(e.x),y:a(e.y),fontSize:e.fontSize*r,text:Bo(e.text,r)};return e.width!=null&&(t.width=e.width*n),t}if(e.type===`draw`||e.type===`polygon`||e.type===`line`)return{...e,points:e.points.map(e=>({x:i(e.x),y:a(e.y)}))};if(e.type===`table`)return{...e,x:i(e.x),y:a(e.y),colWidths:e.colWidths.map(e=>e*n),rowHeights:e.rowHeights.map(e=>e*r)};if(e.type===`sticky`){let t=Z(e),n=i(t.x+t.width/2),r=a(t.y+t.height/2);return{...e,x:n-t.width/2,y:r-t.height/2}}if(e.type===`icon`){let t=Z(e),o=(n+r)/2;return{...e,x:i(t.x),y:a(t.y),width:t.width*o,height:t.height*o,fontSize:e.fontSize*o}}let o=Z(e);return{...e,x:i(o.x),y:a(o.y),width:o.width*n,height:o.height*r}}function ic(e,t){let n=Js(e);if(!n)return e;let r=t===`horizontal`,i=new Set(e.map(e=>e.id)),a=n.x+n.width/2,o=n.y+n.height/2,s=e=>r?2*a-e:e,c=e=>r?e:2*o-e,l=e=>({x:s(e.x),y:c(e.y)});return e.map(e=>{if(e.type===`arrow`){let t=l({x:e.x,y:e.y}),n=l({x:e.x2,y:e.y2});return{...e,x:t.x,y:t.y,x2:n.x,y2:n.y,bend:-e.bend,bow:e.bow==null?e.bow:-e.bow,elbowPoints:e.elbowPoints?.map(l),elbowRoute:void 0,elbowMidHandle:void 0,startBinding:sc(e.startBinding,i,r),endBinding:sc(e.endBinding,i,r)}}if(e.type===`polygon`&&e.band)return{...e,points:e.points.map(l),band:cc(e.band,i,r)};if(e.type===`draw`||e.type===`polygon`||e.type===`line`)return{...e,points:e.points.map(l)};let t=Z(e),n=l({x:t.x+t.width/2,y:t.y+t.height/2}),a={...e,x:n.x-t.width/2,y:n.y-t.height/2,rotation:-Ns(e)};if(a.type===`text`||a.type===`icon`||a.type===`image`)return{...a,flipX:r?!a.flipX:a.flipX,flipY:r?a.flipY:!a.flipY};if(a.type===`rectangle`){let e=Ui(a.kind),t=r&&e.x?!a.flipX:a.flipX,n=!r&&e.y?!a.flipY:a.flipY;return{...a,flipX:t||void 0,flipY:n||void 0}}return a})}var ac={n:`n`,s:`s`,e:`w`,w:`e`,ne:`nw`,nw:`ne`,se:`sw`,sw:`se`},oc={n:`s`,s:`n`,e:`e`,w:`w`,ne:`se`,se:`ne`,nw:`sw`,sw:`nw`};function sc(e,t,n){if(!e)return e;if(!t.has(e.shapeId))return null;if(`kind`in e)return e;let r=n?{x:1-e.anchor.x,y:e.anchor.y}:{x:e.anchor.x,y:1-e.anchor.y};if(!e.port)return{...e,anchor:r};let i=n?ac:oc;return{...e,anchor:r,port:i[e.port]}}function cc(e,t,n){if(!(!t.has(e.from)||!t.has(e.to)))return n?{from:e.to,to:e.from,fromTop:e.toTop,fromSpan:e.toSpan,toTop:e.fromTop,toSpan:e.fromSpan}:{...e,fromTop:1-e.fromTop-e.fromSpan,toTop:1-e.toTop-e.toSpan}}function lc(e,t){return e.map(e=>({...e,steps:e.steps.flatMap(e=>{let n=t(e.target);if(!n)return[];let r={...e,target:n};if(e.also){let n=e.also.flatMap(e=>t(e)??[]);n.length>0?r.also=n:delete r.also}return[r]})}))}var uc={width:160,height:100};function dc(e){return e===`drawnicons`?96:55}function fc(e,t){return!Number.isFinite(t)||t<=0||t===1?{width:e,height:e}:t>1?{width:e,height:e/t}:{width:e*t,height:e}}function pc(e,t){return Math.max(0,t)/55*e}function mc(e,t){return(e-3)*(Math.max(0,t)/55)}function hc(e){return e===`ellipse`?{width:120,height:120}:e===`checkbox`||e===`crossbox`||e===`heart`||e===`plus`?{width:110,height:110}:e===`arrow-up`||e===`arrow-down`?{width:100,height:160}:e===`bolt`?{width:110,height:150}:e===`actor`?{width:100,height:150}:e===`arrow-left`||e===`arrow-right`?{width:160,height:100}:e===`queue`?{width:170,height:80}:e===`callout`?{width:180,height:90}:e===`double-circle`?{width:120,height:120}:e===`fork-join`?{width:160,height:26}:uc}function gc(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`shape-${Date.now()}-${Math.floor(Math.random()*1e6)}`}function _c(e){return{id:gc(),type:`rectangle`,kind:`rectangle`,rotation:0,label:``,fontSize:16,fontFamily:_,color:d,fill:`transparent`,strokeWidth:1.5,dash:`solid`,opacity:1,...e}}function vc(e,t){if(!e)return null;let n=t.get(e.shapeId);return n?{...e,shapeId:n}:null}function yc(e,t){let n=new Map,r=new Map,i=new Map,a=new Map;for(let t of e)n.set(t.id,gc()),t.groupId&&i.set(t.groupId,(i.get(t.groupId)??0)+1),t.groupId&&!r.has(t.groupId)&&r.set(t.groupId,gc()),t.lockId&&!a.has(t.lockId)&&a.set(t.lockId,gc());return e.map(e=>{let o={...tc(e,t),id:n.get(e.id)};return o.groupId&&=(i.get(o.groupId)??0)>1?r.get(o.groupId):void 0,o.lockId&&=a.get(o.lockId),o.type===`arrow`&&(o.startBinding=vc(o.startBinding,n),o.endBinding=vc(o.endBinding,n)),o.type===`figure`&&o.flows&&(o.flows=lc(o.flows,e=>n.get(e))),o})}function bc(e,t){let n=e.width/(t.width||1),r=e.height/(t.height||1);return{x:e.x-t.x*n,y:e.y-t.y*r,width:n,height:r}}var xc=2;function Sc(e,t){return e===`rounded`?Math.min(12,Math.abs(t.width)/2,Math.abs(t.height)/2):xc}var Cc=Mr.generator(),wc=1,Tc=1,Ec=.45,Dc=.2,Oc=250,kc=.5;function Ac(e){return e<=Oc?1:Math.max(kc,Oc/e)}var jc=.3,Mc=220,Nc=.35;function Pc(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)%2**31}var Fc=2e3,Ic=new Map;function Lc(e,t){Ic.size>=Fc&&Ic.delete(Ic.keys().next().value),Ic.set(e,t)}function Rc(e,t,n,r=wc,i=Tc){let a=`${t}|${n}|${r}|${i}|${e}`,o=Ic.get(a);if(o)return o;let s=Cc.path(e,{seed:t,roughness:r,bowing:i,disableMultiStroke:!0,preserveVertices:!0,strokeWidth:n}),c=Cc.toPaths(s).map(e=>e.d);return Lc(a,c),c}function zc(e){let t=Z(e),n={x:0,y:0,width:t.width,height:t.height},r=Wi(e.kind,n,e.corner,{x:e.flipX,y:e.flipY}),i=c(Math.min(t.width,t.height)/Mc,Nc,1);return Rc(r,Pc(e.id),e.strokeWidth,wc*i,jc*i)}function Bc(e,t,n){let r=Pc(t.id)+n;if(n>0)return Rc(e,r,1.5,.5,jc);let i=Z(t),a=c(Math.min(i.width,i.height)/Mc,Nc,1);return Rc(e,r,1.5,wc*a,jc*a)}function Vc(e,t,n,r,i){let a=Pc(r.id)+i,o=`disc|${a}|${e.toFixed(1)}|${t.toFixed(1)}|${n.toFixed(1)}`,s=Ic.get(o);if(s)return s;let c=Cc.circle(e,t,n*2,{seed:a,roughness:wc,bowing:Tc,fill:`#000000`,fillStyle:`solid`,stroke:`none`,disableMultiStroke:!0}),l=Cc.toPaths(c).filter(e=>e.fill&&e.fill!==`none`).map(e=>e.d);return Lc(o,l),l}function Hc(e,t,n,r){let i=Z(t),a=c(Math.min(i.width,i.height)/Mc,Nc,1);return Rc(e,Pc(t.id)+n,r,wc*a,jc*a)}function Uc(e){return e.bendStyle===`elbow`?f(P(e)):Math.hypot(e.x2-e.x,e.y2-e.y)+Math.abs(e.bend)}function Wc(e){let t=Ac(Uc(e));return Rc(un(e),Pc(e.id),e.strokeWidth,Ec*t,Dc*t)}function Gc(e){let t=Ac(f(e.points));return Rc(bn(e.points),Pc(e.id),e.strokeWidth,Ec*t,Dc*t)}var Kc=`#8a8f98`,qc=2,Jc=1.5,Yc=`#4dabf7`;function Q(e,t,n,r=qc,i){return Hc(t,e.shape,e.nextSalt(),r).map(e=>({kind:`path`,d:e,stroke:n,width:r,testId:i}))}function Xc(e,t,n,r){return[{kind:`rect`,x:t.x,y:t.y,width:t.width,height:t.height,rx:n,fill:r},...Q(e,V(t.x,t.y,t.width,t.height,n),e.ink)]}function Zc(e,t,n,r,i,a={}){return{kind:`text`,x:t,y:n,text:r,size:a.size??e.shape.fontSize,color:i,family:e.shape.fontFamily,anchor:a.anchor??`start`,baseline:a.baseline??`middle`,testId:a.testId}}function Qc(e,t,n){return e.text.measure(t,n??e.shape.fontSize,e.shape.fontFamily)}function $c(e){return!e.fill||e.fill===`transparent`?null:e.fill}var el=1.6,tl=.85,nl=.85;function rl(e){return Math.min(7,e.height*.18)}function il(e){return 12+rl(e)*2+12}function al(e){return Math.min(26,e.height)}function ol(e){return al(e)*1.9+10}function sl(e){return Math.min(e.height,e.width/3)}function cl(e){return Math.min(e.height*.28,13)}function ll(e){return cl(e)*2+24}function ul(e,t){let n=[],r=``;for(let i of e.split(/\s+/)){let e=r.length===0?i:`${r} ${i}`;e.length>t&&r.length>0?(n.push(r),r=i):r=e}return r.length>0&&n.push(r),n}function dl(e,t,n){let r=n*.52;return ul(e,Math.max(4,Math.floor(t/r)))}function fl(e,t,n){return e.split(/\r?\n/).flatMap(e=>e?dl(e,t,n):[``])}var pl=`#e7f5ff`;function ml(e,t){let n=$c(e.shape);if(!n)return[];let{bounds:r}=e;return[{kind:`rect`,x:r.x,y:r.y,width:r.width,height:r.height,rx:t,fill:n}]}function hl(e,t){let{bounds:n,ink:r}=e,i=ml(e,t);return i.push(...Q(e,V(n.x,n.y,n.width,n.height,t),r)),i}function gl(e){return e.split(` | `).map(e=>e.trim()).filter(e=>e.length>0)}function _l(e,t){return t===0?0:Math.max(0,Math.min(t-1,Math.round(e.value??0)))}var vl=`+id: string
12
- +name: string
13
- ---
14
- +save()
15
- +delete()`,yl=1.9,bl=1.4,xl=/^-{2,}$/;function Sl(e){return(e??``).split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0)}function Cl(e){return Sl(e.body).map(e=>({text:e,divider:xl.test(e)}))}function wl(e){return Cl(e).filter(e=>!e.divider).map(e=>e.text)}function Tl(e){let t=e.fontSize*.9;return{fontSize:t,lineH:t*bl}}function El(e){let t=Z(e),n=wl(e).length===0?t.height:Math.min(t.height,e.fontSize*yl),r=t.x+12,i=t.width-24,{fontSize:a}=Tl(e),o=t.y+n+4,s=t.y+t.height-4;return{title:{field:`label`,x:t.x,y:t.y,width:t.width,height:n,fontSize:e.fontSize},body:{field:`body`,x:r,y:o,width:i,height:Math.max(a,s-o),fontSize:a}}}function Dl(e,t,n){let r=n*.9,i=r*bl,a=n*yl,o=Math.round(a+4+t.length*i+8),s=(e,t)=>e.length*t*.62,c=Math.max(s(e,n),0,...t.filter(e=>!xl.test(e)).map(e=>s(e,r)));return{width:Math.max(160,Math.round(c+24+16)),height:o}}function Ol(e){let t=El(e),{lineH:n}=Tl(e),r=Z(e).y+e.height;return Cl(e).map((e,r)=>({text:e.text,cy:t.body.y+n*(r+.5),divider:e.divider})).filter(e=>e.cy<=r)}function kl(e){let t=Z(e);return Ol(e).filter(e=>!e.divider).map(({cy:e})=>({cy:e,left:{x:t.x,y:e},right:{x:t.x+t.width,y:e}}))}function Al(t){let{bounds:n,shape:r,ink:i}=t,a=El(r),o=n.y+a.title.height,s=wl(r).length>0,c=$c(r),l=[];c&&l.push({kind:`path`,d:s?Nr(n.x,n.y,n.width,a.title.height,6):V(n.x,n.y,n.width,n.height,6),fill:c,testId:`entity-header`}),l.push(...Q(t,V(n.x,n.y,n.width,n.height,6),i)),s&&l.push(...Q(t,Fr(n.x,o,n.x+n.width,o),i,Jc));let u=r.label.trim();u&&l.push(Zc(t,n.x+n.width/2,n.y+a.title.height/2,u,c?e(c):i,{anchor:`middle`,testId:`entity-title`}));for(let{text:e,cy:o,divider:s}of Ol(r)){if(s){l.push(...Q(t,Fr(n.x,o,n.x+n.width,o),i,Jc,`entity-divider`));continue}l.push(Zc(t,a.body.x,o,e,i,{size:a.body.fontSize,testId:`entity-row`}))}return l}function jl(e){return Math.min(e.height,Ml(e.fontSize))}function Ml(e){return e*2.4}var Nl=12;function Pl(e){if(!e.activations||e.activations.length===0)return[];let t=jl(e),n=e.height;return e.activations.map(r=>{let i=Math.min(Math.max(r.top,t),Math.max(t,n-12)),a=Math.max(12,Math.min(r.height,n-i));return{x:e.x+e.width/2-Nl/2,y:e.y+i,width:Nl,height:a}})}function Fl(e,t){for(let n of Pl(e))if(t>=n.y&&t<=n.y+n.height)return n;return null}function Il(e){let t=jl(e);return{x:e.x+e.width/2,y:e.y+t,width:0,height:Math.max(2,e.height-t)}}function Ll(e){let t=jl(e),n=Math.max(0,e.height-t),r=Math.min(Math.max(n*.12,16),64);return{top:t+r,height:Math.max(12,n-r*2)}}function Rl(e){let t=Pl(e);if(t.length===0)return Ll(e);let n=jl(e),r=t.map(t=>({top:t.y-e.y,bottom:t.y-e.y+t.height})).sort((e,t)=>e.top-t.top),i=[],a=n;for(let e of r)e.top>a&&i.push({start:a,end:e.top}),a=Math.max(a,e.bottom);a<e.height&&i.push({start:a,end:e.height});let o=i.sort((e,t)=>t.end-t.start-(e.end-e.start))[0];if(!o)return{top:Math.max(n,e.height-12),height:12};let s=o.end-o.start,c=Math.min(Math.max(s*.15,10),48);return{top:o.start+c,height:Math.max(12,s-c*2)}}var zl=12,Bl=7,Vl=1.5;function Hl(t){let n=$c(t);return n?e(n):null}function Ul(e){let{bounds:t,shape:n,ink:r}=e,i=jl(n),a=t.x+t.width/2,o=$c(n)??X.paper,s=Xc(e,{x:t.x,y:t.y,width:t.width,height:i},6,o);n.label.trim()&&s.push(Zc(e,a,t.y+i/2,n.label.trim(),Hl(n)??r,{anchor:`middle`,testId:`lifeline-name`}));let c=t.y+t.height;for(let e=t.y+i;e<c;e+=zl)s.push({kind:`line`,x1:a,y1:e,x2:a,y2:Math.min(e+Bl,c),stroke:r,width:Vl});for(let t of Pl(n))s.push(...Xc(e,t,2,o));return s}var Wl=[`opt`,`alt`,`loop`,`par`,`break`,`critical`,`seq`],Gl=`#f3f0ff`,Kl=14,ql=8,Jl=1.75,Yl=.1;function Xl(e,t){let n=e.trimStart().match(/^\S+(\s[\s\S]*)?$/);return t+(n&&n[1]?n[1]:``)}function Zl(e){return Math.min(Z(e).height,e.fontSize*Jl)}function Ql(e,t){let n=Z(e),r=e.label.trim()||`opt`,i=Math.min(n.width,t.measure(r,e.fontSize,e.fontFamily)+24);return{x:n.x,y:n.y,width:i,height:Zl(e)}}function $l(e){let t=Math.min(ql,e.width/2,e.height/2);return{tl:Math.min(Kl,e.width-t,e.height-t),br:t}}function eu(e){let{x:t,y:n,width:r,height:i}=e,{tl:a,br:o}=$l(e);return[`M ${t+a} ${n}`,`L ${t+r} ${n}`,`L ${t+r} ${n+i-o}`,`Q ${t+r} ${n+i} ${t+r-o} ${n+i}`,`L ${t} ${n+i}`,`L ${t} ${n+a}`,`Q ${t} ${n} ${t+a} ${n}`,`Z`].join(` `)}function tu(e){let{x:t,y:n,width:r,height:i}=e,{br:a}=$l(e);return`M ${t+r} ${n} L ${t+r} ${n+i-a} Q ${t+r} ${n+i} ${t+r-a} ${n+i} L ${t} ${n+i}`}function nu(t){let{bounds:n,shape:r,ink:i}=t,a=$c(r)??`#f3f0ff`,o=Ql(r,t.text),s=[{kind:`path`,d:eu(o),fill:a,testId:`fragment-tab`}];s.push(...Q(t,V(n.x,n.y,n.width,n.height,Kl),i)),s.push(...Q(t,tu(o),i,Jc,`fragment-tab`));let c=r.label.trim();return c&&s.push(Zc(t,o.x+12,o.y+o.height/2+r.fontSize*Yl,c,e(a),{anchor:`start`,testId:`fragment-label`})),s}var ru={entity:Al,lifeline:Ul,fragment:nu},iu=8,au=[],$={get(e){for(let t=au.length-1;t>=0;--t)if(au[t].shapes===e)return au[t].index},has(e){return $.get(e)!==void 0},set(e,t){au.push({shapes:e,index:t}),au.length>iu&&au.shift()}};function ou(e){if(e.type===`arrow`){let t=[];return e.startBinding&&t.push(e.startBinding.shapeId),e.endBinding&&t.push(e.endBinding.shapeId),t}return e.type===`polygon`&&e.band?[e.band.from,e.band.to]:[]}function su(e){let t=new Map,n=new Map,r=new Map;for(let i=0;i<e.length;i+=1){let a=e[i];t.has(a.id)||t.set(a.id,i);let o=r.get(a.type);o?o.push(i):r.set(a.type,[i]);for(let e of ou(a)){let t=n.get(e);t?t.push(a.id):n.set(e,[a.id])}}return{position:t,dependents:n,byType:r}}function cu(e){let t=$.get(e);if(t)return t;let n=su(e);return $.set(e,n),n}function lu(e,t){if(e===t||$.has(t))return;let n=$.get(e);if(!(!n||e.length!==t.length)){for(let n=0;n<t.length;n+=1){let r=e[n],i=t[n];if(r!==i&&!du(r,i))return}$.set(t,n)}}function uu(e,t,n){if(e===t||$.has(t))return;let r=$.get(e);if(!(!r||e.length!==t.length)){for(let r of n){let n=e[r],i=t[r];if(n!==i&&!du(n,i))return}$.set(t,r)}}function du(e,t){return e.id===t.id&&e.type===t.type&&fu(e,t)}function fu(e,t){let n=ou(t);if(n.length===0)return!0;let r=ou(e);return n.every(e=>r.includes(e))}function pu(e,t){let{position:n}=cu(e),r=[];for(let e of t){let t=n.get(e);t!==void 0&&r.push(t)}return r.sort((e,t)=>e-t),r.map(t=>e[t])}function mu(e,t){let n=$.get(e);return n?(n.byType.get(t)??[]).map(t=>e[t]):e.filter(e=>e.type===t)}function hu(e){return mu(e,`figure`)}function gu(e,t){let n=$.get(e);if(n){let r=n.position.get(t);return r===void 0?void 0:e[r]}return e.find(e=>e.id===t)}var _u=.05;function vu(e){return Number.isNaN(e)?1:c(e,_u,8)}function yu(e){return{zoom:1,x:Number.isFinite(e.width)?e.width/2:0,y:Number.isFinite(e.height)?e.height/2:0}}function bu(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function xu(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function Su(e,t,n){let r=vu(t),i=bu(n,e),a=n.x-i.x*r,o=n.y-i.y*r;return!Number.isFinite(a)||!Number.isFinite(o)?{zoom:r,x:n.x,y:n.y}:{zoom:r,x:a,y:o}}function Cu(e,t,n,r=80,i=24){if(!l(e))return null;let a=xu({x:e.x,y:e.y},t),o=xu({x:e.x+e.width,y:e.y+e.height},t);if(a.x>=i&&a.y>=i&&o.x<=n.width-i&&o.y<=n.height-i)return null;if(e.width*t.zoom<=n.width-r*2&&e.height*t.zoom<=n.height-r*2){let r=e.x+e.width/2,i=e.y+e.height/2;return{zoom:t.zoom,x:n.width/2-r*t.zoom,y:n.height/2-i*t.zoom}}return wu(e,n,r)}function wu(e,t,n=80){if(!l(e))return yu(t);let r=Math.max(1,t.width-n*2),i=Math.max(1,t.height-n*2),a=vu(Math.min(r/e.width,i/e.height,1)),o=e.x+e.width/2,s=e.y+e.height/2,c={zoom:a,x:t.width/2-o*a,y:t.height/2-s*a};return!Number.isFinite(c.x)||!Number.isFinite(c.y)?yu(t):c}function Tu(e,t,n,r){return n.id===e.id?!1:n.type===`figure`?Ou(t,Z(n,r)):u(s(Z(n,r)),t)}function Eu(e,t,n){let i=Z(t,n);return e.filter(e=>(Rs(e)||r(Ws(e),i))&&Tu(t,i,e,n))}function Du(e,t,n){let r=e.map((e,t)=>({x:s(Z(e,n)).x,order:t,shape:e})).sort((e,t)=>e.x-t.x),i=r.map(e=>e.x),a=e=>{let t=0,n=i.length;for(;t<n;){let r=t+n>>1;i[r]<e?t=r+1:n=r}return t},o=e=>{let t=0,n=i.length;for(;t<n;){let r=t+n>>1;i[r]<=e?t=r+1:n=r}return t};return{members(e){let i=Z(e,n),s=a(i.x),c=o(i.x+i.width);t?.onCandidates?.(Math.max(0,c-s));let l=[];for(let t=s;t<c;t+=1){let a=r[t];Tu(e,i,a.shape,n)&&l.push(a)}return l.sort((e,t)=>e.order-t.order),l.map(e=>e.shape)}}}function Ou(e,t){return t.x>=e.x&&t.y>=e.y&&t.x+t.width<=e.x+e.width&&t.y+t.height<=e.y+e.height}function ku(e,t){let n=Z(t);return e.some(e=>e.type===`figure`&&e.id!==t.id&&Ou(Z(e),n))}function Au(e){let t=e.filter(e=>e.type===`figure`),n=t.map(e=>Z(e)),r=new Set;for(let e=0;e<t.length;e+=1)for(let i=0;i<t.length;i+=1)if(e!==i&&Ou(n[i],n[e])){r.add(t[e].id);break}return r}function ju(e,t,n){let r=new Set(t.map(e=>e.id)),i=[...t];if(r.size>=e.length)return i;let a=t.filter(e=>e.type===`figure`),o=a.length>2?Du(e,void 0,n):null;for(let t of a){let a=o?o.members(t):Eu(e,t,n);for(let e of a)r.has(e.id)||(r.add(e.id),i.push(e))}return i}var Mu=64,Nu=480,Pu=270;function Fu(e,t){return e.type===`figure`&&e.slideOrder!==void 0&&!e.groupId&&(e.kind??`simple`)===`simple`&&!t.has(e.id)}function Iu(e){let t=hu(e);return Ru(t,Au(t))}function Lu(e){return e.filter(e=>!e.slideSkipped)}function Ru(e,t){return e.filter(e=>Fu(e,t)).sort((e,t)=>(e.slideOrder??0)-(t.slideOrder??0))}function zu(e,t){let n=(Fo(e.label)?es(e.label):e.label).trim();return n.length>0?n:`Frame ${t+1}`}function Bu(e,t){return zu(e,t).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`slide-${t+1}`}function Vu(e,t,n){let r=[...e],[i]=r.splice(t,1);return r.splice(n,0,i),r.map((e,t)=>({...e,slideOrder:t}))}function Hu(e,t,n=1){return e.map((e,r)=>({...e,slideOrder:r<t?r:r+n}))}function Uu(e,t,n=[]){let r=e[e.length-1],i=r&&r.width>=Nu&&r.height>=Pu,a=i?r.width:960,o=i?r.height:540,s=r?null:Js(n),c,l;return r?(c=Math.max(...e.map(e=>e.x+e.width))+Mu,l=r.y):s?(c=s.x+s.width+Mu,l=s.y+s.height/2-o/2):(c=t.x-a/2,l=t.y-o/2),{id:gc(),type:`figure`,x:c,y:l,width:a,height:o,rotation:0,label:`Frame ${e.length+1}`,fontSize:24,fontFamily:_,color:h,fill:`#ffffff`,opacity:1,slideOrder:e.length}}function Wu(e,t,n){let r=t[n],i=Eu(e,r),a={x:Math.max(...t.map(e=>e.x+e.width))+Mu-r.x,y:0},[o,...s]=yc([r,...i],a);return{clones:[{...o,slideOrder:n+1},...s],renumbered:Hu(t,n+1)}}function Gu(e,t){return new Set([t.id,...Eu(e,t).map(e=>e.id)])}function Ku(e,t){let n=Au(e);return e.filter(e=>qu(t,e,n))}function qu(e,t,n){if(t.id===e.id||t.type===`figure`&&!n.has(t.id))return!1;let r=Z(e),i=Ws(t);return i.x<r.x+r.width&&i.x+i.width>r.x&&i.y<r.y+r.height&&i.y+i.height>r.y}function Ju(e,t,n){if(n.size===0||t.length===0)return null;let r=Au(e),i=null;for(let a of e){if(!n.has(a.id))continue;let e=t.find(e=>e.id===a.id)??Yu(t,a,r);if(e){if(i&&i.id!==e.id)return null;i=e}}return i}function Yu(e,t,n){let r=null,i=1/0;for(let a of e){if(!qu(a,t,n))continue;let e=Z(a),o=e.width*e.height;o<i&&(r=a,i=o)}return r}function Xu(e,t){let n=vu(Math.min(t.width/e.width,t.height/e.height));return{zoom:n,x:t.width/2-(e.x+e.width/2)*n,y:t.height/2-(e.y+e.height/2)*n}}function Zu(e,t,n){return Qu(e,bu({x:n.width/2,y:n.height/2},t))}function Qu(e,t){let n=-1,r=1/0;return e.forEach((e,i)=>{let a=Z(e),o=t.x>=a.x&&t.x<=a.x+a.width&&t.y>=a.y&&t.y<=a.y+a.height,s=a.width*a.height;o&&s<r&&(n=i,r=s)}),n}export{Rl as $,No as $n,rn as $r,Rs as $t,gu as A,ds as An,Pr as Ar,gc as At,ru as B,X as Bn,xn as Br,Xs as Bt,bu as C,Qo as Cn,Wr as Cr,dl as Ct,lu as D,Fo as Dn,Gi as Dr,Gc as Dt,ou as E,qo as En,U as Er,Bc as Et,bl as F,Xo as Fn,Cn as Fr,pc as Ft,Zl as G,Ao as Gn,qt as Gr,Qs as Gt,Dl as H,vo as Hn,bn as Hr,Ys as Ht,Gl as I,is as In,On as Ir,Sc as It,Fl as J,_o as Jn,Bt as Jr,ec as Jt,Xl as K,Eo as Kn,P as Kr,nc as Kt,Yl as L,as as Ln,kn as Lr,bc as Lt,pu as M,Zo as Mn,V as Mr,dc as Mt,mu as N,ts as Nn,wn as Nr,hc as Nt,uu as O,os as On,Wi as Or,zc as Ot,vl as P,es as Pn,Sn as Pr,fc as Pt,Hl as Q,po as Qn,tn as Qr,Ws as Qt,Wl as R,oo as Rn,An as Rr,mc as Rt,Cu as S,Ro as Sn,Hr as Sr,ul as St,Su as T,Io as Tn,Bi as Tr,Vc as Tt,kl as U,yo as Un,sn as Ur,tc as Ut,El as V,Mo as Vn,yn as Vr,ic as Vt,Ql as W,go as Wn,F as Wr,Zs as Wt,jl as X,bo as Xn,un as Xr,Vs as Xt,Il as Y,ko as Yn,zt as Yr,$s as Yt,Ml as Z,Co as Zn,cn as Zr,Js as Zt,Eu as _,ws as _n,Aa as _r,Qc as _t,Xu as a,Et as ai,Z as an,ro as ar,nl as at,vu as b,vs as bn,ja as br,ol as bt,Vu as c,Ce as ci,zs as cn,eo as cr,_l as ct,Ju as d,_e as di,ys as dn,Qa as dr,hl as dt,Ft as ei,Is as en,fo as er,tl as et,zu as f,D as fi,Os as fn,qa as fr,rl as ft,ju as g,bs as gn,no as gr,Q as gt,Du as h,ks as hn,Ya as hr,sl as ht,Iu as i,Ot as ii,js as in,io as ir,Kc as it,cu as j,rs as jn,Fr as jr,_c as jt,hu as k,Jo as kn,Gr as kr,yc as kt,Ku as l,b as li,qs as ln,Xa as lr,cl as lt,qu as m,xs as mn,Ua as mr,gl as mt,Uu as n,Te as ni,Ps as nn,uo as nr,el as nt,Lu as o,St as oi,Ms as on,Ga as or,Yc as ot,Gu as p,ge as pi,Cs as pn,Ka as pr,il as pt,Pl as q,xo as qn,Wt as qr,rc as qt,Wu as r,Dt as ri,Fs as rn,ao as rr,pl as rt,Hu as s,ye as si,Ns as sn,$a as sr,$c as st,Zu as t,an as ti,Ks as tn,lo as tr,Jc as tt,Bu as u,ee as ui,As as un,Za as ur,ll as ut,ku as v,Es as vn,Pa as vr,Zc as vt,xu as w,Ko as wn,zi as wr,Wc as wt,wu as x,cs as xn,ka as xr,fl as xt,Au as y,Ss as yn,Na as yr,al as yt,Vl as z,co as zn,jn as zr,lc as zt};