@excalidraw/common 0.18.0-063e025 → 0.18.0-1acf66e

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 (94) hide show
  1. package/dist/dev/index.js +9 -5
  2. package/dist/dev/index.js.map +2 -2
  3. package/dist/prod/index.js +3 -3
  4. package/dist/types/common/src/constants.d.ts +2 -0
  5. package/dist/types/common/src/points.d.ts +1 -1
  6. package/dist/types/common/src/utils.d.ts +1 -1
  7. package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
  8. package/dist/types/element/src/arrows/focus.d.ts +5 -2
  9. package/dist/types/element/src/binding.d.ts +12 -3
  10. package/dist/types/element/src/comparisons.d.ts +4 -4
  11. package/dist/types/element/src/convertToShape.d.ts +23 -0
  12. package/dist/types/element/src/dragElements.d.ts +27 -0
  13. package/dist/types/element/src/flowchart.d.ts +6 -6
  14. package/dist/types/element/src/groups.d.ts +1 -1
  15. package/dist/types/element/src/index.d.ts +2 -0
  16. package/dist/types/element/src/linearElementEditor.d.ts +7 -0
  17. package/dist/types/element/src/newElement.d.ts +13 -0
  18. package/dist/types/element/src/selection.d.ts +1 -1
  19. package/dist/types/element/src/textElement.d.ts +6 -3
  20. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +15 -3
  21. package/dist/types/excalidraw/actions/actionBoundText.d.ts +10 -2
  22. package/dist/types/excalidraw/actions/actionCanvas.d.ts +99 -565
  23. package/dist/types/excalidraw/actions/actionClipboard.d.ts +10 -2
  24. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +5 -1
  25. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +16 -3
  26. package/dist/types/excalidraw/actions/actionDeselect.d.ts +2 -1
  27. package/dist/types/excalidraw/actions/actionElementLink.d.ts +5 -1
  28. package/dist/types/excalidraw/actions/actionElementLock.d.ts +10 -2
  29. package/dist/types/excalidraw/actions/actionExport.d.ts +15 -7
  30. package/dist/types/excalidraw/actions/actionFrame.d.ts +15 -178
  31. package/dist/types/excalidraw/actions/actionGroup.d.ts +10 -2
  32. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +6 -1
  33. package/dist/types/excalidraw/actions/actionLink.d.ts +5 -1
  34. package/dist/types/excalidraw/actions/actionMenu.d.ts +5 -1
  35. package/dist/types/excalidraw/actions/actionProperties.d.ts +10 -2
  36. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +5 -1
  37. package/dist/types/excalidraw/actions/actionStyles.d.ts +5 -1
  38. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
  39. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +5 -1
  40. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +5 -1
  41. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +5 -1
  42. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +5 -1
  43. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +5 -1
  44. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +5 -1
  45. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +6 -2
  46. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +5 -1
  47. package/dist/types/excalidraw/actions/index.d.ts +0 -1
  48. package/dist/types/excalidraw/actions/manager.d.ts +1 -0
  49. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  50. package/dist/types/excalidraw/actions/types.d.ts +5 -1
  51. package/dist/types/excalidraw/appState.d.ts +5 -5
  52. package/dist/types/excalidraw/components/Actions.d.ts +16 -10
  53. package/dist/types/excalidraw/components/App.arrowText.d.ts +72 -0
  54. package/dist/types/excalidraw/components/App.cursor.d.ts +31 -0
  55. package/dist/types/excalidraw/components/App.d.ts +322 -76
  56. package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
  57. package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
  58. package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
  59. package/dist/types/excalidraw/components/{ToolButton.d.ts → IconButton.d.ts} +16 -19
  60. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
  61. package/dist/types/excalidraw/components/LayerUI.d.ts +4 -2
  62. package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
  63. package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
  64. package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
  65. package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
  66. package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
  67. package/dist/types/excalidraw/components/Popover.d.ts +1 -3
  68. package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
  69. package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
  70. package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
  71. package/dist/types/excalidraw/components/Tools.d.ts +145 -0
  72. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -0
  73. package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
  74. package/dist/types/excalidraw/components/icons.d.ts +1 -1
  75. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -1
  76. package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
  77. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
  78. package/dist/types/excalidraw/data/blob.d.ts +20 -12
  79. package/dist/types/excalidraw/data/json.d.ts +10 -6
  80. package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
  81. package/dist/types/excalidraw/scene/types.d.ts +3 -0
  82. package/dist/types/excalidraw/types.d.ts +199 -13
  83. package/dist/types/excalidraw/viewport.d.ts +20 -64
  84. package/dist/types/laser-pointer/src/state.d.ts +1 -0
  85. package/dist/types/math/src/index.d.ts +1 -0
  86. package/dist/types/math/src/pca.d.ts +79 -0
  87. package/dist/types/math/src/polygon.d.ts +25 -1
  88. package/package.json +1 -1
  89. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -173
  90. package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
  91. package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
  92. package/dist/types/excalidraw/components/shapes.d.ts +0 -270
  93. package/dist/types/excalidraw/cursor.d.ts +0 -5
  94. package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
@@ -1,4 +1,4 @@
1
- var Ve=Object.create;var q=Object.defineProperty;var Ye=Object.getOwnPropertyDescriptor;var $e=Object.getOwnPropertyNames;var ze=Object.getPrototypeOf,Xe=Object.prototype.hasOwnProperty;var je=(e,t)=>()=>(e&&(t=e(e=0)),t);var Z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var qe=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $e(t))!Xe.call(e,o)&&o!==n&&q(e,o,{get:()=>t[o],enumerable:!(r=Ye(t,o))||r.enumerable});return e};var Q=(e,t,n)=>(n=e!=null?Ve(ze(e)):{},qe(t||!e||!e.__esModule?q(n,"default",{value:e,enumerable:!0}):n,e));var h,p=je(()=>{h={PROD:!0}});var Oe=Z((V,Le)=>{p();(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof V=="object"?Le.exports=t():(e.PromisePool=t(),e.promisePool=e.PromisePool)})(V,function(){"use strict";var e=function(){this._listeners={}};e.prototype.addEventListener=function(a,l){this._listeners[a]=this._listeners[a]||[],this._listeners[a].indexOf(l)<0&&this._listeners[a].push(l)},e.prototype.removeEventListener=function(a,l){if(this._listeners[a]){var u=this._listeners[a].indexOf(l);u>=0&&this._listeners[a].splice(u,1)}},e.prototype.dispatchEvent=function(a){if(this._listeners[a.type]&&this._listeners[a.type].length)for(var l=this._listeners[a.type].slice(),u=0,m=l.length;u<m;++u)l[u].call(this,a)};var t=function(a){return typeof a.constructor=="function"&&a.constructor.name==="GeneratorFunction"},n=function(a){return{next:function(){var l=a();return l?{value:l}:{done:!0}}}},r=function(a){var l=!1;return{next:function(){return l?{done:!0}:(l=!0,{value:a})}}},o=function(a,l){var u=typeof a;if(u==="object"){if(typeof a.next=="function")return a;if(typeof a.then=="function")return r(a)}return u==="function"?t(a)?a():n(a):r(l.resolve(a))},s=function(a,l,u){this.target=a,this.type=l,this.data=u},i=function(a,l,u){if(e.call(this),typeof l!="number"||Math.floor(l)!==l||l<1)throw new Error("Invalid concurrency");this._concurrency=l,this._options=u||{},this._options.promise=this._options.promise||Promise,this._iterator=o(a,this._options.promise),this._done=!1,this._size=0,this._promise=null,this._callbacks=null};return i.prototype=new e,i.prototype.constructor=i,i.prototype.concurrency=function(a){return typeof a<"u"&&(this._concurrency=a,this.active()&&this._proceed()),this._concurrency},i.prototype.size=function(){return this._size},i.prototype.active=function(){return!!this._promise},i.prototype.promise=function(){return this._promise},i.prototype.start=function(){var a=this,l=this._options.promise;return this._promise=new l(function(u,m){a._callbacks={reject:m,resolve:u},a._proceed()}),this._promise},i.prototype._fireEvent=function(a,l){this.dispatchEvent(new s(this,a,l))},i.prototype._settle=function(a){a?this._callbacks.reject(a):this._callbacks.resolve(),this._promise=null,this._callbacks=null},i.prototype._onPooledPromiseFulfilled=function(a,l){this._size--,this.active()&&(this._fireEvent("fulfilled",{promise:a,result:l}),this._proceed())},i.prototype._onPooledPromiseRejected=function(a,l){this._size--,this.active()&&(this._fireEvent("rejected",{promise:a,error:l}),this._settle(l||new Error("Unknown error")))},i.prototype._trackPromise=function(a){var l=this;a.then(function(u){l._onPooledPromiseFulfilled(a,u)},function(u){l._onPooledPromiseRejected(a,u)}).catch(function(u){l._settle(new Error("Promise processing failed: "+u))})},i.prototype._proceed=function(){if(!this._done){for(var a={done:!1};this._size<this._concurrency&&!(a=this._iterator.next()).done;)this._size++,this._trackPromise(a.value);this._done=a===null||!!a.done}this._done&&this._size===0&&this._settle()},i.PromisePoolEvent=s,i.PromisePool=i,i})});var He=Z(H=>{"use strict";p();Object.defineProperty(H,"__esModule",{value:!0});H.sanitizeUrl=void 0;var rn=/^([^\w]*)(javascript|data|vbscript)/im,on=/&#(\w+)(^\w|;)?/g,sn=/&(newline|tab);/gi,an=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,ln=/^.+(:|&colon;)/gim,cn=[".","/"];function un(e){return cn.indexOf(e[0])>-1}function pn(e){return e.replace(on,function(t,n){return String.fromCharCode(n)})}function dn(e){var t=pn(e||"").replace(sn,"").replace(an,"").trim();if(!t)return"about:blank";if(un(t))return t;var n=t.match(ln);if(!n)return t;var r=n[0];return rn.test(r)?"about:blank":t}H.sanitizeUrl=dn});p();p();var J=class{constructor(t){this.scoreFunction=t}content=[];sinkDown(t){let n=this.content[t],r=this.scoreFunction(n);for(;t>0;){let o=(t+1>>1)-1,s=this.content[o];if(r<this.scoreFunction(s))this.content[t]=s,t=o;else break}this.content[t]=n}bubbleUp(t){let n=this.content.length,r=this.content[t],o=this.scoreFunction(r);for(;;){let s=(t+1<<1)-1,i=s+1,a=t,l=o;if(s<n){let u=this.scoreFunction(this.content[s]);u<l&&(a=s,l=u)}if(i<n&&this.scoreFunction(this.content[i])<l&&(a=i),a===t)break;this.content[t]=this.content[a],t=a}this.content[t]=r}push(t){this.content.push(t),this.sinkDown(this.content.length-1)}pop(){if(this.content.length===0)return null;let t=this.content[0],n=this.content.pop();return this.content.length>0&&(this.content[0]=n,this.bubbleUp(0)),t}remove(t){if(this.content.length===0)return;let n=this.content.indexOf(t),r=this.content.pop();n<this.content.length&&(this.content[n]=r,this.scoreFunction(r)<this.scoreFunction(t)?this.sinkDown(n):this.bubbleUp(n))}size(){return this.content.length}rescoreElement(t){this.sinkDown(this.content.indexOf(t))}};p();var gn=e=>Array.isArray(e)&&e.length===4&&typeof e[0]=="number"&&typeof e[1]=="number"&&typeof e[2]=="number"&&typeof e[3]=="number";p();p();function I(e){"@babel/helpers - typeof";return I=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(e)}var Qe=/^\s+/,Je=/\s+$/;function c(e,t){if(e=e||"",t=t||{},e instanceof c)return e;if(!(this instanceof c))return new c(e,t);var n=et(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}c.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),n,r,o,s,i,a;return n=t.r/255,r=t.g/255,o=t.b/255,n<=.03928?s=n/12.92:s=Math.pow((n+.055)/1.055,2.4),r<=.03928?i=r/12.92:i=Math.pow((r+.055)/1.055,2.4),o<=.03928?a=o/12.92:a=Math.pow((o+.055)/1.055,2.4),.2126*s+.7152*i+.0722*a},setAlpha:function(t){return this._a=ae(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=te(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=te(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),o=Math.round(t.v*100);return this._a==1?"hsv("+n+", "+r+"%, "+o+"%)":"hsva("+n+", "+r+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var t=ee(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=ee(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),o=Math.round(t.l*100);return this._a==1?"hsl("+n+", "+r+"%, "+o+"%)":"hsla("+n+", "+r+"%, "+o+"%, "+this._roundA+")"},toHex:function(t){return ne(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return ot(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(E(this._r,255)*100)+"%",g:Math.round(E(this._g,255)*100)+"%",b:Math.round(E(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(E(this._r,255)*100)+"%, "+Math.round(E(this._g,255)*100)+"%, "+Math.round(E(this._b,255)*100)+"%)":"rgba("+Math.round(E(this._r,255)*100)+"%, "+Math.round(E(this._g,255)*100)+"%, "+Math.round(E(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Et[ne(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+re(this._r,this._g,this._b,this._a),r=n,o=this._gradientType?"GradientType = 1, ":"";if(t){var s=c(t);r="#"+re(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+n+",endColorstr="+r+")"},toString:function(t){var n=!!t;t=t||this._format;var r=!1,o=this._a<1&&this._a>=0,s=!n&&o&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return s?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(r=this.toRgbString()),t==="prgb"&&(r=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(r=this.toHexString()),t==="hex3"&&(r=this.toHexString(!0)),t==="hex4"&&(r=this.toHex8String(!0)),t==="hex8"&&(r=this.toHex8String()),t==="name"&&(r=this.toName()),t==="hsl"&&(r=this.toHslString()),t==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return c(this.toString())},_applyModification:function(t,n){var r=t.apply(null,[this].concat([].slice.call(n)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(lt,arguments)},brighten:function(){return this._applyModification(ct,arguments)},darken:function(){return this._applyModification(ut,arguments)},desaturate:function(){return this._applyModification(st,arguments)},saturate:function(){return this._applyModification(at,arguments)},greyscale:function(){return this._applyModification(it,arguments)},spin:function(){return this._applyModification(pt,arguments)},_applyCombination:function(t,n){return t.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(ht,arguments)},complement:function(){return this._applyCombination(dt,arguments)},monochromatic:function(){return this._applyCombination(mt,arguments)},splitcomplement:function(){return this._applyCombination(ft,arguments)},triad:function(){return this._applyCombination(oe,[3])},tetrad:function(){return this._applyCombination(oe,[4])}};c.fromRatio=function(e,t){if(I(e)=="object"){var n={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?n[r]=e[r]:n[r]=R(e[r]));e=n}return c(e,t)};function et(e){var t={r:0,g:0,b:0},n=1,r=null,o=null,s=null,i=!1,a=!1;return typeof e=="string"&&(e=_t(e)),I(e)=="object"&&(A(e.r)&&A(e.g)&&A(e.b)?(t=tt(e.r,e.g,e.b),i=!0,a=String(e.r).substr(-1)==="%"?"prgb":"rgb"):A(e.h)&&A(e.s)&&A(e.v)?(r=R(e.s),o=R(e.v),t=rt(e.h,r,o),i=!0,a="hsv"):A(e.h)&&A(e.s)&&A(e.l)&&(r=R(e.s),s=R(e.l),t=nt(e.h,r,s),i=!0,a="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=ae(n),{ok:i,format:e.format||a,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function tt(e,t,n){return{r:E(e,255)*255,g:E(t,255)*255,b:E(n,255)*255}}function ee(e,t,n){e=E(e,255),t=E(t,255),n=E(n,255);var r=Math.max(e,t,n),o=Math.min(e,t,n),s,i,a=(r+o)/2;if(r==o)s=i=0;else{var l=r-o;switch(i=a>.5?l/(2-r-o):l/(r+o),r){case e:s=(t-n)/l+(t<n?6:0);break;case t:s=(n-e)/l+2;break;case n:s=(e-t)/l+4;break}s/=6}return{h:s,s:i,l:a}}function nt(e,t,n){var r,o,s;e=E(e,360),t=E(t,100),n=E(n,100);function i(u,m,b){return b<0&&(b+=1),b>1&&(b-=1),b<1/6?u+(m-u)*6*b:b<1/2?m:b<2/3?u+(m-u)*(2/3-b)*6:u}if(t===0)r=o=s=n;else{var a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;r=i(l,a,e+1/3),o=i(l,a,e),s=i(l,a,e-1/3)}return{r:r*255,g:o*255,b:s*255}}function te(e,t,n){e=E(e,255),t=E(t,255),n=E(n,255);var r=Math.max(e,t,n),o=Math.min(e,t,n),s,i,a=r,l=r-o;if(i=r===0?0:l/r,r==o)s=0;else{switch(r){case e:s=(t-n)/l+(t<n?6:0);break;case t:s=(n-e)/l+2;break;case n:s=(e-t)/l+4;break}s/=6}return{h:s,s:i,v:a}}function rt(e,t,n){e=E(e,360)*6,t=E(t,100),n=E(n,100);var r=Math.floor(e),o=e-r,s=n*(1-t),i=n*(1-o*t),a=n*(1-(1-o)*t),l=r%6,u=[n,i,s,s,a,n][l],m=[a,n,n,i,s,s][l],b=[s,s,a,n,n,i][l];return{r:u*255,g:m*255,b:b*255}}function ne(e,t,n,r){var o=[x(Math.round(e).toString(16)),x(Math.round(t).toString(16)),x(Math.round(n).toString(16))];return r&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function ot(e,t,n,r,o){var s=[x(Math.round(e).toString(16)),x(Math.round(t).toString(16)),x(Math.round(n).toString(16)),x(ie(r))];return o&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function re(e,t,n,r){var o=[x(ie(r)),x(Math.round(e).toString(16)),x(Math.round(t).toString(16)),x(Math.round(n).toString(16))];return o.join("")}c.equals=function(e,t){return!e||!t?!1:c(e).toRgbString()==c(t).toRgbString()};c.random=function(){return c.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function st(e,t){t=t===0?0:t||10;var n=c(e).toHsl();return n.s-=t/100,n.s=C(n.s),c(n)}function at(e,t){t=t===0?0:t||10;var n=c(e).toHsl();return n.s+=t/100,n.s=C(n.s),c(n)}function it(e){return c(e).desaturate(100)}function lt(e,t){t=t===0?0:t||10;var n=c(e).toHsl();return n.l+=t/100,n.l=C(n.l),c(n)}function ct(e,t){t=t===0?0:t||10;var n=c(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),c(n)}function ut(e,t){t=t===0?0:t||10;var n=c(e).toHsl();return n.l-=t/100,n.l=C(n.l),c(n)}function pt(e,t){var n=c(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,c(n)}function dt(e){var t=c(e).toHsl();return t.h=(t.h+180)%360,c(t)}function oe(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var n=c(e).toHsl(),r=[c(e)],o=360/t,s=1;s<t;s++)r.push(c({h:(n.h+s*o)%360,s:n.s,l:n.l}));return r}function ft(e){var t=c(e).toHsl(),n=t.h;return[c(e),c({h:(n+72)%360,s:t.s,l:t.l}),c({h:(n+216)%360,s:t.s,l:t.l})]}function ht(e,t,n){t=t||6,n=n||30;var r=c(e).toHsl(),o=360/n,s=[c(e)];for(r.h=(r.h-(o*t>>1)+720)%360;--t;)r.h=(r.h+o)%360,s.push(c(r));return s}function mt(e,t){t=t||6;for(var n=c(e).toHsv(),r=n.h,o=n.s,s=n.v,i=[],a=1/t;t--;)i.push(c({h:r,s:o,v:s})),s=(s+a)%1;return i}c.mix=function(e,t,n){n=n===0?0:n||50;var r=c(e).toRgb(),o=c(t).toRgb(),s=n/100,i={r:(o.r-r.r)*s+r.r,g:(o.g-r.g)*s+r.g,b:(o.b-r.b)*s+r.b,a:(o.a-r.a)*s+r.a};return c(i)};c.readability=function(e,t){var n=c(e),r=c(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)};c.isReadable=function(e,t,n){var r=c.readability(e,t),o,s;switch(s=!1,o=xt(n),o.level+o.size){case"AAsmall":case"AAAlarge":s=r>=4.5;break;case"AAlarge":s=r>=3;break;case"AAAsmall":s=r>=7;break}return s};c.mostReadable=function(e,t,n){var r=null,o=0,s,i,a,l;n=n||{},i=n.includeFallbackColors,a=n.level,l=n.size;for(var u=0;u<t.length;u++)s=c.readability(e,t[u]),s>o&&(o=s,r=c(t[u]));return c.isReadable(e,r,{level:a,size:l})||!i?r:(n.includeFallbackColors=!1,c.mostReadable(e,["#fff","#000"],n))};var B=c.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Et=c.hexNames=Tt(B);function Tt(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function ae(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function E(e,t){bt(e)&&(e="100%");var n=gt(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function C(e){return Math.min(1,Math.max(0,e))}function g(e){return parseInt(e,16)}function bt(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function gt(e){return typeof e=="string"&&e.indexOf("%")!=-1}function x(e){return e.length==1?"0"+e:""+e}function R(e){return e<=1&&(e=e*100+"%"),e}function ie(e){return Math.round(parseFloat(e)*255).toString(16)}function se(e){return g(e)/255}var _=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",o="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+o),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+o),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+o),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function A(e){return!!_.CSS_UNIT.exec(e)}function _t(e){e=e.replace(Qe,"").replace(Je,"").toLowerCase();var t=!1;if(B[e])e=B[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=_.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=_.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=_.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=_.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=_.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=_.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=_.hex8.exec(e))?{r:g(n[1]),g:g(n[2]),b:g(n[3]),a:se(n[4]),format:t?"name":"hex8"}:(n=_.hex6.exec(e))?{r:g(n[1]),g:g(n[2]),b:g(n[3]),format:t?"name":"hex"}:(n=_.hex4.exec(e))?{r:g(n[1]+""+n[1]),g:g(n[2]+""+n[2]),b:g(n[3]+""+n[3]),a:se(n[4]+""+n[4]),format:t?"name":"hex8"}:(n=_.hex3.exec(e))?{r:g(n[1]+""+n[1]),g:g(n[2]+""+n[2]),b:g(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function xt(e){var t,n;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:t,size:n}}import{clamp as le}from"@excalidraw/math";import{degreesToRadians as At}from"@excalidraw/math";var K=typeof window<"u"?new Map:null;function yt(e,t,n,r){let o=e/255,s=t/255,i=n/255,a=At(r),l=Math.cos(a),u=Math.sin(a),m=[.213+l*.787-u*.213,.715-l*.715-u*.715,.072-l*.072+u*.928,.213-l*.213+u*.143,.715+l*.285+u*.14,.072-l*.072-u*.283,.213-l*.213-u*.787,.715-l*.715+u*.715,.072+l*.928+u*.072],b=o*m[0]+s*m[1]+i*m[2],j=o*m[3]+s*m[4]+i*m[5],y=o*m[6]+s*m[7]+i*m[8];return{r:Math.round(Math.max(0,Math.min(1,b))*255),g:Math.round(Math.max(0,Math.min(1,j))*255),b:Math.round(Math.max(0,Math.min(1,y))*255)}}var vt=(e,t,n,r)=>{let o=le(r,0,100)/100,s=u=>{let m=u*(1-o)+(255-u)*o;return Math.round(le(m,0,255))},i=s(e),a=s(t),l=s(n);return{r:i,g:a,b:l}},Rn=(e,t=!0)=>{if(!t)return e;let n=K?.get(e);if(n)return n;let r=c(e),o=r.getAlpha(),s=r.toRgb(),i=vt(s.r,s.g,s.b,93),a=yt(i.r,i.g,i.b,180),l=ue(a.r,a.g,a.b,o);return K&&K.set(e,l),l},St=(e,t)=>t.reduce((n,r)=>(r in e&&(n[r]=e[r]),n),{}),Ln=5,On=5,wn=4,P=4,D=1,d={transparent:"transparent",black:"#1e1e1e",white:"#ffffff",gray:["#f8f9fa","#e9ecef","#ced4da","#868e96","#343a40"],red:["#fff5f5","#ffc9c9","#ff8787","#fa5252","#e03131"],pink:["#fff0f6","#fcc2d7","#f783ac","#e64980","#c2255c"],grape:["#f8f0fc","#eebefa","#da77f2","#be4bdb","#9c36b5"],violet:["#f3f0ff","#d0bfff","#9775fa","#7950f2","#6741d9"],blue:["#e7f5ff","#a5d8ff","#4dabf7","#228be6","#1971c2"],cyan:["#e3fafc","#99e9f2","#3bc9db","#15aabf","#0c8599"],teal:["#e6fcf5","#96f2d7","#38d9a9","#12b886","#099268"],green:["#ebfbee","#b2f2bb","#69db7c","#40c057","#2f9e44"],yellow:["#fff9db","#ffec99","#ffd43b","#fab005","#f08c00"],orange:["#fff4e6","#ffd8a8","#ffa94d","#fd7e14","#e8590c"],bronze:["#f8f1ee","#eaddd7","#d2bab0","#a18072","#846358"]},ce=St(d,["cyan","blue","violet","grape","pink","green","teal","yellow","orange","red"]),Fn=[d.black,d.red[P],d.green[P],d.blue[P],d.yellow[P]],In=[d.transparent,d.red[D],d.green[D],d.blue[D],d.yellow[D]],Cn=[d.white,"#f8f9fa","#f5faff","#fffce8","#fdf8f6"],Pn={transparent:d.transparent,white:d.white,gray:d.gray,black:d.black,bronze:d.bronze,...ce},Dn={transparent:d.transparent,white:d.white,gray:d.gray,black:d.black,bronze:d.bronze,...ce},kn=e=>[d.cyan[e],d.blue[e],d.violet[e],d.grape[e],d.pink[e],d.green[e],d.teal[e],d.yellow[e],d.orange[e],d.red[e]],ue=(e,t,n,r)=>{let o=`#${(16777216+(e<<16)+(t<<8)+n).toString(16).slice(1)}`;if(r!==void 0&&r<1){let s=Math.round(r*255).toString(16).padStart(2,"0");return`${o}${s}`}return o},Un=e=>{let t=c(e);if(!t.isValid())return null;let{r:n,g:r,b:o,a:s}=t.toRgb();return ue(n,r,o,s)},pe=e=>c(e).getAlpha()===0,Nn=240,Mt=(e,t,n)=>(e*299+t*587+n*114)/1e3,Hn=(e,t=160)=>{if(!e)return!0;if(pe(e))return!1;let n=c(e);if(!n.isValid())return!0;let{r,g:o,b:s}=n.toRgb();return Mt(r,o,s)<t},Gn=e=>{if(e=e.trim(),pe(e))return e;let t=c(e);return t.isValid()?["hex","hex8"].includes(t.getFormat())&&!e.startsWith("#")?`#${e}`:e:null};p();var Vn=typeof window<"u"&&"ResizeObserver"in window,Yn="Excalidraw",$n=36,zn=10,Xn=20,jn=8,qn=5,Zn=1,Qn=30,Jn=Math.PI/12,er="red",tr={TEXT:"text",CROSSHAIR:"crosshair",GRABBING:"grabbing",GRAB:"grab",POINTER:"pointer",MOVE:"move",AUTO:""},nr={MAIN:0,WHEEL:1,SECONDARY:2,TOUCH:-1,ERASER:5},rr={enabled:"all",disabled:"none",inheritFromUI:"var(--ui-pointerEvents)"},Rt=(f=>(f.COPY="copy",f.PASTE="paste",f.CUT="cut",f.KEYDOWN="keydown",f.KEYUP="keyup",f.MOUSE_MOVE="mousemove",f.RESIZE="resize",f.UNLOAD="unload",f.FOCUS="focus",f.BLUR="blur",f.DRAG_OVER="dragover",f.DROP="drop",f.GESTURE_END="gestureend",f.BEFORE_UNLOAD="beforeunload",f.GESTURE_START="gesturestart",f.GESTURE_CHANGE="gesturechange",f.POINTER_MOVE="pointermove",f.POINTER_DOWN="pointerdown",f.POINTER_UP="pointerup",f.STATE_CHANGE="statechange",f.WHEEL="wheel",f.TOUCH_START="touchstart",f.TOUCH_END="touchend",f.HASHCHANGE="hashchange",f.VISIBILITY_CHANGE="visibilitychange",f.SCROLL="scroll",f.EXCALIDRAW_LINK="excalidraw-link",f.MENU_ITEM_SELECT="menu.itemSelect",f.MESSAGE="message",f.FULLSCREENCHANGE="fullscreenchange",f))(Rt||{}),or={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5},k={TEST:"test",DEVELOPMENT:"development",PRODUCTION:"production"},sr={SIDEBAR:"sidebar",SHAPE_ACTIONS_MENU:"App-menu__left",ZOOM_ACTIONS:"zoom-actions",SEARCH_MENU_INPUT_WRAPPER:"layer-ui__search-inputWrapper",CONVERT_ELEMENT_TYPE_POPUP:"ConvertElementTypePopup",SHAPE_ACTIONS_THEME_SCOPE:"shape-actions-theme-scope",FRAME_NAME:"frame-name",DROPDOWN_MENU_EVENT_WRAPPER:"dropdown-menu-event-wrapper"},ar={sm:16,md:20,lg:28,xl:36},fe="Xiaolai",L="Segoe UI Emoji",T={Virgil:1,Helvetica:2,Cascadia:3,Excalifont:5,Nunito:6,"Lilita One":7,"Comic Shanns":8,"Liberation Sans":9,Assistant:10},he="sans-serif",me="monospace",Lt={[he]:998,[me]:999},W={[fe]:100,...Lt,[L]:1e3};function Ot(e){switch(e){case T.Cascadia:case T["Comic Shanns"]:return me;default:return he}}var Ee=e=>{let t=Ot(e);switch(e){case T.Excalifont:return[fe,t,L];default:return[t,L]}},ir={LIGHT:"light",DARK:"dark"},lr="invert(93%) hue-rotate(180deg)",cr={strokeColor:"#bbb",strokeWidth:2,strokeStyle:"solid",fillStyle:"solid",roughness:0,roundness:null,backgroundColor:"transparent",radius:8,nameOffsetY:3,nameColorLightTheme:"#999999",nameColorDarkTheme:"#7a7a7a",nameFontSize:14,nameLineHeight:1.25},ur=1,pr=20,dr=T.Excalifont,fr="left",hr="top",Te="{version}",wt=2,Ft=2*wt,It=1e-5,mr=2*Ft-It,Er="#ffffff",Tr="#1e1e1e",br="#a2f1a6",gr=["selectAll"],_r=20,xr=5,be={svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif",jfif:"image/jfif"},Ct={text:"text/plain",html:"text/html",json:"application/json",excalidraw:"application/vnd.excalidraw+json",excalidrawClipboard:"application/vnd.excalidraw.clipboard+json",excalidrawlib:"application/vnd.excalidrawlib+json",excalidrawlibIds:"application/vnd.excalidrawlib.ids+json"},de={...Ct,"excalidraw.svg":"image/svg+xml","excalidraw.png":"image/png",binary:"application/octet-stream",...be},Ar=[de.text,de.html,...Object.values(be)],yr={png:"png",svg:"svg",clipboard:"clipboard"},vr={excalidraw:"excalidraw",excalidrawClipboard:"excalidraw/clipboard",excalidrawLibrary:"excalidrawlib",excalidrawClipboardWithAPI:"excalidraw-api/clipboard"},Sr=()=>window.EXCALIDRAW_EXPORT_SOURCE||window.location.origin,Mr=500,Rr=300,Lr=500,Or=1e4,wr=3e4,Fr=100,Ir=.1,Cr=.1,Pr=30,Dr=300,kr=6e4,Ur=3e3,Nr={addLibrary:"addLibrary"},Hr={addLibrary:"addLibrary"},Gr={canvasActions:{changeViewBackgroundColor:!0,clearCanvas:!0,export:{saveFileToDisk:!0},loadScene:!0,saveToActiveFile:!0,toggleTheme:null,saveAsImage:!0},tools:{image:!0}},Br=2,Kr=[1,2,3],Wr=10,Vr={maxWidthOrHeight:1440,maxFileSizeBytes:4*1024*1024},Yr="http://www.w3.org/2000/svg",$r=`<?xml version="1.0" standalone="no"?>
1
+ var Ye=Object.create;var q=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var ze=Object.getOwnPropertyNames;var Xe=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty;var qe=(e,t)=>()=>(e&&(t=e(e=0)),t);var Z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ze=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ze(t))!je.call(e,o)&&o!==n&&q(e,o,{get:()=>t[o],enumerable:!(r=$e(t,o))||r.enumerable});return e};var Q=(e,t,n)=>(n=e!=null?Ye(Xe(e)):{},Ze(t||!e||!e.__esModule?q(n,"default",{value:e,enumerable:!0}):n,e));var h,p=qe(()=>{h={PROD:!0}});var we=Z((V,Oe)=>{p();(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof V=="object"?Oe.exports=t():(e.PromisePool=t(),e.promisePool=e.PromisePool)})(V,function(){"use strict";var e=function(){this._listeners={}};e.prototype.addEventListener=function(a,l){this._listeners[a]=this._listeners[a]||[],this._listeners[a].indexOf(l)<0&&this._listeners[a].push(l)},e.prototype.removeEventListener=function(a,l){if(this._listeners[a]){var u=this._listeners[a].indexOf(l);u>=0&&this._listeners[a].splice(u,1)}},e.prototype.dispatchEvent=function(a){if(this._listeners[a.type]&&this._listeners[a.type].length)for(var l=this._listeners[a.type].slice(),u=0,m=l.length;u<m;++u)l[u].call(this,a)};var t=function(a){return typeof a.constructor=="function"&&a.constructor.name==="GeneratorFunction"},n=function(a){return{next:function(){var l=a();return l?{value:l}:{done:!0}}}},r=function(a){var l=!1;return{next:function(){return l?{done:!0}:(l=!0,{value:a})}}},o=function(a,l){var u=typeof a;if(u==="object"){if(typeof a.next=="function")return a;if(typeof a.then=="function")return r(a)}return u==="function"?t(a)?a():n(a):r(l.resolve(a))},s=function(a,l,u){this.target=a,this.type=l,this.data=u},i=function(a,l,u){if(e.call(this),typeof l!="number"||Math.floor(l)!==l||l<1)throw new Error("Invalid concurrency");this._concurrency=l,this._options=u||{},this._options.promise=this._options.promise||Promise,this._iterator=o(a,this._options.promise),this._done=!1,this._size=0,this._promise=null,this._callbacks=null};return i.prototype=new e,i.prototype.constructor=i,i.prototype.concurrency=function(a){return typeof a<"u"&&(this._concurrency=a,this.active()&&this._proceed()),this._concurrency},i.prototype.size=function(){return this._size},i.prototype.active=function(){return!!this._promise},i.prototype.promise=function(){return this._promise},i.prototype.start=function(){var a=this,l=this._options.promise;return this._promise=new l(function(u,m){a._callbacks={reject:m,resolve:u},a._proceed()}),this._promise},i.prototype._fireEvent=function(a,l){this.dispatchEvent(new s(this,a,l))},i.prototype._settle=function(a){a?this._callbacks.reject(a):this._callbacks.resolve(),this._promise=null,this._callbacks=null},i.prototype._onPooledPromiseFulfilled=function(a,l){this._size--,this.active()&&(this._fireEvent("fulfilled",{promise:a,result:l}),this._proceed())},i.prototype._onPooledPromiseRejected=function(a,l){this._size--,this.active()&&(this._fireEvent("rejected",{promise:a,error:l}),this._settle(l||new Error("Unknown error")))},i.prototype._trackPromise=function(a){var l=this;a.then(function(u){l._onPooledPromiseFulfilled(a,u)},function(u){l._onPooledPromiseRejected(a,u)}).catch(function(u){l._settle(new Error("Promise processing failed: "+u))})},i.prototype._proceed=function(){if(!this._done){for(var a={done:!1};this._size<this._concurrency&&!(a=this._iterator.next()).done;)this._size++,this._trackPromise(a.value);this._done=a===null||!!a.done}this._done&&this._size===0&&this._settle()},i.PromisePoolEvent=s,i.PromisePool=i,i})});var Ge=Z(H=>{"use strict";p();Object.defineProperty(H,"__esModule",{value:!0});H.sanitizeUrl=void 0;var on=/^([^\w]*)(javascript|data|vbscript)/im,sn=/&#(\w+)(^\w|;)?/g,an=/&(newline|tab);/gi,ln=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,cn=/^.+(:|&colon;)/gim,un=[".","/"];function pn(e){return un.indexOf(e[0])>-1}function dn(e){return e.replace(sn,function(t,n){return String.fromCharCode(n)})}function fn(e){var t=dn(e||"").replace(an,"").replace(ln,"").trim();if(!t)return"about:blank";if(pn(t))return t;var n=t.match(cn);if(!n)return t;var r=n[0];return on.test(r)?"about:blank":t}H.sanitizeUrl=fn});p();p();var J=class{constructor(t){this.scoreFunction=t}content=[];sinkDown(t){let n=this.content[t],r=this.scoreFunction(n);for(;t>0;){let o=(t+1>>1)-1,s=this.content[o];if(r<this.scoreFunction(s))this.content[t]=s,t=o;else break}this.content[t]=n}bubbleUp(t){let n=this.content.length,r=this.content[t],o=this.scoreFunction(r);for(;;){let s=(t+1<<1)-1,i=s+1,a=t,l=o;if(s<n){let u=this.scoreFunction(this.content[s]);u<l&&(a=s,l=u)}if(i<n&&this.scoreFunction(this.content[i])<l&&(a=i),a===t)break;this.content[t]=this.content[a],t=a}this.content[t]=r}push(t){this.content.push(t),this.sinkDown(this.content.length-1)}pop(){if(this.content.length===0)return null;let t=this.content[0],n=this.content.pop();return this.content.length>0&&(this.content[0]=n,this.bubbleUp(0)),t}remove(t){if(this.content.length===0)return;let n=this.content.indexOf(t),r=this.content.pop();n<this.content.length&&(this.content[n]=r,this.scoreFunction(r)<this.scoreFunction(t)?this.sinkDown(n):this.bubbleUp(n))}size(){return this.content.length}rescoreElement(t){this.sinkDown(this.content.indexOf(t))}};p();var _n=e=>Array.isArray(e)&&e.length===4&&typeof e[0]=="number"&&typeof e[1]=="number"&&typeof e[2]=="number"&&typeof e[3]=="number";p();p();function I(e){"@babel/helpers - typeof";return I=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(e)}var Je=/^\s+/,et=/\s+$/;function c(e,t){if(e=e||"",t=t||{},e instanceof c)return e;if(!(this instanceof c))return new c(e,t);var n=tt(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}c.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),n,r,o,s,i,a;return n=t.r/255,r=t.g/255,o=t.b/255,n<=.03928?s=n/12.92:s=Math.pow((n+.055)/1.055,2.4),r<=.03928?i=r/12.92:i=Math.pow((r+.055)/1.055,2.4),o<=.03928?a=o/12.92:a=Math.pow((o+.055)/1.055,2.4),.2126*s+.7152*i+.0722*a},setAlpha:function(t){return this._a=ae(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=te(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=te(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),o=Math.round(t.v*100);return this._a==1?"hsv("+n+", "+r+"%, "+o+"%)":"hsva("+n+", "+r+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var t=ee(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=ee(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),o=Math.round(t.l*100);return this._a==1?"hsl("+n+", "+r+"%, "+o+"%)":"hsla("+n+", "+r+"%, "+o+"%, "+this._roundA+")"},toHex:function(t){return ne(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return st(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(E(this._r,255)*100)+"%",g:Math.round(E(this._g,255)*100)+"%",b:Math.round(E(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(E(this._r,255)*100)+"%, "+Math.round(E(this._g,255)*100)+"%, "+Math.round(E(this._b,255)*100)+"%)":"rgba("+Math.round(E(this._r,255)*100)+"%, "+Math.round(E(this._g,255)*100)+"%, "+Math.round(E(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Tt[ne(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+re(this._r,this._g,this._b,this._a),r=n,o=this._gradientType?"GradientType = 1, ":"";if(t){var s=c(t);r="#"+re(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+n+",endColorstr="+r+")"},toString:function(t){var n=!!t;t=t||this._format;var r=!1,o=this._a<1&&this._a>=0,s=!n&&o&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return s?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(r=this.toRgbString()),t==="prgb"&&(r=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(r=this.toHexString()),t==="hex3"&&(r=this.toHexString(!0)),t==="hex4"&&(r=this.toHex8String(!0)),t==="hex8"&&(r=this.toHex8String()),t==="name"&&(r=this.toName()),t==="hsl"&&(r=this.toHslString()),t==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return c(this.toString())},_applyModification:function(t,n){var r=t.apply(null,[this].concat([].slice.call(n)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(ct,arguments)},brighten:function(){return this._applyModification(ut,arguments)},darken:function(){return this._applyModification(pt,arguments)},desaturate:function(){return this._applyModification(at,arguments)},saturate:function(){return this._applyModification(it,arguments)},greyscale:function(){return this._applyModification(lt,arguments)},spin:function(){return this._applyModification(dt,arguments)},_applyCombination:function(t,n){return t.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(mt,arguments)},complement:function(){return this._applyCombination(ft,arguments)},monochromatic:function(){return this._applyCombination(Et,arguments)},splitcomplement:function(){return this._applyCombination(ht,arguments)},triad:function(){return this._applyCombination(oe,[3])},tetrad:function(){return this._applyCombination(oe,[4])}};c.fromRatio=function(e,t){if(I(e)=="object"){var n={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?n[r]=e[r]:n[r]=R(e[r]));e=n}return c(e,t)};function tt(e){var t={r:0,g:0,b:0},n=1,r=null,o=null,s=null,i=!1,a=!1;return typeof e=="string"&&(e=xt(e)),I(e)=="object"&&(A(e.r)&&A(e.g)&&A(e.b)?(t=nt(e.r,e.g,e.b),i=!0,a=String(e.r).substr(-1)==="%"?"prgb":"rgb"):A(e.h)&&A(e.s)&&A(e.v)?(r=R(e.s),o=R(e.v),t=ot(e.h,r,o),i=!0,a="hsv"):A(e.h)&&A(e.s)&&A(e.l)&&(r=R(e.s),s=R(e.l),t=rt(e.h,r,s),i=!0,a="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=ae(n),{ok:i,format:e.format||a,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function nt(e,t,n){return{r:E(e,255)*255,g:E(t,255)*255,b:E(n,255)*255}}function ee(e,t,n){e=E(e,255),t=E(t,255),n=E(n,255);var r=Math.max(e,t,n),o=Math.min(e,t,n),s,i,a=(r+o)/2;if(r==o)s=i=0;else{var l=r-o;switch(i=a>.5?l/(2-r-o):l/(r+o),r){case e:s=(t-n)/l+(t<n?6:0);break;case t:s=(n-e)/l+2;break;case n:s=(e-t)/l+4;break}s/=6}return{h:s,s:i,l:a}}function rt(e,t,n){var r,o,s;e=E(e,360),t=E(t,100),n=E(n,100);function i(u,m,b){return b<0&&(b+=1),b>1&&(b-=1),b<1/6?u+(m-u)*6*b:b<1/2?m:b<2/3?u+(m-u)*(2/3-b)*6:u}if(t===0)r=o=s=n;else{var a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;r=i(l,a,e+1/3),o=i(l,a,e),s=i(l,a,e-1/3)}return{r:r*255,g:o*255,b:s*255}}function te(e,t,n){e=E(e,255),t=E(t,255),n=E(n,255);var r=Math.max(e,t,n),o=Math.min(e,t,n),s,i,a=r,l=r-o;if(i=r===0?0:l/r,r==o)s=0;else{switch(r){case e:s=(t-n)/l+(t<n?6:0);break;case t:s=(n-e)/l+2;break;case n:s=(e-t)/l+4;break}s/=6}return{h:s,s:i,v:a}}function ot(e,t,n){e=E(e,360)*6,t=E(t,100),n=E(n,100);var r=Math.floor(e),o=e-r,s=n*(1-t),i=n*(1-o*t),a=n*(1-(1-o)*t),l=r%6,u=[n,i,s,s,a,n][l],m=[a,n,n,i,s,s][l],b=[s,s,a,n,n,i][l];return{r:u*255,g:m*255,b:b*255}}function ne(e,t,n,r){var o=[x(Math.round(e).toString(16)),x(Math.round(t).toString(16)),x(Math.round(n).toString(16))];return r&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function st(e,t,n,r,o){var s=[x(Math.round(e).toString(16)),x(Math.round(t).toString(16)),x(Math.round(n).toString(16)),x(ie(r))];return o&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function re(e,t,n,r){var o=[x(ie(r)),x(Math.round(e).toString(16)),x(Math.round(t).toString(16)),x(Math.round(n).toString(16))];return o.join("")}c.equals=function(e,t){return!e||!t?!1:c(e).toRgbString()==c(t).toRgbString()};c.random=function(){return c.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function at(e,t){t=t===0?0:t||10;var n=c(e).toHsl();return n.s-=t/100,n.s=C(n.s),c(n)}function it(e,t){t=t===0?0:t||10;var n=c(e).toHsl();return n.s+=t/100,n.s=C(n.s),c(n)}function lt(e){return c(e).desaturate(100)}function ct(e,t){t=t===0?0:t||10;var n=c(e).toHsl();return n.l+=t/100,n.l=C(n.l),c(n)}function ut(e,t){t=t===0?0:t||10;var n=c(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),c(n)}function pt(e,t){t=t===0?0:t||10;var n=c(e).toHsl();return n.l-=t/100,n.l=C(n.l),c(n)}function dt(e,t){var n=c(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,c(n)}function ft(e){var t=c(e).toHsl();return t.h=(t.h+180)%360,c(t)}function oe(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var n=c(e).toHsl(),r=[c(e)],o=360/t,s=1;s<t;s++)r.push(c({h:(n.h+s*o)%360,s:n.s,l:n.l}));return r}function ht(e){var t=c(e).toHsl(),n=t.h;return[c(e),c({h:(n+72)%360,s:t.s,l:t.l}),c({h:(n+216)%360,s:t.s,l:t.l})]}function mt(e,t,n){t=t||6,n=n||30;var r=c(e).toHsl(),o=360/n,s=[c(e)];for(r.h=(r.h-(o*t>>1)+720)%360;--t;)r.h=(r.h+o)%360,s.push(c(r));return s}function Et(e,t){t=t||6;for(var n=c(e).toHsv(),r=n.h,o=n.s,s=n.v,i=[],a=1/t;t--;)i.push(c({h:r,s:o,v:s})),s=(s+a)%1;return i}c.mix=function(e,t,n){n=n===0?0:n||50;var r=c(e).toRgb(),o=c(t).toRgb(),s=n/100,i={r:(o.r-r.r)*s+r.r,g:(o.g-r.g)*s+r.g,b:(o.b-r.b)*s+r.b,a:(o.a-r.a)*s+r.a};return c(i)};c.readability=function(e,t){var n=c(e),r=c(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)};c.isReadable=function(e,t,n){var r=c.readability(e,t),o,s;switch(s=!1,o=At(n),o.level+o.size){case"AAsmall":case"AAAlarge":s=r>=4.5;break;case"AAlarge":s=r>=3;break;case"AAAsmall":s=r>=7;break}return s};c.mostReadable=function(e,t,n){var r=null,o=0,s,i,a,l;n=n||{},i=n.includeFallbackColors,a=n.level,l=n.size;for(var u=0;u<t.length;u++)s=c.readability(e,t[u]),s>o&&(o=s,r=c(t[u]));return c.isReadable(e,r,{level:a,size:l})||!i?r:(n.includeFallbackColors=!1,c.mostReadable(e,["#fff","#000"],n))};var B=c.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Tt=c.hexNames=bt(B);function bt(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function ae(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function E(e,t){gt(e)&&(e="100%");var n=_t(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function C(e){return Math.min(1,Math.max(0,e))}function g(e){return parseInt(e,16)}function gt(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function _t(e){return typeof e=="string"&&e.indexOf("%")!=-1}function x(e){return e.length==1?"0"+e:""+e}function R(e){return e<=1&&(e=e*100+"%"),e}function ie(e){return Math.round(parseFloat(e)*255).toString(16)}function se(e){return g(e)/255}var _=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",o="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+o),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+o),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+o),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function A(e){return!!_.CSS_UNIT.exec(e)}function xt(e){e=e.replace(Je,"").replace(et,"").toLowerCase();var t=!1;if(B[e])e=B[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=_.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=_.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=_.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=_.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=_.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=_.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=_.hex8.exec(e))?{r:g(n[1]),g:g(n[2]),b:g(n[3]),a:se(n[4]),format:t?"name":"hex8"}:(n=_.hex6.exec(e))?{r:g(n[1]),g:g(n[2]),b:g(n[3]),format:t?"name":"hex"}:(n=_.hex4.exec(e))?{r:g(n[1]+""+n[1]),g:g(n[2]+""+n[2]),b:g(n[3]+""+n[3]),a:se(n[4]+""+n[4]),format:t?"name":"hex8"}:(n=_.hex3.exec(e))?{r:g(n[1]+""+n[1]),g:g(n[2]+""+n[2]),b:g(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function At(e){var t,n;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:t,size:n}}import{clamp as le}from"@excalidraw/math";import{degreesToRadians as yt}from"@excalidraw/math";var K=typeof window<"u"?new Map:null;function vt(e,t,n,r){let o=e/255,s=t/255,i=n/255,a=yt(r),l=Math.cos(a),u=Math.sin(a),m=[.213+l*.787-u*.213,.715-l*.715-u*.715,.072-l*.072+u*.928,.213-l*.213+u*.143,.715+l*.285+u*.14,.072-l*.072-u*.283,.213-l*.213-u*.787,.715-l*.715+u*.715,.072+l*.928+u*.072],b=o*m[0]+s*m[1]+i*m[2],j=o*m[3]+s*m[4]+i*m[5],y=o*m[6]+s*m[7]+i*m[8];return{r:Math.round(Math.max(0,Math.min(1,b))*255),g:Math.round(Math.max(0,Math.min(1,j))*255),b:Math.round(Math.max(0,Math.min(1,y))*255)}}var St=(e,t,n,r)=>{let o=le(r,0,100)/100,s=u=>{let m=u*(1-o)+(255-u)*o;return Math.round(le(m,0,255))},i=s(e),a=s(t),l=s(n);return{r:i,g:a,b:l}},Ln=(e,t=!0)=>{if(!t)return e;let n=K?.get(e);if(n)return n;let r=c(e),o=r.getAlpha(),s=r.toRgb(),i=St(s.r,s.g,s.b,93),a=vt(i.r,i.g,i.b,180),l=ue(a.r,a.g,a.b,o);return K&&K.set(e,l),l},Mt=(e,t)=>t.reduce((n,r)=>(r in e&&(n[r]=e[r]),n),{}),On=5,wn=5,Fn=4,P=4,D=1,d={transparent:"transparent",black:"#1e1e1e",white:"#ffffff",gray:["#f8f9fa","#e9ecef","#ced4da","#868e96","#343a40"],red:["#fff5f5","#ffc9c9","#ff8787","#fa5252","#e03131"],pink:["#fff0f6","#fcc2d7","#f783ac","#e64980","#c2255c"],grape:["#f8f0fc","#eebefa","#da77f2","#be4bdb","#9c36b5"],violet:["#f3f0ff","#d0bfff","#9775fa","#7950f2","#6741d9"],blue:["#e7f5ff","#a5d8ff","#4dabf7","#228be6","#1971c2"],cyan:["#e3fafc","#99e9f2","#3bc9db","#15aabf","#0c8599"],teal:["#e6fcf5","#96f2d7","#38d9a9","#12b886","#099268"],green:["#ebfbee","#b2f2bb","#69db7c","#40c057","#2f9e44"],yellow:["#fff9db","#ffec99","#ffd43b","#fab005","#f08c00"],orange:["#fff4e6","#ffd8a8","#ffa94d","#fd7e14","#e8590c"],bronze:["#f8f1ee","#eaddd7","#d2bab0","#a18072","#846358"]},ce=Mt(d,["cyan","blue","violet","grape","pink","green","teal","yellow","orange","red"]),In=[d.black,d.red[P],d.green[P],d.blue[P],d.yellow[P]],Cn=[d.transparent,d.red[D],d.green[D],d.blue[D],d.yellow[D]],Pn=[d.white,"#f8f9fa","#f5faff","#fffce8","#fdf8f6"],Dn={transparent:d.transparent,white:d.white,gray:d.gray,black:d.black,bronze:d.bronze,...ce},kn={transparent:d.transparent,white:d.white,gray:d.gray,black:d.black,bronze:d.bronze,...ce},Un=e=>[d.cyan[e],d.blue[e],d.violet[e],d.grape[e],d.pink[e],d.green[e],d.teal[e],d.yellow[e],d.orange[e],d.red[e]],ue=(e,t,n,r)=>{let o=`#${(16777216+(e<<16)+(t<<8)+n).toString(16).slice(1)}`;if(r!==void 0&&r<1){let s=Math.round(r*255).toString(16).padStart(2,"0");return`${o}${s}`}return o},Nn=e=>{let t=c(e);if(!t.isValid())return null;let{r:n,g:r,b:o,a:s}=t.toRgb();return ue(n,r,o,s)},pe=e=>c(e).getAlpha()===0,Hn=240,Rt=(e,t,n)=>(e*299+t*587+n*114)/1e3,Gn=(e,t=160)=>{if(!e)return!0;if(pe(e))return!1;let n=c(e);if(!n.isValid())return!0;let{r,g:o,b:s}=n.toRgb();return Rt(r,o,s)<t},Bn=e=>{if(e=e.trim(),pe(e))return e;let t=c(e);return t.isValid()?["hex","hex8"].includes(t.getFormat())&&!e.startsWith("#")?`#${e}`:e:null};p();var Yn=typeof window<"u"&&"ResizeObserver"in window,$n="Excalidraw",zn=36,Xn=10,jn=20,qn=8,Zn=5,Qn=1,Jn=30,er=Math.PI/12,tr="red",nr={TEXT:"text",CROSSHAIR:"crosshair",GRABBING:"grabbing",GRAB:"grab",POINTER:"pointer",MOVE:"move",AUTO:""},rr={MAIN:0,WHEEL:1,SECONDARY:2,TOUCH:-1,ERASER:5},or={enabled:"all",disabled:"none",inheritFromUI:"var(--ui-pointerEvents)"},Lt=(f=>(f.COPY="copy",f.PASTE="paste",f.CUT="cut",f.KEYDOWN="keydown",f.KEYUP="keyup",f.MOUSE_MOVE="mousemove",f.RESIZE="resize",f.UNLOAD="unload",f.FOCUS="focus",f.BLUR="blur",f.DRAG_OVER="dragover",f.DROP="drop",f.GESTURE_END="gestureend",f.BEFORE_UNLOAD="beforeunload",f.GESTURE_START="gesturestart",f.GESTURE_CHANGE="gesturechange",f.POINTER_MOVE="pointermove",f.POINTER_DOWN="pointerdown",f.POINTER_UP="pointerup",f.STATE_CHANGE="statechange",f.WHEEL="wheel",f.TOUCH_START="touchstart",f.TOUCH_END="touchend",f.HASHCHANGE="hashchange",f.VISIBILITY_CHANGE="visibilitychange",f.SCROLL="scroll",f.EXCALIDRAW_LINK="excalidraw-link",f.MENU_ITEM_SELECT="menu.itemSelect",f.MESSAGE="message",f.FULLSCREENCHANGE="fullscreenchange",f))(Lt||{}),sr={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5},k={TEST:"test",DEVELOPMENT:"development",PRODUCTION:"production"},ar={SIDEBAR:"sidebar",SHAPE_ACTIONS_MENU:"App-menu__left",ZOOM_ACTIONS:"zoom-actions",SEARCH_MENU_INPUT_WRAPPER:"layer-ui__search-inputWrapper",CONVERT_ELEMENT_TYPE_POPUP:"ConvertElementTypePopup",SHAPE_ACTIONS_THEME_SCOPE:"shape-actions-theme-scope",FRAME_NAME:"frame-name",DROPDOWN_MENU_EVENT_WRAPPER:"dropdown-menu-event-wrapper"},ir={sm:16,md:20,lg:28,xl:36},fe="Xiaolai",L="Segoe UI Emoji",T={Virgil:1,Helvetica:2,Cascadia:3,Excalifont:5,Nunito:6,"Lilita One":7,"Comic Shanns":8,"Liberation Sans":9,Assistant:10},he="sans-serif",me="monospace",Ot={[he]:998,[me]:999},W={[fe]:100,...Ot,[L]:1e3};function wt(e){switch(e){case T.Cascadia:case T["Comic Shanns"]:return me;default:return he}}var Ee=e=>{let t=wt(e);switch(e){case T.Excalifont:return[fe,t,L];default:return[t,L]}},lr={LIGHT:"light",DARK:"dark"},cr="invert(93%) hue-rotate(180deg)",ur={strokeColor:"#bbb",strokeWidth:2,strokeStyle:"solid",fillStyle:"solid",roughness:0,roundness:null,backgroundColor:"transparent",radius:8,nameOffsetY:3,nameColorLightTheme:"#999999",nameColorDarkTheme:"#7a7a7a",nameFontSize:14,nameLineHeight:1.25},pr=1,dr=20,fr=T.Excalifont,hr="left",mr="top",Te="{version}",Ft=2,It=2*Ft,Ct=1e-5,Er=2*It-Ct,Tr="#ffffff",br="#1e1e1e",gr="#a2f1a6",_r=["selectAll"],xr=20,Ar=5,be={svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif",jfif:"image/jfif"},Pt={text:"text/plain",html:"text/html",json:"application/json",excalidraw:"application/vnd.excalidraw+json",excalidrawClipboard:"application/vnd.excalidraw.clipboard+json",excalidrawlib:"application/vnd.excalidrawlib+json",excalidrawlibIds:"application/vnd.excalidrawlib.ids+json"},de={...Pt,"excalidraw.svg":"image/svg+xml","excalidraw.png":"image/png",binary:"application/octet-stream",...be},yr=[de.text,de.html,...Object.values(be)],vr={png:"png",svg:"svg",clipboard:"clipboard"},Sr={excalidraw:"excalidraw",excalidrawClipboard:"excalidraw/clipboard",excalidrawLibrary:"excalidrawlib",excalidrawClipboardWithAPI:"excalidraw-api/clipboard"},Mr=()=>window.EXCALIDRAW_EXPORT_SOURCE||window.location.origin,Rr=500,Lr=300,Or=500,wr=1e4,Fr=3e4,Ir=100,Cr=.1,Pr=.1,Dr=30,kr=300,Ur=6e4,Nr=3e3,Hr={addLibrary:"addLibrary"},Gr={addLibrary:"addLibrary"},Br={canvasActions:{changeViewBackgroundColor:!0,clearCanvas:!0,export:{saveFileToDisk:!0},loadScene:!0,saveToActiveFile:!0,toggleTheme:null,saveAsImage:!0},tools:{image:!0}},Kr=2,Wr=[1,2,3],Vr=10,Yr={maxWidthOrHeight:1440,maxFileSizeBytes:4*1024*1024},$r="http://www.w3.org/2000/svg",zr=`<?xml version="1.0" standalone="no"?>
2
2
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
- `,zr=128,Xr={excalidraw:2,excalidrawLibrary:2},jr=5,qr=.7,Zr=11,Qr={TOP:"top",MIDDLE:"middle",BOTTOM:"bottom"},Jr={LEFT:"left",CENTER:"center",RIGHT:"right"},eo=20,to=.25,no=32,ro={LEGACY:1,PROPORTIONAL_RADIUS:2,ADAPTIVE_RADIUS:3},Pt={architect:0,artist:1,cartoonist:2},oo=["thin","medium","bold"],ge={thin:1,medium:2,bold:4,extraBold:8},Dt={thin:.5,medium:1,bold:2,extraBold:4},so=(e,t)=>e==="freedraw"?Dt[t]:ge[t],kt="medium",ao={strokeColor:d.black,backgroundColor:d.transparent,fillStyle:"solid",strokeWidth:ge[kt],strokeStyle:"solid",roughness:Pt.artist,opacity:100,locked:!1},Ut="library",io="search",lo={name:"default",defaultTab:Ut},co=new Set(["iframe","embeddable","image"]),uo={selection:"selection",lasso:"lasso",rectangle:"rectangle",diamond:"diamond",ellipse:"ellipse",arrow:"arrow",line:"line",freedraw:"freedraw",text:"text",image:"image",eraser:"eraser",hand:"hand",frame:"frame",magicframe:"magicframe",embeddable:"embeddable",laser:"laser"},po={OAI_API_KEY:"excalidraw-oai-api-key",MERMAID_TO_EXCALIDRAW:"mermaid-to-excalidraw",PUBLISH_LIBRARY:"publish-library-data"},fo="Untitled",ho={generalStats:1,elementProperties:2},mo=1,Eo={sharp:"sharp",round:"round",elbow:"elbow"},To=.3,bo="element",go=Symbol.for("__test__originalId__"),Nt=(r=>(r.ACTIVE="active",r.AWAY="away",r.IDLE="idle",r))(Nt||{}),_o=20,xo=35,Ao=700,yo={background:"var(--mobile-action-button-bg)"},vo=.5,So=.2;p();var U={[T.Excalifont]:{metrics:{unitsPerEm:1e3,ascender:886,descender:-374,lineHeight:1.25}},[T.Nunito]:{metrics:{unitsPerEm:1e3,ascender:1011,descender:-353,lineHeight:1.25}},[T["Lilita One"]]:{metrics:{unitsPerEm:1e3,ascender:923,descender:-220,lineHeight:1.15}},[T["Comic Shanns"]]:{metrics:{unitsPerEm:1e3,ascender:750,descender:-250,lineHeight:1.25}},[T.Virgil]:{metrics:{unitsPerEm:1e3,ascender:886,descender:-374,lineHeight:1.25},deprecated:!0},[T.Helvetica]:{metrics:{unitsPerEm:2048,ascender:1577,descender:-471,lineHeight:1.15},deprecated:!0,local:!0},[T.Cascadia]:{metrics:{unitsPerEm:2048,ascender:1900,descender:-480,lineHeight:1.2},deprecated:!0},[T["Liberation Sans"]]:{metrics:{unitsPerEm:2048,ascender:1854,descender:-434,lineHeight:1.15},private:!0},[T.Assistant]:{metrics:{unitsPerEm:2048,ascender:1021,descender:-287,lineHeight:1.25},private:!0},[W.Xiaolai]:{metrics:{unitsPerEm:1e3,ascender:880,descender:-144,lineHeight:1.25},fallback:!0},[W["Segoe UI Emoji"]]:{metrics:{unitsPerEm:1e3,ascender:886,descender:-374,lineHeight:1.25},local:!0,fallback:!0}},Oo={LATIN:"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD",LATIN_EXT:"U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF",CYRILIC_EXT:"U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F",CYRILIC:"U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116",VIETNAMESE:"U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB"},wo="local:",Fo=(e,t,n)=>{let{unitsPerEm:r,ascender:o,descender:s}=U[e]?.metrics||U[T.Excalifont].metrics,i=t/r,a=(n-i*o+i*s)/2;return i*o+a},Io=e=>{let{lineHeight:t}=U[e]?.metrics||U[T.Excalifont].metrics;return t};p();var _e=class{jobs=[];running=!1;tick(){if(this.running)return;let t=this.jobs.shift();t?(this.running=!0,t.promise.resolve(Ae(t.jobFactory,...t.args).finally(()=>{this.running=!1,this.tick()}))):this.running=!1}push(t,...n){let r=xe();return this.jobs.push({jobFactory:t,promise:r,args:n}),this.tick(),r}};p();p();var ye="excalidraw.desktopUIMode",No=599,Ho=1e3,Go=500,Bo=600,Ko=1180,Wo=1440,Vo=1229,ve=/Mac|iPod|iPhone|iPad/.test(navigator.platform),Yo=/^Win/.test(navigator.platform),Se=/\b(android)\b/i.test(navigator.userAgent),$o=typeof window<"u"&&"netscape"in window&&navigator.userAgent.indexOf("rv:")>1&&navigator.userAgent.indexOf("Gecko")>1,Ht=navigator.userAgent.indexOf("Chrome")!==-1,zo=!Ht&&navigator.userAgent.indexOf("Safari")!==-1,Me=/iPad|iPhone/i.test(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,Xo=()=>navigator.brave?.isBrave?.name==="isBrave",Gt=(e,t)=>e<=599||t<500&&e<1e3,Bt=(e,t)=>{let n=Math.min(e,t),r=Math.max(e,t);return n>=600&&r<=1180},Kt=()=>{let e=navigator.userAgent||"",t=navigator.platform||"",n=navigator.userAgentData;if(n){let o=(n.platform||"").toLowerCase(),s=o==="windows"||o==="macos"||o==="linux"||o==="chrome os";if(n.mobile===!0)return!0;if(n.mobile===!1&&o==="android")return matchMedia?.("(hover: none)").matches&&matchMedia?.("(pointer: coarse)").matches;if(s)return!1}if(Me)return!0;if(Se){let o=/Mobile/i.test(e);if(o||!o)return matchMedia?.("(hover: none)").matches&&matchMedia?.("(pointer: coarse)").matches}return/Win|Linux|CrOS|Mac/.test(t)||/Windows NT|X11|CrOS|Macintosh/.test(e),!1},jo=(e,t)=>Gt(e,t)?"phone":Bt(e,t)?"tablet":"desktop",qo=e=>e.formFactor==="phone"?"mobile":e.formFactor==="tablet"?"compact":e.desktopUIMode,Zo=e=>{let t=e??"",n="unknown";return Me?n="ios":Se?n="android":t&&(n="other"),{isMobileDevice:Kt(),platform:n}},Qo=()=>{if(typeof window>"u")return null;try{let e=window.localStorage.getItem(ye);if(e==="compact"||e==="full")return e}catch{}return null},Wt=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(ye,e)}catch{}},Jo=e=>{if(!(e!=="compact"&&e!=="full"))return Wt(e),e};var Re={EQUAL:"Equal",MINUS:"Minus",NUM_ADD:"NumpadAdd",NUM_SUBTRACT:"NumpadSubtract",NUM_ZERO:"Numpad0",BRACKET_RIGHT:"BracketRight",BRACKET_LEFT:"BracketLeft",ONE:"Digit1",TWO:"Digit2",THREE:"Digit3",NINE:"Digit9",QUOTE:"Quote",ZERO:"Digit0",SLASH:"Slash",C:"KeyC",D:"KeyD",H:"KeyH",V:"KeyV",Z:"KeyZ",Y:"KeyY",R:"KeyR",S:"KeyS"},S={ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",BACKSPACE:"Backspace",ALT:"Alt",CTRL_OR_CMD:ve?"metaKey":"ctrlKey",DELETE:"Delete",ENTER:"Enter",ESCAPE:"Escape",QUESTION_MARK:"?",SPACE:" ",TAB:"Tab",CHEVRON_LEFT:"<",CHEVRON_RIGHT:">",PERIOD:".",COMMA:",",SUBTRACT:"-",SLASH:"/",A:"a",C:"c",D:"d",E:"e",F:"f",G:"g",H:"h",I:"i",L:"l",O:"o",P:"p",Q:"q",R:"r",S:"s",T:"t",V:"v",X:"x",Y:"y",Z:"z",K:"k",W:"w",0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9"},Vt=new Map([[S.Z,Re.Z],[S.Y,Re.Y]]),Yt=e=>/^[a-z]$/.test(e.toLowerCase()),rs=(e,t)=>{if(t===e.key.toLowerCase())return!0;let n=Vt.get(t);return!!(n&&!Yt(e.key)&&e.code===n)},os=e=>e===S.ARROW_LEFT||e===S.ARROW_RIGHT||e===S.ARROW_DOWN||e===S.ARROW_UP,ss=e=>e.altKey,as=e=>e.shiftKey,is=e=>e.shiftKey;p();import{pointFromPair as $t}from"@excalidraw/math";var ps=e=>{let t=e.map(r=>r[0]),n=e.map(r=>r[1]);return{width:Math.max(...t)-Math.min(...t),height:Math.max(...n)-Math.min(...n)}},ds=(e,t,n,r)=>{let o=n.map(y=>y[e]),s=Math.max(...o),i=Math.min(...o),a=s-i,l=a===0?1:t/a,u=1/0,m=n.map(y=>{let v=y[e]*l,F=[...y];return F[e]=v,v<u&&(u=v),F});if(!r||m.length===2)return m;let b=i-u;return m.map(y=>$t(y.map((v,F)=>F===e?v+b:v)))},fs=(e,t,n)=>n?[Math.round(e/n)*n,Math.round(t/n)*n]:[e,t];p();var Fe=Q(Oe(),1),we=class{pool;entries={};constructor(t,n){this.pool=new Fe.default(t,n)}all(){let t=n=>{if(n.data.result){let[r,o]=n.data.result;this.entries[r]=o}};return this.pool.addEventListener("fulfilled",t),this.pool.start().then(()=>(setTimeout(()=>{this.pool.removeEventListener("fulfilled",t)}),Object.values(this.entries)))}};p();p();p();var Ie=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,n)=>(n&=63,n<36?t+=n.toString(36):n<62?t+=(n-26).toString(36).toUpperCase():n>62?t+="-":t+="_",t),"");p();var O=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}};p();import{average as N}from"@excalidraw/math";var Y=null,Os=e=>{Y=e},ws=()=>{if(Y)return Y;let e=new Date,t=e.getFullYear(),n=`${e.getMonth()+1}`.padStart(2,"0"),r=`${e.getDate()}`.padStart(2,"0"),o=`${e.getHours()}`.padStart(2,"0"),s=`${e.getMinutes()}`.padStart(2,"0");return`${t}-${n}-${r}-${o}${s}`},Fs=e=>e.charAt(0).toUpperCase()+e.slice(1),Is=e=>e instanceof HTMLElement&&e.className.includes("ToolIcon"),zt=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,Cs=e=>zt(e)||e instanceof Element&&!!e.closest("label, button"),Ps=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&(e.type==="text"||e.type==="number"||e.type==="password"||e.type==="search")||e instanceof HTMLElement&&e.closest(".cm-editor")!==null,Xt=({fontFamily:e})=>{for(let[t,n]of Object.entries(T))if(n===e)return`${t}${Ee(n).map(r=>`, ${r}`).join("")}`;return L},Ds=({fontSize:e,fontFamily:t})=>`${e}px ${Xt({fontFamily:t})}`,ks=async e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},Us=(e,t)=>{let n=0,r=null,o=(...s)=>{r=s,clearTimeout(n),n=window.setTimeout(()=>{r=null,e(...s)},t)};return o.flush=()=>{if(clearTimeout(n),r){let s=r;r=null,e(...s)}},o.cancel=()=>{r=null,clearTimeout(n)},o},Ns=e=>{let t=null,n=null,r=()=>{t=window.requestAnimationFrame(()=>{t=null;let s=n;n=null,s&&e(...s)})},o=(...s)=>{n=s,t===null&&r()};return o.flush=()=>{t!==null&&(cancelAnimationFrame(t),t=null),n&&(e(...n),n=null)},o.cancel=()=>{n=null,t!==null&&(cancelAnimationFrame(t),t=null)},o},Hs=e=>1-Math.pow(1-e,4),Gs=(e,t)=>{if(!e.length||t<1)return[];let n=0,r=0,o=Array(Math.ceil(e.length/t));for(;n<e.length;)o[r++]=e.slice(n,n+=t);return o},Bs=e=>{let t=window.getSelection();if(t){let n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}},Ks=()=>{let e=window.getSelection();e&&e.removeAllRanges()},Ws=(e,t)=>Math.abs(e-t),Vs=e=>e==="selection"||e==="lasso",Ys=(e,t)=>t.type==="custom"?{...e.activeTool,type:"custom",customType:t.customType,locked:t.locked??e.activeTool.locked}:{...e.activeTool,lastActiveTool:t.lastActiveToolBeforeEraser===void 0?e.activeTool.lastActiveTool:t.lastActiveToolBeforeEraser,type:t.type,customType:null,locked:t.locked??e.activeTool.locked,fromSelection:t.fromSelection??!1},$s=()=>document.fullscreenElement?.nodeName==="HTML",zs=()=>document.documentElement.requestFullscreen(),Xs=()=>document.exitFullscreen(),js=({clientX:e,clientY:t},{zoom:n,offsetLeft:r,offsetTop:o,scrollX:s,scrollY:i})=>{let a=(e-r)/n.value-s,l=(t-o)/n.value-i;return{x:a,y:l}},qs=({sceneX:e,sceneY:t},{zoom:n,offsetLeft:r,offsetTop:o,scrollX:s,scrollY:i})=>{let a=(e+s)*n.value+r,l=(t+i)*n.value+o;return{x:a,y:l}},Zs=e=>getComputedStyle(document.documentElement).getPropertyValue(`--${e}`),jt="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u2C00-\uFB1C\uFDFE-\uFE6F\uFEFD-\uFFFF",qt="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Zt=new RegExp(`^[^${jt}]*[${qt}]`),Qs=e=>Zt.test(e),Js=e=>{let[t,n]=e;return{x:t,y:n}},ea=e=>{if(e?.name==="AbortError"){console.warn(e);return}throw e},ta=(e,t,n=0)=>{n<0&&(n=e.length+n),n=Math.min(e.length,Math.max(n,0));let r=n-1;for(;++r<e.length;)if(t(e[r],r,e))return r;return-1},na=(e,t,n=e.length-1)=>{n<0&&(n=e.length+n),n=Math.min(e.length-1,Math.max(n,0));let r=n+1;for(;--r>-1;)if(t(e[r],r,e))return r;return-1},ra=(e,t)=>{for(let n=0;n<e.length;n++){let r=t(e[n],n);if(r!=null)return r}},xe=()=>{let e,t,n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n},oa=(e,t)=>{let n=[{value:1,symbol:"b"},{value:1e3,symbol:"k"},{value:1e6,symbol:"M"},{value:1e9,symbol:"G"}],r=/\.0+$|(\.[0-9]*[1-9])0+$/,o;for(o=n.length-1;o>0&&!(e>=n[o].value);o--);return(e/n[o].value).toFixed(t).replace(r,"$1")+n[o].symbol},sa=()=>document.querySelector('meta[name="version"]')?.content||Te,aa=()=>{let t=document.createElement("canvas").getContext("2d");if(!t)return!1;let n=12;return t.fillStyle="#f00",t.textBaseline="top",t.font="32px Arial",t.fillText("\u{1F600}",0,0),t.getImageData(n,n,1,1).data[0]!==0},ia=e=>{let t=e.parentElement;for(;t;){if(t===document.body)return document;let{overflowY:n}=window.getComputedStyle(t);if(t.scrollHeight>t.clientHeight&&(n==="auto"||n==="scroll"||n==="overlay"))return t;t=t.parentElement}return document},la=e=>{let t=e.parentElement;for(;t;){if(t.tabIndex>-1){t.focus();return}t=t.parentElement}},ca=e=>{e.preventDefault(),e.returnValue=""},ua=e=>Array.from(e).map(t=>`0${t.toString(16)}`.slice(-2)).join(""),pa=()=>z()?1:Date.now(),da=e=>e instanceof Map?e:e.reduce((t,n)=>(t.set(typeof n=="string"?n:n.id,n),t),new Map),fa=e=>e.reduce((t,n,r)=>(t.set(n.id,[n,r]),t),new Map),ha=(e,t)=>e.reduce((n,r,o)=>(n[t?t(r):o]=r,n),{}),ma=e=>e.reduce((t,n,r)=>{let o={...n,prev:null,next:null};if(r!==0){let s=t[r-1];if(o.prev=s,s.next=o,r===e.length-1){let i=t[0];o.next=i,i.prev=o}}return t.push(o),t},[]),Qt=e=>Array.isArray(e)?e:e.values(),Ea=e=>Array.isArray(e)?e:Array.from(Qt(e)),z=()=>h.MODE===k.TEST,Ta=()=>h.MODE===k.DEVELOPMENT,Pe=()=>h.MODE===k.PRODUCTION,ba=()=>typeof process<"u"&&!0,ga=(e,t)=>new CustomEvent(e,{detail:{nativeEvent:t},cancelable:!0}),_a=(e,t)=>{let n=!1;for(let r in t){let o=t[r];if(typeof o<"u"){if(e[r]===o&&(typeof o!="object"||o===null))continue;n=!0}}return n?{...e,...t}:e},xa=e=>{let t=typeof e;return e==null||t!=="object"&&t!=="function"},Jt=()=>{try{return window.self===window.top?"top":"iframe"}catch{return"iframe"}},Aa=()=>Jt()==="iframe",ya=e=>!!e&&typeof e=="object"&&"then"in e&&"catch"in e&&"finally"in e,va=e=>{let t=e?.querySelectorAll("button, a, input, select, textarea, div[tabindex], label[tabindex]");return t?Array.from(t).filter(n=>n.tabIndex>-1&&!n.disabled):[]},Ce=(e,t)=>Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t,en=(e,t,n,r=!1)=>{let o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return r&&console.warn("%cisShallowEqual: objects don't have same properties ->","color: #8B4000",e,t),!1;if(n&&Array.isArray(n)){for(let i of n)if(!(e[i]===t[i]||Ce(e[i],t[i])))return r&&console.warn(`%cisShallowEqual: ${i} not equal ->`,"color: #8B4000",e[i],t[i]),!1;return!0}return o.every(i=>{let a=n?.[i],l=a?a(e[i],t[i]):e[i]===t[i]||Ce(e[i],t[i]);return!l&&r&&console.warn(`%cisShallowEqual: ${i} not equal ->`,"color: #8B4000",e[i],t[i]),l})},Sa=(e,t,{checkForDefaultPrevented:n=!0}={})=>function(o){if(e?.(o),!n||!o?.defaultPrevented)return t?.(o)},Ma=(e,t,n)=>{if(!t)return e;if(n)return console.error(t),e;throw new Error(t)};function Ra(e,t){if(!e)throw new Error(t)}var La=e=>{let t,n,r=function(o){let s=Object.entries(o);if(t){let a=!0;for(let[l,u]of s)if(t.get(l)!==u){a=!1;break}if(a)return n}let i=e(o);return t=new Map(s),n=i,i};return r.clear=()=>{t=void 0,n=void 0},r},Oa=(e,t)=>e instanceof Set||e instanceof Map?e.has(t):"includes"in e?e.includes(t):e.hasOwnProperty(t),wa=e=>JSON.parse(JSON.stringify(e)),Fa=(e,t)=>en(e,t)?e:t;function Ia(e,t,n,r){return e?(e?.addEventListener?.(t,n,r),()=>{e?.removeEventListener?.(t,n,r)}):()=>{}}function Ca(e,t=!0){let n=e.length;if(n<4)return"";let r=e[0],o=e[1],s=e[2],i=`M${r[0].toFixed(2)},${r[1].toFixed(2)} Q${o[0].toFixed(2)},${o[1].toFixed(2)} ${N(o[0],s[0]).toFixed(2)},${N(o[1],s[1]).toFixed(2)} T`;for(let a=2,l=n-1;a<l;a++)r=e[a],o=e[a+1],i+=`${N(r[0],o[0]).toFixed(2)},${N(r[1],o[1]).toFixed(2)} `;return t&&(i+="Z"),i}var Pa=e=>e.replace(/\r?\n|\r/g,`
4
- `);function Da(e){return e}var Ae=async(e,...t)=>new Promise(n=>{n(e(...t))}),ka=(...e)=>Math.max(...e.map(t=>t?1:0))>0,Ua=e=>{try{return JSON.parse(e)}catch{return null}},De=e=>e.replace(/"/g,"&quot;"),Na=e=>Array.isArray(e)?e:[e],tn=e=>Array.isArray(e),nn=e=>tn(e)?e.length:e instanceof Map||e instanceof Set?e.size:Object.keys(e).length,Ha=(e,t)=>{if(nn(e)===0)return null;let n=t||(o=>o),r=null;for(let o of e){let s=n(o);if((r===null||r===s)&&s!=null)r=s;else return null}return r},ke="excalidraw-feature-flags",$={COMPLEX_BINDINGS:!1},M=null,Ga=e=>{if(!M)try{let t=localStorage.getItem(ke);t&&(M=JSON.parse(t)??$)}catch{}return(M||$)[e]},Ba=(e,t)=>{try{M={...M||$,[e]:t},localStorage.setItem(ke,JSON.stringify(M))}catch(n){console.error("unable to set feature flag",n)}},Ka=(e,t)=>t.includes(e);var Ue=new O(Date.now()),Ne=0,Xa=()=>Math.floor(Ue.next()*2**31),ja=e=>{Ue=new O(e),Ne=0},qa=()=>z()?`id${Ne++}`:Ie();p();var Ge=Q(He(),1);var fn=e=>(e=e.trim(),e&&(0,Ge.sanitizeUrl)(De(e))),ni=e=>!!(e?.includes(location.origin)||e?.startsWith("/")),ri=e=>{if(e=fn(e),e.startsWith("/"))return`${location.origin}${e}`;try{new URL(e)}catch{return"about:blank"}return e};p();var G=class{subscribers=[];on(...t){let n=t.flat().filter(r=>typeof r=="function");return this.subscribers.push(...n),()=>this.off(n)}once(...t){let n=t.flat().filter(o=>typeof o=="function");n.push(()=>r());let r=this.on(...n);return r}off(...t){let n=t.flat();this.subscribers=this.subscribers.filter(r=>!n.includes(r))}trigger(...t){for(let n of this.subscribers)n(...t);return this}clear(){this.subscribers=[]}};p();var Be=class{constructor(t){this.behavior=t}emitters=new Map;lastPayload=new Map;emittedOnce=new Set;getEmitter(t){let n=this.emitters.get(t);return n||(n=new G,this.emitters.set(t,n)),n}toPromiseValue(t){return t.length===1?t[0]:t}on(t,n){let r=this.behavior[t],o=this.lastPayload.get(t);if(n)return r.replay==="last"&&o&&(queueMicrotask(()=>n(...o)),r.cardinality==="once")?()=>{}:this.getEmitter(t).on(n);if(r.cardinality!=="once"||r.replay!=="last")throw new Error(`Event "${String(t)}" requires a callback`);return o?Promise.resolve(this.toPromiseValue(o)):new Promise(s=>{this.getEmitter(t).once((...i)=>{s(this.toPromiseValue(i))})})}emit(t,...n){let r=this.behavior[t];if(!Pe()&&r.cardinality==="once"){if(this.emittedOnce.has(t))throw new Error(`Event "${String(t)}" can only be emitted once`);this.emittedOnce.add(t)}r.replay==="last"&&this.lastPayload.set(t,n);try{this.getEmitter(t).trigger(...n)}finally{r.cardinality==="once"&&this.getEmitter(t).clear()}}clear(){this.lastPayload.clear(),this.emittedOnce.clear();for(let t of this.emitters.values())t.clear();this.emitters.clear()}};p();var Ke=class{constructor(t,n=Object.is){this.isEqual=n;this.value=t}version=0;value;waiters=new Set;subscribers=new Set;getSnapshot(){return{version:this.version,value:this.value}}set(t){if(this.isEqual(this.value,t))return!1;this.value=t,this.version+=1;let n=this.getSnapshot();for(let r of this.subscribers)r(n);for(let r of this.waiters)r(n);return this.waiters.clear(),!0}update(t){return this.set(t(this.value))}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}pull(t=-1){return this.version!==t?Promise.resolve(this.getSnapshot()):new Promise(n=>{this.waiters.add(n)})}};p();var w=(e,t=5)=>parseFloat(e.toPrecision(t)),hn=e=>w(e.reduce((t,n)=>t+n)/e.length),X=class e{static DEBUG_LOG_TIMES=!0;static TIMES_AGGR={};static TIMES_AVG={};static LAST_DEBUG_LOG_CALL=0;static DEBUG_LOG_INTERVAL_ID=null;static LAST_FRAME_TIMESTAMP=0;static FRAME_COUNT=0;static ANIMATION_FRAME_ID=null;static scheduleAnimationFrame=()=>{e.DEBUG_LOG_INTERVAL_ID!==null&&(e.ANIMATION_FRAME_ID=requestAnimationFrame(t=>{e.LAST_FRAME_TIMESTAMP!==t&&(e.LAST_FRAME_TIMESTAMP=t,e.FRAME_COUNT++),e.DEBUG_LOG_INTERVAL_ID!==null&&e.scheduleAnimationFrame()}))};static setupInterval=()=>{e.DEBUG_LOG_INTERVAL_ID===null&&(console.info("%c(starting perf recording)","color: lime"),e.DEBUG_LOG_INTERVAL_ID=window.setInterval(e.debugLogger,1e3),e.scheduleAnimationFrame()),e.LAST_DEBUG_LOG_CALL=Date.now()};static debugLogger=()=>{if(e.DEBUG_LOG_TIMES){for(let[t,{t:n,times:r}]of Object.entries(e.TIMES_AGGR))r.length&&(console.info(t,w(r.reduce((o,s)=>o+s)),r.sort((o,s)=>o-s).map(o=>w(o))),e.TIMES_AGGR[t]={t:n,times:[]});for(let[t,{t:n,times:r,avg:o}]of Object.entries(e.TIMES_AVG))if(r.length){let s=r.reduce((a,l)=>a+l),i=w(s/e.FRAME_COUNT);console.info(t,`- ${r.length} calls - ${i}ms/frame across ${e.FRAME_COUNT} frames (${w(i/16.67*100,1)}% of frame budget)`),e.TIMES_AVG[t]={t:n,times:[],avg:o!=null?hn([o,i]):i}}}e.FRAME_COUNT=0,Date.now()-e.LAST_DEBUG_LOG_CALL>600&&e.DEBUG_LOG_INTERVAL_ID!==null&&(console.info("%c(stopping perf recording)","color: red"),window.clearInterval(e.DEBUG_LOG_INTERVAL_ID),window.cancelAnimationFrame(e.ANIMATION_FRAME_ID),e.ANIMATION_FRAME_ID=null,e.FRAME_COUNT=0,e.LAST_FRAME_TIMESTAMP=0,e.DEBUG_LOG_INTERVAL_ID=null,e.TIMES_AGGR={},e.TIMES_AVG={})};static logTime=(t,n="default")=>{e.setupInterval();let r=performance.now(),{t:o,times:s}=e.TIMES_AGGR[n]=e.TIMES_AGGR[n]||{t:0,times:[]};o&&s.push(t??r-o),e.TIMES_AGGR[n].t=r};static logTimeAverage=(t,n="default")=>{e.setupInterval();let r=performance.now(),{t:o,times:s}=e.TIMES_AVG[n]=e.TIMES_AVG[n]||{t:0,times:[]};o&&s.push(t??r-o),e.TIMES_AVG[n].t=r};static logWrapper=t=>(n,r="default")=>(...o)=>{let s=performance.now(),i=n(...o);return e[t](performance.now()-s,r),i};static logTimeWrap=e.logWrapper("logTime");static logTimeAverageWrap=e.logWrapper("logTimeAverage");static perfWrap=(t,n="default")=>(...r)=>{console.time(n);let o=t(...r);return console.timeEnd(n),o};static CHANGED_CACHE={};static logChanged(t,n){let r=e.CHANGED_CACHE[t];if(e.CHANGED_CACHE[t]=n,!r)return;let o=new Set([...Object.keys(r),...Object.keys(n)]),s={};for(let i of o){let a=r[i],l=n[i];We(a,l)||(s[i]={prev:a,next:l})}Object.keys(s).length>0&&console.info(`[${t}] changed:`,s)}};function We(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object"||Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o of n)if(!We(e[o],t[o]))return!1;return!0}export{Ur as ACTIVE_THRESHOLD,Ar as ALLOWED_PASTE_MIME_TYPES,Yn as APP_NAME,Zr as ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO,qr as ARROW_LABEL_WIDTH_FRACTION,Eo as ARROW_TYPE,Be as AppEventBus,Ao as BIND_MODE_TIMEOUT,jr as BOUND_TEXT_PADDING,J as BinaryHeap,gr as CANVAS_ONLY_ACTIONS,io as CANVAS_SEARCH_TAB,fe as CJK_HAND_DRAWN_FALLBACK_FONT,sr as CLASSES,Re as CODES,On as COLORS_PER_ROW,Tr as COLOR_CHARCOAL_BLACK,Nn as COLOR_OUTLINE_CONTRAST_THRESHOLD,d as COLOR_PALETTE,br as COLOR_VOICE_CALL,Er as COLOR_WHITE,tr as CURSOR_TYPE,lr as DARK_THEME_FILTER,no as DEFAULT_ADAPTIVE_RADIUS,Cn as DEFAULT_CANVAS_BACKGROUND_PICKS,wn as DEFAULT_CHART_COLOR_INDEX,mr as DEFAULT_COLLISION_THRESHOLD,D as DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX,Dn as DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE,In as DEFAULT_ELEMENT_BACKGROUND_PICKS,ao as DEFAULT_ELEMENT_PROPS,P as DEFAULT_ELEMENT_STROKE_COLOR_INDEX,Pn as DEFAULT_ELEMENT_STROKE_COLOR_PALETTE,Fn as DEFAULT_ELEMENT_STROKE_PICKS,kt as DEFAULT_ELEMENT_STROKE_WIDTH_KEY,Wr as DEFAULT_EXPORT_PADDING,fo as DEFAULT_FILENAME,dr as DEFAULT_FONT_FAMILY,pr as DEFAULT_FONT_SIZE,_r as DEFAULT_GRID_SIZE,xr as DEFAULT_GRID_STEP,Vr as DEFAULT_IMAGE_OPTIONS,er as DEFAULT_LASER_COLOR,to as DEFAULT_PROPORTIONAL_RADIUS,To as DEFAULT_REDUCED_GLOBAL_ALPHA,lo as DEFAULT_SIDEBAR,vo as DEFAULT_STROKE_STREAMLINE,So as DEFAULT_STROKE_STREAMLINE_PRECISE,fr as DEFAULT_TEXT_ALIGN,wt as DEFAULT_TRANSFORM_HANDLE_SPACING,Gr as DEFAULT_UI_OPTIONS,Te as DEFAULT_VERSION,hr as DEFAULT_VERTICAL_ALIGN,xo as DOUBLE_TAP_POSITION_THRESHOLD,zn as DRAGGING_THRESHOLD,X as Debug,po as EDITOR_LS_KEYS,bo as ELEMENT_LINK_KEY,eo as ELEMENT_READY_TO_ERASE_OPACITY,qn as ELEMENT_SHIFT_TRANSLATE_AMOUNT,Zn as ELEMENT_TRANSLATE_AMOUNT,zr as ENCRYPTION_KEY_BITS,k as ENV,It as EPSILON,Rt as EVENT,vr as EXPORT_DATA_TYPES,yr as EXPORT_IMAGE_TYPES,Kr as EXPORT_SCALES,G as Emitter,T as FONT_FAMILY,W as FONT_FAMILY_FALLBACKS,Lt as FONT_FAMILY_GENERIC_FALLBACKS,U as FONT_METADATA,ar as FONT_SIZES,cr as FRAME_STYLE,Dt as FREEDRAW_STROKE_WIDTH,Oo as GOOGLE_FONTS_RANGES,Dr as HYPERLINK_TOOLTIP_DELAY,kr as IDLE_THRESHOLD,be as IMAGE_MIME_TYPES,Mr as IMAGE_RENDER_TIMEOUT,S as KEYS,Vt as KeyCodeMap,co as LIBRARY_DISABLED_TYPES,Ut as LIBRARY_SIDEBAR_TAB,jn as LINE_CONFIRM_THRESHOLD,_o as LINE_POLYGON_POINT_MERGE_DISTANCE,wo as LOCAL_FONT_PROTOCOL,Ln as MAX_CUSTOM_COLORS_USED_IN_CANVAS,Br as MAX_DECIMALS_FOR_SVG_EXPORT,Pr as MAX_ZOOM,de as MIME_TYPES,Xn as MINIMUM_ARROW_SIZE,ur as MIN_FONT_SIZE,mo as MIN_WIDTH_OR_HEIGHT,Cr as MIN_ZOOM,yo as MOBILE_ACTION_BUTTON_BG,me as MONOSPACE_GENERIC_FONT,Go as MQ_MAX_HEIGHT_LANDSCAPE,No as MQ_MAX_MOBILE,Ko as MQ_MAX_TABLET,Ho as MQ_MAX_WIDTH_LANDSCAPE,Bo as MQ_MIN_TABLET,Wo as MQ_MIN_WIDTH_DESKTOP,Vo as MQ_RIGHT_SIDEBAR_MIN_WIDTH,go as ORIG_ID,nr as POINTER_BUTTON,rr as POINTER_EVENTS,we as PromisePool,_e as Queue,Pt as ROUGHNESS,ro as ROUNDNESS,he as SANS_SERIF_GENERIC_FONT,Fr as SCROLL_TIMEOUT,Jn as SHIFT_LOCKING_ANGLE,Ft as SIDE_RESIZING_THRESHOLD,ho as STATS_PANELS,Ct as STRING_MIME_TYPES,ge as STROKE_WIDTH,oo as STROKE_WIDTH_KEYS,$r as SVG_DOCUMENT_PREAMBLE,Yr as SVG_NS,Rr as TAP_TWICE_TIMEOUT,Jr as TEXT_ALIGN,$n as TEXT_AUTOWRAP_THRESHOLD,Qn as TEXT_TO_CENTER_SNAP_THRESHOLD,ir as THEME,Or as TITLE_TIMEOUT,uo as TOOL_TYPE,Lr as TOUCH_CTX_MENU_TIMEOUT,Hr as URL_HASH_KEYS,Nr as URL_QUERY_KEYS,Nt as UserIdleState,Xr as VERSIONS,wr as VERSION_TIMEOUT,Qr as VERTICAL_ALIGN,Ke as VersionedSnapshotStore,L as WINDOWS_EMOJI_FALLBACK_FONT,or as YOUTUBE_STATES,Ir as ZOOM_STEP,Ia as addEventListener,zs as allowFullScreen,Rn as applyDarkModeFilter,ma as arrayToList,da as arrayToMap,fa as arrayToMapWithIndex,ha as arrayToObject,Ma as assertNever,ua as bytesToHexString,Fs as capitalizeString,Na as castArray,Gs as chunk,wa as cloneJSON,Un as colorToHex,Sa as composeEventHandlers,Zo as createUserAgentDescriptor,Us as debounce,qo as deriveStylesPanelMode,Ws as distance,Hs as easeOut,De as escapeDoubleQuotes,Xs as exitFullScreen,ta as findIndex,na as findLastIndex,la as focusNearestParent,kn as getAllColorsSpecificShade,ws as getDateTime,Sr as getExportSource,Ga as getFeatureFlag,Ee as getFontFamilyFallbacks,Xt as getFontFamilyString,Ds as getFontString,jo as getFormFactor,Jt as getFrame,Ot as getGenericFontFamilyFallback,Zs as getGlobalCSSVariable,fs as getGridPoint,Io as getLineHeight,ia as getNearestScrollableContainer,ps as getSizeFromPoints,so as getStrokeWidthByKey,Ca as getSvgPathFromStroke,pa as getUpdatedTimestamp,sa as getVersion,Fo as getVerticalOffset,Ra as invariant,Se as isAndroid,ka as isAnyTrue,os as isArrowKey,gn as isBounds,Xo as isBrave,Ht as isChrome,Hn as isColorDark,ve as isDarwin,Ta as isDevEnv,$o as isFirefox,$s as isFullScreen,Me as isIOS,zt as isInputLike,Cs as isInteractive,Yt as isLatinChar,ni as isLocalLink,Oa as isMemberOf,Gt as isMobileBreakpoint,xa as isPrimitive,Pe as isProdEnv,ya as isPromiseLike,Qs as isRTL,tn as isReadonlyArray,Aa as isRunningInIframe,zo as isSafari,Vs as isSelectionLikeTool,ba as isServerEnv,en as isShallowEqual,Bt as isTabletBreakpoint,z as isTestEnv,Is as isToolIcon,pe as isTransparent,Yo as isWindows,Ps as isWritableElement,Qo as loadDesktopUIModePreference,ra as mapFind,rs as matchKey,La as memoize,ea as muteFSAbortError,oa as nFormatter,ks as nextAnimationFrame,Pa as normalizeEOL,Gn as normalizeInputColor,fn as normalizeLink,Ka as oneOf,ca as preventUnload,Ae as promiseTry,va as queryFocusableElements,qa as randomId,Xa as randomInteger,Ha as reduceToCommonValue,Ks as removeSelection,ds as rescalePoints,ja as reseed,xe as resolvablePromise,ue as rgbToHex,Ua as safelyParseJSON,qs as sceneCoordsToViewportCoords,Bs as selectNode,Os as setDateTimeForTests,Jo as setDesktopUIMode,Ba as setFeatureFlag,as as shouldMaintainAspectRatio,ss as shouldResizeFromCenter,is as shouldRotateWithDiscreteAngle,nn as sizeOf,aa as supportsEmoji,Vn as supportsResizeObserver,Ns as throttleRAF,Ea as toArray,Da as toBrandedType,Qt as toIterable,ri as toValidURL,Js as tupleToCoors,Ys as updateActiveTool,_a as updateObject,Fa as updateStable,js as viewportCoordsToSceneCoords,ga as wrapEvent};
3
+ `,Xr=128,jr={excalidraw:2,excalidrawLibrary:2},qr=5,Zr=.7,Qr=11,Jr={TOP:"top",MIDDLE:"middle",BOTTOM:"bottom"},eo={LEFT:"left",CENTER:"center",RIGHT:"right"},to=20,no=70,ro=.25,oo=32,so={LEGACY:1,PROPORTIONAL_RADIUS:2,ADAPTIVE_RADIUS:3},Dt={architect:0,artist:1,cartoonist:2},ao=["thin","medium","bold"],ge={thin:1,medium:2,bold:4,extraBold:8},kt={thin:.5,medium:1,bold:2,extraBold:4},io=(e,t)=>e==="freedraw"?kt[t]:ge[t],Ut="medium",lo={strokeColor:d.black,backgroundColor:d.transparent,fillStyle:"solid",strokeWidth:ge[Ut],strokeStyle:"solid",roughness:Dt.artist,opacity:100,locked:!1},Nt="library",co="search",uo={name:"default",defaultTab:Nt},po=new Set(["iframe","embeddable","image"]),fo={selection:"selection",lasso:"lasso",rectangle:"rectangle",diamond:"diamond",ellipse:"ellipse",arrow:"arrow",line:"line",freedraw:"freedraw",text:"text",image:"image",eraser:"eraser",hand:"hand",frame:"frame",magicframe:"magicframe",embeddable:"embeddable",laser:"laser",autoshape:"autoshape"},ho={OAI_API_KEY:"excalidraw-oai-api-key",MERMAID_TO_EXCALIDRAW:"mermaid-to-excalidraw",PUBLISH_LIBRARY:"publish-library-data"},mo="Untitled",Eo={generalStats:1,elementProperties:2},To=1,bo={sharp:"sharp",round:"round",elbow:"elbow"},go=.3,_o="element",xo=Symbol.for("__test__originalId__"),Ht=(r=>(r.ACTIVE="active",r.AWAY="away",r.IDLE="idle",r))(Ht||{}),Ao=20,yo=35,vo=700,So={background:"var(--mobile-action-button-bg)"},Mo=.5,Ro=.2;p();var U={[T.Excalifont]:{metrics:{unitsPerEm:1e3,ascender:886,descender:-374,lineHeight:1.25}},[T.Nunito]:{metrics:{unitsPerEm:1e3,ascender:1011,descender:-353,lineHeight:1.25}},[T["Lilita One"]]:{metrics:{unitsPerEm:1e3,ascender:923,descender:-220,lineHeight:1.15}},[T["Comic Shanns"]]:{metrics:{unitsPerEm:1e3,ascender:750,descender:-250,lineHeight:1.25}},[T.Virgil]:{metrics:{unitsPerEm:1e3,ascender:886,descender:-374,lineHeight:1.25},deprecated:!0},[T.Helvetica]:{metrics:{unitsPerEm:2048,ascender:1577,descender:-471,lineHeight:1.15},deprecated:!0,local:!0},[T.Cascadia]:{metrics:{unitsPerEm:2048,ascender:1900,descender:-480,lineHeight:1.2},deprecated:!0},[T["Liberation Sans"]]:{metrics:{unitsPerEm:2048,ascender:1854,descender:-434,lineHeight:1.15},private:!0},[T.Assistant]:{metrics:{unitsPerEm:2048,ascender:1021,descender:-287,lineHeight:1.25},private:!0},[W.Xiaolai]:{metrics:{unitsPerEm:1e3,ascender:880,descender:-144,lineHeight:1.25},fallback:!0},[W["Segoe UI Emoji"]]:{metrics:{unitsPerEm:1e3,ascender:886,descender:-374,lineHeight:1.25},local:!0,fallback:!0}},Fo={LATIN:"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD",LATIN_EXT:"U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF",CYRILIC_EXT:"U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F",CYRILIC:"U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116",VIETNAMESE:"U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB"},Io="local:",Co=(e,t,n)=>{let{unitsPerEm:r,ascender:o,descender:s}=U[e]?.metrics||U[T.Excalifont].metrics,i=t/r,a=(n-i*o+i*s)/2;return i*o+a},Po=e=>{let{lineHeight:t}=U[e]?.metrics||U[T.Excalifont].metrics;return t};p();var _e=class{jobs=[];running=!1;tick(){if(this.running)return;let t=this.jobs.shift();t?(this.running=!0,t.promise.resolve(Ae(t.jobFactory,...t.args).finally(()=>{this.running=!1,this.tick()}))):this.running=!1}push(t,...n){let r=xe();return this.jobs.push({jobFactory:t,promise:r,args:n}),this.tick(),r}};p();p();var ye="excalidraw.desktopUIMode",Go=599,Bo=1e3,Ko=500,Wo=600,Vo=1180,Yo=1440,$o=1229,ve=/Mac|iPod|iPhone|iPad/.test(navigator.platform),zo=/^Win/.test(navigator.platform),Se=/\b(android)\b/i.test(navigator.userAgent),Xo=typeof window<"u"&&"netscape"in window&&navigator.userAgent.indexOf("rv:")>1&&navigator.userAgent.indexOf("Gecko")>1,Gt=navigator.userAgent.indexOf("Chrome")!==-1,jo=!Gt&&navigator.userAgent.indexOf("Safari")!==-1,Me=/iPad|iPhone/i.test(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,qo=()=>navigator.brave?.isBrave?.name==="isBrave",Bt=(e,t)=>e<=599||t<500&&e<1e3,Kt=(e,t)=>{let n=Math.min(e,t),r=Math.max(e,t);return n>=600&&r<=1180},Wt=()=>{let e=navigator.userAgent||"",t=navigator.platform||"",n=navigator.userAgentData;if(n){let o=(n.platform||"").toLowerCase(),s=o==="windows"||o==="macos"||o==="linux"||o==="chrome os";if(n.mobile===!0)return!0;if(n.mobile===!1&&o==="android")return matchMedia?.("(hover: none)").matches&&matchMedia?.("(pointer: coarse)").matches;if(s)return!1}if(Me)return!0;if(Se){let o=/Mobile/i.test(e);if(o||!o)return matchMedia?.("(hover: none)").matches&&matchMedia?.("(pointer: coarse)").matches}return/Win|Linux|CrOS|Mac/.test(t)||/Windows NT|X11|CrOS|Macintosh/.test(e),!1},Zo=(e,t)=>Bt(e,t)?"phone":Kt(e,t)?"tablet":"desktop",Qo=e=>e.formFactor==="phone"?"mobile":e.formFactor==="tablet"?"compact":e.desktopUIMode,Jo=e=>{let t=e??"",n="unknown";return Me?n="ios":Se?n="android":t&&(n="other"),{isMobileDevice:Wt(),platform:n}},es=()=>{if(typeof window>"u")return null;try{let e=window.localStorage.getItem(ye);if(e==="compact"||e==="full")return e}catch{}return null},Vt=e=>{if(!(typeof window>"u"))try{window.localStorage.setItem(ye,e)}catch{}},ts=e=>{if(!(e!=="compact"&&e!=="full"))return Vt(e),e};var Re={EQUAL:"Equal",MINUS:"Minus",NUM_ADD:"NumpadAdd",NUM_SUBTRACT:"NumpadSubtract",NUM_ZERO:"Numpad0",BRACKET_RIGHT:"BracketRight",BRACKET_LEFT:"BracketLeft",ONE:"Digit1",TWO:"Digit2",THREE:"Digit3",NINE:"Digit9",QUOTE:"Quote",ZERO:"Digit0",SLASH:"Slash",C:"KeyC",D:"KeyD",H:"KeyH",V:"KeyV",Z:"KeyZ",Y:"KeyY",R:"KeyR",S:"KeyS"},S={ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",BACKSPACE:"Backspace",ALT:"Alt",CTRL_OR_CMD:ve?"metaKey":"ctrlKey",DELETE:"Delete",ENTER:"Enter",ESCAPE:"Escape",QUESTION_MARK:"?",SPACE:" ",TAB:"Tab",CHEVRON_LEFT:"<",CHEVRON_RIGHT:">",PERIOD:".",COMMA:",",SUBTRACT:"-",SLASH:"/",A:"a",C:"c",D:"d",E:"e",F:"f",G:"g",H:"h",I:"i",L:"l",O:"o",P:"p",Q:"q",R:"r",S:"s",T:"t",V:"v",X:"x",Y:"y",Z:"z",K:"k",W:"w",0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9"},Yt=new Map([[S.Z,Re.Z],[S.Y,Re.Y]]),$t=e=>/^[a-z]$/.test(e.toLowerCase()),ss=(e,t)=>{if(t===e.key.toLowerCase())return!0;let n=Yt.get(t);return!!(n&&!$t(e.key)&&e.code===n)},as=e=>e===S.ARROW_LEFT||e===S.ARROW_RIGHT||e===S.ARROW_DOWN||e===S.ARROW_UP,is=e=>e.altKey,ls=e=>e.shiftKey,cs=e=>e.shiftKey;p();import{pointFrom as Le,pointFromPair as zt}from"@excalidraw/math";var fs=e=>{let t=e.map(r=>r[0]),n=e.map(r=>r[1]);return{width:Math.max(...t)-Math.min(...t),height:Math.max(...n)-Math.min(...n)}},hs=(e,t,n,r)=>{let o=n.map(y=>y[e]),s=Math.max(...o),i=Math.min(...o),a=s-i,l=a===0?1:t/a,u=1/0,m=n.map(y=>{let v=y[e]*l,F=[...y];return F[e]=v,v<u&&(u=v),F});if(!r||m.length===2)return m;let b=i-u;return m.map(y=>zt(y.map((v,F)=>F===e?v+b:v)))},ms=(e,t,n)=>n?Le(Math.round(e/n)*n,Math.round(t/n)*n):Le(e,t);p();var Ie=Q(we(),1),Fe=class{pool;entries={};constructor(t,n){this.pool=new Ie.default(t,n)}all(){let t=n=>{if(n.data.result){let[r,o]=n.data.result;this.entries[r]=o}};return this.pool.addEventListener("fulfilled",t),this.pool.start().then(()=>(setTimeout(()=>{this.pool.removeEventListener("fulfilled",t)}),Object.values(this.entries)))}};p();p();p();var Ce=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,n)=>(n&=63,n<36?t+=n.toString(36):n<62?t+=(n-26).toString(36).toUpperCase():n>62?t+="-":t+="_",t),"");p();var O=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}};p();import{average as N}from"@excalidraw/math";var Y=null,Fs=e=>{Y=e},Is=()=>{if(Y)return Y;let e=new Date,t=e.getFullYear(),n=`${e.getMonth()+1}`.padStart(2,"0"),r=`${e.getDate()}`.padStart(2,"0"),o=`${e.getHours()}`.padStart(2,"0"),s=`${e.getMinutes()}`.padStart(2,"0");return`${t}-${n}-${r}-${o}${s}`},Cs=e=>e.charAt(0).toUpperCase()+e.slice(1),Ps=e=>e instanceof HTMLElement&&e.className.includes("ToolIcon"),Xt=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,Ds=e=>Xt(e)||e instanceof Element&&!!e.closest("label, button"),ks=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&(e.type==="text"||e.type==="number"||e.type==="password"||e.type==="search")||e instanceof HTMLElement&&e.closest(".cm-editor")!==null,jt=({fontFamily:e})=>{for(let[t,n]of Object.entries(T))if(n===e)return`${t}${Ee(n).map(r=>`, ${r}`).join("")}`;return L},Us=({fontSize:e,fontFamily:t})=>`${e}px ${jt({fontFamily:t})}`,Ns=async e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},Hs=(e,t)=>{let n=0,r=null,o=(...s)=>{r=s,clearTimeout(n),n=window.setTimeout(()=>{r=null,e(...s)},t)};return o.flush=()=>{if(clearTimeout(n),r){let s=r;r=null,e(...s)}},o.cancel=()=>{r=null,clearTimeout(n)},o},Gs=e=>{let t=null,n=null,r=()=>{t=window.requestAnimationFrame(()=>{t=null;let s=n;n=null,s&&e(...s)})},o=(...s)=>{n=s,t===null&&r()};return o.flush=()=>{t!==null&&(cancelAnimationFrame(t),t=null),n&&(e(...n),n=null)},o.cancel=()=>{n=null,t!==null&&(cancelAnimationFrame(t),t=null)},o},Bs=e=>1-Math.pow(1-e,4),Ks=(e,t)=>{if(!e.length||t<1)return[];let n=0,r=0,o=Array(Math.ceil(e.length/t));for(;n<e.length;)o[r++]=e.slice(n,n+=t);return o},Ws=e=>{let t=window.getSelection();if(t){let n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}},Vs=()=>{let e=window.getSelection();e&&e.removeAllRanges()},Ys=(e,t)=>Math.abs(e-t),$s=e=>e==="selection"||e==="lasso",zs=(e,t)=>t.type==="custom"?{...e.activeTool,type:"custom",customType:t.customType,locked:t.locked??e.activeTool.locked}:{...e.activeTool,lastActiveTool:t.lastActiveTool===void 0?e.activeTool.lastActiveTool:t.lastActiveTool,type:t.type,customType:null,locked:t.locked??e.activeTool.locked,fromSelection:t.fromSelection??!1},Xs=()=>document.fullscreenElement?.nodeName==="HTML",js=()=>document.documentElement.requestFullscreen(),qs=()=>document.exitFullscreen(),Zs=({clientX:e,clientY:t},{zoom:n,offsetLeft:r,offsetTop:o,scrollX:s,scrollY:i})=>{let a=(e-r)/n.value-s,l=(t-o)/n.value-i;return{x:a,y:l}},Qs=({sceneX:e,sceneY:t},{zoom:n,offsetLeft:r,offsetTop:o,scrollX:s,scrollY:i})=>{let a=(e+s)*n.value+r,l=(t+i)*n.value+o;return{x:a,y:l}},Js=e=>getComputedStyle(document.documentElement).getPropertyValue(`--${e}`),qt="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u2C00-\uFB1C\uFDFE-\uFE6F\uFEFD-\uFFFF",Zt="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Qt=new RegExp(`^[^${qt}]*[${Zt}]`),ea=e=>Qt.test(e),ta=e=>{let[t,n]=e;return{x:t,y:n}},na=e=>{if(e?.name==="AbortError"){console.warn(e);return}throw e},ra=(e,t,n=0)=>{n<0&&(n=e.length+n),n=Math.min(e.length,Math.max(n,0));let r=n-1;for(;++r<e.length;)if(t(e[r],r,e))return r;return-1},oa=(e,t,n=e.length-1)=>{n<0&&(n=e.length+n),n=Math.min(e.length-1,Math.max(n,0));let r=n+1;for(;--r>-1;)if(t(e[r],r,e))return r;return-1},sa=(e,t)=>{for(let n=0;n<e.length;n++){let r=t(e[n],n);if(r!=null)return r}},xe=()=>{let e,t,n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n},aa=(e,t)=>{let n=[{value:1,symbol:"b"},{value:1e3,symbol:"k"},{value:1e6,symbol:"M"},{value:1e9,symbol:"G"}],r=/\.0+$|(\.[0-9]*[1-9])0+$/,o;for(o=n.length-1;o>0&&!(e>=n[o].value);o--);return(e/n[o].value).toFixed(t).replace(r,"$1")+n[o].symbol},ia=()=>document.querySelector('meta[name="version"]')?.content||Te,la=()=>{let t=document.createElement("canvas").getContext("2d");if(!t)return!1;let n=12;return t.fillStyle="#f00",t.textBaseline="top",t.font="32px Arial",t.fillText("\u{1F600}",0,0),t.getImageData(n,n,1,1).data[0]!==0},ca=e=>{let t=e.parentElement;for(;t;){if(t===document.body)return document;let{overflowY:n}=window.getComputedStyle(t);if(t.scrollHeight>t.clientHeight&&(n==="auto"||n==="scroll"||n==="overlay"))return t;t=t.parentElement}return document},ua=e=>{let t=e.parentElement;for(;t;){if(t.tabIndex>-1){t.focus();return}t=t.parentElement}},pa=e=>{e.preventDefault(),e.returnValue=""},da=e=>Array.from(e).map(t=>`0${t.toString(16)}`.slice(-2)).join(""),fa=()=>z()?1:Date.now(),ha=e=>e instanceof Map?e:e.reduce((t,n)=>(t.set(typeof n=="string"?n:n.id,n),t),new Map),ma=e=>e.reduce((t,n,r)=>(t.set(n.id,[n,r]),t),new Map),Ea=(e,t)=>e.reduce((n,r,o)=>(n[t?t(r):o]=r,n),{}),Ta=e=>e.reduce((t,n,r)=>{let o={...n,prev:null,next:null};if(r!==0){let s=t[r-1];if(o.prev=s,s.next=o,r===e.length-1){let i=t[0];o.next=i,i.prev=o}}return t.push(o),t},[]),Jt=e=>Array.isArray(e)?e:e.values(),ba=e=>Array.isArray(e)?e:Array.from(Jt(e)),z=()=>h.MODE===k.TEST,ga=()=>h.MODE===k.DEVELOPMENT,De=()=>h.MODE===k.PRODUCTION,_a=()=>typeof process<"u"&&!0,xa=(e,t)=>new CustomEvent(e,{detail:{nativeEvent:t},cancelable:!0}),Aa=(e,t)=>{let n=!1;for(let r in t){let o=t[r];if(typeof o<"u"){if(e[r]===o&&(typeof o!="object"||o===null))continue;n=!0}}return n?{...e,...t}:e},ya=e=>{let t=typeof e;return e==null||t!=="object"&&t!=="function"},en=()=>{try{return window.self===window.top?"top":"iframe"}catch{return"iframe"}},va=()=>en()==="iframe",Sa=e=>!!e&&typeof e=="object"&&"then"in e&&"catch"in e&&"finally"in e,Ma=e=>{let t=e?.querySelectorAll("button, a, input, select, textarea, div[tabindex], label[tabindex]");return t?Array.from(t).filter(n=>n.tabIndex>-1&&!n.disabled):[]},Pe=(e,t)=>Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t,tn=(e,t,n,r=!1)=>{let o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return r&&console.warn("%cisShallowEqual: objects don't have same properties ->","color: #8B4000",e,t),!1;if(n&&Array.isArray(n)){for(let i of n)if(!(e[i]===t[i]||Pe(e[i],t[i])))return r&&console.warn(`%cisShallowEqual: ${i} not equal ->`,"color: #8B4000",e[i],t[i]),!1;return!0}return o.every(i=>{let a=n?.[i],l=a?a(e[i],t[i]):e[i]===t[i]||Pe(e[i],t[i]);return!l&&r&&console.warn(`%cisShallowEqual: ${i} not equal ->`,"color: #8B4000",e[i],t[i]),l})},Ra=(e,t,{checkForDefaultPrevented:n=!0}={})=>function(o){if(e?.(o),!n||!o?.defaultPrevented)return t?.(o)},La=(e,t,n)=>{if(!t)return e;if(n)return console.error(t),e;throw new Error(t)};function Oa(e,t){if(!e)throw new Error(t)}var wa=e=>{let t,n,r=function(o){let s=Object.entries(o);if(t){let a=!0;for(let[l,u]of s)if(t.get(l)!==u){a=!1;break}if(a)return n}let i=e(o);return t=new Map(s),n=i,i};return r.clear=()=>{t=void 0,n=void 0},r},Fa=(e,t)=>e instanceof Set||e instanceof Map?e.has(t):"includes"in e?e.includes(t):e.hasOwnProperty(t),Ia=e=>JSON.parse(JSON.stringify(e)),Ca=(e,t)=>tn(e,t)?e:t;function Pa(e,t,n,r){return e?(e?.addEventListener?.(t,n,r),()=>{e?.removeEventListener?.(t,n,r)}):()=>{}}function Da(e,t=!0){let n=e.length;if(n<4)return"";let r=e[0],o=e[1],s=e[2],i=`M${r[0].toFixed(2)},${r[1].toFixed(2)} Q${o[0].toFixed(2)},${o[1].toFixed(2)} ${N(o[0],s[0]).toFixed(2)},${N(o[1],s[1]).toFixed(2)} T`;for(let a=2,l=n-1;a<l;a++)r=e[a],o=e[a+1],i+=`${N(r[0],o[0]).toFixed(2)},${N(r[1],o[1]).toFixed(2)} `;return t&&(i+="Z"),i}var ka=e=>e.replace(/\r?\n|\r/g,`
4
+ `);function Ua(e){return e}var Ae=async(e,...t)=>new Promise(n=>{n(e(...t))}),Na=(...e)=>Math.max(...e.map(t=>t?1:0))>0,Ha=e=>{try{return JSON.parse(e)}catch{return null}},ke=e=>e.replace(/"/g,"&quot;"),Ga=e=>Array.isArray(e)?e:[e],nn=e=>Array.isArray(e),rn=e=>nn(e)?e.length:e instanceof Map||e instanceof Set?e.size:Object.keys(e).length,Ba=(e,t)=>{if(rn(e)===0)return null;let n=t||(o=>o),r=null;for(let o of e){let s=n(o);if((r===null||r===s)&&s!=null)r=s;else return null}return r},Ue="excalidraw-feature-flags",$={COMPLEX_BINDINGS:!1},M=null,Ka=e=>{if(!M)try{let t=localStorage.getItem(Ue);t&&(M=JSON.parse(t)??$)}catch{}return(M||$)[e]},Wa=(e,t)=>{try{M={...M||$,[e]:t},localStorage.setItem(Ue,JSON.stringify(M))}catch(n){console.error("unable to set feature flag",n)}},Va=(e,t)=>t.includes(e);var Ne=new O(Date.now()),He=0,qa=()=>Math.floor(Ne.next()*2**31),Za=e=>{Ne=new O(e),He=0},Qa=()=>z()?`id${He++}`:Ce();p();var Be=Q(Ge(),1);var hn=e=>(e=e.trim(),e&&(0,Be.sanitizeUrl)(ke(e))),oi=e=>!!(e?.includes(location.origin)||e?.startsWith("/")),si=e=>{if(e=hn(e),e.startsWith("/"))return`${location.origin}${e}`;try{new URL(e)}catch{return"about:blank"}return e};p();var G=class{subscribers=[];on(...t){let n=t.flat().filter(r=>typeof r=="function");return this.subscribers.push(...n),()=>this.off(n)}once(...t){let n=t.flat().filter(o=>typeof o=="function");n.push(()=>r());let r=this.on(...n);return r}off(...t){let n=t.flat();this.subscribers=this.subscribers.filter(r=>!n.includes(r))}trigger(...t){for(let n of this.subscribers)n(...t);return this}clear(){this.subscribers=[]}};p();var Ke=class{constructor(t){this.behavior=t}emitters=new Map;lastPayload=new Map;emittedOnce=new Set;getEmitter(t){let n=this.emitters.get(t);return n||(n=new G,this.emitters.set(t,n)),n}toPromiseValue(t){return t.length===1?t[0]:t}on(t,n){let r=this.behavior[t],o=this.lastPayload.get(t);if(n)return r.replay==="last"&&o&&(queueMicrotask(()=>n(...o)),r.cardinality==="once")?()=>{}:this.getEmitter(t).on(n);if(r.cardinality!=="once"||r.replay!=="last")throw new Error(`Event "${String(t)}" requires a callback`);return o?Promise.resolve(this.toPromiseValue(o)):new Promise(s=>{this.getEmitter(t).once((...i)=>{s(this.toPromiseValue(i))})})}emit(t,...n){let r=this.behavior[t];if(!De()&&r.cardinality==="once"){if(this.emittedOnce.has(t))throw new Error(`Event "${String(t)}" can only be emitted once`);this.emittedOnce.add(t)}r.replay==="last"&&this.lastPayload.set(t,n);try{this.getEmitter(t).trigger(...n)}finally{r.cardinality==="once"&&this.getEmitter(t).clear()}}clear(){this.lastPayload.clear(),this.emittedOnce.clear();for(let t of this.emitters.values())t.clear();this.emitters.clear()}};p();var We=class{constructor(t,n=Object.is){this.isEqual=n;this.value=t}version=0;value;waiters=new Set;subscribers=new Set;getSnapshot(){return{version:this.version,value:this.value}}set(t){if(this.isEqual(this.value,t))return!1;this.value=t,this.version+=1;let n=this.getSnapshot();for(let r of this.subscribers)r(n);for(let r of this.waiters)r(n);return this.waiters.clear(),!0}update(t){return this.set(t(this.value))}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}pull(t=-1){return this.version!==t?Promise.resolve(this.getSnapshot()):new Promise(n=>{this.waiters.add(n)})}};p();var w=(e,t=5)=>parseFloat(e.toPrecision(t)),mn=e=>w(e.reduce((t,n)=>t+n)/e.length),X=class e{static DEBUG_LOG_TIMES=!0;static TIMES_AGGR={};static TIMES_AVG={};static LAST_DEBUG_LOG_CALL=0;static DEBUG_LOG_INTERVAL_ID=null;static LAST_FRAME_TIMESTAMP=0;static FRAME_COUNT=0;static ANIMATION_FRAME_ID=null;static scheduleAnimationFrame=()=>{e.DEBUG_LOG_INTERVAL_ID!==null&&(e.ANIMATION_FRAME_ID=requestAnimationFrame(t=>{e.LAST_FRAME_TIMESTAMP!==t&&(e.LAST_FRAME_TIMESTAMP=t,e.FRAME_COUNT++),e.DEBUG_LOG_INTERVAL_ID!==null&&e.scheduleAnimationFrame()}))};static setupInterval=()=>{e.DEBUG_LOG_INTERVAL_ID===null&&(console.info("%c(starting perf recording)","color: lime"),e.DEBUG_LOG_INTERVAL_ID=window.setInterval(e.debugLogger,1e3),e.scheduleAnimationFrame()),e.LAST_DEBUG_LOG_CALL=Date.now()};static debugLogger=()=>{if(e.DEBUG_LOG_TIMES){for(let[t,{t:n,times:r}]of Object.entries(e.TIMES_AGGR))r.length&&(console.info(t,w(r.reduce((o,s)=>o+s)),r.sort((o,s)=>o-s).map(o=>w(o))),e.TIMES_AGGR[t]={t:n,times:[]});for(let[t,{t:n,times:r,avg:o}]of Object.entries(e.TIMES_AVG))if(r.length){let s=r.reduce((a,l)=>a+l),i=w(s/e.FRAME_COUNT);console.info(t,`- ${r.length} calls - ${i}ms/frame across ${e.FRAME_COUNT} frames (${w(i/16.67*100,1)}% of frame budget)`),e.TIMES_AVG[t]={t:n,times:[],avg:o!=null?mn([o,i]):i}}}e.FRAME_COUNT=0,Date.now()-e.LAST_DEBUG_LOG_CALL>600&&e.DEBUG_LOG_INTERVAL_ID!==null&&(console.info("%c(stopping perf recording)","color: red"),window.clearInterval(e.DEBUG_LOG_INTERVAL_ID),window.cancelAnimationFrame(e.ANIMATION_FRAME_ID),e.ANIMATION_FRAME_ID=null,e.FRAME_COUNT=0,e.LAST_FRAME_TIMESTAMP=0,e.DEBUG_LOG_INTERVAL_ID=null,e.TIMES_AGGR={},e.TIMES_AVG={})};static logTime=(t,n="default")=>{e.setupInterval();let r=performance.now(),{t:o,times:s}=e.TIMES_AGGR[n]=e.TIMES_AGGR[n]||{t:0,times:[]};o&&s.push(t??r-o),e.TIMES_AGGR[n].t=r};static logTimeAverage=(t,n="default")=>{e.setupInterval();let r=performance.now(),{t:o,times:s}=e.TIMES_AVG[n]=e.TIMES_AVG[n]||{t:0,times:[]};o&&s.push(t??r-o),e.TIMES_AVG[n].t=r};static logWrapper=t=>(n,r="default")=>(...o)=>{let s=performance.now(),i=n(...o);return e[t](performance.now()-s,r),i};static logTimeWrap=e.logWrapper("logTime");static logTimeAverageWrap=e.logWrapper("logTimeAverage");static perfWrap=(t,n="default")=>(...r)=>{console.time(n);let o=t(...r);return console.timeEnd(n),o};static CHANGED_CACHE={};static logChanged(t,n){let r=e.CHANGED_CACHE[t];if(e.CHANGED_CACHE[t]=n,!r)return;let o=new Set([...Object.keys(r),...Object.keys(n)]),s={};for(let i of o){let a=r[i],l=n[i];Ve(a,l)||(s[i]={prev:a,next:l})}Object.keys(s).length>0&&console.info(`[${t}] changed:`,s)}};function Ve(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object"||Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o of n)if(!Ve(e[o],t[o]))return!1;return!0}export{Nr as ACTIVE_THRESHOLD,yr as ALLOWED_PASTE_MIME_TYPES,$n as APP_NAME,Qr as ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO,Zr as ARROW_LABEL_WIDTH_FRACTION,bo as ARROW_TYPE,Ke as AppEventBus,vo as BIND_MODE_TIMEOUT,qr as BOUND_TEXT_PADDING,J as BinaryHeap,_r as CANVAS_ONLY_ACTIONS,co as CANVAS_SEARCH_TAB,fe as CJK_HAND_DRAWN_FALLBACK_FONT,ar as CLASSES,Re as CODES,wn as COLORS_PER_ROW,br as COLOR_CHARCOAL_BLACK,Hn as COLOR_OUTLINE_CONTRAST_THRESHOLD,d as COLOR_PALETTE,gr as COLOR_VOICE_CALL,Tr as COLOR_WHITE,nr as CURSOR_TYPE,cr as DARK_THEME_FILTER,oo as DEFAULT_ADAPTIVE_RADIUS,Pn as DEFAULT_CANVAS_BACKGROUND_PICKS,Fn as DEFAULT_CHART_COLOR_INDEX,Er as DEFAULT_COLLISION_THRESHOLD,D as DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX,kn as DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE,Cn as DEFAULT_ELEMENT_BACKGROUND_PICKS,lo as DEFAULT_ELEMENT_PROPS,P as DEFAULT_ELEMENT_STROKE_COLOR_INDEX,Dn as DEFAULT_ELEMENT_STROKE_COLOR_PALETTE,In as DEFAULT_ELEMENT_STROKE_PICKS,Ut as DEFAULT_ELEMENT_STROKE_WIDTH_KEY,Vr as DEFAULT_EXPORT_PADDING,mo as DEFAULT_FILENAME,fr as DEFAULT_FONT_FAMILY,dr as DEFAULT_FONT_SIZE,xr as DEFAULT_GRID_SIZE,Ar as DEFAULT_GRID_STEP,Yr as DEFAULT_IMAGE_OPTIONS,tr as DEFAULT_LASER_COLOR,ro as DEFAULT_PROPORTIONAL_RADIUS,go as DEFAULT_REDUCED_GLOBAL_ALPHA,uo as DEFAULT_SIDEBAR,Mo as DEFAULT_STROKE_STREAMLINE,Ro as DEFAULT_STROKE_STREAMLINE_PRECISE,hr as DEFAULT_TEXT_ALIGN,Ft as DEFAULT_TRANSFORM_HANDLE_SPACING,Br as DEFAULT_UI_OPTIONS,Te as DEFAULT_VERSION,mr as DEFAULT_VERTICAL_ALIGN,yo as DOUBLE_TAP_POSITION_THRESHOLD,Xn as DRAGGING_THRESHOLD,X as Debug,ho as EDITOR_LS_KEYS,_o as ELEMENT_LINK_KEY,no as ELEMENT_PENDING_DRAW_SHAPE_OPACITY,to as ELEMENT_READY_TO_ERASE_OPACITY,Zn as ELEMENT_SHIFT_TRANSLATE_AMOUNT,Qn as ELEMENT_TRANSLATE_AMOUNT,Xr as ENCRYPTION_KEY_BITS,k as ENV,Ct as EPSILON,Lt as EVENT,Sr as EXPORT_DATA_TYPES,vr as EXPORT_IMAGE_TYPES,Wr as EXPORT_SCALES,G as Emitter,T as FONT_FAMILY,W as FONT_FAMILY_FALLBACKS,Ot as FONT_FAMILY_GENERIC_FALLBACKS,U as FONT_METADATA,ir as FONT_SIZES,ur as FRAME_STYLE,kt as FREEDRAW_STROKE_WIDTH,Fo as GOOGLE_FONTS_RANGES,kr as HYPERLINK_TOOLTIP_DELAY,Ur as IDLE_THRESHOLD,be as IMAGE_MIME_TYPES,Rr as IMAGE_RENDER_TIMEOUT,S as KEYS,Yt as KeyCodeMap,po as LIBRARY_DISABLED_TYPES,Nt as LIBRARY_SIDEBAR_TAB,qn as LINE_CONFIRM_THRESHOLD,Ao as LINE_POLYGON_POINT_MERGE_DISTANCE,Io as LOCAL_FONT_PROTOCOL,On as MAX_CUSTOM_COLORS_USED_IN_CANVAS,Kr as MAX_DECIMALS_FOR_SVG_EXPORT,Dr as MAX_ZOOM,de as MIME_TYPES,jn as MINIMUM_ARROW_SIZE,pr as MIN_FONT_SIZE,To as MIN_WIDTH_OR_HEIGHT,Pr as MIN_ZOOM,So as MOBILE_ACTION_BUTTON_BG,me as MONOSPACE_GENERIC_FONT,Ko as MQ_MAX_HEIGHT_LANDSCAPE,Go as MQ_MAX_MOBILE,Vo as MQ_MAX_TABLET,Bo as MQ_MAX_WIDTH_LANDSCAPE,Wo as MQ_MIN_TABLET,Yo as MQ_MIN_WIDTH_DESKTOP,$o as MQ_RIGHT_SIDEBAR_MIN_WIDTH,xo as ORIG_ID,rr as POINTER_BUTTON,or as POINTER_EVENTS,Fe as PromisePool,_e as Queue,Dt as ROUGHNESS,so as ROUNDNESS,he as SANS_SERIF_GENERIC_FONT,Ir as SCROLL_TIMEOUT,er as SHIFT_LOCKING_ANGLE,It as SIDE_RESIZING_THRESHOLD,Eo as STATS_PANELS,Pt as STRING_MIME_TYPES,ge as STROKE_WIDTH,ao as STROKE_WIDTH_KEYS,zr as SVG_DOCUMENT_PREAMBLE,$r as SVG_NS,Lr as TAP_TWICE_TIMEOUT,eo as TEXT_ALIGN,zn as TEXT_AUTOWRAP_THRESHOLD,Jn as TEXT_TO_CENTER_SNAP_THRESHOLD,lr as THEME,wr as TITLE_TIMEOUT,fo as TOOL_TYPE,Or as TOUCH_CTX_MENU_TIMEOUT,Gr as URL_HASH_KEYS,Hr as URL_QUERY_KEYS,Ht as UserIdleState,jr as VERSIONS,Fr as VERSION_TIMEOUT,Jr as VERTICAL_ALIGN,We as VersionedSnapshotStore,L as WINDOWS_EMOJI_FALLBACK_FONT,sr as YOUTUBE_STATES,Cr as ZOOM_STEP,Pa as addEventListener,js as allowFullScreen,Ln as applyDarkModeFilter,Ta as arrayToList,ha as arrayToMap,ma as arrayToMapWithIndex,Ea as arrayToObject,La as assertNever,da as bytesToHexString,Cs as capitalizeString,Ga as castArray,Ks as chunk,Ia as cloneJSON,Nn as colorToHex,Ra as composeEventHandlers,Jo as createUserAgentDescriptor,Hs as debounce,Qo as deriveStylesPanelMode,Ys as distance,Bs as easeOut,ke as escapeDoubleQuotes,qs as exitFullScreen,ra as findIndex,oa as findLastIndex,ua as focusNearestParent,Un as getAllColorsSpecificShade,Is as getDateTime,Mr as getExportSource,Ka as getFeatureFlag,Ee as getFontFamilyFallbacks,jt as getFontFamilyString,Us as getFontString,Zo as getFormFactor,en as getFrame,wt as getGenericFontFamilyFallback,Js as getGlobalCSSVariable,ms as getGridPoint,Po as getLineHeight,ca as getNearestScrollableContainer,fs as getSizeFromPoints,io as getStrokeWidthByKey,Da as getSvgPathFromStroke,fa as getUpdatedTimestamp,ia as getVersion,Co as getVerticalOffset,Oa as invariant,Se as isAndroid,Na as isAnyTrue,as as isArrowKey,_n as isBounds,qo as isBrave,Gt as isChrome,Gn as isColorDark,ve as isDarwin,ga as isDevEnv,Xo as isFirefox,Xs as isFullScreen,Me as isIOS,Xt as isInputLike,Ds as isInteractive,$t as isLatinChar,oi as isLocalLink,Fa as isMemberOf,Bt as isMobileBreakpoint,ya as isPrimitive,De as isProdEnv,Sa as isPromiseLike,ea as isRTL,nn as isReadonlyArray,va as isRunningInIframe,jo as isSafari,$s as isSelectionLikeTool,_a as isServerEnv,tn as isShallowEqual,Kt as isTabletBreakpoint,z as isTestEnv,Ps as isToolIcon,pe as isTransparent,zo as isWindows,ks as isWritableElement,es as loadDesktopUIModePreference,sa as mapFind,ss as matchKey,wa as memoize,na as muteFSAbortError,aa as nFormatter,Ns as nextAnimationFrame,ka as normalizeEOL,Bn as normalizeInputColor,hn as normalizeLink,Va as oneOf,pa as preventUnload,Ae as promiseTry,Ma as queryFocusableElements,Qa as randomId,qa as randomInteger,Ba as reduceToCommonValue,Vs as removeSelection,hs as rescalePoints,Za as reseed,xe as resolvablePromise,ue as rgbToHex,Ha as safelyParseJSON,Qs as sceneCoordsToViewportCoords,Ws as selectNode,Fs as setDateTimeForTests,ts as setDesktopUIMode,Wa as setFeatureFlag,ls as shouldMaintainAspectRatio,is as shouldResizeFromCenter,cs as shouldRotateWithDiscreteAngle,rn as sizeOf,la as supportsEmoji,Yn as supportsResizeObserver,Gs as throttleRAF,ba as toArray,Ua as toBrandedType,Jt as toIterable,si as toValidURL,ta as tupleToCoors,zs as updateActiveTool,Aa as updateObject,Ca as updateStable,Zs as viewportCoordsToSceneCoords,xa as wrapEvent};
@@ -262,6 +262,7 @@ export declare const TEXT_ALIGN: {
262
262
  RIGHT: string;
263
263
  };
264
264
  export declare const ELEMENT_READY_TO_ERASE_OPACITY = 20;
265
+ export declare const ELEMENT_PENDING_DRAW_SHAPE_OPACITY = 70;
265
266
  export declare const DEFAULT_PROPORTIONAL_RADIUS = 0.25;
266
267
  export declare const DEFAULT_ADAPTIVE_RADIUS = 32;
267
268
  export declare const ROUNDNESS: {
@@ -314,6 +315,7 @@ export declare const TOOL_TYPE: {
314
315
  readonly magicframe: "magicframe";
315
316
  readonly embeddable: "embeddable";
316
317
  readonly laser: "laser";
318
+ readonly autoshape: "autoshape";
317
319
  };
318
320
  export declare const EDITOR_LS_KEYS: {
319
321
  readonly OAI_API_KEY: "excalidraw-oai-api-key";
@@ -6,4 +6,4 @@ export declare const getSizeFromPoints: (points: readonly (GlobalPoint | LocalPo
6
6
  };
7
7
  /** @arg dimension, 0 for rescaling only x, 1 for y */
8
8
  export declare const rescalePoints: <Point extends GlobalPoint | LocalPoint>(dimension: 0 | 1, newSize: number, points: readonly Point[], normalize: boolean) => Point[];
9
- export declare const getGridPoint: (x: number, y: number, gridSize: NullableGridSize) => [number, number];
9
+ export declare const getGridPoint: (x: number, y: number, gridSize: NullableGridSize) => GlobalPoint;
@@ -51,7 +51,7 @@ export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">,
51
51
  locked?: boolean;
52
52
  fromSelection?: boolean;
53
53
  }) & {
54
- lastActiveToolBeforeEraser?: ActiveTool | null;
54
+ lastActiveTool?: ActiveTool | null;
55
55
  }) => AppState["activeTool"];
56
56
  export declare const isFullScreen: () => boolean;
57
57
  export declare const allowFullScreen: () => Promise<void>;
@@ -0,0 +1,49 @@
1
+ import type { GlobalPoint } from "@excalidraw/math";
2
+ import type { AppState } from "@excalidraw/excalidraw/types";
3
+ import type { ElementsMap, ExcalidrawArrowElement, ExcalidrawTextElement, FixedPoint, NonDeleted, NonDeletedExcalidrawElement, TextAlign, VerticalAlign } from "./types";
4
+ export type ArrowEndpoint = {
5
+ arrow: NonDeleted<ExcalidrawArrowElement>;
6
+ startOrEnd: "start" | "end";
7
+ };
8
+ /**
9
+ * Finds a free (unbound) arrow endpoint under the cursor, front-most first.
10
+ * Used by the text tool to offer creating a text label anchored to the tip of
11
+ * an arrow.
12
+ */
13
+ export declare const getUnboundArrowEndpointAtPoint: (scenePointer: GlobalPoint, elements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, zoom: AppState["zoom"]) => ArrowEndpoint | null;
14
+ /**
15
+ * Describes how a text element should be created so that it reads as a label
16
+ * for the given arrow endpoint.
17
+ *
18
+ * The arrow is treated as fixed: rather than routing the arrow to the text, we
19
+ * pick the side of the text the arrow should attach to (the one it already
20
+ * points at), and place the text so that side's midpoint lands on the existing
21
+ * endpoint. The alignment returned pins that same midpoint while the text is
22
+ * typed, so the arrow doesn't swing around during editing.
23
+ */
24
+ export declare const getTextBindingForArrowEndpoint: (arrow: NonDeleted<ExcalidrawArrowElement>, startOrEnd: "start" | "end", elementsMap: ElementsMap,
25
+ /**
26
+ * stroke width the text will be created with — the binding gap is derived
27
+ * from the *bind target*, so using the arrow's would offset the anchor by
28
+ * half the difference between the two
29
+ */
30
+ targetStrokeWidth: number) => {
31
+ /** the text-local ratio the arrow binds to (a side midpoint) */
32
+ fixedPoint: FixedPoint;
33
+ textAlign: TextAlign;
34
+ verticalAlign: VerticalAlign;
35
+ /** scene position the text's bound side midpoint should sit at */
36
+ anchor: GlobalPoint;
37
+ } | null;
38
+ /**
39
+ * Whether an arrow endpoint is bound to this text — i.e. the text serves as an
40
+ * arrow-endpoint label. Checked on the arrows' own bindings: the text's
41
+ * `boundElements` only says an arrow relates to it, while the binding on the
42
+ * arrow is the authoritative side of the relationship.
43
+ */
44
+ export declare const isEndpointBoundText: (text: ExcalidrawTextElement, elementsMap: ElementsMap) => boolean;
45
+ /** the anchor a text bound to an arrow endpoint grows away from */
46
+ export declare const getEndpointBoundTextDragAnchor: (newElement: ExcalidrawTextElement) => {
47
+ anchorRatio: number;
48
+ anchorX: number;
49
+ };
@@ -1,7 +1,7 @@
1
1
  import { type GlobalPoint } from "@excalidraw/math";
2
2
  import type { AppState, NullableGridSize } from "@excalidraw/excalidraw/types";
3
3
  import { LinearElementEditor } from "../linearElementEditor";
4
- import type { ElementsMap, ExcalidrawArrowElement, ExcalidrawBindableElement, NonDeletedSceneElementsMap } from "../types";
4
+ import type { ElementsMap, ExcalidrawArrowElement, ExcalidrawBindableElement, FixedPointBinding, NonDeletedSceneElementsMap } from "../types";
5
5
  import type { Scene } from "../Scene";
6
6
  export declare const isFocusPointVisible: (focusPoint: GlobalPoint, arrow: ExcalidrawArrowElement, bindableElement: ExcalidrawBindableElement, elementsMap: ElementsMap, appState: {
7
7
  isBindingEnabled: AppState["isBindingEnabled"];
@@ -22,6 +22,9 @@ export declare const handleFocusPointPointerDown: (arrow: ExcalidrawArrowElement
22
22
  x: number;
23
23
  y: number;
24
24
  };
25
+ arrowOtherEndpointInitialBinding: FixedPointBinding | null;
26
+ };
27
+ export declare const handleFocusPointPointerUp: (linearElementEditor: LinearElementEditor, scene: Scene) => {
28
+ arrowOtherEndpointInitialBinding: null;
25
29
  };
26
- export declare const handleFocusPointPointerUp: (linearElementEditor: LinearElementEditor, scene: Scene) => void;
27
30
  export declare const handleFocusPointHover: (arrow: ExcalidrawArrowElement, scenePointerX: number, scenePointerY: number, scene: Scene, appState: AppState) => "start" | "end" | null;
@@ -1,6 +1,6 @@
1
1
  import { type GlobalPoint } from "@excalidraw/math";
2
2
  import type { LineSegment, LocalPoint } from "@excalidraw/math";
3
- import type { AppState } from "@excalidraw/excalidraw/types";
3
+ import type { AppState, NullableGridSize } from "@excalidraw/excalidraw/types";
4
4
  import type { Bounds } from "@excalidraw/common";
5
5
  import { type Heading } from "./heading";
6
6
  import type { Scene } from "./Scene";
@@ -28,7 +28,7 @@ export declare const BASE_BINDING_GAP = 5;
28
28
  export declare const BASE_BINDING_GAP_ELBOW = 5;
29
29
  export declare const BASE_ARROW_MIN_LENGTH = 10;
30
30
  export declare const FOCUS_POINT_SIZE: number;
31
- export declare const getBindingGap: (bindTarget: ExcalidrawBindableElement, opts: Pick<ExcalidrawArrowElement, "elbowed">) => number;
31
+ export declare const getBindingGap: (bindTarget: Pick<ExcalidrawBindableElement, "strokeWidth">, opts: Pick<ExcalidrawArrowElement, "elbowed">) => number;
32
32
  export declare const maxBindingDistance_simple: (zoom?: AppState["zoom"]) => number;
33
33
  export declare const isBindingEnabled: (appState: {
34
34
  isBindingEnabled: AppState["isBindingEnabled"];
@@ -38,6 +38,7 @@ export declare const bindOrUnbindBindingElement: (arrow: NonDeleted<ExcalidrawAr
38
38
  altKey?: boolean;
39
39
  angleLocked?: boolean;
40
40
  initialBinding?: boolean;
41
+ gridSize?: NullableGridSize;
41
42
  }) => {
42
43
  start: BindingStrategy;
43
44
  end: BindingStrategy;
@@ -49,12 +50,13 @@ export declare const getBindingStrategyForDraggingBindingElementEndpoints: (arro
49
50
  finalize?: boolean;
50
51
  initialBinding?: boolean;
51
52
  zoom?: AppState["zoom"];
53
+ gridSize?: NullableGridSize;
52
54
  }) => {
53
55
  start: BindingStrategy;
54
56
  end: BindingStrategy;
55
57
  };
56
58
  export declare const bindOrUnbindBindingElements: (selectedArrows: NonDeleted<ExcalidrawArrowElement>[], scene: Scene, appState: AppState) => void;
57
- export declare const bindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, hoveredElement: NonDeleted<ExcalidrawBindableElement>, mode: BindMode, startOrEnd: "start" | "end", scene: Scene, focusPoint?: GlobalPoint, shouldSnapToOutline?: boolean) => void;
59
+ export declare const bindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, hoveredElement: NonDeleted<ExcalidrawBindableElement>, mode: BindMode, startOrEnd: "start" | "end", scene: Scene, focusPoint?: GlobalPoint, shouldSnapToOutline?: boolean, isMidpointSnappingEnabled?: boolean) => void;
58
60
  export declare const unbindBindingElement: (arrow: ExcalidrawArrowElement, startOrEnd: "start" | "end", scene: Scene) => ExcalidrawBindableElement["id"] | null;
59
61
  export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, scene: Scene, options?: {
60
62
  simultaneouslyUpdated?: readonly NonDeletedExcalidrawElement[];
@@ -127,3 +129,10 @@ export declare const getArrowLocalFixedPoints: (arrow: ExcalidrawElbowArrowEleme
127
129
  export declare const isFixedPoint: (fixedPoint: any) => fixedPoint is FixedPointBinding["fixedPoint"];
128
130
  export declare const normalizeFixedPoint: <T extends FixedPoint>(fixedPoint: T) => FixedPoint;
129
131
  export declare const getBindingSideMidPoint: (binding: FixedPointBinding, elementsMap: ElementsMap) => GlobalPoint | LocalPoint | null;
132
+ /**
133
+ * Binds an arrow endpoint to an explicit fixed point on a bindable element,
134
+ * bypassing the "derive the ratio from where the endpoint currently is"
135
+ * strategy used when dragging. Needed when the binding target is placed to fit
136
+ * the arrow rather than the other way round.
137
+ */
138
+ export declare const bindBindingElementToFixedPoint: (arrow: NonDeleted<ExcalidrawArrowElement>, bindableElement: NonDeleted<ExcalidrawBindableElement>, startOrEnd: "start" | "end", fixedPoint: FixedPoint, scene: Scene) => void;
@@ -1,8 +1,8 @@
1
1
  import type { ElementOrToolType } from "@excalidraw/excalidraw/types";
2
- export declare const hasBackground: (type: ElementOrToolType) => type is "line" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw";
3
- export declare const hasStrokeColor: (type: ElementOrToolType) => type is "line" | "arrow" | "text" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "freedraw";
4
- export declare const hasStrokeWidth: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw";
5
- export declare const hasStrokeStyle: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe";
2
+ export declare const hasBackground: (type: ElementOrToolType) => type is "line" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw" | "autoshape";
3
+ export declare const hasStrokeColor: (type: ElementOrToolType) => type is "line" | "arrow" | "text" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "freedraw" | "autoshape";
4
+ export declare const hasStrokeWidth: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw" | "autoshape";
5
+ export declare const hasStrokeStyle: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "autoshape";
6
6
  export declare const hasFreedrawMode: (type: ElementOrToolType) => type is "freedraw";
7
7
  export declare const canChangeRoundness: (type: ElementOrToolType) => type is "line" | "rectangle" | "diamond" | "embeddable" | "iframe" | "image";
8
8
  export declare const toolIsArrow: (type: ElementOrToolType) => type is "arrow";
@@ -0,0 +1,23 @@
1
+ import type { App, AppState } from "@excalidraw/excalidraw/types";
2
+ import type { LocalPoint, GlobalPoint } from "@excalidraw/math";
3
+ import type { Bounds } from "@excalidraw/common";
4
+ import type { ExcalidrawArrowElement, ExcalidrawDiamondElement, ExcalidrawElement, ExcalidrawEllipseElement, ExcalidrawFreeDrawElement, ExcalidrawFrameLikeElement, ExcalidrawRectangleElement, ElementsMap, NonDeleted, ExcalidrawLineElement } from "@excalidraw/element/types";
5
+ declare global {
6
+ interface Window {
7
+ LAST_POINTS?: readonly GlobalPoint[];
8
+ }
9
+ }
10
+ type NonDeletedRecognizedShapeElement = NonDeleted<ExcalidrawRectangleElement | ExcalidrawEllipseElement | ExcalidrawDiamondElement | ExcalidrawArrowElement | ExcalidrawLineElement | ExcalidrawFreeDrawElement>;
11
+ type Shape = NonDeletedRecognizedShapeElement["type"];
12
+ interface ShapeRecognitionResult<P extends LocalPoint | GlobalPoint> {
13
+ type: Shape;
14
+ points: readonly P[];
15
+ boundingBox: Bounds;
16
+ }
17
+ export declare const recognizeShape: <P extends LocalPoint | GlobalPoint>(points: P[], previousElement: ExcalidrawElement | null, zoom?: number) => ShapeRecognitionResult<P>;
18
+ export declare const convertToShape: (points: GlobalPoint[], appState: AppState, elementsMap: ElementsMap, previousElement: ExcalidrawElement | null, frames?: readonly ExcalidrawFrameLikeElement[]) => NonDeletedRecognizedShapeElement | undefined;
19
+ export declare const convertToShapeHandlePointerMoveFromPointerDown: (app: App, pointerCoords: {
20
+ x: number;
21
+ y: number;
22
+ }) => boolean;
23
+ export {};
@@ -1,6 +1,7 @@
1
1
  import type { AppState, NormalizedZoomValue, NullableGridSize, PointerDownState } from "@excalidraw/excalidraw/types";
2
2
  import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
3
3
  import type { Scene } from "./Scene";
4
+ import type { ExcalidrawTextElement } from "./types";
4
5
  export declare const dragSelectedElements: (pointerDownState: PointerDownState, _selectedElements: NonDeletedExcalidrawElement[], offset: {
5
6
  x: number;
6
7
  y: number;
@@ -9,6 +10,32 @@ export declare const dragSelectedElements: (pointerDownState: PointerDownState,
9
10
  y: number;
10
11
  }, gridSize: NullableGridSize) => void;
11
12
  export declare const getDragOffsetXY: (selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
13
+ /**
14
+ * Sizes a text element as it is dragged out.
15
+ *
16
+ * A dragged text pins one point and grows away from it; `anchorRatio` says
17
+ * where along the box that point sits — 0 for its left edge, 1 for its right,
18
+ * 0.5 for its centre.
19
+ *
20
+ * A free text pins the point the drag started from and takes the ratio from
21
+ * the drag direction, so it can be pulled either way. A text bound to an arrow
22
+ * endpoint instead pins whatever the binding placed it against and takes the
23
+ * ratio from its alignment — which is also what keeps it from growing back
24
+ * over the arrow, since dragging that way makes no progress rather than
25
+ * flipping the box around.
26
+ */
27
+ export declare const dragNewTextElement: ({ newElement, anchorX, anchorRatio, pointerX, nextY, zoom, scene, informMutation, }: {
28
+ newElement: ExcalidrawTextElement;
29
+ anchorX: number;
30
+ /** 0 = anchored by its left edge, 1 = by its right, 0.5 = by its centre */
31
+ anchorRatio: number;
32
+ pointerX: number;
33
+ /** free text re-tops itself to the drag origin; a bound one must not move */
34
+ nextY?: number;
35
+ zoom: NormalizedZoomValue;
36
+ scene: Scene;
37
+ informMutation?: boolean;
38
+ }) => void;
12
39
  export declare const dragNewElement: ({ newElement, elementType, originX, originY, x, y, width, height, shouldMaintainAspectRatio, shouldResizeFromCenter, zoom, scene, widthAspectRatio, originOffset, informMutation, }: {
13
40
  newElement: NonDeletedExcalidrawElement;
14
41
  elementType: AppState["activeTool"]["type"];
@@ -1,10 +1,7 @@
1
1
  import type { AppState, PendingExcalidrawElements } from "@excalidraw/excalidraw/types";
2
- import { type NonDeleted, type ElementsMap, type ExcalidrawBindableElement, type ExcalidrawElement, type ExcalidrawFlowchartNodeElement, type NonDeletedExcalidrawElement } from "./types";
2
+ import { type NonDeleted, type ElementsMap, type ExcalidrawElement, type ExcalidrawFlowchartNodeElement } from "./types";
3
3
  import type { Scene } from "./Scene";
4
- type LinkDirection = "up" | "right" | "down" | "left";
5
- export declare const getLinkDirectionFromKey: (key: string) => LinkDirection;
6
- export declare const getPredecessors: (node: ExcalidrawBindableElement, elementsMap: ElementsMap, direction: LinkDirection) => ExcalidrawBindableElement[];
7
- export declare const addNewNodes: (startNode: NonDeleted<ExcalidrawFlowchartNodeElement>, appState: AppState, direction: LinkDirection, scene: Scene, numberOfNodes: number) => NonDeletedExcalidrawElement[];
4
+ export type LinkDirection = "up" | "right" | "down" | "left";
8
5
  export declare class FlowChartNavigator {
9
6
  isExploring: boolean;
10
7
  private sameLevelNodes;
@@ -13,14 +10,17 @@ export declare class FlowChartNavigator {
13
10
  private visitedNodes;
14
11
  clear(): void;
15
12
  exploreByDirection(element: ExcalidrawElement, elementsMap: ElementsMap, direction: LinkDirection): ExcalidrawElement["id"] | null;
13
+ private static getNodeRelatives;
14
+ private static getSuccessors;
15
+ private static getPredecessors;
16
16
  }
17
17
  export declare class FlowChartCreator {
18
18
  isCreatingChart: boolean;
19
19
  private numberOfNodes;
20
20
  private direction;
21
+ private clusterCrossStart;
21
22
  pendingNodes: PendingExcalidrawElements | null;
22
23
  createNodes(startNode: NonDeleted<ExcalidrawFlowchartNodeElement>, appState: AppState, direction: LinkDirection, scene: Scene): void;
23
24
  clear(): void;
24
25
  }
25
26
  export declare const isNodeInFlowchart: (element: ExcalidrawFlowchartNodeElement, elementsMap: ElementsMap) => boolean;
26
- export {};
@@ -31,4 +31,4 @@ export declare const getNonDeletedGroupIds: (elements: ElementsMap) => Set<strin
31
31
  export declare const elementsAreInSameGroup: (elements: readonly ExcalidrawElement[]) => boolean;
32
32
  export declare const isInGroup: (element: ExcalidrawElement) => boolean;
33
33
  export declare const getNewGroupIdsForDuplication: (groupIds: ExcalidrawElement["groupIds"], editingGroupId: AppState["editingGroupId"], mapper: (groupId: GroupId) => GroupId) => string[];
34
- export declare const getSelectedElementsByGroup: (selectedElements: ExcalidrawElement[], elementsMap: ElementsMap, appState: Readonly<Pick<AppState, "selectedGroupIds" | "editingGroupId">>) => NonDeletedExcalidrawElement[][];
34
+ export declare const getSelectedElementsByGroup: (selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap, appState: Readonly<Pick<AppState, "selectedGroupIds" | "editingGroupId">>) => NonDeletedExcalidrawElement[][];
@@ -12,6 +12,7 @@ export declare const isNonDeletedElement: <T extends ExcalidrawElement>(element:
12
12
  export declare const getVisibleElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
13
13
  export declare const getNonDeletedElements: <T extends ExcalidrawElement>(elements: readonly T[]) => readonly NonDeleted<T>[];
14
14
  export * from "./align";
15
+ export * from "./arrowEndpointText";
15
16
  export * from "./binding";
16
17
  export * from "./bounds";
17
18
  export * from "./collision";
@@ -57,3 +58,4 @@ export * from "./utils";
57
58
  export * from "./zindex";
58
59
  export * from "./arrows/helpers";
59
60
  export * from "./arrowheads";
61
+ export * from "./convertToShape";