polotno 1.2.2 → 1.2.3
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.
- package/canvas/image-element.js +1 -1
- package/canvas/use-transformer-snap.js +1 -1
- package/model/store.js +1 -1
- package/package.json +1 -1
- package/polotno.bundle.js +10 -10
- package/side-panel/background-panel.js +1 -1
- package/side-panel/photos-panel.js +1 -1
- package/side-panel/side-panel.js +1 -1
- package/side-panel/tab-button.js +1 -1
- package/side-panel/text-panel.js +1 -1
- package/utils/svg.js +1 -1
- package/utils/wait.d.ts +1 -0
- package/utils/wait.js +1 -0
package/polotno.bundle.js
CHANGED
|
@@ -31,7 +31,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
31
31
|
THE SOFTWARE.
|
|
32
32
|
|
|
33
33
|
*/
|
|
34
|
-
!function(e){"use strict";function t(){return h.createDocumentFragment()}function n(e){return h.createElement(e)}function r(e,t){if(!e)throw new Error("Failed to construct "+t+": 1 argument required, but only 0 present.")}function i(e){if(1===e.length)return o(e[0]);for(var n=t(),r=T.call(e),i=0;i<e.length;i++)n.appendChild(o(r[i]));return n}function o(e){return"object"==typeof e?e:h.createTextNode(e)}for(var a,l,s,c,u,h=e.document,f=Object.prototype.hasOwnProperty,d=Object.defineProperty||function(e,t,n){return f.call(n,"value")?e[t]=n.value:(f.call(n,"get")&&e.__defineGetter__(t,n.get),f.call(n,"set")&&e.__defineSetter__(t,n.set)),e},p=[].indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},v=function(e){var t=void 0===e.className,n=t?e.getAttribute("class")||"":e.className,r=t||"object"==typeof n,i=(r?t?n:n.baseVal:n).replace(g,"");i.length&&P.push.apply(this,i.split(y)),this._isSVG=r,this._=e},m={get:function(){return new v(this)},set:function(){}},g=/^\s+|\s+$/g,y=/\s+/,b="classList",w=function(e,t){return this.contains(e)?t||this.remove(e):(void 0===t||t)&&(t=!0,this.add(e)),!!t},x=e.DocumentFragment&&DocumentFragment.prototype,E=e.Node,_=(E||Element).prototype,z=e.CharacterData||E,S=z&&z.prototype,C=e.DocumentType,O=C&&C.prototype,M=(e.Element||E||e.HTMLElement).prototype,A=e.HTMLSelectElement||n("select").constructor,k=A.prototype.remove,L=e.SVGElement,P=["matches",M.matchesSelector||M.webkitMatchesSelector||M.khtmlMatchesSelector||M.mozMatchesSelector||M.msMatchesSelector||M.oMatchesSelector||function(e){var t=this.parentNode;return!!t&&-1<p.call(t.querySelectorAll(e),this)},"closest",function(e){for(var t,n=this;(t=n&&n.matches)&&!n.matches(e);)n=n.parentNode;return t?n:null},"prepend",function(){var e=this.firstChild,t=i(arguments);e?this.insertBefore(t,e):this.appendChild(t)},"append",function(){this.appendChild(i(arguments))},"before",function(){var e=this.parentNode;e&&e.insertBefore(i(arguments),this)},"after",function(){var e=this.parentNode,t=this.nextSibling,n=i(arguments);e&&(t?e.insertBefore(n,t):e.appendChild(n))},"toggleAttribute",function(e,t){var n=this.hasAttribute(e);return 1<arguments.length?n&&!t?this.removeAttribute(e):t&&!n&&this.setAttribute(e,""):n?this.removeAttribute(e):this.setAttribute(e,""),this.hasAttribute(e)},"replace",function(){this.replaceWith.apply(this,arguments)},"replaceWith",function(){var e=this.parentNode;e&&e.replaceChild(i(arguments),this)},"remove",function(){var e=this.parentNode;e&&e.removeChild(this)}],T=P.slice,H=P.length;H;H-=2)if((l=P[H-2])in M||(M[l]=P[H-1]),"remove"!==l||k._dom4||((A.prototype[l]=function(){return 0<arguments.length?k.apply(this,arguments):M.remove.call(this)})._dom4=!0),/^(?:before|after|replace|replaceWith|remove)$/.test(l)&&(z&&!(l in S)&&(S[l]=P[H-1]),C&&!(l in O)&&(O[l]=P[H-1])),/^(?:append|prepend)$/.test(l))if(x)l in x||(x[l]=P[H-1]);else try{t().constructor.prototype[l]=P[H-1]}catch(e){}var N;n("a").matches("a")||(M[l]=(N=M[l],function(e){return N.call(this.parentNode?this:t().appendChild(this),e)})),v.prototype={length:0,add:function(){for(var e,t=0;t<arguments.length;t++)e=arguments[t],this.contains(e)||P.push.call(this,l);this._isSVG?this._.setAttribute("class",""+this):this._.className=""+this},contains:function(e){return function(t){return H=e.call(this,l=function(e){if(!e)throw"SyntaxError";if(y.test(e))throw"InvalidCharacterError";return e}(t)),-1<H}}([].indexOf||function(e){for(H=this.length;H--&&this[H]!==e;);return H}),item:function(e){return this[e]||null},remove:function(){for(var e,t=0;t<arguments.length;t++)e=arguments[t],this.contains(e)&&P.splice.call(this,H,1);this._isSVG?this._.setAttribute("class",""+this):this._.className=""+this},toggle:w,toString:function(){return P.join.call(this," ")}},L&&!(b in L.prototype)&&d(L.prototype,b,m),b in h.documentElement?((c=n("div").classList).add("a","b","a"),"a b"!=c&&("add"in(s=c.constructor.prototype)||(s=e.TemporaryTokenList.prototype),u=function(e){return function(){for(var t=0;t<arguments.length;)e.call(this,arguments[t++])}},s.add=u(s.add),s.remove=u(s.remove),s.toggle=w)):d(M,b,m),"contains"in _||d(_,"contains",{value:function(e){for(;e&&e!==this;)e=e.parentNode;return this===e}}),"head"in h||d(h,"head",{get:function(){return a||(a=h.getElementsByTagName("head")[0])}}),function(){for(var t,n=e.requestAnimationFrame,r=e.cancelAnimationFrame,i=["o","ms","moz","webkit"],o=i.length;!r&&o--;)n=n||e[i[o]+"RequestAnimationFrame"],r=e[i[o]+"CancelAnimationFrame"]||e[i[o]+"CancelRequestAnimationFrame"];r||(n?(t=n,n=function(e){var n=!0;return t((function(){n&&e.apply(this,arguments)})),function(){n=!1}},r=function(e){e()}):(n=function(e){return setTimeout(e,15,15)},r=function(e){clearTimeout(e)})),e.requestAnimationFrame=n,e.cancelAnimationFrame=r}();try{new e.CustomEvent("?")}catch(t){e.CustomEvent=function(e,t){function n(e,t,n,r){this.initEvent(e,t,n),this.detail=r}return function(r,i){var o=h.createEvent(e);if("string"!=typeof r)throw new Error("An event name must be provided");return"Event"==e&&(o.initCustomEvent=n),null==i&&(i=t),o.initCustomEvent(r,i.bubbles,i.cancelable,i.detail),o}}(e.CustomEvent?"CustomEvent":"Event",{bubbles:!1,cancelable:!1,detail:null})}try{new Event("_")}catch(t){t=function(e){function t(e,t){r(arguments.length,"Event");var n=h.createEvent("Event");return t||(t={}),n.initEvent(e,!!t.bubbles,!!t.cancelable),n}return t.prototype=e.prototype,t}(e.Event||function(){}),d(e,"Event",{value:t}),Event!==t&&(Event=t)}try{new KeyboardEvent("_",{})}catch(t){t=function(t){var n,i=0,o={char:"",key:"",location:0,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1,altGraphKey:!1,repeat:!1,locale:navigator.language,detail:0,bubbles:!1,cancelable:!1,keyCode:0,charCode:0,which:0};try{var a=h.createEvent("KeyboardEvent");a.initKeyboardEvent("keyup",!1,!1,e,"+",3,!0,!1,!0,!1,!1),i="+"==(a.keyIdentifier||a.key)&&3==(a.keyLocation||a.location)&&(a.ctrlKey?a.altKey?1:3:a.shiftKey?2:4)||9}catch(e){}function l(e){for(var t=[],n=["ctrlKey","Control","shiftKey","Shift","altKey","Alt","metaKey","Meta","altGraphKey","AltGraph"],r=0;r<n.length;r+=2)e[n[r]]&&t.push(n[r+1]);return t.join(" ")}function s(e,t){for(var n in t)t.hasOwnProperty(n)&&!t.hasOwnProperty.call(e,n)&&(e[n]=t[n]);return e}function c(e,t,n){try{t[e]=n[e]}catch(e){}}function u(t,a){r(arguments.length,"KeyboardEvent"),a=s(a||{},o);var u,f=h.createEvent(n),d=a.ctrlKey,p=a.shiftKey,v=a.altKey,m=a.metaKey,g=a.altGraphKey,y=i>3?l(a):null,b=String(a.key),w=String(a.char),x=a.location,E=a.keyCode||(a.keyCode=b)&&b.charCodeAt(0)||0,_=a.charCode||(a.charCode=w)&&w.charCodeAt(0)||0,z=a.bubbles,S=a.cancelable,C=a.repeat,O=a.locale,M=a.view||e;if(a.which||(a.which=a.keyCode),"initKeyEvent"in f)f.initKeyEvent(t,z,S,M,d,v,p,m,E,_);else if(0<i&&"initKeyboardEvent"in f){switch(u=[t,z,S,M],i){case 1:u.push(b,x,d,p,v,m,g);break;case 2:u.push(d,v,p,m,E,_);break;case 3:u.push(b,x,d,v,p,m,g);break;case 4:u.push(b,x,y,C,O);break;default:u.push(char,b,x,y,C,O)}f.initKeyboardEvent.apply(f,u)}else f.initEvent(t,z,S);for(b in f)o.hasOwnProperty(b)&&f[b]!==a[b]&&c(b,f,a);return f}return n=0<i?"KeyboardEvent":"Event",u.prototype=t.prototype,u}(e.KeyboardEvent||function(){}),d(e,"KeyboardEvent",{value:t}),KeyboardEvent!==t&&(KeyboardEvent=t)}try{new MouseEvent("_",{})}catch(t){t=function(t){function n(t,n){r(arguments.length,"MouseEvent");var i=h.createEvent("MouseEvent");return n||(n={}),i.initMouseEvent(t,!!n.bubbles,!!n.cancelable,n.view||e,n.detail||1,n.screenX||0,n.screenY||0,n.clientX||0,n.clientY||0,!!n.ctrlKey,!!n.altKey,!!n.shiftKey,!!n.metaKey,n.button||0,n.relatedTarget||null),i}return n.prototype=t.prototype,n}(e.MouseEvent||function(){}),d(e,"MouseEvent",{value:t}),MouseEvent!==t&&(MouseEvent=t)}h.querySelectorAll("*").forEach||function(){function e(e){var t=e.querySelectorAll;e.querySelectorAll=function(e){var n=t.call(this,e);return n.forEach=Array.prototype.forEach,n}}e(h),e(Element.prototype)}();try{h.querySelector(":scope *")}catch(e){!function(){var e="data-scope-"+(1e9*Math.random()>>>0),t=Element.prototype,n=t.querySelector,r=t.querySelectorAll;function i(t,n,r){if(t.type!=h.ELEMENT_NODE)return n.call(t,r);t.setAttribute(e,null);var i=n.call(t,String(r).replace(/(^|,\s*)(:scope([ >]|$))/g,(function(t,n,r,i){return n+"["+e+"]"+(i||" ")})));return t.removeAttribute(e),i}t.querySelector=function(e){return i(this,n,e)},t.querySelectorAll=function(e){return i(this,r,e)}}()}}(window),function(e){"use strict";var t=e.WeakMap||function(){var e,t=0,n=!1,r=!1;function i(t,i,o){r=o,n=!1,e=void 0,t.dispatchEvent(i)}function o(e){this.value=e}function l(){t++,this.__ce__=new a("@DOMMap:"+t+Math.random())}return o.prototype.handleEvent=function(t){n=!0,r?t.currentTarget.removeEventListener(t.type,this,!1):e=this.value},l.prototype={constructor:l,delete:function(e){return i(e,this.__ce__,!0),n},get:function(t){i(t,this.__ce__,!1);var n=e;return e=void 0,n},has:function(e){return i(e,this.__ce__,!1),n},set:function(e,t){return i(e,this.__ce__,!0),e.addEventListener(this.__ce__.type,new o(t),!1),this}},l}();function n(){}function r(e,t,n){function i(e){i.once&&(e.currentTarget.removeEventListener(e.type,t,i),i.removed=!0),i.passive&&(e.preventDefault=r.preventDefault),"function"==typeof i.callback?i.callback.call(this,e):i.callback&&i.callback.handleEvent(e),i.passive&&delete e.preventDefault}return i.type=e,i.callback=t,i.capture=!!n.capture,i.passive=!!n.passive,i.once=!!n.once,i.removed=!1,i}n.prototype=(Object.create||Object)(null),r.preventDefault=function(){};var i,o,a=e.CustomEvent,l=e.dispatchEvent,s=e.addEventListener,c=e.removeEventListener,u=0,h=function(){u++},f=[].indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},d=function(e){return"".concat(e.capture?"1":"0",e.passive?"1":"0",e.once?"1":"0")};try{s("_",h,{once:!0}),l(new a("_")),l(new a("_")),c("_",h,{once:!0})}catch(e){}1!==u&&(o=new t,i=function(e){if(e){var t=e.prototype;t.addEventListener=function(e){return function(t,i,a){if(a&&"boolean"!=typeof a){var l,s,c,u=o.get(this),h=d(a);u||o.set(this,u=new n),t in u||(u[t]={handler:[],wrap:[]}),s=u[t],(l=f.call(s.handler,i))<0?(l=s.handler.push(i)-1,s.wrap[l]=c=new n):c=s.wrap[l],h in c||(c[h]=r(t,i,a),e.call(this,t,c[h],c[h].capture))}else e.call(this,t,i,a)}}(t.addEventListener),t.removeEventListener=function(e){return function(t,n,r){if(r&&"boolean"!=typeof r){var i,a,l,s,c=o.get(this);if(c&&t in c&&(l=c[t],-1<(a=f.call(l.handler,n))&&(i=d(r))in(s=l.wrap[a]))){for(i in e.call(this,t,s[i],s[i].capture),delete s[i],s)return;l.handler.splice(a,1),l.wrap.splice(a,1),0===l.handler.length&&delete c[t]}}else e.call(this,t,n,r)}}(t.removeEventListener)}},e.EventTarget?i(EventTarget):(i(e.Text),i(e.Element||e.HTMLElement),i(e.HTMLDocument),i(e.Window||{prototype:e}),i(e.XMLHttpRequest)))}(self)})),l.register("ljnRB",(function(e,t){"use strict";var n=Object.prototype.toString;e.exports=function(e){var t=n.call(e),r="[object Arguments]"===t;return r||(r="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===n.call(e.callee)),r}})),l.register("gaMM3",(function(e,t){"use strict";var n;if(!Object.keys){var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=l("ljnRB"),a=Object.prototype.propertyIsEnumerable,s=!a.call({toString:null},"toString"),c=a.call((function(){}),"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],h=function(e){var t=e.constructor;return t&&t.prototype===e},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!f["$"+e]&&r.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{h(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();n=function(e){var t=null!==e&&"object"==typeof e,n="[object Function]"===i.call(e),a=o(e),l=t&&"[object String]"===i.call(e),f=[];if(!t&&!n&&!a)throw new TypeError("Object.keys called on a non-object");var p=c&&n;if(l&&e.length>0&&!r.call(e,0))for(var v=0;v<e.length;++v)f.push(String(v));if(a&&e.length>0)for(var m=0;m<e.length;++m)f.push(String(m));else for(var g in e)p&&"prototype"===g||!r.call(e,g)||f.push(String(g));if(s)for(var y=function(e){if("undefined"==typeof window||!d)return h(e);try{return h(e)}catch(e){return!1}}(e),b=0;b<u.length;++b)y&&"constructor"===u[b]||!r.call(e,u[b])||f.push(u[b]);return f}}e.exports=n})),l.register("kDaAc",(function(e,t){"use strict";var n=l("3ukNm");e.exports=function(){return n()&&!!Symbol.toStringTag}})),l.register("3ukNm",(function(e,t){"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}})),l.register("dKI7M",(function(e,t){"use strict";var n="undefined"!=typeof Symbol&&Symbol,r=l("3ukNm");e.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&r())))}})),l.register("aszze",(function(e,t){"use strict";var n=l("2DXy1")("%Object.defineProperty%",!0),r=function(){if(n)try{return n({},"a",{value:1}),!0}catch(e){return!1}return!1};r.hasArrayLengthDefineBug=function(){if(!r())return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=r})),l.register("2DXy1",(function(e,t){"use strict";var n,r=SyntaxError,i=Function,o=TypeError,a=function(e){try{return i('"use strict"; return ('+e+").constructor;")()}catch(e){}},s=Object.getOwnPropertyDescriptor;if(s)try{s({},"")}catch(e){s=null}var c=function(){throw new o},u=s?function(){try{return c}catch(e){try{return s(arguments,"callee").get}catch(e){return c}}}():c,h=l("dKI7M")(),f=Object.getPrototypeOf||function(e){return e.__proto__},d={},p="undefined"==typeof Uint8Array?n:f(Uint8Array),v={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":h?f([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":d,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h?f(f([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&h?f((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&h?f((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h?f(""[Symbol.iterator]()):n,"%Symbol%":h?Symbol:n,"%SyntaxError%":r,"%ThrowTypeError%":u,"%TypedArray%":p,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet},m=function e(t){var n;if("%AsyncFunction%"===t)n=a("async function () {}");else if("%GeneratorFunction%"===t)n=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=a("async function* () {}");else if("%AsyncGenerator%"===t){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&(n=f(i.prototype))}return v[t]=n,n},g={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},y=l("6FqDH"),b=l("7Dpjp"),w=y.call(Function.call,Array.prototype.concat),x=y.call(Function.apply,Array.prototype.splice),E=y.call(Function.call,String.prototype.replace),_=y.call(Function.call,String.prototype.slice),z=y.call(Function.call,RegExp.prototype.exec),S=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,C=/\\(\\)?/g,O=function(e){var t=_(e,0,1),n=_(e,-1);if("%"===t&&"%"!==n)throw new r("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new r("invalid intrinsic syntax, expected opening `%`");var i=[];return E(e,S,(function(e,t,n,r){i[i.length]=n?E(r,C,"$1"):t||e})),i},M=function(e,t){var n,i=e;if(b(g,i)&&(i="%"+(n=g[i])[0]+"%"),b(v,i)){var a=v[i];if(a===d&&(a=m(i)),void 0===a&&!t)throw new o("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:a}}throw new r("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new o('"allowMissing" argument must be a boolean');if(null===z(/^%?[^%]*%?$/g,e))throw new r("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=O(e),i=n.length>0?n[0]:"",a=M("%"+i+"%",t),l=a.name,c=a.value,u=!1,h=a.alias;h&&(i=h[0],x(n,w([0,1],h)));for(var f=1,d=!0;f<n.length;f+=1){var p=n[f],m=_(p,0,1),g=_(p,-1);if(('"'===m||"'"===m||"`"===m||'"'===g||"'"===g||"`"===g)&&m!==g)throw new r("property names with quotes must have matching quotes");if("constructor"!==p&&d||(u=!0),b(v,l="%"+(i+="."+p)+"%"))c=v[l];else if(null!=c){if(!(p in c)){if(!t)throw new o("base intrinsic for "+e+" exists, but the property is not available.");return}if(s&&f+1>=n.length){var y=s(c,p);c=(d=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:c[p]}else d=b(c,p),c=c[p];d&&!u&&(v[l]=c)}}return c}})),l.register("6FqDH",(function(e,t){"use strict";var n=l("kfm3A");e.exports=Function.prototype.bind||n})),l.register("kfm3A",(function(e,t){"use strict";var n="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,i=Object.prototype.toString,o="[object Function]";e.exports=function(e){var t=this;if("function"!=typeof t||i.call(t)!==o)throw new TypeError(n+t);for(var a,l=r.call(arguments,1),s=function(){if(this instanceof a){var n=t.apply(this,l.concat(r.call(arguments)));return Object(n)===n?n:this}return t.apply(e,l.concat(r.call(arguments)))},c=Math.max(0,t.length-l.length),u=[],h=0;h<c;h++)u.push("$"+h);if(a=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this,arguments); }")(s),t.prototype){var f=function(){};f.prototype=t.prototype,a.prototype=new f,f.prototype=null}return a}})),l.register("7Dpjp",(function(e,t){"use strict";var n=l("6FqDH");e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)})),l.register("7OiON",(function(e,t){"use strict";var n=function(){return"string"==typeof function(){}.name},r=Object.getOwnPropertyDescriptor;if(r)try{r([],"length")}catch(e){r=null}n.functionsHaveConfigurableNames=function(){if(!n()||!r)return!1;var e=r((function(){}),"name");return!!e&&!!e.configurable};var i=Function.prototype.bind;n.boundFunctionsHaveNames=function(){return n()&&"function"==typeof i&&""!==function(){}.bind().name},e.exports=n})),l.register("6DzO8",(function(e,t){"use strict";var n=l("iz60K");function r(){}function i(){}i.resetWarningCache=r,e.exports=function(){function e(e,t,r,i,o,a){if(a!==n){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var o={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return o.PropTypes=o,o}})),l.register("iz60K",(function(e,t){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"})),l.register("9e2tS",(function(e,t){var n=l("eeOBM"),r=l("hKlAl"),i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,a=o&&o.exports===i?n.Buffer:void 0,s=(a?a.isBuffer:void 0)||r;e.exports=s})),l.register("eeOBM",(function(e,t){var n=l("gipFg"),r="object"==typeof self&&self&&self.Object===Object&&self,i=n||r||Function("return this")();e.exports=i})),l.register("gipFg",(function(e,n){var r="object"==typeof t&&t&&t.Object===Object&&t;e.exports=r})),l.register("hKlAl",(function(e,t){e.exports=function(){return!1}})),l.register("fwpsA",(function(e,t){var n=l("gipFg"),r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,o=i&&i.exports===r&&n.process,a=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a})),l.register("lJ72B",(function(e,t){var n=l("eeOBM"),r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,o=i&&i.exports===r?n.Buffer:void 0,a=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=a?a(n):new e.constructor(n);return e.copy(r),r}})),l.register("gkF63",(function(t,n){e(t.exports,"default",(()=>c),(e=>c=e));var r=l("aMdtS"),i=n&&!n.nodeType&&n,o=i&&t&&!t.nodeType&&t,a=o&&o.exports===i?r.default.Buffer:void 0,s=a?a.allocUnsafe:void 0;var c=function(e,t){if(t)return e.slice();var n=e.length,r=s?s(n):new e.constructor(n);return e.copy(r),r}})),l.register("aMdtS",(function(t,n){e(t.exports,"default",(()=>o));var r=l("cK2jL"),i="object"==typeof self&&self&&self.Object===Object&&self,o=r.default||i||Function("return this")()})),l.register("cK2jL",(function(n,r){e(n.exports,"default",(()=>i));var i="object"==typeof t&&t&&t.Object===Object&&t})),l.register("jxBAt",(function(t,n){e(t.exports,"default",(()=>c),(e=>c=e));var r=l("aMdtS"),i=l("k0bFH"),o=n&&!n.nodeType&&n,a=o&&t&&!t.nodeType&&t,s=a&&a.exports===o?r.default.Buffer:void 0,c=(s?s.isBuffer:void 0)||i.default})),l.register("k0bFH",(function(t,n){e(t.exports,"default",(()=>r));var r=function(){return!1}})),l.register("h8ok7",(function(t,n){e(t.exports,"default",(()=>s),(e=>s=e));var r=l("cK2jL"),i=n&&!n.nodeType&&n,o=i&&t&&!t.nodeType&&t,a=o&&o.exports===i&&r.default.process,s=function(){try{var e=o&&o.require&&o.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(e){}}()}));var s;s=l("89wqa"),l("8NFma");var c,u,h={};e(h,"createRoot",(()=>c),(e=>c=e)),e(h,"hydrateRoot",(()=>u),(e=>u=e));var f={};!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),f=l("23wBm"),c=f.createRoot,u=f.hydrateRoot;var d=l("8NFma");function p(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error("number"==typeof e?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var v={};function m(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:v}var g=Object.assign,y=Object.getOwnPropertyDescriptor,b=Object.defineProperty,w=Object.prototype,x=[];Object.freeze(x);var E={};Object.freeze(E);var _="undefined"!=typeof Proxy,z=Object.toString();function S(){_||p("Proxy not available")}function C(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var O=function(){};function M(e){return"function"==typeof e}function A(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function k(e){return null!==e&&"object"==typeof e}function L(e){if(!k(e))return!1;var t=Object.getPrototypeOf(e);if(null==t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n.toString()===z}function P(e){var t=null==e?void 0:e.constructor;return!!t&&("GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName)}function T(e,t,n){b(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function H(e,t,n){b(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function N(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return k(e)&&!0===e[n]}}function R(e){return e instanceof Map}function j(e){return e instanceof Set}var V=void 0!==Object.getOwnPropertySymbols;var I="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:V?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function D(e){return null===e?null:"object"==typeof e?""+e:e}function F(e,t){return w.hasOwnProperty.call(e,t)}var B=Object.getOwnPropertyDescriptors||function(e){var t={};return I(e).forEach((function(n){t[n]=y(e,n)})),t};function U(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function G(e,t,n){return t&&U(e.prototype,t),n&&U(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function q(){return q=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},q.apply(this,arguments)}function W(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,K(e,t)}function K(e,t){return K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},K(e,t)}function Y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function X(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return $(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Q=Symbol("mobx-stored-annotations");function Z(e){return Object.assign((function(t,n){J(t,n,e)}),e)}function J(e,t,n){F(e,Q)||T(e,Q,q({},e[Q])),function(e){return e.annotationType_===le}(n)||(e[Q][t]=n)}var ee=Symbol("mobx administration"),te=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=tt.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return Mt(this)},t.reportChanged=function(){Ct(),At(this),Ot()},t.toString=function(){return this.name_},e}(),ne=N("Atom",te);function re(e,t,n){void 0===t&&(t=O),void 0===n&&(n=O);var r,i=new te(e);return t!==O&&Jt(Qt,i,t,r),n!==O&&Zt(i,n),i}var ie={identity:function(e,t){return e===t},structural:function(e,t){return Or(e,t)},default:function(e,t){return Object.is?Object.is(e,t):e===t?0!==e||1/e==1/t:e!=e&&t!=t},shallow:function(e,t){return Or(e,t,1)}};function oe(e,t,n){return mn(e)?e:Array.isArray(e)?je.array(e,{name:n}):L(e)?je.object(e,void 0,{name:n}):R(e)?je.map(e,{name:n}):j(e)?je.set(e,{name:n}):"function"!=typeof e||Wt(e)||fn(e)?e:P(e)?un(e):Gt(n,e)}function ae(e){return e}var le="override";function se(e,t){return{annotationType_:e,options_:t,make_:ce,extend_:ue}}function ce(e,t,n,r){var i;if(null!=(i=this.options_)&&i.bound)return null===this.extend_(e,t,n,!1)?0:1;if(r===e.target_)return null===this.extend_(e,t,n,!1)?0:2;if(Wt(n.value))return 1;var o=he(e,this,t,n,!1);return b(r,t,o),2}function ue(e,t,n,r){var i=he(e,this,t,n);return e.defineProperty_(t,i,r)}function he(e,t,n,r,i){var o,a,l,s,c,u,h,f;void 0===i&&(i=Et.safeDescriptors),f=r,t.annotationType_,f.value;var d,p=r.value;null!=(o=t.options_)&&o.bound&&(p=p.bind(null!=(d=e.proxy_)?d:e.target_));return{value:Ke(null!=(a=null==(l=t.options_)?void 0:l.name)?a:n.toString(),p,null!=(s=null==(c=t.options_)?void 0:c.autoAction)&&s,null!=(u=t.options_)&&u.bound?null!=(h=e.proxy_)?h:e.target_:void 0),configurable:!i||e.isPlainObject_,enumerable:!1,writable:!i}}function fe(e,t){return{annotationType_:e,options_:t,make_:de,extend_:pe}}function de(e,t,n,r){var i;if(r===e.target_)return null===this.extend_(e,t,n,!1)?0:2;if(null!=(i=this.options_)&&i.bound&&(!F(e.target_,t)||!fn(e.target_[t]))&&null===this.extend_(e,t,n,!1))return 0;if(fn(n.value))return 1;var o=ve(e,this,t,n,!1,!1);return b(r,t,o),2}function pe(e,t,n,r){var i,o=ve(e,this,t,n,null==(i=this.options_)?void 0:i.bound);return e.defineProperty_(t,o,r)}function ve(e,t,n,r,i,o){var a;void 0===o&&(o=Et.safeDescriptors),a=r,t.annotationType_,a.value;var l,s=r.value;(fn(s)||(s=un(s)),i)&&((s=s.bind(null!=(l=e.proxy_)?l:e.target_)).isMobXFlow=!0);return{value:s,configurable:!o||e.isPlainObject_,enumerable:!1,writable:!o}}function me(e,t){return{annotationType_:e,options_:t,make_:ge,extend_:ye}}function ge(e,t,n){return null===this.extend_(e,t,n,!1)?0:1}function ye(e,t,n,r){var i;return i=n,this.annotationType_,i.get,e.defineComputedProperty_(t,q({},this.options_,{get:n.get,set:n.set}),r)}function be(e,t){return{annotationType_:e,options_:t,make_:we,extend_:xe}}function we(e,t,n){return null===this.extend_(e,t,n,!1)?0:1}function xe(e,t,n,r){var i,o;return this.annotationType_,e.defineObservableProperty_(t,n.value,null!=(i=null==(o=this.options_)?void 0:o.enhancer)?i:oe,r)}var Ee=_e();function _e(e){return{annotationType_:"true",options_:e,make_:ze,extend_:Se}}function ze(e,t,n,r){var i,o,a,l;if(n.get)return Fe.make_(e,t,n,r);if(n.set){var s=Ke(t.toString(),n.set);return r===e.target_?null===e.defineProperty_(t,{configurable:!Et.safeDescriptors||e.isPlainObject_,set:s})?0:2:(b(r,t,{configurable:!0,set:s}),2)}if(r!==e.target_&&"function"==typeof n.value)return P(n.value)?(null!=(l=this.options_)&&l.autoBind?un.bound:un).make_(e,t,n,r):(null!=(a=this.options_)&&a.autoBind?Gt.bound:Gt).make_(e,t,n,r);var c,u=!1===(null==(i=this.options_)?void 0:i.deep)?je.ref:je;"function"==typeof n.value&&null!=(o=this.options_)&&o.autoBind&&(n.value=n.value.bind(null!=(c=e.proxy_)?c:e.target_));return u.make_(e,t,n,r)}function Se(e,t,n,r){var i,o,a;if(n.get)return Fe.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:!Et.safeDescriptors||e.isPlainObject_,set:Ke(t.toString(),n.set)},r);"function"==typeof n.value&&null!=(i=this.options_)&&i.autoBind&&(n.value=n.value.bind(null!=(a=e.proxy_)?a:e.target_));return(!1===(null==(o=this.options_)?void 0:o.deep)?je.ref:je).extend_(e,t,n,r)}var Ce={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function Oe(e){return e||Ce}Object.freeze(Ce);var Me=be("observable"),Ae=be("observable.ref",{enhancer:ae}),ke=be("observable.shallow",{enhancer:function(e,t,n){return null==e||ur(e)||Kn(e)||er(e)||rr(e)?e:Array.isArray(e)?je.array(e,{name:n,deep:!1}):L(e)?je.object(e,void 0,{name:n,deep:!1}):R(e)?je.map(e,{name:n,deep:!1}):j(e)?je.set(e,{name:n,deep:!1}):void 0}}),Le=be("observable.struct",{enhancer:function(e,t){return Or(e,t)?t:e}}),Pe=Z(Me);function Te(e){return!0===e.deep?oe:!1===e.deep?ae:(t=e.defaultDecorator)&&null!=(n=null==(r=t.options_)?void 0:r.enhancer)?n:oe;var t,n,r}function He(e,t,n){if(!A(t))return mn(e)?e:L(e)?je.object(e,t,n):Array.isArray(e)?je.array(e,t):R(e)?je.map(e,t):j(e)?je.set(e,t):"object"==typeof e&&null!==e?e:je.box(e,t);J(e,t,Me)}Object.assign(He,Pe);var Ne,Re,je=g(He,{box:function(e,t){var n=Oe(t);return new Je(e,Te(n),n.name,!0,n.equals)},array:function(e,t){var n=Oe(t);return(!1===Et.useProxies||!1===n.proxy?Er:Vn)(e,Te(n),n.name)},map:function(e,t){var n=Oe(t);return new Jn(e,Te(n),n.name)},set:function(e,t){var n=Oe(t);return new nr(e,Te(n),n.name)},object:function(e,t,n){return nn(!1===Et.useProxies||!1===(null==n?void 0:n.proxy)?lr({},n):function(e,t){var n,r;return S(),e=lr(e,t),null!=(r=(n=e[ee]).proxy_)?r:n.proxy_=new Proxy(e,Cn)}({},n),e,t)},ref:Z(Ae),shallow:Z(ke),deep:Pe,struct:Z(Le)}),Ve="computed",Ie=me(Ve),De=me("computed.struct",{equals:ie.structural}),Fe=function(e,t){if(A(t))return J(e,t,Ie);if(L(e))return Z(me(Ve,e));var n=L(t)?t:{};return n.get=e,n.name||(n.name=e.name||""),new ot(n)};Object.assign(Fe,Ie),Fe.struct=Z(De);var Be,Ue=0,Ge=1,qe=null!=(Ne=null==(Re=y((function(){}),"name"))?void 0:Re.configurable)&&Ne,We={value:"action",configurable:!0,writable:!1,enumerable:!1};function Ke(e,t,n,r){function i(){return Ye(e,n,t,r||this,arguments)}return void 0===n&&(n=!1),i.isMobxAction=!0,qe&&(We.value=e,Object.defineProperty(i,"name",We)),i}function Ye(e,t,n,r,i){var o=function(e,t,n,r){var i=!1,o=0,a=Et.trackingDerivation,l=!t||!a;Ct();var s=Et.allowStateChanges;l&&(pt(),s=Xe(!0));var c=mt(!0),u={runAsAction_:l,prevDerivation_:a,prevAllowStateChanges_:s,prevAllowStateReads_:c,notifySpy_:i,startTime_:o,actionId_:Ge++,parentActionId_:Ue};return Ue=u.actionId_,u}(0,t);try{return n.apply(r,i)}catch(e){throw o.error_=e,e}finally{!function(e){Ue!==e.actionId_&&p(30);Ue=e.parentActionId_,void 0!==e.error_&&(Et.suppressReactionErrors=!0);Qe(e.prevAllowStateChanges_),gt(e.prevAllowStateReads_),Ot(),e.runAsAction_&&vt(e.prevDerivation_);Et.suppressReactionErrors=!1}(o)}}function $e(e,t){var n=Xe(e);try{return t()}finally{Qe(n)}}function Xe(e){var t=Et.allowStateChanges;return Et.allowStateChanges=e,t}function Qe(e){Et.allowStateChanges=e}Be=Symbol.toPrimitive;var Ze,Je=function(e){function t(t,n,r,i,o){var a;return void 0===r&&(r="ObservableValue"),void 0===i&&(i=!0),void 0===o&&(o=ie.default),(a=e.call(this,r)||this).enhancer=void 0,a.name_=void 0,a.equals=void 0,a.hasUnreportedChange_=!1,a.interceptors_=void 0,a.changeListeners_=void 0,a.value_=void 0,a.dehancer=void 0,a.enhancer=n,a.name_=r,a.equals=o,a.value_=n(t,void 0,r),a}W(t,e);var n=t.prototype;return n.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.set=function(e){this.value_;if((e=this.prepareNewValue_(e))!==Et.UNCHANGED){this.setNewValue_(e)}},n.prepareNewValue_=function(e){if(ut(this),On(this)){var t=An(this,{object:this,type:Nn,newValue:e});if(!t)return Et.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?Et.UNCHANGED:e},n.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),kn(this)&&Pn(this,{type:Nn,object:this,newValue:e,oldValue:t})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(e){return Mn(this,e)},n.observe_=function(e,t){return t&&e({observableKind:"value",debugObjectName:this.name_,object:this,type:Nn,newValue:this.value_,oldValue:void 0}),Ln(this,e)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return D(this.get())},n[Be]=function(){return this.valueOf()},t}(te),et=N("ObservableValue",Je);Ze=Symbol.toPrimitive;var tt,nt,rt,it,ot=function(){function e(e){this.dependenciesState_=tt.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.isBeingObserved_=!1,this.isPendingUnobservation_=!1,this.observers_=new Set,this.diffValue_=0,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=tt.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new lt(null),this.name_=void 0,this.triggeredBy_=void 0,this.isComputing_=!1,this.isRunningSetter_=!1,this.derivation=void 0,this.setter_=void 0,this.isTracing_=rt.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||p(31),this.derivation=e.get,this.name_=e.name||"ComputedValue",e.set&&(this.setter_=Ke("ComputedValue-setter",e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?ie.structural:ie.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){!function(e){if(e.lowestObserverState_!==tt.UP_TO_DATE_)return;e.lowestObserverState_=tt.POSSIBLY_STALE_,e.observers_.forEach((function(e){e.dependenciesState_===tt.UP_TO_DATE_&&(e.dependenciesState_=tt.POSSIBLY_STALE_,e.onBecomeStale_())}))}(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.get=function(){if(this.isComputing_&&p(32,this.name_,this.derivation),0!==Et.inBatch||0!==this.observers_.size||this.keepAlive_){if(Mt(this),ct(this)){var e=Et.trackingContext;this.keepAlive_&&!e&&(Et.trackingContext=this),this.trackAndCompute()&&function(e){if(e.lowestObserverState_===tt.STALE_)return;e.lowestObserverState_=tt.STALE_,e.observers_.forEach((function(t){t.dependenciesState_===tt.POSSIBLY_STALE_?t.dependenciesState_=tt.STALE_:t.dependenciesState_===tt.UP_TO_DATE_&&(e.lowestObserverState_=tt.UP_TO_DATE_)}))}(this),Et.trackingContext=e}}else ct(this)&&(this.warnAboutUntrackedRead_(),Ct(),this.value_=this.computeValue_(!1),Ot());var t=this.value_;if(st(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter_&&p(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter_=!1}}else p(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===tt.NOT_TRACKING_,n=this.computeValue_(!0),r=t||st(e)||st(n)||!this.equals_(e,n);return r&&(this.value_=n),r},t.computeValue_=function(e){this.isComputing_=!0;var t,n=Xe(!1);if(e)t=ht(this,this.derivation,this.scope_);else if(!0===Et.disableErrorBoundaries)t=this.derivation.call(this.scope_);else try{t=this.derivation.call(this.scope_)}catch(e){t=new lt(e)}return Qe(n),this.isComputing_=!1,t},t.suspend_=function(){this.keepAlive_||(ft(this),this.value_=void 0)},t.observe_=function(e,t){var n=this,r=!0,i=void 0;return Kt((function(){var o=n.get();if(!r||t){var a=pt();e({observableKind:"computed",debugObjectName:n.name_,type:Nn,object:n,newValue:o,oldValue:i}),vt(a)}r=!1,i=o}))},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return D(this.get())},t[Ze]=function(){return this.valueOf()},e}(),at=N("ComputedValue",ot);(nt=tt||(tt={}))[nt.NOT_TRACKING_=-1]="NOT_TRACKING_",nt[nt.UP_TO_DATE_=0]="UP_TO_DATE_",nt[nt.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",nt[nt.STALE_=2]="STALE_",(it=rt||(rt={}))[it.NONE=0]="NONE",it[it.LOG=1]="LOG",it[it.BREAK=2]="BREAK";var lt=function(e){this.cause=void 0,this.cause=e};function st(e){return e instanceof lt}function ct(e){switch(e.dependenciesState_){case tt.UP_TO_DATE_:return!1;case tt.NOT_TRACKING_:case tt.STALE_:return!0;case tt.POSSIBLY_STALE_:for(var t=mt(!0),n=pt(),r=e.observing_,i=r.length,o=0;o<i;o++){var a=r[o];if(at(a)){if(Et.disableErrorBoundaries)a.get();else try{a.get()}catch(e){return vt(n),gt(t),!0}if(e.dependenciesState_===tt.STALE_)return vt(n),gt(t),!0}}return yt(e),vt(n),gt(t),!1}}function ut(e){}function ht(e,t,n){var r=mt(!0);yt(e),e.newObserving_=new Array(e.observing_.length+100),e.unboundDepsCount_=0,e.runId_=++Et.runId;var i,o=Et.trackingDerivation;if(Et.trackingDerivation=e,Et.inBatch++,!0===Et.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(e){i=new lt(e)}return Et.inBatch--,Et.trackingDerivation=o,function(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=tt.UP_TO_DATE_,i=0,o=e.unboundDepsCount_,a=0;a<o;a++){var l=n[a];0===l.diffValue_&&(l.diffValue_=1,i!==a&&(n[i]=l),i++),l.dependenciesState_>r&&(r=l.dependenciesState_)}n.length=i,e.newObserving_=null,o=t.length;for(;o--;){var s=t[o];0===s.diffValue_&&zt(s,e),s.diffValue_=0}for(;i--;){var c=n[i];1===c.diffValue_&&(c.diffValue_=0,_t(c,e))}r!==tt.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),gt(r),i}function ft(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)zt(t[n],e);e.dependenciesState_=tt.NOT_TRACKING_}function dt(e){var t=pt();try{return e()}finally{vt(t)}}function pt(){var e=Et.trackingDerivation;return Et.trackingDerivation=null,e}function vt(e){Et.trackingDerivation=e}function mt(e){var t=Et.allowStateReads;return Et.allowStateReads=e,t}function gt(e){Et.allowStateReads=e}function yt(e){if(e.dependenciesState_!==tt.UP_TO_DATE_){e.dependenciesState_=tt.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=tt.UP_TO_DATE_}}var bt=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},wt=!0,xt=!1,Et=function(){var e=m();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(wt=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new bt).version&&(wt=!1),wt?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new bt):(setTimeout((function(){xt||p(35)}),1),new bt)}();function _t(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function zt(e,t){e.observers_.delete(t),0===e.observers_.size&&St(e)}function St(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,Et.pendingUnobservations.push(e))}function Ct(){Et.inBatch++}function Ot(){if(0==--Et.inBatch){Pt();for(var e=Et.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation_=!1,0===n.observers_.size&&(n.isBeingObserved_&&(n.isBeingObserved_=!1,n.onBUO()),n instanceof ot&&n.suspend_())}Et.pendingUnobservations=[]}}function Mt(e){var t=Et.trackingDerivation;return null!==t?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved_&&Et.trackingContext&&(e.isBeingObserved_=!0,e.onBO())),!0):(0===e.observers_.size&&Et.inBatch>0&&St(e),!1)}function At(e){e.lowestObserverState_!==tt.STALE_&&(e.lowestObserverState_=tt.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===tt.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=tt.STALE_})))}var kt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=tt.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=rt.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,Et.pendingReactions.push(this),Pt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){Ct(),this.isScheduled_=!1;var e=Et.trackingContext;if(Et.trackingContext=this,ct(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}Et.trackingContext=e,Ot()}},t.track=function(e){if(!this.isDisposed_){Ct();this.isRunning_=!0;var t=Et.trackingContext;Et.trackingContext=this;var n=ht(this,e,void 0);Et.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&ft(this),st(n)&&this.reportExceptionInDerivation_(n.cause),Ot()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(Et.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";Et.suppressReactionErrors||console.error(n,e),Et.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(Ct(),ft(this),Ot()))},t.getDisposer_=function(){var e=this.dispose.bind(this);return e[ee]=this,e},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1),function(){p("trace() is not available in production builds");for(var e=!1,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];"boolean"==typeof n[n.length-1]&&(e=n.pop());var i=_n(n);if(!i)return p("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");i.isTracing_===rt.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled");i.isTracing_=e?rt.BREAK:rt.LOG}(this,e)},e}();var Lt=function(e){return e()};function Pt(){Et.inBatch>0||Et.isRunningReactions||Lt(Tt)}function Tt(){Et.isRunningReactions=!0;for(var e=Et.pendingReactions,t=0;e.length>0;){100==++t&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].runReaction_()}Et.isRunningReactions=!1}var Ht=N("Reaction",kt);var Nt="action",Rt="autoAction",jt="<unnamed action>",Vt=se(Nt),It=se("action.bound",{bound:!0}),Dt=se(Rt,{autoAction:!0}),Ft=se("autoAction.bound",{autoAction:!0,bound:!0});function Bt(e){return function(t,n){return M(t)?Ke(t.name||jt,t,e):M(n)?Ke(t,n,e):A(n)?J(t,n,e?Dt:Vt):A(t)?Z(se(e?Rt:Nt,{name:t,autoAction:e})):void 0}}var Ut=Bt(!1);Object.assign(Ut,Vt);var Gt=Bt(!0);function qt(e){return Ye(e.name,!1,e,this,void 0)}function Wt(e){return M(e)&&!0===e.isMobxAction}function Kt(e,t){var n,r;void 0===t&&(t=E);var i,o=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(!t.scheduler&&!t.delay)i=new kt(o,(function(){this.track(s)}),t.onError,t.requiresObservable);else{var a=$t(t),l=!1;i=new kt(o,(function(){l||(l=!0,a((function(){l=!1,i.isDisposed_||i.track(s)})))}),t.onError,t.requiresObservable)}function s(){e(i)}return i.schedule_(),i.getDisposer_()}Object.assign(Gt,Dt),Ut.bound=Z(It),Gt.bound=Z(Ft);var Yt=function(e){return e()};function $t(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Yt}function Xt(e,t,n){var r;void 0===n&&(n=E);var i,o,a,l,s=null!=(r=n.name)?r:"Reaction",c=Ut(s,n.onError?(i=n.onError,o=t,function(){try{return o.apply(this,arguments)}catch(e){i.call(this,e)}}):t),u=!n.scheduler&&!n.delay,h=$t(n),f=!0,d=!1,p=n.compareStructural?ie.structural:n.equals||ie.default,v=new kt(s,(function(){f||u?m():d||(d=!0,h(m))}),n.onError,n.requiresObservable);function m(){if(d=!1,!v.isDisposed_){var t=!1;v.track((function(){var n=$e(!1,(function(){return e(v)}));t=f||!p(a,n),l=a,a=n})),(f&&n.fireImmediately||!f&&t)&&c(a,l,v),f=!1}}return v.schedule_(),v.getDisposer_()}var Qt="onBO";function Zt(e,t,n){return Jt("onBUO",e,t,n)}function Jt(e,t,n,r){var i="function"==typeof r?_r(t,n):_r(t),o=M(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var en="always";function tn(e){!0===e.isolateGlobalState&&function(){if((Et.pendingReactions.length||Et.inBatch||Et.isRunningReactions)&&p(36),xt=!0,wt){var e=m();0==--e.__mobxInstanceCount&&(e.__mobxGlobals=void 0),Et=new bt}}();var t,n,r=e.useProxies,i=e.enforceActions;if(void 0!==r&&(Et.useProxies=r===en||"never"!==r&&"undefined"!=typeof Proxy),"ifavailable"===r&&(Et.verifyProxies=!0),void 0!==i){var o=i===en?en:"observed"===i;Et.enforceActions=o,Et.allowStateChanges=!0!==o&&o!==en}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach((function(t){t in e&&(Et[t]=!!e[t])})),Et.allowStateReads=!Et.observableRequiresReaction,e.reactionScheduler&&(t=e.reactionScheduler,n=Lt,Lt=function(e){return t((function(){return n(e)}))})}function nn(e,t,n,r){var i=B(t),o=lr(e,r)[ee];Ct();try{I(i).forEach((function(e){o.extend_(e,i[e],!n||(!(e in n)||n[e]))}))}finally{Ot()}return e}function rn(e,t){return on(_r(e,t))}function on(e){var t,n={name:e.name_};return e.observing_&&e.observing_.length>0&&(n.dependencies=(t=e.observing_,Array.from(new Set(t))).map(on)),n}var an=0;function ln(){this.message="FLOW_CANCELLED"}ln.prototype=Object.create(Error.prototype);var sn=fe("flow"),cn=fe("flow.bound",{bound:!0}),un=Object.assign((function(e,t){if(A(t))return J(e,t,sn);var n=e,r=n.name||"<unnamed flow>",i=function(){var e,t=this,i=arguments,o=++an,a=Ut(r+" - runid: "+o+" - init",n).apply(t,i),l=void 0,s=new Promise((function(t,n){var i=0;function s(e){var t;l=void 0;try{t=Ut(r+" - runid: "+o+" - yield "+i++,a.next).call(a,e)}catch(e){return n(e)}u(t)}function c(e){var t;l=void 0;try{t=Ut(r+" - runid: "+o+" - yield "+i++,a.throw).call(a,e)}catch(e){return n(e)}u(t)}function u(e){if(!M(null==e?void 0:e.then))return e.done?t(e.value):(l=Promise.resolve(e.value)).then(s,c);e.then(u,n)}e=n,s(void 0)}));return s.cancel=Ut(r+" - runid: "+o+" - cancel",(function(){try{l&&hn(l);var t=a.return(void 0),n=Promise.resolve(t.value);n.then(O,O),hn(n),e(new ln)}catch(t){e(t)}})),s};return i.isMobXFlow=!0,i}),sn);function hn(e){M(e.cancel)&&e.cancel()}function fn(e){return!0===(null==e?void 0:e.isMobXFlow)}function dn(e,t,n){var r;return er(e)||Kn(e)||et(e)?r=zr(e):ur(e)&&(r=zr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function pn(e,t,n){return M(n)?function(e,t,n){return zr(e,t).intercept_(n)}(e,t,n):function(e,t){return zr(e).intercept_(t)}(e,t)}function vn(e,t){return!!e&&(void 0!==t?!!ur(e)&&e[ee].values_.has(t):ur(e)||!!e[ee]||ne(e)||Ht(e)||at(e))}function mn(e){return vn(e)}function gn(e){return ur(e)?e[ee].keys_():er(e)||rr(e)?Array.from(e.keys()):Kn(e)?e.map((function(e,t){return t})):void p(5)}function yn(e){return ur(e)?gn(e).map((function(t){return e[t]})):er(e)?gn(e).map((function(t){return e.get(t)})):rr(e)?Array.from(e.values()):Kn(e)?e.slice():void p(6)}function bn(e){return ur(e)?gn(e).map((function(t){return[t,e[t]]})):er(e)?gn(e).map((function(t){return[t,e.get(t)]})):rr(e)?Array.from(e.entries()):Kn(e)?e.map((function(e,t){return[t,e]})):void p(7)}function wn(e,t,n){if(2!==arguments.length||rr(e))ur(e)?e[ee].set_(t,n):er(e)?e.set(t,n):rr(e)?e.add(t):Kn(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&p("Invalid index: '"+t+"'"),Ct(),t>=e.length&&(e.length=t+1),e[t]=n,Ot()):p(8);else{Ct();var r=t;try{for(var i in r)wn(e,i,r[i])}finally{Ot()}}}function xn(e,t,n){if(ur(e))return e[ee].defineProperty_(t,n);p(39)}function En(e,t,n,r){return M(n)?function(e,t,n,r){return zr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return zr(e).observe_(t,n)}(e,t,n)}function _n(e){switch(e.length){case 0:return Et.trackingDerivation;case 1:return _r(e[0]);case 2:return _r(e[0],e[1])}}function zn(e,t){void 0===t&&(t=void 0),Ct();try{return e.apply(t)}finally{Ot()}}function Sn(e){return e[ee]}un.bound=Z(cn);var Cn={has:function(e,t){return Sn(e).has_(t)},get:function(e,t){return Sn(e).get_(t)},set:function(e,t,n){var r;return!!A(t)&&(null==(r=Sn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!A(t)&&(null==(n=Sn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=Sn(e).defineProperty_(t,n))||r},ownKeys:function(e){return Sn(e).ownKeys_()},preventExtensions:function(e){p(13)}};function On(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function Mn(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),C((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function An(e,t){var n=pt();try{for(var r=[].concat(e.interceptors_||[]),i=0,o=r.length;i<o&&((t=r[i](t))&&!t.type&&p(14),t);i++);return t}finally{vt(n)}}function kn(e){return void 0!==e.changeListeners_&&e.changeListeners_.length>0}function Ln(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),C((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function Pn(e,t){var n=pt(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i<o;i++)r[i](t);vt(n)}}function Tn(e,t,n){var r=lr(e,n)[ee];Ct();try{null!=t||(t=function(e){return F(e,Q)||T(e,Q,q({},e[Q])),e[Q]}(e)),I(t).forEach((function(e){return r.make_(e,t[e])}))}finally{Ot()}return e}var Hn="splice",Nn="update",Rn={get:function(e,t){var n=e[ee];return t===ee?n:"length"===t?n.getArrayLength_():"string"!=typeof t||isNaN(t)?F(In,t)?In[t]:e[t]:n.get_(parseInt(t))},set:function(e,t,n){var r=e[ee];return"length"===t&&r.setArrayLength_(n),"symbol"==typeof t||isNaN(t)?e[t]=n:r.set_(parseInt(t),n),!0},preventExtensions:function(){p(15)}},jn=function(){function e(e,t,n,r){void 0===e&&(e="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=n,this.legacyMode_=r,this.atom_=new te(e),this.enhancer_=function(e,n){return t(e,n,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.dehanceValues_=function(e){return void 0!==this.dehancer&&e.length>0?e.map(this.dehancer):e},t.intercept_=function(e){return Mn(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Ln(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&p("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r<e-t;r++)n[r]=void 0;this.spliceWithArray_(t,0,n)}else this.spliceWithArray_(e,t-e)},t.updateArrayLength_=function(e,t){e!==this.lastKnownLength_&&p(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&xr(e+t+1)},t.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=x),On(this)){var o=An(this,{object:this.proxy_,type:Hn,index:e,removedCount:t,added:n});if(!o)return x;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var l=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,l),this.dehanceValues_(l)},t.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a<n.length;a++)this.values_[e+a]=n[a];for(var l=0;l<o.length;l++)this.values_[e+n.length+l]=o[l];return i},t.notifyArrayChildUpdate_=function(e,t,n){var r=!this.owned_&&!1,i=kn(this),o=i||r?{observableKind:"array",object:this.proxy_,type:Nn,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;this.atom_.reportChanged(),i&&Pn(this,o)},t.notifyArraySplice_=function(e,t,n){var r=!this.owned_&&!1,i=kn(this),o=i||r?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Hn,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.atom_.reportChanged(),i&&Pn(this,o)},t.get_=function(e){if(e<this.values_.length)return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx.array] Attempt to read an array index ("+e+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX")},t.set_=function(e,t){var n=this.values_;if(e<n.length){this.atom_;var r=n[e];if(On(this)){var i=An(this,{type:Nn,object:this.proxy_,index:e,newValue:t});if(!i)return;t=i.newValue}(t=this.enhancer_(t,r))!==r&&(n[e]=t,this.notifyArrayChildUpdate_(e,t,r))}else e===n.length?this.spliceWithArray_(e,0,[t]):p(17,e,n.length)},e}();function Vn(e,t,n,r){void 0===n&&(n="ObservableArray"),void 0===r&&(r=!1),S();var i=new jn(n,t,r,!1);H(i.values_,ee,i);var o=new Proxy(i.values_,Rn);if(i.proxy_=o,e&&e.length){var a=Xe(!0);i.spliceWithArray_(0,0,e),Qe(a)}return o}var In={clear:function(){return this.splice(0)},replace:function(e){var t=this[ee];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];var o=this[ee];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(e);case 2:return o.spliceWithArray_(e,t)}return o.spliceWithArray_(e,t,r)},spliceWithArray:function(e,t,n){return this[ee].spliceWithArray_(e,t,n)},push:function(){for(var e=this[ee],t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.spliceWithArray_(e.values_.length,0,n),e.values_.length},pop:function(){return this.splice(Math.max(this[ee].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[ee],t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.spliceWithArray_(0,0,n),e.values_.length},reverse:function(){return Et.trackingDerivation&&p(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Et.trackingDerivation&&p(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[ee],n=t.dehanceValues_(t.values_).indexOf(e);return n>-1&&(this.splice(n,1),!0)}};function Dn(e,t){"function"==typeof Array.prototype[e]&&(In[e]=t(e))}function Fn(e){return function(){var t=this[ee];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Bn(e){return function(t,n){var r=this,i=this[ee];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function Un(e){return function(){var t=this,n=this[ee];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}Dn("concat",Fn),Dn("flat",Fn),Dn("includes",Fn),Dn("indexOf",Fn),Dn("join",Fn),Dn("lastIndexOf",Fn),Dn("slice",Fn),Dn("toString",Fn),Dn("toLocaleString",Fn),Dn("every",Bn),Dn("filter",Bn),Dn("find",Bn),Dn("findIndex",Bn),Dn("flatMap",Bn),Dn("forEach",Bn),Dn("map",Bn),Dn("some",Bn),Dn("reduce",Un),Dn("reduceRight",Un);var Gn,qn,Wn=N("ObservableArrayAdministration",jn);function Kn(e){return k(e)&&Wn(e[ee])}var Yn={},$n="add",Xn="delete";Gn=Symbol.iterator,qn=Symbol.toStringTag;var Qn,Zn,Jn=function(){function e(e,t,n){var r=this;void 0===t&&(t=oe),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[ee]=Yn,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,M(Map)||p(18),this.keysAtom_=re("ObservableMap.keys()"),this.data_=new Map,this.hasMap_=new Map,$e(!0,(function(){r.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!Et.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Je(this.has_(e),ae,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Zt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},t.set=function(e,t){var n=this.has_(e);if(On(this)){var r=An(this,{type:n?Nn:$n,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if((this.keysAtom_,On(this))&&!An(this,{type:Xn,object:this,name:e}))return!1;if(this.has_(e)){var n=kn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:Xn,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return zn((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&Pn(this,r),!0}return!1},t.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==Et.UNCHANGED){var r=kn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:Nn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&Pn(this,i)}},t.addValue_=function(e,t){var n=this;this.keysAtom_,zn((function(){var r,i=new Je(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=kn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:$n,object:this,name:e,newValue:t}:null;r&&Pn(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return kr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return kr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},t[Gn]=function(){return this.entries()},t.forEach=function(e,t){for(var n,r=X(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},t.merge=function(e){var t=this;return er(e)&&(e=new Map(e)),zn((function(){L(e)?function(e){var t=Object.keys(e);if(!V)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return w.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(n){return t.set(n,e[n])})):Array.isArray(e)?e.forEach((function(e){var n=e[0],r=e[1];return t.set(n,r)})):R(e)?(e.constructor!==Map&&p(19,e),e.forEach((function(e,n){return t.set(n,e)}))):null!=e&&p(20,e)})),this},t.clear=function(){var e=this;zn((function(){dt((function(){for(var t,n=X(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},t.replace=function(e){var t=this;return zn((function(){for(var n,r=function(e){if(R(e)||er(e))return e;if(Array.isArray(e))return new Map(e);if(L(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return p(21,e)}(e),i=new Map,o=!1,a=X(t.data_.keys());!(n=a()).done;){var l=n.value;if(!r.has(l))if(t.delete(l))o=!0;else{var s=t.data_.get(l);i.set(l,s)}}for(var c,u=X(r.entries());!(c=u()).done;){var h=c.value,f=h[0],d=h[1],v=t.data_.has(f);if(t.set(f,d),t.data_.has(f)){var m=t.data_.get(f);i.set(f,m),v||(o=!0)}}if(!o)if(t.data_.size!==i.size)t.keysAtom_.reportChanged();else for(var g=t.data_.keys(),y=i.keys(),b=g.next(),w=y.next();!b.done;){if(b.value!==w.value){t.keysAtom_.reportChanged();break}b=g.next(),w=y.next()}t.data_=i})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return Ln(this,e)},t.intercept_=function(e){return Mn(this,e)},G(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:qn,get:function(){return"Map"}}]),e}(),er=N("ObservableMap",Jn);var tr={};Qn=Symbol.iterator,Zn=Symbol.toStringTag;var nr=function(){function e(e,t,n){void 0===t&&(t=oe),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[ee]=tr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,M(Set)||p(22),this.atom_=re(this.name_),this.enhancer_=function(e,r){return t(e,r,n)},e&&this.replace(e)}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;zn((function(){dt((function(){for(var t,n=X(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},t.forEach=function(e,t){for(var n,r=X(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if((this.atom_,On(this))&&!An(this,{type:$n,object:this,newValue:e}))return this;if(!this.has(e)){zn((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=kn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:$n,object:this,newValue:e}:null;n&&Pn(this,r)}return this},t.delete=function(e){var t=this;if(On(this)&&!An(this,{type:Xn,object:this,oldValue:e}))return!1;if(this.has(e)){var n=kn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:Xn,object:this,oldValue:e}:null;return zn((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&Pn(this,r),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return kr({next:function(){var r=e;return e+=1,r<n.length?{value:[t[r],n[r]],done:!1}:{done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var e=this,t=0,n=Array.from(this.data_.values());return kr({next:function(){return t<n.length?{value:e.dehanceValue_(n[t++]),done:!1}:{done:!0}}})},t.replace=function(e){var t=this;return rr(e)&&(e=new Set(e)),zn((function(){Array.isArray(e)||j(e)?(t.clear(),e.forEach((function(e){return t.add(e)}))):null!=e&&p("Cannot initialize set from "+e)})),this},t.observe_=function(e,t){return Ln(this,e)},t.intercept_=function(e){return Mn(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Qn]=function(){return this.values()},G(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Zn,get:function(){return"Set"}}]),e}(),rr=N("ObservableSet",nr),ir=Object.create(null),or="remove",ar=function(){function e(e,t,n,r){void 0===t&&(t=new Map),void 0===r&&(r=Ee),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=e,this.values_=t,this.name_=n,this.defaultAnnotation_=r,this.keysAtom_=new te("ObservableObject.keys"),this.isPlainObject_=L(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(e){return this.values_.get(e).get()},t.setObservablePropValue_=function(e,t){var n=this.values_.get(e);if(n instanceof ot)return n.set(t),!0;if(On(this)){var r=An(this,{type:Nn,object:this.proxy_||this.target_,name:e,newValue:t});if(!r)return null;t=r.newValue}if((t=n.prepareNewValue_(t))!==Et.UNCHANGED){var i=kn(this),o=i?{type:Nn,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),i&&Pn(this,o)}return!0},t.get_=function(e){return Et.trackingDerivation&&!F(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,n){return void 0===n&&(n=!1),F(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):n?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,n)},t.has_=function(e){if(!Et.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var t=this.pendingKeys_.get(e);return t||(t=new Je(e in this.target_,ae,"ObservableObject.key?",!1),this.pendingKeys_.set(e,t)),t.get()},t.make_=function(e,t){if(!0===t&&(t=this.defaultAnnotation_),!1!==t){if(fr(this,t,e),!(e in this.target_)){var n;if(null!=(n=this.target_[Q])&&n[e])return;p(1,t.annotationType_,this.name_+"."+e.toString())}for(var r=this.target_;r&&r!==w;){var i=y(r,e);if(i){var o=t.make_(this,e,i,r);if(0===o)return;if(1===o)break}r=Object.getPrototypeOf(r)}hr(this,t,e)}},t.extend_=function(e,t,n,r){if(void 0===r&&(r=!1),!0===n&&(n=this.defaultAnnotation_),!1===n)return this.defineProperty_(e,t,r);fr(this,n,e);var i=n.extend_(this,e,t,r);return i&&hr(this,n,e),i},t.defineProperty_=function(e,t,n){void 0===n&&(n=!1);try{Ct();var r=this.delete_(e);if(!r)return r;if(On(this)){var i=An(this,{object:this.proxy_||this.target_,name:e,type:$n,newValue:t.value});if(!i)return null;var o=i.newValue;t.value!==o&&(t=q({},t,{value:o}))}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else b(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{Ot()}return!0},t.defineObservableProperty_=function(e,t,n,r){void 0===r&&(r=!1);try{Ct();var i=this.delete_(e);if(!i)return i;if(On(this)){var o=An(this,{object:this.proxy_||this.target_,name:e,type:$n,newValue:t});if(!o)return null;t=o.newValue}var a=cr(e),l={configurable:!Et.safeDescriptors||this.isPlainObject_,enumerable:!0,get:a.get,set:a.set};if(r){if(!Reflect.defineProperty(this.target_,e,l))return!1}else b(this.target_,e,l);var s=new Je(t,n,"ObservableObject.key",!1);this.values_.set(e,s),this.notifyPropertyAddition_(e,s.value_)}finally{Ot()}return!0},t.defineComputedProperty_=function(e,t,n){void 0===n&&(n=!1);try{Ct();var r=this.delete_(e);if(!r)return r;if(On(this))if(!An(this,{object:this.proxy_||this.target_,name:e,type:$n,newValue:void 0}))return null;t.name||(t.name="ObservableObject.key"),t.context=this.proxy_||this.target_;var i=cr(e),o={configurable:!Et.safeDescriptors||this.isPlainObject_,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.target_,e,o))return!1}else b(this.target_,e,o);this.values_.set(e,new ot(t)),this.notifyPropertyAddition_(e,void 0)}finally{Ot()}return!0},t.delete_=function(e,t){if(void 0===t&&(t=!1),!F(this.target_,e))return!0;if(On(this)&&!An(this,{object:this.proxy_||this.target_,name:e,type:or}))return null;try{var n,r;Ct();var i,o=kn(this),a=this.values_.get(e),l=void 0;if(!a&&o)l=null==(i=y(this.target_,e))?void 0:i.value;if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(a&&(this.values_.delete(e),a instanceof Je&&(l=a.value_),At(a)),this.keysAtom_.reportChanged(),null==(n=this.pendingKeys_)||null==(r=n.get(e))||r.set(e in this.target_),o){var s={type:or,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:e};o&&Pn(this,s)}}finally{Ot()}return!0},t.observe_=function(e,t){return Ln(this,e)},t.intercept_=function(e){return Mn(this,e)},t.notifyPropertyAddition_=function(e,t){var n,r,i=kn(this);if(i){var o=i?{type:$n,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;i&&Pn(this,o)}null==(n=this.pendingKeys_)||null==(r=n.get(e))||r.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),I(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function lr(e,t){var n;if(F(e,ee))return e;var r=null!=(n=null==t?void 0:t.name)?n:"ObservableObject",i=new ar(e,new Map,String(r),function(e){var t;return e?null!=(t=e.defaultDecorator)?t:_e(e):void 0}(t));return T(e,ee,i),e}var sr=N("ObservableObjectAdministration",ar);function cr(e){return ir[e]||(ir[e]={get:function(){return this[ee].getObservablePropValue_(e)},set:function(t){return this[ee].setObservablePropValue_(e,t)}})}function ur(e){return!!k(e)&&sr(e[ee])}function hr(e,t,n){var r;null==(r=e.target_[Q])||delete r[n]}function fr(e,t,n){}var dr,pr,vr=br(0),mr=0,gr=function(){};dr=gr,pr=Array.prototype,Object.setPrototypeOf?Object.setPrototypeOf(dr.prototype,pr):void 0!==dr.prototype.__proto__?dr.prototype.__proto__=pr:dr.prototype=pr;var yr=function(e,t,n){function r(t,n,r,i){var o;void 0===r&&(r="ObservableArray"),void 0===i&&(i=!1),o=e.call(this)||this;var a=new jn(r,n,i,!0);if(a.proxy_=Y(o),H(Y(o),ee,a),t&&t.length){var l=Xe(!0);o.spliceWithArray(0,0,t),Qe(l)}return Object.defineProperty(Y(o),"0",vr),o}W(r,e);var i=r.prototype;return i.concat=function(){this[ee].atom_.reportObserved();for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Array.prototype.concat.apply(this.slice(),t.map((function(e){return Kn(e)?e.slice():e})))},i[n]=function(){var e=this,t=0;return kr({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},G(r,[{key:"length",get:function(){return this[ee].getArrayLength_()},set:function(e){this[ee].setArrayLength_(e)}},{key:t,get:function(){return"Array"}}]),r}(gr,Symbol.toStringTag,Symbol.iterator);function br(e){return{enumerable:!1,configurable:!0,get:function(){return this[ee].get_(e)},set:function(t){this[ee].set_(e,t)}}}function wr(e){b(yr.prototype,""+e,br(e))}function xr(e){if(e>mr){for(var t=mr;t<e+100;t++)wr(t);mr=e}}function Er(e,t,n){return new yr(e,t,n)}function _r(e,t){if("object"==typeof e&&null!==e){if(Kn(e))return void 0!==t&&p(23),e[ee].atom_;if(rr(e))return e[ee];if(er(e)){if(void 0===t)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||p(25,t,Sr(e)),n}if(ur(e)){if(!t)return p(26);var r=e[ee].values_.get(t);return r||p(27,t,Sr(e)),r}if(ne(e)||at(e)||Ht(e))return e}else if(M(e)&&Ht(e[ee]))return e[ee];p(28)}function zr(e,t){return e||p(29),void 0!==t?zr(_r(e,t)):ne(e)||at(e)||Ht(e)||er(e)||rr(e)?e:e[ee]?e[ee]:void p(24,e)}function Sr(e,t){var n;if(void 0!==t)n=_r(e,t);else{if(Wt(e))return e.name;n=ur(e)||er(e)||rr(e)?zr(e):_r(e)}return n.name_}Object.entries(In).forEach((function(e){var t=e[0],n=e[1];"concat"!==t&&T(yr.prototype,t,n)})),xr(1e3);var Cr=w.toString;function Or(e,t,n){return void 0===n&&(n=-1),Mr(e,t,n)}function Mr(e,t,n,r,i){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var o=typeof e;if("function"!==o&&"object"!==o&&"object"!=typeof t)return!1;var a=Cr.call(e);if(a!==Cr.call(t))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++}e=Ar(e),t=Ar(t);var l="[object Array]"===a;if(!l){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,c=t.constructor;if(s!==c&&!(M(s)&&s instanceof s&&M(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var u=(r=r||[]).length;u--;)if(r[u]===e)return i[u]===t;if(r.push(e),i.push(t),l){if((u=e.length)!==t.length)return!1;for(;u--;)if(!Mr(e[u],t[u],n-1,r,i))return!1}else{var h,f=Object.keys(e);if(u=f.length,Object.keys(t).length!==u)return!1;for(;u--;)if(!F(t,h=f[u])||!Mr(e[h],t[h],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function Ar(e){return Kn(e)?e.slice():R(e)||er(e)||j(e)||rr(e)?Array.from(e.entries()):e}function kr(e){return e[Symbol.iterator]=Lr,e}function Lr(){return this}if(["Symbol","Map","Set"].forEach((function(e){void 0===m()[e]&&p("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:Sr},$mobx:ee}),!(d=l("8NFma")).useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!Tn)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function Pr(e){e()}var Tr={};e(Tr,"useObserver",(()=>Xr),(e=>Xr=e));d=l("8NFma");function Hr(e){return rn(e)}var Nr="undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry;function Rr(e){return{reaction:e,mounted:!1,changedBeforeMount:!1,cleanAt:Date.now()+jr}}var jr=1e4;var Vr={};e(Vr,"createTimerBasedReactionCleanupTracking",(()=>Dr),(e=>Dr=e));var Ir=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Dr(){var e,t=new Set;function n(){void 0===e&&(e=setTimeout(r,1e4))}function r(){e=void 0;var r=Date.now();t.forEach((function(e){var n=e.current;n&&r>=n.cleanAt&&(n.reaction.dispose(),e.current=null,t.delete(e))})),t.size>0&&n()}return{addReactionToTrack:function(e,r,i){var o;return e.current=Rr(r),o=e,t.add(o),n(),e.current},recordReactionAsCommitted:function(e){t.delete(e)},forceCleanupTimerToRunNowForTests:function(){e&&(clearTimeout(e),r())},resetCleanupScheduleForTests:function(){var n,r;if(t.size>0){try{for(var i=Ir(t),o=i.next();!o.done;o=i.next()){var a=o.value,l=a.current;l&&(l.reaction.dispose(),a.current=null)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.clear()}e&&(clearTimeout(e),e=void 0)}}}var Fr=Nr?function(e){var t=new Map,n=1,r=new e((function(e){var n=t.get(e);n&&(n.reaction.dispose(),t.delete(e))}));return{addReactionToTrack:function(e,i,o){var a=n++;return r.register(o,a,e),e.current=Rr(i),e.current.finalizationRegistryCleanupToken=a,t.set(a,e.current),e.current},recordReactionAsCommitted:function(e){r.unregister(e),e.current&&e.current.finalizationRegistryCleanupToken&&t.delete(e.current.finalizationRegistryCleanupToken)},forceCleanupTimerToRunNowForTests:function(){},resetCleanupScheduleForTests:function(){}}}(Nr):(0,Vr.createTimerBasedReactionCleanupTracking)(),Br=Fr.addReactionToTrack,Ur=Fr.recordReactionAsCommitted,Gr=(Fr.resetCleanupScheduleForTests,Fr.forceCleanupTimerToRunNowForTests,!1);function qr(){return Gr}var Wr=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a};function Kr(e){return"observer".concat(e)}var Yr=function(){};function $r(){return new Yr}function Xr(e,t){if(void 0===t&&(t="observed"),qr())return e();var r=Wr(n(d).useState($r),1)[0],i=Wr(n(d).useState(),2)[1],o=function(){return i([])},a=n(d).useRef(null);if(!a.current)var l=new kt(Kr(t),(function(){s.mounted?o():s.changedBeforeMount=!0})),s=Br(a,l,r);var c,u,h=a.current.reaction;if(n(d).useDebugValue(h,Hr),n(d).useEffect((function(){return Ur(a),a.current?(a.current.mounted=!0,a.current.changedBeforeMount&&(a.current.changedBeforeMount=!1,o())):(a.current={reaction:new kt(Kr(t),(function(){o()})),mounted:!0,changedBeforeMount:!1,cleanAt:1/0},o()),function(){a.current.reaction.dispose(),a.current=null}}),[]),h.track((function(){try{c=e()}catch(e){u=e}})),u)throw u;return c}d=l("8NFma");var Qr="function"==typeof Symbol&&Symbol.for,Zr=Qr?Symbol.for("react.forward_ref"):"function"==typeof d.forwardRef&&(0,d.forwardRef)((function(e){return null})).$$typeof,Jr=Qr?Symbol.for("react.memo"):"function"==typeof d.memo&&(0,d.memo)((function(e){return null})).$$typeof;function ei(e,t){var n;if(Jr&&e.$$typeof===Jr)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");if(qr())return e;var r=null!==(n=null==t?void 0:t.forwardRef)&&void 0!==n&&n,i=e,o=e.displayName||e.name;if(Zr&&e.$$typeof===Zr&&(r=!0,"function"!=typeof(i=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var a,l,s=function(e,t){return(0,Tr.useObserver)((function(){return i(e,t)}),o)};return""!==o&&(s.displayName=o),e.contextTypes&&(s.contextTypes=e.contextTypes),r&&(s=(0,d.forwardRef)(s)),s=(0,d.memo)(s),a=e,l=s,Object.keys(a).forEach((function(e){ti[e]||Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(a,e))})),s}var ti={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};d=l("8NFma");d=l("8NFma");var ni={};e(ni,"useAsObservableSource",(()=>oi),(e=>oi=e));d=l("8NFma");var ri,ii=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a};function oi(e){var t=ii((0,d.useState)((function(){return je(e,{},{deep:!1})})),1)[0];return qt((function(){Object.assign(t,e)})),t}(ri=f.unstable_batchedUpdates)||(ri=Pr),tn({reactionScheduler:ri});d=l("8NFma");var ai=Math.PI/180;const li=void 0!==t?t:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},si={_global:li,version:"8.3.13",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle:e=>si.angleDeg?e*ai:e,enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>si.DD.isDragging,isDragReady:()=>!!si.DD.node,document:li.document,_injectGlobal(e){li.Konva=e}},ci=e=>{si[e.prototype.getClassName()]=e};si._injectGlobal(si);class ui{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new ui(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){var t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}translate(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}scale(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}rotate(e){var t=Math.cos(e),n=Math.sin(e),r=this.m[0]*t+this.m[2]*n,i=this.m[1]*t+this.m[3]*n,o=this.m[0]*-n+this.m[2]*t,a=this.m[1]*-n+this.m[3]*t;return this.m[0]=r,this.m[1]=i,this.m[2]=o,this.m[3]=a,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){var n=this.m[0]+this.m[2]*t,r=this.m[1]+this.m[3]*t,i=this.m[2]+this.m[0]*e,o=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=o,this}multiply(e){var t=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],r=this.m[0]*e.m[2]+this.m[2]*e.m[3],i=this.m[1]*e.m[2]+this.m[3]*e.m[3],o=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],a=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=i,this.m[4]=o,this.m[5]=a,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,r=-this.m[2]*e,i=this.m[0]*e,o=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=i,this.m[4]=o,this.m[5]=a,this}getMatrix(){return this.m}decompose(){var e=this.m[0],t=this.m[1],n=this.m[2],r=this.m[3],i=e*r-t*n;let o={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=e||0!=t){var a=Math.sqrt(e*e+t*t);o.rotation=t>0?Math.acos(e/a):-Math.acos(e/a),o.scaleX=a,o.scaleY=i/a,o.skewX=(e*n+t*r)/i,o.skewY=0}else if(0!=n||0!=r){var l=Math.sqrt(n*n+r*r);o.rotation=Math.PI/2-(r>0?Math.acos(-n/l):-Math.acos(n/l)),o.scaleX=i/l,o.scaleY=l,o.skewX=0,o.skewY=(e*n+t*r)/i}return o.rotation=yi._getRotation(o.rotation),o}}var hi=Math.PI/180,fi=180/Math.PI,di="Konva error: ",pi={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},vi=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,mi=[];const gi="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(e){setTimeout(e,60)},yi={_isElement:e=>!(!e||1!=e.nodeType),_isFunction:e=>!!(e&&e.constructor&&e.call&&e.apply),_isPlainObject:e=>!!e&&e.constructor===Object,_isArray:e=>"[object Array]"===Object.prototype.toString.call(e),_isNumber:e=>"[object Number]"===Object.prototype.toString.call(e)&&!isNaN(e)&&isFinite(e),_isString:e=>"[object String]"===Object.prototype.toString.call(e),_isBoolean:e=>"[object Boolean]"===Object.prototype.toString.call(e),isObject:e=>e instanceof Object,isValidSelector(e){if("string"!=typeof e)return!1;var t=e[0];return"#"===t||"."===t||t===t.toUpperCase()},_sign:e=>0===e||e>0?1:-1,requestAnimFrame(e){mi.push(e),1===mi.length&&gi((function(){const e=mi;mi=[],e.forEach((function(e){e()}))}))},createCanvasElement(){var e=document.createElement("canvas");try{e.style=e.style||{}}catch(e){}return e},createImageElement:()=>document.createElement("img"),_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){var n=yi.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex:(e,t,n)=>(16777216+(e<<16)+(t<<8)+n).toString(16).slice(1),_hexToRgb(e){e=e.replace("#","");var t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t}},getRandomColor(){for(var e=(16777215*Math.random()<<0).toString(16);e.length<6;)e="0"+e;return"#"+e},getRGB(e){var t;return e in pi?{r:(t=pi[e])[0],g:t[1],b:t[2]}:"#"===e[0]?this._hexToRgb(e.substring(1)):"rgb("===e.substr(0,4)?(t=vi.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA:e=>(e=e||"black",yi._namedColorToRBA(e)||yi._hex3ColorToRGBA(e)||yi._hex6ColorToRGBA(e)||yi._rgbColorToRGBA(e)||yi._rgbaColorToRGBA(e)||yi._hslColorToRGBA(e)),_namedColorToRBA(e){var t=pi[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(0===e.indexOf("rgb(")){var t=(e=e.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(0===e.indexOf("rgba(")){var t=(e=e.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(((e,t)=>"%"===e.slice(-1)?3===t?parseInt(e)/100:parseInt(e)/100*255:Number(e)));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex6ColorToRGBA(e){if("#"===e[0]&&7===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex3ColorToRGBA(e){if("#"===e[0]&&4===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,i=Number(n[1])/100,o=Number(n[2])/100;let a,l,s;if(0===i)return s=255*o,{r:Math.round(s),g:Math.round(s),b:Math.round(s),a:1};a=o<.5?o*(1+i):o+i-o*i;const c=2*o-a,u=[0,0,0];for(let e=0;e<3;e++)l=r+1/3*-(e-1),l<0&&l++,l>1&&l--,s=6*l<1?c+6*(a-c)*l:2*l<1?a:3*l<2?c+(a-c)*(2/3-l)*6:c,u[e]=255*s;return{r:Math.round(u[0]),g:Math.round(u[1]),b:Math.round(u[2]),a:1}}},haveIntersection:(e,t)=>!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y),cloneObject(e){var t={};for(var n in e)this._isPlainObject(e[n])?t[n]=this.cloneObject(e[n]):this._isArray(e[n])?t[n]=this.cloneArray(e[n]):t[n]=e[n];return t},cloneArray:e=>e.slice(0),degToRad:e=>e*hi,radToDeg:e=>e*fi,_degToRad:e=>(yi.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),yi.degToRad(e)),_radToDeg:e=>(yi.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),yi.radToDeg(e)),_getRotation:e=>si.angleDeg?yi.radToDeg(e):e,_capitalize:e=>e.charAt(0).toUpperCase()+e.slice(1),throw(e){throw new Error(di+e)},error(e){console.error(di+e)},warn(e){si.showWarnings&&console.warn("Konva warning: "+e)},each(e,t){for(var n in e)t(n,e[n])},_inRange:(e,t,n)=>t<=e&&e<n,_getProjectionToSegment(e,t,n,r,i,o){var a,l,s,c=(e-n)*(e-n)+(t-r)*(t-r);if(0==c)a=e,l=t,s=(i-n)*(i-n)+(o-r)*(o-r);else{var u=((i-e)*(n-e)+(o-t)*(r-t))/c;u<0?(a=e,l=t,s=(e-i)*(e-i)+(t-o)*(t-o)):u>1?(a=n,l=r,s=(n-i)*(n-i)+(r-o)*(r-o)):s=((a=e+u*(n-e))-i)*(a-i)+((l=t+u*(r-t))-o)*(l-o)}return[a,l,s]},_getProjectionToLine(e,t,n){var r=yi.cloneObject(e),i=Number.MAX_VALUE;return t.forEach((function(o,a){if(n||a!==t.length-1){var l=t[(a+1)%t.length],s=yi._getProjectionToSegment(o.x,o.y,l.x,l.y,e.x,e.y),c=s[0],u=s[1],h=s[2];h<i&&(r.x=c,r.y=u,i=h)}})),r},_prepareArrayForTween(e,t,n){var r,i=[],o=[];if(e.length>t.length){var a=t;t=e,e=a}for(r=0;r<e.length;r+=2)i.push({x:e[r],y:e[r+1]});for(r=0;r<t.length;r+=2)o.push({x:t[r],y:t[r+1]});var l=[];return o.forEach((function(e){var t=yi._getProjectionToLine(e,i,n);l.push(t.x),l.push(t.y)})),l},_prepareToStringify(e){var t;for(var n in e.visitedByCircularReferenceRemoval=!0,e)if(e.hasOwnProperty(n)&&e[n]&&"object"==typeof e[n])if(t=Object.getOwnPropertyDescriptor(e,n),e[n].visitedByCircularReferenceRemoval||yi._isElement(e[n])){if(!t.configurable)return null;delete e[n]}else if(null===yi._prepareToStringify(e[n])){if(!t.configurable)return null;delete e[n]}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,t){for(var n in t)e[n]=t[n];return e},_getFirstPointerId:e=>e.touches?e.changedTouches[0].identifier:e.pointerId||999};function bi(e){return yi._isString(e)?'"'+e+'"':"[object Number]"===Object.prototype.toString.call(e)||yi._isBoolean(e)?e:Object.prototype.toString.call(e)}function wi(e){return e>255?255:e<0?0:Math.round(e)}function xi(){if(si.isUnminified)return function(e,t){return yi._isNumber(e)||yi.warn(bi(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function Ei(e){if(si.isUnminified)return function(t,n){let r=yi._isNumber(t),i=yi._isArray(t)&&t.length==e;return r||i||yi.warn(bi(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function _i(){if(si.isUnminified)return function(e,t){return yi._isNumber(e)||"auto"===e||yi.warn(bi(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function zi(){if(si.isUnminified)return function(e,t){return yi._isString(e)||yi.warn(bi(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function Si(){if(si.isUnminified)return function(e,t){const n=yi._isString(e),r="[object CanvasGradient]"===Object.prototype.toString.call(e)||e&&e.addColorStop;return n||r||yi.warn(bi(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function Ci(){if(si.isUnminified)return function(e,t){return!0===e||!1===e||yi.warn(bi(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}function Oi(e){if(si.isUnminified)return function(t,n){return null==t||yi.isObject(t)||yi.warn(bi(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}var Mi="get",Ai="set";const ki={addGetterSetter(e,t,n,r,i){ki.addGetter(e,t,n),ki.addSetter(e,t,r,i),ki.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){var r=Mi+yi._capitalize(t);e.prototype[r]=e.prototype[r]||function(){var e=this.attrs[t];return void 0===e?n:e}},addSetter(e,t,n,r){var i=Ai+yi._capitalize(t);e.prototype[i]||ki.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){var i=Ai+yi._capitalize(t);e.prototype[i]=function(e){return n&&null!=e&&(e=n.call(this,e,t)),this._setAttr(t,e),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,i){var o,a,l=n.length,s=yi._capitalize,c=Mi+s(t),u=Ai+s(t);e.prototype[c]=function(){var e={};for(o=0;o<l;o++)e[a=n[o]]=this.getAttr(t+s(a));return e};var h=Oi(n);e.prototype[u]=function(e){var o,a=this.attrs[t];for(o in r&&(e=r.call(this,e)),h&&h.call(this,e,t),e)e.hasOwnProperty(o)&&this._setAttr(t+s(o),e[o]);return e||n.forEach((e=>{this._setAttr(t+s(e),void 0)})),this._fireChangeEvent(t,a,e),i&&i.call(this),this},ki.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){var n=yi._capitalize(t),r=Ai+n,i=Mi+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(e,t,n,r){yi.error("Adding deprecated "+t);var i=Mi+yi._capitalize(t),o=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[i]=function(){yi.error(o);var e=this.attrs[t];return void 0===e?n:e},ki.addSetter(e,t,r,(function(){yi.error(o)})),ki.addOverloadedGetterSetter(e,t)},backCompat(e,t){yi.each(t,(function(t,n){var r=e.prototype[n],i=Mi+yi._capitalize(t),o=Ai+yi._capitalize(t);function a(){r.apply(this,arguments),yi.error('"'+t+'" method is deprecated and will be removed soon. Use ""'+n+'" instead.')}e.prototype[t]=a,e.prototype[i]=a,e.prototype[o]=a}))},afterSetFilter(){this._filterUpToDate=!1}};function Li(e){var t,n,r=[],i=e.length,o=yi;for(t=0;t<i;t++)n=e[t],o._isNumber(n)?n=Math.round(1e3*n)/1e3:o._isString(n)||(n+=""),r.push(n);return r}var Pi=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"];class Ti{constructor(e){this.canvas=e,si.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){var n,r,i,o,a=this.traceArr,l=a.length,s="";for(n=0;n<l;n++)(i=(r=a[n]).method)?(o=r.args,s+=i,e?s+="()":yi._isArray(o[0])?s+="(["+o.join(",")+"])":(t&&(o=o.map((e=>"number"==typeof e?Math.floor(e):e))),s+="("+o.join(",")+")")):(s+=r.property,e||(s+="="+r.val)),s+=";";return s}clearTrace(){this.traceArr=[]}_trace(e){var t=this.traceArr;t.push(e),t.length>=100&&t.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){var t=e.getLineCap();t&&this.setAttr("lineCap",t)}_applyOpacity(e){var t=e.getAbsoluteOpacity();1!==t&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){var t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,i,o){this._context.arc(e,t,n,r,i,o)}arcTo(e,t,n,r,i){this._context.arcTo(e,t,n,r,i)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,i,o){this._context.bezierCurveTo(e,t,n,r,i,o)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(e,t){var n=arguments;return 2===n.length?this._context.createImageData(e,t):1===n.length?this._context.createImageData(e):void 0}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,i,o){return this._context.createRadialGradient(e,t,n,r,i,o)}drawImage(e,t,n,r,i,o,a,l,s){var c=arguments,u=this._context;3===c.length?u.drawImage(e,t,n):5===c.length?u.drawImage(e,t,n,r,i):9===c.length&&u.drawImage(e,t,n,r,i,o,a,l,s)}ellipse(e,t,n,r,i,o,a,l){this._context.ellipse(e,t,n,r,i,o,a,l)}isPointInPath(e,t){return this._context.isPointInPath(e,t)}fill(e){e?this._context.fill(e):this._context.fill()}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,i,o){this._context.setTransform(e,t,n,r,i,o)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,i,o){this._context.transform(e,t,n,r,i,o)}translate(e,t){this._context.translate(e,t)}_enableTrace(){var e,t,n=this,r=Pi.length,i=this.setAttr,o=function(e){var r,i=n[e];n[e]=function(){return t=Li(Array.prototype.slice.call(arguments,0)),r=i.apply(n,arguments),n._trace({method:e,args:t}),r}};for(e=0;e<r;e++)o(Pi[e]);n.setAttr=function(){i.apply(n,arguments);var e=arguments[0],t=arguments[1];"shadowOffsetX"!==e&&"shadowOffsetY"!==e&&"shadowBlur"!==e||(t/=this.canvas.getPixelRatio()),n._trace({property:e,val:t})}}_applyGlobalCompositeOperation(e){const t=e.attrs.globalCompositeOperation;!t||"source-over"===t||this.setAttr("globalCompositeOperation",t)}}["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"].forEach((function(e){Object.defineProperty(Ti.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})}));class Hi extends Ti{constructor(e){super(e),this._context=e._canvas.getContext("2d")}_fillColor(e){var t=e.fill();this.setAttr("fillStyle",t),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){var t=e._getLinearGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fillRadialGradient(e){var t=e._getRadialGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fill(e){var t=e.fill(),n=e.getFillPriority();if(t&&"color"===n)this._fillColor(e);else{var r=e.getFillPatternImage();if(r&&"pattern"===n)this._fillPattern(e);else{var i=e.getFillLinearGradientColorStops();if(i&&"linear-gradient"===n)this._fillLinearGradient(e);else{var o=e.getFillRadialGradientColorStops();o&&"radial-gradient"===n?this._fillRadialGradient(e):t?this._fillColor(e):r?this._fillPattern(e):i?this._fillLinearGradient(e):o&&this._fillRadialGradient(e)}}}}_strokeLinearGradient(e){var t=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),r=e.getStrokeLinearGradientColorStops(),i=this.createLinearGradient(t.x,t.y,n.x,n.y);if(r){for(var o=0;o<r.length;o+=2)i.addColorStop(r[o],r[o+1]);this.setAttr("strokeStyle",i)}}_stroke(e){var t=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();var r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(e),t&&e.dashEnabled()&&(this.setLineDash(t),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),n||this.restore()}}_applyShadow(e){var t,n,r,i=null!==(t=e.getShadowRGBA())&&void 0!==t?t:"black",o=null!==(n=e.getShadowBlur())&&void 0!==n?n:5,a=null!==(r=e.getShadowOffset())&&void 0!==r?r:{x:0,y:0},l=e.getAbsoluteScale(),s=this.canvas.getPixelRatio(),c=l.x*s,u=l.y*s;this.setAttr("shadowColor",i),this.setAttr("shadowBlur",o*Math.min(Math.abs(c),Math.abs(u))),this.setAttr("shadowOffsetX",a.x*c),this.setAttr("shadowOffsetY",a.y*u)}}class Ni extends Ti{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){var t=e.getStrokeScaleEnabled();if(!t){this.save();var n=this.getCanvas().getPixelRatio();this.setTransform(n,0,0,n,0,0)}this._applyLineCap(e);var r=e.hitStrokeWidth(),i="auto"===r?e.strokeWidth():r;this.setAttr("lineWidth",i),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),t||this.restore()}}}var Ri;class ji{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var t=(e||{}).pixelRatio||si.pixelRatio||function(){if(Ri)return Ri;var e=yi.createCanvasElement().getContext("2d");return Ri=(si._global.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)}();this.pixelRatio=t,this._canvas=yi.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){var t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";var t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";var t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch(e){try{return this._canvas.toDataURL()}catch(e){return yi.error("Unable to get data URL. "+e.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}ki.addGetterSetter(ji,"pixelRatio",void 0,xi());class Vi extends ji{constructor(e={width:0,height:0}){super(e),this.context=new Hi(this),this.setSize(e.width,e.height)}}class Ii extends ji{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new Ni(this),this.setSize(e.width,e.height)}}const Di={get isDragging(){var e=!1;return Di._dragElements.forEach((t=>{"dragging"===t.dragStatus&&(e=!0)})),e},justDragged:!1,get node(){var e;return Di._dragElements.forEach((t=>{e=t.node})),e},_dragElements:new Map,_drag(e){const t=[];Di._dragElements.forEach(((n,r)=>{const{node:i}=n,o=i.getStage();o.setPointersPositions(e),void 0===n.pointerId&&(n.pointerId=yi._getFirstPointerId(e));const a=o._changedPointerPositions.find((e=>e.id===n.pointerId));if(a){if("dragging"!==n.dragStatus){var l=i.dragDistance();if(Math.max(Math.abs(a.x-n.startPointerPos.x),Math.abs(a.y-n.startPointerPos.y))<l)return;if(i.startDrag({evt:e}),!i.isDragging())return}i._setDragPosition(e,n),t.push(i)}})),t.forEach((t=>{t.fire("dragmove",{type:"dragmove",target:t,evt:e},!0)}))},_endDragBefore(e){const t=[];Di._dragElements.forEach((n=>{const{node:r}=n,i=r.getStage();e&&i.setPointersPositions(e);if(!i._changedPointerPositions.find((e=>e.id===n.pointerId)))return;"dragging"!==n.dragStatus&&"stopped"!==n.dragStatus||(Di.justDragged=!0,si._mouseListenClick=!1,si._touchListenClick=!1,si._pointerListenClick=!1,n.dragStatus="stopped");const o=n.node.getLayer()||n.node instanceof si.Stage&&n.node;o&&-1===t.indexOf(o)&&t.push(o)})),t.forEach((e=>{e.draw()}))},_endDragAfter(e){Di._dragElements.forEach(((t,n)=>{"stopped"===t.dragStatus&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),"dragging"!==t.dragStatus&&Di._dragElements.delete(n)}))}};si.isBrowser&&(window.addEventListener("mouseup",Di._endDragBefore,!0),window.addEventListener("touchend",Di._endDragBefore,!0),window.addEventListener("mousemove",Di._drag),window.addEventListener("touchmove",Di._drag),window.addEventListener("mouseup",Di._endDragAfter,!1),window.addEventListener("touchend",Di._endDragAfter,!1));var Fi="absoluteOpacity",Bi="allEventListeners",Ui="absoluteTransform",Gi="absoluteScale",qi="canvas",Wi="listening",Ki="mouseenter",Yi="mouseleave",$i="Shape",Xi=" ",Qi="stage",Zi="transform",Ji="visible",eo=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Xi);let to=1;class no{constructor(e){this._id=to++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){e!==Zi&&e!==Ui||!this._cache.get(e)?e?this._cache.delete(e):this._cache.clear():this._cache.get(e).dirty=!0}_getCache(e,t){var n=this._cache.get(e);return(void 0===n||(e===Zi||e===Ui)&&!0===n.dirty)&&(n=t.call(this),this._cache.set(e,n)),n}_calculate(e,t,n){if(!this._attachedDepsListeners.get(e)){const n=t.map((e=>e+"Change.konva")).join(Xi);this.on(n,(()=>{this._clearCache(e)})),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(qi)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Ui&&this.fire("absoluteTransformChange")}clearCache(){return this._cache.delete(qi),this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var t=e||{},n={};void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height||(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var r=Math.ceil(t.width||n.width),i=Math.ceil(t.height||n.height),o=t.pixelRatio,a=void 0===t.x?Math.floor(n.x):t.x,l=void 0===t.y?Math.floor(n.y):t.y,s=t.offset||0,c=t.drawBorder||!1,u=t.hitCanvasPixelRatio||1;if(r&&i){a-=s,l-=s;var h=new Vi({pixelRatio:o,width:r+=2*s+1,height:i+=2*s+1}),f=new Vi({pixelRatio:o,width:0,height:0}),d=new Ii({pixelRatio:u,width:r,height:i}),p=h.getContext(),v=d.getContext();return d.isCache=!0,h.isCache=!0,this._cache.delete(qi),this._filterUpToDate=!1,!1===t.imageSmoothingEnabled&&(h.getContext()._context.imageSmoothingEnabled=!1,f.getContext()._context.imageSmoothingEnabled=!1),p.save(),v.save(),p.translate(-a,-l),v.translate(-a,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Fi),this._clearSelfAndDescendantCache(Gi),this.drawScene(h,this),this.drawHit(d,this),this._isUnderCache=!1,p.restore(),v.restore(),c&&(p.save(),p.beginPath(),p.rect(0,0,r,i),p.closePath(),p.setAttr("strokeStyle","red"),p.setAttr("lineWidth",5),p.stroke(),p.restore()),this._cache.set(qi,{scene:h,filter:f,hit:d,x:a,y:l}),this._requestDraw(),this}yi.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.")}isCached(){return this._cache.has(qi)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,t){var n,r,i,o,a=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],l=this.getAbsoluteTransform(t);return a.forEach((function(e){var t=l.point(e);void 0===n&&(n=i=t.x,r=o=t.y),n=Math.min(n,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x),o=Math.max(o,t.y)})),{x:n,y:r,width:i-n,height:o-r}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const t=this._getCanvasCache();e.translate(t.x,t.y);var n=this._getCachedSceneCanvas(),r=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/r,n.height/r),e.restore()}_drawCachedHitCanvas(e){var t=this._getCanvasCache(),n=t.hit;e.save(),e.translate(t.x,t.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e,t,n,r,i=this.filters(),o=this._getCanvasCache(),a=o.scene,l=o.filter,s=l.getContext();if(i){if(!this._filterUpToDate){var c=a.pixelRatio;l.setSize(a.width/a.pixelRatio,a.height/a.pixelRatio);try{for(e=i.length,s.clear(),s.drawImage(a._canvas,0,0,a.getWidth()/c,a.getHeight()/c),t=s.getImageData(0,0,l.getWidth(),l.getHeight()),n=0;n<e;n++)"function"==typeof(r=i[n])?(r.call(this,t),s.putImageData(t,0,0)):yi.error("Filter should be type of function, but got "+typeof r+" instead. Please check correct filters")}catch(e){yi.error("Unable to apply filter. "+e.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return l}return a}on(e,t){if(this._cache&&this._cache.delete(Bi),3===arguments.length)return this._delegate.apply(this,arguments);var n,r,i,o,a=e.split(Xi),l=a.length;for(n=0;n<l;n++)i=(r=a[n].split("."))[0],o=r[1]||"",this.eventListeners[i]||(this.eventListeners[i]=[]),this.eventListeners[i].push({name:o,handler:t});return this}off(e,t){var n,r,i,o,a,l=(e||"").split(Xi),s=l.length;if(this._cache&&this._cache.delete(Bi),!e)for(r in this.eventListeners)this._off(r);for(n=0;n<s;n++)if(o=(i=l[n].split("."))[0],a=i[1],o)this.eventListeners[o]&&this._off(o,a,t);else for(r in this.eventListeners)this._off(r,a,t);return this}dispatchEvent(e){var t={target:this,type:e.type,evt:e};return this.fire(e.type,t),this}addEventListener(e,t){return this.on(e,(function(e){t.call(this,e.evt)})),this}removeEventListener(e){return this.off(e),this}_delegate(e,t,n){var r=this;this.on(e,(function(e){for(var i=e.target.findAncestors(t,!0,r),o=0;o<i.length;o++)(e=yi.cloneObject(e)).currentTarget=i[o],n.call(i[o],e)}))}remove(){return this.isDragging()&&this.stopDrag(),Di._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Ui),this._clearSelfAndDescendantCache(Fi),this._clearSelfAndDescendantCache(Gi),this._clearSelfAndDescendantCache(Qi),this._clearSelfAndDescendantCache(Ji),this._clearSelfAndDescendantCache(Wi)}_remove(){this._clearCaches();var e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this}getAttr(e){var t="get"+yi._capitalize(e);return yi._isFunction(this[t])?this[t]():this.attrs[e]}getAncestors(){for(var e=this.getParent(),t=[];e;)t.push(e),e=e.getParent();return t}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges((()=>{var t,n;if(!e)return this;for(t in e)"children"!==t&&(n="set"+yi._capitalize(t),yi._isFunction(this[n])?this[n](e[t]):this._setAttr(t,e[t]))})),this}isListening(){return this._getCache(Wi,this._isListening)}_isListening(e){if(!this.listening())return!1;const t=this.getParent();return!t||t===e||this===e||t._isListening(e)}isVisible(){return this._getCache(Ji,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const t=this.getParent();return!t||t===e||this===e||t._isVisible(e)}shouldDrawHit(e,t=!1){if(e)return this._isVisible(e)&&this._isListening(e);var n=this.getLayer(),r=!1;Di._dragElements.forEach((e=>{"dragging"===e.dragStatus&&("Stage"===e.node.nodeType||e.node.getLayer()===n)&&(r=!0)}));var i=!t&&!si.hitOnDragEnabled&&r;return this.isListening()&&this.isVisible()&&!i}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e,t,n,r,i=this.getDepth(),o=this,a=0;return"Stage"!==o.nodeType&&function l(s){for(e=[],t=s.length,n=0;n<t;n++)r=s[n],a++,r.nodeType!==$i&&(e=e.concat(r.getChildren().slice())),r._id===o._id&&(n=t);e.length>0&&e[0].getDepth()<=i&&l(e)}(o.getStage().getChildren()),a}getDepth(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Zi),this._clearSelfAndDescendantCache(Ui)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges((()=>{this.x(e.x),this.y(e.y)})),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var e=this.getStage().getPointerPosition();if(!e)return null;var t=this.getAbsoluteTransform().copy();return t.invert(),t.point(e)}getAbsolutePosition(e){let t=!1,n=this.parent;for(;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);var r=this.getAbsoluteTransform(e).getMatrix(),i=new ui,o=this.offset();return i.m=r.slice(),i.translate(o.x,o.y),i.getTranslation()}setAbsolutePosition(e){var t=this._clearTransform();this.attrs.x=t.x,this.attrs.y=t.y,delete t.x,delete t.y,this._clearCache(Zi);var n=this._getAbsoluteTransform().copy();return n.invert(),n.translate(e.x,e.y),e={x:this.attrs.x+n.getTranslation().x,y:this.attrs.y+n.getTranslation().y},this._setTransform(t),this.setPosition({x:e.x,y:e.y}),this._clearCache(Zi),this._clearSelfAndDescendantCache(Ui),this}_setTransform(e){var t;for(t in e)this.attrs[t]=e[t]}_clearTransform(){var e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){var t=e.x,n=e.y,r=this.x(),i=this.y();return void 0!==t&&(r+=t),void 0!==n&&(i+=n),this.setPosition({x:r,y:i}),this}_eachAncestorReverse(e,t){var n,r,i=[],o=this.getParent();if(!t||t._id!==this._id){for(i.unshift(this);o&&(!t||o._id!==t._id);)i.unshift(o),o=o.parent;for(n=i.length,r=0;r<n;r++)e(i[r])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return yi.warn("Node has no parent. moveToTop function is ignored."),!1;var e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0)}moveUp(){if(!this.parent)return yi.warn("Node has no parent. moveUp function is ignored."),!1;var e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0)}moveDown(){if(!this.parent)return yi.warn("Node has no parent. moveDown function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return yi.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(e){if(!this.parent)return yi.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&yi.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Fi,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),t=this.getParent();return t&&!t._isUnderCache&&(e*=t.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e,t,n,r,i={},o=this.getAttrs();for(e in i.attrs={},o)t=o[e],yi.isObject(t)&&!yi._isPlainObject(t)&&!yi._isArray(t)||(n="function"==typeof this[e]&&this[e],delete o[e],r=n?n.call(this):null,o[e]=t,r!==t&&(i.attrs[e]=t));return i.className=this.getClassName(),yi._prepareToStringify(i)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,t,n){var r=[];t&&this._isMatch(e)&&r.push(this);for(var i=this.parent;i;){if(i===n)return r;i._isMatch(e)&&r.push(i),i=i.parent}return r}isAncestorOf(e){return!1}findAncestor(e,t,n){return this.findAncestors(e,t,n)[0]}_isMatch(e){if(!e)return!1;if("function"==typeof e)return e(this);var t,n,r=e.replace(/ /g,"").split(","),i=r.length;for(t=0;t<i;t++)if(n=r[t],yi.isValidSelector(n)||(yi.warn('Selector "'+n+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),yi.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),yi.warn("Konva is awesome, right?")),"#"===n.charAt(0)){if(this.id()===n.slice(1))return!0}else if("."===n.charAt(0)){if(this.hasName(n.slice(1)))return!0}else if(this.className===n||this.nodeType===n)return!0;return!1}getLayer(){var e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(Qi,this._getStage)}_getStage(){var e=this.getParent();return e?e.getStage():void 0}fire(e,t={},n){return t.target=t.target||this,n?this._fireAndBubble(e,t):this._fire(e,t),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(Ui,this._getAbsoluteTransform)}_getAbsoluteTransform(e){var t;if(e)return t=new ui,this._eachAncestorReverse((function(e){var n=e.transformsEnabled();"all"===n?t.multiply(e.getTransform()):"position"===n&&t.translate(e.x()-e.offsetX(),e.y()-e.offsetY())}),e),t;t=this._cache.get(Ui)||new ui,this.parent?this.parent.getAbsoluteTransform().copyInto(t):t.reset();var n=this.transformsEnabled();if("all"===n)t.multiply(this.getTransform());else if("position"===n){const e=this.attrs.x||0,n=this.attrs.y||0,r=this.attrs.offsetX||0,i=this.attrs.offsetY||0;t.translate(e-r,n-i)}return t.dirty=!1,t}getAbsoluteScale(e){for(var t=this;t;)t._isUnderCache&&(e=t),t=t.getParent();const n=this.getAbsoluteTransform(e).decompose();return{x:n.scaleX,y:n.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Zi,this._getTransform)}_getTransform(){var e,t,n=this._cache.get(Zi)||new ui;n.reset();var r=this.x(),i=this.y(),o=si.getAngle(this.rotation()),a=null!==(e=this.attrs.scaleX)&&void 0!==e?e:1,l=null!==(t=this.attrs.scaleY)&&void 0!==t?t:1,s=this.attrs.skewX||0,c=this.attrs.skewY||0,u=this.attrs.offsetX||0,h=this.attrs.offsetY||0;return 0===r&&0===i||n.translate(r,i),0!==o&&n.rotate(o),0===s&&0===c||n.skew(s,c),1===a&&1===l||n.scale(a,l),0===u&&0===h||n.translate(-1*u,-1*h),n.dirty=!1,n}clone(e){var t,n,r,i,o,a=yi.cloneObject(this.attrs);for(t in e)a[t]=e[t];var l=new this.constructor(a);for(t in this.eventListeners)for(r=(n=this.eventListeners[t]).length,i=0;i<r;i++)(o=n[i]).name.indexOf("konva")<0&&(l.eventListeners[t]||(l.eventListeners[t]=[]),l.eventListeners[t].push(o));return l}_toKonvaCanvas(e){e=e||{};var t=this.getClientRect(),n=this.getStage(),r=void 0!==e.x?e.x:Math.floor(t.x),i=void 0!==e.y?e.y:Math.floor(t.y),o=e.pixelRatio||1,a=new Vi({width:e.width||Math.ceil(t.width)||(n?n.width():0),height:e.height||Math.ceil(t.height)||(n?n.height():0),pixelRatio:o}),l=a.getContext();return!1===e.imageSmoothingEnabled&&(l._context.imageSmoothingEnabled=!1),l.save(),(r||i)&&l.translate(-1*r,-1*i),this.drawScene(a),l.restore(),a}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){var t=(e=e||{}).mimeType||null,n=e.quality||null,r=this._toKonvaCanvas(e).toDataURL(t,n);return e.callback&&e.callback(r),r}toImage(e){return new Promise(((t,n)=>{try{const n=null==e?void 0:e.callback;n&&delete e.callback,yi._urlToImage(this.toDataURL(e),(function(e){t(e),null==n||n(e)}))}catch(e){n(e)}}))}toBlob(e){return new Promise(((t,n)=>{try{const n=null==e?void 0:e.callback;n&&delete e.callback,this.toCanvas(e).toBlob((e=>{t(e),null==n||n(e)}))}catch(e){n(e)}}))}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():si.dragDistance}_off(e,t,n){var r,i,o,a=this.eventListeners[e];for(r=0;r<a.length;r++)if(i=a[r].name,o=a[r].handler,!("konva"===i&&"konva"!==t||t&&i!==t||n&&n!==o)){if(a.splice(r,1),0===a.length){delete this.eventListeners[e];break}r--}}_fireChangeEvent(e,t,n){this._fire(e+"Change",{oldVal:t,newVal:n})}addName(e){if(!this.hasName(e)){var t=this.name(),n=t?t+" "+e:e;this.name(n)}return this}hasName(e){if(!e)return!1;const t=this.name();return!!t&&-1!==(t||"").split(/\s/g).indexOf(e)}removeName(e){var t=(this.name()||"").split(/\s/g),n=t.indexOf(e);return-1!==n&&(t.splice(n,1),this.name(t.join(" "))),this}setAttr(e,t){var n=this["set"+yi._capitalize(e)];return yi._isFunction(n)?n.call(this,t):this._setAttr(e,t),this}_requestDraw(){if(si.autoDrawEnabled){const e=this.getLayer()||this.getStage();null==e||e.batchDraw()}}_setAttr(e,t){var n=this.attrs[e];(n!==t||yi.isObject(t))&&(null==t?delete this.attrs[e]:this.attrs[e]=t,this._shouldFireChangeEvents&&this._fireChangeEvent(e,n,t),this._requestDraw())}_setComponentAttr(e,t,n){var r;void 0!==n&&((r=this.attrs[e])||(this.attrs[e]=this.getAttr(e)),this.attrs[e][t]=n,this._fireChangeEvent(e,r,n))}_fireAndBubble(e,t,n){if(t&&this.nodeType===$i&&(t.target=this),!((e===Ki||e===Yi)&&(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||"Stage"===this.nodeType&&!n))){this._fire(e,t);var r=(e===Ki||e===Yi)&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(t&&!t.cancelBubble||!t)&&this.parent&&this.parent.isListening()&&!r&&(n&&n.parent?this._fireAndBubble.call(this.parent,e,t,n):this._fireAndBubble.call(this.parent,e,t))}}_getProtoListeners(e){let t=this._cache.get(Bi);if(!t){t={};let e=Object.getPrototypeOf(this);for(;e;)if(e.eventListeners){for(var n in e.eventListeners){const r=e.eventListeners[n],i=t[n]||[];t[n]=r.concat(i)}e=Object.getPrototypeOf(e)}else e=Object.getPrototypeOf(e);this._cache.set(Bi,t)}return t[e]}_fire(e,t){(t=t||{}).currentTarget=this,t.type=e;const n=this._getProtoListeners(e);if(n)for(var r=0;r<n.length;r++)n[r].handler.call(this,t);const i=this.eventListeners[e];if(i)for(r=0;r<i.length;r++)i[r].handler.call(this,t)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){var t=e?e.pointerId:void 0,n=this.getStage(),r=this.getAbsolutePosition(),i=n._getPointerById(t)||n._changedPointerPositions[0]||r;Di._dragElements.set(this._id,{node:this,startPointerPos:i,offset:{x:i.x-r.x,y:i.y-r.y},dragStatus:"ready",pointerId:t})}startDrag(e,t=!0){Di._dragElements.has(this._id)||this._createDragElement(e);Di._dragElements.get(this._id).dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:e&&e.evt},t)}_setDragPosition(e,t){const n=this.getStage()._getPointerById(t.pointerId);if(n){var r={x:n.x-t.offset.x,y:n.y-t.offset.y},i=this.dragBoundFunc();if(void 0!==i){const t=i.call(this,r,e);t?r=t:yi.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}this._lastPos&&this._lastPos.x===r.x&&this._lastPos.y===r.y||(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}}stopDrag(e){const t=Di._dragElements.get(this._id);t&&(t.dragStatus="stopped"),Di._endDragBefore(e),Di._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){const e=Di._dragElements.get(this._id);return!!e&&"dragging"===e.dragStatus}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",(function(e){if((!(void 0!==e.evt.button)||si.dragButtons.indexOf(e.evt.button)>=0)&&!this.isDragging()){var t=!1;Di._dragElements.forEach((e=>{this.isAncestorOf(e.node)&&(t=!0)})),t||this._createDragElement(e)}}))}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const e=Di._dragElements.get(this._id),t=e&&"dragging"===e.dragStatus,n=e&&"ready"===e.dragStatus;t?this.stopDrag():n&&Di._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const t=this.getStage();if(!t)return!1;const n={x:-e.x,y:-e.y,width:t.width()+2*e.x,height:t.height()+2*e.y};return yi.haveIntersection(n,this.getClientRect())}static create(e,t){return yi._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}static _createNode(e,t){var n,r,i,o=no.prototype.getClassName.call(e),a=e.children;t&&(e.attrs.container=t),si[o]||(yi.warn('Can not find a node with class name "'+o+'". Fallback to "Shape".'),o="Shape");if(n=new(0,si[o])(e.attrs),a)for(r=a.length,i=0;i<r;i++)n.add(no._createNode(a[i]));return n}}no.prototype.nodeType="Node",no.prototype._attrsAffectingSize=[],no.prototype.eventListeners={},no.prototype.on.call(no.prototype,eo,(function(){this._batchingTransformChange?this._needClearTransformCache=!0:(this._clearCache(Zi),this._clearSelfAndDescendantCache(Ui))})),no.prototype.on.call(no.prototype,"visibleChange.konva",(function(){this._clearSelfAndDescendantCache(Ji)})),no.prototype.on.call(no.prototype,"listeningChange.konva",(function(){this._clearSelfAndDescendantCache(Wi)})),no.prototype.on.call(no.prototype,"opacityChange.konva",(function(){this._clearSelfAndDescendantCache(Fi)}));const ro=ki.addGetterSetter;ro(no,"zIndex"),ro(no,"absolutePosition"),ro(no,"position"),ro(no,"x",0,xi()),ro(no,"y",0,xi()),ro(no,"globalCompositeOperation","source-over",zi()),ro(no,"opacity",1,xi()),ro(no,"name","",zi()),ro(no,"id","",zi()),ro(no,"rotation",0,xi()),ki.addComponentsGetterSetter(no,"scale",["x","y"]),ro(no,"scaleX",1,xi()),ro(no,"scaleY",1,xi()),ki.addComponentsGetterSetter(no,"skew",["x","y"]),ro(no,"skewX",0,xi()),ro(no,"skewY",0,xi()),ki.addComponentsGetterSetter(no,"offset",["x","y"]),ro(no,"offsetX",0,xi()),ro(no,"offsetY",0,xi()),ro(no,"dragDistance",null,xi()),ro(no,"width",0,xi()),ro(no,"height",0,xi()),ro(no,"listening",!0,Ci()),ro(no,"preventDefault",!0,Ci()),ro(no,"filters",null,(function(e){return this._filterUpToDate=!1,e})),ro(no,"visible",!0,Ci()),ro(no,"transformsEnabled","all",zi()),ro(no,"size"),ro(no,"dragBoundFunc"),ro(no,"draggable",!1,Ci()),ki.backCompat(no,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class io extends no{constructor(){super(...arguments),this.children=[]}getChildren(e){if(!e)return this.children||[];const t=this.children||[];var n=[];return t.forEach((function(t){e(t)&&n.push(t)})),n}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach((e=>{e.parent=null,e.index=0,e.remove()})),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach((e=>{e.parent=null,e.index=0,e.destroy()})),this.children=[],this._requestDraw(),this}add(...e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}var n=e[0];return n.getParent()?(n.moveTo(this),this):(this._validateAdd(n),n.index=this.getChildren().length,n.parent=this,n._clearCaches(),this.getChildren().push(n),this._fire("add",{child:n}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){var t=this._generalFind(e,!0);return t.length>0?t[0]:void 0}_generalFind(e,t){var n=[];return this._descendants((r=>{const i=r._isMatch(e);return i&&n.push(r),!(!i||!t)})),n}_descendants(e){let t=!1;const n=this.getChildren();for(const r of n){if(t=e(r),t)return!0;if(r.hasChildren()&&(t=r._descendants(e),t))return!0}return!1}toObject(){var e=no.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach((t=>{e.children.push(t.toObject())})),e}isAncestorOf(e){for(var t=e.getParent();t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){var t=no.prototype.clone.call(this,e);return this.getChildren().forEach((function(e){t.add(e.clone())})),t}getAllIntersections(e){var t=[];return this.find("Shape").forEach((function(n){n.isVisible()&&n.intersects(e)&&t.push(n)})),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),this.isCached()||null===(t=this.children)||void 0===t||t.forEach((function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;null===(e=this.children)||void 0===e||e.forEach((function(e,t){e.index=t})),this._requestDraw()}drawScene(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas(),i=r&&r.getContext(),o=this._getCanvasCache(),a=o&&o.scene,l=r&&r.isCache;if(!this.isVisible()&&!l)return this;if(a){i.save();var s=this.getAbsoluteTransform(t).getMatrix();i.transform(s[0],s[1],s[2],s[3],s[4],s[5]),this._drawCachedSceneCanvas(i),i.restore()}else this._drawChildren("drawScene",r,t);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;var n=this.getLayer(),r=e||n&&n.hitCanvas,i=r&&r.getContext(),o=this._getCanvasCache();if(o&&o.hit){i.save();var a=this.getAbsoluteTransform(t).getMatrix();i.transform(a[0],a[1],a[2],a[3],a[4],a[5]),this._drawCachedHitCanvas(i),i.restore()}else this._drawChildren("drawHit",r,t);return this}_drawChildren(e,t,n){var r,i=t&&t.getContext(),o=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),s=o&&a||l;const c=n===this;if(s){i.save();var u=this.getAbsoluteTransform(n),h=u.getMatrix();if(i.transform(h[0],h[1],h[2],h[3],h[4],h[5]),i.beginPath(),l)l.call(this,i,this);else{var f=this.clipX(),d=this.clipY();i.rect(f,d,o,a)}i.clip(),h=u.copy().invert().getMatrix(),i.transform(h[0],h[1],h[2],h[3],h[4],h[5])}var p=!c&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===e;p&&(i.save(),i._applyGlobalCompositeOperation(this)),null===(r=this.children)||void 0===r||r.forEach((function(r){r[e](t,n)})),p&&i.restore(),s&&i.restore()}getClientRect(e){var t,n,r,i,o,a=(e=e||{}).skipTransform,l=e.relativeTo,s={x:1/0,y:1/0,width:0,height:0},c=this;null===(t=this.children)||void 0===t||t.forEach((function(t){if(t.visible()){var a=t.getClientRect({relativeTo:c,skipShadow:e.skipShadow,skipStroke:e.skipStroke});0===a.width&&0===a.height||(void 0===n?(n=a.x,r=a.y,i=a.x+a.width,o=a.y+a.height):(n=Math.min(n,a.x),r=Math.min(r,a.y),i=Math.max(i,a.x+a.width),o=Math.max(o,a.y+a.height)))}}));for(var u=this.find("Shape"),h=!1,f=0;f<u.length;f++){if(u[f]._isVisible(this)){h=!0;break}}return s=h&&void 0!==n?{x:n,y:r,width:i-n,height:o-r}:{x:0,y:0,width:0,height:0},a?s:this._transformedRect(s,l)}}ki.addComponentsGetterSetter(io,"clip",["x","y","width","height"]),ki.addGetterSetter(io,"clipX",void 0,xi()),ki.addGetterSetter(io,"clipY",void 0,xi()),ki.addGetterSetter(io,"clipWidth",void 0,xi()),ki.addGetterSetter(io,"clipHeight",void 0,xi()),ki.addGetterSetter(io,"clipFunc");const oo=new Map,ao=void 0!==si._global.PointerEvent;function lo(e){return oo.get(e)}function so(e){return{evt:e,pointerId:e.pointerId}}function co(e,t){return oo.get(e)===t}function uo(e,t){ho(e);t.getStage()&&(oo.set(e,t),ao&&t._fire("gotpointercapture",so(new PointerEvent("gotpointercapture"))))}function ho(e,t){const n=oo.get(e);if(!n)return;const r=n.getStage();r&&r.content,oo.delete(e),ao&&n._fire("lostpointercapture",so(new PointerEvent("lostpointercapture")))}var fo="mouseleave",po="mouseover",vo="mouseenter",mo="mousemove",go="mousedown",yo="mouseup",bo="pointermove",wo="pointerdown",xo="pointerup",Eo="pointercancel",_o="pointerout",zo="pointerleave",So="pointerover",Co="pointerenter",Oo="contextmenu",Mo="touchstart",Ao="touchend",ko="touchmove",Lo="touchcancel",Po="wheel",To=[[vo,"_pointerenter"],[go,"_pointerdown"],[mo,"_pointermove"],[yo,"_pointerup"],[fo,"_pointerleave"],[Mo,"_pointerdown"],[ko,"_pointermove"],[Ao,"_pointerup"],[Lo,"_pointercancel"],[po,"_pointerover"],[Po,"_wheel"],[Oo,"_contextmenu"],[wo,"_pointerdown"],[bo,"_pointermove"],[xo,"_pointerup"],[Eo,"_pointercancel"],["lostpointercapture","_lostpointercapture"]];const Ho={mouse:{[_o]:"mouseout",[zo]:fo,[So]:po,[Co]:vo,[bo]:mo,[wo]:go,[xo]:yo,[Eo]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[_o]:"touchout",[zo]:"touchleave",[So]:"touchover",[Co]:"touchenter",[bo]:ko,[wo]:Mo,[xo]:Ao,[Eo]:Lo,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[_o]:_o,[zo]:zo,[So]:So,[Co]:Co,[bo]:bo,[wo]:wo,[xo]:xo,[Eo]:Eo,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},No=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",Ro=e=>{const t=No(e);return"pointer"===t?si.pointerEventsEnabled&&Ho.pointer:"touch"===t?Ho.touch:"mouse"===t?Ho.mouse:void 0};function jo(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&yi.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}const Vo=[];class Io extends io{constructor(e){super(jo(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Vo.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",(()=>{jo(this.attrs)})),this._checkVisibility()}_validateAdd(e){const t="Layer"===e.getType(),n="FastLayer"===e.getType();t||n||yi.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if("string"==typeof e){if("."===e.charAt(0)){var t=e.slice(1);e=document.getElementsByClassName(t)[0]}else{var n;n="#"!==e.charAt(0)?e:e.slice(1),e=document.getElementById(n)}if(!e)throw"Can not find container in document with id "+n}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var e,t=this.children,n=t.length;for(e=0;e<n;e++)t[e].clear();return this}clone(e){return e||(e={}),e.container="undefined"!=typeof document&&document.createElement("div"),io.prototype.clone.call(this,e)}destroy(){super.destroy();var e=this.content;e&&yi._isInDocument(e)&&this.container().removeChild(e);var t=Vo.indexOf(this);return t>-1&&Vo.splice(t,1),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(yi.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)}_getPointerById(e){return this._pointerPositions.find((t=>t.id===e))}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){(e=e||{}).x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var t=new Vi({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach((function(t){if(t.isVisible()){var r=t._toKonvaCanvas(e);n.drawImage(r._canvas,e.x,e.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}})),t}getIntersection(e){if(!e)return null;var t,n=this.children;for(t=n.length-1;t>=0;t--){const r=n[t].getIntersection(e);if(r)return r}return null}_resizeDOM(){var e=this.width(),t=this.height();this.content&&(this.content.style.width=e+"px",this.content.style.height=t+"px"),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach((n=>{n.setSize({width:e,height:t}),n.draw()}))}add(e,...t){if(arguments.length>1){for(var n=0;n<arguments.length;n++)this.add(arguments[n]);return this}super.add(e);var r=this.children.length;return r>5&&yi.warn("The stage has "+r+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),si.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return co(e,this)}setPointerCapture(e){uo(e,this)}releaseCapture(e){ho(e)}getLayers(){return this.children}_bindContentEvents(){si.isBrowser&&To.forEach((([e,t])=>{this.content.addEventListener(e,(e=>{this[t](e)}),{passive:!1})}))}_pointerenter(e){this.setPointersPositions(e);const t=Ro(e.type);this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=Ro(e.type);this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+"targetShape"];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){const t=Ro(e.type),n=No(e.type);if(t){this.setPointersPositions(e);var r=this._getTargetShape(n),i=!Di.isDragging||si.hitOnDragEnabled;r&&i?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):i&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(e){const t=Ro(e.type),n=No(e.type);if(t){this.setPointersPositions(e);var r=!1;this._changedPointerPositions.forEach((i=>{var o=this.getIntersection(i);Di.justDragged=!1,si["_"+n+"ListenClick"]=!0;if(!(o&&o.isListening()))return;si.capturePointerEventsEnabled&&o.setPointerCapture(i.id),this[n+"ClickStartShape"]=o,o._fireAndBubble(t.pointerdown,{evt:e,pointerId:i.id}),r=!0;const a=e.type.indexOf("touch")>=0;o.preventDefault()&&e.cancelable&&a&&e.preventDefault()})),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(e){const t=Ro(e.type),n=No(e.type);if(!t)return;if(Di.isDragging&&Di.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e),!(!Di.isDragging||si.hitOnDragEnabled))return;var r={};let i=!1;var o=this._getTargetShape(n);this._changedPointerPositions.forEach((a=>{const l=lo(a.id)||this.getIntersection(a),s=a.id,c={evt:e,pointerId:s};var u=o!==l;if(u&&o&&(o._fireAndBubble(t.pointerout,Object.assign({},c),l),o._fireAndBubble(t.pointerleave,Object.assign({},c),l)),l){if(r[l._id])return;r[l._id]=!0}l&&l.isListening()?(i=!0,u&&(l._fireAndBubble(t.pointerover,Object.assign({},c),o),l._fireAndBubble(t.pointerenter,Object.assign({},c),o),this[n+"targetShape"]=l),l._fireAndBubble(t.pointermove,Object.assign({},c))):o&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:s}),this[n+"targetShape"]=null)})),i||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=Ro(e.type),n=No(e.type);if(!t)return;this.setPointersPositions(e);const r=this[n+"ClickStartShape"],i=this[n+"ClickEndShape"];var o={};let a=!1;this._changedPointerPositions.forEach((l=>{const s=lo(l.id)||this.getIntersection(l);if(s){if(s.releaseCapture(l.id),o[s._id])return;o[s._id]=!0}const c=l.id,u={evt:e,pointerId:c};let h=!1;si["_"+n+"InDblClickWindow"]?(h=!0,clearTimeout(this[n+"DblTimeout"])):Di.justDragged||(si["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout((function(){si["_"+n+"InDblClickWindow"]=!1}),si.dblClickWindow),s&&s.isListening()?(a=!0,this[n+"ClickEndShape"]=s,s._fireAndBubble(t.pointerup,Object.assign({},u)),si["_"+n+"ListenClick"]&&r&&r===s&&(s._fireAndBubble(t.pointerclick,Object.assign({},u)),h&&i&&i===s&&s._fireAndBubble(t.pointerdblclick,Object.assign({},u)))):(this[n+"ClickEndShape"]=null,si["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:c}),h&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:c}))})),a||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),si["_"+n+"ListenClick"]=!1,e.cancelable&&"touch"!==n&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(Oo,{evt:e}):this._fire(Oo,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(Po,{evt:e}):this._fire(Po,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=lo(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(xo,so(e)),ho(e.pointerId)}_lostpointercapture(e){ho(e.pointerId)}setPointersPositions(e){var t=this._getContentPosition(),n=null,r=null;void 0!==(e=e||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,(e=>{this._pointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})})),Array.prototype.forEach.call(e.changedTouches||e.touches,(e=>{this._changedPointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}))):(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:yi._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:yi._getFirstPointerId(e)}])}_setPointerPosition(e){yi.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Vi({width:this.width(),height:this.height()}),this.bufferHitCanvas=new Ii({pixelRatio:1,width:this.width(),height:this.height()}),si.isBrowser){var e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}}cache(){return yi.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach((function(e){e.batchDraw()})),this}}Io.prototype.nodeType="Stage",ci(Io),ki.addGetterSetter(Io,"container");var Do="hasShadow",Fo="shadowRGBA",Bo="patternImage",Uo="linearGradient",Go="radialGradient";let qo;function Wo(){return qo||(qo=yi.createCanvasElement().getContext("2d"),qo)}const Ko={};class Yo extends no{constructor(e){let t;for(super(e);t=yi.getRandomColor(),!t||t in Ko;);this.colorKey=t,Ko[t]=this}getContext(){return yi.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return yi.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(Do,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Bo,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=Wo().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new ui;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(si.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),r="undefined"==typeof DOMMatrix?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(r)}return e}}_getLinearGradient(){return this._getCache(Uo,this.__getLinearGradient)}__getLinearGradient(){var e=this.fillLinearGradientColorStops();if(e){for(var t=Wo(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),i=t.createLinearGradient(n.x,n.y,r.x,r.y),o=0;o<e.length;o+=2)i.addColorStop(e[o],e[o+1]);return i}}_getRadialGradient(){return this._getCache(Go,this.__getRadialGradient)}__getRadialGradient(){var e=this.fillRadialGradientColorStops();if(e){for(var t=Wo(),n=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),i=t.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius()),o=0;o<e.length;o+=2)i.addColorStop(e[o],e[o+1]);return i}}getShadowRGBA(){return this._getCache(Fo,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var e=yi.colorToRGBA(this.shadowColor());return e?"rgba("+e.r+","+e.g+","+e.b+","+e.a*(this.shadowOpacity()||1)+")":void 0}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],(()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops())))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],(()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops())))}hasHitStroke(){const e=this.hitStrokeWidth();return"auto"===e?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){var t=this.getStage().bufferHitCanvas;return t.getContext().clear(),this.drawHit(t,null,!0),t.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return no.prototype.destroy.call(this),delete Ko[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var t;if(!this.getStage())return!1;if(!(null===(t=this.attrs.perfectDrawEnabled)||void 0===t||t))return!1;const n=e||this.hasFill(),r=this.hasStroke(),i=1!==this.getAbsoluteOpacity();if(n&&r&&i)return!0;const o=this.hasShadow(),a=this.shadowForStrokeEnabled();return!!(n&&r&&o&&a)}setStrokeHitEnabled(e){yi.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){var e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){const t=e.skipTransform,n=e.relativeTo,r=this.getSelfRect(),i=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,o=r.width+i,a=r.height+i,l=!e.skipShadow&&this.hasShadow(),s=l?this.shadowOffsetX():0,c=l?this.shadowOffsetY():0,u=o+Math.abs(s),h=a+Math.abs(c),f=l&&this.shadowBlur()||0,d={width:u+2*f,height:h+2*f,x:-(i/2+f)+Math.min(s,0)+r.x,y:-(i/2+f)+Math.min(c,0)+r.y};return t?d:this._transformedRect(d,n)}drawScene(e,t){var n,r,i=this.getLayer(),o=e||i.getCanvas(),a=o.getContext(),l=this._getCanvasCache(),s=this.getSceneFunc(),c=this.hasShadow(),u=o.isCache,h=t===this;if(!this.isVisible()&&!h)return this;if(l){a.save();var f=this.getAbsoluteTransform(t).getMatrix();return a.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedSceneCanvas(a),a.restore(),this}if(!s)return this;if(a.save(),this._useBufferCanvas()&&!u){(r=(n=this.getStage().bufferCanvas).getContext()).clear(),r.save(),r._applyLineJoin(this);var d=this.getAbsoluteTransform(t).getMatrix();r.transform(d[0],d[1],d[2],d[3],d[4],d[5]),s.call(this,r,this),r.restore();var p=n.pixelRatio;c&&a._applyShadow(this),a._applyOpacity(this),a._applyGlobalCompositeOperation(this),a.drawImage(n._canvas,0,0,n.width/p,n.height/p)}else{if(a._applyLineJoin(this),!h){d=this.getAbsoluteTransform(t).getMatrix();a.transform(d[0],d[1],d[2],d[3],d[4],d[5]),a._applyOpacity(this),a._applyGlobalCompositeOperation(this)}c&&a._applyShadow(this),s.call(this,a,this)}return a.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;var r=this.getLayer(),i=e||r.hitCanvas,o=i&&i.getContext(),a=this.hitFunc()||this.sceneFunc(),l=this._getCanvasCache(),s=l&&l.hit;if(this.colorKey||yi.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),s){o.save();var c=this.getAbsoluteTransform(t).getMatrix();return o.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedHitCanvas(o),o.restore(),this}if(!a)return this;o.save(),o._applyLineJoin(this);if(!(this===t)){var u=this.getAbsoluteTransform(t).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5])}return a.call(this,o,this),o.restore(),this}drawHitFromCache(e=0){var t,n,r,i,o,a=this._getCanvasCache(),l=this._getCachedSceneCanvas(),s=a.hit,c=s.getContext(),u=s.getWidth(),h=s.getHeight();c.clear(),c.drawImage(l._canvas,0,0,u,h);try{for(r=(n=(t=c.getImageData(0,0,u,h)).data).length,i=yi._hexToRgb(this.colorKey),o=0;o<r;o+=4)n[o+3]>e?(n[o]=i.r,n[o+1]=i.g,n[o+2]=i.b,n[o+3]=255):n[o+3]=0;c.putImageData(t,0,0)}catch(e){yi.error("Unable to draw hit graph from cached scene canvas. "+e.message)}return this}hasPointerCapture(e){return co(e,this)}setPointerCapture(e){uo(e,this)}releaseCapture(e){ho(e)}}Yo.prototype._fillFunc=function(e){e.fill()},Yo.prototype._strokeFunc=function(e){e.stroke()},Yo.prototype._fillFuncHit=function(e){e.fill()},Yo.prototype._strokeFuncHit=function(e){e.stroke()},Yo.prototype._centroid=!1,Yo.prototype.nodeType="Shape",ci(Yo),Yo.prototype.eventListeners={},Yo.prototype.on.call(Yo.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(Do)})),Yo.prototype.on.call(Yo.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(Fo)})),Yo.prototype.on.call(Yo.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",(function(){this._clearCache(Bo)})),Yo.prototype.on.call(Yo.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",(function(){this._clearCache(Uo)})),Yo.prototype.on.call(Yo.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",(function(){this._clearCache(Go)})),ki.addGetterSetter(Yo,"stroke",void 0,Si()),ki.addGetterSetter(Yo,"strokeWidth",2,xi()),ki.addGetterSetter(Yo,"fillAfterStrokeEnabled",!1),ki.addGetterSetter(Yo,"hitStrokeWidth","auto",_i()),ki.addGetterSetter(Yo,"strokeHitEnabled",!0,Ci()),ki.addGetterSetter(Yo,"perfectDrawEnabled",!0,Ci()),ki.addGetterSetter(Yo,"shadowForStrokeEnabled",!0,Ci()),ki.addGetterSetter(Yo,"lineJoin"),ki.addGetterSetter(Yo,"lineCap"),ki.addGetterSetter(Yo,"sceneFunc"),ki.addGetterSetter(Yo,"hitFunc"),ki.addGetterSetter(Yo,"dash"),ki.addGetterSetter(Yo,"dashOffset",0,xi()),ki.addGetterSetter(Yo,"shadowColor",void 0,zi()),ki.addGetterSetter(Yo,"shadowBlur",0,xi()),ki.addGetterSetter(Yo,"shadowOpacity",1,xi()),ki.addComponentsGetterSetter(Yo,"shadowOffset",["x","y"]),ki.addGetterSetter(Yo,"shadowOffsetX",0,xi()),ki.addGetterSetter(Yo,"shadowOffsetY",0,xi()),ki.addGetterSetter(Yo,"fillPatternImage"),ki.addGetterSetter(Yo,"fill",void 0,Si()),ki.addGetterSetter(Yo,"fillPatternX",0,xi()),ki.addGetterSetter(Yo,"fillPatternY",0,xi()),ki.addGetterSetter(Yo,"fillLinearGradientColorStops"),ki.addGetterSetter(Yo,"strokeLinearGradientColorStops"),ki.addGetterSetter(Yo,"fillRadialGradientStartRadius",0),ki.addGetterSetter(Yo,"fillRadialGradientEndRadius",0),ki.addGetterSetter(Yo,"fillRadialGradientColorStops"),ki.addGetterSetter(Yo,"fillPatternRepeat","repeat"),ki.addGetterSetter(Yo,"fillEnabled",!0),ki.addGetterSetter(Yo,"strokeEnabled",!0),ki.addGetterSetter(Yo,"shadowEnabled",!0),ki.addGetterSetter(Yo,"dashEnabled",!0),ki.addGetterSetter(Yo,"strokeScaleEnabled",!0),ki.addGetterSetter(Yo,"fillPriority","color"),ki.addComponentsGetterSetter(Yo,"fillPatternOffset",["x","y"]),ki.addGetterSetter(Yo,"fillPatternOffsetX",0,xi()),ki.addGetterSetter(Yo,"fillPatternOffsetY",0,xi()),ki.addComponentsGetterSetter(Yo,"fillPatternScale",["x","y"]),ki.addGetterSetter(Yo,"fillPatternScaleX",1,xi()),ki.addGetterSetter(Yo,"fillPatternScaleY",1,xi()),ki.addComponentsGetterSetter(Yo,"fillLinearGradientStartPoint",["x","y"]),ki.addComponentsGetterSetter(Yo,"strokeLinearGradientStartPoint",["x","y"]),ki.addGetterSetter(Yo,"fillLinearGradientStartPointX",0),ki.addGetterSetter(Yo,"strokeLinearGradientStartPointX",0),ki.addGetterSetter(Yo,"fillLinearGradientStartPointY",0),ki.addGetterSetter(Yo,"strokeLinearGradientStartPointY",0),ki.addComponentsGetterSetter(Yo,"fillLinearGradientEndPoint",["x","y"]),ki.addComponentsGetterSetter(Yo,"strokeLinearGradientEndPoint",["x","y"]),ki.addGetterSetter(Yo,"fillLinearGradientEndPointX",0),ki.addGetterSetter(Yo,"strokeLinearGradientEndPointX",0),ki.addGetterSetter(Yo,"fillLinearGradientEndPointY",0),ki.addGetterSetter(Yo,"strokeLinearGradientEndPointY",0),ki.addComponentsGetterSetter(Yo,"fillRadialGradientStartPoint",["x","y"]),ki.addGetterSetter(Yo,"fillRadialGradientStartPointX",0),ki.addGetterSetter(Yo,"fillRadialGradientStartPointY",0),ki.addComponentsGetterSetter(Yo,"fillRadialGradientEndPoint",["x","y"]),ki.addGetterSetter(Yo,"fillRadialGradientEndPointX",0),ki.addGetterSetter(Yo,"fillRadialGradientEndPointY",0),ki.addGetterSetter(Yo,"fillPatternRotation",0),ki.backCompat(Yo,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var $o=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Xo=$o.length;class Qo extends io{constructor(e){super(e),this.canvas=new Vi,this.hitCanvas=new Ii({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[e+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){no.prototype.moveToTop.call(this);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!no.prototype.moveUp.call(this))return!1;var e=this.getStage();return!(!e||!e.content)&&(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(no.prototype.moveDown.call(this)){var e=this.getStage();if(e){var t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(no.prototype.moveToBottom.call(this)){var e=this.getStage();if(e){var t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var e=this.getNativeCanvasElement();return no.prototype.remove.call(this),e&&e.parentNode&&yi._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:t}){return this.canvas.setSize(e,t),this.hitCanvas.setSize(e,t),this._setSmoothEnabled(),this}_validateAdd(e){var t=e.getType();"Group"!==t&&"Shape"!==t&&yi.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return(e=e||{}).width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=void 0!==e.x?e.x:this.x(),e.y=void 0!==e.y?e.y:this.y(),no.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){const e=this.visible();this.canvas._canvas.style.display=e?"block":"none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){yi.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){yi.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,yi.requestAnimFrame((()=>{this.draw(),this._waitingForDraw=!1}))),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var t=1,n=!1;;){for(let r=0;r<Xo;r++){const i=$o[r],o=this._getIntersection({x:e.x+i.x*t,y:e.y+i.y*t}),a=o.shape;if(a)return a;if(n=!!o.antialiased,!o.antialiased)break}if(!n)return null;t+=1}}_getIntersection(e){const t=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(e.x*t),Math.round(e.y*t),1,1).data,r=n[3];if(255===r){const e=yi._rgbToHex(n[0],n[1],n[2]),t=Ko["#"+e];return t?{shape:t}:{antialiased:!0}}return r>0?{antialiased:!0}:{}}drawScene(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),io.prototype.drawScene.call(this,r,t),this._fire("draw",{node:this}),this}drawHit(e,t){var n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),io.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){yi.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return yi.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(this.parent&&this.parent.content){var e=this.parent;!!this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}}Qo.prototype.nodeType="Layer",ci(Qo),ki.addGetterSetter(Qo,"imageSmoothingEnabled",!0),ki.addGetterSetter(Qo,"clearBeforeDraw",!0),ki.addGetterSetter(Qo,"hitGraphEnabled",!0,Ci());class Zo extends Qo{constructor(e){super(e),this.listening(!1),yi.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Zo.prototype.nodeType="FastLayer",ci(Zo);class Jo extends io{_validateAdd(e){var t=e.getType();"Group"!==t&&"Shape"!==t&&yi.throw("You may only add groups and shapes to groups.")}}Jo.prototype.nodeType="Group",ci(Jo);var ea=li.performance&&li.performance.now?function(){return li.performance.now()}:function(){return(new Date).getTime()};class ta{constructor(e,t){this.id=ta.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:ea(),frameRate:0},this.func=e,this.setLayers(t)}setLayers(e){var t=[];return t=e?e.length>0?e:[e]:[],this.layers=t,this}getLayers(){return this.layers}addLayer(e){var t,n=this.layers,r=n.length;for(t=0;t<r;t++)if(n[t]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){var e,t=ta.animations,n=t.length;for(e=0;e<n;e++)if(t[e].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=ea(),ta._addAnimation(this),this}stop(){return ta._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){var t,n=e.id,r=this.animations,i=r.length;for(t=0;t<i;t++)if(r[t].id===n){this.animations.splice(t,1);break}}static _runFrames(){var e,t,n,r,i,o,a,l,s={},c=this.animations;for(r=0;r<c.length;r++)if(t=(e=c[r]).layers,n=e.func,e._updateFrameObject(ea()),o=t.length,!n||!1!==n.call(e,e.frame))for(i=0;i<o;i++)void 0!==(a=t[i])._id&&(s[a._id]=a);for(l in s)s.hasOwnProperty(l)&&s[l].batchDraw()}static _animationLoop(){var e=ta;e.animations.length?(e._runFrames(),yi.requestAnimFrame(e._animationLoop)):e.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,yi.requestAnimFrame(this._animationLoop))}}ta.animations=[],ta.animIdCounter=0,ta.animRunning=!1;var na={node:1,duration:1,easing:1,onFinish:1,yoyo:1},ra=0,ia=["fill","stroke","shadowColor"];class oa{constructor(e,t,n,r,i,o,a){this.prop=e,this.propFunc=t,this.begin=r,this._pos=r,this.duration=o,this._change=0,this.prevPos=0,this.yoyo=a,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=i-this.begin,this.pause()}fire(e){var t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return void 0===e&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var e=this.getTimer()-this._startTime;2===this.state?this.setTime(e):3===this.state&&this.setTime(this.duration-e)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class aa{constructor(e){var t,n,r=this,i=e.node,o=i._id,a=e.easing||la.Linear,l=!!e.yoyo;t=void 0===e.duration?.3:0===e.duration?.001:e.duration,this.node=i,this._id=ra++;var s=i.getLayer()||(i instanceof si.Stage?i.getLayers():null);for(n in s||yi.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new ta((function(){r.tween.onEnterFrame()}),s),this.tween=new oa(n,(function(e){r._tweenFunc(e)}),a,0,1,1e3*t,l),this._addListeners(),aa.attrs[o]||(aa.attrs[o]={}),aa.attrs[o][this._id]||(aa.attrs[o][this._id]={}),aa.tweens[o]||(aa.tweens[o]={}),e)void 0===na[n]&&this._addAttr(n,e[n]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,t){var n,r,i,o,a,l,s,c,u=this.node,h=u._id;if((i=aa.tweens[h][e])&&delete aa.attrs[h][i][e],n=u.getAttr(e),yi._isArray(t))if(r=[],a=Math.max(t.length,n.length),"points"===e&&t.length!==n.length&&(t.length>n.length?(s=n,n=yi._prepareArrayForTween(n,t,u.closed())):(l=t,t=yi._prepareArrayForTween(t,n,u.closed()))),0===e.indexOf("fill"))for(o=0;o<a;o++)if(o%2==0)r.push(t[o]-n[o]);else{var f=yi.colorToRGBA(n[o]);c=yi.colorToRGBA(t[o]),n[o]=f,r.push({r:c.r-f.r,g:c.g-f.g,b:c.b-f.b,a:c.a-f.a})}else for(o=0;o<a;o++)r.push(t[o]-n[o]);else-1!==ia.indexOf(e)?(n=yi.colorToRGBA(n),r={r:(c=yi.colorToRGBA(t)).r-n.r,g:c.g-n.g,b:c.b-n.b,a:c.a-n.a}):r=t-n;aa.attrs[h][this._id][e]={start:n,diff:r,end:t,trueEnd:l,trueStart:s},aa.tweens[h][e]=this._id}_tweenFunc(e){var t,n,r,i,o,a,l,s,c=this.node,u=aa.attrs[c._id][this._id];for(t in u){if(r=(n=u[t]).start,i=n.diff,s=n.end,yi._isArray(r))if(o=[],l=Math.max(r.length,s.length),0===t.indexOf("fill"))for(a=0;a<l;a++)a%2==0?o.push((r[a]||0)+i[a]*e):o.push("rgba("+Math.round(r[a].r+i[a].r*e)+","+Math.round(r[a].g+i[a].g*e)+","+Math.round(r[a].b+i[a].b*e)+","+(r[a].a+i[a].a*e)+")");else for(a=0;a<l;a++)o.push((r[a]||0)+i[a]*e);else o=-1!==ia.indexOf(t)?"rgba("+Math.round(r.r+i.r*e)+","+Math.round(r.g+i.g*e)+","+Math.round(r.b+i.b*e)+","+(r.a+i.a*e)+")":r+i*e;c.setAttr(t,o)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var e=this.node,t=aa.attrs[e._id][this._id];t.points&&t.points.trueEnd&&e.setAttr("points",t.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var e=this.node,t=aa.attrs[e._id][this._id];t.points&&t.points.trueStart&&e.points(t.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(1e3*e),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e,t=this.node._id,n=this._id,r=aa.tweens[t];for(e in this.pause(),r)delete aa.tweens[t][e];delete aa.attrs[t][n]}}aa.attrs={},aa.tweens={},no.prototype.to=function(e){var t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new aa(e).play()};const la={BackEaseIn(e,t,n,r){var i=1.70158;return n*(e/=r)*e*((i+1)*e-i)+t},BackEaseOut(e,t,n,r){var i=1.70158;return n*((e=e/r-1)*e*((i+1)*e+i)+1)+t},BackEaseInOut(e,t,n,r){var i=1.70158;return(e/=r/2)<1?n/2*(e*e*((1+(i*=1.525))*e-i))+t:n/2*((e-=2)*e*((1+(i*=1.525))*e+i)+2)+t},ElasticEaseIn(e,t,n,r,i,o){var a=0;return 0===e?t:1==(e/=r)?t+n:(o||(o=.3*r),!i||i<Math.abs(n)?(i=n,a=o/4):a=o/(2*Math.PI)*Math.asin(n/i),-i*Math.pow(2,10*(e-=1))*Math.sin((e*r-a)*(2*Math.PI)/o)+t)},ElasticEaseOut(e,t,n,r,i,o){var a=0;return 0===e?t:1==(e/=r)?t+n:(o||(o=.3*r),!i||i<Math.abs(n)?(i=n,a=o/4):a=o/(2*Math.PI)*Math.asin(n/i),i*Math.pow(2,-10*e)*Math.sin((e*r-a)*(2*Math.PI)/o)+n+t)},ElasticEaseInOut(e,t,n,r,i,o){var a=0;return 0===e?t:2==(e/=r/2)?t+n:(o||(o=r*(.3*1.5)),!i||i<Math.abs(n)?(i=n,a=o/4):a=o/(2*Math.PI)*Math.asin(n/i),e<1?i*Math.pow(2,10*(e-=1))*Math.sin((e*r-a)*(2*Math.PI)/o)*-.5+t:i*Math.pow(2,-10*(e-=1))*Math.sin((e*r-a)*(2*Math.PI)/o)*.5+n+t)},BounceEaseOut:(e,t,n,r)=>(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t,BounceEaseIn:(e,t,n,r)=>n-la.BounceEaseOut(r-e,0,n,r)+t,BounceEaseInOut:(e,t,n,r)=>e<r/2?.5*la.BounceEaseIn(2*e,0,n,r)+t:.5*la.BounceEaseOut(2*e-r,0,n,r)+.5*n+t,EaseIn:(e,t,n,r)=>n*(e/=r)*e+t,EaseOut:(e,t,n,r)=>-n*(e/=r)*(e-2)+t,EaseInOut:(e,t,n,r)=>(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t,StrongEaseIn:(e,t,n,r)=>n*(e/=r)*e*e*e*e+t,StrongEaseOut:(e,t,n,r)=>n*((e=e/r-1)*e*e*e*e+1)+t,StrongEaseInOut:(e,t,n,r)=>(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t,Linear:(e,t,n,r)=>n*e/r+t},sa=yi._assign(si,{Util:yi,Transform:ui,Node:no,Container:io,Stage:Io,stages:Vo,Layer:Qo,FastLayer:Zo,Group:Jo,DD:Di,Shape:Yo,shapes:Ko,Animation:ta,Tween:aa,Easings:la,Context:Ti,Canvas:ji});class ca extends Yo{_sceneFunc(e){var t=si.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=si.getAngle(n?360-this.angle():this.angle()),i=Math.cos(Math.min(r,Math.PI)),o=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),a=Math.sin(Math.min(r,Math.PI/2)),l=i*(i>0?e:t),s=o*(o>0?e:t),c=a*(a>0?t:e);return{x:l,y:n?-1*c:s,width:1*t-l,height:c-s}}}function ua(e,t,n,r,i,o,a){var l=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),s=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),c=a*l/(l+s),u=a*s/(l+s);return[n-c*(i-e),r-c*(o-t),n+u*(i-e),r+u*(o-t)]}function ha(e,t){var n,r,i=e.length,o=[];for(n=2;n<i-2;n+=2)r=ua(e[n-2],e[n-1],e[n],e[n+1],e[n+2],e[n+3],t),isNaN(r[0])||(o.push(r[0]),o.push(r[1]),o.push(e[n]),o.push(e[n+1]),o.push(r[2]),o.push(r[3]));return o}ca.prototype._centroid=!0,ca.prototype.className="Arc",ca.prototype._attrsAffectingSize=["innerRadius","outerRadius"],ci(ca),ki.addGetterSetter(ca,"innerRadius",0,xi()),ki.addGetterSetter(ca,"outerRadius",0,xi()),ki.addGetterSetter(ca,"angle",0,xi()),ki.addGetterSetter(ca,"clockwise",!1,Ci());class fa extends Yo{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",(function(){this._clearCache("tensionPoints")}))}_sceneFunc(e){var t,n,r,i=this.points(),o=i.length,a=this.tension(),l=this.closed(),s=this.bezier();if(o){if(e.beginPath(),e.moveTo(i[0],i[1]),0!==a&&o>4){for(n=(t=this.getTensionPoints()).length,r=l?0:4,l||e.quadraticCurveTo(t[0],t[1],t[2],t[3]);r<n-2;)e.bezierCurveTo(t[r++],t[r++],t[r++],t[r++],t[r++],t[r++]);l||e.quadraticCurveTo(t[n-2],t[n-1],i[o-2],i[o-1])}else if(s)for(r=2;r<o;)e.bezierCurveTo(i[r++],i[r++],i[r++],i[r++],i[r++],i[r++]);else for(r=2;r<o;r+=2)e.lineTo(i[r],i[r+1]);l?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():ha(this.points(),this.tension())}_getTensionPointsClosed(){var e=this.points(),t=e.length,n=this.tension(),r=ua(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),i=ua(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),o=ha(e,n);return[r[2],r[3]].concat(o).concat([i[0],i[1],e[t-2],e[t-1],i[2],i[3],r[0],r[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};for(var t,n,r=(e=0!==this.tension()?[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:this.points())[0],i=e[0],o=e[1],a=e[1],l=0;l<e.length/2;l++)t=e[2*l],n=e[2*l+1],r=Math.min(r,t),i=Math.max(i,t),o=Math.min(o,n),a=Math.max(a,n);return{x:r,y:o,width:i-r,height:a-o}}}fa.prototype.className="Line",fa.prototype._attrsAffectingSize=["points","bezier","tension"],ci(fa),ki.addGetterSetter(fa,"closed",!1),ki.addGetterSetter(fa,"bezier",!1),ki.addGetterSetter(fa,"tension",0,xi()),ki.addGetterSetter(fa,"points",[],function(){if(si.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(yi._isArray(e)?e.forEach((function(e){yi._isNumber(e)||yi.warn('"'+t+'" attribute has non numeric element '+e+". Make sure that all elements are numbers.")})):yi.warn(bi(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}());class da extends Yo{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this.dataArray=da.parsePathData(this.data()),this.pathLength=0;for(var t=0;t<this.dataArray.length;++t)this.pathLength+=this.dataArray[t].pathLength;this.on("dataChange.konva",(function(){this.dataArray=da.parsePathData(this.data()),this.pathLength=0;for(var e=0;e<this.dataArray.length;++e)this.pathLength+=this.dataArray[e].pathLength}))}_sceneFunc(e){var t=this.dataArray;e.beginPath();for(var n=!1,r=0;r<t.length;r++){var i=t[r].command,o=t[r].points;switch(i){case"L":e.lineTo(o[0],o[1]);break;case"M":e.moveTo(o[0],o[1]);break;case"C":e.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"Q":e.quadraticCurveTo(o[0],o[1],o[2],o[3]);break;case"A":var a=o[0],l=o[1],s=o[2],c=o[3],u=o[4],h=o[5],f=o[6],d=o[7],p=s>c?s:c,v=s>c?1:s/c,m=s>c?c/s:1;e.translate(a,l),e.rotate(f),e.scale(v,m),e.arc(0,0,p,u,u+h,1-d),e.scale(1/v,1/m),e.rotate(-f),e.translate(-a,-l);break;case"z":n=!0,e.closePath()}}n||this.hasFill()?e.fillStrokeShape(this):e.strokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach((function(t){if("A"===t.command){var n=t.points[4],r=t.points[5],i=t.points[4]+r,o=Math.PI/180;if(Math.abs(n-i)<o&&(o=Math.abs(n-i)),r<0)for(let r=n-o;r>i;r-=o){const n=da.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],r,0);e.push(n.x,n.y)}else for(let r=n+o;r<i;r+=o){const n=da.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],r,0);e.push(n.x,n.y)}}else if("C"===t.command)for(let n=0;n<=1;n+=.01){const r=da.getPointOnCubicBezier(n,t.start.x,t.start.y,t.points[0],t.points[1],t.points[2],t.points[3],t.points[4],t.points[5]);e.push(r.x,r.y)}else e=e.concat(t.points)}));for(var t,n,r=e[0],i=e[0],o=e[1],a=e[1],l=0;l<e.length/2;l++)t=e[2*l],n=e[2*l+1],isNaN(t)||(r=Math.min(r,t),i=Math.max(i,t)),isNaN(n)||(o=Math.min(o,n),a=Math.max(a,n));return{x:r,y:o,width:i-r,height:a-o}}getLength(){return this.pathLength}getPointAtLength(e){var t,n=0,r=this.dataArray.length;if(!r)return null;for(;n<r&&e>this.dataArray[n].pathLength;)e-=this.dataArray[n].pathLength,++n;if(n===r)return{x:(t=this.dataArray[n-1].points.slice(-2))[0],y:t[1]};if(e<.01)return{x:(t=this.dataArray[n].points.slice(0,2))[0],y:t[1]};var i=this.dataArray[n],o=i.points;switch(i.command){case"L":return da.getPointOnLine(e,i.start.x,i.start.y,o[0],o[1]);case"C":return da.getPointOnCubicBezier(e/i.pathLength,i.start.x,i.start.y,o[0],o[1],o[2],o[3],o[4],o[5]);case"Q":return da.getPointOnQuadraticBezier(e/i.pathLength,i.start.x,i.start.y,o[0],o[1],o[2],o[3]);case"A":var a=o[0],l=o[1],s=o[2],c=o[3],u=o[4],h=o[5],f=o[6];return u+=h*e/i.pathLength,da.getPointOnEllipticalArc(a,l,s,c,u,f)}return null}static getLineLength(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}static getPointOnLine(e,t,n,r,i,o,a){void 0===o&&(o=t),void 0===a&&(a=n);var l=(i-n)/(r-t+1e-8),s=Math.sqrt(e*e/(1+l*l));r<t&&(s*=-1);var c,u=l*s;if(r===t)c={x:o,y:a+u};else if((a-n)/(o-t+1e-8)===l)c={x:o+s,y:a+u};else{var h,f,d=this.getLineLength(t,n,r,i),p=(o-t)*(r-t)+(a-n)*(i-n);h=t+(p/=d*d)*(r-t),f=n+p*(i-n);var v=this.getLineLength(o,a,h,f),m=Math.sqrt(e*e-v*v);s=Math.sqrt(m*m/(1+l*l)),r<t&&(s*=-1),c={x:h+s,y:f+(u=l*s)}}return c}static getPointOnCubicBezier(e,t,n,r,i,o,a,l,s){function c(e){return e*e*e}function u(e){return 3*e*e*(1-e)}function h(e){return 3*e*(1-e)*(1-e)}function f(e){return(1-e)*(1-e)*(1-e)}return{x:l*c(e)+o*u(e)+r*h(e)+t*f(e),y:s*c(e)+a*u(e)+i*h(e)+n*f(e)}}static getPointOnQuadraticBezier(e,t,n,r,i,o,a){function l(e){return e*e}function s(e){return 2*e*(1-e)}function c(e){return(1-e)*(1-e)}return{x:o*l(e)+r*s(e)+t*c(e),y:a*l(e)+i*s(e)+n*c(e)}}static getPointOnEllipticalArc(e,t,n,r,i,o){var a=Math.cos(o),l=Math.sin(o),s=n*Math.cos(i),c=r*Math.sin(i);return{x:e+(s*a-c*l),y:t+(s*l+c*a)}}static parsePathData(e){if(!e)return[];var t=e,n=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];t=t.replace(new RegExp(" ","g"),",");for(var r=0;r<n.length;r++)t=t.replace(new RegExp(n[r],"g"),"|"+n[r]);var i,o=t.split("|"),a=[],l=[],s=0,c=0,u=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;for(r=1;r<o.length;r++){var h=o[r],f=h.charAt(0);for(h=h.slice(1),l.length=0;i=u.exec(h);)l.push(i[0]);for(var d=[],p=0,v=l.length;p<v;p++)if("00"!==l[p]){var m=parseFloat(l[p]);isNaN(m)?d.push(0):d.push(m)}else d.push(0,0);for(;d.length>0&&!isNaN(d[0]);){var g,y,b,w,x,E,_,z,S,C,O=null,M=[],A=s,k=c;switch(f){case"l":s+=d.shift(),c+=d.shift(),O="L",M.push(s,c);break;case"L":s=d.shift(),c=d.shift(),M.push(s,c);break;case"m":var L=d.shift(),P=d.shift();if(s+=L,c+=P,O="M",a.length>2&&"z"===a[a.length-1].command)for(var T=a.length-2;T>=0;T--)if("M"===a[T].command){s=a[T].points[0]+L,c=a[T].points[1]+P;break}M.push(s,c),f="l";break;case"M":s=d.shift(),c=d.shift(),O="M",M.push(s,c),f="L";break;case"h":s+=d.shift(),O="L",M.push(s,c);break;case"H":s=d.shift(),O="L",M.push(s,c);break;case"v":c+=d.shift(),O="L",M.push(s,c);break;case"V":c=d.shift(),O="L",M.push(s,c);break;case"C":M.push(d.shift(),d.shift(),d.shift(),d.shift()),s=d.shift(),c=d.shift(),M.push(s,c);break;case"c":M.push(s+d.shift(),c+d.shift(),s+d.shift(),c+d.shift()),s+=d.shift(),c+=d.shift(),O="C",M.push(s,c);break;case"S":y=s,b=c,"C"===(g=a[a.length-1]).command&&(y=s+(s-g.points[2]),b=c+(c-g.points[3])),M.push(y,b,d.shift(),d.shift()),s=d.shift(),c=d.shift(),O="C",M.push(s,c);break;case"s":y=s,b=c,"C"===(g=a[a.length-1]).command&&(y=s+(s-g.points[2]),b=c+(c-g.points[3])),M.push(y,b,s+d.shift(),c+d.shift()),s+=d.shift(),c+=d.shift(),O="C",M.push(s,c);break;case"Q":M.push(d.shift(),d.shift()),s=d.shift(),c=d.shift(),M.push(s,c);break;case"q":M.push(s+d.shift(),c+d.shift()),s+=d.shift(),c+=d.shift(),O="Q",M.push(s,c);break;case"T":y=s,b=c,"Q"===(g=a[a.length-1]).command&&(y=s+(s-g.points[0]),b=c+(c-g.points[1])),s=d.shift(),c=d.shift(),O="Q",M.push(y,b,s,c);break;case"t":y=s,b=c,"Q"===(g=a[a.length-1]).command&&(y=s+(s-g.points[0]),b=c+(c-g.points[1])),s+=d.shift(),c+=d.shift(),O="Q",M.push(y,b,s,c);break;case"A":w=d.shift(),x=d.shift(),E=d.shift(),_=d.shift(),z=d.shift(),S=s,C=c,s=d.shift(),c=d.shift(),O="A",M=this.convertEndpointToCenterParameterization(S,C,s,c,_,z,w,x,E);break;case"a":w=d.shift(),x=d.shift(),E=d.shift(),_=d.shift(),z=d.shift(),S=s,C=c,s+=d.shift(),c+=d.shift(),O="A",M=this.convertEndpointToCenterParameterization(S,C,s,c,_,z,w,x,E)}a.push({command:O||f,points:M,start:{x:A,y:k},pathLength:this.calcLength(A,k,O||f,M)})}"z"!==f&&"Z"!==f||a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(e,t,n,r){var i,o,a,l,s=da;switch(n){case"L":return s.getLineLength(e,t,r[0],r[1]);case"C":for(i=0,o=s.getPointOnCubicBezier(0,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),l=.01;l<=1;l+=.01)a=s.getPointOnCubicBezier(l,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),i+=s.getLineLength(o.x,o.y,a.x,a.y),o=a;return i;case"Q":for(i=0,o=s.getPointOnQuadraticBezier(0,e,t,r[0],r[1],r[2],r[3]),l=.01;l<=1;l+=.01)a=s.getPointOnQuadraticBezier(l,e,t,r[0],r[1],r[2],r[3]),i+=s.getLineLength(o.x,o.y,a.x,a.y),o=a;return i;case"A":i=0;var c=r[4],u=r[5],h=r[4]+u,f=Math.PI/180;if(Math.abs(c-h)<f&&(f=Math.abs(c-h)),o=s.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],c,0),u<0)for(l=c-f;l>h;l-=f)a=s.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],l,0),i+=s.getLineLength(o.x,o.y,a.x,a.y),o=a;else for(l=c+f;l<h;l+=f)a=s.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],l,0),i+=s.getLineLength(o.x,o.y,a.x,a.y),o=a;return a=s.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],h,0),i+=s.getLineLength(o.x,o.y,a.x,a.y)}return 0}static convertEndpointToCenterParameterization(e,t,n,r,i,o,a,l,s){var c=s*(Math.PI/180),u=Math.cos(c)*(e-n)/2+Math.sin(c)*(t-r)/2,h=-1*Math.sin(c)*(e-n)/2+Math.cos(c)*(t-r)/2,f=u*u/(a*a)+h*h/(l*l);f>1&&(a*=Math.sqrt(f),l*=Math.sqrt(f));var d=Math.sqrt((a*a*(l*l)-a*a*(h*h)-l*l*(u*u))/(a*a*(h*h)+l*l*(u*u)));i===o&&(d*=-1),isNaN(d)&&(d=0);var p=d*a*h/l,v=d*-l*u/a,m=(e+n)/2+Math.cos(c)*p-Math.sin(c)*v,g=(t+r)/2+Math.sin(c)*p+Math.cos(c)*v,y=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},b=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(y(e)*y(t))},w=function(e,t){return(e[0]*t[1]<e[1]*t[0]?-1:1)*Math.acos(b(e,t))},x=w([1,0],[(u-p)/a,(h-v)/l]),E=[(u-p)/a,(h-v)/l],_=[(-1*u-p)/a,(-1*h-v)/l],z=w(E,_);return b(E,_)<=-1&&(z=Math.PI),b(E,_)>=1&&(z=0),0===o&&z>0&&(z-=2*Math.PI),1===o&&z<0&&(z+=2*Math.PI),[m,g,a,l,x,z,c,o]}}da.prototype.className="Path",da.prototype._attrsAffectingSize=["data"],ci(da),ki.addGetterSetter(da,"data");class pa extends fa{_sceneFunc(e){super._sceneFunc(e);var t=2*Math.PI,n=this.points(),r=n,i=0!==this.tension()&&n.length>4;i&&(r=this.getTensionPoints());var o,a,l=this.pointerLength(),s=n.length;if(i){const e=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[s-2],n[s-1]],t=da.calcLength(r[r.length-4],r[r.length-3],"C",e),i=da.getPointOnQuadraticBezier(Math.min(1,1-l/t),e[0],e[1],e[2],e[3],e[4],e[5]);o=n[s-2]-i.x,a=n[s-1]-i.y}else o=n[s-2]-n[s-4],a=n[s-1]-n[s-3];var c=(Math.atan2(a,o)+t)%t,u=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[s-2],n[s-1]),e.rotate(c),e.moveTo(0,0),e.lineTo(-l,u/2),e.lineTo(-l,-u/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),i?(o=(r[0]+r[2])/2-n[0],a=(r[1]+r[3])/2-n[1]):(o=n[2]-n[0],a=n[3]-n[1]),e.rotate((Math.atan2(-a,-o)+t)%t),e.moveTo(0,0),e.lineTo(-l,u/2),e.lineTo(-l,-u/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}}pa.prototype.className="Arrow",ci(pa),ki.addGetterSetter(pa,"pointerLength",10,xi()),ki.addGetterSetter(pa,"pointerWidth",10,xi()),ki.addGetterSetter(pa,"pointerAtBeginning",!1),ki.addGetterSetter(pa,"pointerAtEnding",!0);class va extends Yo{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,2*Math.PI,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}va.prototype._centroid=!0,va.prototype.className="Circle",va.prototype._attrsAffectingSize=["radius"],ci(va),ki.addGetterSetter(va,"radius",0,xi());class ma extends Yo{_sceneFunc(e){var t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,2*Math.PI,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radiusX()}getHeight(){return 2*this.radiusY()}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}ma.prototype.className="Ellipse",ma.prototype._centroid=!0,ma.prototype._attrsAffectingSize=["radiusX","radiusY"],ci(ma),ki.addComponentsGetterSetter(ma,"radius",["x","y"]),ki.addGetterSetter(ma,"radiusX",0,xi()),ki.addGetterSetter(ma,"radiusY",0,xi());class ga extends Yo{constructor(e){super(e),this.on("imageChange.konva",(()=>{this._setImageLoad()})),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&4===e.readyState||e&&e.addEventListener&&e.addEventListener("load",(()=>{this._requestDraw()}))}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const t=this.getWidth(),n=this.getHeight(),r=this.attrs.image;let i;if(r){const e=this.attrs.cropWidth,o=this.attrs.cropHeight;i=e&&o?[r,this.cropX(),this.cropY(),e,o,0,0,t,n]:[r,0,0,t,n]}(this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)),r&&e.drawImage.apply(e,i)}_hitFunc(e){var t=this.width(),n=this.height();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,t;return null!==(e=this.attrs.width)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.width}getHeight(){var e,t;return null!==(e=this.attrs.height)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.height}static fromURL(e,t,n=null){var r=yi.createImageElement();r.onload=function(){var e=new ga({image:r});t(e)},r.onerror=n,r.crossOrigin="Anonymous",r.src=e}}ga.prototype.className="Image",ci(ga),ki.addGetterSetter(ga,"image"),ki.addComponentsGetterSetter(ga,"crop",["x","y","width","height"]),ki.addGetterSetter(ga,"cropX",0,xi()),ki.addGetterSetter(ga,"cropY",0,xi()),ki.addGetterSetter(ga,"cropWidth",0,xi()),ki.addGetterSetter(ga,"cropHeight",0,xi());var ya=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],ba="up",wa="right",xa="down",Ea="left",_a=ya.length;class za extends Jo{constructor(e){super(e),this.on("add.konva",(function(e){this._addListeners(e.child),this._sync()}))}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){var t,n=this,r=function(){n._sync()};for(t=0;t<_a;t++)e.on(ya[t]+"Change.konva",r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var e,t,n,r,i,o,a,l=this.getText(),s=this.getTag();if(l&&s){switch(e=l.width(),t=l.height(),n=s.pointerDirection(),r=s.pointerWidth(),a=s.pointerHeight(),i=0,o=0,n){case ba:i=e/2,o=-1*a;break;case wa:i=e+r,o=t/2;break;case xa:i=e/2,o=t+a;break;case Ea:i=-1*r,o=t/2}s.setAttrs({x:-1*i,y:-1*o,width:e,height:t}),l.setAttrs({x:-1*i,y:-1*o})}}}za.prototype.className="Label",ci(za);class Sa extends Yo{_sceneFunc(e){var t=this.width(),n=this.height(),r=this.pointerDirection(),i=this.pointerWidth(),o=this.pointerHeight(),a=this.cornerRadius();let l=0,s=0,c=0,u=0;"number"==typeof a?l=s=c=u=Math.min(a,t/2,n/2):(l=Math.min(a[0]||0,t/2,n/2),s=Math.min(a[1]||0,t/2,n/2),u=Math.min(a[2]||0,t/2,n/2),c=Math.min(a[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(l,0),r===ba&&(e.lineTo((t-i)/2,0),e.lineTo(t/2,-1*o),e.lineTo((t+i)/2,0)),e.lineTo(t-s,0),e.arc(t-s,s,s,3*Math.PI/2,0,!1),r===wa&&(e.lineTo(t,(n-o)/2),e.lineTo(t+i,n/2),e.lineTo(t,(n+o)/2)),e.lineTo(t,n-u),e.arc(t-u,n-u,u,0,Math.PI/2,!1),r===xa&&(e.lineTo((t+i)/2,n),e.lineTo(t/2,n+o),e.lineTo((t-i)/2,n)),e.lineTo(c,n),e.arc(c,n-c,c,Math.PI/2,Math.PI,!1),r===Ea&&(e.lineTo(0,(n+o)/2),e.lineTo(-1*i,n/2),e.lineTo(0,(n-o)/2)),e.lineTo(0,l),e.arc(l,l,l,Math.PI,3*Math.PI/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){var e=0,t=0,n=this.pointerWidth(),r=this.pointerHeight(),i=this.pointerDirection(),o=this.width(),a=this.height();return i===ba?(t-=r,a+=r):i===xa?a+=r:i===Ea?(e-=1.5*n,o+=n):i===wa&&(o+=1.5*n),{x:e,y:t,width:o,height:a}}}Sa.prototype.className="Tag",ci(Sa),ki.addGetterSetter(Sa,"pointerDirection","none"),ki.addGetterSetter(Sa,"pointerWidth",0,xi()),ki.addGetterSetter(Sa,"pointerHeight",0,xi()),ki.addGetterSetter(Sa,"cornerRadius",0,Ei(4));class Ca extends Yo{_sceneFunc(e){var t=this.cornerRadius(),n=this.width(),r=this.height();if(e.beginPath(),t){let i=0,o=0,a=0,l=0;"number"==typeof t?i=o=a=l=Math.min(t,n/2,r/2):(i=Math.min(t[0]||0,n/2,r/2),o=Math.min(t[1]||0,n/2,r/2),l=Math.min(t[2]||0,n/2,r/2),a=Math.min(t[3]||0,n/2,r/2)),e.moveTo(i,0),e.lineTo(n-o,0),e.arc(n-o,o,o,3*Math.PI/2,0,!1),e.lineTo(n,r-l),e.arc(n-l,r-l,l,0,Math.PI/2,!1),e.lineTo(a,r),e.arc(a,r-a,a,Math.PI/2,Math.PI,!1),e.lineTo(0,i),e.arc(i,i,i,Math.PI,3*Math.PI/2,!1)}else e.rect(0,0,n,r);e.closePath(),e.fillStrokeShape(this)}}Ca.prototype.className="Rect",ci(Ca),ki.addGetterSetter(Ca,"cornerRadius",0,Ei(4));class Oa extends Yo{_sceneFunc(e){const t=this._getPoints();e.beginPath(),e.moveTo(t[0].x,t[0].y);for(var n=1;n<t.length;n++)e.lineTo(t[n].x,t[n].y);e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,t=this.attrs.radius||0,n=[];for(var r=0;r<e;r++)n.push({x:t*Math.sin(2*r*Math.PI/e),y:-1*t*Math.cos(2*r*Math.PI/e)});return n}getSelfRect(){const e=this._getPoints();var t=e[0].x,n=e[0].y,r=e[0].x,i=e[0].y;return e.forEach((e=>{t=Math.min(t,e.x),n=Math.max(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.y)})),{x:t,y:r,width:n-t,height:i-r}}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Oa.prototype.className="RegularPolygon",Oa.prototype._centroid=!0,Oa.prototype._attrsAffectingSize=["radius"],ci(Oa),ki.addGetterSetter(Oa,"radius",0,xi()),ki.addGetterSetter(Oa,"sides",0,xi());var Ma=2*Math.PI;class Aa extends Yo{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,Ma,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),Ma,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Aa.prototype.className="Ring",Aa.prototype._centroid=!0,Aa.prototype._attrsAffectingSize=["innerRadius","outerRadius"],ci(Aa),ki.addGetterSetter(Aa,"innerRadius",0,xi()),ki.addGetterSetter(Aa,"outerRadius",0,xi());class ka extends Yo{constructor(e){super(e),this._updated=!0,this.anim=new ta((()=>{var e=this._updated;return this._updated=!1,e})),this.on("animationChange.konva",(function(){this.frameIndex(0)})),this.on("frameIndexChange.konva",(function(){this._updated=!0})),this.on("frameRateChange.konva",(function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())}))}_sceneFunc(e){var t=this.animation(),n=this.frameIndex(),r=4*n,i=this.animations()[t],o=this.frameOffsets(),a=i[r+0],l=i[r+1],s=i[r+2],c=i[r+3],u=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,s,c),e.closePath(),e.fillStrokeShape(this)),u)if(o){var h=o[t],f=2*n;e.drawImage(u,a,l,s,c,h[f+0],h[f+1],s,c)}else e.drawImage(u,a,l,s,c,0,0,s,c)}_hitFunc(e){var t=this.animation(),n=this.frameIndex(),r=4*n,i=this.animations()[t],o=this.frameOffsets(),a=i[r+2],l=i[r+3];if(e.beginPath(),o){var s=o[t],c=2*n;e.rect(s[c+0],s[c+1],a,l)}else e.rect(0,0,a,l);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval((function(){e._updateIndex()}),1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}}ka.prototype.className="Sprite",ci(ka),ki.addGetterSetter(ka,"animation"),ki.addGetterSetter(ka,"animations"),ki.addGetterSetter(ka,"frameOffsets"),ki.addGetterSetter(ka,"image"),ki.addGetterSetter(ka,"frameIndex",0,xi()),ki.addGetterSetter(ka,"frameRate",17,xi()),ki.backCompat(ka,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class La extends Yo{_sceneFunc(e){var t=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(var i=1;i<2*r;i++){var o=i%2==0?n:t,a=o*Math.sin(i*Math.PI/r),l=-1*o*Math.cos(i*Math.PI/r);e.lineTo(a,l)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}function Pa(e){return Array.from(e)}La.prototype.className="Star",La.prototype._centroid=!0,La.prototype._attrsAffectingSize=["innerRadius","outerRadius"],ci(La),ki.addGetterSetter(La,"numPoints",5,xi()),ki.addGetterSetter(La,"innerRadius",0,xi()),ki.addGetterSetter(La,"outerRadius",0,xi());var Ta,Ha="auto",Na="justify",Ra="left",ja="middle",Va="normal",Ia=" ",Da="none",Fa=["fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],Ba=Fa.length;function Ua(){return Ta||(Ta=yi.createCanvasElement().getContext("2d"))}class Ga extends Yo{constructor(e){super(function(e){return(e=e||{}).fillLinearGradientColorStops||e.fillRadialGradientColorStops||e.fillPatternImage||(e.fill=e.fill||"black"),e}(e)),this._partialTextX=0,this._partialTextY=0;for(var t=0;t<Ba;t++)this.on(Fa[t]+"Change.konva",this._setTextData);this._setTextData()}_sceneFunc(e){var t=this.textArr,n=t.length;if(this.text()){var r,i=this.padding(),o=this.fontSize(),a=this.lineHeight()*o,l=this.verticalAlign(),s=0,c=this.align(),u=this.getWidth(),h=this.letterSpacing(),f=this.fill(),d=this.textDecoration(),p=-1!==d.indexOf("underline"),v=-1!==d.indexOf("line-through"),m=0,g=(m=a/2,0),y=0;for(e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",ja),e.setAttr("textAlign",Ra),l===ja?s=(this.getHeight()-n*a-2*i)/2:"bottom"===l&&(s=this.getHeight()-n*a-2*i),e.translate(i,s+i),r=0;r<n;r++){g=0,y=0;var b,w,x,E=t[r],_=E.text,z=E.width,S=E.lastInParagraph;if(e.save(),"right"===c?g+=u-z-2*i:"center"===c&&(g+=(u-z-2*i)/2),p&&(e.save(),e.beginPath(),e.moveTo(g,m+y+Math.round(o/2)),w=0===(b=_.split(" ").length-1),x=c===Na&&S&&!w?u-2*i:z,e.lineTo(g+Math.round(x),m+y+Math.round(o/2)),e.lineWidth=o/15,e.strokeStyle=f,e.stroke(),e.restore()),v&&(e.save(),e.beginPath(),e.moveTo(g,m+y),w=0===(b=_.split(" ").length-1),x=c===Na&&S&&!w?u-2*i:z,e.lineTo(g+Math.round(x),m+y),e.lineWidth=o/15,e.strokeStyle=f,e.stroke(),e.restore()),0!==h||c===Na){b=_.split(" ").length-1;for(var C=Pa(_),O=0;O<C.length;O++){var M=C[O];" "!==M||S||c!==Na||(g+=(u-2*i-z)/b),this._partialTextX=g,this._partialTextY=m+y,this._partialText=M,e.fillStrokeShape(this),g+=this.measureSize(M).width+h}}else this._partialTextX=g,this._partialTextY=m+y,this._partialText=_,e.fillStrokeShape(this);e.restore(),n>1&&(m+=a)}}}_hitFunc(e){var t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){var t=yi._isString(e)?e:null==e?"":e+"";return this._setAttr("text",t),this}getWidth(){return this.attrs.width===Ha||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===Ha||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return yi.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n=Ua(),r=this.fontSize();return n.save(),n.font=this._getContextFont(),t=n.measureText(e),n.restore(),{width:t.width,height:r}}_getContextFont(){return this.fontStyle()+Ia+this.fontVariant()+Ia+(this.fontSize()+"px ")+this.fontFamily().split(",").map((e=>{const t=(e=e.trim()).indexOf(" ")>=0,n=e.indexOf('"')>=0||e.indexOf("'")>=0;return t&&!n&&(e=`"${e}"`),e})).join(", ")}_addTextLine(e){this.align()===Na&&(e=e.trim());var t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){var t=this.letterSpacing(),n=e.length;return Ua().measureText(e).width+(n?t*(n-1):0)}_setTextData(){var e=this.text().split("\n"),t=+this.fontSize(),n=0,r=this.lineHeight()*t,i=this.attrs.width,o=this.attrs.height,a=i!==Ha&&void 0!==i,l=o!==Ha&&void 0!==o,s=this.padding(),c=i-2*s,u=o-2*s,h=0,f=this.wrap(),d="char"!==f&&f!==Da,p=this.ellipsis();this.textArr=[],Ua().font=this._getContextFont();for(var v=p?this._getTextWidth("…"):0,m=0,g=e.length;m<g;++m){var y=e[m],b=this._getTextWidth(y);if(a&&b>c)for(;y.length>0;){for(var w=0,x=y.length,E="",_=0;w<x;){var z=w+x>>>1,S=y.slice(0,z+1),C=this._getTextWidth(S)+v;C<=c?(w=z+1,E=S,_=C):x=z}if(!E)break;if(d){var O,M=y[E.length];(O=(M===Ia||"-"===M)&&_<=c?E.length:Math.max(E.lastIndexOf(Ia),E.lastIndexOf("-"))+1)>0&&(w=O,E=E.slice(0,w),_=this._getTextWidth(E))}if(E=E.trimRight(),this._addTextLine(E),n=Math.max(n,_),h+=r,this._shouldHandleEllipsis(h)){this._tryToAddEllipsisToLastLine();break}if((y=(y=y.slice(w)).trimLeft()).length>0&&(b=this._getTextWidth(y))<=c){this._addTextLine(y),h+=r,n=Math.max(n,b);break}}else this._addTextLine(y),h+=r,n=Math.max(n,b),this._shouldHandleEllipsis(h)&&m<g-1&&this._tryToAddEllipsisToLastLine();if(l&&h+r>u)break;this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0)}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){var t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,i=r!==Ha&&void 0!==r,o=r-2*this.padding();return!(this.wrap()!==Da)||i&&e+n>o}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,t=e!==Ha&&void 0!==e,n=e-2*this.padding(),r=this.ellipsis(),i=this.textArr[this.textArr.length-1];if(i&&r){if(t)this._getTextWidth(i.text+"…")<n||(i.text=i.text.slice(0,i.text.length-3));this.textArr.splice(this.textArr.length-1,1),this._addTextLine(i.text+"…")}}getStrokeScaleEnabled(){return!0}}Ga.prototype._fillFunc=function(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)},Ga.prototype._strokeFunc=function(e){e.strokeText(this._partialText,this._partialTextX,this._partialTextY)},Ga.prototype.className="Text",Ga.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],ci(Ga),ki.overWriteSetter(Ga,"width",_i()),ki.overWriteSetter(Ga,"height",_i()),ki.addGetterSetter(Ga,"fontFamily","Arial"),ki.addGetterSetter(Ga,"fontSize",12,xi()),ki.addGetterSetter(Ga,"fontStyle",Va),ki.addGetterSetter(Ga,"fontVariant",Va),ki.addGetterSetter(Ga,"padding",0,xi()),ki.addGetterSetter(Ga,"align",Ra),ki.addGetterSetter(Ga,"verticalAlign","top"),ki.addGetterSetter(Ga,"lineHeight",1,xi()),ki.addGetterSetter(Ga,"wrap","word"),ki.addGetterSetter(Ga,"ellipsis",!1,Ci()),ki.addGetterSetter(Ga,"letterSpacing",0,xi()),ki.addGetterSetter(Ga,"text","",zi()),ki.addGetterSetter(Ga,"textDecoration","");var qa="normal";function Wa(e){e.fillText(this.partialText,0,0)}function Ka(e){e.strokeText(this.partialText,0,0)}class Ya extends Yo{constructor(e){super(e),this.dummyCanvas=yi.createCanvasElement(),this.dataArray=[],this.dataArray=da.parsePathData(this.attrs.data),this.on("dataChange.konva",(function(){this.dataArray=da.parsePathData(this.attrs.data),this._setTextData()})),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();var t=this.textDecoration(),n=this.fill(),r=this.fontSize(),i=this.glyphInfo;"underline"===t&&e.beginPath();for(var o=0;o<i.length;o++){e.save();var a=i[o].p0;e.translate(a.x,a.y),e.rotate(i[o].rotation),this.partialText=i[o].text,e.fillStrokeShape(this),"underline"===t&&(0===o&&e.moveTo(0,r/2+1),e.lineTo(r,r/2+1)),e.restore()}"underline"===t&&(e.strokeStyle=n,e.lineWidth=r/20,e.stroke()),e.restore()}_hitFunc(e){e.beginPath();var t=this.glyphInfo;if(t.length>=1){var n=t[0].p0;e.moveTo(n.x,n.y)}for(var r=0;r<t.length;r++){var i=t[r].p1;e.lineTo(i.x,i.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return yi.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return Ga.prototype.setText.call(this,e)}_getContextFont(){return Ga.prototype._getContextFont.call(this)}_getTextSize(e){var t=this.dummyCanvas.getContext("2d");t.save(),t.font=this._getContextFont();var n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(this.attrs.fontSize,10)}}_setTextData(){var e=this,t=this._getTextSize(this.attrs.text),n=this.letterSpacing(),r=this.align(),i=this.kerningFunc();this.textWidth=t.width,this.textHeight=t.height;var o=Math.max(this.textWidth+((this.attrs.text||"").length-1)*n,0);this.glyphInfo=[];for(var a=0,l=0;l<e.dataArray.length;l++)e.dataArray[l].pathLength>0&&(a+=e.dataArray[l].pathLength);var s=0;"center"===r&&(s=Math.max(0,a/2-o/2)),"right"===r&&(s=Math.max(0,a-o));for(var c,u,h,f=Pa(this.text()),d=this.text().split(" ").length-1,p=-1,v=0,m=function(){v=0;for(var t=e.dataArray,n=p+1;n<t.length;n++){if(t[n].pathLength>0)return p=n,t[n];"M"===t[n].command&&(c={x:t[n].points[0],y:t[n].points[1]})}return{}},g=function(t){var i=e._getTextSize(t).width+n;" "===t&&"justify"===r&&(i+=(a-o)/d);var l=0,s=0;for(u=void 0;Math.abs(i-l)/i>.01&&s<20;){s++;for(var f=l;void 0===h;)(h=m())&&f+h.pathLength<i&&(f+=h.pathLength,h=void 0);if(0===Object.keys(h).length||void 0===c)return;var p=!1;switch(h.command){case"L":da.getLineLength(c.x,c.y,h.points[0],h.points[1])>i?u=da.getPointOnLine(i,c.x,c.y,h.points[0],h.points[1],c.x,c.y):h=void 0;break;case"A":var g=h.points[4],y=h.points[5],b=h.points[4]+y;0===v?v=g+1e-8:i>l?v+=Math.PI/180*y/Math.abs(y):v-=Math.PI/360*y/Math.abs(y),(y<0&&v<b||y>=0&&v>b)&&(v=b,p=!0),u=da.getPointOnEllipticalArc(h.points[0],h.points[1],h.points[2],h.points[3],v,h.points[6]);break;case"C":0===v?v=i>h.pathLength?1e-8:i/h.pathLength:i>l?v+=(i-l)/h.pathLength/2:v=Math.max(v-(l-i)/h.pathLength/2,0),v>1&&(v=1,p=!0),u=da.getPointOnCubicBezier(v,h.start.x,h.start.y,h.points[0],h.points[1],h.points[2],h.points[3],h.points[4],h.points[5]);break;case"Q":0===v?v=i/h.pathLength:i>l?v+=(i-l)/h.pathLength:v-=(l-i)/h.pathLength,v>1&&(v=1,p=!0),u=da.getPointOnQuadraticBezier(v,h.start.x,h.start.y,h.points[0],h.points[1],h.points[2],h.points[3])}void 0!==u&&(l=da.getLineLength(c.x,c.y,u.x,u.y)),p&&(p=!1,h=void 0)}},y=s/(e._getTextSize("C").width+n)-1,b=0;b<y&&(g("C"),void 0!==c&&void 0!==u);b++)c=u;for(var w=0;w<f.length&&(g(f[w]),void 0!==c&&void 0!==u);w++){var x=da.getLineLength(c.x,c.y,u.x,u.y),E=0;if(i)try{E=i(f[w-1],f[w])*this.fontSize()}catch(e){E=0}c.x+=E,u.x+=E,this.textWidth+=E;var _=da.getPointOnLine(E+x/2,c.x,c.y,u.x,u.y),z=Math.atan2(u.y-c.y,u.x-c.x);this.glyphInfo.push({transposeX:_.x,transposeY:_.y,text:f[w],rotation:z,p0:c,p1:u}),c=u}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var e=[];this.glyphInfo.forEach((function(t){e.push(t.p0.x),e.push(t.p0.y),e.push(t.p1.x),e.push(t.p1.y)}));for(var t,n,r=e[0]||0,i=e[0]||0,o=e[1]||0,a=e[1]||0,l=0;l<e.length/2;l++)t=e[2*l],n=e[2*l+1],r=Math.min(r,t),i=Math.max(i,t),o=Math.min(o,n),a=Math.max(a,n);var s=this.fontSize();return{x:r-s/2,y:o-s/2,width:i-r+s,height:a-o+s}}}Ya.prototype._fillFunc=Wa,Ya.prototype._strokeFunc=Ka,Ya.prototype._fillFuncHit=Wa,Ya.prototype._strokeFuncHit=Ka,Ya.prototype.className="TextPath",Ya.prototype._attrsAffectingSize=["text","fontSize","data"],ci(Ya),ki.addGetterSetter(Ya,"data"),ki.addGetterSetter(Ya,"fontFamily","Arial"),ki.addGetterSetter(Ya,"fontSize",12,xi()),ki.addGetterSetter(Ya,"fontStyle",qa),ki.addGetterSetter(Ya,"align","left"),ki.addGetterSetter(Ya,"letterSpacing",0,xi()),ki.addGetterSetter(Ya,"textBaseline","middle"),ki.addGetterSetter(Ya,"fontVariant",qa),ki.addGetterSetter(Ya,"text",""),ki.addGetterSetter(Ya,"textDecoration",null),ki.addGetterSetter(Ya,"kerningFunc",null);var $a="tr-konva",Xa=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange"].map((e=>e+".tr-konva")).join(" "),Qa="nodesRect",Za=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],Ja={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const el="ontouchstart"in si._global;var tl=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function nl(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:i})}function rl(e,t){const n=function(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}(e);return nl(e,t,n)}class il extends Jo{constructor(e){super(e),this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(Xa,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return yi.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return $a+this._id}setNodes(e=[]){return this._nodes&&this._nodes.length&&this.detach(),this._nodes=e,1===e.length&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach((e=>{const t=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()},n=e._attrsAffectingSize.map((e=>e+"Change."+this._getEventNamespace())).join(" ");e.on(n,t),e.on(Za.map((e=>e+`.${this._getEventNamespace()}`)).join(" "),t),e.on(`absoluteTransformChange.${this._getEventNamespace()}`,t),this._proxyDrag(e)})),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,(n=>{t=e.getAbsolutePosition(),this.isDragging()||e===this.findOne(".back")||this.startDrag(n,!1)})),e.on(`dragmove.${this._getEventNamespace()}`,(n=>{if(!t)return;const r=e.getAbsolutePosition(),i=r.x-t.x,o=r.y-t.y;this.nodes().forEach((t=>{if(t===e)return;if(t.isDragging())return;const r=t.getAbsolutePosition();t.setAbsolutePosition({x:r.x+i,y:r.y+o}),t.startDrag(n)})),t=null}))}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach((e=>{e.off("."+this._getEventNamespace())})),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(Qa),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(Qa,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){var r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),i=e.getAbsoluteScale(n),o=e.getAbsolutePosition(n),a=r.x*i.x-e.offsetX()*i.x,l=r.y*i.y-e.offsetY()*i.y;const s=(si.getAngle(e.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return nl({x:o.x+a*Math.cos(s)+l*Math.sin(-s),y:o.y+l*Math.cos(s)+a*Math.sin(s),width:r.width*i.x,height:r.height*i.y,rotation:s},-si.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const e=[];this.nodes().map((t=>{const n=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var r=[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x+n.width,y:n.y+n.height},{x:n.x,y:n.y+n.height}],i=t.getAbsoluteTransform();r.forEach((function(t){var n=i.point(t);e.push(n)}))}));const t=new ui;var n,r,i,o;t.rotate(-si.getAngle(this.rotation())),e.forEach((function(e){var a=t.point(e);void 0===n&&(n=i=a.x,r=o=a.y),n=Math.min(n,a.x),r=Math.min(r,a.y),i=Math.max(i,a.x),o=Math.max(o,a.y)})),t.invert();const a=t.point({x:n,y:r});return{x:a.x,y:a.y,width:i-n,height:o-r,rotation:si.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),tl.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var t=new Ca({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:el?10:"auto"}),n=this;t.on("mousedown touchstart",(function(e){n._handleMouseDown(e)})),t.on("dragstart",(e=>{t.stopDrag(),e.cancelBubble=!0})),t.on("dragend",(e=>{e.cancelBubble=!0})),t.on("mouseenter",(()=>{var n=si.getAngle(this.rotation()),r=function(e,t){if("rotater"===e)return"crosshair";t+=yi.degToRad(Ja[e]||0);var n=(yi.radToDeg(t)%360+360)%360;return yi._inRange(n,337.5,360)||yi._inRange(n,0,22.5)?"ns-resize":yi._inRange(n,22.5,67.5)?"nesw-resize":yi._inRange(n,67.5,112.5)?"ew-resize":yi._inRange(n,112.5,157.5)?"nwse-resize":yi._inRange(n,157.5,202.5)?"ns-resize":yi._inRange(n,202.5,247.5)?"nesw-resize":yi._inRange(n,247.5,292.5)?"ew-resize":yi._inRange(n,292.5,337.5)?"nwse-resize":(yi.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}(e,n);t.getStage().content&&(t.getStage().content.style.cursor=r),this._cursorChange=!0})),t.on("mouseout",(()=>{t.getStage().content&&(t.getStage().content.style.cursor=""),this._cursorChange=!1})),this.add(t)}_createBack(){var e=new Yo({name:"back",width:0,height:0,draggable:!0,sceneFunc(e){var t=this.getParent(),n=t.padding();e.beginPath(),e.rect(-n,-n,this.width()+2*n,this.height()+2*n),e.moveTo(this.width()/2,-n),t.rotateEnabled()&&e.lineTo(this.width()/2,-t.rotateAnchorOffset()*yi._sign(this.height())-n),e.fillStrokeShape(this)},hitFunc:(e,t)=>{if(this.shouldOverdrawWholeArea()){var n=this.padding();e.beginPath(),e.rect(-n,-n,t.width()+2*n,t.height()+2*n),e.fillStrokeShape(t)}}});this.add(e),this._proxyDrag(e),e.on("dragstart",(e=>{e.cancelBubble=!0})),e.on("dragmove",(e=>{e.cancelBubble=!0})),e.on("dragend",(e=>{e.cancelBubble=!0})),this.on("dragmove",(e=>{this.update()}))}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var t=this._getNodeRect(),n=t.width,r=t.height,i=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/i),this.cos=Math.abs(n/i),"undefined"!=typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var o=e.target.getAbsolutePosition(),a=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-o.x,y:a.y-o.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach((t=>{t._fire("transformstart",{evt:e.evt,target:t})}))}_handleMouseMove(e){var t,n,r,i=this.findOne("."+this._movingAnchorName),o=i.getStage();o.setPointersPositions(e);const a=o.getPointerPosition();let l={x:a.x-this._anchorDragOffset.x,y:a.y-this._anchorDragOffset.y};const s=i.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(s,l,e)),i.setAbsolutePosition(l);const c=i.getAbsolutePosition();if(s.x!==c.x||s.y!==c.y)if("rotater"!==this._movingAnchorName){var u=this.keepRatio()||e.shiftKey,h=this.centeredScaling()||e.altKey;if("top-left"===this._movingAnchorName){if(u){var f=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(f.x-i.x(),2)+Math.pow(f.y-i.y(),2));var d=this.findOne(".top-left").x()>f.x?-1:1,p=this.findOne(".top-left").y()>f.y?-1:1;t=r*this.cos*d,n=r*this.sin*p,this.findOne(".top-left").x(f.x-t),this.findOne(".top-left").y(f.y-n)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(i.y());else if("top-right"===this._movingAnchorName){if(u){f=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(i.x()-f.x,2)+Math.pow(f.y-i.y(),2));d=this.findOne(".top-right").x()<f.x?-1:1,p=this.findOne(".top-right").y()>f.y?-1:1;t=r*this.cos*d,n=r*this.sin*p,this.findOne(".top-right").x(f.x+t),this.findOne(".top-right").y(f.y-n)}var v=i.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else if("middle-left"===this._movingAnchorName)this.findOne(".top-left").x(i.x());else if("middle-right"===this._movingAnchorName)this.findOne(".bottom-right").x(i.x());else if("bottom-left"===this._movingAnchorName){if(u){f=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(f.x-i.x(),2)+Math.pow(i.y()-f.y,2));d=f.x<i.x()?-1:1,p=i.y()<f.y?-1:1;t=r*this.cos*d,n=r*this.sin*p,i.x(f.x-t),i.y(f.y+n)}v=i.position(),this.findOne(".top-left").x(v.x),this.findOne(".bottom-right").y(v.y)}else if("bottom-center"===this._movingAnchorName)this.findOne(".bottom-right").y(i.y());else if("bottom-right"===this._movingAnchorName){if(u){f=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};r=Math.sqrt(Math.pow(i.x()-f.x,2)+Math.pow(i.y()-f.y,2));d=this.findOne(".bottom-right").x()<f.x?-1:1,p=this.findOne(".bottom-right").y()<f.y?-1:1;t=r*this.cos*d,n=r*this.sin*p,this.findOne(".bottom-right").x(f.x+t),this.findOne(".bottom-right").y(f.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(h=this.centeredScaling()||e.altKey){var m=this.findOne(".top-left"),g=this.findOne(".bottom-right"),y=m.x(),b=m.y(),w=this.getWidth()-g.x(),x=this.getHeight()-g.y();g.move({x:-y,y:-b}),m.move({x:w,y:x})}var E=this.findOne(".top-left").getAbsolutePosition();t=E.x,n=E.y;var _=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),z=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:t,y:n,width:_,height:z,rotation:si.getAngle(this.rotation())},e)}else{var S=this._getNodeRect();t=i.x()-S.width/2,n=-i.y()+S.height/2;let r=Math.atan2(-n,t)+Math.PI/2;S.height<0&&(r-=Math.PI);const o=si.getAngle(this.rotation())+r,a=si.getAngle(this.rotationSnapTolerance()),l=function(e,t,n){let r=t;for(let i=0;i<e.length;i++){const o=si.getAngle(e[i]),a=Math.abs(o-t)%(2*Math.PI);Math.min(a,2*Math.PI-a)<n&&(r=o)}return r}(this.rotationSnaps(),o,a),s=rl(S,l-S.rotation);this._fitNodesInto(s,e)}}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){if(this._transforming){this._transforming=!1,"undefined"!=typeof window&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var t=this.getNode();this._fire("transformend",{evt:e,target:t}),t&&this._nodes.forEach((t=>{t._fire("transformend",{evt:e,target:t})})),this._movingAnchorName=null}}_fitNodesInto(e,t){var n=this._getNodeRect();if(yi._inRange(e.width,2*-this.padding()-1,1))return void this.update();if(yi._inRange(e.height,2*-this.padding()-1,1))return void this.update();const r=this.flipEnabled();var i=new ui;if(i.rotate(si.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const t=i.point({x:2*-this.padding(),y:0});if(e.x+=t.x,e.y+=t.y,e.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,!r)return void this.update()}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const t=i.point({x:2*this.padding(),y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.width+=2*this.padding(),!r)return void this.update()}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const t=i.point({x:0,y:2*-this.padding()});if(e.x+=t.x,e.y+=t.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!r)return void this.update()}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const t=i.point({x:0,y:2*this.padding()});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!r)return void this.update()}if(this.boundBoxFunc()){const t=this.boundBoxFunc()(n,e);t?e=t:yi.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const o=1e7,a=new ui;a.translate(n.x,n.y),a.rotate(n.rotation),a.scale(n.width/o,n.height/o);const l=new ui;l.translate(e.x,e.y),l.rotate(e.rotation),l.scale(e.width/o,e.height/o);const s=l.multiply(a.invert());this._nodes.forEach((e=>{var n;const r=e.getParent().getAbsoluteTransform(),i=e.getTransform().copy();i.translate(e.offsetX(),e.offsetY());const o=new ui;o.multiply(r.copy().invert()).multiply(s).multiply(r).multiply(i);const a=o.decompose();e.setAttrs(a),this._fire("transform",{evt:t,target:e}),e._fire("transform",{evt:t,target:e}),null===(n=e.getLayer())||void 0===n||n.batchDraw()})),this.rotation(yi._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e,t=this._getNodeRect();this.rotation(yi._getRotation(t.rotation));var n=t.width,r=t.height,i=this.enabledAnchors(),o=this.resizeEnabled(),a=this.padding(),l=this.anchorSize();this.find("._anchor").forEach((e=>{e.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})})),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+a,offsetY:l/2+a,visible:o&&i.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:l/2+a,visible:o&&i.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:l/2-a,offsetY:l/2+a,visible:o&&i.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:l/2+a,visible:o&&i.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:r/2,offsetX:l/2-a,visible:o&&i.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:l/2+a,offsetY:l/2-a,visible:o&&i.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:r,offsetY:l/2-a,visible:o&&i.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:l/2-a,offsetY:l/2-a,visible:o&&i.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:n/2,y:-this.rotateAnchorOffset()*yi._sign(r)-a,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0}),null===(e=this.getLayer())||void 0===e||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Jo.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return no.prototype.toObject.call(this)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}il.prototype.className="Transformer",ci(il),ki.addGetterSetter(il,"enabledAnchors",tl,(function(e){return e instanceof Array||yi.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach((function(e){-1===tl.indexOf(e)&&yi.warn("Unknown anchor name: "+e+". Available names are: "+tl.join(", "))})),e||[]})),ki.addGetterSetter(il,"flipEnabled",!0,Ci()),ki.addGetterSetter(il,"resizeEnabled",!0),ki.addGetterSetter(il,"anchorSize",10,xi()),ki.addGetterSetter(il,"rotateEnabled",!0),ki.addGetterSetter(il,"rotationSnaps",[]),ki.addGetterSetter(il,"rotateAnchorOffset",50,xi()),ki.addGetterSetter(il,"rotationSnapTolerance",5,xi()),ki.addGetterSetter(il,"borderEnabled",!0),ki.addGetterSetter(il,"anchorStroke","rgb(0, 161, 255)"),ki.addGetterSetter(il,"anchorStrokeWidth",1,xi()),ki.addGetterSetter(il,"anchorFill","white"),ki.addGetterSetter(il,"anchorCornerRadius",0,xi()),ki.addGetterSetter(il,"borderStroke","rgb(0, 161, 255)"),ki.addGetterSetter(il,"borderStrokeWidth",1,xi()),ki.addGetterSetter(il,"borderDash"),ki.addGetterSetter(il,"keepRatio",!0),ki.addGetterSetter(il,"centeredScaling",!1),ki.addGetterSetter(il,"ignoreStroke",!1),ki.addGetterSetter(il,"padding",0,xi()),ki.addGetterSetter(il,"node"),ki.addGetterSetter(il,"nodes"),ki.addGetterSetter(il,"boundBoxFunc"),ki.addGetterSetter(il,"anchorDragBoundFunc"),ki.addGetterSetter(il,"shouldOverdrawWholeArea",!1),ki.addGetterSetter(il,"useSingleNodeRotation",!0),ki.backCompat(il,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class ol extends Yo{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,si.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}function al(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}ol.prototype.className="Wedge",ol.prototype._centroid=!0,ol.prototype._attrsAffectingSize=["radius"],ci(ol),ki.addGetterSetter(ol,"radius",0,xi()),ki.addGetterSetter(ol,"angle",0,xi()),ki.addGetterSetter(ol,"clockwise",!1),ki.backCompat(ol,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var ll=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],sl=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];ki.addGetterSetter(no,"blurRadius",0,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"brightness",0,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"contrast",0,xi(),ki.afterSetFilter);function cl(e,t,n,r,i){var o=n-t,a=i-r;return 0===o?r+a/2:0===a?r:a*((e-t)/o)+r}ki.addGetterSetter(no,"embossStrength",.5,xi(),ki.afterSetFilter),ki.addGetterSetter(no,"embossWhiteLevel",.5,xi(),ki.afterSetFilter),ki.addGetterSetter(no,"embossDirection","top-left",null,ki.afterSetFilter),ki.addGetterSetter(no,"embossBlend",!1,null,ki.afterSetFilter);ki.addGetterSetter(no,"enhance",0,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"hue",0,xi(),ki.afterSetFilter),ki.addGetterSetter(no,"saturation",0,xi(),ki.afterSetFilter),ki.addGetterSetter(no,"luminance",0,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"hue",0,xi(),ki.afterSetFilter),ki.addGetterSetter(no,"saturation",0,xi(),ki.afterSetFilter),ki.addGetterSetter(no,"value",0,xi(),ki.afterSetFilter);function ul(e,t,n){var r=4*(n*e.width+t),i=[];return i.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),i}function hl(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}ki.addGetterSetter(no,"kaleidoscopePower",2,xi(),ki.afterSetFilter),ki.addGetterSetter(no,"kaleidoscopeAngle",0,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"threshold",0,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"noise",.2,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"pixelSize",8,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"levels",.5,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"red",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),ki.addGetterSetter(no,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),ki.addGetterSetter(no,"blue",0,wi,ki.afterSetFilter);ki.addGetterSetter(no,"red",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),ki.addGetterSetter(no,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),ki.addGetterSetter(no,"blue",0,wi,ki.afterSetFilter),ki.addGetterSetter(no,"alpha",1,(function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e}));ki.addGetterSetter(no,"threshold",.5,xi(),ki.afterSetFilter);const fl=sa.Util._assign(sa,{Arc:ca,Arrow:pa,Circle:va,Ellipse:ma,Image:ga,Label:za,Tag:Sa,Line:fa,Path:da,Rect:Ca,RegularPolygon:Oa,Ring:Aa,Sprite:ka,Star:La,Text:Ga,TextPath:Ya,Transformer:il,Wedge:ol,Filters:{Blur:function(e){var t=Math.round(this.blurRadius());t>0&&function(e,t){var n,r,i,o,a,l,s,c,u,h,f,d,p,v,m,g,y,b,w,x,E,_,z,S,C=e.data,O=e.width,M=e.height,A=t+t+1,k=O-1,L=M-1,P=t+1,T=P*(P+1)/2,H=new al,N=null,R=H,j=null,V=null,I=ll[t],D=sl[t];for(i=1;i<A;i++)R=R.next=new al,i===P&&(N=R);for(R.next=H,s=l=0,r=0;r<M;r++){for(g=y=b=w=c=u=h=f=0,d=P*(x=C[l]),p=P*(E=C[l+1]),v=P*(_=C[l+2]),m=P*(z=C[l+3]),c+=T*x,u+=T*E,h+=T*_,f+=T*z,R=H,i=0;i<P;i++)R.r=x,R.g=E,R.b=_,R.a=z,R=R.next;for(i=1;i<P;i++)o=l+((k<i?k:i)<<2),c+=(R.r=x=C[o])*(S=P-i),u+=(R.g=E=C[o+1])*S,h+=(R.b=_=C[o+2])*S,f+=(R.a=z=C[o+3])*S,g+=x,y+=E,b+=_,w+=z,R=R.next;for(j=H,V=N,n=0;n<O;n++)C[l+3]=z=f*I>>D,0!==z?(z=255/z,C[l]=(c*I>>D)*z,C[l+1]=(u*I>>D)*z,C[l+2]=(h*I>>D)*z):C[l]=C[l+1]=C[l+2]=0,c-=d,u-=p,h-=v,f-=m,d-=j.r,p-=j.g,v-=j.b,m-=j.a,o=s+((o=n+t+1)<k?o:k)<<2,c+=g+=j.r=C[o],u+=y+=j.g=C[o+1],h+=b+=j.b=C[o+2],f+=w+=j.a=C[o+3],j=j.next,d+=x=V.r,p+=E=V.g,v+=_=V.b,m+=z=V.a,g-=x,y-=E,b-=_,w-=z,V=V.next,l+=4;s+=O}for(n=0;n<O;n++){for(y=b=w=g=u=h=f=c=0,d=P*(x=C[l=n<<2]),p=P*(E=C[l+1]),v=P*(_=C[l+2]),m=P*(z=C[l+3]),c+=T*x,u+=T*E,h+=T*_,f+=T*z,R=H,i=0;i<P;i++)R.r=x,R.g=E,R.b=_,R.a=z,R=R.next;for(a=O,i=1;i<=t;i++)l=a+n<<2,c+=(R.r=x=C[l])*(S=P-i),u+=(R.g=E=C[l+1])*S,h+=(R.b=_=C[l+2])*S,f+=(R.a=z=C[l+3])*S,g+=x,y+=E,b+=_,w+=z,R=R.next,i<L&&(a+=O);for(l=n,j=H,V=N,r=0;r<M;r++)C[3+(o=l<<2)]=z=f*I>>D,z>0?(z=255/z,C[o]=(c*I>>D)*z,C[o+1]=(u*I>>D)*z,C[o+2]=(h*I>>D)*z):C[o]=C[o+1]=C[o+2]=0,c-=d,u-=p,h-=v,f-=m,d-=j.r,p-=j.g,v-=j.b,m-=j.a,o=n+((o=r+P)<L?o:L)*O<<2,c+=g+=j.r=C[o],u+=y+=j.g=C[o+1],h+=b+=j.b=C[o+2],f+=w+=j.a=C[o+3],j=j.next,d+=x=V.r,p+=E=V.g,v+=_=V.b,m+=z=V.a,g-=x,y-=E,b-=_,w-=z,V=V.next,l+=O}}(e,t)},Brighten:function(e){var t,n=255*this.brightness(),r=e.data,i=r.length;for(t=0;t<i;t+=4)r[t]+=n,r[t+1]+=n,r[t+2]+=n},Contrast:function(e){var t,n=Math.pow((this.contrast()+100)/100,2),r=e.data,i=r.length,o=150,a=150,l=150;for(t=0;t<i;t+=4)o=r[t],a=r[t+1],l=r[t+2],o/=255,o-=.5,o*=n,o+=.5,a/=255,a-=.5,a*=n,a+=.5,l/=255,l-=.5,l*=n,l+=.5,o=(o*=255)<0?0:o>255?255:o,a=(a*=255)<0?0:a>255?255:a,l=(l*=255)<0?0:l>255?255:l,r[t]=o,r[t+1]=a,r[t+2]=l},Emboss:function(e){var t=10*this.embossStrength(),n=255*this.embossWhiteLevel(),r=this.embossDirection(),i=this.embossBlend(),o=0,a=0,l=e.data,s=e.width,c=e.height,u=4*s,h=c;switch(r){case"top-left":o=-1,a=-1;break;case"top":o=-1,a=0;break;case"top-right":o=-1,a=1;break;case"right":o=0,a=1;break;case"bottom-right":o=1,a=1;break;case"bottom":o=1,a=0;break;case"bottom-left":o=1,a=-1;break;case"left":o=0,a=-1;break;default:yi.error("Unknown emboss direction: "+r)}do{var f=(h-1)*u,d=o;h+d<1&&(d=0),h+d>c&&(d=0);var p=(h-1+d)*s*4,v=s;do{var m=f+4*(v-1),g=a;v+g<1&&(g=0),v+g>s&&(g=0);var y=p+4*(v-1+g),b=l[m]-l[y],w=l[m+1]-l[y+1],x=l[m+2]-l[y+2],E=b,_=E>0?E:-E;if((w>0?w:-w)>_&&(E=w),(x>0?x:-x)>_&&(E=x),E*=t,i){var z=l[m]+E,S=l[m+1]+E,C=l[m+2]+E;l[m]=z>255?255:z<0?0:z,l[m+1]=S>255?255:S<0?0:S,l[m+2]=C>255?255:C<0?0:C}else{var O=n-E;O<0?O=0:O>255&&(O=255),l[m]=l[m+1]=l[m+2]=O}}while(--v)}while(--h)},Enhance:function(e){var t,n,r,i,o=e.data,a=o.length,l=o[0],s=l,c=o[1],u=c,h=o[2],f=h,d=this.enhance();if(0!==d){for(i=0;i<a;i+=4)(t=o[i+0])<l?l=t:t>s&&(s=t),(n=o[i+1])<c?c=n:n>u&&(u=n),(r=o[i+2])<h?h=r:r>f&&(f=r);var p,v,m,g,y,b,w,x,E;for(s===l&&(s=255,l=0),u===c&&(u=255,c=0),f===h&&(f=255,h=0),d>0?(v=s+d*(255-s),m=l-d*(l-0),y=u+d*(255-u),b=c-d*(c-0),x=f+d*(255-f),E=h-d*(h-0)):(v=s+d*(s-(p=.5*(s+l))),m=l+d*(l-p),y=u+d*(u-(g=.5*(u+c))),b=c+d*(c-g),x=f+d*(f-(w=.5*(f+h))),E=h+d*(h-w)),i=0;i<a;i+=4)o[i+0]=cl(o[i+0],l,s,m,v),o[i+1]=cl(o[i+1],c,u,b,y),o[i+2]=cl(o[i+2],h,f,E,x)}},Grayscale:function(e){var t,n,r=e.data,i=r.length;for(t=0;t<i;t+=4)n=.34*r[t]+.5*r[t+1]+.16*r[t+2],r[t]=n,r[t+1]=n,r[t+2]=n},HSL:function(e){var t,n,r,i,o,a=e.data,l=a.length,s=Math.pow(2,this.saturation()),c=Math.abs(this.hue()+360)%360,u=127*this.luminance(),h=1*s*Math.cos(c*Math.PI/180),f=1*s*Math.sin(c*Math.PI/180),d=.299+.701*h+.167*f,p=.587-.587*h+.33*f,v=.114-.114*h-.497*f,m=.299-.299*h-.328*f,g=.587+.413*h+.035*f,y=.114-.114*h+.293*f,b=.299-.3*h+1.25*f,w=.587-.586*h-1.05*f,x=.114+.886*h-.2*f;for(t=0;t<l;t+=4)n=a[t+0],r=a[t+1],i=a[t+2],o=a[t+3],a[t+0]=d*n+p*r+v*i+u,a[t+1]=m*n+g*r+y*i+u,a[t+2]=b*n+w*r+x*i+u,a[t+3]=o},HSV:function(e){var t,n,r,i,o,a=e.data,l=a.length,s=Math.pow(2,this.value()),c=Math.pow(2,this.saturation()),u=Math.abs(this.hue()+360)%360,h=s*c*Math.cos(u*Math.PI/180),f=s*c*Math.sin(u*Math.PI/180),d=.299*s+.701*h+.167*f,p=.587*s-.587*h+.33*f,v=.114*s-.114*h-.497*f,m=.299*s-.299*h-.328*f,g=.587*s+.413*h+.035*f,y=.114*s-.114*h+.293*f,b=.299*s-.3*h+1.25*f,w=.587*s-.586*h-1.05*f,x=.114*s+.886*h-.2*f;for(t=0;t<l;t+=4)n=a[t+0],r=a[t+1],i=a[t+2],o=a[t+3],a[t+0]=d*n+p*r+v*i,a[t+1]=m*n+g*r+y*i,a[t+2]=b*n+w*r+x*i,a[t+3]=o},Invert:function(e){var t,n=e.data,r=n.length;for(t=0;t<r;t+=4)n[t]=255-n[t],n[t+1]=255-n[t+1],n[t+2]=255-n[t+2]},Kaleidoscope:function(e){var t,n,r,i,o,a,l,s,c,u=e.width,h=e.height,f=Math.round(this.kaleidoscopePower()),d=Math.round(this.kaleidoscopeAngle()),p=Math.floor(u*(d%360)/360);if(!(f<1)){var v=yi.createCanvasElement();v.width=u,v.height=h;var m=v.getContext("2d").getImageData(0,0,u,h);!function(e,t,n){var r,i,o,a,l=e.data,s=t.data,c=e.width,u=e.height,h=n.polarCenterX||c/2,f=n.polarCenterY||u/2,d=0,p=0,v=0,m=0,g=Math.sqrt(h*h+f*f);i=c-h,o=u-f,g=(a=Math.sqrt(i*i+o*o))>g?a:g;var y,b,w,x,E=u,_=c,z=360/_*Math.PI/180;for(b=0;b<_;b+=1)for(w=Math.sin(b*z),x=Math.cos(b*z),y=0;y<E;y+=1)i=Math.floor(h+g*y/E*x),d=l[0+(r=4*((o=Math.floor(f+g*y/E*w))*c+i))],p=l[r+1],v=l[r+2],m=l[r+3],s[0+(r=4*(b+y*c))]=d,s[r+1]=p,s[r+2]=v,s[r+3]=m}(e,m,{polarCenterX:u/2,polarCenterY:h/2});for(var g=u/Math.pow(2,f);g<=8;)g*=2,f-=1;var y=g=Math.ceil(g),b=0,w=y,x=1;for(p+g>u&&(b=y,w=0,x=-1),n=0;n<h;n+=1)for(t=b;t!==w;t+=x)s=4*(u*n+Math.round(t+p)%u),i=m.data[s+0],o=m.data[s+1],a=m.data[s+2],l=m.data[s+3],c=4*(u*n+t),m.data[c+0]=i,m.data[c+1]=o,m.data[c+2]=a,m.data[c+3]=l;for(n=0;n<h;n+=1)for(y=Math.floor(g),r=0;r<f;r+=1){for(t=0;t<y+1;t+=1)s=4*(u*n+t),i=m.data[s+0],o=m.data[s+1],a=m.data[s+2],l=m.data[s+3],c=4*(u*n+2*y-t-1),m.data[c+0]=i,m.data[c+1]=o,m.data[c+2]=a,m.data[c+3]=l;y*=2}!function(e,t,n){var r,i,o,a,l,s,c=e.data,u=t.data,h=e.width,f=e.height,d=n.polarCenterX||h/2,p=n.polarCenterY||f/2,v=0,m=0,g=0,y=0,b=Math.sqrt(d*d+p*p);i=h-d,o=f-p,b=(s=Math.sqrt(i*i+o*o))>b?s:b;var w,x,E,_=f,z=h,S=n.polarRotation||0;for(i=0;i<h;i+=1)for(o=0;o<f;o+=1)a=i-d,l=o-p,w=Math.sqrt(a*a+l*l)*_/b,x=(x=(180*Math.atan2(l,a)/Math.PI+360+S)%360)*z/360,E=Math.floor(x),v=c[0+(r=4*(Math.floor(w)*h+E))],m=c[r+1],g=c[r+2],y=c[r+3],u[0+(r=4*(o*h+i))]=v,u[r+1]=m,u[r+2]=g,u[r+3]=y}(m,e,{polarRotation:0})}},Mask:function(e){var t=function(e,t){var n=ul(e,0,0),r=ul(e,e.width-1,0),i=ul(e,0,e.height-1),o=ul(e,e.width-1,e.height-1),a=t||10;if(hl(n,r)<a&&hl(r,o)<a&&hl(o,i)<a&&hl(i,n)<a){for(var l=function(e){for(var t=[0,0,0],n=0;n<e.length;n++)t[0]+=e[n][0],t[1]+=e[n][1],t[2]+=e[n][2];return t[0]/=e.length,t[1]/=e.length,t[2]/=e.length,t}([r,n,o,i]),s=[],c=0;c<e.width*e.height;c++){var u=hl(l,[e.data[4*c],e.data[4*c+1],e.data[4*c+2]]);s[c]=u<a?0:255}return s}}(e,this.threshold());return t&&function(e,t){for(var n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}(e,t=function(e,t,n){for(var r=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),a=[],l=0;l<n;l++)for(var s=0;s<t;s++){for(var c=l*t+s,u=0,h=0;h<i;h++)for(var f=0;f<i;f++){var d=l+h-o,p=s+f-o;if(d>=0&&d<n&&p>=0&&p<t){var v=r[h*i+f];u+=e[d*t+p]*v}}a[c]=u}return a}(t=function(e,t,n){for(var r=[1,1,1,1,1,1,1,1,1],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),a=[],l=0;l<n;l++)for(var s=0;s<t;s++){for(var c=l*t+s,u=0,h=0;h<i;h++)for(var f=0;f<i;f++){var d=l+h-o,p=s+f-o;if(d>=0&&d<n&&p>=0&&p<t){var v=r[h*i+f];u+=e[d*t+p]*v}}a[c]=u>=1020?255:0}return a}(t=function(e,t,n){for(var r=[1,1,1,1,0,1,1,1,1],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),a=[],l=0;l<n;l++)for(var s=0;s<t;s++){for(var c=l*t+s,u=0,h=0;h<i;h++)for(var f=0;f<i;f++){var d=l+h-o,p=s+f-o;if(d>=0&&d<n&&p>=0&&p<t){var v=r[h*i+f];u+=e[d*t+p]*v}}a[c]=2040===u?255:0}return a}(t,e.width,e.height),e.width,e.height),e.width,e.height)),e},Noise:function(e){var t,n=255*this.noise(),r=e.data,i=r.length,o=n/2;for(t=0;t<i;t+=4)r[t+0]+=o-2*o*Math.random(),r[t+1]+=o-2*o*Math.random(),r[t+2]+=o-2*o*Math.random()},Pixelate:function(e){var t,n,r,i,o,a,l,s,c,u,h,f,d,p,v=Math.ceil(this.pixelSize()),m=e.width,g=e.height,y=Math.ceil(m/v),b=Math.ceil(g/v),w=e.data;if(v<=0)yi.error("pixelSize value can not be <= 0");else for(f=0;f<y;f+=1)for(d=0;d<b;d+=1){for(i=0,o=0,a=0,l=0,c=(s=f*v)+v,h=(u=d*v)+v,p=0,t=s;t<c;t+=1)if(!(t>=m))for(n=u;n<h;n+=1)n>=g||(i+=w[(r=4*(m*n+t))+0],o+=w[r+1],a+=w[r+2],l+=w[r+3],p+=1);for(i/=p,o/=p,a/=p,l/=p,t=s;t<c;t+=1)if(!(t>=m))for(n=u;n<h;n+=1)n>=g||(w[(r=4*(m*n+t))+0]=i,w[r+1]=o,w[r+2]=a,w[r+3]=l)}},Posterize:function(e){var t,n=Math.round(254*this.levels())+1,r=e.data,i=r.length,o=255/n;for(t=0;t<i;t+=1)r[t]=Math.floor(r[t]/o)*o},RGB:function(e){var t,n,r=e.data,i=r.length,o=this.red(),a=this.green(),l=this.blue();for(t=0;t<i;t+=4)n=(.34*r[t]+.5*r[t+1]+.16*r[t+2])/255,r[t]=n*o,r[t+1]=n*a,r[t+2]=n*l,r[t+3]=r[t+3]},RGBA:function(e){var t,n,r=e.data,i=r.length,o=this.red(),a=this.green(),l=this.blue(),s=this.alpha();for(t=0;t<i;t+=4)n=1-s,r[t]=o*s+r[t]*n,r[t+1]=a*s+r[t+1]*n,r[t+2]=l*s+r[t+2]*n},Sepia:function(e){var t,n,r,i,o=e.data,a=o.length;for(t=0;t<a;t+=4)n=o[t+0],r=o[t+1],i=o[t+2],o[t+0]=Math.min(255,.393*n+.769*r+.189*i),o[t+1]=Math.min(255,.349*n+.686*r+.168*i),o[t+2]=Math.min(255,.272*n+.534*r+.131*i)},Solarize:function(e){var t=e.data,n=e.width,r=4*n,i=e.height;do{var o=(i-1)*r,a=n;do{var l=o+4*(a-1),s=t[l],c=t[l+1],u=t[l+2];s>127&&(s=255-s),c>127&&(c=255-c),u>127&&(u=255-u),t[l]=s,t[l+1]=c,t[l+2]=u}while(--a)}while(--i)},Threshold:function(e){var t,n=255*this.threshold(),r=e.data,i=r.length;for(t=0;t<i;t+=1)r[t]=r[t]<n?0:255}}});var dl,pl=fl,vl=(d=l("8NFma"),sa);dl=l("bBlAQ");var ml;ml=l("d74WH");var gl={};e(gl,"appendInitialChild",(()=>Ml)),e(gl,"createInstance",(()=>Al)),e(gl,"createTextInstance",(()=>kl)),e(gl,"finalizeInitialChildren",(()=>Ll)),e(gl,"getPublicInstance",(()=>Pl)),e(gl,"prepareForCommit",(()=>Tl)),e(gl,"preparePortalMount",(()=>Hl)),e(gl,"prepareUpdate",(()=>Nl)),e(gl,"resetAfterCommit",(()=>Rl)),e(gl,"resetTextContent",(()=>jl)),e(gl,"shouldDeprioritizeSubtree",(()=>Vl)),e(gl,"getRootHostContext",(()=>Il)),e(gl,"getChildHostContext",(()=>Dl)),e(gl,"scheduleTimeout",(()=>Fl)),e(gl,"cancelTimeout",(()=>Bl)),e(gl,"noTimeout",(()=>Ul)),e(gl,"shouldSetTextContent",(()=>Gl)),e(gl,"isPrimaryRenderer",(()=>ql)),e(gl,"warnsIfNotActing",(()=>Wl)),e(gl,"supportsMutation",(()=>Kl)),e(gl,"appendChild",(()=>Yl)),e(gl,"appendChildToContainer",(()=>$l)),e(gl,"insertBefore",(()=>Xl)),e(gl,"insertInContainerBefore",(()=>Ql)),e(gl,"removeChild",(()=>Zl)),e(gl,"removeChildFromContainer",(()=>Jl)),e(gl,"commitTextUpdate",(()=>es)),e(gl,"commitMount",(()=>ts)),e(gl,"commitUpdate",(()=>ns)),e(gl,"hideInstance",(()=>rs)),e(gl,"hideTextInstance",(()=>is)),e(gl,"unhideInstance",(()=>os)),e(gl,"unhideTextInstance",(()=>as)),e(gl,"clearContainer",(()=>ls)),e(gl,"detachDeletedInstance",(()=>ss)),e(gl,"getCurrentEventPriority",(()=>cs)),e(gl,"now",(()=>l("clk2u").unstable_now)),e(gl,"idlePriority",(()=>l("clk2u").unstable_IdlePriority)),e(gl,"run",(()=>l("clk2u").unstable_runWithPriority));const yl={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let bl=!1,wl=!1;const xl=".react-konva-event";let El=!1;const _l={};function zl(e,t,n=_l){if(!bl&&"zIndex"in t&&(console.warn('ReactKonva: You are using "zIndex" attribute for a Konva node.\nreact-konva may get confused with ordering. Just define correct order of elements in your render function of a component.\nFor more info see: https://github.com/konvajs/react-konva/issues/194\n'),bl=!0),!wl&&t.draggable){var r=void 0!==t.x||void 0!==t.y,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn("ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.\nPosition of a node will be changed during drag&drop, so you should update state of the react app as well.\nConsider to add onDragMove or onDragEnd events.\nFor more info see: https://github.com/konvajs/react-konva/issues/256\n"),wl=!0)}for(var o in n)if(!yl[o]){var a="on"===o.slice(0,2),l=n[o]!==t[o];if(a&&l)"content"===(d=o.substr(2).toLowerCase()).substr(0,7)&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),e.off(d,n[o]);!t.hasOwnProperty(o)&&e.setAttr(o,void 0)}var s=El||t._useStrictMode,c={},u=!1;const h={};for(var o in t)if(!yl[o]){a="on"===o.slice(0,2);var f=n[o]!==t[o];if(a&&f)"content"===(d=o.substr(2).toLowerCase()).substr(0,7)&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),t[o]&&(h[d]=t[o]);!a&&(t[o]!==n[o]||s&&t[o]!==e.getAttr(o))&&(u=!0,c[o]=t[o])}for(var d in u&&(e.setAttrs(c),Sl(e)),h)e.on(d+xl,h[d])}function Sl(e){if(!si.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}l("clk2u");const Cl={},Ol={};function Ml(e,t){"string"!=typeof t?(e.add(t),Sl(e)):console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`)}function Al(e,t,n){let r=vl[e];r||(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=vl.Group);const i={},o={};for(var a in t){"on"===a.slice(0,2)?o[a]=t[a]:i[a]=t[a]}const l=new r(i);return zl(l,o),l}function kl(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function Ll(e,t,n){return!1}function Pl(e){return e}function Tl(){return null}function Hl(){return null}function Nl(e,t,n,r){return Ol}function Rl(){}function jl(e){}function Vl(e,t){return!1}function Il(){return Cl}function Dl(){return Cl}vl.Node.prototype._applyProps=zl;const Fl=setTimeout,Bl=clearTimeout,Ul=-1;function Gl(e,t){return!1}const ql=!1,Wl=!0,Kl=!0;function Yl(e,t){t.parent===e?t.moveToTop():e.add(t),Sl(e)}function $l(e,t){t.parent===e?t.moveToTop():e.add(t),Sl(e)}function Xl(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),Sl(e)}function Ql(e,t,n){Xl(e,t,n)}function Zl(e,t){t.destroy(),t.off(xl),Sl(e)}function Jl(e,t){t.destroy(),t.off(xl),Sl(e)}function es(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function ts(e,t,n){}function ns(e,t,n,r,i){zl(e,i,r)}function rs(e){e.hide(),Sl(e)}function is(e){}function os(e,t){(null==t.visible||t.visible)&&e.show()}function as(e,t){}function ls(e){}function ss(){}const cs=()=>ml.DefaultEventPriority;d=l("8NFma");var us=Object.defineProperty,hs=Object.defineProperties,fs=Object.getOwnPropertyDescriptors,ds=Object.getOwnPropertySymbols,ps=Object.prototype.hasOwnProperty,vs=Object.prototype.propertyIsEnumerable,ms=(e,t,n)=>t in e?us(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gs=(e,t)=>{for(var n in t||(t={}))ps.call(t,n)&&ms(e,n,t[n]);if(ds)for(var n of ds(t))vs.call(t,n)&&ms(e,n,t[n]);return e};function ys(e,t,n){if(!e)return;if(!0===n(e))return e;let r=t?e.return:e.child;for(;r;){const e=ys(r,t,n);if(e)return e;r=t?null:r.sibling}}function bs(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}const ws=bs(d.createContext(null));class xs extends d.Component{render(){return d.createElement(ws.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:Es,ReactCurrentDispatcher:_s}=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function zs(){const e=d.useContext(ws);if(!e)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const t=d.useId();return d.useMemo((()=>{var n;return null!=(n=Es.current)?n:ys(e,!1,(e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}}))}),[e,t])}const Ss=[],Cs=new WeakMap;function Os(){var e;const t=zs();Ss.splice(0,Ss.length),ys(t,!0,(e=>{var t;const n=null==(t=e.type)?void 0:t._context;n&&n!==ws&&Ss.push(bs(n))}));for(const t of Ss){const n=null==(e=_s.current)?void 0:e.readContext(t);Cs.set(t,n)}return d.useMemo((()=>Ss.reduce(((e,t)=>n=>{return d.createElement(e,null,d.createElement(t.Provider,(r=gs({},n),i={value:Cs.get(t)},hs(r,fs(i)))));var r,i}),(e=>d.createElement(xs,gs({},e))))),[])}const Ms=e=>{const t=n(d).useRef(),r=n(d).useRef(),i=n(d).useRef(),o=function(e){const t=n(d).useRef();return n(d).useLayoutEffect((()=>{t.current=e})),t.current}(e),a=Os(),l=t=>{const{forwardedRef:n}=e;n&&("function"==typeof n?n(t):n.current=t)};return n(d).useLayoutEffect((()=>(r.current=new vl.Stage({width:e.width,height:e.height,container:t.current}),l(r.current),i.current=Ns.createContainer(r.current,ml.LegacyRoot,!1,null),Ns.updateContainer(n(d).createElement(a,{},e.children),i.current),()=>{vl.isBrowser&&(l(null),Ns.updateContainer(null,i.current,null),r.current.destroy())})),[]),n(d).useLayoutEffect((()=>{l(r.current),zl(r.current,e,o),Ns.updateContainer(n(d).createElement(a,{},e.children),i.current,null)})),n(d).createElement("div",{ref:t,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},As="Group",ks="Rect",Ls="Line",Ps="Image",Ts="Text",Hs="Transformer",Ns=n(dl)(gl);Ns.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:n(d).version,rendererPackageName:"react-konva"});const Rs=n(d).forwardRef(((e,t)=>n(d).createElement(xs,{},n(d).createElement(Ms,{...e,forwardedRef:t}))));var js;d=l("8NFma");js=function(e,t,n){const r=d.useRef("loading"),i=d.useRef(),[o,a]=d.useState(0),l=d.useRef(),s=d.useRef(),c=d.useRef();return l.current===e&&s.current===t&&c.current===n||(r.current="loading",i.current=void 0,l.current=e,s.current=t,c.current=n),d.useLayoutEffect((function(){if(e){var o=document.createElement("img");return o.addEventListener("load",l),o.addEventListener("error",s),t&&(o.crossOrigin=t),n&&(o.referrerpolicy=n),o.src=e,function(){o.removeEventListener("load",l),o.removeEventListener("error",s)}}function l(){r.current="loaded",i.current=o,a(Math.random())}function s(){r.current="failed",i.current=void 0,a(Math.random())}}),[e,t,n]),[i.current,r.current]},l("8NFma");d=l("8NFma");var Vs={};e(Vs,"Html",(()=>Ds),(e=>Ds=e));d=l("8NFma");var Is=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};const Ds=({children:e,groupProps:t,divProps:r,transform:i,transformFunc:o})=>{const a=n(d).useRef(null),[l]=(n(d).useRef(),n(d).useState((()=>document.createElement("div")))),s=n(d).useMemo((()=>n(h).createRoot(l)),[l]),c=null==i||i,u=()=>{if(c&&a.current){let e=a.current.getAbsoluteTransform().decompose();o&&(e=o(e)),l.style.position="absolute",l.style.zIndex="10",l.style.top="0px",l.style.left="0px",l.style.transform=`translate(${e.x}px, ${e.y}px) rotate(${e.rotation}deg) scaleX(${e.scaleX}) scaleY(${e.scaleY})`,l.style.transformOrigin="top left"}else l.style.position="",l.style.zIndex="",l.style.top="",l.style.left="",l.style.transform="",l.style.transformOrigin="";const e=r||{},{style:t}=e,n=Is(e,["style"]);Object.assign(l.style,t),Object.assign(l,n)};return n(d).useLayoutEffect((()=>{var e;const t=a.current;if(!t)return;const n=null===(e=t.getStage())||void 0===e?void 0:e.container();return n?(n.appendChild(l),c&&(e=>{const t=window.getComputedStyle(e).position;return!("absolute"===t||"relative"===t)})(n)&&(n.style.position="relative"),t.on("absoluteTransformChange",u),u(),()=>{var e;t.off("absoluteTransformChange",u),null===(e=l.parentNode)||void 0===e||e.removeChild(l)}):void 0}),[c]),n(d).useLayoutEffect((()=>{u()}),[r]),n(d).useLayoutEffect((()=>{s.render(e)})),n(d).useEffect((()=>()=>{s.unmount()}),[]),n(d).createElement(As,Object.assign({ref:a},t))};d=l("8NFma");const Fs=({selector:e,enabled:t,children:r})=>{const i=n(d).useRef(null),o=n(d).useRef(null),a=n(d).useRef(),l=null==t||t;return n(d).useLayoutEffect((()=>{if(!i.current||!o.current)return;a.current=o.current;const t=i.current.getStage().findOne(e);l&&t?o.current.moveTo(t):o.current.moveTo(i.current),i.current.getLayer().batchDraw(),t&&t.getLayer().batchDraw()}),[e,l]),n(d).useEffect((()=>()=>{var e;null===(e=a.current)||void 0===e||e.destroy()}),[]),n(d).createElement(As,{name:"_outer_portal",ref:i},n(d).createElement(As,{name:"_inner_portal",ref:o},r))};d=l("8NFma");let Bs=!1;function Us(e,t){const r=n(d).useRef();n(d).useLayoutEffect((()=>{r.current&&r.current.destroy()}),[t]),n(d).useLayoutEffect((()=>{if(!Bs)return;const t=e.current.opacity();return t?(e.current.opacity(0),r.current=new pl.Tween({node:e.current,opacity:t,onFinish:()=>{r.current?.destroy()}}),r.current.play(),()=>{r.current?.destroy()}):void 0}),[])}let Gs=0,qs=[];function Ws(e){Gs+=1;let t=!1;Date.now();const n=setTimeout((()=>{t||(Xs(`Timeout loading image ${e}`),console.error("Timeout triggered for loader. Some assets may not have loaded.",e),t=!0,Ks())}),3e4);return()=>{t||(clearTimeout(n),Ks())}}function Ks(){Gs-=1,0===Gs&&(qs.forEach((e=>e())),qs=[])}function Ys(){return new Promise((e=>{return t=()=>{Bs?setTimeout(e,300):e(!0)},void(0===Gs?t():qs.push(t));var t}))}let $s=[];function Xs(e){$s.forEach((t=>t(e)))}let Qs=je(["Roboto","Amatic SC","Press Start 2P","Marck Script","Rubik Mono One"]),Zs=!1;function Js(){return Zs}function ec(){return Qs}const tc=je([]);var nc=document.createElement("canvas");function rc(e,t="Arial"){var n=nc.getContext("2d");return n.font=`normal 40px '${e}', ${t}`,n.measureText("Some test text;?#D-ПРИВЕТ!1230o9u8i7y6t5r4e3w2q1").width}const ic={Arial:!0},oc=e=>ic[e];async function ac(e){if(ic[e])return;const t=!!document.fonts?.load,n=rc("Arial");if(t)try{await document.fonts.load(`16px '${e}'`);const t=rc(e);if(n!==t)return void(ic[e]=!0)}catch{}const r=rc("Times","Times"),i=rc(e);for(let t=0;t<100;t++){const t=rc(e,"Arial"),o=rc(e,"Times");if(t!==i||t!==n||o!==r)return void(ic[e]=!0);await new Promise((e=>setTimeout(e,60)))}console.warn(`Timeout for loading font "${e}". Looks like polotno can't load it. Is it a correct font family?`),Xs(`Timeout for loading font "${e}"`)}const lc={};const sc={};const cc=je({imageDownScalingEnabled:!0,removeBackgroundEnabled:!0,htmlRenderEnabled:!1,forceTextFitEnabled:!1,textVerticalResizeEnabled:!1,textOverflow:"resize"});function uc(e=""){return e.replace(/(<([^>]+)>)/gi,"")}var hc,fc,dc,pc,vc={};e(vc,"parse",(()=>hc),(e=>hc=e)),e(vc,"stringify",(()=>fc),(e=>fc=e)),(pc=pc||{}).stringify=(dc={"visit_linear-gradient":function(e){return dc.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return dc.visit_gradient(e)},"visit_radial-gradient":function(e){return dc.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return dc.visit_gradient(e)},visit_gradient:function(e){var t=dc.visit(e.orientation);return t&&(t+=", "),e.type+"("+t+dc.visit(e.colorStops)+")"},visit_shape:function(e){var t=e.value,n=dc.visit(e.at),r=dc.visit(e.style);return r&&(t+=" "+r),n&&(t+=" at "+n),t},"visit_default-radial":function(e){var t="",n=dc.visit(e.at);return n&&(t+=n),t},"visit_extent-keyword":function(e){var t=e.value,n=dc.visit(e.at);return n&&(t+=" at "+n),t},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return dc.visit(e.value.x)+" "+dc.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_literal:function(e){return dc.visit_color(e.value,e)},visit_hex:function(e){return dc.visit_color("#"+e.value,e)},visit_rgb:function(e){return dc.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return dc.visit_color("rgba("+e.value.join(", ")+")",e)},visit_color:function(e,t){var n=e,r=dc.visit(t.length);return r&&(n+=" "+r),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var t="",n=e.length;return e.forEach((function(e,r){t+=dc.visit(e),r<n-1&&(t+=", ")})),t},visit:function(e){if(!e)return"";if(e instanceof Array)return dc.visit_array(e,"");if(e.type){var t=dc["visit_"+e.type];if(t)return t(e);throw Error("Missing visitor visit_"+e.type)}throw Error("Invalid node.")}},function(e){return dc.visit(e)}),(pc=pc||{}).parse=function(){var e=/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,t=/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,n=/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,r=/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,i=/^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,o=/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,a=/^(left|center|right|top|bottom)/i,l=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,s=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,c=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,u=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,h=/^\(/,f=/^\)/,d=/^,/,p=/^\#([0-9a-fA-F]+)/,v=/^([a-zA-Z]+)/,m=/^rgb/i,g=/^rgba/i,y=/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/,b="";function w(e){var t=new Error(b+": "+e);throw t.source=b,t}function x(){var e=L(E);return b.length>0&&w("Invalid input not EOF"),e}function E(){return _("linear-gradient",e,S)||_("repeating-linear-gradient",t,S)||_("radial-gradient",n,C)||_("repeating-radial-gradient",r,C)}function _(e,t,n){return z(t,(function(t){var r=n();return r&&(j(d)||w("Missing comma before color stops")),{type:e,orientation:r,colorStops:L(P)}}))}function z(e,t){var n=j(e);if(n){j(h)||w("Missing (");var r=t(n);return j(f)||w("Missing )"),r}}function S(){return R("directional",i,1)||R("angular",u,1)}function C(){var e,t,n=O();return n&&((e=[]).push(n),t=b,j(d)&&((n=O())?e.push(n):b=t)),e}function O(){var e=function(){var e=R("shape",/^(circle)/i,0);e&&(e.style=N()||M());return e}()||function(){var e=R("shape",/^(ellipse)/i,0);e&&(e.style=H()||M());return e}();if(e)e.at=A();else{var t=M();if(t){e=t;var n=A();n&&(e.at=n)}else{var r=k();r&&(e={type:"default-radial",at:r})}}return e}function M(){return R("extent-keyword",o,1)}function A(){if(R("position",/^at/,0)){var e=k();return e||w("Missing positioning value"),e}}function k(){var e={x:H(),y:H()};if(e.x||e.y)return{type:"position",value:e}}function L(e){var t=e(),n=[];if(t)for(n.push(t);j(d);)(t=e())?n.push(t):w("One extra comma");return n}function P(){var e=R("hex",p,1)||z(g,(function(){return{type:"rgba",value:L(T)}}))||z(m,(function(){return{type:"rgb",value:L(T)}}))||R("literal",v,0);return e||w("Expected color definition"),e.length=H(),e}function T(){return j(y)[1]}function H(){return R("%",s,1)||R("position-keyword",a,1)||N()}function N(){return R("px",l,1)||R("em",c,1)}function R(e,t,n){var r=j(t);if(r)return{type:e,value:r[n]}}function j(e){var t,n;return(n=/^[\n\r\t\s]+/.exec(b))&&V(n[0].length),(t=e.exec(b))&&V(t[0].length),t}function V(e){b=b.substr(e)}return function(e){return b=e.toString(),x()}}(),hc=pc.parse,fc=pc.stringify;const mc=e=>e.indexOf("linear-gradient")>=0,gc=e=>"hex"===e.type?"#"+e.value:"literal"===e.type?e.value:`${e.type}(${e.value.join(",")})`,yc=e=>{if(!mc(e))return[0,e,e];const t=n(vc).parse(e)[0],r=parseFloat(t.orientation.value),i=t.colorStops[0],o=gc(i),a=t.colorStops[1];return[r,o,gc(a)]};function bc(e,t){const n={filters:[]};t.brightnessEnabled&&(n.filters.push(pl.Filters.Brighten),n.brightness=t.brightness),t.blurEnabled&&(n.filters.push(pl.Filters.Blur),n.blurRadius=t.blurRadius),t.sepiaEnabled&&n.filters.push(pl.Filters.Sepia),t.grayscaleEnabled&&n.filters.push(pl.Filters.Grayscale),e.setAttrs(n),n.filters.length?e.cache({pixelRatio:t.store._elementsPixelRatio}):e.clearCache(),e.getLayer()?.batchDraw()}l("8NFma");const wc=ei((({element:e})=>(0,s.jsx)(ks,{name:"highlighter",x:e.x,y:e.y,rotation:e.rotation,width:e.width,height:e.height,listening:!1,stroke:"rgb(0, 161, 255)",strokeWidth:2,strokeScaleEnabled:!1}))),xc=document.createElement("style");xc.type="text/css",document.head.appendChild(xc);const Ec={border:"none",padding:"0px",overflow:"hidden",background:"none",outline:"none",resize:"none",overflowWrap:"break-word",whiteSpace:"pre-wrap",userSelect:"text",wordBreak:"normal"};function _c(e){return function(e){e=e.replace(/\s/g,"");let t=0;for(var n=0;n<e.length;n++){r=e[n],new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*?[֑-߿יִ-﷽ﹰ-ﻼ]").test(r)&&(t+=1)}var r;return t>e.length/2}(e)?"rtl":"ltr"}const zc=ei((({textNodeRef:e,element:t,onBlur:r,selectAll:i,cursorPosition:o})=>{const[a,l]=n(d).useState(Ec),c=e.current;n(d).useLayoutEffect((()=>{const e={};e.width=c.width()-2*c.padding()+"px",e.height=c.height()-2*c.padding()+10+"px",e.fontSize=c.fontSize()+"px",e.lineHeight=c.lineHeight()+.01,e.fontFamily=c.fontFamily(),e.textAlign=c.align(),e.color=c.fill(),e.fontWeight=t.fontWeight,e.fontStyle=t.fontStyle;const n=`\n .polotno-input::placeholder {\n color: ${a.color};\n opacity: 0.6;\n }\n `;xc.innerHTML="",xc.appendChild(document.createTextNode(n)),JSON.stringify(e)!==JSON.stringify(a)&&l(e)}));const u=n(d).useRef(null);n(d).useEffect((()=>{const e=setTimeout((()=>{const e=u.current;if(!e)return;u.current?.focus();const t=o||e.value.length;e.selectionStart=e.selectionEnd=t,i&&(e?.select(),document.execCommand("selectAll",!1,null))}));return()=>{clearTimeout(e)}}),[]);let h=0;const f=c.textArr.length*c.lineHeight()*c.fontSize();return"middle"===t.verticalAlign&&(h=(t.height-f)/2),"bottom"===t.verticalAlign&&(h=t.height-f),(0,s.jsx)(Vs.Html,{children:(0,s.jsx)("textarea",{className:"polotno-input",ref:u,dir:_c(t.text),style:{...Ec,...a,paddingTop:h+"px"},value:t.text,onChange:e=>{t.set({text:e.target.value})},placeholder:t.placeholder,onBlur:r})})})),Sc=(e,t)=>{const[r,i]=n(d).useState(oc(t));return n(d).useLayoutEffect((()=>{if(oc(t))return void i(!0);let n=!0;return(async()=>{r&&i(!1);const o=Ws(`text ${t}`);await e.loadFont(t),pl.Util.requestAnimFrame(o),n&&i(!0)})(),()=>{n=!1}}),[t]),[r]};const Cc=e=>n(d).useMemo((()=>{if(!mc(e.fill))return{fill:e.fill};const t=yc(e.fill),n={x:e.width/2,y:e.height/2},r=Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2)),i=pl.Util.degToRad(t[0])-Math.PI/2;return{fillLinearGradientStartPointX:n.x-r*Math.cos(i),fillLinearGradientStartPointY:n.y-r*Math.sin(i),fillLinearGradientColorStops:[0,t[1],1,t[2]],fillLinearGradientEndPointX:n.x+r*Math.cos(i),fillLinearGradientEndPointY:n.y+r*Math.sin(i),fill:t[1],fillPriority:"linear-gradient"}}),[e.fill]),Oc=ei((({element:e,store:t})=>{const r=n(d).useRef(null),{editorEnabled:i,selectAll:o}=(e=>{const[t,r]=n(d).useState(!1),i=n(d).useRef(!1);return n(d).useEffect((()=>{var t=!0;return setTimeout((()=>{t&&(e._editModeEnabled&&(i.current=!0),r(!0),setTimeout((()=>{i.current=!1}),50))}),50),()=>{t=!1}}),[]),{editorEnabled:t&&e._editModeEnabled,selectAll:i.current}})(e),[a,l]=n(d).useState(!1),[c,u]=n(d).useState(!1),h=n(d).useRef(e.height),f=t.selectedElements.indexOf(e)>=0,{textVerticalResizeEnabled:p}=cc,v=function(e){const t=n(d).useRef(e),r=n(d).useRef(e);return n(d).useEffect((()=>{r.current=t.current,t.current=e}),[e]),r.current}(e.fontFamily);n(d).useEffect((()=>{if(e.width)return;const t=r.current;t.width(600),e.set({width:1.4*t.getTextWidth()})}),[]),n(d).useLayoutEffect((()=>Kt((()=>{bc(r.current,e)}))));const[m]=Sc(t,e.fontFamily),g=uc(e.text),y=()=>{const e=r.current.clone({height:void 0}),t=Math.ceil(e.fontSize()*e.lineHeight()*e.textArr.length+1);return e.destroy(),t};n(d).useLayoutEffect((()=>{if(!m)return;const{textOverflow:n}=cc;if(e.height)if("change-font-size"!==n||c){if("resize"===n){const n=y();p&&e.height<n&&t.history.ignore((()=>{e.set({height:n}),r.current.height(n)})),p||e.height===n||t.history.ignore((()=>{e.set({height:n}),r.current.height(n)}))}}else{const n=function(e,t){const n=e.getAttrs(),r=uc(t.text);let i=t.fontSize;const o=Math.round(2*t.fontSize)-1;for(let n=1;n<o;n++){const n=t.height&&e.height()>t.height,o=r.split("\n").join(" ").split(" ");let a=e.textArr.map((e=>e.text)).join(";");const l=o.find((e=>!a.includes(e)||(a=a.replace(e,""),!1)));if(!n&&!l)break;i-=.5,e.fontSize(i)}return e.fontSize(n.fontSize),i}(r.current,e);if(n!==e.fontSize)return void t.history.ignore((()=>{e.set({fontSize:n})}));const i=y();e.height!==i&&t.history.ignore((()=>{e.set({height:i})}))}else{const n=y();t.history.ignore((()=>{e.set({height:n})}))}})),n(d).useLayoutEffect((()=>{const t=r.current;t&&(t.width(t.width()+1e-8),t._setTextData(),bc(t,e))}),[m]);const b=n(d).useRef(null),w=n(d).useRef(0),x=n=>{const r=t.selectedElements.find((t=>t===e));r&&e.contentEditable&&(w.current=function(e){const t=e.target,n=function(e){var t=e.getAbsoluteTransform().copy();t.invert();var n=e.getStage().getPointerPosition();return t.point(n)}(t),r=t.textArr,i=Math.floor(n.y/(t.fontSize()*t.lineHeight())),o=r.slice(0,i).reduce(((e,t)=>e+t.text.length),i),a=r[i]??r[0];let l=0;return"right"===t.align()?l=t.width()-a.width:"center"===t.align()&&(l=t.width()/2-a.width/2),o+Math.round((n.x-l)/a.width*a.text.length)}(n),e.toggleEditMode())},E=!g&&e.placeholder?.6:e.opacity;Us(r,E);const _=(({fontLoaded:e,fontFamily:t,fontSize:r,lineHeight:i})=>n(d).useMemo((()=>{if("number"==typeof i)return i;const e=document.createElement("div");e.style.fontFamily=t,e.style.fontSize=r+"px",e.style.lineHeight=i,e.innerText="Test text",document.body.appendChild(e);const n=e.offsetHeight;return document.body.removeChild(e),n/r}),[e,t,r,i]))({fontLoaded:m,fontFamily:e.fontFamily,fontSize:e.fontSize,lineHeight:e.lineHeight}),z=e.selectable||"admin"===t.role,S=Cc(e);return(0,s.jsxs)(n(d).Fragment,{children:[(0,s.jsx)(Ts,{ref:r,id:e.id,name:"element",hideInExport:!e.showInExport||!g,editModeEnabled:e._editModeEnabled,x:e.x,y:e.y,rotation:e.rotation,width:e.width,height:e.height,text:g||e.placeholder,...S,stroke:e.stroke,strokeWidth:e.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:e.fontSize,fontFamily:`"${e.fontFamily}", "${v}"`,fontStyle:e.fontStyle+" "+e.fontWeight,textDecoration:e.textDecoration,align:e.align,verticalAlign:e.verticalAlign,draggable:e.draggable,opacity:E,visible:!e._editModeEnabled,ellipsis:"ellipsis"===cc.textOverflow,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,lineHeight:_,letterSpacing:e.letterSpacing*e.fontSize,listening:z,onDragStart:()=>{t.history.startTransaction()},onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:n=>{e.set({x:n.target.x(),y:n.target.y()}),t.history.endTransaction()},onMouseEnter:()=>{l(!0)},onMouseLeave:()=>{l(!1)},onClick:x,onTap:x,onTransformStart:()=>{u(!0),t.history.startTransaction(),h.current=r.current.height()},onTransform:t=>{const n=t.target,r=n.getStage()?.findOne("Transformer"),i=r.getActiveAnchor();if("middle-left"===i||"middle-right"===i){const t=n.scaleX(),r=n.width()*t,i=e.fontSize;let o=r;r<i&&(o=i,b.current&&n.position(b.current)),n.width(o),n.scaleX(1),n.scaleY(1);const a=y();if("ellipsis"!==cc.textOverflow){const t=Math.max(a,h.current);n.height(t),e.set({height:n.height()})}e.set({x:n.x(),y:n.y(),width:n.width(),rotation:n.rotation()}),bc(n,e)}if("top-center"===i||"bottom-center"===i){let n="resize"===cc.textOverflow?y():_*e.fontSize;t.target.height(Math.max(n,t.target.height()*t.target.scaleY())),t.target.scaleY(1)}t.target.strokeWidth(e.strokeWidth/t.target.scaleX()),b.current=t.target.position()},onTransformEnd:n=>{u(!1);const r=n.target.scaleX();n.target.scaleX(1),n.target.scaleY(1),n.target.strokeWidth(e.strokeWidth),e.set({fontSize:Math.round(e.fontSize*r),width:Math.ceil(n.target.width()*r),x:n.target.x(),y:n.target.y(),rotation:n.target.rotation(),height:n.target.height()}),t.history.endTransaction()}}),i&&(0,s.jsx)(As,{x:e.x,y:e.y,rotation:e.rotation,children:(0,s.jsx)(zc,{textNodeRef:r,element:e,selectAll:o,cursorPosition:w.current,onBlur:()=>{e.toggleEditMode(!1)}})}),!c&&(a||f)&&(0,s.jsx)(wc,{element:e})]})}));d=l("8NFma"),d=l("8NFma");function Mc(e){for(;e.parentNode;){if("defs"===e.nodeName)return!0;e=e.parentNode}return!1}function Ac(e){const t={fill:"",stroke:""};return e.getAttribute("fill")&&"none"!==e.getAttribute("fill")&&(t.fill=e.getAttribute("fill")),!t.fill&&e.style.fill&&"none"!==e.style.fill&&(t.fill=e.style.fill),e.getAttribute("stroke")&&(t.stroke=e.getAttribute("stroke")),!t.stroke&&e.style.stroke&&(t.stroke=e.style.stroke),t.stroke||t.fill||(t.fill="black"),t}const kc=["path","rect","circle"];function Lc(e){for(var t=[],n=e.getElementsByTagName("*"),r=0,i=n.length;r<i;r++){const e=n[r];Mc(e)||(null!==e.getAttribute("fill")&&t.push(e),(null!==e.getAttribute("stroke")||e.style&&e.style.fill||kc.indexOf(e.nodeName)>=0)&&t.push(e))}return t}async function Pc(e){const t=await fetch(e);return Hc(await t.text())}async function Tc(e){const t=await fetch(e,{mode:"cors"});return await t.text()}function Hc(e){return"data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(e)))}async function Nc(e){const t=await Tc(e);const n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement.getAttribute("viewBox"),[r,i,o,a]=n?.split(" ")||[];return{width:parseFloat(o),height:parseFloat(a)}}function Rc(e){var t=(new DOMParser).parseFromString(e,"image/svg+xml");const n=t.documentElement.getAttribute("viewBox"),[r,i,o,a]=n?.split(" ")||[],l=t.documentElement.getAttribute("width");(!l||l.indexOf("%")>=0)&&t.documentElement.setAttribute("width",o+"px");const s=t.documentElement.getAttribute("height");(!s||s.indexOf("%")>=0)&&t.documentElement.setAttribute("height",a+"px");return(new XMLSerializer).serializeToString(t)}const jc=(e,t)=>{if(!e||!t)return!1;const n=pl.Util.colorToRGBA(e),r=pl.Util.colorToRGBA(t);return n&&r?n.r===r.r&&n.g===r.g&&n.b===r.b&&n.a===r.a:void 0};function Vc(e,t){var n=(new DOMParser).parseFromString(e,"image/svg+xml");const r=Lc(n),i=Array.from(t.keys());r.forEach((e=>{const{fill:r,stroke:o}=Ac(e);[{prop:"fill",color:r},{prop:"stroke",color:o}].forEach((({prop:r,color:o})=>{const a=i.find((e=>jc(e,o)));if(a){const i=t.get(a);if(mc(i)){const[t,o,a]=yc(i),l=[{offset:"0%","stop-color":o},{offset:"100%","stop-color":a}],s="color"+Math.round(1e8*Math.random());!function(e,t,n,r){var i=e.namespaceURI,o=document.createElementNS(i,"linearGradient");const a=pl.Util.degToRad(n+90),l=(Math.cos(a)+1)/2,s=(Math.sin(a)+1)/2,c=(Math.cos(a+Math.PI)+1)/2,u=(Math.sin(a+Math.PI)+1)/2;o.setAttribute("x1",100*l+"%"),o.setAttribute("y1",100*s+"%"),o.setAttribute("x2",100*c+"%"),o.setAttribute("y2",100*u+"%"),o.setAttribute("gradientUnits","userSpaceOnUse"),o.setAttribute("id",t);for(var h=0;h<r.length;h++){var f=r[h],d=document.createElementNS(i,"stop");for(var p in f)f.hasOwnProperty(p)&&d.setAttribute(p,f[p]);o.appendChild(d)}(e.querySelector("defs")||e.insertBefore(document.createElementNS(i,"defs"),e.firstChild)).appendChild(o)}(n.children[0],s,t,l),e.style[r]=null,e.setAttribute(r,`url('#${s}')`)}else e.style[r]=t.get(a)}}))}));return Hc((new XMLSerializer).serializeToString(n))}const Ic=e=>{const[t,r]=n(d).useState([]);return n(d).useEffect((()=>{let t=!1;return(async()=>{r([]);const n=function(e){const t=Lc((new DOMParser).parseFromString(e,"image/svg+xml")),n=[];return t.forEach((e=>{const{fill:t,stroke:r}=Ac(e);[t,r].forEach((e=>{e&&pl.Util.colorToRGBA(e)&&-1===n.indexOf(e)&&n.push(e)}))})),n}(await Tc(e));t||r(n)})(),()=>{t=!0}}),[e]),t};const Dc=e=>{const[t,r]=n(d).useState(e);return n(d).useEffect((()=>{(async()=>{const n=await async function(e){return e.indexOf("data:image/svg+xml")>=0||e.indexOf(".svg")>=0?Hc(Rc(await Tc(e))):e}(e);n!==t&&r(n)})()}),[e]),t};function Fc(e,t){const n=document.createElement("canvas");n.width=e.width,n.height=e.height,n.getContext("2d")?.drawImage(e,0,0,n.width,n.height);const r=function(e,t,n,r,i,o,a){for(var l=new ImageData(t,n),s=new Int32Array(e.data.buffer),c=e.width,u=new Int32Array(l.data.buffer),h=l.width,f=t/o,d=n/a,p=Math.round(1/f),v=Math.round(1/d),m=p*v,g=0;g<l.height;g++)for(var y=0;y<h;y++){for(var b=r+Math.round(y/f)+(i+Math.round(g/d))*c,w=0,x=0,E=0,_=0,z=0;z<v;z++)for(var S=0;S<p;S++){var C=s[b+S+z*c];w+=C<<24>>>24,x+=C<<16>>>24,E+=C<<8>>>24,_+=C>>>24}w=Math.round(w/m),x=Math.round(x/m),E=Math.round(E/m),_=Math.round(_/m),u[y+g*h]=_<<24|E<<16|x<<8|w}return l}(n.getContext("2d").getImageData(0,0,n.width,n.height),Math.floor(n.width*t),Math.floor(n.height*t),0,0,n.width,n.height);return n.width=Math.floor(n.width*t),n.height=Math.floor(n.height*t),n.getContext("2d")?.putImageData(r,0,0),n}const Bc=document.createElement("canvas"),Uc=ei((({element:e})=>{const t=Math.min(30,e.width/4,e.height/4),r=n(d).useRef(null);return n(d).useEffect((()=>{const e=r.current;if(!e)return;const t=new pl.Animation((t=>{e.rotate((t?.timeDiff||0)/2)}),e.getLayer());return t.start(),()=>{t.stop()}})),(0,s.jsxs)(As,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.opacity,hideInExport:!e.showInExport,children:[(0,s.jsx)(ks,{width:e.width,height:e.height,fill:"rgba(124, 173, 212, 0.8)"}),(0,s.jsx)("Arc",{ref:r,x:e.width/2,y:e.height/2,fill:"white",outerRadius:Math.abs(t),innerRadius:Math.max(1,t-5),angle:270})]})})),Gc=ei((({element:e})=>{const t="Can not load the image...",n=Math.max(10,Math.min(30,e.width/t.length));return(0,s.jsxs)(As,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.opacity,hideInExport:!e.showInExport,children:[(0,s.jsx)(ks,{width:e.width,height:e.height,fill:"rgba(223, 102, 102, 0.8)"}),(0,s.jsx)(Ts,{text:t,fontSize:n,width:e.width,height:e.height,align:"center",fill:"white",verticalAlign:"middle",padding:5})]})}));let qc=n(js);const Wc=(e,t)=>{const r=n(d).useRef(),i=()=>{r.current?.(),r.current=void 0};n(d).useEffect((()=>i),[]),n(d).useLayoutEffect((()=>{"loading"!==e||r.current||(r.current=Ws(`image ${t}`)),"loading"!==e&&i(),"failed"===e&&Xs(`image ${t}`)}),[e])},Kc=ei((({element:e,store:t})=>{const[r,i]=n(d).useState(!1),o=n(d).useRef(null),a=n(d).useRef(null),[l,c]=n(d).useState(!1),u=t.selectedElements.indexOf(e)>=0,[h,f]=(e=>{const[t,r]=n(d).useReducer((e=>e+1),0),i=n(d).useRef("loading"),o=n(d).useRef(e.src),a=n(d).useRef(e.src);return a.current!==e.src&&(a.current=e.src,i.current="loading"),n(d).useEffect((()=>{if("image"===e.type)return;if(!e.src)return;let t=!1;return(async()=>{i.current="loading",r();const n=Vc(Rc(await Tc(e.src)),e.colorsReplace);t||(o.current=n,i.current="loaded",r())})(),()=>{t=!0}}),[e.src,JSON.stringify(e.colorsReplace)]),"image"===e.type?[e.src,"loaded"]:[o.current,i.current]})(e),[p,v]=qc(h,"anonymous"),m="svg"!==e.type||"loaded"===f?v:"loading";Wc(m,e.id);const g=(({image:e,status:t,type:r})=>{const i=n(d).useRef();return n(d).useEffect((()=>{i.current=e||i.current}),[e]),"failed"!==t||"failed"!==t&&"svg"===r?i.current:void 0})({image:p,status:v,type:e.type}),y=((e,t)=>{const[r,i]=qc(e.maskSrc,"anonymous"),o=e.maskSrc?i:"loaded";return Wc(o,e.id),n(d).useMemo((()=>{if(!r)return t;if(!t||!t.width||!t.height)return t;const n=document.createElement("canvas");n.width=Math.max(t.width,1),n.height=Math.max(t.height,1);const i=n.getContext("2d");if(!i)return t;i.drawImage(t,0,0),i.globalCompositeOperation="source-in";const o=function(e,t){const n=t.width/t.height;let r,i;return n>=e.width/e.height?(r=e.width,i=e.width/n):(r=e.height*n,i=e.height),{x:(e.width-r)/2,y:(e.height-i)/2,width:r,height:i}}(r,e);return i.drawImage(r,o.x,o.y,o.width,o.height,0,0,t.width,t.height),n}),[t,r,e.width,e.height])})(e,((e,t,r)=>n(d).useMemo((()=>{const{flipX:n,flipY:i}=e,o="svg"===e.type||e.src.indexOf("data:image/svg+xml")>=0||e.src.indexOf(".svg")>=0;if(!n&&!i&&!o)return t;if(!t||!t.width||!t.height)return null;const a=document.createElement("canvas");let l=1;"svg"===e.type&&(l=Math.max(e.width/t.width*r,e.height/t.height*r)),a.width=Math.max(t.width*l,1),a.height=Math.max(t.height*l,1);let s=n?-a.width:0,c=i?-a.height:0;return a.getContext("2d")?.scale(n?-1:1,i?-1:1),a.getContext("2d")?.drawImage(t,s,c,a.width,a.height),a}),[e.flipX,e.flipY,t,e.width,e.height,r]))(e,p||g,t._elementsPixelRatio))||Bc;let{cropX:b,cropY:w,cropWidth:x,cropHeight:E}=e;"loaded"!==v&&(b=w=0,x=E=1);const _=y.width*x,z=y.height*E,S=e.width/e.height;let C,O;const M=_/z,A="svg"===e.type;A?(C=_,O=z):S>=M?(C=_,O=_/S):(C=z*S,O=z);const k={x:y.width*b,y:y.height*w,width:C,height:O},L=e.cornerRadius??0;let P=((e,t,r,i)=>{const o=Dc(e.clipSrc||""),[a]=qc(o,"anonymous"),l=n(d).useMemo((()=>{if(t&&a)return document.createElement("canvas")}),[t,a]);return n(d).useLayoutEffect((()=>{if(!a)return;if(!t||!t.width||!t.height)return;if(!a||!a.width||!a.height)return;if(!l)return;const n=document.createElement("canvas"),i=Math.max(e.width/a.width*r,e.height/a.height*r);n.width=a.width*i,n.height=a.height*i,n.getContext("2d")?.drawImage(a,0,0,n.width,n.height),l.width=Math.max(t.width,1),l.height=Math.max(t.height,1);const o=l.getContext("2d");o&&(o.save(),o.drawImage(n,0,0,t.width,t.height),o.globalCompositeOperation="source-in",o.drawImage(t,0,0,l.width,l.height),o.restore())}),[l,t,a,e.width,e.height,r,...i]),e.clipSrc&&a?l:t})(e,((e,t,r,i,o=0,a=!1)=>{const l=n(d).useMemo((()=>{if(t&&t.width&&t.height)return document.createElement("canvas")}),[t]);return n(d).useLayoutEffect((()=>{if(!l||!t)return;const n=Math.floor(Math.max(e.width*i,1)),s=Math.floor(Math.max(e.height*i,1));l.width=n,l.height=s;const c=l.getContext("2d");if(!c)return;const u=Math.min(o*i,n/2,s/2);u&&(c.beginPath(),c.moveTo(u,0),c.lineTo(n-u,0),c.arc(n-u,u,u,3*Math.PI/2,0,!1),c.lineTo(n,s-u),c.arc(n-u,s-u,u,0,Math.PI/2,!1),c.lineTo(u,s),c.arc(u,s-u,u,Math.PI/2,Math.PI,!1),c.lineTo(0,u),c.arc(u,u,u,Math.PI,3*Math.PI/2,!1),c.clip());const h=Math.max(e.width/r.width,e.height/r.height)*i,f=e.page._exporting&&cc.imageDownScalingEnabled&&h<1&&!a,d=f?Fc(t,h):t,p=f?{x:Math.floor(r.x*h),y:Math.floor(r.y*h),width:Math.floor(r.width*h),height:Math.floor(r.height*h)}:r;c.drawImage(d,p.x,p.y,p.width,p.height,0,0,l.width,l.height)}),[l,e.width,e.height,r.x,r.y,r.width,r.height,o,i,a,e.page._exporting]),l})(e,y,k,t._elementsPixelRatio,L,r||e._cropModeEnabled||"svg"===e.type),t._elementsPixelRatio,[k,L,t._elementsPixelRatio]);const T=Math.max(e.width/C,e.height/O);n(d).useEffect((()=>{if(!e._cropModeEnabled)return;const t=o.current?.getStage();function n(t){e._cropModeEnabled&&t.target!==a.current&&e.toggleCropMode(!1)}function r(t){e._cropModeEnabled&&"CANVAS"!==t.target.nodeName&&e.toggleCropMode(!1)}return document.body.addEventListener("click",r),t?.on("click",n),t?.on("tap",n),()=>{document.body.removeEventListener("click",r),document.body.removeEventListener("touchstart",r),t?.off("click",n),t?.off("click",n)}}),[e._cropModeEnabled]),n(d).useLayoutEffect((()=>{if(r||e._cropModeEnabled)return;bc(o.current,e);return Kt((()=>{bc(o.current,e)}),{delay:100})}),[y,r,x,E,e._cropModeEnabled]),n(d).useLayoutEffect((()=>{r||e._cropModeEnabled?o.current?.clearCache():bc(o.current,e)}),[r,e.width,e.height,e._cropModeEnabled]),n(d).useEffect((()=>{bc(o.current,e)}),[e.shadowEnabled,e.shadowBlur,e.cornerRadius,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]);const H=n(d).useRef(null),N=n(d).useRef(null),R=n(d).useRef(null);n(d).useLayoutEffect((()=>{e._cropModeEnabled&&(N.current.nodes([H.current]),R.current.nodes([a.current]))}),[e._cropModeEnabled]);const j=t=>{Math.round(t.target.x())>0&&(t.target.x(0),t.target.scaleX(1)),Math.round(t.target.y())>0&&(t.target.y(0),t.target.scaleY(1));const n=t.target.width()*t.target.scaleX(),r=t.target.height()*t.target.scaleY(),i=Math.min(1,C/n),o=Math.min(1,O/r),a=1-i,l=Math.min(a,Math.max(0,Math.round(-t.target.x())/n)),s=1-o,c=Math.min(s,Math.max(0,Math.round(-t.target.y())/r));t.target.setAttrs({x:-l*y.width,y:-c*y.height,scaleX:1,scaleY:1}),e.set({cropX:l,cropY:c,cropWidth:i,cropHeight:o})},V=()=>{"svg"!==e.type&&e.contentEditable&&setTimeout((()=>{e.toggleCropMode(!0)}))},I="svg"===e.type&&g,D="loading"===v&&!I,F="failed"===v,B=!D&&!F,U=n(d).useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),G=B?e.opacity:0;Us(o,G);const q=e.selectable||"admin"===t.role;return(0,s.jsxs)(n(d).Fragment,{children:[D&&(0,s.jsx)(Uc,{element:e}),F&&(0,s.jsx)(Gc,{element:e}),(0,s.jsx)(Ps,{ref:o,name:"element",id:e.id,image:P,x:e.x,y:e.y,width:e.width||1,height:e.height||1,rotation:e.rotation,opacity:G,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:k,listening:q,draggable:e.draggable,hideInExport:!e.showInExport,onMouseEnter:()=>{c(!0)},onMouseLeave:()=>{c(!1)},onDragStart:()=>{t.history.startTransaction()},onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:n=>{e.set({x:n.target.x(),y:n.target.y()}),t.history.endTransaction()},onDblClick:V,onDblTap:V,onTransformStart:()=>{i(!0),t.history.startTransaction(),U.current={cropX:e.cropX,cropY:e.cropY,cropWidth:e.cropWidth,cropHeight:e.cropHeight}},onTransform:t=>{const n=t.currentTarget,r=Math.abs(n.scaleX()-1)<1e-7?1:n.scaleX(),i=Math.abs(n.scaleY()-1)<1e-7?1:n.scaleY();n.scaleX(1),n.scaleY(1);const o=t.target.getStage()?.findOne("Transformer"),a=1-C/y.width,l=Math.min(a,Math.max(0,e.cropX)),s=1-O/y.height,c=Math.min(s,Math.max(0,e.cropY)),u=o.getActiveAnchor(),h=!(u.indexOf("middle")>=0||u.indexOf("center")>=0),f=!h&&r<1&&U.current.cropHeight>O/y.height;let d=h?e.cropWidth:e.cropWidth*r;f&&(d=e.cropWidth);const p=!h&&i<1&&U.current.cropWidth>C/y.width;let v=h?e.cropHeight:e.cropHeight*i;p&&(v=e.cropHeight),A&&(d=e.cropWidth,v=e.cropHeight),e.set({cropX:l,cropY:c,x:n.x(),y:n.y(),width:n.width()*r,height:n.height()*i,rotation:t.target.rotation(),cropWidth:Math.min(d,1-l),cropHeight:Math.min(v,1-c)})},onTransformEnd:n=>{const r=n.currentTarget;e.set({width:r.width(),height:r.height(),x:r.x(),y:r.y(),rotation:n.target.rotation(),cropWidth:C/y.width,cropHeight:O/y.height}),i(!1),t.history.endTransaction()}}),(0,s.jsx)(ks,{x:e.x,y:e.y,width:e.width-e.borderSize,height:e.height-e.borderSize,offsetX:-e.borderSize/2,offsetY:-e.borderSize/2,stroke:e.borderColor,strokeWidth:e.borderSize,listening:!1,visible:!!e.borderSize,rotation:e.rotation,cornerRadius:Math.max(0,L-e.borderSize),hideInExport:!e.showInExport}),e._cropModeEnabled&&(0,s.jsxs)(Fs,{selector:".page-abs-container",enabled:!0,children:[(0,s.jsx)(ks,{x:-1500,y:-1500,width:4500,height:4500,fill:"rgba(0,0,0,0.3)"}),(0,s.jsx)(Ps,{listening:!1,image:P,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur}),(0,s.jsxs)(As,{x:e.x,y:e.y,rotation:e.rotation,scaleX:T,scaleY:T,children:[(0,s.jsx)(Ps,{image:y,ref:a,opacity:.4,draggable:!0,x:-e.cropX*y.width,y:-e.cropY*y.height,onDragMove:j,onTransform:j}),(0,s.jsx)(Hs,{ref:R,anchorSize:20,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,rotateEnabled:!1,borderEnabled:!1,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2}),(0,s.jsx)(ks,{width:C,height:O,ref:H,listening:!1,onTransform:t=>{t.target.x()<-e.cropX*y.width-1e-9&&(t.target.x(-e.cropX*y.width),t.target.scaleX(1)),t.target.y()<-e.cropY*y.height-1e-9&&(t.target.y(-e.cropY*y.height),t.target.scaleY(1));const n=Math.min(1,Math.max(0,e.cropX+t.target.x()/y.width)),r=Math.min(1,Math.max(0,t.target.y()/y.height+e.cropY)),i=t.target.width()*t.target.scaleX(),o=t.target.height()*t.target.scaleY(),a=Math.min(1-n,i/y.width),l=Math.min(1-r,o/y.height),s=t.target.getAbsolutePosition(t.target.getParent().getParent());t.target.scale({x:1,y:1}),t.target.position({x:0,y:0}),e.set({x:s.x,y:s.y,cropX:n,cropY:r,cropWidth:a,cropHeight:l,width:Math.min(i*T,y.width*(1-n)*T),height:Math.min(o*T,y.height*(1-r)*T)})}}),(0,s.jsx)(Hs,{ref:N,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,keepRatio:!1,rotateEnabled:!1,anchorFill:"rgb(240, 240, 240)",anchorStrokeWidth:2,borderStrokeWidth:2})]})]}),(l||u)&&(0,s.jsx)(wc,{element:e})]})}));d=l("8NFma");var Yc,$c,Xc,Qc={};$c=function(e){var t,n,r=au(e),i=r[0],o=r[1],a=new nu(function(e,t,n){return 3*(t+n)/4-n}(0,i,o)),l=0,s=o>0?i-4:i;for(n=0;n<s;n+=4)t=tu[e.charCodeAt(n)]<<18|tu[e.charCodeAt(n+1)]<<12|tu[e.charCodeAt(n+2)]<<6|tu[e.charCodeAt(n+3)],a[l++]=t>>16&255,a[l++]=t>>8&255,a[l++]=255&t;2===o&&(t=tu[e.charCodeAt(n)]<<2|tu[e.charCodeAt(n+1)]>>4,a[l++]=255&t);1===o&&(t=tu[e.charCodeAt(n)]<<10|tu[e.charCodeAt(n+1)]<<4|tu[e.charCodeAt(n+2)]>>2,a[l++]=t>>8&255,a[l++]=255&t);return a},Xc=function(e){for(var t,n=e.length,r=n%3,i=[],o=16383,a=0,l=n-r;a<l;a+=o)i.push(lu(e,a,a+o>l?l:a+o));1===r?(t=e[n-1],i.push(eu[t>>2]+eu[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],i.push(eu[t>>10]+eu[t>>4&63]+eu[t<<2&63]+"="));return i.join("")}
|
|
34
|
+
!function(e){"use strict";function t(){return h.createDocumentFragment()}function n(e){return h.createElement(e)}function r(e,t){if(!e)throw new Error("Failed to construct "+t+": 1 argument required, but only 0 present.")}function i(e){if(1===e.length)return o(e[0]);for(var n=t(),r=T.call(e),i=0;i<e.length;i++)n.appendChild(o(r[i]));return n}function o(e){return"object"==typeof e?e:h.createTextNode(e)}for(var a,l,s,c,u,h=e.document,f=Object.prototype.hasOwnProperty,d=Object.defineProperty||function(e,t,n){return f.call(n,"value")?e[t]=n.value:(f.call(n,"get")&&e.__defineGetter__(t,n.get),f.call(n,"set")&&e.__defineSetter__(t,n.set)),e},p=[].indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},v=function(e){var t=void 0===e.className,n=t?e.getAttribute("class")||"":e.className,r=t||"object"==typeof n,i=(r?t?n:n.baseVal:n).replace(g,"");i.length&&P.push.apply(this,i.split(y)),this._isSVG=r,this._=e},m={get:function(){return new v(this)},set:function(){}},g=/^\s+|\s+$/g,y=/\s+/,b="classList",w=function(e,t){return this.contains(e)?t||this.remove(e):(void 0===t||t)&&(t=!0,this.add(e)),!!t},x=e.DocumentFragment&&DocumentFragment.prototype,E=e.Node,_=(E||Element).prototype,z=e.CharacterData||E,S=z&&z.prototype,C=e.DocumentType,O=C&&C.prototype,M=(e.Element||E||e.HTMLElement).prototype,A=e.HTMLSelectElement||n("select").constructor,k=A.prototype.remove,L=e.SVGElement,P=["matches",M.matchesSelector||M.webkitMatchesSelector||M.khtmlMatchesSelector||M.mozMatchesSelector||M.msMatchesSelector||M.oMatchesSelector||function(e){var t=this.parentNode;return!!t&&-1<p.call(t.querySelectorAll(e),this)},"closest",function(e){for(var t,n=this;(t=n&&n.matches)&&!n.matches(e);)n=n.parentNode;return t?n:null},"prepend",function(){var e=this.firstChild,t=i(arguments);e?this.insertBefore(t,e):this.appendChild(t)},"append",function(){this.appendChild(i(arguments))},"before",function(){var e=this.parentNode;e&&e.insertBefore(i(arguments),this)},"after",function(){var e=this.parentNode,t=this.nextSibling,n=i(arguments);e&&(t?e.insertBefore(n,t):e.appendChild(n))},"toggleAttribute",function(e,t){var n=this.hasAttribute(e);return 1<arguments.length?n&&!t?this.removeAttribute(e):t&&!n&&this.setAttribute(e,""):n?this.removeAttribute(e):this.setAttribute(e,""),this.hasAttribute(e)},"replace",function(){this.replaceWith.apply(this,arguments)},"replaceWith",function(){var e=this.parentNode;e&&e.replaceChild(i(arguments),this)},"remove",function(){var e=this.parentNode;e&&e.removeChild(this)}],T=P.slice,H=P.length;H;H-=2)if((l=P[H-2])in M||(M[l]=P[H-1]),"remove"!==l||k._dom4||((A.prototype[l]=function(){return 0<arguments.length?k.apply(this,arguments):M.remove.call(this)})._dom4=!0),/^(?:before|after|replace|replaceWith|remove)$/.test(l)&&(z&&!(l in S)&&(S[l]=P[H-1]),C&&!(l in O)&&(O[l]=P[H-1])),/^(?:append|prepend)$/.test(l))if(x)l in x||(x[l]=P[H-1]);else try{t().constructor.prototype[l]=P[H-1]}catch(e){}var N;n("a").matches("a")||(M[l]=(N=M[l],function(e){return N.call(this.parentNode?this:t().appendChild(this),e)})),v.prototype={length:0,add:function(){for(var e,t=0;t<arguments.length;t++)e=arguments[t],this.contains(e)||P.push.call(this,l);this._isSVG?this._.setAttribute("class",""+this):this._.className=""+this},contains:function(e){return function(t){return H=e.call(this,l=function(e){if(!e)throw"SyntaxError";if(y.test(e))throw"InvalidCharacterError";return e}(t)),-1<H}}([].indexOf||function(e){for(H=this.length;H--&&this[H]!==e;);return H}),item:function(e){return this[e]||null},remove:function(){for(var e,t=0;t<arguments.length;t++)e=arguments[t],this.contains(e)&&P.splice.call(this,H,1);this._isSVG?this._.setAttribute("class",""+this):this._.className=""+this},toggle:w,toString:function(){return P.join.call(this," ")}},L&&!(b in L.prototype)&&d(L.prototype,b,m),b in h.documentElement?((c=n("div").classList).add("a","b","a"),"a b"!=c&&("add"in(s=c.constructor.prototype)||(s=e.TemporaryTokenList.prototype),u=function(e){return function(){for(var t=0;t<arguments.length;)e.call(this,arguments[t++])}},s.add=u(s.add),s.remove=u(s.remove),s.toggle=w)):d(M,b,m),"contains"in _||d(_,"contains",{value:function(e){for(;e&&e!==this;)e=e.parentNode;return this===e}}),"head"in h||d(h,"head",{get:function(){return a||(a=h.getElementsByTagName("head")[0])}}),function(){for(var t,n=e.requestAnimationFrame,r=e.cancelAnimationFrame,i=["o","ms","moz","webkit"],o=i.length;!r&&o--;)n=n||e[i[o]+"RequestAnimationFrame"],r=e[i[o]+"CancelAnimationFrame"]||e[i[o]+"CancelRequestAnimationFrame"];r||(n?(t=n,n=function(e){var n=!0;return t((function(){n&&e.apply(this,arguments)})),function(){n=!1}},r=function(e){e()}):(n=function(e){return setTimeout(e,15,15)},r=function(e){clearTimeout(e)})),e.requestAnimationFrame=n,e.cancelAnimationFrame=r}();try{new e.CustomEvent("?")}catch(t){e.CustomEvent=function(e,t){function n(e,t,n,r){this.initEvent(e,t,n),this.detail=r}return function(r,i){var o=h.createEvent(e);if("string"!=typeof r)throw new Error("An event name must be provided");return"Event"==e&&(o.initCustomEvent=n),null==i&&(i=t),o.initCustomEvent(r,i.bubbles,i.cancelable,i.detail),o}}(e.CustomEvent?"CustomEvent":"Event",{bubbles:!1,cancelable:!1,detail:null})}try{new Event("_")}catch(t){t=function(e){function t(e,t){r(arguments.length,"Event");var n=h.createEvent("Event");return t||(t={}),n.initEvent(e,!!t.bubbles,!!t.cancelable),n}return t.prototype=e.prototype,t}(e.Event||function(){}),d(e,"Event",{value:t}),Event!==t&&(Event=t)}try{new KeyboardEvent("_",{})}catch(t){t=function(t){var n,i=0,o={char:"",key:"",location:0,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1,altGraphKey:!1,repeat:!1,locale:navigator.language,detail:0,bubbles:!1,cancelable:!1,keyCode:0,charCode:0,which:0};try{var a=h.createEvent("KeyboardEvent");a.initKeyboardEvent("keyup",!1,!1,e,"+",3,!0,!1,!0,!1,!1),i="+"==(a.keyIdentifier||a.key)&&3==(a.keyLocation||a.location)&&(a.ctrlKey?a.altKey?1:3:a.shiftKey?2:4)||9}catch(e){}function l(e){for(var t=[],n=["ctrlKey","Control","shiftKey","Shift","altKey","Alt","metaKey","Meta","altGraphKey","AltGraph"],r=0;r<n.length;r+=2)e[n[r]]&&t.push(n[r+1]);return t.join(" ")}function s(e,t){for(var n in t)t.hasOwnProperty(n)&&!t.hasOwnProperty.call(e,n)&&(e[n]=t[n]);return e}function c(e,t,n){try{t[e]=n[e]}catch(e){}}function u(t,a){r(arguments.length,"KeyboardEvent"),a=s(a||{},o);var u,f=h.createEvent(n),d=a.ctrlKey,p=a.shiftKey,v=a.altKey,m=a.metaKey,g=a.altGraphKey,y=i>3?l(a):null,b=String(a.key),w=String(a.char),x=a.location,E=a.keyCode||(a.keyCode=b)&&b.charCodeAt(0)||0,_=a.charCode||(a.charCode=w)&&w.charCodeAt(0)||0,z=a.bubbles,S=a.cancelable,C=a.repeat,O=a.locale,M=a.view||e;if(a.which||(a.which=a.keyCode),"initKeyEvent"in f)f.initKeyEvent(t,z,S,M,d,v,p,m,E,_);else if(0<i&&"initKeyboardEvent"in f){switch(u=[t,z,S,M],i){case 1:u.push(b,x,d,p,v,m,g);break;case 2:u.push(d,v,p,m,E,_);break;case 3:u.push(b,x,d,v,p,m,g);break;case 4:u.push(b,x,y,C,O);break;default:u.push(char,b,x,y,C,O)}f.initKeyboardEvent.apply(f,u)}else f.initEvent(t,z,S);for(b in f)o.hasOwnProperty(b)&&f[b]!==a[b]&&c(b,f,a);return f}return n=0<i?"KeyboardEvent":"Event",u.prototype=t.prototype,u}(e.KeyboardEvent||function(){}),d(e,"KeyboardEvent",{value:t}),KeyboardEvent!==t&&(KeyboardEvent=t)}try{new MouseEvent("_",{})}catch(t){t=function(t){function n(t,n){r(arguments.length,"MouseEvent");var i=h.createEvent("MouseEvent");return n||(n={}),i.initMouseEvent(t,!!n.bubbles,!!n.cancelable,n.view||e,n.detail||1,n.screenX||0,n.screenY||0,n.clientX||0,n.clientY||0,!!n.ctrlKey,!!n.altKey,!!n.shiftKey,!!n.metaKey,n.button||0,n.relatedTarget||null),i}return n.prototype=t.prototype,n}(e.MouseEvent||function(){}),d(e,"MouseEvent",{value:t}),MouseEvent!==t&&(MouseEvent=t)}h.querySelectorAll("*").forEach||function(){function e(e){var t=e.querySelectorAll;e.querySelectorAll=function(e){var n=t.call(this,e);return n.forEach=Array.prototype.forEach,n}}e(h),e(Element.prototype)}();try{h.querySelector(":scope *")}catch(e){!function(){var e="data-scope-"+(1e9*Math.random()>>>0),t=Element.prototype,n=t.querySelector,r=t.querySelectorAll;function i(t,n,r){if(t.type!=h.ELEMENT_NODE)return n.call(t,r);t.setAttribute(e,null);var i=n.call(t,String(r).replace(/(^|,\s*)(:scope([ >]|$))/g,(function(t,n,r,i){return n+"["+e+"]"+(i||" ")})));return t.removeAttribute(e),i}t.querySelector=function(e){return i(this,n,e)},t.querySelectorAll=function(e){return i(this,r,e)}}()}}(window),function(e){"use strict";var t=e.WeakMap||function(){var e,t=0,n=!1,r=!1;function i(t,i,o){r=o,n=!1,e=void 0,t.dispatchEvent(i)}function o(e){this.value=e}function l(){t++,this.__ce__=new a("@DOMMap:"+t+Math.random())}return o.prototype.handleEvent=function(t){n=!0,r?t.currentTarget.removeEventListener(t.type,this,!1):e=this.value},l.prototype={constructor:l,delete:function(e){return i(e,this.__ce__,!0),n},get:function(t){i(t,this.__ce__,!1);var n=e;return e=void 0,n},has:function(e){return i(e,this.__ce__,!1),n},set:function(e,t){return i(e,this.__ce__,!0),e.addEventListener(this.__ce__.type,new o(t),!1),this}},l}();function n(){}function r(e,t,n){function i(e){i.once&&(e.currentTarget.removeEventListener(e.type,t,i),i.removed=!0),i.passive&&(e.preventDefault=r.preventDefault),"function"==typeof i.callback?i.callback.call(this,e):i.callback&&i.callback.handleEvent(e),i.passive&&delete e.preventDefault}return i.type=e,i.callback=t,i.capture=!!n.capture,i.passive=!!n.passive,i.once=!!n.once,i.removed=!1,i}n.prototype=(Object.create||Object)(null),r.preventDefault=function(){};var i,o,a=e.CustomEvent,l=e.dispatchEvent,s=e.addEventListener,c=e.removeEventListener,u=0,h=function(){u++},f=[].indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},d=function(e){return"".concat(e.capture?"1":"0",e.passive?"1":"0",e.once?"1":"0")};try{s("_",h,{once:!0}),l(new a("_")),l(new a("_")),c("_",h,{once:!0})}catch(e){}1!==u&&(o=new t,i=function(e){if(e){var t=e.prototype;t.addEventListener=function(e){return function(t,i,a){if(a&&"boolean"!=typeof a){var l,s,c,u=o.get(this),h=d(a);u||o.set(this,u=new n),t in u||(u[t]={handler:[],wrap:[]}),s=u[t],(l=f.call(s.handler,i))<0?(l=s.handler.push(i)-1,s.wrap[l]=c=new n):c=s.wrap[l],h in c||(c[h]=r(t,i,a),e.call(this,t,c[h],c[h].capture))}else e.call(this,t,i,a)}}(t.addEventListener),t.removeEventListener=function(e){return function(t,n,r){if(r&&"boolean"!=typeof r){var i,a,l,s,c=o.get(this);if(c&&t in c&&(l=c[t],-1<(a=f.call(l.handler,n))&&(i=d(r))in(s=l.wrap[a]))){for(i in e.call(this,t,s[i],s[i].capture),delete s[i],s)return;l.handler.splice(a,1),l.wrap.splice(a,1),0===l.handler.length&&delete c[t]}}else e.call(this,t,n,r)}}(t.removeEventListener)}},e.EventTarget?i(EventTarget):(i(e.Text),i(e.Element||e.HTMLElement),i(e.HTMLDocument),i(e.Window||{prototype:e}),i(e.XMLHttpRequest)))}(self)})),l.register("ljnRB",(function(e,t){"use strict";var n=Object.prototype.toString;e.exports=function(e){var t=n.call(e),r="[object Arguments]"===t;return r||(r="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===n.call(e.callee)),r}})),l.register("gaMM3",(function(e,t){"use strict";var n;if(!Object.keys){var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=l("ljnRB"),a=Object.prototype.propertyIsEnumerable,s=!a.call({toString:null},"toString"),c=a.call((function(){}),"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],h=function(e){var t=e.constructor;return t&&t.prototype===e},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!f["$"+e]&&r.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{h(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();n=function(e){var t=null!==e&&"object"==typeof e,n="[object Function]"===i.call(e),a=o(e),l=t&&"[object String]"===i.call(e),f=[];if(!t&&!n&&!a)throw new TypeError("Object.keys called on a non-object");var p=c&&n;if(l&&e.length>0&&!r.call(e,0))for(var v=0;v<e.length;++v)f.push(String(v));if(a&&e.length>0)for(var m=0;m<e.length;++m)f.push(String(m));else for(var g in e)p&&"prototype"===g||!r.call(e,g)||f.push(String(g));if(s)for(var y=function(e){if("undefined"==typeof window||!d)return h(e);try{return h(e)}catch(e){return!1}}(e),b=0;b<u.length;++b)y&&"constructor"===u[b]||!r.call(e,u[b])||f.push(u[b]);return f}}e.exports=n})),l.register("kDaAc",(function(e,t){"use strict";var n=l("3ukNm");e.exports=function(){return n()&&!!Symbol.toStringTag}})),l.register("3ukNm",(function(e,t){"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}})),l.register("dKI7M",(function(e,t){"use strict";var n="undefined"!=typeof Symbol&&Symbol,r=l("3ukNm");e.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&r())))}})),l.register("aszze",(function(e,t){"use strict";var n=l("2DXy1")("%Object.defineProperty%",!0),r=function(){if(n)try{return n({},"a",{value:1}),!0}catch(e){return!1}return!1};r.hasArrayLengthDefineBug=function(){if(!r())return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=r})),l.register("2DXy1",(function(e,t){"use strict";var n,r=SyntaxError,i=Function,o=TypeError,a=function(e){try{return i('"use strict"; return ('+e+").constructor;")()}catch(e){}},s=Object.getOwnPropertyDescriptor;if(s)try{s({},"")}catch(e){s=null}var c=function(){throw new o},u=s?function(){try{return c}catch(e){try{return s(arguments,"callee").get}catch(e){return c}}}():c,h=l("dKI7M")(),f=Object.getPrototypeOf||function(e){return e.__proto__},d={},p="undefined"==typeof Uint8Array?n:f(Uint8Array),v={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":h?f([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":d,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h?f(f([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&h?f((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&h?f((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h?f(""[Symbol.iterator]()):n,"%Symbol%":h?Symbol:n,"%SyntaxError%":r,"%ThrowTypeError%":u,"%TypedArray%":p,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet},m=function e(t){var n;if("%AsyncFunction%"===t)n=a("async function () {}");else if("%GeneratorFunction%"===t)n=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=a("async function* () {}");else if("%AsyncGenerator%"===t){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&(n=f(i.prototype))}return v[t]=n,n},g={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},y=l("6FqDH"),b=l("7Dpjp"),w=y.call(Function.call,Array.prototype.concat),x=y.call(Function.apply,Array.prototype.splice),E=y.call(Function.call,String.prototype.replace),_=y.call(Function.call,String.prototype.slice),z=y.call(Function.call,RegExp.prototype.exec),S=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,C=/\\(\\)?/g,O=function(e){var t=_(e,0,1),n=_(e,-1);if("%"===t&&"%"!==n)throw new r("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new r("invalid intrinsic syntax, expected opening `%`");var i=[];return E(e,S,(function(e,t,n,r){i[i.length]=n?E(r,C,"$1"):t||e})),i},M=function(e,t){var n,i=e;if(b(g,i)&&(i="%"+(n=g[i])[0]+"%"),b(v,i)){var a=v[i];if(a===d&&(a=m(i)),void 0===a&&!t)throw new o("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:a}}throw new r("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new o('"allowMissing" argument must be a boolean');if(null===z(/^%?[^%]*%?$/g,e))throw new r("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=O(e),i=n.length>0?n[0]:"",a=M("%"+i+"%",t),l=a.name,c=a.value,u=!1,h=a.alias;h&&(i=h[0],x(n,w([0,1],h)));for(var f=1,d=!0;f<n.length;f+=1){var p=n[f],m=_(p,0,1),g=_(p,-1);if(('"'===m||"'"===m||"`"===m||'"'===g||"'"===g||"`"===g)&&m!==g)throw new r("property names with quotes must have matching quotes");if("constructor"!==p&&d||(u=!0),b(v,l="%"+(i+="."+p)+"%"))c=v[l];else if(null!=c){if(!(p in c)){if(!t)throw new o("base intrinsic for "+e+" exists, but the property is not available.");return}if(s&&f+1>=n.length){var y=s(c,p);c=(d=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:c[p]}else d=b(c,p),c=c[p];d&&!u&&(v[l]=c)}}return c}})),l.register("6FqDH",(function(e,t){"use strict";var n=l("kfm3A");e.exports=Function.prototype.bind||n})),l.register("kfm3A",(function(e,t){"use strict";var n="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,i=Object.prototype.toString,o="[object Function]";e.exports=function(e){var t=this;if("function"!=typeof t||i.call(t)!==o)throw new TypeError(n+t);for(var a,l=r.call(arguments,1),s=function(){if(this instanceof a){var n=t.apply(this,l.concat(r.call(arguments)));return Object(n)===n?n:this}return t.apply(e,l.concat(r.call(arguments)))},c=Math.max(0,t.length-l.length),u=[],h=0;h<c;h++)u.push("$"+h);if(a=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this,arguments); }")(s),t.prototype){var f=function(){};f.prototype=t.prototype,a.prototype=new f,f.prototype=null}return a}})),l.register("7Dpjp",(function(e,t){"use strict";var n=l("6FqDH");e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)})),l.register("7OiON",(function(e,t){"use strict";var n=function(){return"string"==typeof function(){}.name},r=Object.getOwnPropertyDescriptor;if(r)try{r([],"length")}catch(e){r=null}n.functionsHaveConfigurableNames=function(){if(!n()||!r)return!1;var e=r((function(){}),"name");return!!e&&!!e.configurable};var i=Function.prototype.bind;n.boundFunctionsHaveNames=function(){return n()&&"function"==typeof i&&""!==function(){}.bind().name},e.exports=n})),l.register("6DzO8",(function(e,t){"use strict";var n=l("iz60K");function r(){}function i(){}i.resetWarningCache=r,e.exports=function(){function e(e,t,r,i,o,a){if(a!==n){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var o={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return o.PropTypes=o,o}})),l.register("iz60K",(function(e,t){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"})),l.register("9e2tS",(function(e,t){var n=l("eeOBM"),r=l("hKlAl"),i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,a=o&&o.exports===i?n.Buffer:void 0,s=(a?a.isBuffer:void 0)||r;e.exports=s})),l.register("eeOBM",(function(e,t){var n=l("gipFg"),r="object"==typeof self&&self&&self.Object===Object&&self,i=n||r||Function("return this")();e.exports=i})),l.register("gipFg",(function(e,n){var r="object"==typeof t&&t&&t.Object===Object&&t;e.exports=r})),l.register("hKlAl",(function(e,t){e.exports=function(){return!1}})),l.register("fwpsA",(function(e,t){var n=l("gipFg"),r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,o=i&&i.exports===r&&n.process,a=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a})),l.register("lJ72B",(function(e,t){var n=l("eeOBM"),r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,o=i&&i.exports===r?n.Buffer:void 0,a=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=a?a(n):new e.constructor(n);return e.copy(r),r}})),l.register("gkF63",(function(t,n){e(t.exports,"default",(()=>c),(e=>c=e));var r=l("aMdtS"),i=n&&!n.nodeType&&n,o=i&&t&&!t.nodeType&&t,a=o&&o.exports===i?r.default.Buffer:void 0,s=a?a.allocUnsafe:void 0;var c=function(e,t){if(t)return e.slice();var n=e.length,r=s?s(n):new e.constructor(n);return e.copy(r),r}})),l.register("aMdtS",(function(t,n){e(t.exports,"default",(()=>o));var r=l("cK2jL"),i="object"==typeof self&&self&&self.Object===Object&&self,o=r.default||i||Function("return this")()})),l.register("cK2jL",(function(n,r){e(n.exports,"default",(()=>i));var i="object"==typeof t&&t&&t.Object===Object&&t})),l.register("jxBAt",(function(t,n){e(t.exports,"default",(()=>c),(e=>c=e));var r=l("aMdtS"),i=l("k0bFH"),o=n&&!n.nodeType&&n,a=o&&t&&!t.nodeType&&t,s=a&&a.exports===o?r.default.Buffer:void 0,c=(s?s.isBuffer:void 0)||i.default})),l.register("k0bFH",(function(t,n){e(t.exports,"default",(()=>r));var r=function(){return!1}})),l.register("h8ok7",(function(t,n){e(t.exports,"default",(()=>s),(e=>s=e));var r=l("cK2jL"),i=n&&!n.nodeType&&n,o=i&&t&&!t.nodeType&&t,a=o&&o.exports===i&&r.default.process,s=function(){try{var e=o&&o.require&&o.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(e){}}()}));var s;s=l("89wqa"),l("8NFma");var c,u,h={};e(h,"createRoot",(()=>c),(e=>c=e)),e(h,"hydrateRoot",(()=>u),(e=>u=e));var f={};!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),f=l("23wBm"),c=f.createRoot,u=f.hydrateRoot;var d=l("8NFma");function p(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error("number"==typeof e?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var v={};function m(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:v}var g=Object.assign,y=Object.getOwnPropertyDescriptor,b=Object.defineProperty,w=Object.prototype,x=[];Object.freeze(x);var E={};Object.freeze(E);var _="undefined"!=typeof Proxy,z=Object.toString();function S(){_||p("Proxy not available")}function C(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var O=function(){};function M(e){return"function"==typeof e}function A(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function k(e){return null!==e&&"object"==typeof e}function L(e){if(!k(e))return!1;var t=Object.getPrototypeOf(e);if(null==t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n.toString()===z}function P(e){var t=null==e?void 0:e.constructor;return!!t&&("GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName)}function T(e,t,n){b(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function H(e,t,n){b(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function N(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return k(e)&&!0===e[n]}}function R(e){return e instanceof Map}function j(e){return e instanceof Set}var V=void 0!==Object.getOwnPropertySymbols;var I="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:V?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function D(e){return null===e?null:"object"==typeof e?""+e:e}function F(e,t){return w.hasOwnProperty.call(e,t)}var B=Object.getOwnPropertyDescriptors||function(e){var t={};return I(e).forEach((function(n){t[n]=y(e,n)})),t};function U(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function G(e,t,n){return t&&U(e.prototype,t),n&&U(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function q(){return q=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},q.apply(this,arguments)}function W(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,K(e,t)}function K(e,t){return K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},K(e,t)}function Y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function X(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return $(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Q=Symbol("mobx-stored-annotations");function Z(e){return Object.assign((function(t,n){J(t,n,e)}),e)}function J(e,t,n){F(e,Q)||T(e,Q,q({},e[Q])),function(e){return e.annotationType_===le}(n)||(e[Q][t]=n)}var ee=Symbol("mobx administration"),te=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=tt.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return Mt(this)},t.reportChanged=function(){Ct(),At(this),Ot()},t.toString=function(){return this.name_},e}(),ne=N("Atom",te);function re(e,t,n){void 0===t&&(t=O),void 0===n&&(n=O);var r,i=new te(e);return t!==O&&Jt(Qt,i,t,r),n!==O&&Zt(i,n),i}var ie={identity:function(e,t){return e===t},structural:function(e,t){return Or(e,t)},default:function(e,t){return Object.is?Object.is(e,t):e===t?0!==e||1/e==1/t:e!=e&&t!=t},shallow:function(e,t){return Or(e,t,1)}};function oe(e,t,n){return mn(e)?e:Array.isArray(e)?je.array(e,{name:n}):L(e)?je.object(e,void 0,{name:n}):R(e)?je.map(e,{name:n}):j(e)?je.set(e,{name:n}):"function"!=typeof e||Wt(e)||fn(e)?e:P(e)?un(e):Gt(n,e)}function ae(e){return e}var le="override";function se(e,t){return{annotationType_:e,options_:t,make_:ce,extend_:ue}}function ce(e,t,n,r){var i;if(null!=(i=this.options_)&&i.bound)return null===this.extend_(e,t,n,!1)?0:1;if(r===e.target_)return null===this.extend_(e,t,n,!1)?0:2;if(Wt(n.value))return 1;var o=he(e,this,t,n,!1);return b(r,t,o),2}function ue(e,t,n,r){var i=he(e,this,t,n);return e.defineProperty_(t,i,r)}function he(e,t,n,r,i){var o,a,l,s,c,u,h,f;void 0===i&&(i=Et.safeDescriptors),f=r,t.annotationType_,f.value;var d,p=r.value;null!=(o=t.options_)&&o.bound&&(p=p.bind(null!=(d=e.proxy_)?d:e.target_));return{value:Ke(null!=(a=null==(l=t.options_)?void 0:l.name)?a:n.toString(),p,null!=(s=null==(c=t.options_)?void 0:c.autoAction)&&s,null!=(u=t.options_)&&u.bound?null!=(h=e.proxy_)?h:e.target_:void 0),configurable:!i||e.isPlainObject_,enumerable:!1,writable:!i}}function fe(e,t){return{annotationType_:e,options_:t,make_:de,extend_:pe}}function de(e,t,n,r){var i;if(r===e.target_)return null===this.extend_(e,t,n,!1)?0:2;if(null!=(i=this.options_)&&i.bound&&(!F(e.target_,t)||!fn(e.target_[t]))&&null===this.extend_(e,t,n,!1))return 0;if(fn(n.value))return 1;var o=ve(e,this,t,n,!1,!1);return b(r,t,o),2}function pe(e,t,n,r){var i,o=ve(e,this,t,n,null==(i=this.options_)?void 0:i.bound);return e.defineProperty_(t,o,r)}function ve(e,t,n,r,i,o){var a;void 0===o&&(o=Et.safeDescriptors),a=r,t.annotationType_,a.value;var l,s=r.value;(fn(s)||(s=un(s)),i)&&((s=s.bind(null!=(l=e.proxy_)?l:e.target_)).isMobXFlow=!0);return{value:s,configurable:!o||e.isPlainObject_,enumerable:!1,writable:!o}}function me(e,t){return{annotationType_:e,options_:t,make_:ge,extend_:ye}}function ge(e,t,n){return null===this.extend_(e,t,n,!1)?0:1}function ye(e,t,n,r){var i;return i=n,this.annotationType_,i.get,e.defineComputedProperty_(t,q({},this.options_,{get:n.get,set:n.set}),r)}function be(e,t){return{annotationType_:e,options_:t,make_:we,extend_:xe}}function we(e,t,n){return null===this.extend_(e,t,n,!1)?0:1}function xe(e,t,n,r){var i,o;return this.annotationType_,e.defineObservableProperty_(t,n.value,null!=(i=null==(o=this.options_)?void 0:o.enhancer)?i:oe,r)}var Ee=_e();function _e(e){return{annotationType_:"true",options_:e,make_:ze,extend_:Se}}function ze(e,t,n,r){var i,o,a,l;if(n.get)return Fe.make_(e,t,n,r);if(n.set){var s=Ke(t.toString(),n.set);return r===e.target_?null===e.defineProperty_(t,{configurable:!Et.safeDescriptors||e.isPlainObject_,set:s})?0:2:(b(r,t,{configurable:!0,set:s}),2)}if(r!==e.target_&&"function"==typeof n.value)return P(n.value)?(null!=(l=this.options_)&&l.autoBind?un.bound:un).make_(e,t,n,r):(null!=(a=this.options_)&&a.autoBind?Gt.bound:Gt).make_(e,t,n,r);var c,u=!1===(null==(i=this.options_)?void 0:i.deep)?je.ref:je;"function"==typeof n.value&&null!=(o=this.options_)&&o.autoBind&&(n.value=n.value.bind(null!=(c=e.proxy_)?c:e.target_));return u.make_(e,t,n,r)}function Se(e,t,n,r){var i,o,a;if(n.get)return Fe.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:!Et.safeDescriptors||e.isPlainObject_,set:Ke(t.toString(),n.set)},r);"function"==typeof n.value&&null!=(i=this.options_)&&i.autoBind&&(n.value=n.value.bind(null!=(a=e.proxy_)?a:e.target_));return(!1===(null==(o=this.options_)?void 0:o.deep)?je.ref:je).extend_(e,t,n,r)}var Ce={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function Oe(e){return e||Ce}Object.freeze(Ce);var Me=be("observable"),Ae=be("observable.ref",{enhancer:ae}),ke=be("observable.shallow",{enhancer:function(e,t,n){return null==e||ur(e)||Kn(e)||er(e)||rr(e)?e:Array.isArray(e)?je.array(e,{name:n,deep:!1}):L(e)?je.object(e,void 0,{name:n,deep:!1}):R(e)?je.map(e,{name:n,deep:!1}):j(e)?je.set(e,{name:n,deep:!1}):void 0}}),Le=be("observable.struct",{enhancer:function(e,t){return Or(e,t)?t:e}}),Pe=Z(Me);function Te(e){return!0===e.deep?oe:!1===e.deep?ae:(t=e.defaultDecorator)&&null!=(n=null==(r=t.options_)?void 0:r.enhancer)?n:oe;var t,n,r}function He(e,t,n){if(!A(t))return mn(e)?e:L(e)?je.object(e,t,n):Array.isArray(e)?je.array(e,t):R(e)?je.map(e,t):j(e)?je.set(e,t):"object"==typeof e&&null!==e?e:je.box(e,t);J(e,t,Me)}Object.assign(He,Pe);var Ne,Re,je=g(He,{box:function(e,t){var n=Oe(t);return new Je(e,Te(n),n.name,!0,n.equals)},array:function(e,t){var n=Oe(t);return(!1===Et.useProxies||!1===n.proxy?Er:Vn)(e,Te(n),n.name)},map:function(e,t){var n=Oe(t);return new Jn(e,Te(n),n.name)},set:function(e,t){var n=Oe(t);return new nr(e,Te(n),n.name)},object:function(e,t,n){return nn(!1===Et.useProxies||!1===(null==n?void 0:n.proxy)?lr({},n):function(e,t){var n,r;return S(),e=lr(e,t),null!=(r=(n=e[ee]).proxy_)?r:n.proxy_=new Proxy(e,Cn)}({},n),e,t)},ref:Z(Ae),shallow:Z(ke),deep:Pe,struct:Z(Le)}),Ve="computed",Ie=me(Ve),De=me("computed.struct",{equals:ie.structural}),Fe=function(e,t){if(A(t))return J(e,t,Ie);if(L(e))return Z(me(Ve,e));var n=L(t)?t:{};return n.get=e,n.name||(n.name=e.name||""),new ot(n)};Object.assign(Fe,Ie),Fe.struct=Z(De);var Be,Ue=0,Ge=1,qe=null!=(Ne=null==(Re=y((function(){}),"name"))?void 0:Re.configurable)&&Ne,We={value:"action",configurable:!0,writable:!1,enumerable:!1};function Ke(e,t,n,r){function i(){return Ye(e,n,t,r||this,arguments)}return void 0===n&&(n=!1),i.isMobxAction=!0,qe&&(We.value=e,Object.defineProperty(i,"name",We)),i}function Ye(e,t,n,r,i){var o=function(e,t,n,r){var i=!1,o=0,a=Et.trackingDerivation,l=!t||!a;Ct();var s=Et.allowStateChanges;l&&(pt(),s=Xe(!0));var c=mt(!0),u={runAsAction_:l,prevDerivation_:a,prevAllowStateChanges_:s,prevAllowStateReads_:c,notifySpy_:i,startTime_:o,actionId_:Ge++,parentActionId_:Ue};return Ue=u.actionId_,u}(0,t);try{return n.apply(r,i)}catch(e){throw o.error_=e,e}finally{!function(e){Ue!==e.actionId_&&p(30);Ue=e.parentActionId_,void 0!==e.error_&&(Et.suppressReactionErrors=!0);Qe(e.prevAllowStateChanges_),gt(e.prevAllowStateReads_),Ot(),e.runAsAction_&&vt(e.prevDerivation_);Et.suppressReactionErrors=!1}(o)}}function $e(e,t){var n=Xe(e);try{return t()}finally{Qe(n)}}function Xe(e){var t=Et.allowStateChanges;return Et.allowStateChanges=e,t}function Qe(e){Et.allowStateChanges=e}Be=Symbol.toPrimitive;var Ze,Je=function(e){function t(t,n,r,i,o){var a;return void 0===r&&(r="ObservableValue"),void 0===i&&(i=!0),void 0===o&&(o=ie.default),(a=e.call(this,r)||this).enhancer=void 0,a.name_=void 0,a.equals=void 0,a.hasUnreportedChange_=!1,a.interceptors_=void 0,a.changeListeners_=void 0,a.value_=void 0,a.dehancer=void 0,a.enhancer=n,a.name_=r,a.equals=o,a.value_=n(t,void 0,r),a}W(t,e);var n=t.prototype;return n.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.set=function(e){this.value_;if((e=this.prepareNewValue_(e))!==Et.UNCHANGED){this.setNewValue_(e)}},n.prepareNewValue_=function(e){if(ut(this),On(this)){var t=An(this,{object:this,type:Nn,newValue:e});if(!t)return Et.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?Et.UNCHANGED:e},n.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),kn(this)&&Pn(this,{type:Nn,object:this,newValue:e,oldValue:t})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(e){return Mn(this,e)},n.observe_=function(e,t){return t&&e({observableKind:"value",debugObjectName:this.name_,object:this,type:Nn,newValue:this.value_,oldValue:void 0}),Ln(this,e)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return D(this.get())},n[Be]=function(){return this.valueOf()},t}(te),et=N("ObservableValue",Je);Ze=Symbol.toPrimitive;var tt,nt,rt,it,ot=function(){function e(e){this.dependenciesState_=tt.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.isBeingObserved_=!1,this.isPendingUnobservation_=!1,this.observers_=new Set,this.diffValue_=0,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=tt.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new lt(null),this.name_=void 0,this.triggeredBy_=void 0,this.isComputing_=!1,this.isRunningSetter_=!1,this.derivation=void 0,this.setter_=void 0,this.isTracing_=rt.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||p(31),this.derivation=e.get,this.name_=e.name||"ComputedValue",e.set&&(this.setter_=Ke("ComputedValue-setter",e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?ie.structural:ie.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){!function(e){if(e.lowestObserverState_!==tt.UP_TO_DATE_)return;e.lowestObserverState_=tt.POSSIBLY_STALE_,e.observers_.forEach((function(e){e.dependenciesState_===tt.UP_TO_DATE_&&(e.dependenciesState_=tt.POSSIBLY_STALE_,e.onBecomeStale_())}))}(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.get=function(){if(this.isComputing_&&p(32,this.name_,this.derivation),0!==Et.inBatch||0!==this.observers_.size||this.keepAlive_){if(Mt(this),ct(this)){var e=Et.trackingContext;this.keepAlive_&&!e&&(Et.trackingContext=this),this.trackAndCompute()&&function(e){if(e.lowestObserverState_===tt.STALE_)return;e.lowestObserverState_=tt.STALE_,e.observers_.forEach((function(t){t.dependenciesState_===tt.POSSIBLY_STALE_?t.dependenciesState_=tt.STALE_:t.dependenciesState_===tt.UP_TO_DATE_&&(e.lowestObserverState_=tt.UP_TO_DATE_)}))}(this),Et.trackingContext=e}}else ct(this)&&(this.warnAboutUntrackedRead_(),Ct(),this.value_=this.computeValue_(!1),Ot());var t=this.value_;if(st(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter_&&p(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter_=!1}}else p(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===tt.NOT_TRACKING_,n=this.computeValue_(!0),r=t||st(e)||st(n)||!this.equals_(e,n);return r&&(this.value_=n),r},t.computeValue_=function(e){this.isComputing_=!0;var t,n=Xe(!1);if(e)t=ht(this,this.derivation,this.scope_);else if(!0===Et.disableErrorBoundaries)t=this.derivation.call(this.scope_);else try{t=this.derivation.call(this.scope_)}catch(e){t=new lt(e)}return Qe(n),this.isComputing_=!1,t},t.suspend_=function(){this.keepAlive_||(ft(this),this.value_=void 0)},t.observe_=function(e,t){var n=this,r=!0,i=void 0;return Kt((function(){var o=n.get();if(!r||t){var a=pt();e({observableKind:"computed",debugObjectName:n.name_,type:Nn,object:n,newValue:o,oldValue:i}),vt(a)}r=!1,i=o}))},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return D(this.get())},t[Ze]=function(){return this.valueOf()},e}(),at=N("ComputedValue",ot);(nt=tt||(tt={}))[nt.NOT_TRACKING_=-1]="NOT_TRACKING_",nt[nt.UP_TO_DATE_=0]="UP_TO_DATE_",nt[nt.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",nt[nt.STALE_=2]="STALE_",(it=rt||(rt={}))[it.NONE=0]="NONE",it[it.LOG=1]="LOG",it[it.BREAK=2]="BREAK";var lt=function(e){this.cause=void 0,this.cause=e};function st(e){return e instanceof lt}function ct(e){switch(e.dependenciesState_){case tt.UP_TO_DATE_:return!1;case tt.NOT_TRACKING_:case tt.STALE_:return!0;case tt.POSSIBLY_STALE_:for(var t=mt(!0),n=pt(),r=e.observing_,i=r.length,o=0;o<i;o++){var a=r[o];if(at(a)){if(Et.disableErrorBoundaries)a.get();else try{a.get()}catch(e){return vt(n),gt(t),!0}if(e.dependenciesState_===tt.STALE_)return vt(n),gt(t),!0}}return yt(e),vt(n),gt(t),!1}}function ut(e){}function ht(e,t,n){var r=mt(!0);yt(e),e.newObserving_=new Array(e.observing_.length+100),e.unboundDepsCount_=0,e.runId_=++Et.runId;var i,o=Et.trackingDerivation;if(Et.trackingDerivation=e,Et.inBatch++,!0===Et.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(e){i=new lt(e)}return Et.inBatch--,Et.trackingDerivation=o,function(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=tt.UP_TO_DATE_,i=0,o=e.unboundDepsCount_,a=0;a<o;a++){var l=n[a];0===l.diffValue_&&(l.diffValue_=1,i!==a&&(n[i]=l),i++),l.dependenciesState_>r&&(r=l.dependenciesState_)}n.length=i,e.newObserving_=null,o=t.length;for(;o--;){var s=t[o];0===s.diffValue_&&zt(s,e),s.diffValue_=0}for(;i--;){var c=n[i];1===c.diffValue_&&(c.diffValue_=0,_t(c,e))}r!==tt.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),gt(r),i}function ft(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)zt(t[n],e);e.dependenciesState_=tt.NOT_TRACKING_}function dt(e){var t=pt();try{return e()}finally{vt(t)}}function pt(){var e=Et.trackingDerivation;return Et.trackingDerivation=null,e}function vt(e){Et.trackingDerivation=e}function mt(e){var t=Et.allowStateReads;return Et.allowStateReads=e,t}function gt(e){Et.allowStateReads=e}function yt(e){if(e.dependenciesState_!==tt.UP_TO_DATE_){e.dependenciesState_=tt.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=tt.UP_TO_DATE_}}var bt=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},wt=!0,xt=!1,Et=function(){var e=m();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(wt=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new bt).version&&(wt=!1),wt?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new bt):(setTimeout((function(){xt||p(35)}),1),new bt)}();function _t(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function zt(e,t){e.observers_.delete(t),0===e.observers_.size&&St(e)}function St(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,Et.pendingUnobservations.push(e))}function Ct(){Et.inBatch++}function Ot(){if(0==--Et.inBatch){Pt();for(var e=Et.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation_=!1,0===n.observers_.size&&(n.isBeingObserved_&&(n.isBeingObserved_=!1,n.onBUO()),n instanceof ot&&n.suspend_())}Et.pendingUnobservations=[]}}function Mt(e){var t=Et.trackingDerivation;return null!==t?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved_&&Et.trackingContext&&(e.isBeingObserved_=!0,e.onBO())),!0):(0===e.observers_.size&&Et.inBatch>0&&St(e),!1)}function At(e){e.lowestObserverState_!==tt.STALE_&&(e.lowestObserverState_=tt.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===tt.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=tt.STALE_})))}var kt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=tt.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=rt.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,Et.pendingReactions.push(this),Pt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){Ct(),this.isScheduled_=!1;var e=Et.trackingContext;if(Et.trackingContext=this,ct(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}Et.trackingContext=e,Ot()}},t.track=function(e){if(!this.isDisposed_){Ct();this.isRunning_=!0;var t=Et.trackingContext;Et.trackingContext=this;var n=ht(this,e,void 0);Et.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&ft(this),st(n)&&this.reportExceptionInDerivation_(n.cause),Ot()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(Et.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";Et.suppressReactionErrors||console.error(n,e),Et.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(Ct(),ft(this),Ot()))},t.getDisposer_=function(){var e=this.dispose.bind(this);return e[ee]=this,e},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1),function(){p("trace() is not available in production builds");for(var e=!1,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];"boolean"==typeof n[n.length-1]&&(e=n.pop());var i=_n(n);if(!i)return p("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");i.isTracing_===rt.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled");i.isTracing_=e?rt.BREAK:rt.LOG}(this,e)},e}();var Lt=function(e){return e()};function Pt(){Et.inBatch>0||Et.isRunningReactions||Lt(Tt)}function Tt(){Et.isRunningReactions=!0;for(var e=Et.pendingReactions,t=0;e.length>0;){100==++t&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].runReaction_()}Et.isRunningReactions=!1}var Ht=N("Reaction",kt);var Nt="action",Rt="autoAction",jt="<unnamed action>",Vt=se(Nt),It=se("action.bound",{bound:!0}),Dt=se(Rt,{autoAction:!0}),Ft=se("autoAction.bound",{autoAction:!0,bound:!0});function Bt(e){return function(t,n){return M(t)?Ke(t.name||jt,t,e):M(n)?Ke(t,n,e):A(n)?J(t,n,e?Dt:Vt):A(t)?Z(se(e?Rt:Nt,{name:t,autoAction:e})):void 0}}var Ut=Bt(!1);Object.assign(Ut,Vt);var Gt=Bt(!0);function qt(e){return Ye(e.name,!1,e,this,void 0)}function Wt(e){return M(e)&&!0===e.isMobxAction}function Kt(e,t){var n,r;void 0===t&&(t=E);var i,o=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(!t.scheduler&&!t.delay)i=new kt(o,(function(){this.track(s)}),t.onError,t.requiresObservable);else{var a=$t(t),l=!1;i=new kt(o,(function(){l||(l=!0,a((function(){l=!1,i.isDisposed_||i.track(s)})))}),t.onError,t.requiresObservable)}function s(){e(i)}return i.schedule_(),i.getDisposer_()}Object.assign(Gt,Dt),Ut.bound=Z(It),Gt.bound=Z(Ft);var Yt=function(e){return e()};function $t(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Yt}function Xt(e,t,n){var r;void 0===n&&(n=E);var i,o,a,l,s=null!=(r=n.name)?r:"Reaction",c=Ut(s,n.onError?(i=n.onError,o=t,function(){try{return o.apply(this,arguments)}catch(e){i.call(this,e)}}):t),u=!n.scheduler&&!n.delay,h=$t(n),f=!0,d=!1,p=n.compareStructural?ie.structural:n.equals||ie.default,v=new kt(s,(function(){f||u?m():d||(d=!0,h(m))}),n.onError,n.requiresObservable);function m(){if(d=!1,!v.isDisposed_){var t=!1;v.track((function(){var n=$e(!1,(function(){return e(v)}));t=f||!p(a,n),l=a,a=n})),(f&&n.fireImmediately||!f&&t)&&c(a,l,v),f=!1}}return v.schedule_(),v.getDisposer_()}var Qt="onBO";function Zt(e,t,n){return Jt("onBUO",e,t,n)}function Jt(e,t,n,r){var i="function"==typeof r?_r(t,n):_r(t),o=M(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var en="always";function tn(e){!0===e.isolateGlobalState&&function(){if((Et.pendingReactions.length||Et.inBatch||Et.isRunningReactions)&&p(36),xt=!0,wt){var e=m();0==--e.__mobxInstanceCount&&(e.__mobxGlobals=void 0),Et=new bt}}();var t,n,r=e.useProxies,i=e.enforceActions;if(void 0!==r&&(Et.useProxies=r===en||"never"!==r&&"undefined"!=typeof Proxy),"ifavailable"===r&&(Et.verifyProxies=!0),void 0!==i){var o=i===en?en:"observed"===i;Et.enforceActions=o,Et.allowStateChanges=!0!==o&&o!==en}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach((function(t){t in e&&(Et[t]=!!e[t])})),Et.allowStateReads=!Et.observableRequiresReaction,e.reactionScheduler&&(t=e.reactionScheduler,n=Lt,Lt=function(e){return t((function(){return n(e)}))})}function nn(e,t,n,r){var i=B(t),o=lr(e,r)[ee];Ct();try{I(i).forEach((function(e){o.extend_(e,i[e],!n||(!(e in n)||n[e]))}))}finally{Ot()}return e}function rn(e,t){return on(_r(e,t))}function on(e){var t,n={name:e.name_};return e.observing_&&e.observing_.length>0&&(n.dependencies=(t=e.observing_,Array.from(new Set(t))).map(on)),n}var an=0;function ln(){this.message="FLOW_CANCELLED"}ln.prototype=Object.create(Error.prototype);var sn=fe("flow"),cn=fe("flow.bound",{bound:!0}),un=Object.assign((function(e,t){if(A(t))return J(e,t,sn);var n=e,r=n.name||"<unnamed flow>",i=function(){var e,t=this,i=arguments,o=++an,a=Ut(r+" - runid: "+o+" - init",n).apply(t,i),l=void 0,s=new Promise((function(t,n){var i=0;function s(e){var t;l=void 0;try{t=Ut(r+" - runid: "+o+" - yield "+i++,a.next).call(a,e)}catch(e){return n(e)}u(t)}function c(e){var t;l=void 0;try{t=Ut(r+" - runid: "+o+" - yield "+i++,a.throw).call(a,e)}catch(e){return n(e)}u(t)}function u(e){if(!M(null==e?void 0:e.then))return e.done?t(e.value):(l=Promise.resolve(e.value)).then(s,c);e.then(u,n)}e=n,s(void 0)}));return s.cancel=Ut(r+" - runid: "+o+" - cancel",(function(){try{l&&hn(l);var t=a.return(void 0),n=Promise.resolve(t.value);n.then(O,O),hn(n),e(new ln)}catch(t){e(t)}})),s};return i.isMobXFlow=!0,i}),sn);function hn(e){M(e.cancel)&&e.cancel()}function fn(e){return!0===(null==e?void 0:e.isMobXFlow)}function dn(e,t,n){var r;return er(e)||Kn(e)||et(e)?r=zr(e):ur(e)&&(r=zr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function pn(e,t,n){return M(n)?function(e,t,n){return zr(e,t).intercept_(n)}(e,t,n):function(e,t){return zr(e).intercept_(t)}(e,t)}function vn(e,t){return!!e&&(void 0!==t?!!ur(e)&&e[ee].values_.has(t):ur(e)||!!e[ee]||ne(e)||Ht(e)||at(e))}function mn(e){return vn(e)}function gn(e){return ur(e)?e[ee].keys_():er(e)||rr(e)?Array.from(e.keys()):Kn(e)?e.map((function(e,t){return t})):void p(5)}function yn(e){return ur(e)?gn(e).map((function(t){return e[t]})):er(e)?gn(e).map((function(t){return e.get(t)})):rr(e)?Array.from(e.values()):Kn(e)?e.slice():void p(6)}function bn(e){return ur(e)?gn(e).map((function(t){return[t,e[t]]})):er(e)?gn(e).map((function(t){return[t,e.get(t)]})):rr(e)?Array.from(e.entries()):Kn(e)?e.map((function(e,t){return[t,e]})):void p(7)}function wn(e,t,n){if(2!==arguments.length||rr(e))ur(e)?e[ee].set_(t,n):er(e)?e.set(t,n):rr(e)?e.add(t):Kn(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&p("Invalid index: '"+t+"'"),Ct(),t>=e.length&&(e.length=t+1),e[t]=n,Ot()):p(8);else{Ct();var r=t;try{for(var i in r)wn(e,i,r[i])}finally{Ot()}}}function xn(e,t,n){if(ur(e))return e[ee].defineProperty_(t,n);p(39)}function En(e,t,n,r){return M(n)?function(e,t,n,r){return zr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return zr(e).observe_(t,n)}(e,t,n)}function _n(e){switch(e.length){case 0:return Et.trackingDerivation;case 1:return _r(e[0]);case 2:return _r(e[0],e[1])}}function zn(e,t){void 0===t&&(t=void 0),Ct();try{return e.apply(t)}finally{Ot()}}function Sn(e){return e[ee]}un.bound=Z(cn);var Cn={has:function(e,t){return Sn(e).has_(t)},get:function(e,t){return Sn(e).get_(t)},set:function(e,t,n){var r;return!!A(t)&&(null==(r=Sn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!A(t)&&(null==(n=Sn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=Sn(e).defineProperty_(t,n))||r},ownKeys:function(e){return Sn(e).ownKeys_()},preventExtensions:function(e){p(13)}};function On(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function Mn(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),C((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function An(e,t){var n=pt();try{for(var r=[].concat(e.interceptors_||[]),i=0,o=r.length;i<o&&((t=r[i](t))&&!t.type&&p(14),t);i++);return t}finally{vt(n)}}function kn(e){return void 0!==e.changeListeners_&&e.changeListeners_.length>0}function Ln(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),C((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function Pn(e,t){var n=pt(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i<o;i++)r[i](t);vt(n)}}function Tn(e,t,n){var r=lr(e,n)[ee];Ct();try{null!=t||(t=function(e){return F(e,Q)||T(e,Q,q({},e[Q])),e[Q]}(e)),I(t).forEach((function(e){return r.make_(e,t[e])}))}finally{Ot()}return e}var Hn="splice",Nn="update",Rn={get:function(e,t){var n=e[ee];return t===ee?n:"length"===t?n.getArrayLength_():"string"!=typeof t||isNaN(t)?F(In,t)?In[t]:e[t]:n.get_(parseInt(t))},set:function(e,t,n){var r=e[ee];return"length"===t&&r.setArrayLength_(n),"symbol"==typeof t||isNaN(t)?e[t]=n:r.set_(parseInt(t),n),!0},preventExtensions:function(){p(15)}},jn=function(){function e(e,t,n,r){void 0===e&&(e="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=n,this.legacyMode_=r,this.atom_=new te(e),this.enhancer_=function(e,n){return t(e,n,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.dehanceValues_=function(e){return void 0!==this.dehancer&&e.length>0?e.map(this.dehancer):e},t.intercept_=function(e){return Mn(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Ln(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&p("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r<e-t;r++)n[r]=void 0;this.spliceWithArray_(t,0,n)}else this.spliceWithArray_(e,t-e)},t.updateArrayLength_=function(e,t){e!==this.lastKnownLength_&&p(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&xr(e+t+1)},t.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=x),On(this)){var o=An(this,{object:this.proxy_,type:Hn,index:e,removedCount:t,added:n});if(!o)return x;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var l=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,l),this.dehanceValues_(l)},t.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a<n.length;a++)this.values_[e+a]=n[a];for(var l=0;l<o.length;l++)this.values_[e+n.length+l]=o[l];return i},t.notifyArrayChildUpdate_=function(e,t,n){var r=!this.owned_&&!1,i=kn(this),o=i||r?{observableKind:"array",object:this.proxy_,type:Nn,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;this.atom_.reportChanged(),i&&Pn(this,o)},t.notifyArraySplice_=function(e,t,n){var r=!this.owned_&&!1,i=kn(this),o=i||r?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Hn,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.atom_.reportChanged(),i&&Pn(this,o)},t.get_=function(e){if(e<this.values_.length)return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx.array] Attempt to read an array index ("+e+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX")},t.set_=function(e,t){var n=this.values_;if(e<n.length){this.atom_;var r=n[e];if(On(this)){var i=An(this,{type:Nn,object:this.proxy_,index:e,newValue:t});if(!i)return;t=i.newValue}(t=this.enhancer_(t,r))!==r&&(n[e]=t,this.notifyArrayChildUpdate_(e,t,r))}else e===n.length?this.spliceWithArray_(e,0,[t]):p(17,e,n.length)},e}();function Vn(e,t,n,r){void 0===n&&(n="ObservableArray"),void 0===r&&(r=!1),S();var i=new jn(n,t,r,!1);H(i.values_,ee,i);var o=new Proxy(i.values_,Rn);if(i.proxy_=o,e&&e.length){var a=Xe(!0);i.spliceWithArray_(0,0,e),Qe(a)}return o}var In={clear:function(){return this.splice(0)},replace:function(e){var t=this[ee];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];var o=this[ee];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(e);case 2:return o.spliceWithArray_(e,t)}return o.spliceWithArray_(e,t,r)},spliceWithArray:function(e,t,n){return this[ee].spliceWithArray_(e,t,n)},push:function(){for(var e=this[ee],t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.spliceWithArray_(e.values_.length,0,n),e.values_.length},pop:function(){return this.splice(Math.max(this[ee].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[ee],t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.spliceWithArray_(0,0,n),e.values_.length},reverse:function(){return Et.trackingDerivation&&p(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Et.trackingDerivation&&p(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[ee],n=t.dehanceValues_(t.values_).indexOf(e);return n>-1&&(this.splice(n,1),!0)}};function Dn(e,t){"function"==typeof Array.prototype[e]&&(In[e]=t(e))}function Fn(e){return function(){var t=this[ee];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Bn(e){return function(t,n){var r=this,i=this[ee];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function Un(e){return function(){var t=this,n=this[ee];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}Dn("concat",Fn),Dn("flat",Fn),Dn("includes",Fn),Dn("indexOf",Fn),Dn("join",Fn),Dn("lastIndexOf",Fn),Dn("slice",Fn),Dn("toString",Fn),Dn("toLocaleString",Fn),Dn("every",Bn),Dn("filter",Bn),Dn("find",Bn),Dn("findIndex",Bn),Dn("flatMap",Bn),Dn("forEach",Bn),Dn("map",Bn),Dn("some",Bn),Dn("reduce",Un),Dn("reduceRight",Un);var Gn,qn,Wn=N("ObservableArrayAdministration",jn);function Kn(e){return k(e)&&Wn(e[ee])}var Yn={},$n="add",Xn="delete";Gn=Symbol.iterator,qn=Symbol.toStringTag;var Qn,Zn,Jn=function(){function e(e,t,n){var r=this;void 0===t&&(t=oe),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[ee]=Yn,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,M(Map)||p(18),this.keysAtom_=re("ObservableMap.keys()"),this.data_=new Map,this.hasMap_=new Map,$e(!0,(function(){r.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!Et.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Je(this.has_(e),ae,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Zt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},t.set=function(e,t){var n=this.has_(e);if(On(this)){var r=An(this,{type:n?Nn:$n,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if((this.keysAtom_,On(this))&&!An(this,{type:Xn,object:this,name:e}))return!1;if(this.has_(e)){var n=kn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:Xn,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return zn((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&Pn(this,r),!0}return!1},t.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==Et.UNCHANGED){var r=kn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:Nn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&Pn(this,i)}},t.addValue_=function(e,t){var n=this;this.keysAtom_,zn((function(){var r,i=new Je(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=kn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:$n,object:this,name:e,newValue:t}:null;r&&Pn(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return kr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return kr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},t[Gn]=function(){return this.entries()},t.forEach=function(e,t){for(var n,r=X(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},t.merge=function(e){var t=this;return er(e)&&(e=new Map(e)),zn((function(){L(e)?function(e){var t=Object.keys(e);if(!V)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return w.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(n){return t.set(n,e[n])})):Array.isArray(e)?e.forEach((function(e){var n=e[0],r=e[1];return t.set(n,r)})):R(e)?(e.constructor!==Map&&p(19,e),e.forEach((function(e,n){return t.set(n,e)}))):null!=e&&p(20,e)})),this},t.clear=function(){var e=this;zn((function(){dt((function(){for(var t,n=X(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},t.replace=function(e){var t=this;return zn((function(){for(var n,r=function(e){if(R(e)||er(e))return e;if(Array.isArray(e))return new Map(e);if(L(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return p(21,e)}(e),i=new Map,o=!1,a=X(t.data_.keys());!(n=a()).done;){var l=n.value;if(!r.has(l))if(t.delete(l))o=!0;else{var s=t.data_.get(l);i.set(l,s)}}for(var c,u=X(r.entries());!(c=u()).done;){var h=c.value,f=h[0],d=h[1],v=t.data_.has(f);if(t.set(f,d),t.data_.has(f)){var m=t.data_.get(f);i.set(f,m),v||(o=!0)}}if(!o)if(t.data_.size!==i.size)t.keysAtom_.reportChanged();else for(var g=t.data_.keys(),y=i.keys(),b=g.next(),w=y.next();!b.done;){if(b.value!==w.value){t.keysAtom_.reportChanged();break}b=g.next(),w=y.next()}t.data_=i})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return Ln(this,e)},t.intercept_=function(e){return Mn(this,e)},G(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:qn,get:function(){return"Map"}}]),e}(),er=N("ObservableMap",Jn);var tr={};Qn=Symbol.iterator,Zn=Symbol.toStringTag;var nr=function(){function e(e,t,n){void 0===t&&(t=oe),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[ee]=tr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,M(Set)||p(22),this.atom_=re(this.name_),this.enhancer_=function(e,r){return t(e,r,n)},e&&this.replace(e)}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;zn((function(){dt((function(){for(var t,n=X(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},t.forEach=function(e,t){for(var n,r=X(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if((this.atom_,On(this))&&!An(this,{type:$n,object:this,newValue:e}))return this;if(!this.has(e)){zn((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=kn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:$n,object:this,newValue:e}:null;n&&Pn(this,r)}return this},t.delete=function(e){var t=this;if(On(this)&&!An(this,{type:Xn,object:this,oldValue:e}))return!1;if(this.has(e)){var n=kn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:Xn,object:this,oldValue:e}:null;return zn((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&Pn(this,r),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return kr({next:function(){var r=e;return e+=1,r<n.length?{value:[t[r],n[r]],done:!1}:{done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var e=this,t=0,n=Array.from(this.data_.values());return kr({next:function(){return t<n.length?{value:e.dehanceValue_(n[t++]),done:!1}:{done:!0}}})},t.replace=function(e){var t=this;return rr(e)&&(e=new Set(e)),zn((function(){Array.isArray(e)||j(e)?(t.clear(),e.forEach((function(e){return t.add(e)}))):null!=e&&p("Cannot initialize set from "+e)})),this},t.observe_=function(e,t){return Ln(this,e)},t.intercept_=function(e){return Mn(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Qn]=function(){return this.values()},G(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Zn,get:function(){return"Set"}}]),e}(),rr=N("ObservableSet",nr),ir=Object.create(null),or="remove",ar=function(){function e(e,t,n,r){void 0===t&&(t=new Map),void 0===r&&(r=Ee),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=e,this.values_=t,this.name_=n,this.defaultAnnotation_=r,this.keysAtom_=new te("ObservableObject.keys"),this.isPlainObject_=L(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(e){return this.values_.get(e).get()},t.setObservablePropValue_=function(e,t){var n=this.values_.get(e);if(n instanceof ot)return n.set(t),!0;if(On(this)){var r=An(this,{type:Nn,object:this.proxy_||this.target_,name:e,newValue:t});if(!r)return null;t=r.newValue}if((t=n.prepareNewValue_(t))!==Et.UNCHANGED){var i=kn(this),o=i?{type:Nn,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),i&&Pn(this,o)}return!0},t.get_=function(e){return Et.trackingDerivation&&!F(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,n){return void 0===n&&(n=!1),F(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):n?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,n)},t.has_=function(e){if(!Et.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var t=this.pendingKeys_.get(e);return t||(t=new Je(e in this.target_,ae,"ObservableObject.key?",!1),this.pendingKeys_.set(e,t)),t.get()},t.make_=function(e,t){if(!0===t&&(t=this.defaultAnnotation_),!1!==t){if(fr(this,t,e),!(e in this.target_)){var n;if(null!=(n=this.target_[Q])&&n[e])return;p(1,t.annotationType_,this.name_+"."+e.toString())}for(var r=this.target_;r&&r!==w;){var i=y(r,e);if(i){var o=t.make_(this,e,i,r);if(0===o)return;if(1===o)break}r=Object.getPrototypeOf(r)}hr(this,t,e)}},t.extend_=function(e,t,n,r){if(void 0===r&&(r=!1),!0===n&&(n=this.defaultAnnotation_),!1===n)return this.defineProperty_(e,t,r);fr(this,n,e);var i=n.extend_(this,e,t,r);return i&&hr(this,n,e),i},t.defineProperty_=function(e,t,n){void 0===n&&(n=!1);try{Ct();var r=this.delete_(e);if(!r)return r;if(On(this)){var i=An(this,{object:this.proxy_||this.target_,name:e,type:$n,newValue:t.value});if(!i)return null;var o=i.newValue;t.value!==o&&(t=q({},t,{value:o}))}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else b(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{Ot()}return!0},t.defineObservableProperty_=function(e,t,n,r){void 0===r&&(r=!1);try{Ct();var i=this.delete_(e);if(!i)return i;if(On(this)){var o=An(this,{object:this.proxy_||this.target_,name:e,type:$n,newValue:t});if(!o)return null;t=o.newValue}var a=cr(e),l={configurable:!Et.safeDescriptors||this.isPlainObject_,enumerable:!0,get:a.get,set:a.set};if(r){if(!Reflect.defineProperty(this.target_,e,l))return!1}else b(this.target_,e,l);var s=new Je(t,n,"ObservableObject.key",!1);this.values_.set(e,s),this.notifyPropertyAddition_(e,s.value_)}finally{Ot()}return!0},t.defineComputedProperty_=function(e,t,n){void 0===n&&(n=!1);try{Ct();var r=this.delete_(e);if(!r)return r;if(On(this))if(!An(this,{object:this.proxy_||this.target_,name:e,type:$n,newValue:void 0}))return null;t.name||(t.name="ObservableObject.key"),t.context=this.proxy_||this.target_;var i=cr(e),o={configurable:!Et.safeDescriptors||this.isPlainObject_,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.target_,e,o))return!1}else b(this.target_,e,o);this.values_.set(e,new ot(t)),this.notifyPropertyAddition_(e,void 0)}finally{Ot()}return!0},t.delete_=function(e,t){if(void 0===t&&(t=!1),!F(this.target_,e))return!0;if(On(this)&&!An(this,{object:this.proxy_||this.target_,name:e,type:or}))return null;try{var n,r;Ct();var i,o=kn(this),a=this.values_.get(e),l=void 0;if(!a&&o)l=null==(i=y(this.target_,e))?void 0:i.value;if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(a&&(this.values_.delete(e),a instanceof Je&&(l=a.value_),At(a)),this.keysAtom_.reportChanged(),null==(n=this.pendingKeys_)||null==(r=n.get(e))||r.set(e in this.target_),o){var s={type:or,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:e};o&&Pn(this,s)}}finally{Ot()}return!0},t.observe_=function(e,t){return Ln(this,e)},t.intercept_=function(e){return Mn(this,e)},t.notifyPropertyAddition_=function(e,t){var n,r,i=kn(this);if(i){var o=i?{type:$n,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;i&&Pn(this,o)}null==(n=this.pendingKeys_)||null==(r=n.get(e))||r.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),I(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function lr(e,t){var n;if(F(e,ee))return e;var r=null!=(n=null==t?void 0:t.name)?n:"ObservableObject",i=new ar(e,new Map,String(r),function(e){var t;return e?null!=(t=e.defaultDecorator)?t:_e(e):void 0}(t));return T(e,ee,i),e}var sr=N("ObservableObjectAdministration",ar);function cr(e){return ir[e]||(ir[e]={get:function(){return this[ee].getObservablePropValue_(e)},set:function(t){return this[ee].setObservablePropValue_(e,t)}})}function ur(e){return!!k(e)&&sr(e[ee])}function hr(e,t,n){var r;null==(r=e.target_[Q])||delete r[n]}function fr(e,t,n){}var dr,pr,vr=br(0),mr=0,gr=function(){};dr=gr,pr=Array.prototype,Object.setPrototypeOf?Object.setPrototypeOf(dr.prototype,pr):void 0!==dr.prototype.__proto__?dr.prototype.__proto__=pr:dr.prototype=pr;var yr=function(e,t,n){function r(t,n,r,i){var o;void 0===r&&(r="ObservableArray"),void 0===i&&(i=!1),o=e.call(this)||this;var a=new jn(r,n,i,!0);if(a.proxy_=Y(o),H(Y(o),ee,a),t&&t.length){var l=Xe(!0);o.spliceWithArray(0,0,t),Qe(l)}return Object.defineProperty(Y(o),"0",vr),o}W(r,e);var i=r.prototype;return i.concat=function(){this[ee].atom_.reportObserved();for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Array.prototype.concat.apply(this.slice(),t.map((function(e){return Kn(e)?e.slice():e})))},i[n]=function(){var e=this,t=0;return kr({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},G(r,[{key:"length",get:function(){return this[ee].getArrayLength_()},set:function(e){this[ee].setArrayLength_(e)}},{key:t,get:function(){return"Array"}}]),r}(gr,Symbol.toStringTag,Symbol.iterator);function br(e){return{enumerable:!1,configurable:!0,get:function(){return this[ee].get_(e)},set:function(t){this[ee].set_(e,t)}}}function wr(e){b(yr.prototype,""+e,br(e))}function xr(e){if(e>mr){for(var t=mr;t<e+100;t++)wr(t);mr=e}}function Er(e,t,n){return new yr(e,t,n)}function _r(e,t){if("object"==typeof e&&null!==e){if(Kn(e))return void 0!==t&&p(23),e[ee].atom_;if(rr(e))return e[ee];if(er(e)){if(void 0===t)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||p(25,t,Sr(e)),n}if(ur(e)){if(!t)return p(26);var r=e[ee].values_.get(t);return r||p(27,t,Sr(e)),r}if(ne(e)||at(e)||Ht(e))return e}else if(M(e)&&Ht(e[ee]))return e[ee];p(28)}function zr(e,t){return e||p(29),void 0!==t?zr(_r(e,t)):ne(e)||at(e)||Ht(e)||er(e)||rr(e)?e:e[ee]?e[ee]:void p(24,e)}function Sr(e,t){var n;if(void 0!==t)n=_r(e,t);else{if(Wt(e))return e.name;n=ur(e)||er(e)||rr(e)?zr(e):_r(e)}return n.name_}Object.entries(In).forEach((function(e){var t=e[0],n=e[1];"concat"!==t&&T(yr.prototype,t,n)})),xr(1e3);var Cr=w.toString;function Or(e,t,n){return void 0===n&&(n=-1),Mr(e,t,n)}function Mr(e,t,n,r,i){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var o=typeof e;if("function"!==o&&"object"!==o&&"object"!=typeof t)return!1;var a=Cr.call(e);if(a!==Cr.call(t))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++}e=Ar(e),t=Ar(t);var l="[object Array]"===a;if(!l){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,c=t.constructor;if(s!==c&&!(M(s)&&s instanceof s&&M(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var u=(r=r||[]).length;u--;)if(r[u]===e)return i[u]===t;if(r.push(e),i.push(t),l){if((u=e.length)!==t.length)return!1;for(;u--;)if(!Mr(e[u],t[u],n-1,r,i))return!1}else{var h,f=Object.keys(e);if(u=f.length,Object.keys(t).length!==u)return!1;for(;u--;)if(!F(t,h=f[u])||!Mr(e[h],t[h],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function Ar(e){return Kn(e)?e.slice():R(e)||er(e)||j(e)||rr(e)?Array.from(e.entries()):e}function kr(e){return e[Symbol.iterator]=Lr,e}function Lr(){return this}if(["Symbol","Map","Set"].forEach((function(e){void 0===m()[e]&&p("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:Sr},$mobx:ee}),!(d=l("8NFma")).useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!Tn)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function Pr(e){e()}var Tr={};e(Tr,"useObserver",(()=>Xr),(e=>Xr=e));d=l("8NFma");function Hr(e){return rn(e)}var Nr="undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry;function Rr(e){return{reaction:e,mounted:!1,changedBeforeMount:!1,cleanAt:Date.now()+jr}}var jr=1e4;var Vr={};e(Vr,"createTimerBasedReactionCleanupTracking",(()=>Dr),(e=>Dr=e));var Ir=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Dr(){var e,t=new Set;function n(){void 0===e&&(e=setTimeout(r,1e4))}function r(){e=void 0;var r=Date.now();t.forEach((function(e){var n=e.current;n&&r>=n.cleanAt&&(n.reaction.dispose(),e.current=null,t.delete(e))})),t.size>0&&n()}return{addReactionToTrack:function(e,r,i){var o;return e.current=Rr(r),o=e,t.add(o),n(),e.current},recordReactionAsCommitted:function(e){t.delete(e)},forceCleanupTimerToRunNowForTests:function(){e&&(clearTimeout(e),r())},resetCleanupScheduleForTests:function(){var n,r;if(t.size>0){try{for(var i=Ir(t),o=i.next();!o.done;o=i.next()){var a=o.value,l=a.current;l&&(l.reaction.dispose(),a.current=null)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.clear()}e&&(clearTimeout(e),e=void 0)}}}var Fr=Nr?function(e){var t=new Map,n=1,r=new e((function(e){var n=t.get(e);n&&(n.reaction.dispose(),t.delete(e))}));return{addReactionToTrack:function(e,i,o){var a=n++;return r.register(o,a,e),e.current=Rr(i),e.current.finalizationRegistryCleanupToken=a,t.set(a,e.current),e.current},recordReactionAsCommitted:function(e){r.unregister(e),e.current&&e.current.finalizationRegistryCleanupToken&&t.delete(e.current.finalizationRegistryCleanupToken)},forceCleanupTimerToRunNowForTests:function(){},resetCleanupScheduleForTests:function(){}}}(Nr):(0,Vr.createTimerBasedReactionCleanupTracking)(),Br=Fr.addReactionToTrack,Ur=Fr.recordReactionAsCommitted,Gr=(Fr.resetCleanupScheduleForTests,Fr.forceCleanupTimerToRunNowForTests,!1);function qr(){return Gr}var Wr=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a};function Kr(e){return"observer".concat(e)}var Yr=function(){};function $r(){return new Yr}function Xr(e,t){if(void 0===t&&(t="observed"),qr())return e();var r=Wr(n(d).useState($r),1)[0],i=Wr(n(d).useState(),2)[1],o=function(){return i([])},a=n(d).useRef(null);if(!a.current)var l=new kt(Kr(t),(function(){s.mounted?o():s.changedBeforeMount=!0})),s=Br(a,l,r);var c,u,h=a.current.reaction;if(n(d).useDebugValue(h,Hr),n(d).useEffect((function(){return Ur(a),a.current?(a.current.mounted=!0,a.current.changedBeforeMount&&(a.current.changedBeforeMount=!1,o())):(a.current={reaction:new kt(Kr(t),(function(){o()})),mounted:!0,changedBeforeMount:!1,cleanAt:1/0},o()),function(){a.current.reaction.dispose(),a.current=null}}),[]),h.track((function(){try{c=e()}catch(e){u=e}})),u)throw u;return c}d=l("8NFma");var Qr="function"==typeof Symbol&&Symbol.for,Zr=Qr?Symbol.for("react.forward_ref"):"function"==typeof d.forwardRef&&(0,d.forwardRef)((function(e){return null})).$$typeof,Jr=Qr?Symbol.for("react.memo"):"function"==typeof d.memo&&(0,d.memo)((function(e){return null})).$$typeof;function ei(e,t){var n;if(Jr&&e.$$typeof===Jr)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");if(qr())return e;var r=null!==(n=null==t?void 0:t.forwardRef)&&void 0!==n&&n,i=e,o=e.displayName||e.name;if(Zr&&e.$$typeof===Zr&&(r=!0,"function"!=typeof(i=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var a,l,s=function(e,t){return(0,Tr.useObserver)((function(){return i(e,t)}),o)};return""!==o&&(s.displayName=o),e.contextTypes&&(s.contextTypes=e.contextTypes),r&&(s=(0,d.forwardRef)(s)),s=(0,d.memo)(s),a=e,l=s,Object.keys(a).forEach((function(e){ti[e]||Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(a,e))})),s}var ti={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};d=l("8NFma");d=l("8NFma");var ni={};e(ni,"useAsObservableSource",(()=>oi),(e=>oi=e));d=l("8NFma");var ri,ii=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a};function oi(e){var t=ii((0,d.useState)((function(){return je(e,{},{deep:!1})})),1)[0];return qt((function(){Object.assign(t,e)})),t}(ri=f.unstable_batchedUpdates)||(ri=Pr),tn({reactionScheduler:ri});d=l("8NFma");var ai=Math.PI/180;const li=void 0!==t?t:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},si={_global:li,version:"8.3.13",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle:e=>si.angleDeg?e*ai:e,enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>si.DD.isDragging,isDragReady:()=>!!si.DD.node,document:li.document,_injectGlobal(e){li.Konva=e}},ci=e=>{si[e.prototype.getClassName()]=e};si._injectGlobal(si);class ui{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new ui(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){var t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}translate(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}scale(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}rotate(e){var t=Math.cos(e),n=Math.sin(e),r=this.m[0]*t+this.m[2]*n,i=this.m[1]*t+this.m[3]*n,o=this.m[0]*-n+this.m[2]*t,a=this.m[1]*-n+this.m[3]*t;return this.m[0]=r,this.m[1]=i,this.m[2]=o,this.m[3]=a,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){var n=this.m[0]+this.m[2]*t,r=this.m[1]+this.m[3]*t,i=this.m[2]+this.m[0]*e,o=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=o,this}multiply(e){var t=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],r=this.m[0]*e.m[2]+this.m[2]*e.m[3],i=this.m[1]*e.m[2]+this.m[3]*e.m[3],o=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],a=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=i,this.m[4]=o,this.m[5]=a,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,r=-this.m[2]*e,i=this.m[0]*e,o=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=i,this.m[4]=o,this.m[5]=a,this}getMatrix(){return this.m}decompose(){var e=this.m[0],t=this.m[1],n=this.m[2],r=this.m[3],i=e*r-t*n;let o={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=e||0!=t){var a=Math.sqrt(e*e+t*t);o.rotation=t>0?Math.acos(e/a):-Math.acos(e/a),o.scaleX=a,o.scaleY=i/a,o.skewX=(e*n+t*r)/i,o.skewY=0}else if(0!=n||0!=r){var l=Math.sqrt(n*n+r*r);o.rotation=Math.PI/2-(r>0?Math.acos(-n/l):-Math.acos(n/l)),o.scaleX=i/l,o.scaleY=l,o.skewX=0,o.skewY=(e*n+t*r)/i}return o.rotation=yi._getRotation(o.rotation),o}}var hi=Math.PI/180,fi=180/Math.PI,di="Konva error: ",pi={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},vi=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,mi=[];const gi="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(e){setTimeout(e,60)},yi={_isElement:e=>!(!e||1!=e.nodeType),_isFunction:e=>!!(e&&e.constructor&&e.call&&e.apply),_isPlainObject:e=>!!e&&e.constructor===Object,_isArray:e=>"[object Array]"===Object.prototype.toString.call(e),_isNumber:e=>"[object Number]"===Object.prototype.toString.call(e)&&!isNaN(e)&&isFinite(e),_isString:e=>"[object String]"===Object.prototype.toString.call(e),_isBoolean:e=>"[object Boolean]"===Object.prototype.toString.call(e),isObject:e=>e instanceof Object,isValidSelector(e){if("string"!=typeof e)return!1;var t=e[0];return"#"===t||"."===t||t===t.toUpperCase()},_sign:e=>0===e||e>0?1:-1,requestAnimFrame(e){mi.push(e),1===mi.length&&gi((function(){const e=mi;mi=[],e.forEach((function(e){e()}))}))},createCanvasElement(){var e=document.createElement("canvas");try{e.style=e.style||{}}catch(e){}return e},createImageElement:()=>document.createElement("img"),_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){var n=yi.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex:(e,t,n)=>(16777216+(e<<16)+(t<<8)+n).toString(16).slice(1),_hexToRgb(e){e=e.replace("#","");var t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t}},getRandomColor(){for(var e=(16777215*Math.random()<<0).toString(16);e.length<6;)e="0"+e;return"#"+e},getRGB(e){var t;return e in pi?{r:(t=pi[e])[0],g:t[1],b:t[2]}:"#"===e[0]?this._hexToRgb(e.substring(1)):"rgb("===e.substr(0,4)?(t=vi.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA:e=>(e=e||"black",yi._namedColorToRBA(e)||yi._hex3ColorToRGBA(e)||yi._hex6ColorToRGBA(e)||yi._rgbColorToRGBA(e)||yi._rgbaColorToRGBA(e)||yi._hslColorToRGBA(e)),_namedColorToRBA(e){var t=pi[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(0===e.indexOf("rgb(")){var t=(e=e.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(0===e.indexOf("rgba(")){var t=(e=e.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(((e,t)=>"%"===e.slice(-1)?3===t?parseInt(e)/100:parseInt(e)/100*255:Number(e)));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex6ColorToRGBA(e){if("#"===e[0]&&7===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex3ColorToRGBA(e){if("#"===e[0]&&4===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,i=Number(n[1])/100,o=Number(n[2])/100;let a,l,s;if(0===i)return s=255*o,{r:Math.round(s),g:Math.round(s),b:Math.round(s),a:1};a=o<.5?o*(1+i):o+i-o*i;const c=2*o-a,u=[0,0,0];for(let e=0;e<3;e++)l=r+1/3*-(e-1),l<0&&l++,l>1&&l--,s=6*l<1?c+6*(a-c)*l:2*l<1?a:3*l<2?c+(a-c)*(2/3-l)*6:c,u[e]=255*s;return{r:Math.round(u[0]),g:Math.round(u[1]),b:Math.round(u[2]),a:1}}},haveIntersection:(e,t)=>!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y),cloneObject(e){var t={};for(var n in e)this._isPlainObject(e[n])?t[n]=this.cloneObject(e[n]):this._isArray(e[n])?t[n]=this.cloneArray(e[n]):t[n]=e[n];return t},cloneArray:e=>e.slice(0),degToRad:e=>e*hi,radToDeg:e=>e*fi,_degToRad:e=>(yi.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),yi.degToRad(e)),_radToDeg:e=>(yi.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),yi.radToDeg(e)),_getRotation:e=>si.angleDeg?yi.radToDeg(e):e,_capitalize:e=>e.charAt(0).toUpperCase()+e.slice(1),throw(e){throw new Error(di+e)},error(e){console.error(di+e)},warn(e){si.showWarnings&&console.warn("Konva warning: "+e)},each(e,t){for(var n in e)t(n,e[n])},_inRange:(e,t,n)=>t<=e&&e<n,_getProjectionToSegment(e,t,n,r,i,o){var a,l,s,c=(e-n)*(e-n)+(t-r)*(t-r);if(0==c)a=e,l=t,s=(i-n)*(i-n)+(o-r)*(o-r);else{var u=((i-e)*(n-e)+(o-t)*(r-t))/c;u<0?(a=e,l=t,s=(e-i)*(e-i)+(t-o)*(t-o)):u>1?(a=n,l=r,s=(n-i)*(n-i)+(r-o)*(r-o)):s=((a=e+u*(n-e))-i)*(a-i)+((l=t+u*(r-t))-o)*(l-o)}return[a,l,s]},_getProjectionToLine(e,t,n){var r=yi.cloneObject(e),i=Number.MAX_VALUE;return t.forEach((function(o,a){if(n||a!==t.length-1){var l=t[(a+1)%t.length],s=yi._getProjectionToSegment(o.x,o.y,l.x,l.y,e.x,e.y),c=s[0],u=s[1],h=s[2];h<i&&(r.x=c,r.y=u,i=h)}})),r},_prepareArrayForTween(e,t,n){var r,i=[],o=[];if(e.length>t.length){var a=t;t=e,e=a}for(r=0;r<e.length;r+=2)i.push({x:e[r],y:e[r+1]});for(r=0;r<t.length;r+=2)o.push({x:t[r],y:t[r+1]});var l=[];return o.forEach((function(e){var t=yi._getProjectionToLine(e,i,n);l.push(t.x),l.push(t.y)})),l},_prepareToStringify(e){var t;for(var n in e.visitedByCircularReferenceRemoval=!0,e)if(e.hasOwnProperty(n)&&e[n]&&"object"==typeof e[n])if(t=Object.getOwnPropertyDescriptor(e,n),e[n].visitedByCircularReferenceRemoval||yi._isElement(e[n])){if(!t.configurable)return null;delete e[n]}else if(null===yi._prepareToStringify(e[n])){if(!t.configurable)return null;delete e[n]}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,t){for(var n in t)e[n]=t[n];return e},_getFirstPointerId:e=>e.touches?e.changedTouches[0].identifier:e.pointerId||999};function bi(e){return yi._isString(e)?'"'+e+'"':"[object Number]"===Object.prototype.toString.call(e)||yi._isBoolean(e)?e:Object.prototype.toString.call(e)}function wi(e){return e>255?255:e<0?0:Math.round(e)}function xi(){if(si.isUnminified)return function(e,t){return yi._isNumber(e)||yi.warn(bi(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function Ei(e){if(si.isUnminified)return function(t,n){let r=yi._isNumber(t),i=yi._isArray(t)&&t.length==e;return r||i||yi.warn(bi(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function _i(){if(si.isUnminified)return function(e,t){return yi._isNumber(e)||"auto"===e||yi.warn(bi(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function zi(){if(si.isUnminified)return function(e,t){return yi._isString(e)||yi.warn(bi(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function Si(){if(si.isUnminified)return function(e,t){const n=yi._isString(e),r="[object CanvasGradient]"===Object.prototype.toString.call(e)||e&&e.addColorStop;return n||r||yi.warn(bi(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function Ci(){if(si.isUnminified)return function(e,t){return!0===e||!1===e||yi.warn(bi(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}function Oi(e){if(si.isUnminified)return function(t,n){return null==t||yi.isObject(t)||yi.warn(bi(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}var Mi="get",Ai="set";const ki={addGetterSetter(e,t,n,r,i){ki.addGetter(e,t,n),ki.addSetter(e,t,r,i),ki.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){var r=Mi+yi._capitalize(t);e.prototype[r]=e.prototype[r]||function(){var e=this.attrs[t];return void 0===e?n:e}},addSetter(e,t,n,r){var i=Ai+yi._capitalize(t);e.prototype[i]||ki.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){var i=Ai+yi._capitalize(t);e.prototype[i]=function(e){return n&&null!=e&&(e=n.call(this,e,t)),this._setAttr(t,e),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,i){var o,a,l=n.length,s=yi._capitalize,c=Mi+s(t),u=Ai+s(t);e.prototype[c]=function(){var e={};for(o=0;o<l;o++)e[a=n[o]]=this.getAttr(t+s(a));return e};var h=Oi(n);e.prototype[u]=function(e){var o,a=this.attrs[t];for(o in r&&(e=r.call(this,e)),h&&h.call(this,e,t),e)e.hasOwnProperty(o)&&this._setAttr(t+s(o),e[o]);return e||n.forEach((e=>{this._setAttr(t+s(e),void 0)})),this._fireChangeEvent(t,a,e),i&&i.call(this),this},ki.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){var n=yi._capitalize(t),r=Ai+n,i=Mi+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(e,t,n,r){yi.error("Adding deprecated "+t);var i=Mi+yi._capitalize(t),o=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[i]=function(){yi.error(o);var e=this.attrs[t];return void 0===e?n:e},ki.addSetter(e,t,r,(function(){yi.error(o)})),ki.addOverloadedGetterSetter(e,t)},backCompat(e,t){yi.each(t,(function(t,n){var r=e.prototype[n],i=Mi+yi._capitalize(t),o=Ai+yi._capitalize(t);function a(){r.apply(this,arguments),yi.error('"'+t+'" method is deprecated and will be removed soon. Use ""'+n+'" instead.')}e.prototype[t]=a,e.prototype[i]=a,e.prototype[o]=a}))},afterSetFilter(){this._filterUpToDate=!1}};function Li(e){var t,n,r=[],i=e.length,o=yi;for(t=0;t<i;t++)n=e[t],o._isNumber(n)?n=Math.round(1e3*n)/1e3:o._isString(n)||(n+=""),r.push(n);return r}var Pi=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"];class Ti{constructor(e){this.canvas=e,si.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){var n,r,i,o,a=this.traceArr,l=a.length,s="";for(n=0;n<l;n++)(i=(r=a[n]).method)?(o=r.args,s+=i,e?s+="()":yi._isArray(o[0])?s+="(["+o.join(",")+"])":(t&&(o=o.map((e=>"number"==typeof e?Math.floor(e):e))),s+="("+o.join(",")+")")):(s+=r.property,e||(s+="="+r.val)),s+=";";return s}clearTrace(){this.traceArr=[]}_trace(e){var t=this.traceArr;t.push(e),t.length>=100&&t.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){var t=e.getLineCap();t&&this.setAttr("lineCap",t)}_applyOpacity(e){var t=e.getAbsoluteOpacity();1!==t&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){var t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,i,o){this._context.arc(e,t,n,r,i,o)}arcTo(e,t,n,r,i){this._context.arcTo(e,t,n,r,i)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,i,o){this._context.bezierCurveTo(e,t,n,r,i,o)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(e,t){var n=arguments;return 2===n.length?this._context.createImageData(e,t):1===n.length?this._context.createImageData(e):void 0}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,i,o){return this._context.createRadialGradient(e,t,n,r,i,o)}drawImage(e,t,n,r,i,o,a,l,s){var c=arguments,u=this._context;3===c.length?u.drawImage(e,t,n):5===c.length?u.drawImage(e,t,n,r,i):9===c.length&&u.drawImage(e,t,n,r,i,o,a,l,s)}ellipse(e,t,n,r,i,o,a,l){this._context.ellipse(e,t,n,r,i,o,a,l)}isPointInPath(e,t){return this._context.isPointInPath(e,t)}fill(e){e?this._context.fill(e):this._context.fill()}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,i,o){this._context.setTransform(e,t,n,r,i,o)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,i,o){this._context.transform(e,t,n,r,i,o)}translate(e,t){this._context.translate(e,t)}_enableTrace(){var e,t,n=this,r=Pi.length,i=this.setAttr,o=function(e){var r,i=n[e];n[e]=function(){return t=Li(Array.prototype.slice.call(arguments,0)),r=i.apply(n,arguments),n._trace({method:e,args:t}),r}};for(e=0;e<r;e++)o(Pi[e]);n.setAttr=function(){i.apply(n,arguments);var e=arguments[0],t=arguments[1];"shadowOffsetX"!==e&&"shadowOffsetY"!==e&&"shadowBlur"!==e||(t/=this.canvas.getPixelRatio()),n._trace({property:e,val:t})}}_applyGlobalCompositeOperation(e){const t=e.attrs.globalCompositeOperation;!t||"source-over"===t||this.setAttr("globalCompositeOperation",t)}}["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"].forEach((function(e){Object.defineProperty(Ti.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})}));class Hi extends Ti{constructor(e){super(e),this._context=e._canvas.getContext("2d")}_fillColor(e){var t=e.fill();this.setAttr("fillStyle",t),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){var t=e._getLinearGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fillRadialGradient(e){var t=e._getRadialGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fill(e){var t=e.fill(),n=e.getFillPriority();if(t&&"color"===n)this._fillColor(e);else{var r=e.getFillPatternImage();if(r&&"pattern"===n)this._fillPattern(e);else{var i=e.getFillLinearGradientColorStops();if(i&&"linear-gradient"===n)this._fillLinearGradient(e);else{var o=e.getFillRadialGradientColorStops();o&&"radial-gradient"===n?this._fillRadialGradient(e):t?this._fillColor(e):r?this._fillPattern(e):i?this._fillLinearGradient(e):o&&this._fillRadialGradient(e)}}}}_strokeLinearGradient(e){var t=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),r=e.getStrokeLinearGradientColorStops(),i=this.createLinearGradient(t.x,t.y,n.x,n.y);if(r){for(var o=0;o<r.length;o+=2)i.addColorStop(r[o],r[o+1]);this.setAttr("strokeStyle",i)}}_stroke(e){var t=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();var r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(e),t&&e.dashEnabled()&&(this.setLineDash(t),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),n||this.restore()}}_applyShadow(e){var t,n,r,i=null!==(t=e.getShadowRGBA())&&void 0!==t?t:"black",o=null!==(n=e.getShadowBlur())&&void 0!==n?n:5,a=null!==(r=e.getShadowOffset())&&void 0!==r?r:{x:0,y:0},l=e.getAbsoluteScale(),s=this.canvas.getPixelRatio(),c=l.x*s,u=l.y*s;this.setAttr("shadowColor",i),this.setAttr("shadowBlur",o*Math.min(Math.abs(c),Math.abs(u))),this.setAttr("shadowOffsetX",a.x*c),this.setAttr("shadowOffsetY",a.y*u)}}class Ni extends Ti{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){var t=e.getStrokeScaleEnabled();if(!t){this.save();var n=this.getCanvas().getPixelRatio();this.setTransform(n,0,0,n,0,0)}this._applyLineCap(e);var r=e.hitStrokeWidth(),i="auto"===r?e.strokeWidth():r;this.setAttr("lineWidth",i),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),t||this.restore()}}}var Ri;class ji{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var t=(e||{}).pixelRatio||si.pixelRatio||function(){if(Ri)return Ri;var e=yi.createCanvasElement().getContext("2d");return Ri=(si._global.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)}();this.pixelRatio=t,this._canvas=yi.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){var t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";var t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";var t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch(e){try{return this._canvas.toDataURL()}catch(e){return yi.error("Unable to get data URL. "+e.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}ki.addGetterSetter(ji,"pixelRatio",void 0,xi());class Vi extends ji{constructor(e={width:0,height:0}){super(e),this.context=new Hi(this),this.setSize(e.width,e.height)}}class Ii extends ji{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new Ni(this),this.setSize(e.width,e.height)}}const Di={get isDragging(){var e=!1;return Di._dragElements.forEach((t=>{"dragging"===t.dragStatus&&(e=!0)})),e},justDragged:!1,get node(){var e;return Di._dragElements.forEach((t=>{e=t.node})),e},_dragElements:new Map,_drag(e){const t=[];Di._dragElements.forEach(((n,r)=>{const{node:i}=n,o=i.getStage();o.setPointersPositions(e),void 0===n.pointerId&&(n.pointerId=yi._getFirstPointerId(e));const a=o._changedPointerPositions.find((e=>e.id===n.pointerId));if(a){if("dragging"!==n.dragStatus){var l=i.dragDistance();if(Math.max(Math.abs(a.x-n.startPointerPos.x),Math.abs(a.y-n.startPointerPos.y))<l)return;if(i.startDrag({evt:e}),!i.isDragging())return}i._setDragPosition(e,n),t.push(i)}})),t.forEach((t=>{t.fire("dragmove",{type:"dragmove",target:t,evt:e},!0)}))},_endDragBefore(e){const t=[];Di._dragElements.forEach((n=>{const{node:r}=n,i=r.getStage();e&&i.setPointersPositions(e);if(!i._changedPointerPositions.find((e=>e.id===n.pointerId)))return;"dragging"!==n.dragStatus&&"stopped"!==n.dragStatus||(Di.justDragged=!0,si._mouseListenClick=!1,si._touchListenClick=!1,si._pointerListenClick=!1,n.dragStatus="stopped");const o=n.node.getLayer()||n.node instanceof si.Stage&&n.node;o&&-1===t.indexOf(o)&&t.push(o)})),t.forEach((e=>{e.draw()}))},_endDragAfter(e){Di._dragElements.forEach(((t,n)=>{"stopped"===t.dragStatus&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),"dragging"!==t.dragStatus&&Di._dragElements.delete(n)}))}};si.isBrowser&&(window.addEventListener("mouseup",Di._endDragBefore,!0),window.addEventListener("touchend",Di._endDragBefore,!0),window.addEventListener("mousemove",Di._drag),window.addEventListener("touchmove",Di._drag),window.addEventListener("mouseup",Di._endDragAfter,!1),window.addEventListener("touchend",Di._endDragAfter,!1));var Fi="absoluteOpacity",Bi="allEventListeners",Ui="absoluteTransform",Gi="absoluteScale",qi="canvas",Wi="listening",Ki="mouseenter",Yi="mouseleave",$i="Shape",Xi=" ",Qi="stage",Zi="transform",Ji="visible",eo=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Xi);let to=1;class no{constructor(e){this._id=to++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){e!==Zi&&e!==Ui||!this._cache.get(e)?e?this._cache.delete(e):this._cache.clear():this._cache.get(e).dirty=!0}_getCache(e,t){var n=this._cache.get(e);return(void 0===n||(e===Zi||e===Ui)&&!0===n.dirty)&&(n=t.call(this),this._cache.set(e,n)),n}_calculate(e,t,n){if(!this._attachedDepsListeners.get(e)){const n=t.map((e=>e+"Change.konva")).join(Xi);this.on(n,(()=>{this._clearCache(e)})),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(qi)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Ui&&this.fire("absoluteTransformChange")}clearCache(){return this._cache.delete(qi),this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var t=e||{},n={};void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height||(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var r=Math.ceil(t.width||n.width),i=Math.ceil(t.height||n.height),o=t.pixelRatio,a=void 0===t.x?Math.floor(n.x):t.x,l=void 0===t.y?Math.floor(n.y):t.y,s=t.offset||0,c=t.drawBorder||!1,u=t.hitCanvasPixelRatio||1;if(r&&i){a-=s,l-=s;var h=new Vi({pixelRatio:o,width:r+=2*s+1,height:i+=2*s+1}),f=new Vi({pixelRatio:o,width:0,height:0}),d=new Ii({pixelRatio:u,width:r,height:i}),p=h.getContext(),v=d.getContext();return d.isCache=!0,h.isCache=!0,this._cache.delete(qi),this._filterUpToDate=!1,!1===t.imageSmoothingEnabled&&(h.getContext()._context.imageSmoothingEnabled=!1,f.getContext()._context.imageSmoothingEnabled=!1),p.save(),v.save(),p.translate(-a,-l),v.translate(-a,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Fi),this._clearSelfAndDescendantCache(Gi),this.drawScene(h,this),this.drawHit(d,this),this._isUnderCache=!1,p.restore(),v.restore(),c&&(p.save(),p.beginPath(),p.rect(0,0,r,i),p.closePath(),p.setAttr("strokeStyle","red"),p.setAttr("lineWidth",5),p.stroke(),p.restore()),this._cache.set(qi,{scene:h,filter:f,hit:d,x:a,y:l}),this._requestDraw(),this}yi.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.")}isCached(){return this._cache.has(qi)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,t){var n,r,i,o,a=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],l=this.getAbsoluteTransform(t);return a.forEach((function(e){var t=l.point(e);void 0===n&&(n=i=t.x,r=o=t.y),n=Math.min(n,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x),o=Math.max(o,t.y)})),{x:n,y:r,width:i-n,height:o-r}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const t=this._getCanvasCache();e.translate(t.x,t.y);var n=this._getCachedSceneCanvas(),r=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/r,n.height/r),e.restore()}_drawCachedHitCanvas(e){var t=this._getCanvasCache(),n=t.hit;e.save(),e.translate(t.x,t.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e,t,n,r,i=this.filters(),o=this._getCanvasCache(),a=o.scene,l=o.filter,s=l.getContext();if(i){if(!this._filterUpToDate){var c=a.pixelRatio;l.setSize(a.width/a.pixelRatio,a.height/a.pixelRatio);try{for(e=i.length,s.clear(),s.drawImage(a._canvas,0,0,a.getWidth()/c,a.getHeight()/c),t=s.getImageData(0,0,l.getWidth(),l.getHeight()),n=0;n<e;n++)"function"==typeof(r=i[n])?(r.call(this,t),s.putImageData(t,0,0)):yi.error("Filter should be type of function, but got "+typeof r+" instead. Please check correct filters")}catch(e){yi.error("Unable to apply filter. "+e.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return l}return a}on(e,t){if(this._cache&&this._cache.delete(Bi),3===arguments.length)return this._delegate.apply(this,arguments);var n,r,i,o,a=e.split(Xi),l=a.length;for(n=0;n<l;n++)i=(r=a[n].split("."))[0],o=r[1]||"",this.eventListeners[i]||(this.eventListeners[i]=[]),this.eventListeners[i].push({name:o,handler:t});return this}off(e,t){var n,r,i,o,a,l=(e||"").split(Xi),s=l.length;if(this._cache&&this._cache.delete(Bi),!e)for(r in this.eventListeners)this._off(r);for(n=0;n<s;n++)if(o=(i=l[n].split("."))[0],a=i[1],o)this.eventListeners[o]&&this._off(o,a,t);else for(r in this.eventListeners)this._off(r,a,t);return this}dispatchEvent(e){var t={target:this,type:e.type,evt:e};return this.fire(e.type,t),this}addEventListener(e,t){return this.on(e,(function(e){t.call(this,e.evt)})),this}removeEventListener(e){return this.off(e),this}_delegate(e,t,n){var r=this;this.on(e,(function(e){for(var i=e.target.findAncestors(t,!0,r),o=0;o<i.length;o++)(e=yi.cloneObject(e)).currentTarget=i[o],n.call(i[o],e)}))}remove(){return this.isDragging()&&this.stopDrag(),Di._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Ui),this._clearSelfAndDescendantCache(Fi),this._clearSelfAndDescendantCache(Gi),this._clearSelfAndDescendantCache(Qi),this._clearSelfAndDescendantCache(Ji),this._clearSelfAndDescendantCache(Wi)}_remove(){this._clearCaches();var e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this}getAttr(e){var t="get"+yi._capitalize(e);return yi._isFunction(this[t])?this[t]():this.attrs[e]}getAncestors(){for(var e=this.getParent(),t=[];e;)t.push(e),e=e.getParent();return t}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges((()=>{var t,n;if(!e)return this;for(t in e)"children"!==t&&(n="set"+yi._capitalize(t),yi._isFunction(this[n])?this[n](e[t]):this._setAttr(t,e[t]))})),this}isListening(){return this._getCache(Wi,this._isListening)}_isListening(e){if(!this.listening())return!1;const t=this.getParent();return!t||t===e||this===e||t._isListening(e)}isVisible(){return this._getCache(Ji,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const t=this.getParent();return!t||t===e||this===e||t._isVisible(e)}shouldDrawHit(e,t=!1){if(e)return this._isVisible(e)&&this._isListening(e);var n=this.getLayer(),r=!1;Di._dragElements.forEach((e=>{"dragging"===e.dragStatus&&("Stage"===e.node.nodeType||e.node.getLayer()===n)&&(r=!0)}));var i=!t&&!si.hitOnDragEnabled&&r;return this.isListening()&&this.isVisible()&&!i}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e,t,n,r,i=this.getDepth(),o=this,a=0;return"Stage"!==o.nodeType&&function l(s){for(e=[],t=s.length,n=0;n<t;n++)r=s[n],a++,r.nodeType!==$i&&(e=e.concat(r.getChildren().slice())),r._id===o._id&&(n=t);e.length>0&&e[0].getDepth()<=i&&l(e)}(o.getStage().getChildren()),a}getDepth(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Zi),this._clearSelfAndDescendantCache(Ui)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges((()=>{this.x(e.x),this.y(e.y)})),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var e=this.getStage().getPointerPosition();if(!e)return null;var t=this.getAbsoluteTransform().copy();return t.invert(),t.point(e)}getAbsolutePosition(e){let t=!1,n=this.parent;for(;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);var r=this.getAbsoluteTransform(e).getMatrix(),i=new ui,o=this.offset();return i.m=r.slice(),i.translate(o.x,o.y),i.getTranslation()}setAbsolutePosition(e){var t=this._clearTransform();this.attrs.x=t.x,this.attrs.y=t.y,delete t.x,delete t.y,this._clearCache(Zi);var n=this._getAbsoluteTransform().copy();return n.invert(),n.translate(e.x,e.y),e={x:this.attrs.x+n.getTranslation().x,y:this.attrs.y+n.getTranslation().y},this._setTransform(t),this.setPosition({x:e.x,y:e.y}),this._clearCache(Zi),this._clearSelfAndDescendantCache(Ui),this}_setTransform(e){var t;for(t in e)this.attrs[t]=e[t]}_clearTransform(){var e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){var t=e.x,n=e.y,r=this.x(),i=this.y();return void 0!==t&&(r+=t),void 0!==n&&(i+=n),this.setPosition({x:r,y:i}),this}_eachAncestorReverse(e,t){var n,r,i=[],o=this.getParent();if(!t||t._id!==this._id){for(i.unshift(this);o&&(!t||o._id!==t._id);)i.unshift(o),o=o.parent;for(n=i.length,r=0;r<n;r++)e(i[r])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return yi.warn("Node has no parent. moveToTop function is ignored."),!1;var e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0)}moveUp(){if(!this.parent)return yi.warn("Node has no parent. moveUp function is ignored."),!1;var e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0)}moveDown(){if(!this.parent)return yi.warn("Node has no parent. moveDown function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return yi.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(e){if(!this.parent)return yi.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&yi.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Fi,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),t=this.getParent();return t&&!t._isUnderCache&&(e*=t.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e,t,n,r,i={},o=this.getAttrs();for(e in i.attrs={},o)t=o[e],yi.isObject(t)&&!yi._isPlainObject(t)&&!yi._isArray(t)||(n="function"==typeof this[e]&&this[e],delete o[e],r=n?n.call(this):null,o[e]=t,r!==t&&(i.attrs[e]=t));return i.className=this.getClassName(),yi._prepareToStringify(i)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,t,n){var r=[];t&&this._isMatch(e)&&r.push(this);for(var i=this.parent;i;){if(i===n)return r;i._isMatch(e)&&r.push(i),i=i.parent}return r}isAncestorOf(e){return!1}findAncestor(e,t,n){return this.findAncestors(e,t,n)[0]}_isMatch(e){if(!e)return!1;if("function"==typeof e)return e(this);var t,n,r=e.replace(/ /g,"").split(","),i=r.length;for(t=0;t<i;t++)if(n=r[t],yi.isValidSelector(n)||(yi.warn('Selector "'+n+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),yi.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),yi.warn("Konva is awesome, right?")),"#"===n.charAt(0)){if(this.id()===n.slice(1))return!0}else if("."===n.charAt(0)){if(this.hasName(n.slice(1)))return!0}else if(this.className===n||this.nodeType===n)return!0;return!1}getLayer(){var e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(Qi,this._getStage)}_getStage(){var e=this.getParent();return e?e.getStage():void 0}fire(e,t={},n){return t.target=t.target||this,n?this._fireAndBubble(e,t):this._fire(e,t),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(Ui,this._getAbsoluteTransform)}_getAbsoluteTransform(e){var t;if(e)return t=new ui,this._eachAncestorReverse((function(e){var n=e.transformsEnabled();"all"===n?t.multiply(e.getTransform()):"position"===n&&t.translate(e.x()-e.offsetX(),e.y()-e.offsetY())}),e),t;t=this._cache.get(Ui)||new ui,this.parent?this.parent.getAbsoluteTransform().copyInto(t):t.reset();var n=this.transformsEnabled();if("all"===n)t.multiply(this.getTransform());else if("position"===n){const e=this.attrs.x||0,n=this.attrs.y||0,r=this.attrs.offsetX||0,i=this.attrs.offsetY||0;t.translate(e-r,n-i)}return t.dirty=!1,t}getAbsoluteScale(e){for(var t=this;t;)t._isUnderCache&&(e=t),t=t.getParent();const n=this.getAbsoluteTransform(e).decompose();return{x:n.scaleX,y:n.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Zi,this._getTransform)}_getTransform(){var e,t,n=this._cache.get(Zi)||new ui;n.reset();var r=this.x(),i=this.y(),o=si.getAngle(this.rotation()),a=null!==(e=this.attrs.scaleX)&&void 0!==e?e:1,l=null!==(t=this.attrs.scaleY)&&void 0!==t?t:1,s=this.attrs.skewX||0,c=this.attrs.skewY||0,u=this.attrs.offsetX||0,h=this.attrs.offsetY||0;return 0===r&&0===i||n.translate(r,i),0!==o&&n.rotate(o),0===s&&0===c||n.skew(s,c),1===a&&1===l||n.scale(a,l),0===u&&0===h||n.translate(-1*u,-1*h),n.dirty=!1,n}clone(e){var t,n,r,i,o,a=yi.cloneObject(this.attrs);for(t in e)a[t]=e[t];var l=new this.constructor(a);for(t in this.eventListeners)for(r=(n=this.eventListeners[t]).length,i=0;i<r;i++)(o=n[i]).name.indexOf("konva")<0&&(l.eventListeners[t]||(l.eventListeners[t]=[]),l.eventListeners[t].push(o));return l}_toKonvaCanvas(e){e=e||{};var t=this.getClientRect(),n=this.getStage(),r=void 0!==e.x?e.x:Math.floor(t.x),i=void 0!==e.y?e.y:Math.floor(t.y),o=e.pixelRatio||1,a=new Vi({width:e.width||Math.ceil(t.width)||(n?n.width():0),height:e.height||Math.ceil(t.height)||(n?n.height():0),pixelRatio:o}),l=a.getContext();return!1===e.imageSmoothingEnabled&&(l._context.imageSmoothingEnabled=!1),l.save(),(r||i)&&l.translate(-1*r,-1*i),this.drawScene(a),l.restore(),a}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){var t=(e=e||{}).mimeType||null,n=e.quality||null,r=this._toKonvaCanvas(e).toDataURL(t,n);return e.callback&&e.callback(r),r}toImage(e){return new Promise(((t,n)=>{try{const n=null==e?void 0:e.callback;n&&delete e.callback,yi._urlToImage(this.toDataURL(e),(function(e){t(e),null==n||n(e)}))}catch(e){n(e)}}))}toBlob(e){return new Promise(((t,n)=>{try{const n=null==e?void 0:e.callback;n&&delete e.callback,this.toCanvas(e).toBlob((e=>{t(e),null==n||n(e)}))}catch(e){n(e)}}))}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():si.dragDistance}_off(e,t,n){var r,i,o,a=this.eventListeners[e];for(r=0;r<a.length;r++)if(i=a[r].name,o=a[r].handler,!("konva"===i&&"konva"!==t||t&&i!==t||n&&n!==o)){if(a.splice(r,1),0===a.length){delete this.eventListeners[e];break}r--}}_fireChangeEvent(e,t,n){this._fire(e+"Change",{oldVal:t,newVal:n})}addName(e){if(!this.hasName(e)){var t=this.name(),n=t?t+" "+e:e;this.name(n)}return this}hasName(e){if(!e)return!1;const t=this.name();return!!t&&-1!==(t||"").split(/\s/g).indexOf(e)}removeName(e){var t=(this.name()||"").split(/\s/g),n=t.indexOf(e);return-1!==n&&(t.splice(n,1),this.name(t.join(" "))),this}setAttr(e,t){var n=this["set"+yi._capitalize(e)];return yi._isFunction(n)?n.call(this,t):this._setAttr(e,t),this}_requestDraw(){if(si.autoDrawEnabled){const e=this.getLayer()||this.getStage();null==e||e.batchDraw()}}_setAttr(e,t){var n=this.attrs[e];(n!==t||yi.isObject(t))&&(null==t?delete this.attrs[e]:this.attrs[e]=t,this._shouldFireChangeEvents&&this._fireChangeEvent(e,n,t),this._requestDraw())}_setComponentAttr(e,t,n){var r;void 0!==n&&((r=this.attrs[e])||(this.attrs[e]=this.getAttr(e)),this.attrs[e][t]=n,this._fireChangeEvent(e,r,n))}_fireAndBubble(e,t,n){if(t&&this.nodeType===$i&&(t.target=this),!((e===Ki||e===Yi)&&(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||"Stage"===this.nodeType&&!n))){this._fire(e,t);var r=(e===Ki||e===Yi)&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(t&&!t.cancelBubble||!t)&&this.parent&&this.parent.isListening()&&!r&&(n&&n.parent?this._fireAndBubble.call(this.parent,e,t,n):this._fireAndBubble.call(this.parent,e,t))}}_getProtoListeners(e){let t=this._cache.get(Bi);if(!t){t={};let e=Object.getPrototypeOf(this);for(;e;)if(e.eventListeners){for(var n in e.eventListeners){const r=e.eventListeners[n],i=t[n]||[];t[n]=r.concat(i)}e=Object.getPrototypeOf(e)}else e=Object.getPrototypeOf(e);this._cache.set(Bi,t)}return t[e]}_fire(e,t){(t=t||{}).currentTarget=this,t.type=e;const n=this._getProtoListeners(e);if(n)for(var r=0;r<n.length;r++)n[r].handler.call(this,t);const i=this.eventListeners[e];if(i)for(r=0;r<i.length;r++)i[r].handler.call(this,t)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){var t=e?e.pointerId:void 0,n=this.getStage(),r=this.getAbsolutePosition(),i=n._getPointerById(t)||n._changedPointerPositions[0]||r;Di._dragElements.set(this._id,{node:this,startPointerPos:i,offset:{x:i.x-r.x,y:i.y-r.y},dragStatus:"ready",pointerId:t})}startDrag(e,t=!0){Di._dragElements.has(this._id)||this._createDragElement(e);Di._dragElements.get(this._id).dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:e&&e.evt},t)}_setDragPosition(e,t){const n=this.getStage()._getPointerById(t.pointerId);if(n){var r={x:n.x-t.offset.x,y:n.y-t.offset.y},i=this.dragBoundFunc();if(void 0!==i){const t=i.call(this,r,e);t?r=t:yi.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}this._lastPos&&this._lastPos.x===r.x&&this._lastPos.y===r.y||(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}}stopDrag(e){const t=Di._dragElements.get(this._id);t&&(t.dragStatus="stopped"),Di._endDragBefore(e),Di._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){const e=Di._dragElements.get(this._id);return!!e&&"dragging"===e.dragStatus}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",(function(e){if((!(void 0!==e.evt.button)||si.dragButtons.indexOf(e.evt.button)>=0)&&!this.isDragging()){var t=!1;Di._dragElements.forEach((e=>{this.isAncestorOf(e.node)&&(t=!0)})),t||this._createDragElement(e)}}))}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const e=Di._dragElements.get(this._id),t=e&&"dragging"===e.dragStatus,n=e&&"ready"===e.dragStatus;t?this.stopDrag():n&&Di._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const t=this.getStage();if(!t)return!1;const n={x:-e.x,y:-e.y,width:t.width()+2*e.x,height:t.height()+2*e.y};return yi.haveIntersection(n,this.getClientRect())}static create(e,t){return yi._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}static _createNode(e,t){var n,r,i,o=no.prototype.getClassName.call(e),a=e.children;t&&(e.attrs.container=t),si[o]||(yi.warn('Can not find a node with class name "'+o+'". Fallback to "Shape".'),o="Shape");if(n=new(0,si[o])(e.attrs),a)for(r=a.length,i=0;i<r;i++)n.add(no._createNode(a[i]));return n}}no.prototype.nodeType="Node",no.prototype._attrsAffectingSize=[],no.prototype.eventListeners={},no.prototype.on.call(no.prototype,eo,(function(){this._batchingTransformChange?this._needClearTransformCache=!0:(this._clearCache(Zi),this._clearSelfAndDescendantCache(Ui))})),no.prototype.on.call(no.prototype,"visibleChange.konva",(function(){this._clearSelfAndDescendantCache(Ji)})),no.prototype.on.call(no.prototype,"listeningChange.konva",(function(){this._clearSelfAndDescendantCache(Wi)})),no.prototype.on.call(no.prototype,"opacityChange.konva",(function(){this._clearSelfAndDescendantCache(Fi)}));const ro=ki.addGetterSetter;ro(no,"zIndex"),ro(no,"absolutePosition"),ro(no,"position"),ro(no,"x",0,xi()),ro(no,"y",0,xi()),ro(no,"globalCompositeOperation","source-over",zi()),ro(no,"opacity",1,xi()),ro(no,"name","",zi()),ro(no,"id","",zi()),ro(no,"rotation",0,xi()),ki.addComponentsGetterSetter(no,"scale",["x","y"]),ro(no,"scaleX",1,xi()),ro(no,"scaleY",1,xi()),ki.addComponentsGetterSetter(no,"skew",["x","y"]),ro(no,"skewX",0,xi()),ro(no,"skewY",0,xi()),ki.addComponentsGetterSetter(no,"offset",["x","y"]),ro(no,"offsetX",0,xi()),ro(no,"offsetY",0,xi()),ro(no,"dragDistance",null,xi()),ro(no,"width",0,xi()),ro(no,"height",0,xi()),ro(no,"listening",!0,Ci()),ro(no,"preventDefault",!0,Ci()),ro(no,"filters",null,(function(e){return this._filterUpToDate=!1,e})),ro(no,"visible",!0,Ci()),ro(no,"transformsEnabled","all",zi()),ro(no,"size"),ro(no,"dragBoundFunc"),ro(no,"draggable",!1,Ci()),ki.backCompat(no,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class io extends no{constructor(){super(...arguments),this.children=[]}getChildren(e){if(!e)return this.children||[];const t=this.children||[];var n=[];return t.forEach((function(t){e(t)&&n.push(t)})),n}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach((e=>{e.parent=null,e.index=0,e.remove()})),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach((e=>{e.parent=null,e.index=0,e.destroy()})),this.children=[],this._requestDraw(),this}add(...e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}var n=e[0];return n.getParent()?(n.moveTo(this),this):(this._validateAdd(n),n.index=this.getChildren().length,n.parent=this,n._clearCaches(),this.getChildren().push(n),this._fire("add",{child:n}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){var t=this._generalFind(e,!0);return t.length>0?t[0]:void 0}_generalFind(e,t){var n=[];return this._descendants((r=>{const i=r._isMatch(e);return i&&n.push(r),!(!i||!t)})),n}_descendants(e){let t=!1;const n=this.getChildren();for(const r of n){if(t=e(r),t)return!0;if(r.hasChildren()&&(t=r._descendants(e),t))return!0}return!1}toObject(){var e=no.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach((t=>{e.children.push(t.toObject())})),e}isAncestorOf(e){for(var t=e.getParent();t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){var t=no.prototype.clone.call(this,e);return this.getChildren().forEach((function(e){t.add(e.clone())})),t}getAllIntersections(e){var t=[];return this.find("Shape").forEach((function(n){n.isVisible()&&n.intersects(e)&&t.push(n)})),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),this.isCached()||null===(t=this.children)||void 0===t||t.forEach((function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;null===(e=this.children)||void 0===e||e.forEach((function(e,t){e.index=t})),this._requestDraw()}drawScene(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas(),i=r&&r.getContext(),o=this._getCanvasCache(),a=o&&o.scene,l=r&&r.isCache;if(!this.isVisible()&&!l)return this;if(a){i.save();var s=this.getAbsoluteTransform(t).getMatrix();i.transform(s[0],s[1],s[2],s[3],s[4],s[5]),this._drawCachedSceneCanvas(i),i.restore()}else this._drawChildren("drawScene",r,t);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;var n=this.getLayer(),r=e||n&&n.hitCanvas,i=r&&r.getContext(),o=this._getCanvasCache();if(o&&o.hit){i.save();var a=this.getAbsoluteTransform(t).getMatrix();i.transform(a[0],a[1],a[2],a[3],a[4],a[5]),this._drawCachedHitCanvas(i),i.restore()}else this._drawChildren("drawHit",r,t);return this}_drawChildren(e,t,n){var r,i=t&&t.getContext(),o=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),s=o&&a||l;const c=n===this;if(s){i.save();var u=this.getAbsoluteTransform(n),h=u.getMatrix();if(i.transform(h[0],h[1],h[2],h[3],h[4],h[5]),i.beginPath(),l)l.call(this,i,this);else{var f=this.clipX(),d=this.clipY();i.rect(f,d,o,a)}i.clip(),h=u.copy().invert().getMatrix(),i.transform(h[0],h[1],h[2],h[3],h[4],h[5])}var p=!c&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===e;p&&(i.save(),i._applyGlobalCompositeOperation(this)),null===(r=this.children)||void 0===r||r.forEach((function(r){r[e](t,n)})),p&&i.restore(),s&&i.restore()}getClientRect(e){var t,n,r,i,o,a=(e=e||{}).skipTransform,l=e.relativeTo,s={x:1/0,y:1/0,width:0,height:0},c=this;null===(t=this.children)||void 0===t||t.forEach((function(t){if(t.visible()){var a=t.getClientRect({relativeTo:c,skipShadow:e.skipShadow,skipStroke:e.skipStroke});0===a.width&&0===a.height||(void 0===n?(n=a.x,r=a.y,i=a.x+a.width,o=a.y+a.height):(n=Math.min(n,a.x),r=Math.min(r,a.y),i=Math.max(i,a.x+a.width),o=Math.max(o,a.y+a.height)))}}));for(var u=this.find("Shape"),h=!1,f=0;f<u.length;f++){if(u[f]._isVisible(this)){h=!0;break}}return s=h&&void 0!==n?{x:n,y:r,width:i-n,height:o-r}:{x:0,y:0,width:0,height:0},a?s:this._transformedRect(s,l)}}ki.addComponentsGetterSetter(io,"clip",["x","y","width","height"]),ki.addGetterSetter(io,"clipX",void 0,xi()),ki.addGetterSetter(io,"clipY",void 0,xi()),ki.addGetterSetter(io,"clipWidth",void 0,xi()),ki.addGetterSetter(io,"clipHeight",void 0,xi()),ki.addGetterSetter(io,"clipFunc");const oo=new Map,ao=void 0!==si._global.PointerEvent;function lo(e){return oo.get(e)}function so(e){return{evt:e,pointerId:e.pointerId}}function co(e,t){return oo.get(e)===t}function uo(e,t){ho(e);t.getStage()&&(oo.set(e,t),ao&&t._fire("gotpointercapture",so(new PointerEvent("gotpointercapture"))))}function ho(e,t){const n=oo.get(e);if(!n)return;const r=n.getStage();r&&r.content,oo.delete(e),ao&&n._fire("lostpointercapture",so(new PointerEvent("lostpointercapture")))}var fo="mouseleave",po="mouseover",vo="mouseenter",mo="mousemove",go="mousedown",yo="mouseup",bo="pointermove",wo="pointerdown",xo="pointerup",Eo="pointercancel",_o="pointerout",zo="pointerleave",So="pointerover",Co="pointerenter",Oo="contextmenu",Mo="touchstart",Ao="touchend",ko="touchmove",Lo="touchcancel",Po="wheel",To=[[vo,"_pointerenter"],[go,"_pointerdown"],[mo,"_pointermove"],[yo,"_pointerup"],[fo,"_pointerleave"],[Mo,"_pointerdown"],[ko,"_pointermove"],[Ao,"_pointerup"],[Lo,"_pointercancel"],[po,"_pointerover"],[Po,"_wheel"],[Oo,"_contextmenu"],[wo,"_pointerdown"],[bo,"_pointermove"],[xo,"_pointerup"],[Eo,"_pointercancel"],["lostpointercapture","_lostpointercapture"]];const Ho={mouse:{[_o]:"mouseout",[zo]:fo,[So]:po,[Co]:vo,[bo]:mo,[wo]:go,[xo]:yo,[Eo]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[_o]:"touchout",[zo]:"touchleave",[So]:"touchover",[Co]:"touchenter",[bo]:ko,[wo]:Mo,[xo]:Ao,[Eo]:Lo,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[_o]:_o,[zo]:zo,[So]:So,[Co]:Co,[bo]:bo,[wo]:wo,[xo]:xo,[Eo]:Eo,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},No=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",Ro=e=>{const t=No(e);return"pointer"===t?si.pointerEventsEnabled&&Ho.pointer:"touch"===t?Ho.touch:"mouse"===t?Ho.mouse:void 0};function jo(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&yi.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}const Vo=[];class Io extends io{constructor(e){super(jo(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Vo.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",(()=>{jo(this.attrs)})),this._checkVisibility()}_validateAdd(e){const t="Layer"===e.getType(),n="FastLayer"===e.getType();t||n||yi.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if("string"==typeof e){if("."===e.charAt(0)){var t=e.slice(1);e=document.getElementsByClassName(t)[0]}else{var n;n="#"!==e.charAt(0)?e:e.slice(1),e=document.getElementById(n)}if(!e)throw"Can not find container in document with id "+n}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var e,t=this.children,n=t.length;for(e=0;e<n;e++)t[e].clear();return this}clone(e){return e||(e={}),e.container="undefined"!=typeof document&&document.createElement("div"),io.prototype.clone.call(this,e)}destroy(){super.destroy();var e=this.content;e&&yi._isInDocument(e)&&this.container().removeChild(e);var t=Vo.indexOf(this);return t>-1&&Vo.splice(t,1),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(yi.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)}_getPointerById(e){return this._pointerPositions.find((t=>t.id===e))}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){(e=e||{}).x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var t=new Vi({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach((function(t){if(t.isVisible()){var r=t._toKonvaCanvas(e);n.drawImage(r._canvas,e.x,e.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}})),t}getIntersection(e){if(!e)return null;var t,n=this.children;for(t=n.length-1;t>=0;t--){const r=n[t].getIntersection(e);if(r)return r}return null}_resizeDOM(){var e=this.width(),t=this.height();this.content&&(this.content.style.width=e+"px",this.content.style.height=t+"px"),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach((n=>{n.setSize({width:e,height:t}),n.draw()}))}add(e,...t){if(arguments.length>1){for(var n=0;n<arguments.length;n++)this.add(arguments[n]);return this}super.add(e);var r=this.children.length;return r>5&&yi.warn("The stage has "+r+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),si.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return co(e,this)}setPointerCapture(e){uo(e,this)}releaseCapture(e){ho(e)}getLayers(){return this.children}_bindContentEvents(){si.isBrowser&&To.forEach((([e,t])=>{this.content.addEventListener(e,(e=>{this[t](e)}),{passive:!1})}))}_pointerenter(e){this.setPointersPositions(e);const t=Ro(e.type);this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=Ro(e.type);this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+"targetShape"];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){const t=Ro(e.type),n=No(e.type);if(t){this.setPointersPositions(e);var r=this._getTargetShape(n),i=!Di.isDragging||si.hitOnDragEnabled;r&&i?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):i&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(e){const t=Ro(e.type),n=No(e.type);if(t){this.setPointersPositions(e);var r=!1;this._changedPointerPositions.forEach((i=>{var o=this.getIntersection(i);Di.justDragged=!1,si["_"+n+"ListenClick"]=!0;if(!(o&&o.isListening()))return;si.capturePointerEventsEnabled&&o.setPointerCapture(i.id),this[n+"ClickStartShape"]=o,o._fireAndBubble(t.pointerdown,{evt:e,pointerId:i.id}),r=!0;const a=e.type.indexOf("touch")>=0;o.preventDefault()&&e.cancelable&&a&&e.preventDefault()})),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(e){const t=Ro(e.type),n=No(e.type);if(!t)return;if(Di.isDragging&&Di.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e),!(!Di.isDragging||si.hitOnDragEnabled))return;var r={};let i=!1;var o=this._getTargetShape(n);this._changedPointerPositions.forEach((a=>{const l=lo(a.id)||this.getIntersection(a),s=a.id,c={evt:e,pointerId:s};var u=o!==l;if(u&&o&&(o._fireAndBubble(t.pointerout,Object.assign({},c),l),o._fireAndBubble(t.pointerleave,Object.assign({},c),l)),l){if(r[l._id])return;r[l._id]=!0}l&&l.isListening()?(i=!0,u&&(l._fireAndBubble(t.pointerover,Object.assign({},c),o),l._fireAndBubble(t.pointerenter,Object.assign({},c),o),this[n+"targetShape"]=l),l._fireAndBubble(t.pointermove,Object.assign({},c))):o&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:s}),this[n+"targetShape"]=null)})),i||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=Ro(e.type),n=No(e.type);if(!t)return;this.setPointersPositions(e);const r=this[n+"ClickStartShape"],i=this[n+"ClickEndShape"];var o={};let a=!1;this._changedPointerPositions.forEach((l=>{const s=lo(l.id)||this.getIntersection(l);if(s){if(s.releaseCapture(l.id),o[s._id])return;o[s._id]=!0}const c=l.id,u={evt:e,pointerId:c};let h=!1;si["_"+n+"InDblClickWindow"]?(h=!0,clearTimeout(this[n+"DblTimeout"])):Di.justDragged||(si["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout((function(){si["_"+n+"InDblClickWindow"]=!1}),si.dblClickWindow),s&&s.isListening()?(a=!0,this[n+"ClickEndShape"]=s,s._fireAndBubble(t.pointerup,Object.assign({},u)),si["_"+n+"ListenClick"]&&r&&r===s&&(s._fireAndBubble(t.pointerclick,Object.assign({},u)),h&&i&&i===s&&s._fireAndBubble(t.pointerdblclick,Object.assign({},u)))):(this[n+"ClickEndShape"]=null,si["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:c}),h&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:c}))})),a||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),si["_"+n+"ListenClick"]=!1,e.cancelable&&"touch"!==n&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(Oo,{evt:e}):this._fire(Oo,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(Po,{evt:e}):this._fire(Po,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=lo(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(xo,so(e)),ho(e.pointerId)}_lostpointercapture(e){ho(e.pointerId)}setPointersPositions(e){var t=this._getContentPosition(),n=null,r=null;void 0!==(e=e||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,(e=>{this._pointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})})),Array.prototype.forEach.call(e.changedTouches||e.touches,(e=>{this._changedPointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}))):(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:yi._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:yi._getFirstPointerId(e)}])}_setPointerPosition(e){yi.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Vi({width:this.width(),height:this.height()}),this.bufferHitCanvas=new Ii({pixelRatio:1,width:this.width(),height:this.height()}),si.isBrowser){var e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}}cache(){return yi.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach((function(e){e.batchDraw()})),this}}Io.prototype.nodeType="Stage",ci(Io),ki.addGetterSetter(Io,"container");var Do="hasShadow",Fo="shadowRGBA",Bo="patternImage",Uo="linearGradient",Go="radialGradient";let qo;function Wo(){return qo||(qo=yi.createCanvasElement().getContext("2d"),qo)}const Ko={};class Yo extends no{constructor(e){let t;for(super(e);t=yi.getRandomColor(),!t||t in Ko;);this.colorKey=t,Ko[t]=this}getContext(){return yi.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return yi.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(Do,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Bo,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=Wo().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new ui;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(si.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),r="undefined"==typeof DOMMatrix?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(r)}return e}}_getLinearGradient(){return this._getCache(Uo,this.__getLinearGradient)}__getLinearGradient(){var e=this.fillLinearGradientColorStops();if(e){for(var t=Wo(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),i=t.createLinearGradient(n.x,n.y,r.x,r.y),o=0;o<e.length;o+=2)i.addColorStop(e[o],e[o+1]);return i}}_getRadialGradient(){return this._getCache(Go,this.__getRadialGradient)}__getRadialGradient(){var e=this.fillRadialGradientColorStops();if(e){for(var t=Wo(),n=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),i=t.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius()),o=0;o<e.length;o+=2)i.addColorStop(e[o],e[o+1]);return i}}getShadowRGBA(){return this._getCache(Fo,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var e=yi.colorToRGBA(this.shadowColor());return e?"rgba("+e.r+","+e.g+","+e.b+","+e.a*(this.shadowOpacity()||1)+")":void 0}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],(()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops())))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],(()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops())))}hasHitStroke(){const e=this.hitStrokeWidth();return"auto"===e?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){var t=this.getStage().bufferHitCanvas;return t.getContext().clear(),this.drawHit(t,null,!0),t.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return no.prototype.destroy.call(this),delete Ko[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var t;if(!this.getStage())return!1;if(!(null===(t=this.attrs.perfectDrawEnabled)||void 0===t||t))return!1;const n=e||this.hasFill(),r=this.hasStroke(),i=1!==this.getAbsoluteOpacity();if(n&&r&&i)return!0;const o=this.hasShadow(),a=this.shadowForStrokeEnabled();return!!(n&&r&&o&&a)}setStrokeHitEnabled(e){yi.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){var e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){const t=e.skipTransform,n=e.relativeTo,r=this.getSelfRect(),i=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,o=r.width+i,a=r.height+i,l=!e.skipShadow&&this.hasShadow(),s=l?this.shadowOffsetX():0,c=l?this.shadowOffsetY():0,u=o+Math.abs(s),h=a+Math.abs(c),f=l&&this.shadowBlur()||0,d={width:u+2*f,height:h+2*f,x:-(i/2+f)+Math.min(s,0)+r.x,y:-(i/2+f)+Math.min(c,0)+r.y};return t?d:this._transformedRect(d,n)}drawScene(e,t){var n,r,i=this.getLayer(),o=e||i.getCanvas(),a=o.getContext(),l=this._getCanvasCache(),s=this.getSceneFunc(),c=this.hasShadow(),u=o.isCache,h=t===this;if(!this.isVisible()&&!h)return this;if(l){a.save();var f=this.getAbsoluteTransform(t).getMatrix();return a.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedSceneCanvas(a),a.restore(),this}if(!s)return this;if(a.save(),this._useBufferCanvas()&&!u){(r=(n=this.getStage().bufferCanvas).getContext()).clear(),r.save(),r._applyLineJoin(this);var d=this.getAbsoluteTransform(t).getMatrix();r.transform(d[0],d[1],d[2],d[3],d[4],d[5]),s.call(this,r,this),r.restore();var p=n.pixelRatio;c&&a._applyShadow(this),a._applyOpacity(this),a._applyGlobalCompositeOperation(this),a.drawImage(n._canvas,0,0,n.width/p,n.height/p)}else{if(a._applyLineJoin(this),!h){d=this.getAbsoluteTransform(t).getMatrix();a.transform(d[0],d[1],d[2],d[3],d[4],d[5]),a._applyOpacity(this),a._applyGlobalCompositeOperation(this)}c&&a._applyShadow(this),s.call(this,a,this)}return a.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;var r=this.getLayer(),i=e||r.hitCanvas,o=i&&i.getContext(),a=this.hitFunc()||this.sceneFunc(),l=this._getCanvasCache(),s=l&&l.hit;if(this.colorKey||yi.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),s){o.save();var c=this.getAbsoluteTransform(t).getMatrix();return o.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedHitCanvas(o),o.restore(),this}if(!a)return this;o.save(),o._applyLineJoin(this);if(!(this===t)){var u=this.getAbsoluteTransform(t).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5])}return a.call(this,o,this),o.restore(),this}drawHitFromCache(e=0){var t,n,r,i,o,a=this._getCanvasCache(),l=this._getCachedSceneCanvas(),s=a.hit,c=s.getContext(),u=s.getWidth(),h=s.getHeight();c.clear(),c.drawImage(l._canvas,0,0,u,h);try{for(r=(n=(t=c.getImageData(0,0,u,h)).data).length,i=yi._hexToRgb(this.colorKey),o=0;o<r;o+=4)n[o+3]>e?(n[o]=i.r,n[o+1]=i.g,n[o+2]=i.b,n[o+3]=255):n[o+3]=0;c.putImageData(t,0,0)}catch(e){yi.error("Unable to draw hit graph from cached scene canvas. "+e.message)}return this}hasPointerCapture(e){return co(e,this)}setPointerCapture(e){uo(e,this)}releaseCapture(e){ho(e)}}Yo.prototype._fillFunc=function(e){e.fill()},Yo.prototype._strokeFunc=function(e){e.stroke()},Yo.prototype._fillFuncHit=function(e){e.fill()},Yo.prototype._strokeFuncHit=function(e){e.stroke()},Yo.prototype._centroid=!1,Yo.prototype.nodeType="Shape",ci(Yo),Yo.prototype.eventListeners={},Yo.prototype.on.call(Yo.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(Do)})),Yo.prototype.on.call(Yo.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(Fo)})),Yo.prototype.on.call(Yo.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",(function(){this._clearCache(Bo)})),Yo.prototype.on.call(Yo.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",(function(){this._clearCache(Uo)})),Yo.prototype.on.call(Yo.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",(function(){this._clearCache(Go)})),ki.addGetterSetter(Yo,"stroke",void 0,Si()),ki.addGetterSetter(Yo,"strokeWidth",2,xi()),ki.addGetterSetter(Yo,"fillAfterStrokeEnabled",!1),ki.addGetterSetter(Yo,"hitStrokeWidth","auto",_i()),ki.addGetterSetter(Yo,"strokeHitEnabled",!0,Ci()),ki.addGetterSetter(Yo,"perfectDrawEnabled",!0,Ci()),ki.addGetterSetter(Yo,"shadowForStrokeEnabled",!0,Ci()),ki.addGetterSetter(Yo,"lineJoin"),ki.addGetterSetter(Yo,"lineCap"),ki.addGetterSetter(Yo,"sceneFunc"),ki.addGetterSetter(Yo,"hitFunc"),ki.addGetterSetter(Yo,"dash"),ki.addGetterSetter(Yo,"dashOffset",0,xi()),ki.addGetterSetter(Yo,"shadowColor",void 0,zi()),ki.addGetterSetter(Yo,"shadowBlur",0,xi()),ki.addGetterSetter(Yo,"shadowOpacity",1,xi()),ki.addComponentsGetterSetter(Yo,"shadowOffset",["x","y"]),ki.addGetterSetter(Yo,"shadowOffsetX",0,xi()),ki.addGetterSetter(Yo,"shadowOffsetY",0,xi()),ki.addGetterSetter(Yo,"fillPatternImage"),ki.addGetterSetter(Yo,"fill",void 0,Si()),ki.addGetterSetter(Yo,"fillPatternX",0,xi()),ki.addGetterSetter(Yo,"fillPatternY",0,xi()),ki.addGetterSetter(Yo,"fillLinearGradientColorStops"),ki.addGetterSetter(Yo,"strokeLinearGradientColorStops"),ki.addGetterSetter(Yo,"fillRadialGradientStartRadius",0),ki.addGetterSetter(Yo,"fillRadialGradientEndRadius",0),ki.addGetterSetter(Yo,"fillRadialGradientColorStops"),ki.addGetterSetter(Yo,"fillPatternRepeat","repeat"),ki.addGetterSetter(Yo,"fillEnabled",!0),ki.addGetterSetter(Yo,"strokeEnabled",!0),ki.addGetterSetter(Yo,"shadowEnabled",!0),ki.addGetterSetter(Yo,"dashEnabled",!0),ki.addGetterSetter(Yo,"strokeScaleEnabled",!0),ki.addGetterSetter(Yo,"fillPriority","color"),ki.addComponentsGetterSetter(Yo,"fillPatternOffset",["x","y"]),ki.addGetterSetter(Yo,"fillPatternOffsetX",0,xi()),ki.addGetterSetter(Yo,"fillPatternOffsetY",0,xi()),ki.addComponentsGetterSetter(Yo,"fillPatternScale",["x","y"]),ki.addGetterSetter(Yo,"fillPatternScaleX",1,xi()),ki.addGetterSetter(Yo,"fillPatternScaleY",1,xi()),ki.addComponentsGetterSetter(Yo,"fillLinearGradientStartPoint",["x","y"]),ki.addComponentsGetterSetter(Yo,"strokeLinearGradientStartPoint",["x","y"]),ki.addGetterSetter(Yo,"fillLinearGradientStartPointX",0),ki.addGetterSetter(Yo,"strokeLinearGradientStartPointX",0),ki.addGetterSetter(Yo,"fillLinearGradientStartPointY",0),ki.addGetterSetter(Yo,"strokeLinearGradientStartPointY",0),ki.addComponentsGetterSetter(Yo,"fillLinearGradientEndPoint",["x","y"]),ki.addComponentsGetterSetter(Yo,"strokeLinearGradientEndPoint",["x","y"]),ki.addGetterSetter(Yo,"fillLinearGradientEndPointX",0),ki.addGetterSetter(Yo,"strokeLinearGradientEndPointX",0),ki.addGetterSetter(Yo,"fillLinearGradientEndPointY",0),ki.addGetterSetter(Yo,"strokeLinearGradientEndPointY",0),ki.addComponentsGetterSetter(Yo,"fillRadialGradientStartPoint",["x","y"]),ki.addGetterSetter(Yo,"fillRadialGradientStartPointX",0),ki.addGetterSetter(Yo,"fillRadialGradientStartPointY",0),ki.addComponentsGetterSetter(Yo,"fillRadialGradientEndPoint",["x","y"]),ki.addGetterSetter(Yo,"fillRadialGradientEndPointX",0),ki.addGetterSetter(Yo,"fillRadialGradientEndPointY",0),ki.addGetterSetter(Yo,"fillPatternRotation",0),ki.backCompat(Yo,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var $o=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Xo=$o.length;class Qo extends io{constructor(e){super(e),this.canvas=new Vi,this.hitCanvas=new Ii({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[e+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){no.prototype.moveToTop.call(this);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!no.prototype.moveUp.call(this))return!1;var e=this.getStage();return!(!e||!e.content)&&(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(no.prototype.moveDown.call(this)){var e=this.getStage();if(e){var t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(no.prototype.moveToBottom.call(this)){var e=this.getStage();if(e){var t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var e=this.getNativeCanvasElement();return no.prototype.remove.call(this),e&&e.parentNode&&yi._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:t}){return this.canvas.setSize(e,t),this.hitCanvas.setSize(e,t),this._setSmoothEnabled(),this}_validateAdd(e){var t=e.getType();"Group"!==t&&"Shape"!==t&&yi.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return(e=e||{}).width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=void 0!==e.x?e.x:this.x(),e.y=void 0!==e.y?e.y:this.y(),no.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){const e=this.visible();this.canvas._canvas.style.display=e?"block":"none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){yi.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){yi.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,yi.requestAnimFrame((()=>{this.draw(),this._waitingForDraw=!1}))),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var t=1,n=!1;;){for(let r=0;r<Xo;r++){const i=$o[r],o=this._getIntersection({x:e.x+i.x*t,y:e.y+i.y*t}),a=o.shape;if(a)return a;if(n=!!o.antialiased,!o.antialiased)break}if(!n)return null;t+=1}}_getIntersection(e){const t=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(e.x*t),Math.round(e.y*t),1,1).data,r=n[3];if(255===r){const e=yi._rgbToHex(n[0],n[1],n[2]),t=Ko["#"+e];return t?{shape:t}:{antialiased:!0}}return r>0?{antialiased:!0}:{}}drawScene(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),io.prototype.drawScene.call(this,r,t),this._fire("draw",{node:this}),this}drawHit(e,t){var n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),io.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){yi.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return yi.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(this.parent&&this.parent.content){var e=this.parent;!!this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}}Qo.prototype.nodeType="Layer",ci(Qo),ki.addGetterSetter(Qo,"imageSmoothingEnabled",!0),ki.addGetterSetter(Qo,"clearBeforeDraw",!0),ki.addGetterSetter(Qo,"hitGraphEnabled",!0,Ci());class Zo extends Qo{constructor(e){super(e),this.listening(!1),yi.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Zo.prototype.nodeType="FastLayer",ci(Zo);class Jo extends io{_validateAdd(e){var t=e.getType();"Group"!==t&&"Shape"!==t&&yi.throw("You may only add groups and shapes to groups.")}}Jo.prototype.nodeType="Group",ci(Jo);var ea=li.performance&&li.performance.now?function(){return li.performance.now()}:function(){return(new Date).getTime()};class ta{constructor(e,t){this.id=ta.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:ea(),frameRate:0},this.func=e,this.setLayers(t)}setLayers(e){var t=[];return t=e?e.length>0?e:[e]:[],this.layers=t,this}getLayers(){return this.layers}addLayer(e){var t,n=this.layers,r=n.length;for(t=0;t<r;t++)if(n[t]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){var e,t=ta.animations,n=t.length;for(e=0;e<n;e++)if(t[e].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=ea(),ta._addAnimation(this),this}stop(){return ta._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){var t,n=e.id,r=this.animations,i=r.length;for(t=0;t<i;t++)if(r[t].id===n){this.animations.splice(t,1);break}}static _runFrames(){var e,t,n,r,i,o,a,l,s={},c=this.animations;for(r=0;r<c.length;r++)if(t=(e=c[r]).layers,n=e.func,e._updateFrameObject(ea()),o=t.length,!n||!1!==n.call(e,e.frame))for(i=0;i<o;i++)void 0!==(a=t[i])._id&&(s[a._id]=a);for(l in s)s.hasOwnProperty(l)&&s[l].batchDraw()}static _animationLoop(){var e=ta;e.animations.length?(e._runFrames(),yi.requestAnimFrame(e._animationLoop)):e.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,yi.requestAnimFrame(this._animationLoop))}}ta.animations=[],ta.animIdCounter=0,ta.animRunning=!1;var na={node:1,duration:1,easing:1,onFinish:1,yoyo:1},ra=0,ia=["fill","stroke","shadowColor"];class oa{constructor(e,t,n,r,i,o,a){this.prop=e,this.propFunc=t,this.begin=r,this._pos=r,this.duration=o,this._change=0,this.prevPos=0,this.yoyo=a,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=i-this.begin,this.pause()}fire(e){var t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return void 0===e&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var e=this.getTimer()-this._startTime;2===this.state?this.setTime(e):3===this.state&&this.setTime(this.duration-e)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class aa{constructor(e){var t,n,r=this,i=e.node,o=i._id,a=e.easing||la.Linear,l=!!e.yoyo;t=void 0===e.duration?.3:0===e.duration?.001:e.duration,this.node=i,this._id=ra++;var s=i.getLayer()||(i instanceof si.Stage?i.getLayers():null);for(n in s||yi.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new ta((function(){r.tween.onEnterFrame()}),s),this.tween=new oa(n,(function(e){r._tweenFunc(e)}),a,0,1,1e3*t,l),this._addListeners(),aa.attrs[o]||(aa.attrs[o]={}),aa.attrs[o][this._id]||(aa.attrs[o][this._id]={}),aa.tweens[o]||(aa.tweens[o]={}),e)void 0===na[n]&&this._addAttr(n,e[n]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,t){var n,r,i,o,a,l,s,c,u=this.node,h=u._id;if((i=aa.tweens[h][e])&&delete aa.attrs[h][i][e],n=u.getAttr(e),yi._isArray(t))if(r=[],a=Math.max(t.length,n.length),"points"===e&&t.length!==n.length&&(t.length>n.length?(s=n,n=yi._prepareArrayForTween(n,t,u.closed())):(l=t,t=yi._prepareArrayForTween(t,n,u.closed()))),0===e.indexOf("fill"))for(o=0;o<a;o++)if(o%2==0)r.push(t[o]-n[o]);else{var f=yi.colorToRGBA(n[o]);c=yi.colorToRGBA(t[o]),n[o]=f,r.push({r:c.r-f.r,g:c.g-f.g,b:c.b-f.b,a:c.a-f.a})}else for(o=0;o<a;o++)r.push(t[o]-n[o]);else-1!==ia.indexOf(e)?(n=yi.colorToRGBA(n),r={r:(c=yi.colorToRGBA(t)).r-n.r,g:c.g-n.g,b:c.b-n.b,a:c.a-n.a}):r=t-n;aa.attrs[h][this._id][e]={start:n,diff:r,end:t,trueEnd:l,trueStart:s},aa.tweens[h][e]=this._id}_tweenFunc(e){var t,n,r,i,o,a,l,s,c=this.node,u=aa.attrs[c._id][this._id];for(t in u){if(r=(n=u[t]).start,i=n.diff,s=n.end,yi._isArray(r))if(o=[],l=Math.max(r.length,s.length),0===t.indexOf("fill"))for(a=0;a<l;a++)a%2==0?o.push((r[a]||0)+i[a]*e):o.push("rgba("+Math.round(r[a].r+i[a].r*e)+","+Math.round(r[a].g+i[a].g*e)+","+Math.round(r[a].b+i[a].b*e)+","+(r[a].a+i[a].a*e)+")");else for(a=0;a<l;a++)o.push((r[a]||0)+i[a]*e);else o=-1!==ia.indexOf(t)?"rgba("+Math.round(r.r+i.r*e)+","+Math.round(r.g+i.g*e)+","+Math.round(r.b+i.b*e)+","+(r.a+i.a*e)+")":r+i*e;c.setAttr(t,o)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var e=this.node,t=aa.attrs[e._id][this._id];t.points&&t.points.trueEnd&&e.setAttr("points",t.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var e=this.node,t=aa.attrs[e._id][this._id];t.points&&t.points.trueStart&&e.points(t.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(1e3*e),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e,t=this.node._id,n=this._id,r=aa.tweens[t];for(e in this.pause(),r)delete aa.tweens[t][e];delete aa.attrs[t][n]}}aa.attrs={},aa.tweens={},no.prototype.to=function(e){var t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new aa(e).play()};const la={BackEaseIn(e,t,n,r){var i=1.70158;return n*(e/=r)*e*((i+1)*e-i)+t},BackEaseOut(e,t,n,r){var i=1.70158;return n*((e=e/r-1)*e*((i+1)*e+i)+1)+t},BackEaseInOut(e,t,n,r){var i=1.70158;return(e/=r/2)<1?n/2*(e*e*((1+(i*=1.525))*e-i))+t:n/2*((e-=2)*e*((1+(i*=1.525))*e+i)+2)+t},ElasticEaseIn(e,t,n,r,i,o){var a=0;return 0===e?t:1==(e/=r)?t+n:(o||(o=.3*r),!i||i<Math.abs(n)?(i=n,a=o/4):a=o/(2*Math.PI)*Math.asin(n/i),-i*Math.pow(2,10*(e-=1))*Math.sin((e*r-a)*(2*Math.PI)/o)+t)},ElasticEaseOut(e,t,n,r,i,o){var a=0;return 0===e?t:1==(e/=r)?t+n:(o||(o=.3*r),!i||i<Math.abs(n)?(i=n,a=o/4):a=o/(2*Math.PI)*Math.asin(n/i),i*Math.pow(2,-10*e)*Math.sin((e*r-a)*(2*Math.PI)/o)+n+t)},ElasticEaseInOut(e,t,n,r,i,o){var a=0;return 0===e?t:2==(e/=r/2)?t+n:(o||(o=r*(.3*1.5)),!i||i<Math.abs(n)?(i=n,a=o/4):a=o/(2*Math.PI)*Math.asin(n/i),e<1?i*Math.pow(2,10*(e-=1))*Math.sin((e*r-a)*(2*Math.PI)/o)*-.5+t:i*Math.pow(2,-10*(e-=1))*Math.sin((e*r-a)*(2*Math.PI)/o)*.5+n+t)},BounceEaseOut:(e,t,n,r)=>(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t,BounceEaseIn:(e,t,n,r)=>n-la.BounceEaseOut(r-e,0,n,r)+t,BounceEaseInOut:(e,t,n,r)=>e<r/2?.5*la.BounceEaseIn(2*e,0,n,r)+t:.5*la.BounceEaseOut(2*e-r,0,n,r)+.5*n+t,EaseIn:(e,t,n,r)=>n*(e/=r)*e+t,EaseOut:(e,t,n,r)=>-n*(e/=r)*(e-2)+t,EaseInOut:(e,t,n,r)=>(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t,StrongEaseIn:(e,t,n,r)=>n*(e/=r)*e*e*e*e+t,StrongEaseOut:(e,t,n,r)=>n*((e=e/r-1)*e*e*e*e+1)+t,StrongEaseInOut:(e,t,n,r)=>(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t,Linear:(e,t,n,r)=>n*e/r+t},sa=yi._assign(si,{Util:yi,Transform:ui,Node:no,Container:io,Stage:Io,stages:Vo,Layer:Qo,FastLayer:Zo,Group:Jo,DD:Di,Shape:Yo,shapes:Ko,Animation:ta,Tween:aa,Easings:la,Context:Ti,Canvas:ji});class ca extends Yo{_sceneFunc(e){var t=si.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=si.getAngle(n?360-this.angle():this.angle()),i=Math.cos(Math.min(r,Math.PI)),o=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),a=Math.sin(Math.min(r,Math.PI/2)),l=i*(i>0?e:t),s=o*(o>0?e:t),c=a*(a>0?t:e);return{x:l,y:n?-1*c:s,width:1*t-l,height:c-s}}}function ua(e,t,n,r,i,o,a){var l=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),s=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),c=a*l/(l+s),u=a*s/(l+s);return[n-c*(i-e),r-c*(o-t),n+u*(i-e),r+u*(o-t)]}function ha(e,t){var n,r,i=e.length,o=[];for(n=2;n<i-2;n+=2)r=ua(e[n-2],e[n-1],e[n],e[n+1],e[n+2],e[n+3],t),isNaN(r[0])||(o.push(r[0]),o.push(r[1]),o.push(e[n]),o.push(e[n+1]),o.push(r[2]),o.push(r[3]));return o}ca.prototype._centroid=!0,ca.prototype.className="Arc",ca.prototype._attrsAffectingSize=["innerRadius","outerRadius"],ci(ca),ki.addGetterSetter(ca,"innerRadius",0,xi()),ki.addGetterSetter(ca,"outerRadius",0,xi()),ki.addGetterSetter(ca,"angle",0,xi()),ki.addGetterSetter(ca,"clockwise",!1,Ci());class fa extends Yo{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",(function(){this._clearCache("tensionPoints")}))}_sceneFunc(e){var t,n,r,i=this.points(),o=i.length,a=this.tension(),l=this.closed(),s=this.bezier();if(o){if(e.beginPath(),e.moveTo(i[0],i[1]),0!==a&&o>4){for(n=(t=this.getTensionPoints()).length,r=l?0:4,l||e.quadraticCurveTo(t[0],t[1],t[2],t[3]);r<n-2;)e.bezierCurveTo(t[r++],t[r++],t[r++],t[r++],t[r++],t[r++]);l||e.quadraticCurveTo(t[n-2],t[n-1],i[o-2],i[o-1])}else if(s)for(r=2;r<o;)e.bezierCurveTo(i[r++],i[r++],i[r++],i[r++],i[r++],i[r++]);else for(r=2;r<o;r+=2)e.lineTo(i[r],i[r+1]);l?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():ha(this.points(),this.tension())}_getTensionPointsClosed(){var e=this.points(),t=e.length,n=this.tension(),r=ua(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),i=ua(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),o=ha(e,n);return[r[2],r[3]].concat(o).concat([i[0],i[1],e[t-2],e[t-1],i[2],i[3],r[0],r[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};for(var t,n,r=(e=0!==this.tension()?[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:this.points())[0],i=e[0],o=e[1],a=e[1],l=0;l<e.length/2;l++)t=e[2*l],n=e[2*l+1],r=Math.min(r,t),i=Math.max(i,t),o=Math.min(o,n),a=Math.max(a,n);return{x:r,y:o,width:i-r,height:a-o}}}fa.prototype.className="Line",fa.prototype._attrsAffectingSize=["points","bezier","tension"],ci(fa),ki.addGetterSetter(fa,"closed",!1),ki.addGetterSetter(fa,"bezier",!1),ki.addGetterSetter(fa,"tension",0,xi()),ki.addGetterSetter(fa,"points",[],function(){if(si.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(yi._isArray(e)?e.forEach((function(e){yi._isNumber(e)||yi.warn('"'+t+'" attribute has non numeric element '+e+". Make sure that all elements are numbers.")})):yi.warn(bi(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}());class da extends Yo{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this.dataArray=da.parsePathData(this.data()),this.pathLength=0;for(var t=0;t<this.dataArray.length;++t)this.pathLength+=this.dataArray[t].pathLength;this.on("dataChange.konva",(function(){this.dataArray=da.parsePathData(this.data()),this.pathLength=0;for(var e=0;e<this.dataArray.length;++e)this.pathLength+=this.dataArray[e].pathLength}))}_sceneFunc(e){var t=this.dataArray;e.beginPath();for(var n=!1,r=0;r<t.length;r++){var i=t[r].command,o=t[r].points;switch(i){case"L":e.lineTo(o[0],o[1]);break;case"M":e.moveTo(o[0],o[1]);break;case"C":e.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"Q":e.quadraticCurveTo(o[0],o[1],o[2],o[3]);break;case"A":var a=o[0],l=o[1],s=o[2],c=o[3],u=o[4],h=o[5],f=o[6],d=o[7],p=s>c?s:c,v=s>c?1:s/c,m=s>c?c/s:1;e.translate(a,l),e.rotate(f),e.scale(v,m),e.arc(0,0,p,u,u+h,1-d),e.scale(1/v,1/m),e.rotate(-f),e.translate(-a,-l);break;case"z":n=!0,e.closePath()}}n||this.hasFill()?e.fillStrokeShape(this):e.strokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach((function(t){if("A"===t.command){var n=t.points[4],r=t.points[5],i=t.points[4]+r,o=Math.PI/180;if(Math.abs(n-i)<o&&(o=Math.abs(n-i)),r<0)for(let r=n-o;r>i;r-=o){const n=da.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],r,0);e.push(n.x,n.y)}else for(let r=n+o;r<i;r+=o){const n=da.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],r,0);e.push(n.x,n.y)}}else if("C"===t.command)for(let n=0;n<=1;n+=.01){const r=da.getPointOnCubicBezier(n,t.start.x,t.start.y,t.points[0],t.points[1],t.points[2],t.points[3],t.points[4],t.points[5]);e.push(r.x,r.y)}else e=e.concat(t.points)}));for(var t,n,r=e[0],i=e[0],o=e[1],a=e[1],l=0;l<e.length/2;l++)t=e[2*l],n=e[2*l+1],isNaN(t)||(r=Math.min(r,t),i=Math.max(i,t)),isNaN(n)||(o=Math.min(o,n),a=Math.max(a,n));return{x:r,y:o,width:i-r,height:a-o}}getLength(){return this.pathLength}getPointAtLength(e){var t,n=0,r=this.dataArray.length;if(!r)return null;for(;n<r&&e>this.dataArray[n].pathLength;)e-=this.dataArray[n].pathLength,++n;if(n===r)return{x:(t=this.dataArray[n-1].points.slice(-2))[0],y:t[1]};if(e<.01)return{x:(t=this.dataArray[n].points.slice(0,2))[0],y:t[1]};var i=this.dataArray[n],o=i.points;switch(i.command){case"L":return da.getPointOnLine(e,i.start.x,i.start.y,o[0],o[1]);case"C":return da.getPointOnCubicBezier(e/i.pathLength,i.start.x,i.start.y,o[0],o[1],o[2],o[3],o[4],o[5]);case"Q":return da.getPointOnQuadraticBezier(e/i.pathLength,i.start.x,i.start.y,o[0],o[1],o[2],o[3]);case"A":var a=o[0],l=o[1],s=o[2],c=o[3],u=o[4],h=o[5],f=o[6];return u+=h*e/i.pathLength,da.getPointOnEllipticalArc(a,l,s,c,u,f)}return null}static getLineLength(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}static getPointOnLine(e,t,n,r,i,o,a){void 0===o&&(o=t),void 0===a&&(a=n);var l=(i-n)/(r-t+1e-8),s=Math.sqrt(e*e/(1+l*l));r<t&&(s*=-1);var c,u=l*s;if(r===t)c={x:o,y:a+u};else if((a-n)/(o-t+1e-8)===l)c={x:o+s,y:a+u};else{var h,f,d=this.getLineLength(t,n,r,i),p=(o-t)*(r-t)+(a-n)*(i-n);h=t+(p/=d*d)*(r-t),f=n+p*(i-n);var v=this.getLineLength(o,a,h,f),m=Math.sqrt(e*e-v*v);s=Math.sqrt(m*m/(1+l*l)),r<t&&(s*=-1),c={x:h+s,y:f+(u=l*s)}}return c}static getPointOnCubicBezier(e,t,n,r,i,o,a,l,s){function c(e){return e*e*e}function u(e){return 3*e*e*(1-e)}function h(e){return 3*e*(1-e)*(1-e)}function f(e){return(1-e)*(1-e)*(1-e)}return{x:l*c(e)+o*u(e)+r*h(e)+t*f(e),y:s*c(e)+a*u(e)+i*h(e)+n*f(e)}}static getPointOnQuadraticBezier(e,t,n,r,i,o,a){function l(e){return e*e}function s(e){return 2*e*(1-e)}function c(e){return(1-e)*(1-e)}return{x:o*l(e)+r*s(e)+t*c(e),y:a*l(e)+i*s(e)+n*c(e)}}static getPointOnEllipticalArc(e,t,n,r,i,o){var a=Math.cos(o),l=Math.sin(o),s=n*Math.cos(i),c=r*Math.sin(i);return{x:e+(s*a-c*l),y:t+(s*l+c*a)}}static parsePathData(e){if(!e)return[];var t=e,n=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];t=t.replace(new RegExp(" ","g"),",");for(var r=0;r<n.length;r++)t=t.replace(new RegExp(n[r],"g"),"|"+n[r]);var i,o=t.split("|"),a=[],l=[],s=0,c=0,u=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;for(r=1;r<o.length;r++){var h=o[r],f=h.charAt(0);for(h=h.slice(1),l.length=0;i=u.exec(h);)l.push(i[0]);for(var d=[],p=0,v=l.length;p<v;p++)if("00"!==l[p]){var m=parseFloat(l[p]);isNaN(m)?d.push(0):d.push(m)}else d.push(0,0);for(;d.length>0&&!isNaN(d[0]);){var g,y,b,w,x,E,_,z,S,C,O=null,M=[],A=s,k=c;switch(f){case"l":s+=d.shift(),c+=d.shift(),O="L",M.push(s,c);break;case"L":s=d.shift(),c=d.shift(),M.push(s,c);break;case"m":var L=d.shift(),P=d.shift();if(s+=L,c+=P,O="M",a.length>2&&"z"===a[a.length-1].command)for(var T=a.length-2;T>=0;T--)if("M"===a[T].command){s=a[T].points[0]+L,c=a[T].points[1]+P;break}M.push(s,c),f="l";break;case"M":s=d.shift(),c=d.shift(),O="M",M.push(s,c),f="L";break;case"h":s+=d.shift(),O="L",M.push(s,c);break;case"H":s=d.shift(),O="L",M.push(s,c);break;case"v":c+=d.shift(),O="L",M.push(s,c);break;case"V":c=d.shift(),O="L",M.push(s,c);break;case"C":M.push(d.shift(),d.shift(),d.shift(),d.shift()),s=d.shift(),c=d.shift(),M.push(s,c);break;case"c":M.push(s+d.shift(),c+d.shift(),s+d.shift(),c+d.shift()),s+=d.shift(),c+=d.shift(),O="C",M.push(s,c);break;case"S":y=s,b=c,"C"===(g=a[a.length-1]).command&&(y=s+(s-g.points[2]),b=c+(c-g.points[3])),M.push(y,b,d.shift(),d.shift()),s=d.shift(),c=d.shift(),O="C",M.push(s,c);break;case"s":y=s,b=c,"C"===(g=a[a.length-1]).command&&(y=s+(s-g.points[2]),b=c+(c-g.points[3])),M.push(y,b,s+d.shift(),c+d.shift()),s+=d.shift(),c+=d.shift(),O="C",M.push(s,c);break;case"Q":M.push(d.shift(),d.shift()),s=d.shift(),c=d.shift(),M.push(s,c);break;case"q":M.push(s+d.shift(),c+d.shift()),s+=d.shift(),c+=d.shift(),O="Q",M.push(s,c);break;case"T":y=s,b=c,"Q"===(g=a[a.length-1]).command&&(y=s+(s-g.points[0]),b=c+(c-g.points[1])),s=d.shift(),c=d.shift(),O="Q",M.push(y,b,s,c);break;case"t":y=s,b=c,"Q"===(g=a[a.length-1]).command&&(y=s+(s-g.points[0]),b=c+(c-g.points[1])),s+=d.shift(),c+=d.shift(),O="Q",M.push(y,b,s,c);break;case"A":w=d.shift(),x=d.shift(),E=d.shift(),_=d.shift(),z=d.shift(),S=s,C=c,s=d.shift(),c=d.shift(),O="A",M=this.convertEndpointToCenterParameterization(S,C,s,c,_,z,w,x,E);break;case"a":w=d.shift(),x=d.shift(),E=d.shift(),_=d.shift(),z=d.shift(),S=s,C=c,s+=d.shift(),c+=d.shift(),O="A",M=this.convertEndpointToCenterParameterization(S,C,s,c,_,z,w,x,E)}a.push({command:O||f,points:M,start:{x:A,y:k},pathLength:this.calcLength(A,k,O||f,M)})}"z"!==f&&"Z"!==f||a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(e,t,n,r){var i,o,a,l,s=da;switch(n){case"L":return s.getLineLength(e,t,r[0],r[1]);case"C":for(i=0,o=s.getPointOnCubicBezier(0,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),l=.01;l<=1;l+=.01)a=s.getPointOnCubicBezier(l,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),i+=s.getLineLength(o.x,o.y,a.x,a.y),o=a;return i;case"Q":for(i=0,o=s.getPointOnQuadraticBezier(0,e,t,r[0],r[1],r[2],r[3]),l=.01;l<=1;l+=.01)a=s.getPointOnQuadraticBezier(l,e,t,r[0],r[1],r[2],r[3]),i+=s.getLineLength(o.x,o.y,a.x,a.y),o=a;return i;case"A":i=0;var c=r[4],u=r[5],h=r[4]+u,f=Math.PI/180;if(Math.abs(c-h)<f&&(f=Math.abs(c-h)),o=s.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],c,0),u<0)for(l=c-f;l>h;l-=f)a=s.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],l,0),i+=s.getLineLength(o.x,o.y,a.x,a.y),o=a;else for(l=c+f;l<h;l+=f)a=s.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],l,0),i+=s.getLineLength(o.x,o.y,a.x,a.y),o=a;return a=s.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],h,0),i+=s.getLineLength(o.x,o.y,a.x,a.y)}return 0}static convertEndpointToCenterParameterization(e,t,n,r,i,o,a,l,s){var c=s*(Math.PI/180),u=Math.cos(c)*(e-n)/2+Math.sin(c)*(t-r)/2,h=-1*Math.sin(c)*(e-n)/2+Math.cos(c)*(t-r)/2,f=u*u/(a*a)+h*h/(l*l);f>1&&(a*=Math.sqrt(f),l*=Math.sqrt(f));var d=Math.sqrt((a*a*(l*l)-a*a*(h*h)-l*l*(u*u))/(a*a*(h*h)+l*l*(u*u)));i===o&&(d*=-1),isNaN(d)&&(d=0);var p=d*a*h/l,v=d*-l*u/a,m=(e+n)/2+Math.cos(c)*p-Math.sin(c)*v,g=(t+r)/2+Math.sin(c)*p+Math.cos(c)*v,y=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},b=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(y(e)*y(t))},w=function(e,t){return(e[0]*t[1]<e[1]*t[0]?-1:1)*Math.acos(b(e,t))},x=w([1,0],[(u-p)/a,(h-v)/l]),E=[(u-p)/a,(h-v)/l],_=[(-1*u-p)/a,(-1*h-v)/l],z=w(E,_);return b(E,_)<=-1&&(z=Math.PI),b(E,_)>=1&&(z=0),0===o&&z>0&&(z-=2*Math.PI),1===o&&z<0&&(z+=2*Math.PI),[m,g,a,l,x,z,c,o]}}da.prototype.className="Path",da.prototype._attrsAffectingSize=["data"],ci(da),ki.addGetterSetter(da,"data");class pa extends fa{_sceneFunc(e){super._sceneFunc(e);var t=2*Math.PI,n=this.points(),r=n,i=0!==this.tension()&&n.length>4;i&&(r=this.getTensionPoints());var o,a,l=this.pointerLength(),s=n.length;if(i){const e=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[s-2],n[s-1]],t=da.calcLength(r[r.length-4],r[r.length-3],"C",e),i=da.getPointOnQuadraticBezier(Math.min(1,1-l/t),e[0],e[1],e[2],e[3],e[4],e[5]);o=n[s-2]-i.x,a=n[s-1]-i.y}else o=n[s-2]-n[s-4],a=n[s-1]-n[s-3];var c=(Math.atan2(a,o)+t)%t,u=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[s-2],n[s-1]),e.rotate(c),e.moveTo(0,0),e.lineTo(-l,u/2),e.lineTo(-l,-u/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),i?(o=(r[0]+r[2])/2-n[0],a=(r[1]+r[3])/2-n[1]):(o=n[2]-n[0],a=n[3]-n[1]),e.rotate((Math.atan2(-a,-o)+t)%t),e.moveTo(0,0),e.lineTo(-l,u/2),e.lineTo(-l,-u/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}}pa.prototype.className="Arrow",ci(pa),ki.addGetterSetter(pa,"pointerLength",10,xi()),ki.addGetterSetter(pa,"pointerWidth",10,xi()),ki.addGetterSetter(pa,"pointerAtBeginning",!1),ki.addGetterSetter(pa,"pointerAtEnding",!0);class va extends Yo{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,2*Math.PI,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}va.prototype._centroid=!0,va.prototype.className="Circle",va.prototype._attrsAffectingSize=["radius"],ci(va),ki.addGetterSetter(va,"radius",0,xi());class ma extends Yo{_sceneFunc(e){var t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,2*Math.PI,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radiusX()}getHeight(){return 2*this.radiusY()}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}ma.prototype.className="Ellipse",ma.prototype._centroid=!0,ma.prototype._attrsAffectingSize=["radiusX","radiusY"],ci(ma),ki.addComponentsGetterSetter(ma,"radius",["x","y"]),ki.addGetterSetter(ma,"radiusX",0,xi()),ki.addGetterSetter(ma,"radiusY",0,xi());class ga extends Yo{constructor(e){super(e),this.on("imageChange.konva",(()=>{this._setImageLoad()})),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&4===e.readyState||e&&e.addEventListener&&e.addEventListener("load",(()=>{this._requestDraw()}))}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const t=this.getWidth(),n=this.getHeight(),r=this.attrs.image;let i;if(r){const e=this.attrs.cropWidth,o=this.attrs.cropHeight;i=e&&o?[r,this.cropX(),this.cropY(),e,o,0,0,t,n]:[r,0,0,t,n]}(this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)),r&&e.drawImage.apply(e,i)}_hitFunc(e){var t=this.width(),n=this.height();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,t;return null!==(e=this.attrs.width)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.width}getHeight(){var e,t;return null!==(e=this.attrs.height)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.height}static fromURL(e,t,n=null){var r=yi.createImageElement();r.onload=function(){var e=new ga({image:r});t(e)},r.onerror=n,r.crossOrigin="Anonymous",r.src=e}}ga.prototype.className="Image",ci(ga),ki.addGetterSetter(ga,"image"),ki.addComponentsGetterSetter(ga,"crop",["x","y","width","height"]),ki.addGetterSetter(ga,"cropX",0,xi()),ki.addGetterSetter(ga,"cropY",0,xi()),ki.addGetterSetter(ga,"cropWidth",0,xi()),ki.addGetterSetter(ga,"cropHeight",0,xi());var ya=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],ba="up",wa="right",xa="down",Ea="left",_a=ya.length;class za extends Jo{constructor(e){super(e),this.on("add.konva",(function(e){this._addListeners(e.child),this._sync()}))}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){var t,n=this,r=function(){n._sync()};for(t=0;t<_a;t++)e.on(ya[t]+"Change.konva",r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var e,t,n,r,i,o,a,l=this.getText(),s=this.getTag();if(l&&s){switch(e=l.width(),t=l.height(),n=s.pointerDirection(),r=s.pointerWidth(),a=s.pointerHeight(),i=0,o=0,n){case ba:i=e/2,o=-1*a;break;case wa:i=e+r,o=t/2;break;case xa:i=e/2,o=t+a;break;case Ea:i=-1*r,o=t/2}s.setAttrs({x:-1*i,y:-1*o,width:e,height:t}),l.setAttrs({x:-1*i,y:-1*o})}}}za.prototype.className="Label",ci(za);class Sa extends Yo{_sceneFunc(e){var t=this.width(),n=this.height(),r=this.pointerDirection(),i=this.pointerWidth(),o=this.pointerHeight(),a=this.cornerRadius();let l=0,s=0,c=0,u=0;"number"==typeof a?l=s=c=u=Math.min(a,t/2,n/2):(l=Math.min(a[0]||0,t/2,n/2),s=Math.min(a[1]||0,t/2,n/2),u=Math.min(a[2]||0,t/2,n/2),c=Math.min(a[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(l,0),r===ba&&(e.lineTo((t-i)/2,0),e.lineTo(t/2,-1*o),e.lineTo((t+i)/2,0)),e.lineTo(t-s,0),e.arc(t-s,s,s,3*Math.PI/2,0,!1),r===wa&&(e.lineTo(t,(n-o)/2),e.lineTo(t+i,n/2),e.lineTo(t,(n+o)/2)),e.lineTo(t,n-u),e.arc(t-u,n-u,u,0,Math.PI/2,!1),r===xa&&(e.lineTo((t+i)/2,n),e.lineTo(t/2,n+o),e.lineTo((t-i)/2,n)),e.lineTo(c,n),e.arc(c,n-c,c,Math.PI/2,Math.PI,!1),r===Ea&&(e.lineTo(0,(n+o)/2),e.lineTo(-1*i,n/2),e.lineTo(0,(n-o)/2)),e.lineTo(0,l),e.arc(l,l,l,Math.PI,3*Math.PI/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){var e=0,t=0,n=this.pointerWidth(),r=this.pointerHeight(),i=this.pointerDirection(),o=this.width(),a=this.height();return i===ba?(t-=r,a+=r):i===xa?a+=r:i===Ea?(e-=1.5*n,o+=n):i===wa&&(o+=1.5*n),{x:e,y:t,width:o,height:a}}}Sa.prototype.className="Tag",ci(Sa),ki.addGetterSetter(Sa,"pointerDirection","none"),ki.addGetterSetter(Sa,"pointerWidth",0,xi()),ki.addGetterSetter(Sa,"pointerHeight",0,xi()),ki.addGetterSetter(Sa,"cornerRadius",0,Ei(4));class Ca extends Yo{_sceneFunc(e){var t=this.cornerRadius(),n=this.width(),r=this.height();if(e.beginPath(),t){let i=0,o=0,a=0,l=0;"number"==typeof t?i=o=a=l=Math.min(t,n/2,r/2):(i=Math.min(t[0]||0,n/2,r/2),o=Math.min(t[1]||0,n/2,r/2),l=Math.min(t[2]||0,n/2,r/2),a=Math.min(t[3]||0,n/2,r/2)),e.moveTo(i,0),e.lineTo(n-o,0),e.arc(n-o,o,o,3*Math.PI/2,0,!1),e.lineTo(n,r-l),e.arc(n-l,r-l,l,0,Math.PI/2,!1),e.lineTo(a,r),e.arc(a,r-a,a,Math.PI/2,Math.PI,!1),e.lineTo(0,i),e.arc(i,i,i,Math.PI,3*Math.PI/2,!1)}else e.rect(0,0,n,r);e.closePath(),e.fillStrokeShape(this)}}Ca.prototype.className="Rect",ci(Ca),ki.addGetterSetter(Ca,"cornerRadius",0,Ei(4));class Oa extends Yo{_sceneFunc(e){const t=this._getPoints();e.beginPath(),e.moveTo(t[0].x,t[0].y);for(var n=1;n<t.length;n++)e.lineTo(t[n].x,t[n].y);e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,t=this.attrs.radius||0,n=[];for(var r=0;r<e;r++)n.push({x:t*Math.sin(2*r*Math.PI/e),y:-1*t*Math.cos(2*r*Math.PI/e)});return n}getSelfRect(){const e=this._getPoints();var t=e[0].x,n=e[0].y,r=e[0].x,i=e[0].y;return e.forEach((e=>{t=Math.min(t,e.x),n=Math.max(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.y)})),{x:t,y:r,width:n-t,height:i-r}}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Oa.prototype.className="RegularPolygon",Oa.prototype._centroid=!0,Oa.prototype._attrsAffectingSize=["radius"],ci(Oa),ki.addGetterSetter(Oa,"radius",0,xi()),ki.addGetterSetter(Oa,"sides",0,xi());var Ma=2*Math.PI;class Aa extends Yo{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,Ma,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),Ma,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Aa.prototype.className="Ring",Aa.prototype._centroid=!0,Aa.prototype._attrsAffectingSize=["innerRadius","outerRadius"],ci(Aa),ki.addGetterSetter(Aa,"innerRadius",0,xi()),ki.addGetterSetter(Aa,"outerRadius",0,xi());class ka extends Yo{constructor(e){super(e),this._updated=!0,this.anim=new ta((()=>{var e=this._updated;return this._updated=!1,e})),this.on("animationChange.konva",(function(){this.frameIndex(0)})),this.on("frameIndexChange.konva",(function(){this._updated=!0})),this.on("frameRateChange.konva",(function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())}))}_sceneFunc(e){var t=this.animation(),n=this.frameIndex(),r=4*n,i=this.animations()[t],o=this.frameOffsets(),a=i[r+0],l=i[r+1],s=i[r+2],c=i[r+3],u=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,s,c),e.closePath(),e.fillStrokeShape(this)),u)if(o){var h=o[t],f=2*n;e.drawImage(u,a,l,s,c,h[f+0],h[f+1],s,c)}else e.drawImage(u,a,l,s,c,0,0,s,c)}_hitFunc(e){var t=this.animation(),n=this.frameIndex(),r=4*n,i=this.animations()[t],o=this.frameOffsets(),a=i[r+2],l=i[r+3];if(e.beginPath(),o){var s=o[t],c=2*n;e.rect(s[c+0],s[c+1],a,l)}else e.rect(0,0,a,l);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval((function(){e._updateIndex()}),1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}}ka.prototype.className="Sprite",ci(ka),ki.addGetterSetter(ka,"animation"),ki.addGetterSetter(ka,"animations"),ki.addGetterSetter(ka,"frameOffsets"),ki.addGetterSetter(ka,"image"),ki.addGetterSetter(ka,"frameIndex",0,xi()),ki.addGetterSetter(ka,"frameRate",17,xi()),ki.backCompat(ka,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class La extends Yo{_sceneFunc(e){var t=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(var i=1;i<2*r;i++){var o=i%2==0?n:t,a=o*Math.sin(i*Math.PI/r),l=-1*o*Math.cos(i*Math.PI/r);e.lineTo(a,l)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}function Pa(e){return Array.from(e)}La.prototype.className="Star",La.prototype._centroid=!0,La.prototype._attrsAffectingSize=["innerRadius","outerRadius"],ci(La),ki.addGetterSetter(La,"numPoints",5,xi()),ki.addGetterSetter(La,"innerRadius",0,xi()),ki.addGetterSetter(La,"outerRadius",0,xi());var Ta,Ha="auto",Na="justify",Ra="left",ja="middle",Va="normal",Ia=" ",Da="none",Fa=["fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],Ba=Fa.length;function Ua(){return Ta||(Ta=yi.createCanvasElement().getContext("2d"))}class Ga extends Yo{constructor(e){super(function(e){return(e=e||{}).fillLinearGradientColorStops||e.fillRadialGradientColorStops||e.fillPatternImage||(e.fill=e.fill||"black"),e}(e)),this._partialTextX=0,this._partialTextY=0;for(var t=0;t<Ba;t++)this.on(Fa[t]+"Change.konva",this._setTextData);this._setTextData()}_sceneFunc(e){var t=this.textArr,n=t.length;if(this.text()){var r,i=this.padding(),o=this.fontSize(),a=this.lineHeight()*o,l=this.verticalAlign(),s=0,c=this.align(),u=this.getWidth(),h=this.letterSpacing(),f=this.fill(),d=this.textDecoration(),p=-1!==d.indexOf("underline"),v=-1!==d.indexOf("line-through"),m=0,g=(m=a/2,0),y=0;for(e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",ja),e.setAttr("textAlign",Ra),l===ja?s=(this.getHeight()-n*a-2*i)/2:"bottom"===l&&(s=this.getHeight()-n*a-2*i),e.translate(i,s+i),r=0;r<n;r++){g=0,y=0;var b,w,x,E=t[r],_=E.text,z=E.width,S=E.lastInParagraph;if(e.save(),"right"===c?g+=u-z-2*i:"center"===c&&(g+=(u-z-2*i)/2),p&&(e.save(),e.beginPath(),e.moveTo(g,m+y+Math.round(o/2)),w=0===(b=_.split(" ").length-1),x=c===Na&&S&&!w?u-2*i:z,e.lineTo(g+Math.round(x),m+y+Math.round(o/2)),e.lineWidth=o/15,e.strokeStyle=f,e.stroke(),e.restore()),v&&(e.save(),e.beginPath(),e.moveTo(g,m+y),w=0===(b=_.split(" ").length-1),x=c===Na&&S&&!w?u-2*i:z,e.lineTo(g+Math.round(x),m+y),e.lineWidth=o/15,e.strokeStyle=f,e.stroke(),e.restore()),0!==h||c===Na){b=_.split(" ").length-1;for(var C=Pa(_),O=0;O<C.length;O++){var M=C[O];" "!==M||S||c!==Na||(g+=(u-2*i-z)/b),this._partialTextX=g,this._partialTextY=m+y,this._partialText=M,e.fillStrokeShape(this),g+=this.measureSize(M).width+h}}else this._partialTextX=g,this._partialTextY=m+y,this._partialText=_,e.fillStrokeShape(this);e.restore(),n>1&&(m+=a)}}}_hitFunc(e){var t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){var t=yi._isString(e)?e:null==e?"":e+"";return this._setAttr("text",t),this}getWidth(){return this.attrs.width===Ha||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===Ha||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return yi.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n=Ua(),r=this.fontSize();return n.save(),n.font=this._getContextFont(),t=n.measureText(e),n.restore(),{width:t.width,height:r}}_getContextFont(){return this.fontStyle()+Ia+this.fontVariant()+Ia+(this.fontSize()+"px ")+this.fontFamily().split(",").map((e=>{const t=(e=e.trim()).indexOf(" ")>=0,n=e.indexOf('"')>=0||e.indexOf("'")>=0;return t&&!n&&(e=`"${e}"`),e})).join(", ")}_addTextLine(e){this.align()===Na&&(e=e.trim());var t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){var t=this.letterSpacing(),n=e.length;return Ua().measureText(e).width+(n?t*(n-1):0)}_setTextData(){var e=this.text().split("\n"),t=+this.fontSize(),n=0,r=this.lineHeight()*t,i=this.attrs.width,o=this.attrs.height,a=i!==Ha&&void 0!==i,l=o!==Ha&&void 0!==o,s=this.padding(),c=i-2*s,u=o-2*s,h=0,f=this.wrap(),d="char"!==f&&f!==Da,p=this.ellipsis();this.textArr=[],Ua().font=this._getContextFont();for(var v=p?this._getTextWidth("…"):0,m=0,g=e.length;m<g;++m){var y=e[m],b=this._getTextWidth(y);if(a&&b>c)for(;y.length>0;){for(var w=0,x=y.length,E="",_=0;w<x;){var z=w+x>>>1,S=y.slice(0,z+1),C=this._getTextWidth(S)+v;C<=c?(w=z+1,E=S,_=C):x=z}if(!E)break;if(d){var O,M=y[E.length];(O=(M===Ia||"-"===M)&&_<=c?E.length:Math.max(E.lastIndexOf(Ia),E.lastIndexOf("-"))+1)>0&&(w=O,E=E.slice(0,w),_=this._getTextWidth(E))}if(E=E.trimRight(),this._addTextLine(E),n=Math.max(n,_),h+=r,this._shouldHandleEllipsis(h)){this._tryToAddEllipsisToLastLine();break}if((y=(y=y.slice(w)).trimLeft()).length>0&&(b=this._getTextWidth(y))<=c){this._addTextLine(y),h+=r,n=Math.max(n,b);break}}else this._addTextLine(y),h+=r,n=Math.max(n,b),this._shouldHandleEllipsis(h)&&m<g-1&&this._tryToAddEllipsisToLastLine();if(l&&h+r>u)break;this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0)}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){var t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,i=r!==Ha&&void 0!==r,o=r-2*this.padding();return!(this.wrap()!==Da)||i&&e+n>o}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,t=e!==Ha&&void 0!==e,n=e-2*this.padding(),r=this.ellipsis(),i=this.textArr[this.textArr.length-1];if(i&&r){if(t)this._getTextWidth(i.text+"…")<n||(i.text=i.text.slice(0,i.text.length-3));this.textArr.splice(this.textArr.length-1,1),this._addTextLine(i.text+"…")}}getStrokeScaleEnabled(){return!0}}Ga.prototype._fillFunc=function(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)},Ga.prototype._strokeFunc=function(e){e.strokeText(this._partialText,this._partialTextX,this._partialTextY)},Ga.prototype.className="Text",Ga.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],ci(Ga),ki.overWriteSetter(Ga,"width",_i()),ki.overWriteSetter(Ga,"height",_i()),ki.addGetterSetter(Ga,"fontFamily","Arial"),ki.addGetterSetter(Ga,"fontSize",12,xi()),ki.addGetterSetter(Ga,"fontStyle",Va),ki.addGetterSetter(Ga,"fontVariant",Va),ki.addGetterSetter(Ga,"padding",0,xi()),ki.addGetterSetter(Ga,"align",Ra),ki.addGetterSetter(Ga,"verticalAlign","top"),ki.addGetterSetter(Ga,"lineHeight",1,xi()),ki.addGetterSetter(Ga,"wrap","word"),ki.addGetterSetter(Ga,"ellipsis",!1,Ci()),ki.addGetterSetter(Ga,"letterSpacing",0,xi()),ki.addGetterSetter(Ga,"text","",zi()),ki.addGetterSetter(Ga,"textDecoration","");var qa="normal";function Wa(e){e.fillText(this.partialText,0,0)}function Ka(e){e.strokeText(this.partialText,0,0)}class Ya extends Yo{constructor(e){super(e),this.dummyCanvas=yi.createCanvasElement(),this.dataArray=[],this.dataArray=da.parsePathData(this.attrs.data),this.on("dataChange.konva",(function(){this.dataArray=da.parsePathData(this.attrs.data),this._setTextData()})),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();var t=this.textDecoration(),n=this.fill(),r=this.fontSize(),i=this.glyphInfo;"underline"===t&&e.beginPath();for(var o=0;o<i.length;o++){e.save();var a=i[o].p0;e.translate(a.x,a.y),e.rotate(i[o].rotation),this.partialText=i[o].text,e.fillStrokeShape(this),"underline"===t&&(0===o&&e.moveTo(0,r/2+1),e.lineTo(r,r/2+1)),e.restore()}"underline"===t&&(e.strokeStyle=n,e.lineWidth=r/20,e.stroke()),e.restore()}_hitFunc(e){e.beginPath();var t=this.glyphInfo;if(t.length>=1){var n=t[0].p0;e.moveTo(n.x,n.y)}for(var r=0;r<t.length;r++){var i=t[r].p1;e.lineTo(i.x,i.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return yi.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return Ga.prototype.setText.call(this,e)}_getContextFont(){return Ga.prototype._getContextFont.call(this)}_getTextSize(e){var t=this.dummyCanvas.getContext("2d");t.save(),t.font=this._getContextFont();var n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(this.attrs.fontSize,10)}}_setTextData(){var e=this,t=this._getTextSize(this.attrs.text),n=this.letterSpacing(),r=this.align(),i=this.kerningFunc();this.textWidth=t.width,this.textHeight=t.height;var o=Math.max(this.textWidth+((this.attrs.text||"").length-1)*n,0);this.glyphInfo=[];for(var a=0,l=0;l<e.dataArray.length;l++)e.dataArray[l].pathLength>0&&(a+=e.dataArray[l].pathLength);var s=0;"center"===r&&(s=Math.max(0,a/2-o/2)),"right"===r&&(s=Math.max(0,a-o));for(var c,u,h,f=Pa(this.text()),d=this.text().split(" ").length-1,p=-1,v=0,m=function(){v=0;for(var t=e.dataArray,n=p+1;n<t.length;n++){if(t[n].pathLength>0)return p=n,t[n];"M"===t[n].command&&(c={x:t[n].points[0],y:t[n].points[1]})}return{}},g=function(t){var i=e._getTextSize(t).width+n;" "===t&&"justify"===r&&(i+=(a-o)/d);var l=0,s=0;for(u=void 0;Math.abs(i-l)/i>.01&&s<20;){s++;for(var f=l;void 0===h;)(h=m())&&f+h.pathLength<i&&(f+=h.pathLength,h=void 0);if(0===Object.keys(h).length||void 0===c)return;var p=!1;switch(h.command){case"L":da.getLineLength(c.x,c.y,h.points[0],h.points[1])>i?u=da.getPointOnLine(i,c.x,c.y,h.points[0],h.points[1],c.x,c.y):h=void 0;break;case"A":var g=h.points[4],y=h.points[5],b=h.points[4]+y;0===v?v=g+1e-8:i>l?v+=Math.PI/180*y/Math.abs(y):v-=Math.PI/360*y/Math.abs(y),(y<0&&v<b||y>=0&&v>b)&&(v=b,p=!0),u=da.getPointOnEllipticalArc(h.points[0],h.points[1],h.points[2],h.points[3],v,h.points[6]);break;case"C":0===v?v=i>h.pathLength?1e-8:i/h.pathLength:i>l?v+=(i-l)/h.pathLength/2:v=Math.max(v-(l-i)/h.pathLength/2,0),v>1&&(v=1,p=!0),u=da.getPointOnCubicBezier(v,h.start.x,h.start.y,h.points[0],h.points[1],h.points[2],h.points[3],h.points[4],h.points[5]);break;case"Q":0===v?v=i/h.pathLength:i>l?v+=(i-l)/h.pathLength:v-=(l-i)/h.pathLength,v>1&&(v=1,p=!0),u=da.getPointOnQuadraticBezier(v,h.start.x,h.start.y,h.points[0],h.points[1],h.points[2],h.points[3])}void 0!==u&&(l=da.getLineLength(c.x,c.y,u.x,u.y)),p&&(p=!1,h=void 0)}},y=s/(e._getTextSize("C").width+n)-1,b=0;b<y&&(g("C"),void 0!==c&&void 0!==u);b++)c=u;for(var w=0;w<f.length&&(g(f[w]),void 0!==c&&void 0!==u);w++){var x=da.getLineLength(c.x,c.y,u.x,u.y),E=0;if(i)try{E=i(f[w-1],f[w])*this.fontSize()}catch(e){E=0}c.x+=E,u.x+=E,this.textWidth+=E;var _=da.getPointOnLine(E+x/2,c.x,c.y,u.x,u.y),z=Math.atan2(u.y-c.y,u.x-c.x);this.glyphInfo.push({transposeX:_.x,transposeY:_.y,text:f[w],rotation:z,p0:c,p1:u}),c=u}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var e=[];this.glyphInfo.forEach((function(t){e.push(t.p0.x),e.push(t.p0.y),e.push(t.p1.x),e.push(t.p1.y)}));for(var t,n,r=e[0]||0,i=e[0]||0,o=e[1]||0,a=e[1]||0,l=0;l<e.length/2;l++)t=e[2*l],n=e[2*l+1],r=Math.min(r,t),i=Math.max(i,t),o=Math.min(o,n),a=Math.max(a,n);var s=this.fontSize();return{x:r-s/2,y:o-s/2,width:i-r+s,height:a-o+s}}}Ya.prototype._fillFunc=Wa,Ya.prototype._strokeFunc=Ka,Ya.prototype._fillFuncHit=Wa,Ya.prototype._strokeFuncHit=Ka,Ya.prototype.className="TextPath",Ya.prototype._attrsAffectingSize=["text","fontSize","data"],ci(Ya),ki.addGetterSetter(Ya,"data"),ki.addGetterSetter(Ya,"fontFamily","Arial"),ki.addGetterSetter(Ya,"fontSize",12,xi()),ki.addGetterSetter(Ya,"fontStyle",qa),ki.addGetterSetter(Ya,"align","left"),ki.addGetterSetter(Ya,"letterSpacing",0,xi()),ki.addGetterSetter(Ya,"textBaseline","middle"),ki.addGetterSetter(Ya,"fontVariant",qa),ki.addGetterSetter(Ya,"text",""),ki.addGetterSetter(Ya,"textDecoration",null),ki.addGetterSetter(Ya,"kerningFunc",null);var $a="tr-konva",Xa=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange"].map((e=>e+".tr-konva")).join(" "),Qa="nodesRect",Za=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],Ja={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const el="ontouchstart"in si._global;var tl=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function nl(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:i})}function rl(e,t){const n=function(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}(e);return nl(e,t,n)}class il extends Jo{constructor(e){super(e),this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(Xa,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return yi.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return $a+this._id}setNodes(e=[]){return this._nodes&&this._nodes.length&&this.detach(),this._nodes=e,1===e.length&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach((e=>{const t=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()},n=e._attrsAffectingSize.map((e=>e+"Change."+this._getEventNamespace())).join(" ");e.on(n,t),e.on(Za.map((e=>e+`.${this._getEventNamespace()}`)).join(" "),t),e.on(`absoluteTransformChange.${this._getEventNamespace()}`,t),this._proxyDrag(e)})),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,(n=>{t=e.getAbsolutePosition(),this.isDragging()||e===this.findOne(".back")||this.startDrag(n,!1)})),e.on(`dragmove.${this._getEventNamespace()}`,(n=>{if(!t)return;const r=e.getAbsolutePosition(),i=r.x-t.x,o=r.y-t.y;this.nodes().forEach((t=>{if(t===e)return;if(t.isDragging())return;const r=t.getAbsolutePosition();t.setAbsolutePosition({x:r.x+i,y:r.y+o}),t.startDrag(n)})),t=null}))}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach((e=>{e.off("."+this._getEventNamespace())})),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(Qa),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(Qa,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){var r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),i=e.getAbsoluteScale(n),o=e.getAbsolutePosition(n),a=r.x*i.x-e.offsetX()*i.x,l=r.y*i.y-e.offsetY()*i.y;const s=(si.getAngle(e.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return nl({x:o.x+a*Math.cos(s)+l*Math.sin(-s),y:o.y+l*Math.cos(s)+a*Math.sin(s),width:r.width*i.x,height:r.height*i.y,rotation:s},-si.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const e=[];this.nodes().map((t=>{const n=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var r=[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x+n.width,y:n.y+n.height},{x:n.x,y:n.y+n.height}],i=t.getAbsoluteTransform();r.forEach((function(t){var n=i.point(t);e.push(n)}))}));const t=new ui;var n,r,i,o;t.rotate(-si.getAngle(this.rotation())),e.forEach((function(e){var a=t.point(e);void 0===n&&(n=i=a.x,r=o=a.y),n=Math.min(n,a.x),r=Math.min(r,a.y),i=Math.max(i,a.x),o=Math.max(o,a.y)})),t.invert();const a=t.point({x:n,y:r});return{x:a.x,y:a.y,width:i-n,height:o-r,rotation:si.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),tl.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var t=new Ca({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:el?10:"auto"}),n=this;t.on("mousedown touchstart",(function(e){n._handleMouseDown(e)})),t.on("dragstart",(e=>{t.stopDrag(),e.cancelBubble=!0})),t.on("dragend",(e=>{e.cancelBubble=!0})),t.on("mouseenter",(()=>{var n=si.getAngle(this.rotation()),r=function(e,t){if("rotater"===e)return"crosshair";t+=yi.degToRad(Ja[e]||0);var n=(yi.radToDeg(t)%360+360)%360;return yi._inRange(n,337.5,360)||yi._inRange(n,0,22.5)?"ns-resize":yi._inRange(n,22.5,67.5)?"nesw-resize":yi._inRange(n,67.5,112.5)?"ew-resize":yi._inRange(n,112.5,157.5)?"nwse-resize":yi._inRange(n,157.5,202.5)?"ns-resize":yi._inRange(n,202.5,247.5)?"nesw-resize":yi._inRange(n,247.5,292.5)?"ew-resize":yi._inRange(n,292.5,337.5)?"nwse-resize":(yi.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}(e,n);t.getStage().content&&(t.getStage().content.style.cursor=r),this._cursorChange=!0})),t.on("mouseout",(()=>{t.getStage().content&&(t.getStage().content.style.cursor=""),this._cursorChange=!1})),this.add(t)}_createBack(){var e=new Yo({name:"back",width:0,height:0,draggable:!0,sceneFunc(e){var t=this.getParent(),n=t.padding();e.beginPath(),e.rect(-n,-n,this.width()+2*n,this.height()+2*n),e.moveTo(this.width()/2,-n),t.rotateEnabled()&&e.lineTo(this.width()/2,-t.rotateAnchorOffset()*yi._sign(this.height())-n),e.fillStrokeShape(this)},hitFunc:(e,t)=>{if(this.shouldOverdrawWholeArea()){var n=this.padding();e.beginPath(),e.rect(-n,-n,t.width()+2*n,t.height()+2*n),e.fillStrokeShape(t)}}});this.add(e),this._proxyDrag(e),e.on("dragstart",(e=>{e.cancelBubble=!0})),e.on("dragmove",(e=>{e.cancelBubble=!0})),e.on("dragend",(e=>{e.cancelBubble=!0})),this.on("dragmove",(e=>{this.update()}))}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var t=this._getNodeRect(),n=t.width,r=t.height,i=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/i),this.cos=Math.abs(n/i),"undefined"!=typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var o=e.target.getAbsolutePosition(),a=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-o.x,y:a.y-o.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach((t=>{t._fire("transformstart",{evt:e.evt,target:t})}))}_handleMouseMove(e){var t,n,r,i=this.findOne("."+this._movingAnchorName),o=i.getStage();o.setPointersPositions(e);const a=o.getPointerPosition();let l={x:a.x-this._anchorDragOffset.x,y:a.y-this._anchorDragOffset.y};const s=i.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(s,l,e)),i.setAbsolutePosition(l);const c=i.getAbsolutePosition();if(s.x!==c.x||s.y!==c.y)if("rotater"!==this._movingAnchorName){var u=this.keepRatio()||e.shiftKey,h=this.centeredScaling()||e.altKey;if("top-left"===this._movingAnchorName){if(u){var f=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(f.x-i.x(),2)+Math.pow(f.y-i.y(),2));var d=this.findOne(".top-left").x()>f.x?-1:1,p=this.findOne(".top-left").y()>f.y?-1:1;t=r*this.cos*d,n=r*this.sin*p,this.findOne(".top-left").x(f.x-t),this.findOne(".top-left").y(f.y-n)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(i.y());else if("top-right"===this._movingAnchorName){if(u){f=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(i.x()-f.x,2)+Math.pow(f.y-i.y(),2));d=this.findOne(".top-right").x()<f.x?-1:1,p=this.findOne(".top-right").y()>f.y?-1:1;t=r*this.cos*d,n=r*this.sin*p,this.findOne(".top-right").x(f.x+t),this.findOne(".top-right").y(f.y-n)}var v=i.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else if("middle-left"===this._movingAnchorName)this.findOne(".top-left").x(i.x());else if("middle-right"===this._movingAnchorName)this.findOne(".bottom-right").x(i.x());else if("bottom-left"===this._movingAnchorName){if(u){f=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(f.x-i.x(),2)+Math.pow(i.y()-f.y,2));d=f.x<i.x()?-1:1,p=i.y()<f.y?-1:1;t=r*this.cos*d,n=r*this.sin*p,i.x(f.x-t),i.y(f.y+n)}v=i.position(),this.findOne(".top-left").x(v.x),this.findOne(".bottom-right").y(v.y)}else if("bottom-center"===this._movingAnchorName)this.findOne(".bottom-right").y(i.y());else if("bottom-right"===this._movingAnchorName){if(u){f=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};r=Math.sqrt(Math.pow(i.x()-f.x,2)+Math.pow(i.y()-f.y,2));d=this.findOne(".bottom-right").x()<f.x?-1:1,p=this.findOne(".bottom-right").y()<f.y?-1:1;t=r*this.cos*d,n=r*this.sin*p,this.findOne(".bottom-right").x(f.x+t),this.findOne(".bottom-right").y(f.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(h=this.centeredScaling()||e.altKey){var m=this.findOne(".top-left"),g=this.findOne(".bottom-right"),y=m.x(),b=m.y(),w=this.getWidth()-g.x(),x=this.getHeight()-g.y();g.move({x:-y,y:-b}),m.move({x:w,y:x})}var E=this.findOne(".top-left").getAbsolutePosition();t=E.x,n=E.y;var _=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),z=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:t,y:n,width:_,height:z,rotation:si.getAngle(this.rotation())},e)}else{var S=this._getNodeRect();t=i.x()-S.width/2,n=-i.y()+S.height/2;let r=Math.atan2(-n,t)+Math.PI/2;S.height<0&&(r-=Math.PI);const o=si.getAngle(this.rotation())+r,a=si.getAngle(this.rotationSnapTolerance()),l=function(e,t,n){let r=t;for(let i=0;i<e.length;i++){const o=si.getAngle(e[i]),a=Math.abs(o-t)%(2*Math.PI);Math.min(a,2*Math.PI-a)<n&&(r=o)}return r}(this.rotationSnaps(),o,a),s=rl(S,l-S.rotation);this._fitNodesInto(s,e)}}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){if(this._transforming){this._transforming=!1,"undefined"!=typeof window&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var t=this.getNode();this._fire("transformend",{evt:e,target:t}),t&&this._nodes.forEach((t=>{t._fire("transformend",{evt:e,target:t})})),this._movingAnchorName=null}}_fitNodesInto(e,t){var n=this._getNodeRect();if(yi._inRange(e.width,2*-this.padding()-1,1))return void this.update();if(yi._inRange(e.height,2*-this.padding()-1,1))return void this.update();const r=this.flipEnabled();var i=new ui;if(i.rotate(si.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const t=i.point({x:2*-this.padding(),y:0});if(e.x+=t.x,e.y+=t.y,e.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,!r)return void this.update()}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const t=i.point({x:2*this.padding(),y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.width+=2*this.padding(),!r)return void this.update()}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const t=i.point({x:0,y:2*-this.padding()});if(e.x+=t.x,e.y+=t.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!r)return void this.update()}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const t=i.point({x:0,y:2*this.padding()});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!r)return void this.update()}if(this.boundBoxFunc()){const t=this.boundBoxFunc()(n,e);t?e=t:yi.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const o=1e7,a=new ui;a.translate(n.x,n.y),a.rotate(n.rotation),a.scale(n.width/o,n.height/o);const l=new ui;l.translate(e.x,e.y),l.rotate(e.rotation),l.scale(e.width/o,e.height/o);const s=l.multiply(a.invert());this._nodes.forEach((e=>{var n;const r=e.getParent().getAbsoluteTransform(),i=e.getTransform().copy();i.translate(e.offsetX(),e.offsetY());const o=new ui;o.multiply(r.copy().invert()).multiply(s).multiply(r).multiply(i);const a=o.decompose();e.setAttrs(a),this._fire("transform",{evt:t,target:e}),e._fire("transform",{evt:t,target:e}),null===(n=e.getLayer())||void 0===n||n.batchDraw()})),this.rotation(yi._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e,t=this._getNodeRect();this.rotation(yi._getRotation(t.rotation));var n=t.width,r=t.height,i=this.enabledAnchors(),o=this.resizeEnabled(),a=this.padding(),l=this.anchorSize();this.find("._anchor").forEach((e=>{e.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})})),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+a,offsetY:l/2+a,visible:o&&i.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:l/2+a,visible:o&&i.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:l/2-a,offsetY:l/2+a,visible:o&&i.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:l/2+a,visible:o&&i.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:r/2,offsetX:l/2-a,visible:o&&i.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:l/2+a,offsetY:l/2-a,visible:o&&i.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:r,offsetY:l/2-a,visible:o&&i.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:l/2-a,offsetY:l/2-a,visible:o&&i.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:n/2,y:-this.rotateAnchorOffset()*yi._sign(r)-a,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0}),null===(e=this.getLayer())||void 0===e||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Jo.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return no.prototype.toObject.call(this)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}il.prototype.className="Transformer",ci(il),ki.addGetterSetter(il,"enabledAnchors",tl,(function(e){return e instanceof Array||yi.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach((function(e){-1===tl.indexOf(e)&&yi.warn("Unknown anchor name: "+e+". Available names are: "+tl.join(", "))})),e||[]})),ki.addGetterSetter(il,"flipEnabled",!0,Ci()),ki.addGetterSetter(il,"resizeEnabled",!0),ki.addGetterSetter(il,"anchorSize",10,xi()),ki.addGetterSetter(il,"rotateEnabled",!0),ki.addGetterSetter(il,"rotationSnaps",[]),ki.addGetterSetter(il,"rotateAnchorOffset",50,xi()),ki.addGetterSetter(il,"rotationSnapTolerance",5,xi()),ki.addGetterSetter(il,"borderEnabled",!0),ki.addGetterSetter(il,"anchorStroke","rgb(0, 161, 255)"),ki.addGetterSetter(il,"anchorStrokeWidth",1,xi()),ki.addGetterSetter(il,"anchorFill","white"),ki.addGetterSetter(il,"anchorCornerRadius",0,xi()),ki.addGetterSetter(il,"borderStroke","rgb(0, 161, 255)"),ki.addGetterSetter(il,"borderStrokeWidth",1,xi()),ki.addGetterSetter(il,"borderDash"),ki.addGetterSetter(il,"keepRatio",!0),ki.addGetterSetter(il,"centeredScaling",!1),ki.addGetterSetter(il,"ignoreStroke",!1),ki.addGetterSetter(il,"padding",0,xi()),ki.addGetterSetter(il,"node"),ki.addGetterSetter(il,"nodes"),ki.addGetterSetter(il,"boundBoxFunc"),ki.addGetterSetter(il,"anchorDragBoundFunc"),ki.addGetterSetter(il,"shouldOverdrawWholeArea",!1),ki.addGetterSetter(il,"useSingleNodeRotation",!0),ki.backCompat(il,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class ol extends Yo{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,si.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}function al(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}ol.prototype.className="Wedge",ol.prototype._centroid=!0,ol.prototype._attrsAffectingSize=["radius"],ci(ol),ki.addGetterSetter(ol,"radius",0,xi()),ki.addGetterSetter(ol,"angle",0,xi()),ki.addGetterSetter(ol,"clockwise",!1),ki.backCompat(ol,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var ll=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],sl=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];ki.addGetterSetter(no,"blurRadius",0,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"brightness",0,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"contrast",0,xi(),ki.afterSetFilter);function cl(e,t,n,r,i){var o=n-t,a=i-r;return 0===o?r+a/2:0===a?r:a*((e-t)/o)+r}ki.addGetterSetter(no,"embossStrength",.5,xi(),ki.afterSetFilter),ki.addGetterSetter(no,"embossWhiteLevel",.5,xi(),ki.afterSetFilter),ki.addGetterSetter(no,"embossDirection","top-left",null,ki.afterSetFilter),ki.addGetterSetter(no,"embossBlend",!1,null,ki.afterSetFilter);ki.addGetterSetter(no,"enhance",0,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"hue",0,xi(),ki.afterSetFilter),ki.addGetterSetter(no,"saturation",0,xi(),ki.afterSetFilter),ki.addGetterSetter(no,"luminance",0,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"hue",0,xi(),ki.afterSetFilter),ki.addGetterSetter(no,"saturation",0,xi(),ki.afterSetFilter),ki.addGetterSetter(no,"value",0,xi(),ki.afterSetFilter);function ul(e,t,n){var r=4*(n*e.width+t),i=[];return i.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),i}function hl(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}ki.addGetterSetter(no,"kaleidoscopePower",2,xi(),ki.afterSetFilter),ki.addGetterSetter(no,"kaleidoscopeAngle",0,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"threshold",0,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"noise",.2,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"pixelSize",8,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"levels",.5,xi(),ki.afterSetFilter);ki.addGetterSetter(no,"red",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),ki.addGetterSetter(no,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),ki.addGetterSetter(no,"blue",0,wi,ki.afterSetFilter);ki.addGetterSetter(no,"red",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),ki.addGetterSetter(no,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),ki.addGetterSetter(no,"blue",0,wi,ki.afterSetFilter),ki.addGetterSetter(no,"alpha",1,(function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e}));ki.addGetterSetter(no,"threshold",.5,xi(),ki.afterSetFilter);const fl=sa.Util._assign(sa,{Arc:ca,Arrow:pa,Circle:va,Ellipse:ma,Image:ga,Label:za,Tag:Sa,Line:fa,Path:da,Rect:Ca,RegularPolygon:Oa,Ring:Aa,Sprite:ka,Star:La,Text:Ga,TextPath:Ya,Transformer:il,Wedge:ol,Filters:{Blur:function(e){var t=Math.round(this.blurRadius());t>0&&function(e,t){var n,r,i,o,a,l,s,c,u,h,f,d,p,v,m,g,y,b,w,x,E,_,z,S,C=e.data,O=e.width,M=e.height,A=t+t+1,k=O-1,L=M-1,P=t+1,T=P*(P+1)/2,H=new al,N=null,R=H,j=null,V=null,I=ll[t],D=sl[t];for(i=1;i<A;i++)R=R.next=new al,i===P&&(N=R);for(R.next=H,s=l=0,r=0;r<M;r++){for(g=y=b=w=c=u=h=f=0,d=P*(x=C[l]),p=P*(E=C[l+1]),v=P*(_=C[l+2]),m=P*(z=C[l+3]),c+=T*x,u+=T*E,h+=T*_,f+=T*z,R=H,i=0;i<P;i++)R.r=x,R.g=E,R.b=_,R.a=z,R=R.next;for(i=1;i<P;i++)o=l+((k<i?k:i)<<2),c+=(R.r=x=C[o])*(S=P-i),u+=(R.g=E=C[o+1])*S,h+=(R.b=_=C[o+2])*S,f+=(R.a=z=C[o+3])*S,g+=x,y+=E,b+=_,w+=z,R=R.next;for(j=H,V=N,n=0;n<O;n++)C[l+3]=z=f*I>>D,0!==z?(z=255/z,C[l]=(c*I>>D)*z,C[l+1]=(u*I>>D)*z,C[l+2]=(h*I>>D)*z):C[l]=C[l+1]=C[l+2]=0,c-=d,u-=p,h-=v,f-=m,d-=j.r,p-=j.g,v-=j.b,m-=j.a,o=s+((o=n+t+1)<k?o:k)<<2,c+=g+=j.r=C[o],u+=y+=j.g=C[o+1],h+=b+=j.b=C[o+2],f+=w+=j.a=C[o+3],j=j.next,d+=x=V.r,p+=E=V.g,v+=_=V.b,m+=z=V.a,g-=x,y-=E,b-=_,w-=z,V=V.next,l+=4;s+=O}for(n=0;n<O;n++){for(y=b=w=g=u=h=f=c=0,d=P*(x=C[l=n<<2]),p=P*(E=C[l+1]),v=P*(_=C[l+2]),m=P*(z=C[l+3]),c+=T*x,u+=T*E,h+=T*_,f+=T*z,R=H,i=0;i<P;i++)R.r=x,R.g=E,R.b=_,R.a=z,R=R.next;for(a=O,i=1;i<=t;i++)l=a+n<<2,c+=(R.r=x=C[l])*(S=P-i),u+=(R.g=E=C[l+1])*S,h+=(R.b=_=C[l+2])*S,f+=(R.a=z=C[l+3])*S,g+=x,y+=E,b+=_,w+=z,R=R.next,i<L&&(a+=O);for(l=n,j=H,V=N,r=0;r<M;r++)C[3+(o=l<<2)]=z=f*I>>D,z>0?(z=255/z,C[o]=(c*I>>D)*z,C[o+1]=(u*I>>D)*z,C[o+2]=(h*I>>D)*z):C[o]=C[o+1]=C[o+2]=0,c-=d,u-=p,h-=v,f-=m,d-=j.r,p-=j.g,v-=j.b,m-=j.a,o=n+((o=r+P)<L?o:L)*O<<2,c+=g+=j.r=C[o],u+=y+=j.g=C[o+1],h+=b+=j.b=C[o+2],f+=w+=j.a=C[o+3],j=j.next,d+=x=V.r,p+=E=V.g,v+=_=V.b,m+=z=V.a,g-=x,y-=E,b-=_,w-=z,V=V.next,l+=O}}(e,t)},Brighten:function(e){var t,n=255*this.brightness(),r=e.data,i=r.length;for(t=0;t<i;t+=4)r[t]+=n,r[t+1]+=n,r[t+2]+=n},Contrast:function(e){var t,n=Math.pow((this.contrast()+100)/100,2),r=e.data,i=r.length,o=150,a=150,l=150;for(t=0;t<i;t+=4)o=r[t],a=r[t+1],l=r[t+2],o/=255,o-=.5,o*=n,o+=.5,a/=255,a-=.5,a*=n,a+=.5,l/=255,l-=.5,l*=n,l+=.5,o=(o*=255)<0?0:o>255?255:o,a=(a*=255)<0?0:a>255?255:a,l=(l*=255)<0?0:l>255?255:l,r[t]=o,r[t+1]=a,r[t+2]=l},Emboss:function(e){var t=10*this.embossStrength(),n=255*this.embossWhiteLevel(),r=this.embossDirection(),i=this.embossBlend(),o=0,a=0,l=e.data,s=e.width,c=e.height,u=4*s,h=c;switch(r){case"top-left":o=-1,a=-1;break;case"top":o=-1,a=0;break;case"top-right":o=-1,a=1;break;case"right":o=0,a=1;break;case"bottom-right":o=1,a=1;break;case"bottom":o=1,a=0;break;case"bottom-left":o=1,a=-1;break;case"left":o=0,a=-1;break;default:yi.error("Unknown emboss direction: "+r)}do{var f=(h-1)*u,d=o;h+d<1&&(d=0),h+d>c&&(d=0);var p=(h-1+d)*s*4,v=s;do{var m=f+4*(v-1),g=a;v+g<1&&(g=0),v+g>s&&(g=0);var y=p+4*(v-1+g),b=l[m]-l[y],w=l[m+1]-l[y+1],x=l[m+2]-l[y+2],E=b,_=E>0?E:-E;if((w>0?w:-w)>_&&(E=w),(x>0?x:-x)>_&&(E=x),E*=t,i){var z=l[m]+E,S=l[m+1]+E,C=l[m+2]+E;l[m]=z>255?255:z<0?0:z,l[m+1]=S>255?255:S<0?0:S,l[m+2]=C>255?255:C<0?0:C}else{var O=n-E;O<0?O=0:O>255&&(O=255),l[m]=l[m+1]=l[m+2]=O}}while(--v)}while(--h)},Enhance:function(e){var t,n,r,i,o=e.data,a=o.length,l=o[0],s=l,c=o[1],u=c,h=o[2],f=h,d=this.enhance();if(0!==d){for(i=0;i<a;i+=4)(t=o[i+0])<l?l=t:t>s&&(s=t),(n=o[i+1])<c?c=n:n>u&&(u=n),(r=o[i+2])<h?h=r:r>f&&(f=r);var p,v,m,g,y,b,w,x,E;for(s===l&&(s=255,l=0),u===c&&(u=255,c=0),f===h&&(f=255,h=0),d>0?(v=s+d*(255-s),m=l-d*(l-0),y=u+d*(255-u),b=c-d*(c-0),x=f+d*(255-f),E=h-d*(h-0)):(v=s+d*(s-(p=.5*(s+l))),m=l+d*(l-p),y=u+d*(u-(g=.5*(u+c))),b=c+d*(c-g),x=f+d*(f-(w=.5*(f+h))),E=h+d*(h-w)),i=0;i<a;i+=4)o[i+0]=cl(o[i+0],l,s,m,v),o[i+1]=cl(o[i+1],c,u,b,y),o[i+2]=cl(o[i+2],h,f,E,x)}},Grayscale:function(e){var t,n,r=e.data,i=r.length;for(t=0;t<i;t+=4)n=.34*r[t]+.5*r[t+1]+.16*r[t+2],r[t]=n,r[t+1]=n,r[t+2]=n},HSL:function(e){var t,n,r,i,o,a=e.data,l=a.length,s=Math.pow(2,this.saturation()),c=Math.abs(this.hue()+360)%360,u=127*this.luminance(),h=1*s*Math.cos(c*Math.PI/180),f=1*s*Math.sin(c*Math.PI/180),d=.299+.701*h+.167*f,p=.587-.587*h+.33*f,v=.114-.114*h-.497*f,m=.299-.299*h-.328*f,g=.587+.413*h+.035*f,y=.114-.114*h+.293*f,b=.299-.3*h+1.25*f,w=.587-.586*h-1.05*f,x=.114+.886*h-.2*f;for(t=0;t<l;t+=4)n=a[t+0],r=a[t+1],i=a[t+2],o=a[t+3],a[t+0]=d*n+p*r+v*i+u,a[t+1]=m*n+g*r+y*i+u,a[t+2]=b*n+w*r+x*i+u,a[t+3]=o},HSV:function(e){var t,n,r,i,o,a=e.data,l=a.length,s=Math.pow(2,this.value()),c=Math.pow(2,this.saturation()),u=Math.abs(this.hue()+360)%360,h=s*c*Math.cos(u*Math.PI/180),f=s*c*Math.sin(u*Math.PI/180),d=.299*s+.701*h+.167*f,p=.587*s-.587*h+.33*f,v=.114*s-.114*h-.497*f,m=.299*s-.299*h-.328*f,g=.587*s+.413*h+.035*f,y=.114*s-.114*h+.293*f,b=.299*s-.3*h+1.25*f,w=.587*s-.586*h-1.05*f,x=.114*s+.886*h-.2*f;for(t=0;t<l;t+=4)n=a[t+0],r=a[t+1],i=a[t+2],o=a[t+3],a[t+0]=d*n+p*r+v*i,a[t+1]=m*n+g*r+y*i,a[t+2]=b*n+w*r+x*i,a[t+3]=o},Invert:function(e){var t,n=e.data,r=n.length;for(t=0;t<r;t+=4)n[t]=255-n[t],n[t+1]=255-n[t+1],n[t+2]=255-n[t+2]},Kaleidoscope:function(e){var t,n,r,i,o,a,l,s,c,u=e.width,h=e.height,f=Math.round(this.kaleidoscopePower()),d=Math.round(this.kaleidoscopeAngle()),p=Math.floor(u*(d%360)/360);if(!(f<1)){var v=yi.createCanvasElement();v.width=u,v.height=h;var m=v.getContext("2d").getImageData(0,0,u,h);!function(e,t,n){var r,i,o,a,l=e.data,s=t.data,c=e.width,u=e.height,h=n.polarCenterX||c/2,f=n.polarCenterY||u/2,d=0,p=0,v=0,m=0,g=Math.sqrt(h*h+f*f);i=c-h,o=u-f,g=(a=Math.sqrt(i*i+o*o))>g?a:g;var y,b,w,x,E=u,_=c,z=360/_*Math.PI/180;for(b=0;b<_;b+=1)for(w=Math.sin(b*z),x=Math.cos(b*z),y=0;y<E;y+=1)i=Math.floor(h+g*y/E*x),d=l[0+(r=4*((o=Math.floor(f+g*y/E*w))*c+i))],p=l[r+1],v=l[r+2],m=l[r+3],s[0+(r=4*(b+y*c))]=d,s[r+1]=p,s[r+2]=v,s[r+3]=m}(e,m,{polarCenterX:u/2,polarCenterY:h/2});for(var g=u/Math.pow(2,f);g<=8;)g*=2,f-=1;var y=g=Math.ceil(g),b=0,w=y,x=1;for(p+g>u&&(b=y,w=0,x=-1),n=0;n<h;n+=1)for(t=b;t!==w;t+=x)s=4*(u*n+Math.round(t+p)%u),i=m.data[s+0],o=m.data[s+1],a=m.data[s+2],l=m.data[s+3],c=4*(u*n+t),m.data[c+0]=i,m.data[c+1]=o,m.data[c+2]=a,m.data[c+3]=l;for(n=0;n<h;n+=1)for(y=Math.floor(g),r=0;r<f;r+=1){for(t=0;t<y+1;t+=1)s=4*(u*n+t),i=m.data[s+0],o=m.data[s+1],a=m.data[s+2],l=m.data[s+3],c=4*(u*n+2*y-t-1),m.data[c+0]=i,m.data[c+1]=o,m.data[c+2]=a,m.data[c+3]=l;y*=2}!function(e,t,n){var r,i,o,a,l,s,c=e.data,u=t.data,h=e.width,f=e.height,d=n.polarCenterX||h/2,p=n.polarCenterY||f/2,v=0,m=0,g=0,y=0,b=Math.sqrt(d*d+p*p);i=h-d,o=f-p,b=(s=Math.sqrt(i*i+o*o))>b?s:b;var w,x,E,_=f,z=h,S=n.polarRotation||0;for(i=0;i<h;i+=1)for(o=0;o<f;o+=1)a=i-d,l=o-p,w=Math.sqrt(a*a+l*l)*_/b,x=(x=(180*Math.atan2(l,a)/Math.PI+360+S)%360)*z/360,E=Math.floor(x),v=c[0+(r=4*(Math.floor(w)*h+E))],m=c[r+1],g=c[r+2],y=c[r+3],u[0+(r=4*(o*h+i))]=v,u[r+1]=m,u[r+2]=g,u[r+3]=y}(m,e,{polarRotation:0})}},Mask:function(e){var t=function(e,t){var n=ul(e,0,0),r=ul(e,e.width-1,0),i=ul(e,0,e.height-1),o=ul(e,e.width-1,e.height-1),a=t||10;if(hl(n,r)<a&&hl(r,o)<a&&hl(o,i)<a&&hl(i,n)<a){for(var l=function(e){for(var t=[0,0,0],n=0;n<e.length;n++)t[0]+=e[n][0],t[1]+=e[n][1],t[2]+=e[n][2];return t[0]/=e.length,t[1]/=e.length,t[2]/=e.length,t}([r,n,o,i]),s=[],c=0;c<e.width*e.height;c++){var u=hl(l,[e.data[4*c],e.data[4*c+1],e.data[4*c+2]]);s[c]=u<a?0:255}return s}}(e,this.threshold());return t&&function(e,t){for(var n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}(e,t=function(e,t,n){for(var r=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),a=[],l=0;l<n;l++)for(var s=0;s<t;s++){for(var c=l*t+s,u=0,h=0;h<i;h++)for(var f=0;f<i;f++){var d=l+h-o,p=s+f-o;if(d>=0&&d<n&&p>=0&&p<t){var v=r[h*i+f];u+=e[d*t+p]*v}}a[c]=u}return a}(t=function(e,t,n){for(var r=[1,1,1,1,1,1,1,1,1],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),a=[],l=0;l<n;l++)for(var s=0;s<t;s++){for(var c=l*t+s,u=0,h=0;h<i;h++)for(var f=0;f<i;f++){var d=l+h-o,p=s+f-o;if(d>=0&&d<n&&p>=0&&p<t){var v=r[h*i+f];u+=e[d*t+p]*v}}a[c]=u>=1020?255:0}return a}(t=function(e,t,n){for(var r=[1,1,1,1,0,1,1,1,1],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),a=[],l=0;l<n;l++)for(var s=0;s<t;s++){for(var c=l*t+s,u=0,h=0;h<i;h++)for(var f=0;f<i;f++){var d=l+h-o,p=s+f-o;if(d>=0&&d<n&&p>=0&&p<t){var v=r[h*i+f];u+=e[d*t+p]*v}}a[c]=2040===u?255:0}return a}(t,e.width,e.height),e.width,e.height),e.width,e.height)),e},Noise:function(e){var t,n=255*this.noise(),r=e.data,i=r.length,o=n/2;for(t=0;t<i;t+=4)r[t+0]+=o-2*o*Math.random(),r[t+1]+=o-2*o*Math.random(),r[t+2]+=o-2*o*Math.random()},Pixelate:function(e){var t,n,r,i,o,a,l,s,c,u,h,f,d,p,v=Math.ceil(this.pixelSize()),m=e.width,g=e.height,y=Math.ceil(m/v),b=Math.ceil(g/v),w=e.data;if(v<=0)yi.error("pixelSize value can not be <= 0");else for(f=0;f<y;f+=1)for(d=0;d<b;d+=1){for(i=0,o=0,a=0,l=0,c=(s=f*v)+v,h=(u=d*v)+v,p=0,t=s;t<c;t+=1)if(!(t>=m))for(n=u;n<h;n+=1)n>=g||(i+=w[(r=4*(m*n+t))+0],o+=w[r+1],a+=w[r+2],l+=w[r+3],p+=1);for(i/=p,o/=p,a/=p,l/=p,t=s;t<c;t+=1)if(!(t>=m))for(n=u;n<h;n+=1)n>=g||(w[(r=4*(m*n+t))+0]=i,w[r+1]=o,w[r+2]=a,w[r+3]=l)}},Posterize:function(e){var t,n=Math.round(254*this.levels())+1,r=e.data,i=r.length,o=255/n;for(t=0;t<i;t+=1)r[t]=Math.floor(r[t]/o)*o},RGB:function(e){var t,n,r=e.data,i=r.length,o=this.red(),a=this.green(),l=this.blue();for(t=0;t<i;t+=4)n=(.34*r[t]+.5*r[t+1]+.16*r[t+2])/255,r[t]=n*o,r[t+1]=n*a,r[t+2]=n*l,r[t+3]=r[t+3]},RGBA:function(e){var t,n,r=e.data,i=r.length,o=this.red(),a=this.green(),l=this.blue(),s=this.alpha();for(t=0;t<i;t+=4)n=1-s,r[t]=o*s+r[t]*n,r[t+1]=a*s+r[t+1]*n,r[t+2]=l*s+r[t+2]*n},Sepia:function(e){var t,n,r,i,o=e.data,a=o.length;for(t=0;t<a;t+=4)n=o[t+0],r=o[t+1],i=o[t+2],o[t+0]=Math.min(255,.393*n+.769*r+.189*i),o[t+1]=Math.min(255,.349*n+.686*r+.168*i),o[t+2]=Math.min(255,.272*n+.534*r+.131*i)},Solarize:function(e){var t=e.data,n=e.width,r=4*n,i=e.height;do{var o=(i-1)*r,a=n;do{var l=o+4*(a-1),s=t[l],c=t[l+1],u=t[l+2];s>127&&(s=255-s),c>127&&(c=255-c),u>127&&(u=255-u),t[l]=s,t[l+1]=c,t[l+2]=u}while(--a)}while(--i)},Threshold:function(e){var t,n=255*this.threshold(),r=e.data,i=r.length;for(t=0;t<i;t+=1)r[t]=r[t]<n?0:255}}});var dl,pl=fl,vl=(d=l("8NFma"),sa);dl=l("bBlAQ");var ml;ml=l("d74WH");var gl={};e(gl,"appendInitialChild",(()=>Ml)),e(gl,"createInstance",(()=>Al)),e(gl,"createTextInstance",(()=>kl)),e(gl,"finalizeInitialChildren",(()=>Ll)),e(gl,"getPublicInstance",(()=>Pl)),e(gl,"prepareForCommit",(()=>Tl)),e(gl,"preparePortalMount",(()=>Hl)),e(gl,"prepareUpdate",(()=>Nl)),e(gl,"resetAfterCommit",(()=>Rl)),e(gl,"resetTextContent",(()=>jl)),e(gl,"shouldDeprioritizeSubtree",(()=>Vl)),e(gl,"getRootHostContext",(()=>Il)),e(gl,"getChildHostContext",(()=>Dl)),e(gl,"scheduleTimeout",(()=>Fl)),e(gl,"cancelTimeout",(()=>Bl)),e(gl,"noTimeout",(()=>Ul)),e(gl,"shouldSetTextContent",(()=>Gl)),e(gl,"isPrimaryRenderer",(()=>ql)),e(gl,"warnsIfNotActing",(()=>Wl)),e(gl,"supportsMutation",(()=>Kl)),e(gl,"appendChild",(()=>Yl)),e(gl,"appendChildToContainer",(()=>$l)),e(gl,"insertBefore",(()=>Xl)),e(gl,"insertInContainerBefore",(()=>Ql)),e(gl,"removeChild",(()=>Zl)),e(gl,"removeChildFromContainer",(()=>Jl)),e(gl,"commitTextUpdate",(()=>es)),e(gl,"commitMount",(()=>ts)),e(gl,"commitUpdate",(()=>ns)),e(gl,"hideInstance",(()=>rs)),e(gl,"hideTextInstance",(()=>is)),e(gl,"unhideInstance",(()=>os)),e(gl,"unhideTextInstance",(()=>as)),e(gl,"clearContainer",(()=>ls)),e(gl,"detachDeletedInstance",(()=>ss)),e(gl,"getCurrentEventPriority",(()=>cs)),e(gl,"now",(()=>l("clk2u").unstable_now)),e(gl,"idlePriority",(()=>l("clk2u").unstable_IdlePriority)),e(gl,"run",(()=>l("clk2u").unstable_runWithPriority));const yl={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let bl=!1,wl=!1;const xl=".react-konva-event";let El=!1;const _l={};function zl(e,t,n=_l){if(!bl&&"zIndex"in t&&(console.warn('ReactKonva: You are using "zIndex" attribute for a Konva node.\nreact-konva may get confused with ordering. Just define correct order of elements in your render function of a component.\nFor more info see: https://github.com/konvajs/react-konva/issues/194\n'),bl=!0),!wl&&t.draggable){var r=void 0!==t.x||void 0!==t.y,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn("ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.\nPosition of a node will be changed during drag&drop, so you should update state of the react app as well.\nConsider to add onDragMove or onDragEnd events.\nFor more info see: https://github.com/konvajs/react-konva/issues/256\n"),wl=!0)}for(var o in n)if(!yl[o]){var a="on"===o.slice(0,2),l=n[o]!==t[o];if(a&&l)"content"===(d=o.substr(2).toLowerCase()).substr(0,7)&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),e.off(d,n[o]);!t.hasOwnProperty(o)&&e.setAttr(o,void 0)}var s=El||t._useStrictMode,c={},u=!1;const h={};for(var o in t)if(!yl[o]){a="on"===o.slice(0,2);var f=n[o]!==t[o];if(a&&f)"content"===(d=o.substr(2).toLowerCase()).substr(0,7)&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),t[o]&&(h[d]=t[o]);!a&&(t[o]!==n[o]||s&&t[o]!==e.getAttr(o))&&(u=!0,c[o]=t[o])}for(var d in u&&(e.setAttrs(c),Sl(e)),h)e.on(d+xl,h[d])}function Sl(e){if(!si.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}l("clk2u");const Cl={},Ol={};function Ml(e,t){"string"!=typeof t?(e.add(t),Sl(e)):console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`)}function Al(e,t,n){let r=vl[e];r||(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=vl.Group);const i={},o={};for(var a in t){"on"===a.slice(0,2)?o[a]=t[a]:i[a]=t[a]}const l=new r(i);return zl(l,o),l}function kl(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function Ll(e,t,n){return!1}function Pl(e){return e}function Tl(){return null}function Hl(){return null}function Nl(e,t,n,r){return Ol}function Rl(){}function jl(e){}function Vl(e,t){return!1}function Il(){return Cl}function Dl(){return Cl}vl.Node.prototype._applyProps=zl;const Fl=setTimeout,Bl=clearTimeout,Ul=-1;function Gl(e,t){return!1}const ql=!1,Wl=!0,Kl=!0;function Yl(e,t){t.parent===e?t.moveToTop():e.add(t),Sl(e)}function $l(e,t){t.parent===e?t.moveToTop():e.add(t),Sl(e)}function Xl(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),Sl(e)}function Ql(e,t,n){Xl(e,t,n)}function Zl(e,t){t.destroy(),t.off(xl),Sl(e)}function Jl(e,t){t.destroy(),t.off(xl),Sl(e)}function es(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function ts(e,t,n){}function ns(e,t,n,r,i){zl(e,i,r)}function rs(e){e.hide(),Sl(e)}function is(e){}function os(e,t){(null==t.visible||t.visible)&&e.show()}function as(e,t){}function ls(e){}function ss(){}const cs=()=>ml.DefaultEventPriority;d=l("8NFma");var us=Object.defineProperty,hs=Object.defineProperties,fs=Object.getOwnPropertyDescriptors,ds=Object.getOwnPropertySymbols,ps=Object.prototype.hasOwnProperty,vs=Object.prototype.propertyIsEnumerable,ms=(e,t,n)=>t in e?us(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gs=(e,t)=>{for(var n in t||(t={}))ps.call(t,n)&&ms(e,n,t[n]);if(ds)for(var n of ds(t))vs.call(t,n)&&ms(e,n,t[n]);return e};function ys(e,t,n){if(!e)return;if(!0===n(e))return e;let r=t?e.return:e.child;for(;r;){const e=ys(r,t,n);if(e)return e;r=t?null:r.sibling}}function bs(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}const ws=bs(d.createContext(null));class xs extends d.Component{render(){return d.createElement(ws.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:Es,ReactCurrentDispatcher:_s}=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function zs(){const e=d.useContext(ws);if(!e)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const t=d.useId();return d.useMemo((()=>{var n;return null!=(n=Es.current)?n:ys(e,!1,(e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}}))}),[e,t])}const Ss=[],Cs=new WeakMap;function Os(){var e;const t=zs();Ss.splice(0,Ss.length),ys(t,!0,(e=>{var t;const n=null==(t=e.type)?void 0:t._context;n&&n!==ws&&Ss.push(bs(n))}));for(const t of Ss){const n=null==(e=_s.current)?void 0:e.readContext(t);Cs.set(t,n)}return d.useMemo((()=>Ss.reduce(((e,t)=>n=>{return d.createElement(e,null,d.createElement(t.Provider,(r=gs({},n),i={value:Cs.get(t)},hs(r,fs(i)))));var r,i}),(e=>d.createElement(xs,gs({},e))))),[])}const Ms=e=>{const t=n(d).useRef(),r=n(d).useRef(),i=n(d).useRef(),o=function(e){const t=n(d).useRef();return n(d).useLayoutEffect((()=>{t.current=e})),t.current}(e),a=Os(),l=t=>{const{forwardedRef:n}=e;n&&("function"==typeof n?n(t):n.current=t)};return n(d).useLayoutEffect((()=>(r.current=new vl.Stage({width:e.width,height:e.height,container:t.current}),l(r.current),i.current=Ns.createContainer(r.current,ml.LegacyRoot,!1,null),Ns.updateContainer(n(d).createElement(a,{},e.children),i.current),()=>{vl.isBrowser&&(l(null),Ns.updateContainer(null,i.current,null),r.current.destroy())})),[]),n(d).useLayoutEffect((()=>{l(r.current),zl(r.current,e,o),Ns.updateContainer(n(d).createElement(a,{},e.children),i.current,null)})),n(d).createElement("div",{ref:t,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},As="Group",ks="Rect",Ls="Line",Ps="Image",Ts="Text",Hs="Transformer",Ns=n(dl)(gl);Ns.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:n(d).version,rendererPackageName:"react-konva"});const Rs=n(d).forwardRef(((e,t)=>n(d).createElement(xs,{},n(d).createElement(Ms,{...e,forwardedRef:t}))));var js;d=l("8NFma");js=function(e,t,n){const r=d.useRef("loading"),i=d.useRef(),[o,a]=d.useState(0),l=d.useRef(),s=d.useRef(),c=d.useRef();return l.current===e&&s.current===t&&c.current===n||(r.current="loading",i.current=void 0,l.current=e,s.current=t,c.current=n),d.useLayoutEffect((function(){if(e){var o=document.createElement("img");return o.addEventListener("load",l),o.addEventListener("error",s),t&&(o.crossOrigin=t),n&&(o.referrerpolicy=n),o.src=e,function(){o.removeEventListener("load",l),o.removeEventListener("error",s)}}function l(){r.current="loaded",i.current=o,a(Math.random())}function s(){r.current="failed",i.current=void 0,a(Math.random())}}),[e,t,n]),[i.current,r.current]},l("8NFma");d=l("8NFma");var Vs={};e(Vs,"Html",(()=>Ds),(e=>Ds=e));d=l("8NFma");var Is=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};const Ds=({children:e,groupProps:t,divProps:r,transform:i,transformFunc:o})=>{const a=n(d).useRef(null),[l]=(n(d).useRef(),n(d).useState((()=>document.createElement("div")))),s=n(d).useMemo((()=>n(h).createRoot(l)),[l]),c=null==i||i,u=()=>{if(c&&a.current){let e=a.current.getAbsoluteTransform().decompose();o&&(e=o(e)),l.style.position="absolute",l.style.zIndex="10",l.style.top="0px",l.style.left="0px",l.style.transform=`translate(${e.x}px, ${e.y}px) rotate(${e.rotation}deg) scaleX(${e.scaleX}) scaleY(${e.scaleY})`,l.style.transformOrigin="top left"}else l.style.position="",l.style.zIndex="",l.style.top="",l.style.left="",l.style.transform="",l.style.transformOrigin="";const e=r||{},{style:t}=e,n=Is(e,["style"]);Object.assign(l.style,t),Object.assign(l,n)};return n(d).useLayoutEffect((()=>{var e;const t=a.current;if(!t)return;const n=null===(e=t.getStage())||void 0===e?void 0:e.container();return n?(n.appendChild(l),c&&(e=>{const t=window.getComputedStyle(e).position;return!("absolute"===t||"relative"===t)})(n)&&(n.style.position="relative"),t.on("absoluteTransformChange",u),u(),()=>{var e;t.off("absoluteTransformChange",u),null===(e=l.parentNode)||void 0===e||e.removeChild(l)}):void 0}),[c]),n(d).useLayoutEffect((()=>{u()}),[r]),n(d).useLayoutEffect((()=>{s.render(e)})),n(d).useEffect((()=>()=>{s.unmount()}),[]),n(d).createElement(As,Object.assign({ref:a},t))};d=l("8NFma");const Fs=({selector:e,enabled:t,children:r})=>{const i=n(d).useRef(null),o=n(d).useRef(null),a=n(d).useRef(),l=null==t||t;return n(d).useLayoutEffect((()=>{if(!i.current||!o.current)return;a.current=o.current;const t=i.current.getStage().findOne(e);l&&t?o.current.moveTo(t):o.current.moveTo(i.current),i.current.getLayer().batchDraw(),t&&t.getLayer().batchDraw()}),[e,l]),n(d).useEffect((()=>()=>{var e;null===(e=a.current)||void 0===e||e.destroy()}),[]),n(d).createElement(As,{name:"_outer_portal",ref:i},n(d).createElement(As,{name:"_inner_portal",ref:o},r))};d=l("8NFma");let Bs=!1;function Us(e,t){const r=n(d).useRef();n(d).useLayoutEffect((()=>{r.current&&r.current.destroy()}),[t]),n(d).useLayoutEffect((()=>{if(!Bs)return;const t=e.current.opacity();return t?(e.current.opacity(0),r.current=new pl.Tween({node:e.current,opacity:t,onFinish:()=>{r.current?.destroy()}}),r.current.play(),()=>{r.current?.destroy()}):void 0}),[])}let Gs=0,qs=[];function Ws(e){Gs+=1;let t=!1;Date.now();const n=setTimeout((()=>{t||(Xs(`Timeout loading image ${e}`),console.error("Timeout triggered for loader. Some assets may not have loaded.",e),t=!0,Ks())}),3e4);return()=>{t||(clearTimeout(n),Ks())}}function Ks(){Gs-=1,0===Gs&&(qs.forEach((e=>e())),qs=[])}function Ys(){return new Promise((e=>{return t=()=>{Bs?setTimeout(e,300):e(!0)},void(0===Gs?t():qs.push(t));var t}))}let $s=[];function Xs(e){$s.forEach((t=>t(e)))}let Qs=je(["Roboto","Amatic SC","Press Start 2P","Marck Script","Rubik Mono One"]),Zs=!1;function Js(){return Zs}function ec(){return Qs}const tc=je([]);var nc=document.createElement("canvas");function rc(e,t="Arial"){var n=nc.getContext("2d");return n.font=`normal 40px '${e}', ${t}`,n.measureText("Some test text;?#D-ПРИВЕТ!1230o9u8i7y6t5r4e3w2q1").width}const ic={Arial:!0},oc=e=>ic[e];async function ac(e){if(ic[e])return;const t=!!document.fonts?.load,n=rc("Arial");if(t)try{await document.fonts.load(`16px '${e}'`);const t=rc(e);if(n!==t)return void(ic[e]=!0)}catch{}const r=rc("Times","Times"),i=rc(e);for(let t=0;t<100;t++){const t=rc(e,"Arial"),o=rc(e,"Times");if(t!==i||t!==n||o!==r)return void(ic[e]=!0);await new Promise((e=>setTimeout(e,60)))}console.warn(`Timeout for loading font "${e}". Looks like polotno can't load it. Is it a correct font family?`),Xs(`Timeout for loading font "${e}"`)}const lc={};const sc={};const cc=je({imageDownScalingEnabled:!0,removeBackgroundEnabled:!0,htmlRenderEnabled:!1,forceTextFitEnabled:!1,textVerticalResizeEnabled:!1,textOverflow:"resize"});function uc(e=""){return e.replace(/(<([^>]+)>)/gi,"")}var hc,fc,dc,pc,vc={};e(vc,"parse",(()=>hc),(e=>hc=e)),e(vc,"stringify",(()=>fc),(e=>fc=e)),(pc=pc||{}).stringify=(dc={"visit_linear-gradient":function(e){return dc.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return dc.visit_gradient(e)},"visit_radial-gradient":function(e){return dc.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return dc.visit_gradient(e)},visit_gradient:function(e){var t=dc.visit(e.orientation);return t&&(t+=", "),e.type+"("+t+dc.visit(e.colorStops)+")"},visit_shape:function(e){var t=e.value,n=dc.visit(e.at),r=dc.visit(e.style);return r&&(t+=" "+r),n&&(t+=" at "+n),t},"visit_default-radial":function(e){var t="",n=dc.visit(e.at);return n&&(t+=n),t},"visit_extent-keyword":function(e){var t=e.value,n=dc.visit(e.at);return n&&(t+=" at "+n),t},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return dc.visit(e.value.x)+" "+dc.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_literal:function(e){return dc.visit_color(e.value,e)},visit_hex:function(e){return dc.visit_color("#"+e.value,e)},visit_rgb:function(e){return dc.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return dc.visit_color("rgba("+e.value.join(", ")+")",e)},visit_color:function(e,t){var n=e,r=dc.visit(t.length);return r&&(n+=" "+r),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var t="",n=e.length;return e.forEach((function(e,r){t+=dc.visit(e),r<n-1&&(t+=", ")})),t},visit:function(e){if(!e)return"";if(e instanceof Array)return dc.visit_array(e,"");if(e.type){var t=dc["visit_"+e.type];if(t)return t(e);throw Error("Missing visitor visit_"+e.type)}throw Error("Invalid node.")}},function(e){return dc.visit(e)}),(pc=pc||{}).parse=function(){var e=/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,t=/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,n=/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,r=/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,i=/^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,o=/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,a=/^(left|center|right|top|bottom)/i,l=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,s=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,c=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,u=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,h=/^\(/,f=/^\)/,d=/^,/,p=/^\#([0-9a-fA-F]+)/,v=/^([a-zA-Z]+)/,m=/^rgb/i,g=/^rgba/i,y=/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/,b="";function w(e){var t=new Error(b+": "+e);throw t.source=b,t}function x(){var e=L(E);return b.length>0&&w("Invalid input not EOF"),e}function E(){return _("linear-gradient",e,S)||_("repeating-linear-gradient",t,S)||_("radial-gradient",n,C)||_("repeating-radial-gradient",r,C)}function _(e,t,n){return z(t,(function(t){var r=n();return r&&(j(d)||w("Missing comma before color stops")),{type:e,orientation:r,colorStops:L(P)}}))}function z(e,t){var n=j(e);if(n){j(h)||w("Missing (");var r=t(n);return j(f)||w("Missing )"),r}}function S(){return R("directional",i,1)||R("angular",u,1)}function C(){var e,t,n=O();return n&&((e=[]).push(n),t=b,j(d)&&((n=O())?e.push(n):b=t)),e}function O(){var e=function(){var e=R("shape",/^(circle)/i,0);e&&(e.style=N()||M());return e}()||function(){var e=R("shape",/^(ellipse)/i,0);e&&(e.style=H()||M());return e}();if(e)e.at=A();else{var t=M();if(t){e=t;var n=A();n&&(e.at=n)}else{var r=k();r&&(e={type:"default-radial",at:r})}}return e}function M(){return R("extent-keyword",o,1)}function A(){if(R("position",/^at/,0)){var e=k();return e||w("Missing positioning value"),e}}function k(){var e={x:H(),y:H()};if(e.x||e.y)return{type:"position",value:e}}function L(e){var t=e(),n=[];if(t)for(n.push(t);j(d);)(t=e())?n.push(t):w("One extra comma");return n}function P(){var e=R("hex",p,1)||z(g,(function(){return{type:"rgba",value:L(T)}}))||z(m,(function(){return{type:"rgb",value:L(T)}}))||R("literal",v,0);return e||w("Expected color definition"),e.length=H(),e}function T(){return j(y)[1]}function H(){return R("%",s,1)||R("position-keyword",a,1)||N()}function N(){return R("px",l,1)||R("em",c,1)}function R(e,t,n){var r=j(t);if(r)return{type:e,value:r[n]}}function j(e){var t,n;return(n=/^[\n\r\t\s]+/.exec(b))&&V(n[0].length),(t=e.exec(b))&&V(t[0].length),t}function V(e){b=b.substr(e)}return function(e){return b=e.toString(),x()}}(),hc=pc.parse,fc=pc.stringify;const mc=e=>e.indexOf("linear-gradient")>=0,gc=e=>"hex"===e.type?"#"+e.value:"literal"===e.type?e.value:`${e.type}(${e.value.join(",")})`,yc=e=>{if(!mc(e))return[0,e,e];const t=n(vc).parse(e)[0],r=parseFloat(t.orientation.value),i=t.colorStops[0],o=gc(i),a=t.colorStops[1];return[r,o,gc(a)]};function bc(e,t){const n={filters:[]};t.brightnessEnabled&&(n.filters.push(pl.Filters.Brighten),n.brightness=t.brightness),t.blurEnabled&&(n.filters.push(pl.Filters.Blur),n.blurRadius=t.blurRadius),t.sepiaEnabled&&n.filters.push(pl.Filters.Sepia),t.grayscaleEnabled&&n.filters.push(pl.Filters.Grayscale),e.setAttrs(n),n.filters.length?e.cache({pixelRatio:t.store._elementsPixelRatio}):e.clearCache(),e.getLayer()?.batchDraw()}l("8NFma");const wc=ei((({element:e})=>(0,s.jsx)(ks,{name:"highlighter",x:e.x,y:e.y,rotation:e.rotation,width:e.width,height:e.height,listening:!1,stroke:"rgb(0, 161, 255)",strokeWidth:2,strokeScaleEnabled:!1}))),xc=document.createElement("style");xc.type="text/css",document.head.appendChild(xc);const Ec={border:"none",padding:"0px",overflow:"hidden",background:"none",outline:"none",resize:"none",overflowWrap:"break-word",whiteSpace:"pre-wrap",userSelect:"text",wordBreak:"normal"};function _c(e){return function(e){e=e.replace(/\s/g,"");let t=0;for(var n=0;n<e.length;n++){r=e[n],new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*?[֑-߿יִ-﷽ﹰ-ﻼ]").test(r)&&(t+=1)}var r;return t>e.length/2}(e)?"rtl":"ltr"}const zc=ei((({textNodeRef:e,element:t,onBlur:r,selectAll:i,cursorPosition:o})=>{const[a,l]=n(d).useState(Ec),c=e.current;n(d).useLayoutEffect((()=>{const e={};e.width=c.width()-2*c.padding()+"px",e.height=c.height()-2*c.padding()+10+"px",e.fontSize=c.fontSize()+"px",e.lineHeight=c.lineHeight()+.01,e.fontFamily=c.fontFamily(),e.textAlign=c.align(),e.color=c.fill(),e.fontWeight=t.fontWeight,e.fontStyle=t.fontStyle;const n=`\n .polotno-input::placeholder {\n color: ${a.color};\n opacity: 0.6;\n }\n `;xc.innerHTML="",xc.appendChild(document.createTextNode(n)),JSON.stringify(e)!==JSON.stringify(a)&&l(e)}));const u=n(d).useRef(null);n(d).useEffect((()=>{const e=setTimeout((()=>{const e=u.current;if(!e)return;u.current?.focus();const t=o||e.value.length;e.selectionStart=e.selectionEnd=t,i&&(e?.select(),document.execCommand("selectAll",!1,null))}));return()=>{clearTimeout(e)}}),[]);let h=0;const f=c.textArr.length*c.lineHeight()*c.fontSize();return"middle"===t.verticalAlign&&(h=(t.height-f)/2),"bottom"===t.verticalAlign&&(h=t.height-f),(0,s.jsx)(Vs.Html,{children:(0,s.jsx)("textarea",{className:"polotno-input",ref:u,dir:_c(t.text),style:{...Ec,...a,paddingTop:h+"px"},value:t.text,onChange:e=>{t.set({text:e.target.value})},placeholder:t.placeholder,onBlur:r})})})),Sc=(e,t)=>{const[r,i]=n(d).useState(oc(t));return n(d).useLayoutEffect((()=>{if(oc(t))return void i(!0);let n=!0;return(async()=>{r&&i(!1);const o=Ws(`text ${t}`);await e.loadFont(t),pl.Util.requestAnimFrame(o),n&&i(!0)})(),()=>{n=!1}}),[t]),[r]};const Cc=e=>n(d).useMemo((()=>{if(!mc(e.fill))return{fill:e.fill};const t=yc(e.fill),n={x:e.width/2,y:e.height/2},r=Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2)),i=pl.Util.degToRad(t[0])-Math.PI/2;return{fillLinearGradientStartPointX:n.x-r*Math.cos(i),fillLinearGradientStartPointY:n.y-r*Math.sin(i),fillLinearGradientColorStops:[0,t[1],1,t[2]],fillLinearGradientEndPointX:n.x+r*Math.cos(i),fillLinearGradientEndPointY:n.y+r*Math.sin(i),fill:t[1],fillPriority:"linear-gradient"}}),[e.fill]),Oc=ei((({element:e,store:t})=>{const r=n(d).useRef(null),{editorEnabled:i,selectAll:o}=(e=>{const[t,r]=n(d).useState(!1),i=n(d).useRef(!1);return n(d).useEffect((()=>{var t=!0;return setTimeout((()=>{t&&(e._editModeEnabled&&(i.current=!0),r(!0),setTimeout((()=>{i.current=!1}),50))}),50),()=>{t=!1}}),[]),{editorEnabled:t&&e._editModeEnabled,selectAll:i.current}})(e),[a,l]=n(d).useState(!1),[c,u]=n(d).useState(!1),h=n(d).useRef(e.height),f=t.selectedElements.indexOf(e)>=0,{textVerticalResizeEnabled:p}=cc,v=function(e){const t=n(d).useRef(e),r=n(d).useRef(e);return n(d).useEffect((()=>{r.current=t.current,t.current=e}),[e]),r.current}(e.fontFamily);n(d).useEffect((()=>{if(e.width)return;const t=r.current;t.width(600),e.set({width:1.4*t.getTextWidth()})}),[]),n(d).useLayoutEffect((()=>Kt((()=>{bc(r.current,e)}))));const[m]=Sc(t,e.fontFamily),g=uc(e.text),y=()=>{const e=r.current.clone({height:void 0}),t=Math.ceil(e.fontSize()*e.lineHeight()*e.textArr.length+1);return e.destroy(),t};n(d).useLayoutEffect((()=>{if(!m)return;const{textOverflow:n}=cc;if(e.height)if("change-font-size"!==n||c){if("resize"===n){const n=y();p&&e.height<n&&t.history.ignore((()=>{e.set({height:n}),r.current.height(n)})),p||e.height===n||t.history.ignore((()=>{e.set({height:n}),r.current.height(n)}))}}else{const n=function(e,t){const n=e.getAttrs(),r=uc(t.text);let i=t.fontSize;const o=Math.round(2*t.fontSize)-1;for(let n=1;n<o;n++){const n=t.height&&e.height()>t.height,o=r.split("\n").join(" ").split(" ");let a=e.textArr.map((e=>e.text)).join(";");const l=o.find((e=>!a.includes(e)||(a=a.replace(e,""),!1)));if(!n&&!l)break;i-=.5,e.fontSize(i)}return e.fontSize(n.fontSize),i}(r.current,e);if(n!==e.fontSize)return void t.history.ignore((()=>{e.set({fontSize:n})}));const i=y();e.height!==i&&t.history.ignore((()=>{e.set({height:i})}))}else{const n=y();t.history.ignore((()=>{e.set({height:n})}))}})),n(d).useLayoutEffect((()=>{const t=r.current;t&&(t.width(t.width()+1e-8),t._setTextData(),bc(t,e))}),[m]);const b=n(d).useRef(null),w=n(d).useRef(0),x=n=>{const r=t.selectedElements.find((t=>t===e));r&&e.contentEditable&&(w.current=function(e){const t=e.target,n=function(e){var t=e.getAbsoluteTransform().copy();t.invert();var n=e.getStage().getPointerPosition();return t.point(n)}(t),r=t.textArr,i=Math.floor(n.y/(t.fontSize()*t.lineHeight())),o=r.slice(0,i).reduce(((e,t)=>e+t.text.length),i),a=r[i]??r[0];let l=0;return"right"===t.align()?l=t.width()-a.width:"center"===t.align()&&(l=t.width()/2-a.width/2),o+Math.round((n.x-l)/a.width*a.text.length)}(n),e.toggleEditMode())},E=!g&&e.placeholder?.6:e.opacity;Us(r,E);const _=(({fontLoaded:e,fontFamily:t,fontSize:r,lineHeight:i})=>n(d).useMemo((()=>{if("number"==typeof i)return i;const e=document.createElement("div");e.style.fontFamily=t,e.style.fontSize=r+"px",e.style.lineHeight=i,e.innerText="Test text",document.body.appendChild(e);const n=e.offsetHeight;return document.body.removeChild(e),n/r}),[e,t,r,i]))({fontLoaded:m,fontFamily:e.fontFamily,fontSize:e.fontSize,lineHeight:e.lineHeight}),z=e.selectable||"admin"===t.role,S=Cc(e);return(0,s.jsxs)(n(d).Fragment,{children:[(0,s.jsx)(Ts,{ref:r,id:e.id,name:"element",hideInExport:!e.showInExport||!g,editModeEnabled:e._editModeEnabled,x:e.x,y:e.y,rotation:e.rotation,width:e.width,height:e.height,text:g||e.placeholder,...S,stroke:e.stroke,strokeWidth:e.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:e.fontSize,fontFamily:`"${e.fontFamily}", "${v}"`,fontStyle:e.fontStyle+" "+e.fontWeight,textDecoration:e.textDecoration,align:e.align,verticalAlign:e.verticalAlign,draggable:e.draggable,opacity:E,visible:!e._editModeEnabled,ellipsis:"ellipsis"===cc.textOverflow,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,lineHeight:_,letterSpacing:e.letterSpacing*e.fontSize,listening:z,onDragStart:()=>{t.history.startTransaction()},onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:n=>{e.set({x:n.target.x(),y:n.target.y()}),t.history.endTransaction()},onMouseEnter:()=>{l(!0)},onMouseLeave:()=>{l(!1)},onClick:x,onTap:x,onTransformStart:()=>{u(!0),t.history.startTransaction(),h.current=r.current.height()},onTransform:t=>{const n=t.target,r=n.getStage()?.findOne("Transformer"),i=r.getActiveAnchor();if("middle-left"===i||"middle-right"===i){const t=n.scaleX(),r=n.width()*t,i=e.fontSize;let o=r;r<i&&(o=i,b.current&&n.position(b.current)),n.width(o),n.scaleX(1),n.scaleY(1);const a=y();if("ellipsis"!==cc.textOverflow){const t=Math.max(a,h.current);n.height(t),e.set({height:n.height()})}e.set({x:n.x(),y:n.y(),width:n.width(),rotation:n.rotation()}),bc(n,e)}if("top-center"===i||"bottom-center"===i){let n="resize"===cc.textOverflow?y():_*e.fontSize;t.target.height(Math.max(n,t.target.height()*t.target.scaleY())),t.target.scaleY(1)}t.target.strokeWidth(e.strokeWidth/t.target.scaleX()),b.current=t.target.position()},onTransformEnd:n=>{u(!1);const r=n.target.scaleX();n.target.scaleX(1),n.target.scaleY(1),n.target.strokeWidth(e.strokeWidth),e.set({fontSize:Math.round(e.fontSize*r),width:Math.ceil(n.target.width()*r),x:n.target.x(),y:n.target.y(),rotation:n.target.rotation(),height:n.target.height()}),t.history.endTransaction()}}),i&&(0,s.jsx)(As,{x:e.x,y:e.y,rotation:e.rotation,children:(0,s.jsx)(zc,{textNodeRef:r,element:e,selectAll:o,cursorPosition:w.current,onBlur:()=>{e.toggleEditMode(!1)}})}),!c&&(a||f)&&(0,s.jsx)(wc,{element:e})]})}));d=l("8NFma"),d=l("8NFma");function Mc(e){for(;e.parentNode;){if("defs"===e.nodeName)return!0;e=e.parentNode}return!1}function Ac(e){const t={fill:"",stroke:""};return e.getAttribute("fill")&&"none"!==e.getAttribute("fill")&&(t.fill=e.getAttribute("fill")),!t.fill&&e.style.fill&&"none"!==e.style.fill&&(t.fill=e.style.fill),e.getAttribute("stroke")&&(t.stroke=e.getAttribute("stroke")),!t.stroke&&e.style.stroke&&(t.stroke=e.style.stroke),t.stroke||t.fill||(t.fill="black"),t}const kc=["path","rect","circle"];function Lc(e){for(var t=[],n=e.getElementsByTagName("*"),r=0,i=n.length;r<i;r++){const e=n[r];Mc(e)||(null!==e.getAttribute("fill")&&t.push(e),(null!==e.getAttribute("stroke")||e.style&&e.style.fill||kc.indexOf(e.nodeName)>=0)&&t.push(e))}return t}async function Pc(e){const t=await fetch(e);return Hc(await t.text())}async function Tc(e){const t=await fetch(e,{mode:"cors"});return await t.text()}function Hc(e){return"data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(e)))}async function Nc(e){const t=await Tc(e);const n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement.getAttribute("viewBox"),[r,i,o,a]=n?.split(" ")||[];return{width:parseFloat(o),height:parseFloat(a)}}function Rc(e){var t=(new DOMParser).parseFromString(e,"image/svg+xml");const n=t.documentElement.getAttribute("viewBox"),[r,i,o,a]=n?.split(" ")||[],l=t.documentElement.getAttribute("width");!l&&t.documentElement.setAttribute("width",o+"px");const s=t.documentElement.getAttribute("height");if((!s||s.indexOf("%")>=0)&&t.documentElement.setAttribute("height",a+"px"),l&&l.indexOf("%")>=0&&s&&-1===s.indexOf("%")){const e=parseFloat(s)/parseFloat(a);t.documentElement.setAttribute("width",e*parseFloat(o)+"px")}if(s&&s.indexOf("%")>=0&&l&&-1===l.indexOf("%")){const e=parseFloat(l)/parseFloat(o);t.documentElement.setAttribute("height",e*parseFloat(a)+"px")}return(new XMLSerializer).serializeToString(t)}const jc=(e,t)=>{if(!e||!t)return!1;const n=pl.Util.colorToRGBA(e),r=pl.Util.colorToRGBA(t);return n&&r?n.r===r.r&&n.g===r.g&&n.b===r.b&&n.a===r.a:void 0};function Vc(e,t){var n=(new DOMParser).parseFromString(e,"image/svg+xml");const r=Lc(n),i=Array.from(t.keys());r.forEach((e=>{const{fill:r,stroke:o}=Ac(e);[{prop:"fill",color:r},{prop:"stroke",color:o}].forEach((({prop:r,color:o})=>{const a=i.find((e=>jc(e,o)));if(a){const i=t.get(a);if(mc(i)){const[t,o,a]=yc(i),l=[{offset:"0%","stop-color":o},{offset:"100%","stop-color":a}],s="color"+Math.round(1e8*Math.random());!function(e,t,n,r){var i=e.namespaceURI,o=document.createElementNS(i,"linearGradient");const a=pl.Util.degToRad(n+90),l=(Math.cos(a)+1)/2,s=(Math.sin(a)+1)/2,c=(Math.cos(a+Math.PI)+1)/2,u=(Math.sin(a+Math.PI)+1)/2;o.setAttribute("x1",100*l+"%"),o.setAttribute("y1",100*s+"%"),o.setAttribute("x2",100*c+"%"),o.setAttribute("y2",100*u+"%"),o.setAttribute("gradientUnits","userSpaceOnUse"),o.setAttribute("id",t);for(var h=0;h<r.length;h++){var f=r[h],d=document.createElementNS(i,"stop");for(var p in f)f.hasOwnProperty(p)&&d.setAttribute(p,f[p]);o.appendChild(d)}(e.querySelector("defs")||e.insertBefore(document.createElementNS(i,"defs"),e.firstChild)).appendChild(o)}(n.children[0],s,t,l),e.style[r]=null,e.setAttribute(r,`url('#${s}')`)}else e.style[r]=t.get(a)}}))}));return Hc((new XMLSerializer).serializeToString(n))}const Ic=e=>{const[t,r]=n(d).useState([]);return n(d).useEffect((()=>{let t=!1;return(async()=>{r([]);const n=function(e){const t=Lc((new DOMParser).parseFromString(e,"image/svg+xml")),n=[];return t.forEach((e=>{const{fill:t,stroke:r}=Ac(e);[t,r].forEach((e=>{e&&pl.Util.colorToRGBA(e)&&-1===n.indexOf(e)&&n.push(e)}))})),n}(await Tc(e));t||r(n)})(),()=>{t=!0}}),[e]),t};const Dc=e=>{const[t,r]=n(d).useState(e);return n(d).useEffect((()=>{(async()=>{const n=await async function(e){return e.indexOf("data:image/svg+xml")>=0||e.indexOf(".svg")>=0?Hc(Rc(await Tc(e))):e}(e);n!==t&&r(n)})()}),[e]),t};function Fc(e,t){const n=document.createElement("canvas");n.width=e.width,n.height=e.height,n.getContext("2d")?.drawImage(e,0,0,n.width,n.height);const r=function(e,t,n,r,i,o,a){for(var l=new ImageData(t,n),s=new Int32Array(e.data.buffer),c=e.width,u=new Int32Array(l.data.buffer),h=l.width,f=t/o,d=n/a,p=Math.round(1/f),v=Math.round(1/d),m=p*v,g=0;g<l.height;g++)for(var y=0;y<h;y++){for(var b=r+Math.round(y/f)+(i+Math.round(g/d))*c,w=0,x=0,E=0,_=0,z=0;z<v;z++)for(var S=0;S<p;S++){var C=s[b+S+z*c];w+=C<<24>>>24,x+=C<<16>>>24,E+=C<<8>>>24,_+=C>>>24}w=Math.round(w/m),x=Math.round(x/m),E=Math.round(E/m),_=Math.round(_/m),u[y+g*h]=_<<24|E<<16|x<<8|w}return l}(n.getContext("2d").getImageData(0,0,n.width,n.height),Math.floor(n.width*t),Math.floor(n.height*t),0,0,n.width,n.height);return n.width=Math.floor(n.width*t),n.height=Math.floor(n.height*t),n.getContext("2d")?.putImageData(r,0,0),n}const Bc=document.createElement("canvas"),Uc=ei((({element:e})=>{const t=Math.min(30,e.width/4,e.height/4),r=n(d).useRef(null);return n(d).useEffect((()=>{const e=r.current;if(!e)return;const t=new pl.Animation((t=>{e.rotate((t?.timeDiff||0)/2)}),e.getLayer());return t.start(),()=>{t.stop()}})),(0,s.jsxs)(As,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.opacity,hideInExport:!e.showInExport,children:[(0,s.jsx)(ks,{width:e.width,height:e.height,fill:"rgba(124, 173, 212, 0.8)"}),(0,s.jsx)("Arc",{ref:r,x:e.width/2,y:e.height/2,fill:"white",outerRadius:Math.abs(t),innerRadius:Math.max(1,t-5),angle:270})]})})),Gc=ei((({element:e})=>{const t="Can not load the image...",n=Math.max(10,Math.min(30,e.width/t.length));return(0,s.jsxs)(As,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.opacity,hideInExport:!e.showInExport,children:[(0,s.jsx)(ks,{width:e.width,height:e.height,fill:"rgba(223, 102, 102, 0.8)"}),(0,s.jsx)(Ts,{text:t,fontSize:n,width:e.width,height:e.height,align:"center",fill:"white",verticalAlign:"middle",padding:5})]})}));let qc=n(js);const Wc=(e,t)=>{const r=n(d).useRef(),i=()=>{r.current?.(),r.current=void 0};n(d).useEffect((()=>i),[]),n(d).useLayoutEffect((()=>{"loading"!==e||r.current||(r.current=Ws(`image ${t}`)),"loading"!==e&&i(),"failed"===e&&Xs(`image ${t}`)}),[e])},Kc=ei((({element:e,store:t})=>{const[r,i]=n(d).useState(!1),o=n(d).useRef(null),a=n(d).useRef(null),[l,c]=n(d).useState(!1),u=t.selectedElements.indexOf(e)>=0,[h,f]=(e=>{const[t,r]=n(d).useReducer((e=>e+1),0),i=n(d).useRef("loading"),o=n(d).useRef(e.src),a=n(d).useRef(e.src);return a.current!==e.src&&(a.current=e.src,i.current="loading"),n(d).useEffect((()=>{if("image"===e.type)return;if(!e.src)return;let t=!1;return(async()=>{i.current="loading",r();const n=Vc(Rc(await Tc(e.src)),e.colorsReplace);t||(o.current=n,i.current="loaded",r())})(),()=>{t=!0}}),[e.src,JSON.stringify(e.colorsReplace)]),"image"===e.type?[e.src,"loaded"]:[o.current,i.current]})(e),[p,v]=qc(h,"anonymous"),m="svg"!==e.type||"loaded"===f?v:"loading";Wc(m,e.id);const g=(({image:e,status:t,type:r})=>{const i=n(d).useRef();return n(d).useEffect((()=>{i.current=e||i.current}),[e]),"failed"!==t||"failed"!==t&&"svg"===r?i.current:void 0})({image:p,status:v,type:e.type}),y=((e,t)=>{const[r,i]=qc(e.maskSrc,"anonymous"),o=e.maskSrc?i:"loaded";return Wc(o,e.id),n(d).useMemo((()=>{if(!r)return t;if(!t||!t.width||!t.height)return t;const n=document.createElement("canvas");n.width=Math.max(t.width,1),n.height=Math.max(t.height,1);const i=n.getContext("2d");if(!i)return t;i.drawImage(t,0,0),i.globalCompositeOperation="source-in";const o=function(e,t){const n=t.width/t.height;let r,i;return n>=e.width/e.height?(r=e.width,i=e.width/n):(r=e.height*n,i=e.height),{x:(e.width-r)/2,y:(e.height-i)/2,width:r,height:i}}(r,e);return i.drawImage(r,o.x,o.y,o.width,o.height,0,0,t.width,t.height),n}),[t,r,e.width,e.height])})(e,((e,t,r)=>n(d).useMemo((()=>{const{flipX:n,flipY:i}=e,o="svg"===e.type||e.src.indexOf("data:image/svg+xml")>=0||e.src.indexOf(".svg")>=0;if(!n&&!i&&!o)return t;if(!t||!t.width||!t.height)return null;const a=document.createElement("canvas");let l=1;"svg"===e.type&&(l=Math.max(e.width/t.width*r,e.height/t.height*r)),a.width=Math.max(t.width*l,1),a.height=Math.max(t.height*l,1);let s=n?-a.width:0,c=i?-a.height:0;return a.getContext("2d")?.scale(n?-1:1,i?-1:1),a.getContext("2d")?.drawImage(t,s,c,a.width,a.height),a}),[e.flipX,e.flipY,t,e.width,e.height,r]))(e,p||g,t._elementsPixelRatio))||Bc;let{cropX:b,cropY:w,cropWidth:x,cropHeight:E}=e;"loaded"!==v&&(b=w=0,x=E=1);const _=y.width*x,z=y.height*E,S=e.width/e.height;let C,O;const M=_/z,A="svg"===e.type;A?(C=_,O=z):S>=M?(C=_,O=_/S):(C=z*S,O=z);const k={x:y.width*b,y:y.height*w,width:C,height:O},L=e.cornerRadius??0;let P=((e,t,r,i)=>{const o=Dc(e.clipSrc||""),[a]=qc(o,"anonymous"),l=n(d).useMemo((()=>{if(t&&a)return document.createElement("canvas")}),[t,a]);return n(d).useLayoutEffect((()=>{if(!a)return;if(!t||!t.width||!t.height)return;if(!a||!a.width||!a.height)return;if(!l)return;const n=document.createElement("canvas"),i=Math.max(e.width/a.width*r,e.height/a.height*r);n.width=a.width*i,n.height=a.height*i,n.getContext("2d")?.drawImage(a,0,0,n.width,n.height),l.width=Math.max(t.width,1),l.height=Math.max(t.height,1);const o=l.getContext("2d");o&&(o.save(),o.drawImage(n,0,0,t.width,t.height),o.globalCompositeOperation="source-in",o.drawImage(t,0,0,l.width,l.height),o.restore())}),[l,t,a,e.width,e.height,r,...i]),e.clipSrc&&a?l:t})(e,((e,t,r,i,o=0,a=!1)=>{const l=n(d).useMemo((()=>{if(t&&t.width&&t.height)return document.createElement("canvas")}),[t]);return n(d).useLayoutEffect((()=>{if(!l||!t)return;const n=Math.floor(Math.max(e.width*i,1)),s=Math.floor(Math.max(e.height*i,1));l.width=n,l.height=s;const c=l.getContext("2d");if(!c)return;const u=Math.min(o*i,n/2,s/2);u&&(c.beginPath(),c.moveTo(u,0),c.lineTo(n-u,0),c.arc(n-u,u,u,3*Math.PI/2,0,!1),c.lineTo(n,s-u),c.arc(n-u,s-u,u,0,Math.PI/2,!1),c.lineTo(u,s),c.arc(u,s-u,u,Math.PI/2,Math.PI,!1),c.lineTo(0,u),c.arc(u,u,u,Math.PI,3*Math.PI/2,!1),c.clip());const h=Math.max(e.width/r.width,e.height/r.height)*i,f=e.page._exporting&&cc.imageDownScalingEnabled&&h<1&&!a,d=f?Fc(t,h):t,p=f?{x:Math.floor(r.x*h),y:Math.floor(r.y*h),width:Math.floor(r.width*h),height:Math.floor(r.height*h)}:r;c.drawImage(d,p.x,p.y,p.width,p.height,0,0,l.width,l.height)}),[l,e.width,e.height,r.x,r.y,r.width,r.height,o,i,a,e.page._exporting]),l})(e,y,k,t._elementsPixelRatio,L,r||e._cropModeEnabled||"svg"===e.type),t._elementsPixelRatio,[k,L,t._elementsPixelRatio]);const T=Math.max(e.width/C,e.height/O);n(d).useEffect((()=>{if(!e._cropModeEnabled)return;const t=o.current?.getStage();function n(t){e._cropModeEnabled&&t.target!==a.current&&e.toggleCropMode(!1)}function r(t){e._cropModeEnabled&&"CANVAS"!==t.target.nodeName&&e.toggleCropMode(!1)}return document.body.addEventListener("click",r),t?.on("click",n),t?.on("tap",n),()=>{document.body.removeEventListener("click",r),document.body.removeEventListener("touchstart",r),t?.off("click",n),t?.off("click",n)}}),[e._cropModeEnabled]),n(d).useLayoutEffect((()=>{if(r||e._cropModeEnabled)return;bc(o.current,e);return Kt((()=>{bc(o.current,e)}),{delay:100})}),[y,r,x,E,e._cropModeEnabled]),n(d).useLayoutEffect((()=>{r||e._cropModeEnabled?o.current?.clearCache():bc(o.current,e)}),[r,e.width,e.height,e._cropModeEnabled]),n(d).useEffect((()=>{bc(o.current,e)}),[e.shadowEnabled,e.shadowBlur,e.cornerRadius,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]);const H=n(d).useRef(null),N=n(d).useRef(null),R=n(d).useRef(null);n(d).useLayoutEffect((()=>{e._cropModeEnabled&&(N.current.nodes([H.current]),R.current.nodes([a.current]))}),[e._cropModeEnabled]);const j=t=>{Math.round(t.target.x())>0&&(t.target.x(0),t.target.scaleX(1)),Math.round(t.target.y())>0&&(t.target.y(0),t.target.scaleY(1));const n=t.target.width()*t.target.scaleX(),r=t.target.height()*t.target.scaleY(),i=Math.min(1,C/n),o=Math.min(1,O/r),a=1-i,l=Math.min(a,Math.max(0,Math.round(-t.target.x())/n)),s=1-o,c=Math.min(s,Math.max(0,Math.round(-t.target.y())/r));t.target.setAttrs({x:-l*y.width,y:-c*y.height,scaleX:1,scaleY:1}),e.set({cropX:l,cropY:c,cropWidth:i,cropHeight:o})},V=()=>{"svg"!==e.type&&e.contentEditable&&setTimeout((()=>{e.toggleCropMode(!0)}))},I="svg"===e.type&&g,D="loading"===v&&!I,F="failed"===v,B=!D&&!F,U=n(d).useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),G=B?e.opacity:0;Us(o,G);const q=e.selectable||"admin"===t.role;return(0,s.jsxs)(n(d).Fragment,{children:[D&&(0,s.jsx)(Uc,{element:e}),F&&(0,s.jsx)(Gc,{element:e}),(0,s.jsx)(Ps,{ref:o,name:"element",id:e.id,image:P,x:e.x,y:e.y,width:e.width||1,height:e.height||1,rotation:e.rotation,opacity:G,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:k,listening:q,draggable:e.draggable,hideInExport:!e.showInExport,onMouseEnter:()=>{c(!0)},onMouseLeave:()=>{c(!1)},onDragStart:()=>{t.history.startTransaction()},onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:n=>{e.set({x:n.target.x(),y:n.target.y()}),t.history.endTransaction()},onDblClick:V,onDblTap:V,onTransformStart:()=>{i(!0),t.history.startTransaction(),U.current={cropX:e.cropX,cropY:e.cropY,cropWidth:e.cropWidth,cropHeight:e.cropHeight}},onTransform:t=>{const n=t.currentTarget,r=Math.abs(n.scaleX()-1)<1e-7?1:n.scaleX(),i=Math.abs(n.scaleY()-1)<1e-7?1:n.scaleY();n.scaleX(1),n.scaleY(1);const o=t.target.getStage()?.findOne("Transformer"),a=1-C/y.width,l=Math.min(a,Math.max(0,e.cropX)),s=1-O/y.height,c=Math.min(s,Math.max(0,e.cropY)),u=o.getActiveAnchor(),h=!(u.indexOf("middle")>=0||u.indexOf("center")>=0),f=!h&&r<1&&U.current.cropHeight>O/y.height;let d=h?e.cropWidth:e.cropWidth*r;f&&(d=e.cropWidth);const p=!h&&i<1&&U.current.cropWidth>C/y.width;let v=h?e.cropHeight:e.cropHeight*i;p&&(v=e.cropHeight),A&&(d=e.cropWidth,v=e.cropHeight),e.set({cropX:l,cropY:c,x:n.x(),y:n.y(),width:n.width()*r,height:n.height()*i,rotation:t.target.rotation(),cropWidth:Math.min(d,1-l),cropHeight:Math.min(v,1-c)})},onTransformEnd:n=>{const r=n.currentTarget;e.set({width:r.width(),height:r.height(),x:r.x(),y:r.y(),rotation:n.target.rotation(),cropWidth:C/y.width,cropHeight:O/y.height}),i(!1),t.history.endTransaction()}}),(0,s.jsx)(ks,{x:e.x,y:e.y,width:Math.max(e.width-e.borderSize,0),height:Math.max(e.height-e.borderSize,0),offsetX:-e.borderSize/2,offsetY:-e.borderSize/2,stroke:e.borderColor,strokeWidth:e.borderSize,listening:!1,visible:!!e.borderSize,rotation:e.rotation,cornerRadius:Math.max(0,L-e.borderSize),hideInExport:!e.showInExport}),e._cropModeEnabled&&(0,s.jsxs)(Fs,{selector:".page-abs-container",enabled:!0,children:[(0,s.jsx)(ks,{x:-1500,y:-1500,width:4500,height:4500,fill:"rgba(0,0,0,0.3)"}),(0,s.jsx)(Ps,{listening:!1,image:P,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur}),(0,s.jsxs)(As,{x:e.x,y:e.y,rotation:e.rotation,scaleX:T,scaleY:T,children:[(0,s.jsx)(Ps,{image:y,ref:a,opacity:.4,draggable:!0,x:-e.cropX*y.width,y:-e.cropY*y.height,onDragMove:j,onTransform:j}),(0,s.jsx)(Hs,{ref:R,anchorSize:20,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,rotateEnabled:!1,borderEnabled:!1,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2}),(0,s.jsx)(ks,{width:C,height:O,ref:H,listening:!1,onTransform:t=>{t.target.x()<-e.cropX*y.width-1e-9&&(t.target.x(-e.cropX*y.width),t.target.scaleX(1)),t.target.y()<-e.cropY*y.height-1e-9&&(t.target.y(-e.cropY*y.height),t.target.scaleY(1));const n=Math.min(1,Math.max(0,e.cropX+t.target.x()/y.width)),r=Math.min(1,Math.max(0,t.target.y()/y.height+e.cropY)),i=t.target.width()*t.target.scaleX(),o=t.target.height()*t.target.scaleY(),a=Math.min(1-n,i/y.width),l=Math.min(1-r,o/y.height),s=t.target.getAbsolutePosition(t.target.getParent().getParent());t.target.scale({x:1,y:1}),t.target.position({x:0,y:0}),e.set({x:s.x,y:s.y,cropX:n,cropY:r,cropWidth:a,cropHeight:l,width:Math.min(i*T,y.width*(1-n)*T),height:Math.min(o*T,y.height*(1-r)*T)})}}),(0,s.jsx)(Hs,{ref:N,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,keepRatio:!1,rotateEnabled:!1,anchorFill:"rgb(240, 240, 240)",anchorStrokeWidth:2,borderStrokeWidth:2})]})]}),(l||u)&&(0,s.jsx)(wc,{element:e})]})}));d=l("8NFma");var Yc,$c,Xc,Qc={};$c=function(e){var t,n,r=au(e),i=r[0],o=r[1],a=new nu(function(e,t,n){return 3*(t+n)/4-n}(0,i,o)),l=0,s=o>0?i-4:i;for(n=0;n<s;n+=4)t=tu[e.charCodeAt(n)]<<18|tu[e.charCodeAt(n+1)]<<12|tu[e.charCodeAt(n+2)]<<6|tu[e.charCodeAt(n+3)],a[l++]=t>>16&255,a[l++]=t>>8&255,a[l++]=255&t;2===o&&(t=tu[e.charCodeAt(n)]<<2|tu[e.charCodeAt(n+1)]>>4,a[l++]=255&t);1===o&&(t=tu[e.charCodeAt(n)]<<10|tu[e.charCodeAt(n+1)]<<4|tu[e.charCodeAt(n+2)]>>2,a[l++]=t>>8&255,a[l++]=255&t);return a},Xc=function(e){for(var t,n=e.length,r=n%3,i=[],o=16383,a=0,l=n-r;a<l;a+=o)i.push(lu(e,a,a+o>l?l:a+o));1===r?(t=e[n-1],i.push(eu[t>>2]+eu[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],i.push(eu[t>>10]+eu[t>>4&63]+eu[t<<2&63]+"="));return i.join("")}
|
|
35
35
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */;for(var Zc,Jc,eu=[],tu=[],nu="undefined"!=typeof Uint8Array?Uint8Array:Array,ru="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",iu=0,ou=ru.length;iu<ou;++iu)eu[iu]=ru[iu],tu[ru.charCodeAt(iu)]=iu;function au(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function lu(e,t,n){for(var r,i,o=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(eu[(i=r)>>18&63]+eu[i>>12&63]+eu[i>>6&63]+eu[63&i]);return o.join("")}tu["-".charCodeAt(0)]=62,tu["_".charCodeAt(0)]=63,Zc=function(e,t,n,r,i){var o,a,l=8*i-r-1,s=(1<<l)-1,c=s>>1,u=-7,h=n?i-1:0,f=n?-1:1,d=e[t+h];for(h+=f,o=d&(1<<-u)-1,d>>=-u,u+=l;u>0;o=256*o+e[t+h],h+=f,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+e[t+h],h+=f,u-=8);if(0===o)o=1-c;else{if(o===s)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=c}return(d?-1:1)*a*Math.pow(2,o-r)},Jc=function(e,t,n,r,i,o){var a,l,s,c=8*o-i-1,u=(1<<c)-1,h=u>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-a))<1&&(a--,s*=2),(t+=a+h>=1?f/s:f*Math.pow(2,1-h))*s>=2&&(a++,s/=2),a+h>=u?(l=0,a=u):a+h>=1?(l=(t*s-1)*Math.pow(2,i),a+=h):(l=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&l,d+=p,l/=256,i-=8);for(a=a<<i|l,c+=i;c>0;e[n+d]=255&a,d+=p,a/=256,c-=8);e[n+d-p]|=128*v};const su="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;Yc=hu;const cu=2147483647;function uu(e){if(e>cu)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,hu.prototype),t}function hu(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return pu(e)}return fu(e,t,n)}function fu(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!hu.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|yu(e,t);let r=uu(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Zu(e,Uint8Array)){const t=new Uint8Array(e);return mu(t.buffer,t.byteOffset,t.byteLength)}return vu(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Zu(e,ArrayBuffer)||e&&Zu(e.buffer,ArrayBuffer))return mu(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Zu(e,SharedArrayBuffer)||e&&Zu(e.buffer,SharedArrayBuffer)))return mu(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return hu.from(r,t,n);const i=function(e){if(hu.isBuffer(e)){const t=0|gu(e.length),n=uu(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||Ju(e.length)?uu(0):vu(e);if("Buffer"===e.type&&Array.isArray(e.data))return vu(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return hu.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function du(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function pu(e){return du(e),uu(e<0?0:0|gu(e))}function vu(e){const t=e.length<0?0:0|gu(e.length),n=uu(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function mu(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,hu.prototype),r}function gu(e){if(e>=cu)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+cu.toString(16)+" bytes");return 0|e}function yu(e,t){if(hu.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Zu(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return $u(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Xu(e).length;default:if(i)return r?-1:$u(e).length;t=(""+t).toLowerCase(),i=!0}}function bu(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Tu(this,t,n);case"utf8":case"utf-8":return Au(this,t,n);case"ascii":return Lu(this,t,n);case"latin1":case"binary":return Pu(this,t,n);case"base64":return Mu(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Hu(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function wu(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function xu(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Ju(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=hu.from(t,r)),hu.isBuffer(t))return 0===t.length?-1:Eu(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Eu(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function Eu(e,t,n,r,i){let o,a=1,l=e.length,s=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,l/=2,s/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let r=-1;for(o=n;o<l;o++)if(c(e,o)===c(t,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===s)return r*a}else-1!==r&&(o-=o-r),r=-1}else for(n+s>l&&(n=l-s),o=n;o>=0;o--){let n=!0;for(let r=0;r<s;r++)if(c(e,o+r)!==c(t,r)){n=!1;break}if(n)return o}return-1}function _u(e,t,n,r){n=Number(n)||0;const i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=t.length;let a;for(r>o/2&&(r=o/2),a=0;a<r;++a){const r=parseInt(t.substr(2*a,2),16);if(Ju(r))return a;e[n+a]=r}return a}function zu(e,t,n,r){return Qu($u(t,e.length-n),e,n,r)}function Su(e,t,n,r){return Qu(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function Cu(e,t,n,r){return Qu(Xu(t),e,n,r)}function Ou(e,t,n,r){return Qu(function(e,t){let n,r,i;const o=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function Mu(e,t,n){return 0===t&&n===e.length?Xc(e):Xc(e.slice(t,n))}function Au(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i<n;){const t=e[i];let o=null,a=t>239?4:t>223?3:t>191?2:1;if(i+a<=n){let n,r,l,s;switch(a){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128==(192&n)&&(s=(31&t)<<6|63&n,s>127&&(o=s));break;case 3:n=e[i+1],r=e[i+2],128==(192&n)&&128==(192&r)&&(s=(15&t)<<12|(63&n)<<6|63&r,s>2047&&(s<55296||s>57343)&&(o=s));break;case 4:n=e[i+1],r=e[i+2],l=e[i+3],128==(192&n)&&128==(192&r)&&128==(192&l)&&(s=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&l,s>65535&&s<1114112&&(o=s))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(e){const t=e.length;if(t<=ku)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=ku));return n}(r)}hu.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),hu.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(hu.prototype,"parent",{enumerable:!0,get:function(){if(hu.isBuffer(this))return this.buffer}}),Object.defineProperty(hu.prototype,"offset",{enumerable:!0,get:function(){if(hu.isBuffer(this))return this.byteOffset}}),hu.poolSize=8192,hu.from=function(e,t,n){return fu(e,t,n)},Object.setPrototypeOf(hu.prototype,Uint8Array.prototype),Object.setPrototypeOf(hu,Uint8Array),hu.alloc=function(e,t,n){return function(e,t,n){return du(e),e<=0?uu(e):void 0!==t?"string"==typeof n?uu(e).fill(t,n):uu(e).fill(t):uu(e)}(e,t,n)},hu.allocUnsafe=function(e){return pu(e)},hu.allocUnsafeSlow=function(e){return pu(e)},hu.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==hu.prototype},hu.compare=function(e,t){if(Zu(e,Uint8Array)&&(e=hu.from(e,e.offset,e.byteLength)),Zu(t,Uint8Array)&&(t=hu.from(t,t.offset,t.byteLength)),!hu.isBuffer(e)||!hu.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},hu.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},hu.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return hu.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=hu.allocUnsafe(t);let i=0;for(n=0;n<e.length;++n){let t=e[n];if(Zu(t,Uint8Array))i+t.length>r.length?(hu.isBuffer(t)||(t=hu.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!hu.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},hu.byteLength=yu,hu.prototype._isBuffer=!0,hu.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)wu(this,t,t+1);return this},hu.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)wu(this,t,t+3),wu(this,t+1,t+2);return this},hu.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)wu(this,t,t+7),wu(this,t+1,t+6),wu(this,t+2,t+5),wu(this,t+3,t+4);return this},hu.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?Au(this,0,e):bu.apply(this,arguments)},hu.prototype.toLocaleString=hu.prototype.toString,hu.prototype.equals=function(e){if(!hu.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===hu.compare(this,e)},hu.prototype.inspect=function(){let e="";return e=this.toString("hex",0,50).replace(/(.{2})/g,"$1 ").trim(),this.length>50&&(e+=" ... "),"<Buffer "+e+">"},su&&(hu.prototype[su]=hu.prototype.inspect),hu.prototype.compare=function(e,t,n,r,i){if(Zu(e,Uint8Array)&&(e=hu.from(e,e.offset,e.byteLength)),!hu.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const l=Math.min(o,a),s=this.slice(r,i),c=e.slice(t,n);for(let e=0;e<l;++e)if(s[e]!==c[e]){o=s[e],a=c[e];break}return o<a?-1:a<o?1:0},hu.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},hu.prototype.indexOf=function(e,t,n){return xu(this,e,t,n,!0)},hu.prototype.lastIndexOf=function(e,t,n){return xu(this,e,t,n,!1)},hu.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return _u(this,e,t,n);case"utf8":case"utf-8":return zu(this,e,t,n);case"ascii":case"latin1":case"binary":return Su(this,e,t,n);case"base64":return Cu(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ou(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},hu.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const ku=4096;function Lu(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function Pu(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function Tu(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=t;r<n;++r)i+=eh[e[r]];return i}function Hu(e,t,n){const r=e.slice(t,n);let i="";for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+256*r[e+1]);return i}function Nu(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function Ru(e,t,n,r,i,o){if(!hu.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function ju(e,t,n,r,i){qu(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function Vu(e,t,n,r,i){qu(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function Iu(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Du(e,t,n,r,i){return t=+t,n>>>=0,i||Iu(e,0,n,4),Jc(e,t,n,r,23,4),n+4}function Fu(e,t,n,r,i){return t=+t,n>>>=0,i||Iu(e,0,n,8),Jc(e,t,n,r,52,8),n+8}hu.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,hu.prototype),r},hu.prototype.readUintLE=hu.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||Nu(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return r},hu.prototype.readUintBE=hu.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||Nu(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},hu.prototype.readUint8=hu.prototype.readUInt8=function(e,t){return e>>>=0,t||Nu(e,1,this.length),this[e]},hu.prototype.readUint16LE=hu.prototype.readUInt16LE=function(e,t){return e>>>=0,t||Nu(e,2,this.length),this[e]|this[e+1]<<8},hu.prototype.readUint16BE=hu.prototype.readUInt16BE=function(e,t){return e>>>=0,t||Nu(e,2,this.length),this[e]<<8|this[e+1]},hu.prototype.readUint32LE=hu.prototype.readUInt32LE=function(e,t){return e>>>=0,t||Nu(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},hu.prototype.readUint32BE=hu.prototype.readUInt32BE=function(e,t){return e>>>=0,t||Nu(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},hu.prototype.readBigUInt64LE=th((function(e){Wu(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Ku(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),hu.prototype.readBigUInt64BE=th((function(e){Wu(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Ku(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),hu.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||Nu(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},hu.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||Nu(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},hu.prototype.readInt8=function(e,t){return e>>>=0,t||Nu(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},hu.prototype.readInt16LE=function(e,t){e>>>=0,t||Nu(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},hu.prototype.readInt16BE=function(e,t){e>>>=0,t||Nu(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},hu.prototype.readInt32LE=function(e,t){return e>>>=0,t||Nu(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},hu.prototype.readInt32BE=function(e,t){return e>>>=0,t||Nu(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},hu.prototype.readBigInt64LE=th((function(e){Wu(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Ku(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),hu.prototype.readBigInt64BE=th((function(e){Wu(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Ku(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),hu.prototype.readFloatLE=function(e,t){return e>>>=0,t||Nu(e,4,this.length),Zc(this,e,!0,23,4)},hu.prototype.readFloatBE=function(e,t){return e>>>=0,t||Nu(e,4,this.length),Zc(this,e,!1,23,4)},hu.prototype.readDoubleLE=function(e,t){return e>>>=0,t||Nu(e,8,this.length),Zc(this,e,!0,52,8)},hu.prototype.readDoubleBE=function(e,t){return e>>>=0,t||Nu(e,8,this.length),Zc(this,e,!1,52,8)},hu.prototype.writeUintLE=hu.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){Ru(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},hu.prototype.writeUintBE=hu.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){Ru(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},hu.prototype.writeUint8=hu.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||Ru(this,e,t,1,255,0),this[t]=255&e,t+1},hu.prototype.writeUint16LE=hu.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||Ru(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},hu.prototype.writeUint16BE=hu.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||Ru(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},hu.prototype.writeUint32LE=hu.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||Ru(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},hu.prototype.writeUint32BE=hu.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||Ru(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},hu.prototype.writeBigUInt64LE=th((function(e,t=0){return ju(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),hu.prototype.writeBigUInt64BE=th((function(e,t=0){return Vu(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),hu.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);Ru(this,e,t,n,r-1,-r)}let i=0,o=1,a=0;for(this[t]=255&e;++i<n&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+n},hu.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);Ru(this,e,t,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+n},hu.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||Ru(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},hu.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||Ru(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},hu.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||Ru(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},hu.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||Ru(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},hu.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||Ru(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},hu.prototype.writeBigInt64LE=th((function(e,t=0){return ju(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),hu.prototype.writeBigInt64BE=th((function(e,t=0){return Vu(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),hu.prototype.writeFloatLE=function(e,t,n){return Du(this,e,t,!0,n)},hu.prototype.writeFloatBE=function(e,t,n){return Du(this,e,t,!1,n)},hu.prototype.writeDoubleLE=function(e,t,n){return Fu(this,e,t,!0,n)},hu.prototype.writeDoubleBE=function(e,t,n){return Fu(this,e,t,!1,n)},hu.prototype.copy=function(e,t,n,r){if(!hu.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},hu.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!hu.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{const o=hu.isBuffer(e)?e:hu.from(e,r),a=o.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=o[i%a]}return this};const Bu={};function Uu(e,t,n){Bu[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function Gu(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function qu(e,t,n,r,i,o){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new Bu.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){Wu(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||Ku(t,e.length-(n+1))}(r,i,o)}function Wu(e,t){if("number"!=typeof e)throw new Bu.ERR_INVALID_ARG_TYPE(t,"number",e)}function Ku(e,t,n){if(Math.floor(e)!==e)throw Wu(e,n),new Bu.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new Bu.ERR_BUFFER_OUT_OF_BOUNDS;throw new Bu.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}Uu("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),Uu("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),Uu("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=Gu(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=Gu(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const Yu=/[^+/0-9A-Za-z-_]/g;function $u(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let a=0;a<r;++a){if(n=e.charCodeAt(a),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Xu(e){return $c(function(e){if((e=(e=e.split("=")[0]).trim().replace(Yu,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Qu(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Zu(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Ju(e){return e!=e}const eh=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function th(e){return"undefined"==typeof BigInt?nh:e}function nh(){throw new Error("BigInt not supported")}var rh,ih=Yc;
|
|
36
36
|
/*!
|
|
37
37
|
* Quill Editor v1.3.7
|
|
@@ -59,7 +59,7 @@ THE SOFTWARE.
|
|
|
59
59
|
.ql-direction-rtl {
|
|
60
60
|
direction: rtl;
|
|
61
61
|
}
|
|
62
|
-
`,Ah=({html:e,onBlur:t,onChange:r,element:i})=>{const o=n(d).useRef(null);n(d).useEffect((()=>{if(!o.current)return;const e=new(n(Qc))(o.current,{toolbar:!1,keyboard:!1,clipboard:{matchVisual:!1}});return Oh.editor.instance=e,window.__polotnoQuill=e,e.on("text-change",(()=>{e.getSelection()&&(Oh.currentFormat=e.getFormat()),setTimeout((()=>{r(o.current?.childNodes[0].innerHTML)}),10)})),e.setSelection(0,0,"api"),e.on("selection-change",(n=>{n||t(),n&&(Oh.currentFormat=e.getFormat())})),o.current.childNodes[0].addEventListener("blur",(e=>{e.relatedTarget?.classList.contains("ql-clipboard")||t()})),()=>{Oh.editor.instance=null,Oh.currentFormat={},delete window.__polotnoQuill}}),[]),n(d).useEffect((()=>{const t=Oh.editor.instance,n=t.getSelection();if(!(o.current?.childNodes[0].innerHTML===i.text)){var r=t.clipboard.convert("<div class='ql-editor' style='outline: none;'>"+e+"<p><br></p></div>");t.setContents(r),t.history.clear(),n&&(t.setSelection(n.index,n.length),Oh.currentFormat=t.getFormat())}}),[i.text]);const a=Cc(i).fill;return(0,s.jsx)(Mh,{ref:o,style:{fontSize:i.fontSize,color:a,width:i.width,fontFamily:i.fontFamily,lineHeight:i.lineHeight,letterSpacing:i.letterSpacing+"rem",textAlign:i.align},dir:_c(uc(i.text))})};function kh(e,{fontFamily:t="",color:n="black"}={}){let r=`color: ${n||e.fill}`;return`<div style="white-space: pre-wrap; width: ${e.width||100}px; ${r}; font-size: ${e.fontSize}px; font-family: '${t}'; text-decoration: ${e.textDecoration}; text-align: ${e.align}; line-height: ${e.lineHeight}; letter-spacing: ${e.letterSpacing}rem; font-style: ${e.fontStyle}; font-weight: ${e.fontWeight}; -webkit-text-stroke: ${e.strokeWidth}px ${e.stroke};" contentEditable dir="${_c(uc(e.text))}">${e.text}</div>`}const Lh=ei((({element:e,store:t})=>{const r=n(d).useRef(null),[i,o]=n(d).useState(),[a,l]=n(d).useState(!1),[c,u]=n(d).useState(!0),[h,f]=n(d).useState(!1),[p,v]=n(d).useState(!1),m=n(d).useRef(e.height),g=t.selectedElements.indexOf(e)>=0,y=e.fontSize/4,{textVerticalResizeEnabled:b}=cc,[w]=Sc(t,e.fontFamily);Us(r);const x=w?e.fontFamily:"Arial",E=Cc(e).fill,_=kh(e,{fontFamily:x,color:E}),{width:z,height:S}=function(e,t,r){return n(d).useMemo((()=>lh(e)),[e,t.width,r])}(_,e,w);n(d).useEffect((()=>{if(!w)return;if(!e.height)return void e.set({height:S});const{textOverflow:n}=cc;if("change-font-size"!==n||a)"resize"===n&&(b&&e.height<S&&t.history.ignore((()=>{e.set({height:S})})),b||e.height===S||t.history.ignore((()=>{e.set({height:S})})));else{const n=(e=>{let t=e.fontSize;for(let n=1;n<50;n++){const n=kh({...e.toJSON(),fontSize:t},{fontFamily:e.fontFamily}),{height:r}=lh(n);if(!(e.height&&r>e.height))break;t-=.5}return t})(e);n!==e.fontSize?t.history.ignore((()=>{e.set({fontSize:n})})):e.height!==S&&t.history.ignore((()=>{e.set({height:S})}))}}));const C=n(d).useRef(0);n(d).useLayoutEffect((()=>{if(a||h)return;C.current++;const n=C.current,r=Ws(`text ${e.id}`);u(!0),async function(){await new Promise((e=>setTimeout(e)));const i=await sh({html:_,width:e.width||1,height:e.height||S||1,fontFamily:x,padding:y,font:t.fonts.find((e=>e.fontFamily===x))||tc.find((e=>e.fontFamily===x))});n===C.current?(o(i),u(!1),pl.Util.requestAnimFrame(r)):r()}()}),[_,a,S,h,x]);const O=a||c;n(d).useLayoutEffect((()=>Kt((()=>{bc(r.current,e)}))),[i,O,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]);let M=0;return"middle"===e.verticalAlign&&(M=(e.height-S)/2),"bottom"===e.verticalAlign&&(M=e.height-S),(0,s.jsxs)(n(d).Fragment,{children:[(0,s.jsx)(ks,{ref:r,name:"element",x:e.x,y:e.y,listening:e.selectable,rotation:e.rotation,width:e.width,height:e.height,visible:!O,draggable:e.draggable,opacity:h?0:e.opacity,hideInExport:!e.showInExport,onMouseEnter:()=>{v(!0)},onMouseLeave:()=>{v(!1)},onDragStart:()=>{t.history.startTransaction()},onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:n=>{e.set({x:n.target.x(),y:n.target.y()}),t.history.endTransaction()},id:e.id,onDblClick:()=>{e.contentEditable&&f(!0)},onDblTap:()=>{e.contentEditable&&f(!0)},onTransformStart:t=>{l(!0),m.current=e.height},onTransform:t=>{const n=t.target,r=n.getStage()?.findOne("Transformer"),i=r.getActiveAnchor(),o="middle-left"===i||"middle-right"===i,a="top-center"===i||"bottom-center"===i,l=n.scaleX();if(o){const t=n.scaleX(),r=Math.max(n.width()*t,e.fontSize);if(n.width(r),n.scaleX(1),cc.textVerticalResizeEnabled){const t=Math.max(S,m.current);e.set({height:t})}e.set({width:r,x:n.x()})}else if(a){let r="resize"===cc.textOverflow?S:e.lineHeight*e.fontSize;const i=Math.max(r,t.target.height()*t.target.scaleY());n.scaleY(1),e.set({x:n.x(),y:n.y(),height:i,rotation:n.rotation()})}else n.scaleX(1),n.scaleY(1),e.set({fontSize:e.fontSize*l,width:n.width()*l,x:n.x(),y:n.y(),rotation:n.rotation()})},onTransformEnd:t=>{l(!1),u(!0);const n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set({fontSize:e.fontSize*n,width:t.target.width()*n,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation()})}}),(0,s.jsx)(Ps,{ref:r,image:i,x:e.x,y:e.y,offsetX:y,offsetY:y-M,listening:!1,rotation:e.rotation,width:e.width+2*y,height:e.height+2*y,visible:!O,opacity:h?0:e.opacity,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,hideInExport:!e.showInExport}),O&&(0,s.jsx)(As,{x:e.x,y:e.y,rotation:e.rotation,offsetY:-M,children:(0,s.jsx)(Vs.Html,{divProps:{style:{pointerEvents:"none"}},children:(0,s.jsx)(Mh,{dangerouslySetInnerHTML:{__html:_},style:{pointerEvents:"none",display:"inline-block"}})})}),h&&(0,s.jsx)(As,{x:e.x,y:e.y,rotation:e.rotation,offsetY:-M,children:(0,s.jsx)(Vs.Html,{children:(0,s.jsx)(Ah,{html:_,element:e,onChange:t=>{e.set({text:t})},onBlur:e=>{f(!1)}})})}),(g||p)&&(0,s.jsx)(wc,{element:e})]})})),Ph={text:Oc,image:Kc,svg:Kc};var Th=ei((e=>{let t=Ph[e.element.type];return"text"===e.element.type&&cc.htmlRenderEnabled&&(t=Lh),e.element.visible?t?(0,s.jsx)(t,{...e}):(console.error("Can not find component for "+e.element.type),null):null}));d=l("8NFma");function Hh(e,t,n,r,i){const o=Math.sqrt(n*n+r*r);i+=Math.atan2(r,n);return{x:e+o*Math.cos(i),y:t+o*Math.sin(i)}}function Nh(e){const{x:t,y:n,width:r,height:i}=e,o=pl.Util.degToRad(e.rotation),a=Hh(t,n,0,0,o),l=Hh(t,n,r,0,o),s=Hh(t,n,r,i,o),c=Hh(t,n,0,i,o),u=Math.min(a.x,l.x,s.x,c.x),h=Math.min(a.y,l.y,s.y,c.y),f=Math.max(a.x,l.x,s.x,c.x),d=Math.max(a.y,l.y,s.y,c.y);return{x:u,y:h,width:f-u,height:d-h,minX:u,minY:h,maxX:f,maxY:d}}function Rh(e){const t=e.map((e=>Nh(e))),n=Math.min(...t.map((e=>e.minX))),r=Math.min(...t.map((e=>e.minY))),i=Math.max(...t.map((e=>e.maxX))),o=Math.max(...t.map((e=>e.maxY)));return{x:n,y:r,width:i-n,height:o-r,minX:n,minY:r,maxX:i,maxY:o}}function jh(e,t){var n=[],r=[];e.vertical.forEach((e=>{t.vertical.forEach((t=>{var r=Math.abs(e-t.guide);r<5&&n.push({lineGuide:e,diff:r,snap:t.snap,offset:t.offset})}))})),e.horizontal.forEach((e=>{t.horizontal.forEach((t=>{var n=Math.abs(e-t.guide);n<5&&r.push({lineGuide:e,diff:n,snap:t.snap,offset:t.offset})}))}));var i=[];const o=n.sort(((e,t)=>e.diff-t.diff)),a=r.sort(((e,t)=>e.diff-t.diff));var l=o[0],s=a[0];if(l){o.filter((e=>Math.abs(e.diff-l.diff)<.1)).forEach((e=>{i.push({orientation:"V",...e})}))}if(s){a.filter((e=>Math.abs(e.diff-s.diff)<.1)).forEach((e=>{i.push({orientation:"H",...e})}))}return i}function Vh(e){const t=e=>e.hasName("element")||e.hasName("page-background")||e.hasName("elements-area");function r(n){const r=e.current?.getStage();var i=[],o=[];return r.find(t).forEach((e=>{if(!(n.indexOf(e)>=0)){var t=e.getClientRect({skipShadow:!0,skipStroke:!0});i.push(t.x,t.x+t.width,t.x+t.width/2),o.push(t.y,t.y+t.height,t.y+t.height/2)}})),{vertical:i,horizontal:o}}function i(t){const n=e.current?.getLayer(),r=n?.children.find((e=>"line-guides"===e.name()));t.forEach((e=>{if("H"===e.orientation){var t=new pl.Line({points:[-6e3,e.lineGuide,6e3,e.lineGuide],stroke:"rgb(0, 161, 255)",strokeWidth:1,name:"guid-line",dash:[4,6]});r?.add(t),n.batchDraw()}else if("V"===e.orientation){t=new pl.Line({points:[e.lineGuide,-6e3,e.lineGuide,6e3],stroke:"rgb(0, 161, 255)",strokeWidth:1,name:"guid-line",dash:[4,6]});r?.add(t)}}))}const o=e=>{e.target.getLayer().children.find((e=>"line-guides"===e.name())).destroyChildren();var t=r(e.target.nodes()),n=function(e){const t=e.__getNodeRect(),n=Nh({...t,rotation:pl.Util.radToDeg(t.rotation)}),r=e.getAbsolutePosition();return{vertical:[{guide:n.x,offset:r.x-n.x,snap:"start"},{guide:n.x+n.width/2,offset:r.x-n.x-n.width/2,snap:"center"},{guide:n.x+n.width,offset:r.x-n.x-n.width,snap:"end"}],horizontal:[{guide:n.y,offset:r.y-n.y,snap:"start"},{guide:n.y+n.height/2,offset:r.y-n.y-n.height/2,snap:"center"},{guide:n.y+n.height,offset:r.y-n.y-n.height,snap:"end"}]}}(e.target),o=jh(t,n);if(!o.length)return;i(o);const a=e.target.getAbsolutePosition(),l={...a};o.forEach((e=>{switch(e.snap){case"start":case"center":case"end":switch(e.orientation){case"V":l.x=e.lineGuide+e.offset;break;case"H":l.y=e.lineGuide+e.offset}}}));const s=l.x-a.x,c=l.y-a.y;e.evt.ctrlKey||e.evt.metaKey||e.target.nodes().forEach((e=>{const t=e.getAbsolutePosition();e.setAbsolutePosition({x:t.x+s,y:t.y+c})}))},a=(t,n,o)=>{const a=e.current,l=a.getLayer();if(l.children.find((e=>"line-guides"===e.name())).destroyChildren(),"rotater"===a.getActiveAnchor())return n;if(Math.sqrt(Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2))>50)return n;if(!l)return n;var s=jh(r(a.nodes()),{vertical:[{guide:n.x,offset:0,snap:"start"}],horizontal:[{guide:n.y,offset:0,snap:"start"}]});if(!s.length)return n;i(s);if(o.ctrlKey||o.metaKey)return n;let c=n.x,u=n.x;s.forEach((e=>{switch(e.orientation){case"V":c=e.lineGuide;break;case"H":u=e.lineGuide}}));const h=Math.abs(n.x-c)<10,f=Math.abs(n.y-u)<10;return h&&!f?{x:c,y:t.y}:f&&!h?{x:t.x,y:u}:h&&f?{x:c,y:u}:n},l=e=>{const t=e.target.getLayer();t.children.find((e=>"line-guides"===e.name())).destroyChildren(),t.batchDraw()};n(d).useEffect((()=>{e.current&&(e.current.anchorDragBoundFunc(a),e.current.on("dragstart",(()=>{setTimeout((()=>{const e=[...pl.DD._dragElements.entries()];e.reverse(),pl.DD._dragElements.clear(),e.forEach((([e,t])=>{pl.DD._dragElements.set(e,t)}))}))})),e.current.on("dragmove",o),e.current.on("dragend",l),e.current.on("transformend",l))}),[])}function Ih(e,t,n="scale"){const r=t.width/t.height;let i,o;r>=e.width/e.height?(i=e.width,o=e.width/r):(i=e.height*r,o=e.height);let a=0,l=0;return"left-top"===n?(a=0,l=0):"left-middle"===n?(a=0,l=(e.height-o)/2):"left-bottom"===n?(a=0,l=e.height-o):"center-top"===n?(a=(e.width-i)/2,l=0):"center-middle"===n?(a=(e.width-i)/2,l=(e.height-o)/2):"center-bottom"===n?(a=(e.width-i)/2,l=e.height-o):"right-top"===n?(a=e.width-i,l=0):"right-middle"===n?(a=e.width-i,l=(e.height-o)/2):"right-bottom"===n?(a=e.width-i,l=e.height-o):"scale"===n?(a=0,l=0,i=e.width,o=e.height):console.error(new Error("Unknown clip position property - "+n)),{cropX:a,cropY:l,cropWidth:i,cropHeight:o}}l("8NFma");var Dh={};Object.defineProperty(Dh,"__esModule",{value:!0}),Dh.LegacyColors=Dh.Colors=void 0;var Fh={};Object.defineProperty(Fh,"__esModule",{value:!0}),Fh.Colors=void 0;const Bh={CERULEAN1:"#0C5174",CERULEAN2:"#0F6894",CERULEAN3:"#147EB3",CERULEAN4:"#3FA6DA",CERULEAN5:"#68C1EE",FOREST1:"#1D7324",FOREST2:"#238C2C",FOREST3:"#29A634",FOREST4:"#43BF4D",FOREST5:"#62D96B",GOLD1:"#5C4405",GOLD2:"#866103",GOLD3:"#D1980B",GOLD4:"#F0B726",GOLD5:"#FBD065",INDIGO1:"#5642A6",INDIGO2:"#634DBF",INDIGO3:"#7961DB",INDIGO4:"#9881F3",INDIGO5:"#BDADFF",LIME1:"#43501B",LIME2:"#5A701A",LIME3:"#8EB125",LIME4:"#B6D94C",LIME5:"#D4F17E",ROSE1:"#A82255",ROSE2:"#C22762",ROSE3:"#DB2C6F",ROSE4:"#F5498B",ROSE5:"#FF66A1",SEPIA1:"#5E4123",SEPIA2:"#7A542E",SEPIA3:"#946638",SEPIA4:"#AF855A",SEPIA5:"#D0B090",TURQUOISE1:"#004D46",TURQUOISE2:"#007067",TURQUOISE3:"#00A396",TURQUOISE4:"#13C9BA",TURQUOISE5:"#7AE1D8",VERMILION1:"#96290D",VERMILION2:"#B83211",VERMILION3:"#D33D17",VERMILION4:"#EB6847",VERMILION5:"#FF9980",VIOLET1:"#5C255C",VIOLET2:"#7C327C",VIOLET3:"#9D3F9D",VIOLET4:"#BD6BBD",VIOLET5:"#D69FD6"},Uh={COBALT1:Bh.CERULEAN1,COBALT2:Bh.CERULEAN2,COBALT3:Bh.CERULEAN3,COBALT4:Bh.CERULEAN4,COBALT5:Bh.CERULEAN5};Fh.Colors=Object.assign(Object.assign(Object.assign(Object.assign({},{BLACK:"#111418",DARK_GRAY1:"#1C2127",DARK_GRAY2:"#252A31",DARK_GRAY3:"#2F343C",DARK_GRAY4:"#383E47",DARK_GRAY5:"#404854",GRAY1:"#5F6B7C",GRAY2:"#738091",GRAY3:"#8F99A8",GRAY4:"#ABB3BF",GRAY5:"#C5CBD3",LIGHT_GRAY1:"#D3D8DE",LIGHT_GRAY2:"#DCE0E5",LIGHT_GRAY3:"#E5E8EB",LIGHT_GRAY4:"#EDEFF2",LIGHT_GRAY5:"#F6F7F9",WHITE:"#FFFFFF"}),{BLUE1:"#184A90",BLUE2:"#215DB0",BLUE3:"#2D72D2",BLUE4:"#4C90F0",BLUE5:"#8ABBFF",GREEN1:"#165A36",GREEN2:"#1C6E42",GREEN3:"#238551",GREEN4:"#32A467",GREEN5:"#72CA9B",ORANGE1:"#77450D",ORANGE2:"#935610",ORANGE3:"#C87619",ORANGE4:"#EC9A3C",ORANGE5:"#FBB360",RED1:"#8E292C",RED2:"#AC2F33",RED3:"#CD4246",RED4:"#E76A6E",RED5:"#FA999C"}),Bh),Uh),Object.defineProperty(Dh,"Colors",{enumerable:!0,get:function(){return Fh.Colors}});var Gh={};Object.defineProperty(Gh,"__esModule",{value:!0}),Gh.LegacyColors=void 0,Gh.LegacyColors={BLACK:"#10161A",BLUE1:"#0E5A8A",BLUE2:"#106BA3",BLUE3:"#137CBD",BLUE4:"#2B95D6",BLUE5:"#48AFF0",COBALT1:"#1F4B99",COBALT2:"#2458B3",COBALT3:"#2965CC",COBALT4:"#4580E6",COBALT5:"#669EFF",DARK_GRAY1:"#182026",DARK_GRAY2:"#202B33",DARK_GRAY3:"#293742",DARK_GRAY4:"#30404D",DARK_GRAY5:"#394B59",FOREST1:"#1D7324",FOREST2:"#238C2C",FOREST3:"#29A634",FOREST4:"#43BF4D",FOREST5:"#62D96B",GOLD1:"#A67908",GOLD2:"#BF8C0A",GOLD3:"#D99E0B",GOLD4:"#F2B824",GOLD5:"#FFC940",GRAY1:"#5C7080",GRAY2:"#738694",GRAY3:"#8A9BA8",GRAY4:"#A7B6C2",GRAY5:"#BFCCD6",GREEN1:"#0A6640",GREEN2:"#0D8050",GREEN3:"#0F9960",GREEN4:"#15B371",GREEN5:"#3DCC91",INDIGO1:"#5642A6",INDIGO2:"#634DBF",INDIGO3:"#7157D9",INDIGO4:"#9179F2",INDIGO5:"#AD99FF",LIGHT_GRAY1:"#CED9E0",LIGHT_GRAY2:"#D8E1E8",LIGHT_GRAY3:"#E1E8ED",LIGHT_GRAY4:"#EBF1F5",LIGHT_GRAY5:"#F5F8FA",LIME1:"#728C23",LIME2:"#87A629",LIME3:"#9BBF30",LIME4:"#B6D94C",LIME5:"#D1F26D",ORANGE1:"#A66321",ORANGE2:"#BF7326",ORANGE3:"#D9822B",ORANGE4:"#F29D49",ORANGE5:"#FFB366",RED1:"#A82A2A",RED2:"#C23030",RED3:"#DB3737",RED4:"#F55656",RED5:"#FF7373",ROSE1:"#A82255",ROSE2:"#C22762",ROSE3:"#DB2C6F",ROSE4:"#F5498B",ROSE5:"#FF66A1",SEPIA1:"#63411E",SEPIA2:"#7D5125",SEPIA3:"#96622D",SEPIA4:"#B07B46",SEPIA5:"#C99765",TURQUOISE1:"#008075",TURQUOISE2:"#00998C",TURQUOISE3:"#00B3A4",TURQUOISE4:"#14CCBD",TURQUOISE5:"#2EE6D6",VERMILION1:"#9E2B0E",VERMILION2:"#B83211",VERMILION3:"#D13913",VERMILION4:"#EB532D",VERMILION5:"#FF6E4A",VIOLET1:"#5C255C",VIOLET2:"#752F75",VIOLET3:"#8F398F",VIOLET4:"#A854A8",VIOLET5:"#C274C2",WHITE:"#FFFFFF"},Object.defineProperty(Dh,"LegacyColors",{enumerable:!0,get:function(){return Gh.LegacyColors}});var qh={};e(qh,"ACTIVE",(()=>gf)),e(qh,"ALIGN_LEFT",(()=>yf)),e(qh,"ALIGN_RIGHT",(()=>bf)),e(qh,"DARK",(()=>wf)),e(qh,"DISABLED",(()=>xf)),e(qh,"FILL",(()=>Ef)),e(qh,"FIXED",(()=>_f)),e(qh,"FIXED_TOP",(()=>zf)),e(qh,"INLINE",(()=>Sf)),e(qh,"INTERACTIVE",(()=>Cf)),e(qh,"LARGE",(()=>Of)),e(qh,"LOADING",(()=>Mf)),e(qh,"MINIMAL",(()=>Af)),e(qh,"OUTLINED",(()=>kf)),e(qh,"MULTILINE",(()=>Lf)),e(qh,"ROUND",(()=>Pf)),e(qh,"SELECTED",(()=>Tf)),e(qh,"SMALL",(()=>Hf)),e(qh,"VERTICAL",(()=>Nf)),e(qh,"POSITION_TOP",(()=>Rf)),e(qh,"positionClass",(()=>Dm)),e(qh,"POSITION_BOTTOM",(()=>jf)),e(qh,"POSITION_LEFT",(()=>Vf)),e(qh,"POSITION_RIGHT",(()=>If)),e(qh,"ELEVATION_0",(()=>Df)),e(qh,"elevationClass",(()=>jm)),e(qh,"ELEVATION_1",(()=>Ff)),e(qh,"ELEVATION_2",(()=>Bf)),e(qh,"ELEVATION_3",(()=>Uf)),e(qh,"ELEVATION_4",(()=>Gf)),e(qh,"INTENT_PRIMARY",(()=>qf)),e(qh,"intentClass",(()=>Im)),e(qh,"INTENT_SUCCESS",(()=>Wf)),e(qh,"INTENT_WARNING",(()=>Kf)),e(qh,"INTENT_DANGER",(()=>Yf)),e(qh,"FOCUS_DISABLED",(()=>$f)),e(qh,"FOCUS_STYLE_MANAGER_IGNORE",(()=>Xf)),e(qh,"UI_TEXT",(()=>Qf)),e(qh,"RUNNING_TEXT",(()=>Zf)),e(qh,"MONOSPACE_TEXT",(()=>Jf)),e(qh,"TEXT_LARGE",(()=>ed)),e(qh,"TEXT_SMALL",(()=>td)),e(qh,"TEXT_MUTED",(()=>nd)),e(qh,"TEXT_DISABLED",(()=>rd)),e(qh,"TEXT_OVERFLOW_ELLIPSIS",(()=>id)),e(qh,"BLOCKQUOTE",(()=>od)),e(qh,"CODE",(()=>ad)),e(qh,"CODE_BLOCK",(()=>ld)),e(qh,"HEADING",(()=>sd)),e(qh,"LIST",(()=>cd)),e(qh,"LIST_UNSTYLED",(()=>ud)),e(qh,"RTL",(()=>hd)),e(qh,"ALERT",(()=>fd)),e(qh,"ALERT_BODY",(()=>dd)),e(qh,"ALERT_CONTENTS",(()=>pd)),e(qh,"ALERT_FOOTER",(()=>vd)),e(qh,"BREADCRUMB",(()=>md)),e(qh,"BREADCRUMB_CURRENT",(()=>gd)),e(qh,"BREADCRUMBS",(()=>yd)),e(qh,"BREADCRUMBS_COLLAPSED",(()=>bd)),e(qh,"BUTTON",(()=>wd)),e(qh,"BUTTON_GROUP",(()=>xd)),e(qh,"BUTTON_SPINNER",(()=>Ed)),e(qh,"BUTTON_TEXT",(()=>_d)),e(qh,"CALLOUT",(()=>zd)),e(qh,"CALLOUT_ICON",(()=>Sd)),e(qh,"CARD",(()=>Cd)),e(qh,"COLLAPSE",(()=>Od)),e(qh,"COLLAPSE_BODY",(()=>Md)),e(qh,"COLLAPSIBLE_LIST",(()=>Ad)),e(qh,"CONTEXT_MENU",(()=>kd)),e(qh,"CONTEXT_MENU_POPOVER_TARGET",(()=>Ld)),e(qh,"CONTROL_GROUP",(()=>Pd)),e(qh,"DIALOG",(()=>Td)),e(qh,"DIALOG_CONTAINER",(()=>Hd)),e(qh,"DIALOG_BODY",(()=>Nd)),e(qh,"DIALOG_CLOSE_BUTTON",(()=>Rd)),e(qh,"DIALOG_FOOTER",(()=>jd)),e(qh,"DIALOG_FOOTER_ACTIONS",(()=>Vd)),e(qh,"DIALOG_HEADER",(()=>Id)),e(qh,"DIALOG_STEP",(()=>Dd)),e(qh,"DIALOG_STEP_CONTAINER",(()=>Fd)),e(qh,"DIALOG_STEP_TITLE",(()=>Bd)),e(qh,"DIALOG_STEP_ICON",(()=>Ud)),e(qh,"DIALOG_STEP_VIEWED",(()=>Gd)),e(qh,"DIVIDER",(()=>qd)),e(qh,"DRAWER",(()=>Wd)),e(qh,"DRAWER_BODY",(()=>Kd)),e(qh,"DRAWER_FOOTER",(()=>Yd)),e(qh,"DRAWER_HEADER",(()=>$d)),e(qh,"EDITABLE_TEXT",(()=>Xd)),e(qh,"EDITABLE_TEXT_CONTENT",(()=>Qd)),e(qh,"EDITABLE_TEXT_EDITING",(()=>Zd)),e(qh,"EDITABLE_TEXT_INPUT",(()=>Jd)),e(qh,"EDITABLE_TEXT_PLACEHOLDER",(()=>ep)),e(qh,"FLEX_EXPANDER",(()=>tp)),e(qh,"HTML_SELECT",(()=>np)),e(qh,"SELECT",(()=>rp)),e(qh,"HTML_TABLE",(()=>ip)),e(qh,"HTML_TABLE_BORDERED",(()=>op)),e(qh,"HTML_TABLE_CONDENSED",(()=>ap)),e(qh,"HTML_TABLE_STRIPED",(()=>lp)),e(qh,"INPUT",(()=>sp)),e(qh,"INPUT_GHOST",(()=>cp)),e(qh,"INPUT_GROUP",(()=>up)),e(qh,"INPUT_LEFT_CONTAINER",(()=>hp)),e(qh,"INPUT_ACTION",(()=>fp)),e(qh,"CONTROL",(()=>dp)),e(qh,"CONTROL_INDICATOR",(()=>pp)),e(qh,"CONTROL_INDICATOR_CHILD",(()=>vp)),e(qh,"CHECKBOX",(()=>mp)),e(qh,"RADIO",(()=>gp)),e(qh,"SWITCH",(()=>yp)),e(qh,"SWITCH_INNER_TEXT",(()=>bp)),e(qh,"FILE_INPUT",(()=>wp)),e(qh,"FILE_INPUT_HAS_SELECTION",(()=>xp)),e(qh,"FILE_UPLOAD_INPUT",(()=>Ep)),e(qh,"FILE_UPLOAD_INPUT_CUSTOM_TEXT",(()=>_p)),e(qh,"KEY",(()=>zp)),e(qh,"KEY_COMBO",(()=>Sp)),e(qh,"MODIFIER_KEY",(()=>Cp)),e(qh,"HOTKEY",(()=>Op)),e(qh,"HOTKEY_LABEL",(()=>Mp)),e(qh,"HOTKEY_COLUMN",(()=>Ap)),e(qh,"HOTKEY_DIALOG",(()=>kp)),e(qh,"LABEL",(()=>Lp)),e(qh,"FORM_GROUP",(()=>Pp)),e(qh,"FORM_CONTENT",(()=>Tp)),e(qh,"FORM_HELPER_TEXT",(()=>Hp)),e(qh,"FORM_GROUP_SUB_LABEL",(()=>Np)),e(qh,"MENU",(()=>Rp)),e(qh,"MENU_ITEM",(()=>jp)),e(qh,"MENU_ITEM_ICON",(()=>Vp)),e(qh,"MENU_ITEM_LABEL",(()=>Ip)),e(qh,"MENU_SUBMENU",(()=>Dp)),e(qh,"MENU_SUBMENU_ICON",(()=>Fp)),e(qh,"MENU_DIVIDER",(()=>Bp)),e(qh,"MENU_HEADER",(()=>Up)),e(qh,"MULTISTEP_DIALOG",(()=>Gp)),e(qh,"MULTISTEP_DIALOG_PANELS",(()=>qp)),e(qh,"MULTISTEP_DIALOG_LEFT_PANEL",(()=>Wp)),e(qh,"MULTISTEP_DIALOG_RIGHT_PANEL",(()=>Kp)),e(qh,"MULTISTEP_DIALOG_FOOTER",(()=>Yp)),e(qh,"MULTISTEP_DIALOG_NAV_TOP",(()=>$p)),e(qh,"MULTISTEP_DIALOG_NAV_RIGHT",(()=>Xp)),e(qh,"NAVBAR",(()=>Qp)),e(qh,"NAVBAR_GROUP",(()=>Zp)),e(qh,"NAVBAR_HEADING",(()=>Jp)),e(qh,"NAVBAR_DIVIDER",(()=>ev)),e(qh,"NON_IDEAL_STATE",(()=>tv)),e(qh,"NON_IDEAL_STATE_VISUAL",(()=>nv)),e(qh,"NON_IDEAL_STATE_TEXT",(()=>rv)),e(qh,"NUMERIC_INPUT",(()=>iv)),e(qh,"OVERFLOW_LIST",(()=>ov)),e(qh,"OVERFLOW_LIST_SPACER",(()=>av)),e(qh,"OVERLAY",(()=>lv)),e(qh,"OVERLAY_BACKDROP",(()=>sv)),e(qh,"OVERLAY_CONTAINER",(()=>cv)),e(qh,"OVERLAY_CONTENT",(()=>uv)),e(qh,"OVERLAY_INLINE",(()=>hv)),e(qh,"OVERLAY_OPEN",(()=>fv)),e(qh,"OVERLAY_SCROLL_CONTAINER",(()=>dv)),e(qh,"OVERLAY_START_FOCUS_TRAP",(()=>pv)),e(qh,"OVERLAY_END_FOCUS_TRAP",(()=>vv)),e(qh,"PANEL_STACK",(()=>mv)),e(qh,"PANEL_STACK_HEADER",(()=>gv)),e(qh,"PANEL_STACK_HEADER_BACK",(()=>yv)),e(qh,"PANEL_STACK_VIEW",(()=>bv)),e(qh,"PANEL_STACK2",(()=>wv)),e(qh,"PANEL_STACK2_HEADER",(()=>xv)),e(qh,"PANEL_STACK2_HEADER_BACK",(()=>Ev)),e(qh,"PANEL_STACK2_VIEW",(()=>_v)),e(qh,"POPOVER",(()=>zv)),e(qh,"POPOVER_ARROW",(()=>Sv)),e(qh,"POPOVER_BACKDROP",(()=>Cv)),e(qh,"POPOVER_CAPTURING_DISMISS",(()=>Ov)),e(qh,"POPOVER_CONTENT",(()=>Mv)),e(qh,"POPOVER_CONTENT_SIZING",(()=>Av)),e(qh,"POPOVER_DISMISS",(()=>kv)),e(qh,"POPOVER_DISMISS_OVERRIDE",(()=>Lv)),e(qh,"POPOVER_OPEN",(()=>Pv)),e(qh,"POPOVER_OUT_OF_BOUNDARIES",(()=>Tv)),e(qh,"POPOVER_TARGET",(()=>Hv)),e(qh,"POPOVER_WRAPPER",(()=>Nv)),e(qh,"TRANSITION_CONTAINER",(()=>Rv)),e(qh,"PROGRESS_BAR",(()=>jv)),e(qh,"PROGRESS_METER",(()=>Vv)),e(qh,"PROGRESS_NO_STRIPES",(()=>Iv)),e(qh,"PROGRESS_NO_ANIMATION",(()=>Dv)),e(qh,"PORTAL",(()=>Fv)),e(qh,"SKELETON",(()=>Bv)),e(qh,"SLIDER",(()=>Uv)),e(qh,"SLIDER_AXIS",(()=>Gv)),e(qh,"SLIDER_HANDLE",(()=>qv)),e(qh,"SLIDER_LABEL",(()=>Wv)),e(qh,"SLIDER_TRACK",(()=>Kv)),e(qh,"SLIDER_PROGRESS",(()=>Yv)),e(qh,"START",(()=>$v)),e(qh,"END",(()=>Xv)),e(qh,"SPINNER",(()=>Qv)),e(qh,"SPINNER_ANIMATION",(()=>Zv)),e(qh,"SPINNER_HEAD",(()=>Jv)),e(qh,"SPINNER_NO_SPIN",(()=>em)),e(qh,"SPINNER_TRACK",(()=>tm)),e(qh,"TAB",(()=>nm)),e(qh,"TAB_INDICATOR",(()=>rm)),e(qh,"TAB_INDICATOR_WRAPPER",(()=>im)),e(qh,"TAB_LIST",(()=>om)),e(qh,"TAB_PANEL",(()=>am)),e(qh,"TABS",(()=>lm)),e(qh,"TAG",(()=>sm)),e(qh,"TAG_REMOVE",(()=>cm)),e(qh,"TAG_INPUT",(()=>um)),e(qh,"TAG_INPUT_ICON",(()=>hm)),e(qh,"TAG_INPUT_VALUES",(()=>fm)),e(qh,"TOAST",(()=>dm)),e(qh,"TOAST_CONTAINER",(()=>pm)),e(qh,"TOAST_MESSAGE",(()=>vm)),e(qh,"TOOLTIP",(()=>mm)),e(qh,"TOOLTIP_INDICATOR",(()=>gm)),e(qh,"TREE",(()=>ym)),e(qh,"TREE_NODE",(()=>bm)),e(qh,"TREE_NODE_CARET",(()=>wm)),e(qh,"TREE_NODE_CARET_CLOSED",(()=>xm)),e(qh,"TREE_NODE_CARET_NONE",(()=>Em)),e(qh,"TREE_NODE_CARET_OPEN",(()=>_m)),e(qh,"TREE_NODE_CONTENT",(()=>zm)),e(qh,"TREE_NODE_EXPANDED",(()=>Sm)),e(qh,"TREE_NODE_ICON",(()=>Cm)),e(qh,"TREE_NODE_LABEL",(()=>Om)),e(qh,"TREE_NODE_LIST",(()=>Mm)),e(qh,"TREE_NODE_SECONDARY_LABEL",(()=>Am)),e(qh,"TREE_NODE_SELECTED",(()=>km)),e(qh,"TREE_ROOT",(()=>Lm)),e(qh,"ICON",(()=>Pm)),e(qh,"ICON_STANDARD",(()=>Tm)),e(qh,"ICON_LARGE",(()=>Hm)),e(qh,"getClassNamespace",(()=>Nm)),e(qh,"alignmentClass",(()=>Rm)),e(qh,"iconClass",(()=>Vm));var Wh={CENTER:"center",LEFT:"left",RIGHT:"right"},Kh={ZERO:0,ONE:1,TWO:2,THREE:3,FOUR:4},Yh={NONE:"none",PRIMARY:"primary",SUCCESS:"success",WARNING:"warning",DANGER:"danger"},$h={BOTTOM:"bottom",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",LEFT:"left",LEFT_BOTTOM:"left-bottom",LEFT_TOP:"left-top",RIGHT:"right",RIGHT_BOTTOM:"right-bottom",RIGHT_TOP:"right-top",TOP:"top",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var Xh,Qh,Zh,Jh=Xh={};function ef(){throw new Error("setTimeout has not been defined")}function tf(){throw new Error("clearTimeout has not been defined")}function nf(e){if(Qh===setTimeout)return setTimeout(e,0);if((Qh===ef||!Qh)&&setTimeout)return Qh=setTimeout,setTimeout(e,0);try{return Qh(e,0)}catch(t){try{return Qh.call(null,e,0)}catch(t){return Qh.call(this,e,0)}}}!function(){try{Qh="function"==typeof setTimeout?setTimeout:ef}catch(e){Qh=ef}try{Zh="function"==typeof clearTimeout?clearTimeout:tf}catch(e){Zh=tf}}();var rf,of,af,lf,sf,cf=[],uf=!1,hf=-1;function ff(){uf&&rf&&(uf=!1,rf.length?cf=rf.concat(cf):hf=-1,cf.length&&df())}function df(){if(!uf){var e=nf(ff);uf=!0;for(var t=cf.length;t;){for(rf=cf,cf=[];++hf<t;)rf&&rf[hf].run();hf=-1,t=cf.length}rf=null,uf=!1,function(e){if(Zh===clearTimeout)return clearTimeout(e);if((Zh===tf||!Zh)&&clearTimeout)return Zh=clearTimeout,clearTimeout(e);try{Zh(e)}catch(t){try{return Zh.call(null,e)}catch(t){return Zh.call(this,e)}}}(e)}}function pf(e,t){this.fun=e,this.array=t}function vf(){}Jh.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];cf.push(new pf(e,t)),1!==cf.length||uf||nf(df)},pf.prototype.run=function(){this.fun.apply(null,this.array)},Jh.title="browser",Jh.browser=!0,Jh.env={},Jh.argv=[],Jh.version="",Jh.versions={},Jh.on=vf,Jh.addListener=vf,Jh.once=vf,Jh.off=vf,Jh.removeListener=vf,Jh.removeAllListeners=vf,Jh.emit=vf,Jh.prependListener=vf,Jh.prependOnceListener=vf,Jh.listeners=function(e){return[]},Jh.binding=function(e){throw new Error("process.binding is not supported")},Jh.cwd=function(){return"/"},Jh.chdir=function(e){throw new Error("process.chdir is not supported")},Jh.umask=function(){return 0};var mf="bp4";void 0!==Xh&&(mf=null!==(sf=null!==(af=void 0===(of={})?void 0:of.BLUEPRINT_NAMESPACE)&&void 0!==af?af:void 0===(lf={})?void 0:lf.REACT_APP_BLUEPRINT_NAMESPACE)&&void 0!==sf?sf:mf);var gf="".concat(mf,"-active"),yf="".concat(mf,"-align-left"),bf="".concat(mf,"-align-right"),wf="".concat(mf,"-dark"),xf="".concat(mf,"-disabled"),Ef="".concat(mf,"-fill"),_f="".concat(mf,"-fixed"),zf="".concat(mf,"-fixed-top"),Sf="".concat(mf,"-inline"),Cf="".concat(mf,"-interactive"),Of="".concat(mf,"-large"),Mf="".concat(mf,"-loading"),Af="".concat(mf,"-minimal"),kf="".concat(mf,"-outlined"),Lf="".concat(mf,"-multiline"),Pf="".concat(mf,"-round"),Tf="".concat(mf,"-selected"),Hf="".concat(mf,"-small"),Nf="".concat(mf,"-vertical"),Rf=Dm($h.TOP),jf=Dm($h.BOTTOM),Vf=Dm($h.LEFT),If=Dm($h.RIGHT),Df=jm(Kh.ZERO),Ff=jm(Kh.ONE),Bf=jm(Kh.TWO),Uf=jm(Kh.THREE),Gf=jm(Kh.FOUR),qf=Im(Yh.PRIMARY),Wf=Im(Yh.SUCCESS),Kf=Im(Yh.WARNING),Yf=Im(Yh.DANGER),$f="".concat(mf,"-focus-disabled"),Xf="".concat(mf,"-focus-style-manager-ignore"),Qf="".concat(mf,"-ui-text"),Zf="".concat(mf,"-running-text"),Jf="".concat(mf,"-monospace-text"),ed="".concat(mf,"-text-large"),td="".concat(mf,"-text-small"),nd="".concat(mf,"-text-muted"),rd="".concat(mf,"-text-disabled"),id="".concat(mf,"-text-overflow-ellipsis"),od="".concat(mf,"-blockquote"),ad="".concat(mf,"-code"),ld="".concat(mf,"-code-block"),sd="".concat(mf,"-heading"),cd="".concat(mf,"-list"),ud="".concat(mf,"-list-unstyled"),hd="".concat(mf,"-rtl"),fd="".concat(mf,"-alert"),dd="".concat(fd,"-body"),pd="".concat(fd,"-contents"),vd="".concat(fd,"-footer"),md="".concat(mf,"-breadcrumb"),gd="".concat(md,"-current"),yd="".concat(md,"s"),bd="".concat(md,"s-collapsed"),wd="".concat(mf,"-button"),xd="".concat(wd,"-group"),Ed="".concat(wd,"-spinner"),_d="".concat(wd,"-text"),zd="".concat(mf,"-callout"),Sd="".concat(zd,"-icon"),Cd="".concat(mf,"-card"),Od="".concat(mf,"-collapse"),Md="".concat(Od,"-body"),Ad="".concat(mf,"-collapse-list"),kd="".concat(mf,"-context-menu"),Ld="".concat(kd,"-popover-target"),Pd="".concat(mf,"-control-group"),Td="".concat(mf,"-dialog"),Hd="".concat(Td,"-container"),Nd="".concat(Td,"-body"),Rd="".concat(Td,"-close-button"),jd="".concat(Td,"-footer"),Vd="".concat(Td,"-footer-actions"),Id="".concat(Td,"-header"),Dd="".concat(mf,"-dialog-step"),Fd="".concat(Dd,"-container"),Bd="".concat(Dd,"-title"),Ud="".concat(Dd,"-icon"),Gd="".concat(Dd,"-viewed"),qd="".concat(mf,"-divider"),Wd="".concat(mf,"-drawer"),Kd="".concat(Wd,"-body"),Yd="".concat(Wd,"-footer"),$d="".concat(Wd,"-header"),Xd="".concat(mf,"-editable-text"),Qd="".concat(Xd,"-content"),Zd="".concat(Xd,"-editing"),Jd="".concat(Xd,"-input"),ep="".concat(Xd,"-placeholder"),tp="".concat(mf,"-flex-expander"),np="".concat(mf,"-html-select"),rp="".concat(mf,"-select"),ip="".concat(mf,"-html-table"),op="".concat(ip,"-bordered"),ap="".concat(ip,"-condensed"),lp="".concat(ip,"-striped"),sp="".concat(mf,"-input"),cp="".concat(sp,"-ghost"),up="".concat(sp,"-group"),hp="".concat(sp,"-left-container"),fp="".concat(sp,"-action"),dp="".concat(mf,"-control"),pp="".concat(dp,"-indicator"),vp="".concat(pp,"-child"),mp="".concat(mf,"-checkbox"),gp="".concat(mf,"-radio"),yp="".concat(mf,"-switch"),bp="".concat(yp,"-inner-text"),wp="".concat(mf,"-file-input"),xp="".concat(mf,"-file-input-has-selection"),Ep="".concat(mf,"-file-upload-input"),_p="".concat(mf,"-file-upload-input-custom-text"),zp="".concat(mf,"-key"),Sp="".concat(zp,"-combo"),Cp="".concat(mf,"-modifier-key"),Op="".concat(mf,"-hotkey"),Mp="".concat(Op,"-label"),Ap="".concat(Op,"-column"),kp="".concat(Op,"-dialog"),Lp="".concat(mf,"-label"),Pp="".concat(mf,"-form-group"),Tp="".concat(mf,"-form-content"),Hp="".concat(mf,"-form-helper-text"),Np="".concat(mf,"-form-group-sub-label"),Rp="".concat(mf,"-menu"),jp="".concat(Rp,"-item"),Vp="".concat(jp,"-icon"),Ip="".concat(jp,"-label"),Dp="".concat(mf,"-submenu"),Fp="".concat(Dp,"-icon"),Bp="".concat(Rp,"-divider"),Up="".concat(Rp,"-header"),Gp="".concat(mf,"-multistep-dialog"),qp="".concat(Gp,"-panels"),Wp="".concat(Gp,"-left-panel"),Kp="".concat(Gp,"-right-panel"),Yp="".concat(Gp,"-footer"),$p="".concat(Gp,"-nav-top"),Xp="".concat(Gp,"-nav-right"),Qp="".concat(mf,"-navbar"),Zp="".concat(Qp,"-group"),Jp="".concat(Qp,"-heading"),ev="".concat(Qp,"-divider"),tv="".concat(mf,"-non-ideal-state"),nv="".concat(tv,"-visual"),rv="".concat(tv,"-text"),iv="".concat(mf,"-numeric-input"),ov="".concat(mf,"-overflow-list"),av="".concat(ov,"-spacer"),lv="".concat(mf,"-overlay"),sv="".concat(lv,"-backdrop"),cv="".concat(lv,"-container"),uv="".concat(lv,"-content"),hv="".concat(lv,"-inline"),fv="".concat(lv,"-open"),dv="".concat(lv,"-scroll-container"),pv="".concat(lv,"-start-focus-trap"),vv="".concat(lv,"-end-focus-trap"),mv="".concat(mf,"-panel-stack"),gv="".concat(mv,"-header"),yv="".concat(mv,"-header-back"),bv="".concat(mv,"-view"),wv="".concat(mf,"-panel-stack2"),xv="".concat(mv,"-header"),Ev="".concat(mv,"-header-back"),_v="".concat(mv,"-view"),zv="".concat(mf,"-popover"),Sv="".concat(zv,"-arrow"),Cv="".concat(zv,"-backdrop"),Ov="".concat(zv,"-capturing-dismiss"),Mv="".concat(zv,"-content"),Av="".concat(Mv,"-sizing"),kv="".concat(zv,"-dismiss"),Lv="".concat(kv,"-override"),Pv="".concat(zv,"-open"),Tv="".concat(zv,"-out-of-boundaries"),Hv="".concat(zv,"-target"),Nv="".concat(zv,"-wrapper"),Rv="".concat(mf,"-transition-container"),jv="".concat(mf,"-progress-bar"),Vv="".concat(mf,"-progress-meter"),Iv="".concat(mf,"-no-stripes"),Dv="".concat(mf,"-no-animation"),Fv="".concat(mf,"-portal"),Bv="".concat(mf,"-skeleton"),Uv="".concat(mf,"-slider"),Gv="".concat(Uv,"-axis"),qv="".concat(Uv,"-handle"),Wv="".concat(Uv,"-label"),Kv="".concat(Uv,"-track"),Yv="".concat(Uv,"-progress"),$v="".concat(mf,"-start"),Xv="".concat(mf,"-end"),Qv="".concat(mf,"-spinner"),Zv="".concat(Qv,"-animation"),Jv="".concat(Qv,"-head"),em="".concat(mf,"-no-spin"),tm="".concat(Qv,"-track"),nm="".concat(mf,"-tab"),rm="".concat(nm,"-indicator"),im="".concat(rm,"-wrapper"),om="".concat(nm,"-list"),am="".concat(nm,"-panel"),lm="".concat(nm,"s"),sm="".concat(mf,"-tag"),cm="".concat(sm,"-remove"),um="".concat(mf,"-tag-input"),hm="".concat(um,"-icon"),fm="".concat(um,"-values"),dm="".concat(mf,"-toast"),pm="".concat(dm,"-container"),vm="".concat(dm,"-message"),mm="".concat(mf,"-tooltip"),gm="".concat(mm,"-indicator"),ym="".concat(mf,"-tree"),bm="".concat(mf,"-tree-node"),wm="".concat(bm,"-caret"),xm="".concat(wm,"-closed"),Em="".concat(wm,"-none"),_m="".concat(wm,"-open"),zm="".concat(bm,"-content"),Sm="".concat(bm,"-expanded"),Cm="".concat(bm,"-icon"),Om="".concat(bm,"-label"),Mm="".concat(bm,"-list"),Am="".concat(bm,"-secondary-label"),km="".concat(bm,"-selected"),Lm="".concat(mf,"-tree-root"),Pm="".concat(mf,"-icon"),Tm="".concat(Pm,"-standard"),Hm="".concat(Pm,"-large");function Nm(){return mf}function Rm(e){switch(e){case Wh.LEFT:return yf;case Wh.RIGHT:return bf;default:return}}function jm(e){if(void 0!==e)return"".concat(mf,"-elevation-").concat(e)}function Vm(e){if(null!=e)return 0===e.indexOf("".concat(mf,"-icon-"))?e:"".concat(mf,"-icon-").concat(e)}function Im(e){if(null!=e&&e!==Yh.NONE)return"".concat(mf,"-intent-").concat(e.toLowerCase())}function Dm(e){if(void 0!==e)return"".concat(mf,"-position-").concat(e)}var Fm={};e(Fm,"BACKSPACE",(()=>Bm)),e(Fm,"TAB",(()=>Um)),e(Fm,"ENTER",(()=>Gm)),e(Fm,"SHIFT",(()=>qm)),e(Fm,"ESCAPE",(()=>Wm)),e(Fm,"SPACE",(()=>Km)),e(Fm,"ARROW_LEFT",(()=>Ym)),e(Fm,"ARROW_UP",(()=>$m)),e(Fm,"ARROW_RIGHT",(()=>Xm)),e(Fm,"ARROW_DOWN",(()=>Qm)),e(Fm,"DELETE",(()=>Zm)),e(Fm,"isKeyboardClick",(()=>Jm));var Bm=8,Um=9,Gm=13,qm=16,Wm=27,Km=32,Ym=37,$m=38,Xm=39,Qm=40,Zm=46;function Jm(e){return e===Gm||e===Km}var eg={};e(eg,"isDarkTheme",(()=>Tg)),e(eg,"setRef",(()=>Hg)),e(eg,"getRef",(()=>Rg));var tg={};function ng(e,t,n){return void 0===n&&(n=function(e,t){return e===t}),null==e&&null==t||null!=e&&null!=t&&e.length===t.length&&e.every((function(e,r){return n(e,t[r])}))}function rg(e,t,n){if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(Array.isArray(e)||Array.isArray(t))return!1;if(null!=n)return ag(e,t,n);var r=Object.keys(e),i=Object.keys(t);return ag(e,t,{include:r})&&ag(e,t,{include:i})}function ig(e,t,n){if(e===t)return!0;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(Array.isArray(e)||Array.isArray(t))return ng(e,t,ig);if(sg(e)||sg(t))return e===t;if(null!=n)return lg(e,t,n);if(e.constructor!==t.constructor)return!1;var r=Object.keys(e),i=Object.keys(t);return null!=r&&null!=i&&(0===r.length&&0===i.length||ng(r,i)&&lg(e,t,r))}function og(e,t,n){void 0===e&&(e={}),void 0===t&&(t={});var r=null==n?function(e,t){var n=Object.keys(e),r=Object.keys(t),i=cg(n.concat(r));return Object.keys(i)}(e,t):n;return function(e,t,n,r){return n.filter((function(n){return!r(e,t,n)})).map((function(n){return{key:n,valueA:e[n],valueB:t[n]}}))}(e,t,r,(function(e,t,n){return ig(e,t,[n])}))}function ag(e,t,n){return function(e,t,n){if(function(e){return null!=e&&null!=e.include}(n))return n.include;if(function(e){return null!=e&&null!=e.exclude}(n)){var r=Object.keys(e),i=Object.keys(t),o=cg(r.concat(i));return n.exclude.forEach((function(e){return delete o[e]})),Object.keys(o)}return[]}(e,t,n).every((function(n){return e.hasOwnProperty(n)===t.hasOwnProperty(n)&&e[n]===t[n]}))}function lg(e,t,n){return n.every((function(n){return e.hasOwnProperty(n)===t.hasOwnProperty(n)&&ig(e[n],t[n])}))}function sg(e){return"number"==typeof e||"string"==typeof e||"boolean"==typeof e}function cg(e){return e.reduce((function(e,t){return e[t]=!0,e}),{})}e(tg,"arraysEqual",(()=>ng)),e(tg,"shallowCompareKeys",(()=>rg)),e(tg,"deepCompareKeys",(()=>ig)),e(tg,"getDeepUnequalKeyValues",(()=>og));var ug={};function hg(e,t){return e===t||e.contains(t)}function fg(e,t){var n;return null==e?document.activeElement:(null!==(n=e.getRootNode(t))&&void 0!==n?n:document).activeElement}function dg(e,t,n){var r=mg((function(t){e.dispatchEvent(new CustomEvent(n,t))}));return e.addEventListener(t,r),r}function pg(e,t){return void 0===t&&(t={}),mg(e,(function(e){t.preventDefault&&e.preventDefault()}),(function(e){return e.persist()}))}function vg(e){return mg(e)}function mg(e,t,n){var r=!1;return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null==t||t.apply(void 0,i),r||(r=!0,null==n||n.apply(void 0,i),requestAnimationFrame((function(){e.apply(void 0,i),r=!1})))}}e(ug,"elementIsOrContains",(()=>hg)),e(ug,"getActiveElement",(()=>fg)),e(ug,"throttleEvent",(()=>dg)),e(ug,"throttleReactEventCallback",(()=>pg)),e(ug,"throttle",(()=>vg));var gg={};function yg(e){return"function"==typeof e}e(gg,"isFunction",(()=>yg));var bg={};e(bg,"isNodeEnv",(()=>wg)),e(bg,"arrayLengthCompare",(()=>xg)),e(bg,"approxEqual",(()=>Eg)),e(bg,"clamp",(()=>_g)),e(bg,"countDecimalPlaces",(()=>zg)),e(bg,"uniqueId",(()=>Cg));function wg(e){return void 0!==Xh&&Xh.env&&"production"===e}function xg(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),e.length-t.length}function Eg(e,t,n){return void 0===n&&(n=1e-5),Math.abs(e-t)<=n}function _g(e,t,n){if(null==e)return e;if(n<t)throw new Error("[Blueprint] clamp: max cannot be less than min");return Math.min(Math.max(e,t),n)}function zg(e){if(!isFinite(e))return 0;for(var t=1,n=0;Math.round(e*t)/t!==e;)t*=10,n++;return n}var Sg=new Map;function Cg(e){var t,n=null!==(t=Sg.get(e))&&void 0!==t?t:0;return Sg.set(e,n+1),"".concat(e,"-").concat(n)}var Og={};e(Og,"isReactNodeEmpty",(()=>Mg)),e(Og,"isReactChildrenElementOrElements",(()=>Ag)),e(Og,"ensureElement",(()=>kg)),e(Og,"getDisplayName",(()=>Lg)),e(Og,"isElementOfType",(()=>Pg));d=l("8NFma");function Mg(e,t){return void 0===t&&(t=!1),null==e||""===e||!1===e||!t&&Array.isArray(e)&&(0===e.length||e.every((function(e){return Mg(e,!0)})))}function Ag(e){return!Mg(e,!0)&&!0!==e}function kg(e,t){return void 0===t&&(t="span"),null==e||"boolean"==typeof e?void 0:"string"==typeof e?e.trim().length>0?d.createElement(t,{},e):void 0:"number"==typeof e||"symbol"==typeof e.type||Array.isArray(e)?d.createElement(t,{},e):function(e){return"object"==typeof e&&void 0!==e.type&&void 0!==e.props}(e)?e:void 0}function Lg(e){return e.displayName||e.name||"Unknown"}function Pg(e,t){return null!=e&&null!=e.type&&null!=e.type.displayName&&e.type.displayName===t.displayName}function Tg(e){return null!=e&&e instanceof Element&&null!=e.closest(".".concat(wf))}function Hg(e,t){var n;null!=(n=e)&&"function"!=typeof n?e.current=t:function(e){return"function"==typeof e}(e)&&e(t)}function Ng(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){e.forEach((function(e){Hg(e,t)}))}}function Rg(e){var t;return null===e?null:null!==(t=e.current)&&void 0!==t?t:e}function jg(e,t,n){return function(r){e[t]=r,Hg(n,r)}}"undefined"!=typeof window&&"undefined"!=typeof document&&l("2j10E"),r(eg,tg),r(eg,ug),r(eg,gg),r(eg,bg),r(eg,Og);
|
|
62
|
+
`,Ah=({html:e,onBlur:t,onChange:r,element:i})=>{const o=n(d).useRef(null);n(d).useEffect((()=>{if(!o.current)return;const e=new(n(Qc))(o.current,{toolbar:!1,keyboard:!1,clipboard:{matchVisual:!1}});return Oh.editor.instance=e,window.__polotnoQuill=e,e.on("text-change",(()=>{e.getSelection()&&(Oh.currentFormat=e.getFormat()),setTimeout((()=>{r(o.current?.childNodes[0].innerHTML)}),10)})),e.setSelection(0,0,"api"),e.on("selection-change",(n=>{n||t(),n&&(Oh.currentFormat=e.getFormat())})),o.current.childNodes[0].addEventListener("blur",(e=>{e.relatedTarget?.classList.contains("ql-clipboard")||t()})),()=>{Oh.editor.instance=null,Oh.currentFormat={},delete window.__polotnoQuill}}),[]),n(d).useEffect((()=>{const t=Oh.editor.instance,n=t.getSelection();if(!(o.current?.childNodes[0].innerHTML===i.text)){var r=t.clipboard.convert("<div class='ql-editor' style='outline: none;'>"+e+"<p><br></p></div>");t.setContents(r),t.history.clear(),n&&(t.setSelection(n.index,n.length),Oh.currentFormat=t.getFormat())}}),[i.text]);const a=Cc(i).fill;return(0,s.jsx)(Mh,{ref:o,style:{fontSize:i.fontSize,color:a,width:i.width,fontFamily:i.fontFamily,lineHeight:i.lineHeight,letterSpacing:i.letterSpacing+"rem",textAlign:i.align},dir:_c(uc(i.text))})};function kh(e,{fontFamily:t="",color:n="black"}={}){let r=`color: ${n||e.fill}`;return`<div style="white-space: pre-wrap; width: ${e.width||100}px; ${r}; font-size: ${e.fontSize}px; font-family: '${t}'; text-decoration: ${e.textDecoration}; text-align: ${e.align}; line-height: ${e.lineHeight}; letter-spacing: ${e.letterSpacing}rem; font-style: ${e.fontStyle}; font-weight: ${e.fontWeight}; -webkit-text-stroke: ${e.strokeWidth}px ${e.stroke};" contentEditable dir="${_c(uc(e.text))}">${e.text}</div>`}const Lh=ei((({element:e,store:t})=>{const r=n(d).useRef(null),[i,o]=n(d).useState(),[a,l]=n(d).useState(!1),[c,u]=n(d).useState(!0),[h,f]=n(d).useState(!1),[p,v]=n(d).useState(!1),m=n(d).useRef(e.height),g=t.selectedElements.indexOf(e)>=0,y=e.fontSize/4,{textVerticalResizeEnabled:b}=cc,[w]=Sc(t,e.fontFamily);Us(r);const x=w?e.fontFamily:"Arial",E=Cc(e).fill,_=kh(e,{fontFamily:x,color:E}),{width:z,height:S}=function(e,t,r){return n(d).useMemo((()=>lh(e)),[e,t.width,r])}(_,e,w);n(d).useEffect((()=>{if(!w)return;if(!e.height)return void e.set({height:S});const{textOverflow:n}=cc;if("change-font-size"!==n||a)"resize"===n&&(b&&e.height<S&&t.history.ignore((()=>{e.set({height:S})})),b||e.height===S||t.history.ignore((()=>{e.set({height:S})})));else{const n=(e=>{let t=e.fontSize;for(let n=1;n<50;n++){const n=kh({...e.toJSON(),fontSize:t},{fontFamily:e.fontFamily}),{height:r}=lh(n);if(!(e.height&&r>e.height))break;t-=.5}return t})(e);n!==e.fontSize?t.history.ignore((()=>{e.set({fontSize:n})})):e.height!==S&&t.history.ignore((()=>{e.set({height:S})}))}}));const C=n(d).useRef(0);n(d).useLayoutEffect((()=>{if(a||h)return;C.current++;const n=C.current,r=Ws(`text ${e.id}`);u(!0),async function(){await new Promise((e=>setTimeout(e)));const i=await sh({html:_,width:e.width||1,height:e.height||S||1,fontFamily:x,padding:y,font:t.fonts.find((e=>e.fontFamily===x))||tc.find((e=>e.fontFamily===x))});n===C.current?(o(i),u(!1),pl.Util.requestAnimFrame(r)):r()}()}),[_,a,S,h,x]);const O=a||c;n(d).useLayoutEffect((()=>Kt((()=>{bc(r.current,e)}))),[i,O,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]);let M=0;return"middle"===e.verticalAlign&&(M=(e.height-S)/2),"bottom"===e.verticalAlign&&(M=e.height-S),(0,s.jsxs)(n(d).Fragment,{children:[(0,s.jsx)(ks,{ref:r,name:"element",x:e.x,y:e.y,listening:e.selectable,rotation:e.rotation,width:e.width,height:e.height,visible:!O,draggable:e.draggable,opacity:h?0:e.opacity,hideInExport:!e.showInExport,onMouseEnter:()=>{v(!0)},onMouseLeave:()=>{v(!1)},onDragStart:()=>{t.history.startTransaction()},onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:n=>{e.set({x:n.target.x(),y:n.target.y()}),t.history.endTransaction()},id:e.id,onDblClick:()=>{e.contentEditable&&f(!0)},onDblTap:()=>{e.contentEditable&&f(!0)},onTransformStart:t=>{l(!0),m.current=e.height},onTransform:t=>{const n=t.target,r=n.getStage()?.findOne("Transformer"),i=r.getActiveAnchor(),o="middle-left"===i||"middle-right"===i,a="top-center"===i||"bottom-center"===i,l=n.scaleX();if(o){const t=n.scaleX(),r=Math.max(n.width()*t,e.fontSize);if(n.width(r),n.scaleX(1),cc.textVerticalResizeEnabled){const t=Math.max(S,m.current);e.set({height:t})}e.set({width:r,x:n.x()})}else if(a){let r="resize"===cc.textOverflow?S:e.lineHeight*e.fontSize;const i=Math.max(r,t.target.height()*t.target.scaleY());n.scaleY(1),e.set({x:n.x(),y:n.y(),height:i,rotation:n.rotation()})}else n.scaleX(1),n.scaleY(1),e.set({fontSize:e.fontSize*l,width:n.width()*l,x:n.x(),y:n.y(),rotation:n.rotation()})},onTransformEnd:t=>{l(!1),u(!0);const n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set({fontSize:e.fontSize*n,width:t.target.width()*n,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation()})}}),(0,s.jsx)(Ps,{ref:r,image:i,x:e.x,y:e.y,offsetX:y,offsetY:y-M,listening:!1,rotation:e.rotation,width:e.width+2*y,height:e.height+2*y,visible:!O,opacity:h?0:e.opacity,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,hideInExport:!e.showInExport}),O&&(0,s.jsx)(As,{x:e.x,y:e.y,rotation:e.rotation,offsetY:-M,children:(0,s.jsx)(Vs.Html,{divProps:{style:{pointerEvents:"none"}},children:(0,s.jsx)(Mh,{dangerouslySetInnerHTML:{__html:_},style:{pointerEvents:"none",display:"inline-block"}})})}),h&&(0,s.jsx)(As,{x:e.x,y:e.y,rotation:e.rotation,offsetY:-M,children:(0,s.jsx)(Vs.Html,{children:(0,s.jsx)(Ah,{html:_,element:e,onChange:t=>{e.set({text:t})},onBlur:e=>{f(!1)}})})}),(g||p)&&(0,s.jsx)(wc,{element:e})]})})),Ph={text:Oc,image:Kc,svg:Kc};var Th=ei((e=>{let t=Ph[e.element.type];return"text"===e.element.type&&cc.htmlRenderEnabled&&(t=Lh),e.element.visible?t?(0,s.jsx)(t,{...e}):(console.error("Can not find component for "+e.element.type),null):null}));d=l("8NFma");function Hh(e,t,n,r,i){const o=Math.sqrt(n*n+r*r);i+=Math.atan2(r,n);return{x:e+o*Math.cos(i),y:t+o*Math.sin(i)}}function Nh(e){const{x:t,y:n,width:r,height:i}=e,o=pl.Util.degToRad(e.rotation),a=Hh(t,n,0,0,o),l=Hh(t,n,r,0,o),s=Hh(t,n,r,i,o),c=Hh(t,n,0,i,o),u=Math.min(a.x,l.x,s.x,c.x),h=Math.min(a.y,l.y,s.y,c.y),f=Math.max(a.x,l.x,s.x,c.x),d=Math.max(a.y,l.y,s.y,c.y);return{x:u,y:h,width:f-u,height:d-h,minX:u,minY:h,maxX:f,maxY:d}}function Rh(e){const t=e.map((e=>Nh(e))),n=Math.min(...t.map((e=>e.minX))),r=Math.min(...t.map((e=>e.minY))),i=Math.max(...t.map((e=>e.maxX))),o=Math.max(...t.map((e=>e.maxY)));return{x:n,y:r,width:i-n,height:o-r,minX:n,minY:r,maxX:i,maxY:o}}function jh(e,t){var n=[],r=[];e.vertical.forEach((e=>{t.vertical.forEach((t=>{var r=Math.abs(e-t.guide);r<5&&n.push({lineGuide:e,diff:r,snap:t.snap,offset:t.offset})}))})),e.horizontal.forEach((e=>{t.horizontal.forEach((t=>{var n=Math.abs(e-t.guide);n<5&&r.push({lineGuide:e,diff:n,snap:t.snap,offset:t.offset})}))}));var i=[];const o=n.sort(((e,t)=>e.diff-t.diff)),a=r.sort(((e,t)=>e.diff-t.diff));var l=o[0],s=a[0];if(l){o.filter((e=>Math.abs(e.diff-l.diff)<.1)).forEach((e=>{i.push({orientation:"V",...e})}))}if(s){a.filter((e=>Math.abs(e.diff-s.diff)<.1)).forEach((e=>{i.push({orientation:"H",...e})}))}return i}function Vh(e){const t=e=>e.hasName("element")||e.hasName("page-background")||e.hasName("elements-area");function r(n){const r=e.current?.getStage();var i=[],o=[];return r.find(t).forEach((e=>{if(!(n.indexOf(e)>=0)){var t=e.getClientRect({skipShadow:!0,skipStroke:!0});i.push(t.x,t.x+t.width,t.x+t.width/2),o.push(t.y,t.y+t.height,t.y+t.height/2)}})),{vertical:i,horizontal:o}}function i(t){const n=e.current?.getLayer(),r=n?.children.find((e=>"line-guides"===e.name()));t.forEach((e=>{if("H"===e.orientation){var t=new pl.Line({points:[-6e3,e.lineGuide,6e3,e.lineGuide],stroke:"rgb(0, 161, 255)",strokeWidth:1,name:"guid-line",dash:[4,6]});r?.add(t),n.batchDraw()}else if("V"===e.orientation){t=new pl.Line({points:[e.lineGuide,-6e3,e.lineGuide,6e3],stroke:"rgb(0, 161, 255)",strokeWidth:1,name:"guid-line",dash:[4,6]});r?.add(t)}}))}const o=e=>{e.target.getLayer().children.find((e=>"line-guides"===e.name())).destroyChildren();var t=r(e.target.nodes()),n=function(e){const t=e.__getNodeRect(),n=Nh({...t,rotation:pl.Util.radToDeg(t.rotation)}),r=e.getAbsolutePosition();return{vertical:[{guide:n.x,offset:r.x-n.x,snap:"start"},{guide:n.x+n.width/2,offset:r.x-n.x-n.width/2,snap:"center"},{guide:n.x+n.width,offset:r.x-n.x-n.width,snap:"end"}],horizontal:[{guide:n.y,offset:r.y-n.y,snap:"start"},{guide:n.y+n.height/2,offset:r.y-n.y-n.height/2,snap:"center"},{guide:n.y+n.height,offset:r.y-n.y-n.height,snap:"end"}]}}(e.target),o=jh(t,n);if(!o.length)return;i(o);const a=e.target.getAbsolutePosition(),l={...a};o.forEach((e=>{switch(e.snap){case"start":case"center":case"end":switch(e.orientation){case"V":l.x=e.lineGuide+e.offset;break;case"H":l.y=e.lineGuide+e.offset}}}));const s=l.x-a.x,c=l.y-a.y;e.evt.ctrlKey||e.evt.metaKey||e.target.nodes().forEach((e=>{const t=e.getAbsolutePosition();e.setAbsolutePosition({x:t.x+s,y:t.y+c})}))},a=(t,n,o)=>{const a=e.current,l=a.getLayer();if(l.children.find((e=>"line-guides"===e.name())).destroyChildren(),"rotater"===a.getActiveAnchor())return n;if(Math.sqrt(Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2))>50)return n;if(!l)return n;var s=jh(r(a.nodes()),{vertical:[{guide:n.x,offset:0,snap:"start"}],horizontal:[{guide:n.y,offset:0,snap:"start"}]});if(!s.length)return n;i(s);if(o.ctrlKey||o.metaKey)return n;let c=n.x,u=n.x;s.forEach((e=>{switch(e.orientation){case"V":c=e.lineGuide;break;case"H":u=e.lineGuide}}));const h=Math.abs(n.x-c)<10,f=Math.abs(n.y-u)<10;return h&&!f?{x:c,y:t.y}:f&&!h?{x:t.x,y:u}:h&&f?{x:c,y:u}:n},l=e=>{if(!e.target)return;const t=e.target.getLayer();t.children.find((e=>"line-guides"===e.name())).destroyChildren(),t.batchDraw()};n(d).useEffect((()=>{e.current&&(e.current.anchorDragBoundFunc(a),e.current.on("dragstart",(()=>{setTimeout((()=>{const e=[...pl.DD._dragElements.entries()];e.reverse(),pl.DD._dragElements.clear(),e.forEach((([e,t])=>{pl.DD._dragElements.set(e,t)}))}))})),e.current.on("dragmove",o),e.current.on("dragend",l),e.current.on("transformend",l))}),[])}function Ih(e,t,n="scale"){const r=t.width/t.height;let i,o;r>=e.width/e.height?(i=e.width,o=e.width/r):(i=e.height*r,o=e.height);let a=0,l=0;return"left-top"===n?(a=0,l=0):"left-middle"===n?(a=0,l=(e.height-o)/2):"left-bottom"===n?(a=0,l=e.height-o):"center-top"===n?(a=(e.width-i)/2,l=0):"center-middle"===n?(a=(e.width-i)/2,l=(e.height-o)/2):"center-bottom"===n?(a=(e.width-i)/2,l=e.height-o):"right-top"===n?(a=e.width-i,l=0):"right-middle"===n?(a=e.width-i,l=(e.height-o)/2):"right-bottom"===n?(a=e.width-i,l=e.height-o):"scale"===n?(a=0,l=0,i=e.width,o=e.height):console.error(new Error("Unknown clip position property - "+n)),{cropX:a,cropY:l,cropWidth:i,cropHeight:o}}l("8NFma");var Dh={};Object.defineProperty(Dh,"__esModule",{value:!0}),Dh.LegacyColors=Dh.Colors=void 0;var Fh={};Object.defineProperty(Fh,"__esModule",{value:!0}),Fh.Colors=void 0;const Bh={CERULEAN1:"#0C5174",CERULEAN2:"#0F6894",CERULEAN3:"#147EB3",CERULEAN4:"#3FA6DA",CERULEAN5:"#68C1EE",FOREST1:"#1D7324",FOREST2:"#238C2C",FOREST3:"#29A634",FOREST4:"#43BF4D",FOREST5:"#62D96B",GOLD1:"#5C4405",GOLD2:"#866103",GOLD3:"#D1980B",GOLD4:"#F0B726",GOLD5:"#FBD065",INDIGO1:"#5642A6",INDIGO2:"#634DBF",INDIGO3:"#7961DB",INDIGO4:"#9881F3",INDIGO5:"#BDADFF",LIME1:"#43501B",LIME2:"#5A701A",LIME3:"#8EB125",LIME4:"#B6D94C",LIME5:"#D4F17E",ROSE1:"#A82255",ROSE2:"#C22762",ROSE3:"#DB2C6F",ROSE4:"#F5498B",ROSE5:"#FF66A1",SEPIA1:"#5E4123",SEPIA2:"#7A542E",SEPIA3:"#946638",SEPIA4:"#AF855A",SEPIA5:"#D0B090",TURQUOISE1:"#004D46",TURQUOISE2:"#007067",TURQUOISE3:"#00A396",TURQUOISE4:"#13C9BA",TURQUOISE5:"#7AE1D8",VERMILION1:"#96290D",VERMILION2:"#B83211",VERMILION3:"#D33D17",VERMILION4:"#EB6847",VERMILION5:"#FF9980",VIOLET1:"#5C255C",VIOLET2:"#7C327C",VIOLET3:"#9D3F9D",VIOLET4:"#BD6BBD",VIOLET5:"#D69FD6"},Uh={COBALT1:Bh.CERULEAN1,COBALT2:Bh.CERULEAN2,COBALT3:Bh.CERULEAN3,COBALT4:Bh.CERULEAN4,COBALT5:Bh.CERULEAN5};Fh.Colors=Object.assign(Object.assign(Object.assign(Object.assign({},{BLACK:"#111418",DARK_GRAY1:"#1C2127",DARK_GRAY2:"#252A31",DARK_GRAY3:"#2F343C",DARK_GRAY4:"#383E47",DARK_GRAY5:"#404854",GRAY1:"#5F6B7C",GRAY2:"#738091",GRAY3:"#8F99A8",GRAY4:"#ABB3BF",GRAY5:"#C5CBD3",LIGHT_GRAY1:"#D3D8DE",LIGHT_GRAY2:"#DCE0E5",LIGHT_GRAY3:"#E5E8EB",LIGHT_GRAY4:"#EDEFF2",LIGHT_GRAY5:"#F6F7F9",WHITE:"#FFFFFF"}),{BLUE1:"#184A90",BLUE2:"#215DB0",BLUE3:"#2D72D2",BLUE4:"#4C90F0",BLUE5:"#8ABBFF",GREEN1:"#165A36",GREEN2:"#1C6E42",GREEN3:"#238551",GREEN4:"#32A467",GREEN5:"#72CA9B",ORANGE1:"#77450D",ORANGE2:"#935610",ORANGE3:"#C87619",ORANGE4:"#EC9A3C",ORANGE5:"#FBB360",RED1:"#8E292C",RED2:"#AC2F33",RED3:"#CD4246",RED4:"#E76A6E",RED5:"#FA999C"}),Bh),Uh),Object.defineProperty(Dh,"Colors",{enumerable:!0,get:function(){return Fh.Colors}});var Gh={};Object.defineProperty(Gh,"__esModule",{value:!0}),Gh.LegacyColors=void 0,Gh.LegacyColors={BLACK:"#10161A",BLUE1:"#0E5A8A",BLUE2:"#106BA3",BLUE3:"#137CBD",BLUE4:"#2B95D6",BLUE5:"#48AFF0",COBALT1:"#1F4B99",COBALT2:"#2458B3",COBALT3:"#2965CC",COBALT4:"#4580E6",COBALT5:"#669EFF",DARK_GRAY1:"#182026",DARK_GRAY2:"#202B33",DARK_GRAY3:"#293742",DARK_GRAY4:"#30404D",DARK_GRAY5:"#394B59",FOREST1:"#1D7324",FOREST2:"#238C2C",FOREST3:"#29A634",FOREST4:"#43BF4D",FOREST5:"#62D96B",GOLD1:"#A67908",GOLD2:"#BF8C0A",GOLD3:"#D99E0B",GOLD4:"#F2B824",GOLD5:"#FFC940",GRAY1:"#5C7080",GRAY2:"#738694",GRAY3:"#8A9BA8",GRAY4:"#A7B6C2",GRAY5:"#BFCCD6",GREEN1:"#0A6640",GREEN2:"#0D8050",GREEN3:"#0F9960",GREEN4:"#15B371",GREEN5:"#3DCC91",INDIGO1:"#5642A6",INDIGO2:"#634DBF",INDIGO3:"#7157D9",INDIGO4:"#9179F2",INDIGO5:"#AD99FF",LIGHT_GRAY1:"#CED9E0",LIGHT_GRAY2:"#D8E1E8",LIGHT_GRAY3:"#E1E8ED",LIGHT_GRAY4:"#EBF1F5",LIGHT_GRAY5:"#F5F8FA",LIME1:"#728C23",LIME2:"#87A629",LIME3:"#9BBF30",LIME4:"#B6D94C",LIME5:"#D1F26D",ORANGE1:"#A66321",ORANGE2:"#BF7326",ORANGE3:"#D9822B",ORANGE4:"#F29D49",ORANGE5:"#FFB366",RED1:"#A82A2A",RED2:"#C23030",RED3:"#DB3737",RED4:"#F55656",RED5:"#FF7373",ROSE1:"#A82255",ROSE2:"#C22762",ROSE3:"#DB2C6F",ROSE4:"#F5498B",ROSE5:"#FF66A1",SEPIA1:"#63411E",SEPIA2:"#7D5125",SEPIA3:"#96622D",SEPIA4:"#B07B46",SEPIA5:"#C99765",TURQUOISE1:"#008075",TURQUOISE2:"#00998C",TURQUOISE3:"#00B3A4",TURQUOISE4:"#14CCBD",TURQUOISE5:"#2EE6D6",VERMILION1:"#9E2B0E",VERMILION2:"#B83211",VERMILION3:"#D13913",VERMILION4:"#EB532D",VERMILION5:"#FF6E4A",VIOLET1:"#5C255C",VIOLET2:"#752F75",VIOLET3:"#8F398F",VIOLET4:"#A854A8",VIOLET5:"#C274C2",WHITE:"#FFFFFF"},Object.defineProperty(Dh,"LegacyColors",{enumerable:!0,get:function(){return Gh.LegacyColors}});var qh={};e(qh,"ACTIVE",(()=>gf)),e(qh,"ALIGN_LEFT",(()=>yf)),e(qh,"ALIGN_RIGHT",(()=>bf)),e(qh,"DARK",(()=>wf)),e(qh,"DISABLED",(()=>xf)),e(qh,"FILL",(()=>Ef)),e(qh,"FIXED",(()=>_f)),e(qh,"FIXED_TOP",(()=>zf)),e(qh,"INLINE",(()=>Sf)),e(qh,"INTERACTIVE",(()=>Cf)),e(qh,"LARGE",(()=>Of)),e(qh,"LOADING",(()=>Mf)),e(qh,"MINIMAL",(()=>Af)),e(qh,"OUTLINED",(()=>kf)),e(qh,"MULTILINE",(()=>Lf)),e(qh,"ROUND",(()=>Pf)),e(qh,"SELECTED",(()=>Tf)),e(qh,"SMALL",(()=>Hf)),e(qh,"VERTICAL",(()=>Nf)),e(qh,"POSITION_TOP",(()=>Rf)),e(qh,"positionClass",(()=>Dm)),e(qh,"POSITION_BOTTOM",(()=>jf)),e(qh,"POSITION_LEFT",(()=>Vf)),e(qh,"POSITION_RIGHT",(()=>If)),e(qh,"ELEVATION_0",(()=>Df)),e(qh,"elevationClass",(()=>jm)),e(qh,"ELEVATION_1",(()=>Ff)),e(qh,"ELEVATION_2",(()=>Bf)),e(qh,"ELEVATION_3",(()=>Uf)),e(qh,"ELEVATION_4",(()=>Gf)),e(qh,"INTENT_PRIMARY",(()=>qf)),e(qh,"intentClass",(()=>Im)),e(qh,"INTENT_SUCCESS",(()=>Wf)),e(qh,"INTENT_WARNING",(()=>Kf)),e(qh,"INTENT_DANGER",(()=>Yf)),e(qh,"FOCUS_DISABLED",(()=>$f)),e(qh,"FOCUS_STYLE_MANAGER_IGNORE",(()=>Xf)),e(qh,"UI_TEXT",(()=>Qf)),e(qh,"RUNNING_TEXT",(()=>Zf)),e(qh,"MONOSPACE_TEXT",(()=>Jf)),e(qh,"TEXT_LARGE",(()=>ed)),e(qh,"TEXT_SMALL",(()=>td)),e(qh,"TEXT_MUTED",(()=>nd)),e(qh,"TEXT_DISABLED",(()=>rd)),e(qh,"TEXT_OVERFLOW_ELLIPSIS",(()=>id)),e(qh,"BLOCKQUOTE",(()=>od)),e(qh,"CODE",(()=>ad)),e(qh,"CODE_BLOCK",(()=>ld)),e(qh,"HEADING",(()=>sd)),e(qh,"LIST",(()=>cd)),e(qh,"LIST_UNSTYLED",(()=>ud)),e(qh,"RTL",(()=>hd)),e(qh,"ALERT",(()=>fd)),e(qh,"ALERT_BODY",(()=>dd)),e(qh,"ALERT_CONTENTS",(()=>pd)),e(qh,"ALERT_FOOTER",(()=>vd)),e(qh,"BREADCRUMB",(()=>md)),e(qh,"BREADCRUMB_CURRENT",(()=>gd)),e(qh,"BREADCRUMBS",(()=>yd)),e(qh,"BREADCRUMBS_COLLAPSED",(()=>bd)),e(qh,"BUTTON",(()=>wd)),e(qh,"BUTTON_GROUP",(()=>xd)),e(qh,"BUTTON_SPINNER",(()=>Ed)),e(qh,"BUTTON_TEXT",(()=>_d)),e(qh,"CALLOUT",(()=>zd)),e(qh,"CALLOUT_ICON",(()=>Sd)),e(qh,"CARD",(()=>Cd)),e(qh,"COLLAPSE",(()=>Od)),e(qh,"COLLAPSE_BODY",(()=>Md)),e(qh,"COLLAPSIBLE_LIST",(()=>Ad)),e(qh,"CONTEXT_MENU",(()=>kd)),e(qh,"CONTEXT_MENU_POPOVER_TARGET",(()=>Ld)),e(qh,"CONTROL_GROUP",(()=>Pd)),e(qh,"DIALOG",(()=>Td)),e(qh,"DIALOG_CONTAINER",(()=>Hd)),e(qh,"DIALOG_BODY",(()=>Nd)),e(qh,"DIALOG_CLOSE_BUTTON",(()=>Rd)),e(qh,"DIALOG_FOOTER",(()=>jd)),e(qh,"DIALOG_FOOTER_ACTIONS",(()=>Vd)),e(qh,"DIALOG_HEADER",(()=>Id)),e(qh,"DIALOG_STEP",(()=>Dd)),e(qh,"DIALOG_STEP_CONTAINER",(()=>Fd)),e(qh,"DIALOG_STEP_TITLE",(()=>Bd)),e(qh,"DIALOG_STEP_ICON",(()=>Ud)),e(qh,"DIALOG_STEP_VIEWED",(()=>Gd)),e(qh,"DIVIDER",(()=>qd)),e(qh,"DRAWER",(()=>Wd)),e(qh,"DRAWER_BODY",(()=>Kd)),e(qh,"DRAWER_FOOTER",(()=>Yd)),e(qh,"DRAWER_HEADER",(()=>$d)),e(qh,"EDITABLE_TEXT",(()=>Xd)),e(qh,"EDITABLE_TEXT_CONTENT",(()=>Qd)),e(qh,"EDITABLE_TEXT_EDITING",(()=>Zd)),e(qh,"EDITABLE_TEXT_INPUT",(()=>Jd)),e(qh,"EDITABLE_TEXT_PLACEHOLDER",(()=>ep)),e(qh,"FLEX_EXPANDER",(()=>tp)),e(qh,"HTML_SELECT",(()=>np)),e(qh,"SELECT",(()=>rp)),e(qh,"HTML_TABLE",(()=>ip)),e(qh,"HTML_TABLE_BORDERED",(()=>op)),e(qh,"HTML_TABLE_CONDENSED",(()=>ap)),e(qh,"HTML_TABLE_STRIPED",(()=>lp)),e(qh,"INPUT",(()=>sp)),e(qh,"INPUT_GHOST",(()=>cp)),e(qh,"INPUT_GROUP",(()=>up)),e(qh,"INPUT_LEFT_CONTAINER",(()=>hp)),e(qh,"INPUT_ACTION",(()=>fp)),e(qh,"CONTROL",(()=>dp)),e(qh,"CONTROL_INDICATOR",(()=>pp)),e(qh,"CONTROL_INDICATOR_CHILD",(()=>vp)),e(qh,"CHECKBOX",(()=>mp)),e(qh,"RADIO",(()=>gp)),e(qh,"SWITCH",(()=>yp)),e(qh,"SWITCH_INNER_TEXT",(()=>bp)),e(qh,"FILE_INPUT",(()=>wp)),e(qh,"FILE_INPUT_HAS_SELECTION",(()=>xp)),e(qh,"FILE_UPLOAD_INPUT",(()=>Ep)),e(qh,"FILE_UPLOAD_INPUT_CUSTOM_TEXT",(()=>_p)),e(qh,"KEY",(()=>zp)),e(qh,"KEY_COMBO",(()=>Sp)),e(qh,"MODIFIER_KEY",(()=>Cp)),e(qh,"HOTKEY",(()=>Op)),e(qh,"HOTKEY_LABEL",(()=>Mp)),e(qh,"HOTKEY_COLUMN",(()=>Ap)),e(qh,"HOTKEY_DIALOG",(()=>kp)),e(qh,"LABEL",(()=>Lp)),e(qh,"FORM_GROUP",(()=>Pp)),e(qh,"FORM_CONTENT",(()=>Tp)),e(qh,"FORM_HELPER_TEXT",(()=>Hp)),e(qh,"FORM_GROUP_SUB_LABEL",(()=>Np)),e(qh,"MENU",(()=>Rp)),e(qh,"MENU_ITEM",(()=>jp)),e(qh,"MENU_ITEM_ICON",(()=>Vp)),e(qh,"MENU_ITEM_LABEL",(()=>Ip)),e(qh,"MENU_SUBMENU",(()=>Dp)),e(qh,"MENU_SUBMENU_ICON",(()=>Fp)),e(qh,"MENU_DIVIDER",(()=>Bp)),e(qh,"MENU_HEADER",(()=>Up)),e(qh,"MULTISTEP_DIALOG",(()=>Gp)),e(qh,"MULTISTEP_DIALOG_PANELS",(()=>qp)),e(qh,"MULTISTEP_DIALOG_LEFT_PANEL",(()=>Wp)),e(qh,"MULTISTEP_DIALOG_RIGHT_PANEL",(()=>Kp)),e(qh,"MULTISTEP_DIALOG_FOOTER",(()=>Yp)),e(qh,"MULTISTEP_DIALOG_NAV_TOP",(()=>$p)),e(qh,"MULTISTEP_DIALOG_NAV_RIGHT",(()=>Xp)),e(qh,"NAVBAR",(()=>Qp)),e(qh,"NAVBAR_GROUP",(()=>Zp)),e(qh,"NAVBAR_HEADING",(()=>Jp)),e(qh,"NAVBAR_DIVIDER",(()=>ev)),e(qh,"NON_IDEAL_STATE",(()=>tv)),e(qh,"NON_IDEAL_STATE_VISUAL",(()=>nv)),e(qh,"NON_IDEAL_STATE_TEXT",(()=>rv)),e(qh,"NUMERIC_INPUT",(()=>iv)),e(qh,"OVERFLOW_LIST",(()=>ov)),e(qh,"OVERFLOW_LIST_SPACER",(()=>av)),e(qh,"OVERLAY",(()=>lv)),e(qh,"OVERLAY_BACKDROP",(()=>sv)),e(qh,"OVERLAY_CONTAINER",(()=>cv)),e(qh,"OVERLAY_CONTENT",(()=>uv)),e(qh,"OVERLAY_INLINE",(()=>hv)),e(qh,"OVERLAY_OPEN",(()=>fv)),e(qh,"OVERLAY_SCROLL_CONTAINER",(()=>dv)),e(qh,"OVERLAY_START_FOCUS_TRAP",(()=>pv)),e(qh,"OVERLAY_END_FOCUS_TRAP",(()=>vv)),e(qh,"PANEL_STACK",(()=>mv)),e(qh,"PANEL_STACK_HEADER",(()=>gv)),e(qh,"PANEL_STACK_HEADER_BACK",(()=>yv)),e(qh,"PANEL_STACK_VIEW",(()=>bv)),e(qh,"PANEL_STACK2",(()=>wv)),e(qh,"PANEL_STACK2_HEADER",(()=>xv)),e(qh,"PANEL_STACK2_HEADER_BACK",(()=>Ev)),e(qh,"PANEL_STACK2_VIEW",(()=>_v)),e(qh,"POPOVER",(()=>zv)),e(qh,"POPOVER_ARROW",(()=>Sv)),e(qh,"POPOVER_BACKDROP",(()=>Cv)),e(qh,"POPOVER_CAPTURING_DISMISS",(()=>Ov)),e(qh,"POPOVER_CONTENT",(()=>Mv)),e(qh,"POPOVER_CONTENT_SIZING",(()=>Av)),e(qh,"POPOVER_DISMISS",(()=>kv)),e(qh,"POPOVER_DISMISS_OVERRIDE",(()=>Lv)),e(qh,"POPOVER_OPEN",(()=>Pv)),e(qh,"POPOVER_OUT_OF_BOUNDARIES",(()=>Tv)),e(qh,"POPOVER_TARGET",(()=>Hv)),e(qh,"POPOVER_WRAPPER",(()=>Nv)),e(qh,"TRANSITION_CONTAINER",(()=>Rv)),e(qh,"PROGRESS_BAR",(()=>jv)),e(qh,"PROGRESS_METER",(()=>Vv)),e(qh,"PROGRESS_NO_STRIPES",(()=>Iv)),e(qh,"PROGRESS_NO_ANIMATION",(()=>Dv)),e(qh,"PORTAL",(()=>Fv)),e(qh,"SKELETON",(()=>Bv)),e(qh,"SLIDER",(()=>Uv)),e(qh,"SLIDER_AXIS",(()=>Gv)),e(qh,"SLIDER_HANDLE",(()=>qv)),e(qh,"SLIDER_LABEL",(()=>Wv)),e(qh,"SLIDER_TRACK",(()=>Kv)),e(qh,"SLIDER_PROGRESS",(()=>Yv)),e(qh,"START",(()=>$v)),e(qh,"END",(()=>Xv)),e(qh,"SPINNER",(()=>Qv)),e(qh,"SPINNER_ANIMATION",(()=>Zv)),e(qh,"SPINNER_HEAD",(()=>Jv)),e(qh,"SPINNER_NO_SPIN",(()=>em)),e(qh,"SPINNER_TRACK",(()=>tm)),e(qh,"TAB",(()=>nm)),e(qh,"TAB_INDICATOR",(()=>rm)),e(qh,"TAB_INDICATOR_WRAPPER",(()=>im)),e(qh,"TAB_LIST",(()=>om)),e(qh,"TAB_PANEL",(()=>am)),e(qh,"TABS",(()=>lm)),e(qh,"TAG",(()=>sm)),e(qh,"TAG_REMOVE",(()=>cm)),e(qh,"TAG_INPUT",(()=>um)),e(qh,"TAG_INPUT_ICON",(()=>hm)),e(qh,"TAG_INPUT_VALUES",(()=>fm)),e(qh,"TOAST",(()=>dm)),e(qh,"TOAST_CONTAINER",(()=>pm)),e(qh,"TOAST_MESSAGE",(()=>vm)),e(qh,"TOOLTIP",(()=>mm)),e(qh,"TOOLTIP_INDICATOR",(()=>gm)),e(qh,"TREE",(()=>ym)),e(qh,"TREE_NODE",(()=>bm)),e(qh,"TREE_NODE_CARET",(()=>wm)),e(qh,"TREE_NODE_CARET_CLOSED",(()=>xm)),e(qh,"TREE_NODE_CARET_NONE",(()=>Em)),e(qh,"TREE_NODE_CARET_OPEN",(()=>_m)),e(qh,"TREE_NODE_CONTENT",(()=>zm)),e(qh,"TREE_NODE_EXPANDED",(()=>Sm)),e(qh,"TREE_NODE_ICON",(()=>Cm)),e(qh,"TREE_NODE_LABEL",(()=>Om)),e(qh,"TREE_NODE_LIST",(()=>Mm)),e(qh,"TREE_NODE_SECONDARY_LABEL",(()=>Am)),e(qh,"TREE_NODE_SELECTED",(()=>km)),e(qh,"TREE_ROOT",(()=>Lm)),e(qh,"ICON",(()=>Pm)),e(qh,"ICON_STANDARD",(()=>Tm)),e(qh,"ICON_LARGE",(()=>Hm)),e(qh,"getClassNamespace",(()=>Nm)),e(qh,"alignmentClass",(()=>Rm)),e(qh,"iconClass",(()=>Vm));var Wh={CENTER:"center",LEFT:"left",RIGHT:"right"},Kh={ZERO:0,ONE:1,TWO:2,THREE:3,FOUR:4},Yh={NONE:"none",PRIMARY:"primary",SUCCESS:"success",WARNING:"warning",DANGER:"danger"},$h={BOTTOM:"bottom",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",LEFT:"left",LEFT_BOTTOM:"left-bottom",LEFT_TOP:"left-top",RIGHT:"right",RIGHT_BOTTOM:"right-bottom",RIGHT_TOP:"right-top",TOP:"top",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var Xh,Qh,Zh,Jh=Xh={};function ef(){throw new Error("setTimeout has not been defined")}function tf(){throw new Error("clearTimeout has not been defined")}function nf(e){if(Qh===setTimeout)return setTimeout(e,0);if((Qh===ef||!Qh)&&setTimeout)return Qh=setTimeout,setTimeout(e,0);try{return Qh(e,0)}catch(t){try{return Qh.call(null,e,0)}catch(t){return Qh.call(this,e,0)}}}!function(){try{Qh="function"==typeof setTimeout?setTimeout:ef}catch(e){Qh=ef}try{Zh="function"==typeof clearTimeout?clearTimeout:tf}catch(e){Zh=tf}}();var rf,of,af,lf,sf,cf=[],uf=!1,hf=-1;function ff(){uf&&rf&&(uf=!1,rf.length?cf=rf.concat(cf):hf=-1,cf.length&&df())}function df(){if(!uf){var e=nf(ff);uf=!0;for(var t=cf.length;t;){for(rf=cf,cf=[];++hf<t;)rf&&rf[hf].run();hf=-1,t=cf.length}rf=null,uf=!1,function(e){if(Zh===clearTimeout)return clearTimeout(e);if((Zh===tf||!Zh)&&clearTimeout)return Zh=clearTimeout,clearTimeout(e);try{Zh(e)}catch(t){try{return Zh.call(null,e)}catch(t){return Zh.call(this,e)}}}(e)}}function pf(e,t){this.fun=e,this.array=t}function vf(){}Jh.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];cf.push(new pf(e,t)),1!==cf.length||uf||nf(df)},pf.prototype.run=function(){this.fun.apply(null,this.array)},Jh.title="browser",Jh.browser=!0,Jh.env={},Jh.argv=[],Jh.version="",Jh.versions={},Jh.on=vf,Jh.addListener=vf,Jh.once=vf,Jh.off=vf,Jh.removeListener=vf,Jh.removeAllListeners=vf,Jh.emit=vf,Jh.prependListener=vf,Jh.prependOnceListener=vf,Jh.listeners=function(e){return[]},Jh.binding=function(e){throw new Error("process.binding is not supported")},Jh.cwd=function(){return"/"},Jh.chdir=function(e){throw new Error("process.chdir is not supported")},Jh.umask=function(){return 0};var mf="bp4";void 0!==Xh&&(mf=null!==(sf=null!==(af=void 0===(of={})?void 0:of.BLUEPRINT_NAMESPACE)&&void 0!==af?af:void 0===(lf={})?void 0:lf.REACT_APP_BLUEPRINT_NAMESPACE)&&void 0!==sf?sf:mf);var gf="".concat(mf,"-active"),yf="".concat(mf,"-align-left"),bf="".concat(mf,"-align-right"),wf="".concat(mf,"-dark"),xf="".concat(mf,"-disabled"),Ef="".concat(mf,"-fill"),_f="".concat(mf,"-fixed"),zf="".concat(mf,"-fixed-top"),Sf="".concat(mf,"-inline"),Cf="".concat(mf,"-interactive"),Of="".concat(mf,"-large"),Mf="".concat(mf,"-loading"),Af="".concat(mf,"-minimal"),kf="".concat(mf,"-outlined"),Lf="".concat(mf,"-multiline"),Pf="".concat(mf,"-round"),Tf="".concat(mf,"-selected"),Hf="".concat(mf,"-small"),Nf="".concat(mf,"-vertical"),Rf=Dm($h.TOP),jf=Dm($h.BOTTOM),Vf=Dm($h.LEFT),If=Dm($h.RIGHT),Df=jm(Kh.ZERO),Ff=jm(Kh.ONE),Bf=jm(Kh.TWO),Uf=jm(Kh.THREE),Gf=jm(Kh.FOUR),qf=Im(Yh.PRIMARY),Wf=Im(Yh.SUCCESS),Kf=Im(Yh.WARNING),Yf=Im(Yh.DANGER),$f="".concat(mf,"-focus-disabled"),Xf="".concat(mf,"-focus-style-manager-ignore"),Qf="".concat(mf,"-ui-text"),Zf="".concat(mf,"-running-text"),Jf="".concat(mf,"-monospace-text"),ed="".concat(mf,"-text-large"),td="".concat(mf,"-text-small"),nd="".concat(mf,"-text-muted"),rd="".concat(mf,"-text-disabled"),id="".concat(mf,"-text-overflow-ellipsis"),od="".concat(mf,"-blockquote"),ad="".concat(mf,"-code"),ld="".concat(mf,"-code-block"),sd="".concat(mf,"-heading"),cd="".concat(mf,"-list"),ud="".concat(mf,"-list-unstyled"),hd="".concat(mf,"-rtl"),fd="".concat(mf,"-alert"),dd="".concat(fd,"-body"),pd="".concat(fd,"-contents"),vd="".concat(fd,"-footer"),md="".concat(mf,"-breadcrumb"),gd="".concat(md,"-current"),yd="".concat(md,"s"),bd="".concat(md,"s-collapsed"),wd="".concat(mf,"-button"),xd="".concat(wd,"-group"),Ed="".concat(wd,"-spinner"),_d="".concat(wd,"-text"),zd="".concat(mf,"-callout"),Sd="".concat(zd,"-icon"),Cd="".concat(mf,"-card"),Od="".concat(mf,"-collapse"),Md="".concat(Od,"-body"),Ad="".concat(mf,"-collapse-list"),kd="".concat(mf,"-context-menu"),Ld="".concat(kd,"-popover-target"),Pd="".concat(mf,"-control-group"),Td="".concat(mf,"-dialog"),Hd="".concat(Td,"-container"),Nd="".concat(Td,"-body"),Rd="".concat(Td,"-close-button"),jd="".concat(Td,"-footer"),Vd="".concat(Td,"-footer-actions"),Id="".concat(Td,"-header"),Dd="".concat(mf,"-dialog-step"),Fd="".concat(Dd,"-container"),Bd="".concat(Dd,"-title"),Ud="".concat(Dd,"-icon"),Gd="".concat(Dd,"-viewed"),qd="".concat(mf,"-divider"),Wd="".concat(mf,"-drawer"),Kd="".concat(Wd,"-body"),Yd="".concat(Wd,"-footer"),$d="".concat(Wd,"-header"),Xd="".concat(mf,"-editable-text"),Qd="".concat(Xd,"-content"),Zd="".concat(Xd,"-editing"),Jd="".concat(Xd,"-input"),ep="".concat(Xd,"-placeholder"),tp="".concat(mf,"-flex-expander"),np="".concat(mf,"-html-select"),rp="".concat(mf,"-select"),ip="".concat(mf,"-html-table"),op="".concat(ip,"-bordered"),ap="".concat(ip,"-condensed"),lp="".concat(ip,"-striped"),sp="".concat(mf,"-input"),cp="".concat(sp,"-ghost"),up="".concat(sp,"-group"),hp="".concat(sp,"-left-container"),fp="".concat(sp,"-action"),dp="".concat(mf,"-control"),pp="".concat(dp,"-indicator"),vp="".concat(pp,"-child"),mp="".concat(mf,"-checkbox"),gp="".concat(mf,"-radio"),yp="".concat(mf,"-switch"),bp="".concat(yp,"-inner-text"),wp="".concat(mf,"-file-input"),xp="".concat(mf,"-file-input-has-selection"),Ep="".concat(mf,"-file-upload-input"),_p="".concat(mf,"-file-upload-input-custom-text"),zp="".concat(mf,"-key"),Sp="".concat(zp,"-combo"),Cp="".concat(mf,"-modifier-key"),Op="".concat(mf,"-hotkey"),Mp="".concat(Op,"-label"),Ap="".concat(Op,"-column"),kp="".concat(Op,"-dialog"),Lp="".concat(mf,"-label"),Pp="".concat(mf,"-form-group"),Tp="".concat(mf,"-form-content"),Hp="".concat(mf,"-form-helper-text"),Np="".concat(mf,"-form-group-sub-label"),Rp="".concat(mf,"-menu"),jp="".concat(Rp,"-item"),Vp="".concat(jp,"-icon"),Ip="".concat(jp,"-label"),Dp="".concat(mf,"-submenu"),Fp="".concat(Dp,"-icon"),Bp="".concat(Rp,"-divider"),Up="".concat(Rp,"-header"),Gp="".concat(mf,"-multistep-dialog"),qp="".concat(Gp,"-panels"),Wp="".concat(Gp,"-left-panel"),Kp="".concat(Gp,"-right-panel"),Yp="".concat(Gp,"-footer"),$p="".concat(Gp,"-nav-top"),Xp="".concat(Gp,"-nav-right"),Qp="".concat(mf,"-navbar"),Zp="".concat(Qp,"-group"),Jp="".concat(Qp,"-heading"),ev="".concat(Qp,"-divider"),tv="".concat(mf,"-non-ideal-state"),nv="".concat(tv,"-visual"),rv="".concat(tv,"-text"),iv="".concat(mf,"-numeric-input"),ov="".concat(mf,"-overflow-list"),av="".concat(ov,"-spacer"),lv="".concat(mf,"-overlay"),sv="".concat(lv,"-backdrop"),cv="".concat(lv,"-container"),uv="".concat(lv,"-content"),hv="".concat(lv,"-inline"),fv="".concat(lv,"-open"),dv="".concat(lv,"-scroll-container"),pv="".concat(lv,"-start-focus-trap"),vv="".concat(lv,"-end-focus-trap"),mv="".concat(mf,"-panel-stack"),gv="".concat(mv,"-header"),yv="".concat(mv,"-header-back"),bv="".concat(mv,"-view"),wv="".concat(mf,"-panel-stack2"),xv="".concat(mv,"-header"),Ev="".concat(mv,"-header-back"),_v="".concat(mv,"-view"),zv="".concat(mf,"-popover"),Sv="".concat(zv,"-arrow"),Cv="".concat(zv,"-backdrop"),Ov="".concat(zv,"-capturing-dismiss"),Mv="".concat(zv,"-content"),Av="".concat(Mv,"-sizing"),kv="".concat(zv,"-dismiss"),Lv="".concat(kv,"-override"),Pv="".concat(zv,"-open"),Tv="".concat(zv,"-out-of-boundaries"),Hv="".concat(zv,"-target"),Nv="".concat(zv,"-wrapper"),Rv="".concat(mf,"-transition-container"),jv="".concat(mf,"-progress-bar"),Vv="".concat(mf,"-progress-meter"),Iv="".concat(mf,"-no-stripes"),Dv="".concat(mf,"-no-animation"),Fv="".concat(mf,"-portal"),Bv="".concat(mf,"-skeleton"),Uv="".concat(mf,"-slider"),Gv="".concat(Uv,"-axis"),qv="".concat(Uv,"-handle"),Wv="".concat(Uv,"-label"),Kv="".concat(Uv,"-track"),Yv="".concat(Uv,"-progress"),$v="".concat(mf,"-start"),Xv="".concat(mf,"-end"),Qv="".concat(mf,"-spinner"),Zv="".concat(Qv,"-animation"),Jv="".concat(Qv,"-head"),em="".concat(mf,"-no-spin"),tm="".concat(Qv,"-track"),nm="".concat(mf,"-tab"),rm="".concat(nm,"-indicator"),im="".concat(rm,"-wrapper"),om="".concat(nm,"-list"),am="".concat(nm,"-panel"),lm="".concat(nm,"s"),sm="".concat(mf,"-tag"),cm="".concat(sm,"-remove"),um="".concat(mf,"-tag-input"),hm="".concat(um,"-icon"),fm="".concat(um,"-values"),dm="".concat(mf,"-toast"),pm="".concat(dm,"-container"),vm="".concat(dm,"-message"),mm="".concat(mf,"-tooltip"),gm="".concat(mm,"-indicator"),ym="".concat(mf,"-tree"),bm="".concat(mf,"-tree-node"),wm="".concat(bm,"-caret"),xm="".concat(wm,"-closed"),Em="".concat(wm,"-none"),_m="".concat(wm,"-open"),zm="".concat(bm,"-content"),Sm="".concat(bm,"-expanded"),Cm="".concat(bm,"-icon"),Om="".concat(bm,"-label"),Mm="".concat(bm,"-list"),Am="".concat(bm,"-secondary-label"),km="".concat(bm,"-selected"),Lm="".concat(mf,"-tree-root"),Pm="".concat(mf,"-icon"),Tm="".concat(Pm,"-standard"),Hm="".concat(Pm,"-large");function Nm(){return mf}function Rm(e){switch(e){case Wh.LEFT:return yf;case Wh.RIGHT:return bf;default:return}}function jm(e){if(void 0!==e)return"".concat(mf,"-elevation-").concat(e)}function Vm(e){if(null!=e)return 0===e.indexOf("".concat(mf,"-icon-"))?e:"".concat(mf,"-icon-").concat(e)}function Im(e){if(null!=e&&e!==Yh.NONE)return"".concat(mf,"-intent-").concat(e.toLowerCase())}function Dm(e){if(void 0!==e)return"".concat(mf,"-position-").concat(e)}var Fm={};e(Fm,"BACKSPACE",(()=>Bm)),e(Fm,"TAB",(()=>Um)),e(Fm,"ENTER",(()=>Gm)),e(Fm,"SHIFT",(()=>qm)),e(Fm,"ESCAPE",(()=>Wm)),e(Fm,"SPACE",(()=>Km)),e(Fm,"ARROW_LEFT",(()=>Ym)),e(Fm,"ARROW_UP",(()=>$m)),e(Fm,"ARROW_RIGHT",(()=>Xm)),e(Fm,"ARROW_DOWN",(()=>Qm)),e(Fm,"DELETE",(()=>Zm)),e(Fm,"isKeyboardClick",(()=>Jm));var Bm=8,Um=9,Gm=13,qm=16,Wm=27,Km=32,Ym=37,$m=38,Xm=39,Qm=40,Zm=46;function Jm(e){return e===Gm||e===Km}var eg={};e(eg,"isDarkTheme",(()=>Tg)),e(eg,"setRef",(()=>Hg)),e(eg,"getRef",(()=>Rg));var tg={};function ng(e,t,n){return void 0===n&&(n=function(e,t){return e===t}),null==e&&null==t||null!=e&&null!=t&&e.length===t.length&&e.every((function(e,r){return n(e,t[r])}))}function rg(e,t,n){if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(Array.isArray(e)||Array.isArray(t))return!1;if(null!=n)return ag(e,t,n);var r=Object.keys(e),i=Object.keys(t);return ag(e,t,{include:r})&&ag(e,t,{include:i})}function ig(e,t,n){if(e===t)return!0;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(Array.isArray(e)||Array.isArray(t))return ng(e,t,ig);if(sg(e)||sg(t))return e===t;if(null!=n)return lg(e,t,n);if(e.constructor!==t.constructor)return!1;var r=Object.keys(e),i=Object.keys(t);return null!=r&&null!=i&&(0===r.length&&0===i.length||ng(r,i)&&lg(e,t,r))}function og(e,t,n){void 0===e&&(e={}),void 0===t&&(t={});var r=null==n?function(e,t){var n=Object.keys(e),r=Object.keys(t),i=cg(n.concat(r));return Object.keys(i)}(e,t):n;return function(e,t,n,r){return n.filter((function(n){return!r(e,t,n)})).map((function(n){return{key:n,valueA:e[n],valueB:t[n]}}))}(e,t,r,(function(e,t,n){return ig(e,t,[n])}))}function ag(e,t,n){return function(e,t,n){if(function(e){return null!=e&&null!=e.include}(n))return n.include;if(function(e){return null!=e&&null!=e.exclude}(n)){var r=Object.keys(e),i=Object.keys(t),o=cg(r.concat(i));return n.exclude.forEach((function(e){return delete o[e]})),Object.keys(o)}return[]}(e,t,n).every((function(n){return e.hasOwnProperty(n)===t.hasOwnProperty(n)&&e[n]===t[n]}))}function lg(e,t,n){return n.every((function(n){return e.hasOwnProperty(n)===t.hasOwnProperty(n)&&ig(e[n],t[n])}))}function sg(e){return"number"==typeof e||"string"==typeof e||"boolean"==typeof e}function cg(e){return e.reduce((function(e,t){return e[t]=!0,e}),{})}e(tg,"arraysEqual",(()=>ng)),e(tg,"shallowCompareKeys",(()=>rg)),e(tg,"deepCompareKeys",(()=>ig)),e(tg,"getDeepUnequalKeyValues",(()=>og));var ug={};function hg(e,t){return e===t||e.contains(t)}function fg(e,t){var n;return null==e?document.activeElement:(null!==(n=e.getRootNode(t))&&void 0!==n?n:document).activeElement}function dg(e,t,n){var r=mg((function(t){e.dispatchEvent(new CustomEvent(n,t))}));return e.addEventListener(t,r),r}function pg(e,t){return void 0===t&&(t={}),mg(e,(function(e){t.preventDefault&&e.preventDefault()}),(function(e){return e.persist()}))}function vg(e){return mg(e)}function mg(e,t,n){var r=!1;return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];null==t||t.apply(void 0,i),r||(r=!0,null==n||n.apply(void 0,i),requestAnimationFrame((function(){e.apply(void 0,i),r=!1})))}}e(ug,"elementIsOrContains",(()=>hg)),e(ug,"getActiveElement",(()=>fg)),e(ug,"throttleEvent",(()=>dg)),e(ug,"throttleReactEventCallback",(()=>pg)),e(ug,"throttle",(()=>vg));var gg={};function yg(e){return"function"==typeof e}e(gg,"isFunction",(()=>yg));var bg={};e(bg,"isNodeEnv",(()=>wg)),e(bg,"arrayLengthCompare",(()=>xg)),e(bg,"approxEqual",(()=>Eg)),e(bg,"clamp",(()=>_g)),e(bg,"countDecimalPlaces",(()=>zg)),e(bg,"uniqueId",(()=>Cg));function wg(e){return void 0!==Xh&&Xh.env&&"production"===e}function xg(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),e.length-t.length}function Eg(e,t,n){return void 0===n&&(n=1e-5),Math.abs(e-t)<=n}function _g(e,t,n){if(null==e)return e;if(n<t)throw new Error("[Blueprint] clamp: max cannot be less than min");return Math.min(Math.max(e,t),n)}function zg(e){if(!isFinite(e))return 0;for(var t=1,n=0;Math.round(e*t)/t!==e;)t*=10,n++;return n}var Sg=new Map;function Cg(e){var t,n=null!==(t=Sg.get(e))&&void 0!==t?t:0;return Sg.set(e,n+1),"".concat(e,"-").concat(n)}var Og={};e(Og,"isReactNodeEmpty",(()=>Mg)),e(Og,"isReactChildrenElementOrElements",(()=>Ag)),e(Og,"ensureElement",(()=>kg)),e(Og,"getDisplayName",(()=>Lg)),e(Og,"isElementOfType",(()=>Pg));d=l("8NFma");function Mg(e,t){return void 0===t&&(t=!1),null==e||""===e||!1===e||!t&&Array.isArray(e)&&(0===e.length||e.every((function(e){return Mg(e,!0)})))}function Ag(e){return!Mg(e,!0)&&!0!==e}function kg(e,t){return void 0===t&&(t="span"),null==e||"boolean"==typeof e?void 0:"string"==typeof e?e.trim().length>0?d.createElement(t,{},e):void 0:"number"==typeof e||"symbol"==typeof e.type||Array.isArray(e)?d.createElement(t,{},e):function(e){return"object"==typeof e&&void 0!==e.type&&void 0!==e.props}(e)?e:void 0}function Lg(e){return e.displayName||e.name||"Unknown"}function Pg(e,t){return null!=e&&null!=e.type&&null!=e.type.displayName&&e.type.displayName===t.displayName}function Tg(e){return null!=e&&e instanceof Element&&null!=e.closest(".".concat(wf))}function Hg(e,t){var n;null!=(n=e)&&"function"!=typeof n?e.current=t:function(e){return"function"==typeof e}(e)&&e(t)}function Ng(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){e.forEach((function(e){Hg(e,t)}))}}function Rg(e){var t;return null===e?null:null!==(t=e.current)&&void 0!==t?t:e}function jg(e,t,n){return function(r){e[t]=r,Hg(n,r)}}"undefined"!=typeof window&&"undefined"!=typeof document&&l("2j10E"),r(eg,tg),r(eg,ug),r(eg,gg),r(eg,bg),r(eg,Og);
|
|
63
63
|
/*! *****************************************************************************
|
|
64
64
|
Copyright (c) Microsoft Corporation.
|
|
65
65
|
|
|
@@ -196,7 +196,7 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
196
196
|
padding-top: 9px;
|
|
197
197
|
width: 72px;
|
|
198
198
|
}
|
|
199
|
-
`,E8=({children:e,name:t,onClick:n,active:r,iconSize:i})=>(0,s.jsxs)(x8,{onClick:n,className:"polotno-side-panel-tab"+(r?" active":""),children:[(0,s.jsx)("div",{style:{fontSize:(i||14)+"px"},children:
|
|
199
|
+
`,E8=({children:e,name:t,onClick:n,active:r,iconSize:i})=>(0,s.jsxs)(x8,{onClick:n,className:"polotno-side-panel-tab"+(r?" active":""),children:[(0,s.jsx)("div",{style:{fontSize:(i||14)+"px"},children:e}),(0,s.jsx)("div",{style:{paddingTop:"5px"},children:t})]});d=l("8NFma");const _8=Ch("div",n(d=l("8NFma")).forwardRef)`
|
|
200
200
|
height: 100%;
|
|
201
201
|
overflow: auto;
|
|
202
202
|
`,z8=Ch("div")`
|
|
@@ -250,14 +250,14 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
250
250
|
.bp4-dark & .polotno-text-preview-plain {
|
|
251
251
|
filter: invert(1);
|
|
252
252
|
}
|
|
253
|
-
`,T8=e=>new Promise(((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)})),H8=ei((({onSelect:e,onRemove:t,font:n})=>(0,s.jsxs)("div",{style:{height:"100px",cursor:"pointer",boxShadow:"0 0 5px rgba(16, 22, 26, 0.3)",borderRadius:"5px",backgroundColor:"rgba(0, 0, 0, 0.4)",position:"relative",fontFamily:n.fontFamily,fontSize:25,display:"flex",justifyContent:"center",alignContent:"center",flexDirection:"column",textAlign:"center",color:"white",marginBottom:"10px"},onClick:e,children:[n.fontFamily," text",(0,s.jsx)(tG,{style:{position:"absolute",right:0,bottom:0},minimal:!0,icon:"trash",onClick:e=>{e.stopPropagation(),t()}})]}))),N8=({onSelect:e,...t})=>(0,s.jsx)(tG,{...t,draggable:!0,className:"polotno-close-panel",onClick:()=>e(),onDragStart:()=>{bY((({x:t,y:n})=>{e({x:t,y:n})}))},onDragEnd:e=>{bY(null)}}),R8=ei((({store:e})=>{n(d).useEffect((()=>{e.loadFont("Roboto")}),[]);const t=t=>{const n=t.width||e.width/2,r=(t?.x||e.width/2)-n/2,i=(t?.y||e.height/2)-t.fontSize/2,o=(e.width+e.height)/2160,a=e.activePage?.addElement({type:"text",fontFamily:"Roboto",...t,x:r,y:i,width:n,fontSize:t.fontSize*o});v8()||a?.toggleEditMode(!0)};n(d).useEffect((()=>{e.fonts.forEach((t=>e.loadFont(t.fontFamily)))}),[e.fonts]);const{data:r,error:i}=N$(`https://api.polotno.dev/api/get-text-templates?KEY=${eY()}`,tX),[o,a]=n(d).useState("text");return(0,s.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,s.jsxs)(fq,{large:!0,onChange:e=>a(e),children:[(0,s.jsx)(aq,{id:"text",children:FK("sidePanel.text")}),(0,s.jsx)(aq,{id:"font",children:FK("sidePanel.myFonts")})]}),"text"===o&&(0,s.jsxs)(P8,{children:[(0,s.jsx)(N8,{style:{marginBottom:"5px",width:"100%",fontSize:"25px",fontFamily:"Roboto"},minimal:!0,onSelect:e=>{t({...e,fontSize:76,text:FK("sidePanel.headerText"),fontFamily:"Roboto"})},children:FK("sidePanel.createHeader")}),(0,s.jsx)(N8,{style:{marginBottom:"5px",width:"100%",fontSize:"18px",fontFamily:"Roboto"},minimal:!0,onSelect:e=>{t({...e,fontSize:44,text:FK("sidePanel.subHeaderText"),fontFamily:"Roboto"})},children:FK("sidePanel.createSubHeader")}),(0,s.jsx)(N8,{style:{marginBottom:"5px",width:"100%",fontSize:"14px",fontFamily:"Roboto"},minimal:!0,onSelect:e=>{t({...e,fontSize:30,text:FK("sidePanel.bodyText"),fontFamily:"Roboto"})},children:FK("sidePanel.createBody")}),(0,s.jsx)(L8,{shadowEnabled:!1,images:r?.items,getPreview:e=>e.preview,getImageClassName:e=>e.json.indexOf("plain")>=0?"polotno-text-preview-plain":"",isLoading:!r,error:i,onSelect:async(t,n)=>{const r=await fetch(t.json),i=await r.json(),o=(e.width+e.height)/2160,a=n?n.x-i.width/2*o:e.width/2-i.width/2*o,l=n?n.y-i.height/2*o:e.height/2-i.height/2*o;e.history.transaction((()=>{const t=i.pages[0].children,n=[];t.forEach((t=>{delete t.id;const{id:r}=e.activePage?.addElement({...t,fontSize:t.fontSize*o,x:t.x*o+a,y:t.y*o+l,width:t.width*o,height:t.height*o});n.push(r)})),e.selectElements(n)}))}})]}),"font"===o&&(0,s.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"calc(100% - 50px)"},children:[(0,s.jsxs)("label",{htmlFor:"polotno-font-upload",children:[(0,s.jsx)(tG,{icon:"upload",style:{width:"100%"},onClick:()=>{document.querySelector("#polotno-font-upload")?.click()},children:FK("sidePanel.uploadFont")}),(0,s.jsx)("input",{type:"file",accept:".ttf, .otf, .woff, .woff2, .eot",id:"polotno-font-upload",style:{display:"none"},onChange:async t=>{const{target:n}=t;for(const t of n.files){const n=await T8(t),r=t.name.split(".")[0];e.addFont({fontFamily:r,url:n})}n.value=null}})]}),(0,s.jsx)("div",{style:{paddingTop:"20px",overflow:"auto",height:"100%"},children:e.fonts.map(((n,r)=>(0,s.jsx)(H8,{font:n,onSelect:()=>{t({fontSize:80,text:"Cool text",fontFamily:n.fontFamily})},onRemove:()=>{e.removeFont(n.fontFamily)}},r)))})]})]})}));d=l("8NFma");var j8,V8=t6.GenIcon;j8=function(e){return V8({tag:"svg",attr:{className:"icon",viewBox:"0 0 1024 1024",fill:"currentColor"},child:[{tag:"path",attr:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-32 736H663.9V602.2h104l15.6-120.7H663.9v-77.1c0-35 9.7-58.8 59.8-58.8h63.9v-108c-11.1-1.5-49-4.8-93.2-4.8-92.2 0-155.3 56.3-155.3 159.6v89H434.9v120.7h104.3V848H176V176h672v672z"}}],content:"\n"})(e)};var I8,D8=t6.GenIcon;I8=function(e){return D8({tag:"svg",attr:{className:"icon",viewBox:"0 0 1024 1024",fill:"currentColor"},child:[{tag:"path",attr:{d:"M512 306.9c-113.5 0-205.1 91.6-205.1 205.1S398.5 717.1 512 717.1 717.1 625.5 717.1 512 625.5 306.9 512 306.9zm0 338.4c-73.4 0-133.3-59.9-133.3-133.3S438.6 378.7 512 378.7 645.3 438.6 645.3 512 585.4 645.3 512 645.3zm213.5-394.6c-26.5 0-47.9 21.4-47.9 47.9s21.4 47.9 47.9 47.9 47.9-21.3 47.9-47.9a47.84 47.84 0 0 0-47.9-47.9zM911.8 512c0-55.2.5-109.9-2.6-165-3.1-64-17.7-120.8-64.5-167.6-46.9-46.9-103.6-61.4-167.6-64.5-55.2-3.1-109.9-2.6-165-2.6-55.2 0-109.9-.5-165 2.6-64 3.1-120.8 17.7-167.6 64.5C132.6 226.3 118.1 283 115 347c-3.1 55.2-2.6 109.9-2.6 165s-.5 109.9 2.6 165c3.1 64 17.7 120.8 64.5 167.6 46.9 46.9 103.6 61.4 167.6 64.5 55.2 3.1 109.9 2.6 165 2.6 55.2 0 109.9.5 165-2.6 64-3.1 120.8-17.7 167.6-64.5 46.9-46.9 61.4-103.6 64.5-167.6 3.2-55.1 2.6-109.8 2.6-165zm-88 235.8c-7.3 18.2-16.1 31.8-30.2 45.8-14.1 14.1-27.6 22.9-45.8 30.2C695.2 844.7 570.3 840 512 840c-58.3 0-183.3 4.7-235.9-16.1-18.2-7.3-31.8-16.1-45.8-30.2-14.1-14.1-22.9-27.6-30.2-45.8C179.3 695.2 184 570.3 184 512c0-58.3-4.7-183.3 16.1-235.9 7.3-18.2 16.1-31.8 30.2-45.8s27.6-22.9 45.8-30.2C328.7 179.3 453.7 184 512 184s183.3-4.7 235.9 16.1c18.2 7.3 31.8 16.1 45.8 30.2 14.1 14.1 22.9 27.6 30.2 45.8C844.7 328.7 840 453.7 840 512c0 58.3 4.7 183.2-16.2 235.8z"}}],content:"\n"})(e)};var F8,B8=t6.GenIcon;F8=function(e){return B8({tag:"svg",attr:{className:"icon",viewBox:"0 0 1024 1024",fill:"currentColor"},child:[{tag:"path",attr:{d:"M960 509.2c0-2.2 0-4.7-.1-7.6-.1-8.1-.3-17.2-.5-26.9-.8-27.9-2.2-55.7-4.4-81.9-3-36.1-7.4-66.2-13.4-88.8a139.52 139.52 0 0 0-98.3-98.5c-28.3-7.6-83.7-12.3-161.7-15.2-37.1-1.4-76.8-2.3-116.5-2.8-13.9-.2-26.8-.3-38.4-.4h-29.4c-11.6.1-24.5.2-38.4.4-39.7.5-79.4 1.4-116.5 2.8-78 3-133.5 7.7-161.7 15.2A139.35 139.35 0 0 0 82.4 304C76.3 326.6 72 356.7 69 392.8c-2.2 26.2-3.6 54-4.4 81.9-.3 9.7-.4 18.8-.5 26.9 0 2.9-.1 5.4-.1 7.6v5.6c0 2.2 0 4.7.1 7.6.1 8.1.3 17.2.5 26.9.8 27.9 2.2 55.7 4.4 81.9 3 36.1 7.4 66.2 13.4 88.8 12.8 47.9 50.4 85.7 98.3 98.5 28.2 7.6 83.7 12.3 161.7 15.2 37.1 1.4 76.8 2.3 116.5 2.8 13.9.2 26.8.3 38.4.4h29.4c11.6-.1 24.5-.2 38.4-.4 39.7-.5 79.4-1.4 116.5-2.8 78-3 133.5-7.7 161.7-15.2 47.9-12.8 85.5-50.5 98.3-98.5 6.1-22.6 10.4-52.7 13.4-88.8 2.2-26.2 3.6-54 4.4-81.9.3-9.7.4-18.8.5-26.9 0-2.9.1-5.4.1-7.6v-5.6zm-72 5.2c0 2.1 0 4.4-.1 7.1-.1 7.8-.3 16.4-.5 25.7-.7 26.6-2.1 53.2-4.2 77.9-2.7 32.2-6.5 58.6-11.2 76.3-6.2 23.1-24.4 41.4-47.4 47.5-21 5.6-73.9 10.1-145.8 12.8-36.4 1.4-75.6 2.3-114.7 2.8-13.7.2-26.4.3-37.8.3h-28.6l-37.8-.3c-39.1-.5-78.2-1.4-114.7-2.8-71.9-2.8-124.9-7.2-145.8-12.8-23-6.2-41.2-24.4-47.4-47.5-4.7-17.7-8.5-44.1-11.2-76.3-2.1-24.7-3.4-51.3-4.2-77.9-.3-9.3-.4-18-.5-25.7 0-2.7-.1-5.1-.1-7.1v-4.8c0-2.1 0-4.4.1-7.1.1-7.8.3-16.4.5-25.7.7-26.6 2.1-53.2 4.2-77.9 2.7-32.2 6.5-58.6 11.2-76.3 6.2-23.1 24.4-41.4 47.4-47.5 21-5.6 73.9-10.1 145.8-12.8 36.4-1.4 75.6-2.3 114.7-2.8 13.7-.2 26.4-.3 37.8-.3h28.6l37.8.3c39.1.5 78.2 1.4 114.7 2.8 71.9 2.8 124.9 7.2 145.8 12.8 23 6.2 41.2 24.4 47.4 47.5 4.7 17.7 8.5 44.1 11.2 76.3 2.1 24.7 3.4 51.3 4.2 77.9.3 9.3.4 18 .5 25.7 0 2.7.1 5.1.1 7.1v4.8zM423 646l232-135-232-133z"}}],content:"\n"})(e)};var U8,G8=t6.GenIcon;U8=function(e){return G8({tag:"svg",attr:{className:"icon",viewBox:"0 0 1024 1024",fill:"currentColor"},child:[{tag:"path",attr:{d:"M912 302.3L784 376V224c0-35.3-28.7-64-64-64H128c-35.3 0-64 28.7-64 64v576c0 35.3 28.7 64 64 64h592c35.3 0 64-28.7 64-64V648l128 73.7c21.3 12.3 48-3.1 48-27.6V330c0-24.6-26.7-40-48-27.7zM712 792H136V232h576v560zm176-167l-104-59.8V458.9L888 399v226zM208 360h112c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H208c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}}],content:"\n"})(e)};const q8=[["Instagram Post",1080,1080,(0,s.jsx)(n(I8),{})],["Instagram Story",1080,1920,(0,s.jsx)(n(I8),{})],["Instagram Ad",1080,1080,(0,s.jsx)(n(I8),{})],["Facebook Post",940,788,(0,s.jsx)(n(j8),{})],["Facebook Cover",851,315,(0,s.jsx)(n(j8),{})],["Facebook Ad",1200,628,(0,s.jsx)(n(j8),{})],["Youtube Thumbnail",1280,720,(0,s.jsx)(n(F8),{})],["Youtube Channel",2560,1440,(0,s.jsx)(n(F8),{})],["Full HD",1920,1080,(0,s.jsx)(n(U8),{})]],W8=({value:e,onChange:t,...r})=>{const i=n(d).useRef(),[o,a]=n(d).useState(e),l=n(d).useRef(e);l.current=o;const c=()=>{clearTimeout(i.current),t(Math.max(10,l.current))};n(d).useEffect((()=>{a(e)}),[e]);return(0,s.jsx)(PG,{...r,value:o,onValueChange:e=>{a(e),clearTimeout(i.current),i.current=window.setTimeout(c,500)},onBlur:c})},K8=ei((({store:e})=>{const[t,r]=n(d).useState(!0);return(0,s.jsxs)("div",{style:{height:"100%",overflow:"auto",paddingRight:"3px"},children:[(0,s.jsxs)("div",{style:{paddingBottom:"15px"},children:[(0,s.jsxs)(gG,{checked:t,onChange:e=>{r(e.target.checked)},alignIndicator:Wh.RIGHT,style:{marginTop:"8px",marginBottom:"25px"},children:[FK("sidePanel.useMagicResize")," ",(0,s.jsx)(TK,{content:FK("sidePanel.magicResizeDescription"),position:$h.BOTTOM,children:(0,s.jsx)($U,{icon:"help"})})]}),(0,s.jsxs)("div",{style:{width:"50%",display:"inline-block"},children:[FK("sidePanel.width")," (",e.unit,")"]}),(0,s.jsx)("div",{style:{width:"50%",display:"inline-block"},children:(0,s.jsx)(W8,{fill:!0,value:lY({px:e.activePage?.computedWidth||e.width,unit:e.unit,dpi:e.dpi}),onChange:n=>{e.setSize(sY({unitVal:n,dpi:e.dpi,unit:e.unit}),e.activePage?.computedHeight||e.height,t),"auto"!==e.activePage?.width&&e.activePage?.set({width:sY({unitVal:n,dpi:e.dpi,unit:e.unit})})},min:10,max:1e4,selectAllOnFocus:!0,minorStepSize:.01})})]}),(0,s.jsxs)("div",{style:{paddingBottom:"15px"},children:[(0,s.jsxs)("div",{style:{width:"50%",display:"inline-block"},children:[FK("sidePanel.height")," (",e.unit,")"]}),(0,s.jsx)("div",{style:{width:"50%",display:"inline-block"},children:(0,s.jsx)(W8,{fill:!0,value:lY({px:e.activePage?.computedHeight||e.height,dpi:e.dpi,unit:e.unit}),onChange:n=>{e.setSize(e.activePage?.computedWidth||e.width,sY({unitVal:n,dpi:e.dpi,unit:e.unit}),t),"auto"!==e.activePage?.height&&e.activePage?.set({height:sY({unitVal:n,dpi:e.dpi,unit:e.unit})})},min:10,max:1e4,selectAllOnFocus:!0,minorStepSize:.01})})]}),q8.map((([n,r,i,o])=>(0,s.jsxs)(tG,{style:{width:"100%",paddingTop:"10px",paddingBottom:"10px",fontSize:"16px"},minimal:!0,onClick:()=>{e.setSize(r,i,t),"auto"!==e.activePage?.width&&e.activePage?.set({width:r}),"auto"!==e.activePage?.height&&e.activePage?.set({height:i})},icon:o,alignText:"left",children:[n,(0,s.jsxs)("span",{style:{fontSize:"0.7rem",paddingLeft:"20px",float:"right",lineHeight:"1.1rem"},children:[r," x ",i," px"]})]},n)))]})}));d=l("8NFma");function Y8(e){return new Promise((t=>{const n=document.createElement("img");n.onload=async()=>{0===n.width||0===n.height?t(await Nc(e)):t({width:n.width,height:n.height})},n.src=e}))}function $8(e,t){const{width:n,height:r}=e,i=n/r;let o,a;i>=t.width/t.height?(o=t.width,a=t.width/i):(o=t.height*i,a=t.height);const l=(t.width-o)/2,s=(t.height-a)/2;return{cropX:l/t.width,cropY:s/t.height,cropWidth:o/t.width,cropHeight:a/t.height}}async function X8(e){return new Promise(((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))}let Q8=async e=>X8(e);let Z8=[];const J8=({store:e})=>{const[t,r]=n(d).useState(Z8),[i,o]=n(d).useState(!1);return n(d).useEffect((()=>{Z8=t}),[t]),(0,s.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,s.jsx)("div",{style:{height:"45px",paddingTop:"5px"},children:FK("sidePanel.uploadTip")}),(0,s.jsx)("div",{style:{marginBottom:"20px"},children:(0,s.jsxs)("label",{htmlFor:"input-file",children:[(0,s.jsx)(tG,{icon:"upload",style:{width:"100%"},onClick:()=>{document.querySelector("#input-file")?.click()},children:FK("sidePanel.uploadImage")}),(0,s.jsx)("input",{type:"file",id:"input-file",style:{display:"none"},onChange:async e=>{const{target:t}=e;o(!0);for(const e of t.files){const t=await Q8(e);r((e=>e.concat([t])))}o(!1),t.value=null},multiple:!0})]})}),(0,s.jsx)(L8,{images:t,isLoading:i,getPreview:e=>e,onSelect:async(t,n,r)=>{let{width:i,height:o}=await Y8(t);const a=t.indexOf("svg+xml")>=0||t.indexOf(".svg")>=0?"svg":"image";if(r&&"svg"===r.type&&r.contentEditable&&"image"===a)return void r.set({maskSrc:t});if(r&&"image"===r.type&&r.contentEditable&&"image"==a){const e=$8(r,{width:i,height:o});return void r.set({src:t,...e})}const l=Math.min(e.width/i,e.height/o,1);i*=l,o*=l;const s=(n?.x||e.width/2)-i/2,c=(n?.y||e.height/2)-o/2;e.activePage?.addElement({type:a,src:t,x:s,y:c,width:i,height:o})}})]})};l("8NFma");const eee=({store:e})=>{const{setQuery:t,loadMore:n,isReachingEnd:r,data:i,isLoading:o,error:a}=nX({defaultQuery:"",getAPI:({page:e,query:t})=>$K({page:e,query:t})});return(0,s.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,s.jsx)(bG,{leftIcon:"search",placeholder:FK("sidePanel.searchPlaceholder"),onChange:e=>{t(e.target.value)},style:{marginBottom:"20px"}}),(0,s.jsxs)("p",{style:{textAlign:"center"},children:["Photos by"," ",(0,s.jsx)("a",{href:"https://unsplash.com/",target:"_blank",children:"Unsplash"})]}),(0,s.jsx)(L8,{images:i?.map((e=>e.results)).flat(),getPreview:e=>e.urls.small,onSelect:async(t,n,r)=>{if(fetch(XK(t.id)),r&&"svg"===r.type&&r.contentEditable)return void r.set({maskSrc:t.urls.regular});const{width:i,height:o}=await Y8(t.urls.small);if(r&&"image"===r.type&&r.contentEditable){const e=$8(r,{width:i,height:o});return void r.set({src:t.urls.regular,...e})}const a=(n?.x||e.width/2)-i/2,l=(n?.y||e.height/2)-o/2;e.activePage?.addElement({type:"image",src:t.urls.regular,width:i,height:o,x:a,y:l})},isLoading:o,error:a,loadMore:!r&&n,getCredit:e=>(0,s.jsxs)("span",{children:["Photo by"," ",(0,s.jsx)("a",{href:`https://unsplash.com/@${e.user.username}?utm_source=polotno&utm_medium=referral`,target:"_blank",children:e.user.name})," ","on"," ",(0,s.jsx)("a",{href:"https://unsplash.com/?utm_source=polotno&utm_medium=referral",target:"_blank",children:"Unsplash"})]})})]})};l("8NFma");var tee,nee=t6.GenIcon;tee=function(e){return nee({tag:"svg",attr:{viewBox:"0 0 512 512",fill:"currentColor"},child:[{tag:"path",attr:{d:"M430.1 347.9c-6.6-6.1-16.3-7.6-24.6-9-11.5-1.9-15.9-4-22.6-10-14.3-12.7-14.3-31.1 0-43.8l30.3-26.9c46.4-41 46.4-108.2 0-149.2-34.2-30.1-80.1-45-127.8-45-55.7 0-113.9 20.3-158.8 60.1-83.5 73.8-83.5 194.7 0 268.5 41.5 36.7 97.5 55 152.9 55.4h1.7c55.4 0 110-17.9 148.8-52.4 14.4-12.7 12-36.6.1-47.7zM120 216c0-17.7 14.3-32 32-32s32 14.3 32 32-14.3 32-32 32-32-14.3-32-32zm40 126c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm64-161c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm72 219c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48zm24-208c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"}}]})(e)};const ree=["white","rgb(82, 113, 255)","rgb(255, 145, 77)","rgb(126, 217, 87)","rgb(255, 222, 89)","rgb(203, 108, 230)","rgb(0, 0, 0, 0)"],iee=Ch("div")`
|
|
253
|
+
`,T8=e=>new Promise(((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)})),H8=ei((({onSelect:e,onRemove:t,font:n})=>(0,s.jsxs)("div",{style:{height:"100px",cursor:"pointer",boxShadow:"0 0 5px rgba(16, 22, 26, 0.3)",borderRadius:"5px",backgroundColor:"rgba(0, 0, 0, 0.4)",position:"relative",fontFamily:n.fontFamily,fontSize:25,display:"flex",justifyContent:"center",alignContent:"center",flexDirection:"column",textAlign:"center",color:"white",marginBottom:"10px"},onClick:e,children:[n.fontFamily," text",(0,s.jsx)(tG,{style:{position:"absolute",right:0,bottom:0},minimal:!0,icon:"trash",onClick:e=>{e.stopPropagation(),t()}})]}))),N8=({onSelect:e,...t})=>(0,s.jsx)(tG,{...t,draggable:!0,className:"polotno-close-panel",onClick:()=>e(),onDragStart:()=>{bY((({x:t,y:n})=>{e({x:t,y:n})}))},onDragEnd:e=>{bY(null)}}),R8=ei((({store:e})=>{n(d).useEffect((()=>{e.loadFont("Roboto")}),[]);const t=t=>{const n=t.width||e.width/2,r=(t?.x||e.width/2)-n/2,i=(t?.y||e.height/2)-t.fontSize/2,o=(e.width+e.height)/2160,a=e.activePage?.addElement({type:"text",fontFamily:"Roboto",...t,x:r,y:i,width:n,fontSize:t.fontSize*o});v8()||a?.toggleEditMode(!0)};n(d).useEffect((()=>{e.fonts.forEach((t=>e.loadFont(t.fontFamily)))}),[e.fonts]);const{data:r,error:i}=N$(`https://api.polotno.dev/api/get-text-templates?KEY=${eY()}`,tX),[o,a]=n(d).useState("text");return(0,s.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,s.jsxs)(fq,{large:!0,onChange:e=>a(e),children:[(0,s.jsx)(aq,{id:"text",children:FK("sidePanel.text")}),(0,s.jsx)(aq,{id:"font",children:FK("sidePanel.myFonts")})]}),"text"===o&&(0,s.jsxs)(P8,{children:[(0,s.jsx)(N8,{style:{marginBottom:"5px",width:"100%",fontSize:"25px",fontFamily:"Roboto"},minimal:!0,onSelect:e=>{t({...e,fontSize:76,text:FK("sidePanel.headerText"),fontFamily:"Roboto"})},children:FK("sidePanel.createHeader")}),(0,s.jsx)(N8,{style:{marginBottom:"5px",width:"100%",fontSize:"18px",fontFamily:"Roboto"},minimal:!0,onSelect:e=>{t({...e,fontSize:44,text:FK("sidePanel.subHeaderText"),fontFamily:"Roboto"})},children:FK("sidePanel.createSubHeader")}),(0,s.jsx)(N8,{style:{marginBottom:"5px",width:"100%",fontSize:"14px",fontFamily:"Roboto"},minimal:!0,onSelect:e=>{t({...e,fontSize:30,text:FK("sidePanel.bodyText"),fontFamily:"Roboto"})},children:FK("sidePanel.createBody")}),(0,s.jsx)(L8,{shadowEnabled:!1,images:r?.items,getPreview:e=>e.preview,getImageClassName:e=>e.json.indexOf("plain")>=0?"polotno-text-preview-plain":"",isLoading:!r,error:i,onSelect:async(t,n)=>{const r=await fetch(t.json),i=await r.json();if(!e.activePage)return;const o=(e.width+e.height)/2160,a=n?n.x-i.width/2*o:e.width/2-i.width/2*o,l=n?n.y-i.height/2*o:e.height/2-i.height/2*o;e.history.transaction((()=>{const t=i.pages[0].children,n=[];t.forEach((t=>{delete t.id;const{id:r}=e.activePage?.addElement({...t,fontSize:t.fontSize*o,x:t.x*o+a,y:t.y*o+l,width:t.width*o,height:t.height*o});n.push(r)})),e.selectElements(n)}))}})]}),"font"===o&&(0,s.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"calc(100% - 50px)"},children:[(0,s.jsxs)("label",{htmlFor:"polotno-font-upload",children:[(0,s.jsx)(tG,{icon:"upload",style:{width:"100%"},onClick:()=>{document.querySelector("#polotno-font-upload")?.click()},children:FK("sidePanel.uploadFont")}),(0,s.jsx)("input",{type:"file",accept:".ttf, .otf, .woff, .woff2, .eot",id:"polotno-font-upload",style:{display:"none"},onChange:async t=>{const{target:n}=t;for(const t of n.files){const n=await T8(t),r=t.name.split(".")[0];e.addFont({fontFamily:r,url:n})}n.value=null}})]}),(0,s.jsx)("div",{style:{paddingTop:"20px",overflow:"auto",height:"100%"},children:e.fonts.map(((n,r)=>(0,s.jsx)(H8,{font:n,onSelect:()=>{t({fontSize:80,text:"Cool text",fontFamily:n.fontFamily})},onRemove:()=>{e.removeFont(n.fontFamily)}},r)))})]})]})}));d=l("8NFma");var j8,V8=t6.GenIcon;j8=function(e){return V8({tag:"svg",attr:{className:"icon",viewBox:"0 0 1024 1024",fill:"currentColor"},child:[{tag:"path",attr:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-32 736H663.9V602.2h104l15.6-120.7H663.9v-77.1c0-35 9.7-58.8 59.8-58.8h63.9v-108c-11.1-1.5-49-4.8-93.2-4.8-92.2 0-155.3 56.3-155.3 159.6v89H434.9v120.7h104.3V848H176V176h672v672z"}}],content:"\n"})(e)};var I8,D8=t6.GenIcon;I8=function(e){return D8({tag:"svg",attr:{className:"icon",viewBox:"0 0 1024 1024",fill:"currentColor"},child:[{tag:"path",attr:{d:"M512 306.9c-113.5 0-205.1 91.6-205.1 205.1S398.5 717.1 512 717.1 717.1 625.5 717.1 512 625.5 306.9 512 306.9zm0 338.4c-73.4 0-133.3-59.9-133.3-133.3S438.6 378.7 512 378.7 645.3 438.6 645.3 512 585.4 645.3 512 645.3zm213.5-394.6c-26.5 0-47.9 21.4-47.9 47.9s21.4 47.9 47.9 47.9 47.9-21.3 47.9-47.9a47.84 47.84 0 0 0-47.9-47.9zM911.8 512c0-55.2.5-109.9-2.6-165-3.1-64-17.7-120.8-64.5-167.6-46.9-46.9-103.6-61.4-167.6-64.5-55.2-3.1-109.9-2.6-165-2.6-55.2 0-109.9-.5-165 2.6-64 3.1-120.8 17.7-167.6 64.5C132.6 226.3 118.1 283 115 347c-3.1 55.2-2.6 109.9-2.6 165s-.5 109.9 2.6 165c3.1 64 17.7 120.8 64.5 167.6 46.9 46.9 103.6 61.4 167.6 64.5 55.2 3.1 109.9 2.6 165 2.6 55.2 0 109.9.5 165-2.6 64-3.1 120.8-17.7 167.6-64.5 46.9-46.9 61.4-103.6 64.5-167.6 3.2-55.1 2.6-109.8 2.6-165zm-88 235.8c-7.3 18.2-16.1 31.8-30.2 45.8-14.1 14.1-27.6 22.9-45.8 30.2C695.2 844.7 570.3 840 512 840c-58.3 0-183.3 4.7-235.9-16.1-18.2-7.3-31.8-16.1-45.8-30.2-14.1-14.1-22.9-27.6-30.2-45.8C179.3 695.2 184 570.3 184 512c0-58.3-4.7-183.3 16.1-235.9 7.3-18.2 16.1-31.8 30.2-45.8s27.6-22.9 45.8-30.2C328.7 179.3 453.7 184 512 184s183.3-4.7 235.9 16.1c18.2 7.3 31.8 16.1 45.8 30.2 14.1 14.1 22.9 27.6 30.2 45.8C844.7 328.7 840 453.7 840 512c0 58.3 4.7 183.2-16.2 235.8z"}}],content:"\n"})(e)};var F8,B8=t6.GenIcon;F8=function(e){return B8({tag:"svg",attr:{className:"icon",viewBox:"0 0 1024 1024",fill:"currentColor"},child:[{tag:"path",attr:{d:"M960 509.2c0-2.2 0-4.7-.1-7.6-.1-8.1-.3-17.2-.5-26.9-.8-27.9-2.2-55.7-4.4-81.9-3-36.1-7.4-66.2-13.4-88.8a139.52 139.52 0 0 0-98.3-98.5c-28.3-7.6-83.7-12.3-161.7-15.2-37.1-1.4-76.8-2.3-116.5-2.8-13.9-.2-26.8-.3-38.4-.4h-29.4c-11.6.1-24.5.2-38.4.4-39.7.5-79.4 1.4-116.5 2.8-78 3-133.5 7.7-161.7 15.2A139.35 139.35 0 0 0 82.4 304C76.3 326.6 72 356.7 69 392.8c-2.2 26.2-3.6 54-4.4 81.9-.3 9.7-.4 18.8-.5 26.9 0 2.9-.1 5.4-.1 7.6v5.6c0 2.2 0 4.7.1 7.6.1 8.1.3 17.2.5 26.9.8 27.9 2.2 55.7 4.4 81.9 3 36.1 7.4 66.2 13.4 88.8 12.8 47.9 50.4 85.7 98.3 98.5 28.2 7.6 83.7 12.3 161.7 15.2 37.1 1.4 76.8 2.3 116.5 2.8 13.9.2 26.8.3 38.4.4h29.4c11.6-.1 24.5-.2 38.4-.4 39.7-.5 79.4-1.4 116.5-2.8 78-3 133.5-7.7 161.7-15.2 47.9-12.8 85.5-50.5 98.3-98.5 6.1-22.6 10.4-52.7 13.4-88.8 2.2-26.2 3.6-54 4.4-81.9.3-9.7.4-18.8.5-26.9 0-2.9.1-5.4.1-7.6v-5.6zm-72 5.2c0 2.1 0 4.4-.1 7.1-.1 7.8-.3 16.4-.5 25.7-.7 26.6-2.1 53.2-4.2 77.9-2.7 32.2-6.5 58.6-11.2 76.3-6.2 23.1-24.4 41.4-47.4 47.5-21 5.6-73.9 10.1-145.8 12.8-36.4 1.4-75.6 2.3-114.7 2.8-13.7.2-26.4.3-37.8.3h-28.6l-37.8-.3c-39.1-.5-78.2-1.4-114.7-2.8-71.9-2.8-124.9-7.2-145.8-12.8-23-6.2-41.2-24.4-47.4-47.5-4.7-17.7-8.5-44.1-11.2-76.3-2.1-24.7-3.4-51.3-4.2-77.9-.3-9.3-.4-18-.5-25.7 0-2.7-.1-5.1-.1-7.1v-4.8c0-2.1 0-4.4.1-7.1.1-7.8.3-16.4.5-25.7.7-26.6 2.1-53.2 4.2-77.9 2.7-32.2 6.5-58.6 11.2-76.3 6.2-23.1 24.4-41.4 47.4-47.5 21-5.6 73.9-10.1 145.8-12.8 36.4-1.4 75.6-2.3 114.7-2.8 13.7-.2 26.4-.3 37.8-.3h28.6l37.8.3c39.1.5 78.2 1.4 114.7 2.8 71.9 2.8 124.9 7.2 145.8 12.8 23 6.2 41.2 24.4 47.4 47.5 4.7 17.7 8.5 44.1 11.2 76.3 2.1 24.7 3.4 51.3 4.2 77.9.3 9.3.4 18 .5 25.7 0 2.7.1 5.1.1 7.1v4.8zM423 646l232-135-232-133z"}}],content:"\n"})(e)};var U8,G8=t6.GenIcon;U8=function(e){return G8({tag:"svg",attr:{className:"icon",viewBox:"0 0 1024 1024",fill:"currentColor"},child:[{tag:"path",attr:{d:"M912 302.3L784 376V224c0-35.3-28.7-64-64-64H128c-35.3 0-64 28.7-64 64v576c0 35.3 28.7 64 64 64h592c35.3 0 64-28.7 64-64V648l128 73.7c21.3 12.3 48-3.1 48-27.6V330c0-24.6-26.7-40-48-27.7zM712 792H136V232h576v560zm176-167l-104-59.8V458.9L888 399v226zM208 360h112c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H208c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}}],content:"\n"})(e)};const q8=[["Instagram Post",1080,1080,(0,s.jsx)(n(I8),{})],["Instagram Story",1080,1920,(0,s.jsx)(n(I8),{})],["Instagram Ad",1080,1080,(0,s.jsx)(n(I8),{})],["Facebook Post",940,788,(0,s.jsx)(n(j8),{})],["Facebook Cover",851,315,(0,s.jsx)(n(j8),{})],["Facebook Ad",1200,628,(0,s.jsx)(n(j8),{})],["Youtube Thumbnail",1280,720,(0,s.jsx)(n(F8),{})],["Youtube Channel",2560,1440,(0,s.jsx)(n(F8),{})],["Full HD",1920,1080,(0,s.jsx)(n(U8),{})]],W8=({value:e,onChange:t,...r})=>{const i=n(d).useRef(),[o,a]=n(d).useState(e),l=n(d).useRef(e);l.current=o;const c=()=>{clearTimeout(i.current),t(Math.max(10,l.current))};n(d).useEffect((()=>{a(e)}),[e]);return(0,s.jsx)(PG,{...r,value:o,onValueChange:e=>{a(e),clearTimeout(i.current),i.current=window.setTimeout(c,500)},onBlur:c})},K8=ei((({store:e})=>{const[t,r]=n(d).useState(!0);return(0,s.jsxs)("div",{style:{height:"100%",overflow:"auto",paddingRight:"3px"},children:[(0,s.jsxs)("div",{style:{paddingBottom:"15px"},children:[(0,s.jsxs)(gG,{checked:t,onChange:e=>{r(e.target.checked)},alignIndicator:Wh.RIGHT,style:{marginTop:"8px",marginBottom:"25px"},children:[FK("sidePanel.useMagicResize")," ",(0,s.jsx)(TK,{content:FK("sidePanel.magicResizeDescription"),position:$h.BOTTOM,children:(0,s.jsx)($U,{icon:"help"})})]}),(0,s.jsxs)("div",{style:{width:"50%",display:"inline-block"},children:[FK("sidePanel.width")," (",e.unit,")"]}),(0,s.jsx)("div",{style:{width:"50%",display:"inline-block"},children:(0,s.jsx)(W8,{fill:!0,value:lY({px:e.activePage?.computedWidth||e.width,unit:e.unit,dpi:e.dpi}),onChange:n=>{e.setSize(sY({unitVal:n,dpi:e.dpi,unit:e.unit}),e.activePage?.computedHeight||e.height,t),"auto"!==e.activePage?.width&&e.activePage?.set({width:sY({unitVal:n,dpi:e.dpi,unit:e.unit})})},min:10,max:1e4,selectAllOnFocus:!0,minorStepSize:.01})})]}),(0,s.jsxs)("div",{style:{paddingBottom:"15px"},children:[(0,s.jsxs)("div",{style:{width:"50%",display:"inline-block"},children:[FK("sidePanel.height")," (",e.unit,")"]}),(0,s.jsx)("div",{style:{width:"50%",display:"inline-block"},children:(0,s.jsx)(W8,{fill:!0,value:lY({px:e.activePage?.computedHeight||e.height,dpi:e.dpi,unit:e.unit}),onChange:n=>{e.setSize(e.activePage?.computedWidth||e.width,sY({unitVal:n,dpi:e.dpi,unit:e.unit}),t),"auto"!==e.activePage?.height&&e.activePage?.set({height:sY({unitVal:n,dpi:e.dpi,unit:e.unit})})},min:10,max:1e4,selectAllOnFocus:!0,minorStepSize:.01})})]}),q8.map((([n,r,i,o])=>(0,s.jsxs)(tG,{style:{width:"100%",paddingTop:"10px",paddingBottom:"10px",fontSize:"16px"},minimal:!0,onClick:()=>{e.setSize(r,i,t),"auto"!==e.activePage?.width&&e.activePage?.set({width:r}),"auto"!==e.activePage?.height&&e.activePage?.set({height:i})},icon:o,alignText:"left",children:[n,(0,s.jsxs)("span",{style:{fontSize:"0.7rem",paddingLeft:"20px",float:"right",lineHeight:"1.1rem"},children:[r," x ",i," px"]})]},n)))]})}));d=l("8NFma");function Y8(e){return new Promise((t=>{const n=document.createElement("img");n.onload=async()=>{0===n.width||0===n.height?t(await Nc(e)):t({width:n.width,height:n.height})},n.src=e}))}function $8(e,t){const{width:n,height:r}=e,i=n/r;let o,a;i>=t.width/t.height?(o=t.width,a=t.width/i):(o=t.height*i,a=t.height);const l=(t.width-o)/2,s=(t.height-a)/2;return{cropX:l/t.width,cropY:s/t.height,cropWidth:o/t.width,cropHeight:a/t.height}}async function X8(e){return new Promise(((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))}let Q8=async e=>X8(e);let Z8=[];const J8=({store:e})=>{const[t,r]=n(d).useState(Z8),[i,o]=n(d).useState(!1);return n(d).useEffect((()=>{Z8=t}),[t]),(0,s.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,s.jsx)("div",{style:{height:"45px",paddingTop:"5px"},children:FK("sidePanel.uploadTip")}),(0,s.jsx)("div",{style:{marginBottom:"20px"},children:(0,s.jsxs)("label",{htmlFor:"input-file",children:[(0,s.jsx)(tG,{icon:"upload",style:{width:"100%"},onClick:()=>{document.querySelector("#input-file")?.click()},children:FK("sidePanel.uploadImage")}),(0,s.jsx)("input",{type:"file",id:"input-file",style:{display:"none"},onChange:async e=>{const{target:t}=e;o(!0);for(const e of t.files){const t=await Q8(e);r((e=>e.concat([t])))}o(!1),t.value=null},multiple:!0})]})}),(0,s.jsx)(L8,{images:t,isLoading:i,getPreview:e=>e,onSelect:async(t,n,r)=>{let{width:i,height:o}=await Y8(t);const a=t.indexOf("svg+xml")>=0||t.indexOf(".svg")>=0?"svg":"image";if(r&&"svg"===r.type&&r.contentEditable&&"image"===a)return void r.set({maskSrc:t});if(r&&"image"===r.type&&r.contentEditable&&"image"==a){const e=$8(r,{width:i,height:o});return void r.set({src:t,...e})}const l=Math.min(e.width/i,e.height/o,1);i*=l,o*=l;const s=(n?.x||e.width/2)-i/2,c=(n?.y||e.height/2)-o/2;e.activePage?.addElement({type:a,src:t,x:s,y:c,width:i,height:o})}})]})};l("8NFma");const eee=({store:e})=>{const{setQuery:t,loadMore:n,isReachingEnd:r,data:i,isLoading:o,error:a}=nX({defaultQuery:"",getAPI:({page:e,query:t})=>$K({page:e,query:t})});return(0,s.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,s.jsx)(bG,{leftIcon:"search",placeholder:FK("sidePanel.searchPlaceholder"),onChange:e=>{t(e.target.value)},style:{marginBottom:"20px"}}),(0,s.jsxs)("p",{style:{textAlign:"center"},children:["Photos by"," ",(0,s.jsx)("a",{href:"https://unsplash.com/",target:"_blank",children:"Unsplash"})]}),(0,s.jsx)(L8,{images:i?.map((e=>e.results)).flat().filter(Boolean),getPreview:e=>e.urls.small,onSelect:async(t,n,r)=>{if(fetch(XK(t.id)),r&&"svg"===r.type&&r.contentEditable)return void r.set({maskSrc:t.urls.regular});const{width:i,height:o}=await Y8(t.urls.small);if(r&&"image"===r.type&&r.contentEditable){const e=$8(r,{width:i,height:o});return void r.set({src:t.urls.regular,...e})}const a=(n?.x||e.width/2)-i/2,l=(n?.y||e.height/2)-o/2;e.activePage?.addElement({type:"image",src:t.urls.regular,width:i,height:o,x:a,y:l})},isLoading:o,error:a,loadMore:!r&&n,getCredit:e=>(0,s.jsxs)("span",{children:["Photo by"," ",(0,s.jsx)("a",{href:`https://unsplash.com/@${e.user.username}?utm_source=polotno&utm_medium=referral`,target:"_blank",children:e.user.name})," ","on"," ",(0,s.jsx)("a",{href:"https://unsplash.com/?utm_source=polotno&utm_medium=referral",target:"_blank",children:"Unsplash"})]})})]})};l("8NFma");var tee,nee=t6.GenIcon;tee=function(e){return nee({tag:"svg",attr:{viewBox:"0 0 512 512",fill:"currentColor"},child:[{tag:"path",attr:{d:"M430.1 347.9c-6.6-6.1-16.3-7.6-24.6-9-11.5-1.9-15.9-4-22.6-10-14.3-12.7-14.3-31.1 0-43.8l30.3-26.9c46.4-41 46.4-108.2 0-149.2-34.2-30.1-80.1-45-127.8-45-55.7 0-113.9 20.3-158.8 60.1-83.5 73.8-83.5 194.7 0 268.5 41.5 36.7 97.5 55 152.9 55.4h1.7c55.4 0 110-17.9 148.8-52.4 14.4-12.7 12-36.6.1-47.7zM120 216c0-17.7 14.3-32 32-32s32 14.3 32 32-14.3 32-32 32-32-14.3-32-32zm40 126c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm64-161c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm72 219c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48zm24-208c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"}}]})(e)};const ree=["white","rgb(82, 113, 255)","rgb(255, 145, 77)","rgb(126, 217, 87)","rgb(255, 222, 89)","rgb(203, 108, 230)","rgb(0, 0, 0, 0)"],iee=Ch("div")`
|
|
254
254
|
display: inline-block;
|
|
255
255
|
width: 30px;
|
|
256
256
|
height: 30px;
|
|
257
257
|
border-radius: 2px;
|
|
258
258
|
box-shadow: 0 0 2px rgba(16, 22, 26, 0.3);
|
|
259
259
|
cursor: pointer;
|
|
260
|
-
`,oee=({children:e,color:t,...n})=>(0,s.jsx)(iee,{...n,style:{...n.style,background:"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 8 8'%3E%3Cg fill='rgba(112, 112, 116, 1)' fill-opacity='1'%3E%3Cpath fill-rule='evenodd' d='M0 0h4v4H0V0zm4 4h4v4H4V4z'/%3E%3C/g%3E%3C/svg%3E\")"},children:(0,s.jsx)("div",{style:{width:"100%",height:"100%",background:t},children:e})}),aee=ei((({store:e})=>{const{setQuery:t,loadMore:r,isReachingEnd:i,data:o,isLoading:a,error:l}=nX({defaultQuery:"pattern",getAPI:({page:e,query:t})=>$K({page:e,query:t})});return(0,s.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-around",paddingBottom:"10px"},children:[(0,s.jsx)(W7,{value:e.activePage?.background||"white",onChange:t=>{e.activePage?.set({background:t})},store:e,children:(0,s.jsx)(oee,{color:e.activePage?.background,style:{fontSize:"30px"},children:(0,s.jsx)(n(tee),{style:{mixBlendMode:"difference"}})})}),ree.map((t=>(0,s.jsx)(oee,{color:t,onClick:()=>{e.activePage?.set({background:t})}},t)))]}),(0,s.jsx)(bG,{leftIcon:"search",placeholder:FK("sidePanel.searchPlaceholder"),onChange:e=>{t(e.target.value)},style:{marginBottom:"20px"}}),(0,s.jsxs)("p",{style:{textAlign:"center"},children:["Photos by"," ",(0,s.jsx)("a",{href:"https://unsplash.com/",target:"_blank",children:"Unsplash"})]}),(0,s.jsx)(L8,{images:o?.map((e=>e.results)).flat(),isLoading:a,getPreview:e=>e.urls.small,loadMore:!i&&r,onSelect:async t=>{fetch(XK(t.id)),e.activePage?.set({background:t.urls.regular})},error:l,getCredit:e=>(0,s.jsxs)("span",{children:["Photo by"," ",(0,s.jsx)("a",{href:`https://unsplash.com/@${e.user.username}?utm_source=polotno&utm_medium=referral`,target:"_blank",children:e.user.name})," ","on"," ",(0,s.jsx)("a",{href:"https://unsplash.com/?utm_source=polotno&utm_medium=referral",target:"_blank",children:"Unsplash"})]})})]})}));d=l("8NFma");var lee,see,cee="warn";function uee(e){cee=e}(see=lee||(lee={})).afterCreate="afterCreate",see.afterAttach="afterAttach",see.afterCreationFinalization="afterCreationFinalization",see.beforeDetach="beforeDetach",see.beforeDestroy="beforeDestroy";
|
|
260
|
+
`,oee=({children:e,color:t,...n})=>(0,s.jsx)(iee,{...n,style:{...n.style,background:"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 8 8'%3E%3Cg fill='rgba(112, 112, 116, 1)' fill-opacity='1'%3E%3Cpath fill-rule='evenodd' d='M0 0h4v4H0V0zm4 4h4v4H4V4z'/%3E%3C/g%3E%3C/svg%3E\")"},children:(0,s.jsx)("div",{style:{width:"100%",height:"100%",background:t},children:e})}),aee=ei((({store:e})=>{const{setQuery:t,loadMore:r,isReachingEnd:i,data:o,isLoading:a,error:l}=nX({defaultQuery:"pattern",getAPI:({page:e,query:t})=>$K({page:e,query:t})});return(0,s.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-around",paddingBottom:"10px"},children:[(0,s.jsx)(W7,{value:e.activePage?.background||"white",onChange:t=>{e.activePage?.set({background:t})},store:e,children:(0,s.jsx)(oee,{color:e.activePage?.background,style:{fontSize:"30px"},children:(0,s.jsx)(n(tee),{style:{mixBlendMode:"difference"}})})}),ree.map((t=>(0,s.jsx)(oee,{color:t,onClick:()=>{e.activePage?.set({background:t})}},t)))]}),(0,s.jsx)(bG,{leftIcon:"search",placeholder:FK("sidePanel.searchPlaceholder"),onChange:e=>{t(e.target.value)},style:{marginBottom:"20px"}}),(0,s.jsxs)("p",{style:{textAlign:"center"},children:["Photos by"," ",(0,s.jsx)("a",{href:"https://unsplash.com/",target:"_blank",children:"Unsplash"})]}),(0,s.jsx)(L8,{images:o?.map((e=>e.results)).flat().filter(Boolean),isLoading:a,getPreview:e=>e.urls.small,loadMore:!i&&r,onSelect:async t=>{fetch(XK(t.id)),e.activePage?.set({background:t.urls.regular})},error:l,getCredit:e=>(0,s.jsxs)("span",{children:["Photo by"," ",(0,s.jsx)("a",{href:`https://unsplash.com/@${e.user.username}?utm_source=polotno&utm_medium=referral`,target:"_blank",children:e.user.name})," ","on"," ",(0,s.jsx)("a",{href:"https://unsplash.com/?utm_source=polotno&utm_medium=referral",target:"_blank",children:"Unsplash"})]})})]})}));d=l("8NFma");var lee,see,cee="warn";function uee(e){cee=e}(see=lee||(lee={})).afterCreate="afterCreate",see.afterAttach="afterAttach",see.afterCreationFinalization="afterCreationFinalization",see.beforeDetach="beforeDetach",see.beforeDestroy="beforeDestroy";
|
|
261
261
|
/*! *****************************************************************************
|
|
262
262
|
Copyright (c) Microsoft Corporation.
|
|
263
263
|
|
|
@@ -290,7 +290,7 @@ function are(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Ob
|
|
|
290
290
|
Copyright (c) 2018 Jed Watson.
|
|
291
291
|
Licensed under the MIT License (MIT), see
|
|
292
292
|
http://jedwatson.github.io/classnames
|
|
293
|
-
*/!function(){"use strict";var e={}.hasOwnProperty;function t(){for(var n=[],r=0;r<arguments.length;r++){var i=arguments[r];if(i){var o=typeof i;if("string"===o||"number"===o)n.push(i);else if(Array.isArray(i)){if(i.length){var a=t.apply(null,i);a&&n.push(a)}}else if("object"===o)if(i.toString===Object.prototype.toString)for(var l in i)e.call(i,l)&&i[l]&&n.push(l);else n.push(i.toString())}}return n.join(" ")}Aoe?(t.default=t,Aoe=t):"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],(function(){return t})):window.classNames=t}();d=l("8NFma");var koe={};i(koe),e(koe,"default",(()=>Poe));var Loe="Invariant failed";function Poe(e,t){if(!e)throw new Error(Loe)}function Toe(e){return e&&e.__esModule?e.default:e}function Hoe(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}function Noe(e){null!==e.parentElement&&e.parentElement.removeChild(e)}function Roe(e){e.forEach((e=>Noe(e.element)))}function joe(e){e.forEach((e=>{!function(e,t,n){const r=e.children[n]||null;e.insertBefore(t,r)}(e.parentElement,e.element,e.oldIndex)}))}function Voe(e,t){const n=Foe(e),r={parentElement:e.from};let i=[];switch(n){case"normal":i=[{element:e.item,newIndex:e.newIndex,oldIndex:e.oldIndex,parentElement:e.from}];break;case"swap":i=[{element:e.item,oldIndex:e.oldIndex,newIndex:e.newIndex,...r},{element:e.swapItem,oldIndex:e.newIndex,newIndex:e.oldIndex,...r}];break;case"multidrag":i=e.oldIndicies.map(((t,n)=>({element:t.multiDragElement,oldIndex:t.index,newIndex:e.newIndicies[n].index,...r})))}const o=function(e,t){return e.map((e=>({...e,item:t[e.oldIndex]}))).sort(((e,t)=>e.oldIndex-t.oldIndex))}(i,t);return o}function Ioe(e,t){const n=[...t];return e.concat().reverse().forEach((e=>n.splice(e.oldIndex,1))),n}function Doe(e,t,n,r){const i=[...t];return e.forEach((e=>{const t=r&&n&&r(e.item,n);i.splice(e.newIndex,0,t||e.item)})),i}function Foe(e){return e.oldIndicies&&e.oldIndicies.length>0?"multidrag":e.swapItem?"swap":"normal"}Hoe(ire,"Sortable",(()=>$882b6d93070905b3$re_export$Sortable)),Hoe(ire,"Direction",(()=>$882b6d93070905b3$re_export$Direction)),Hoe(ire,"DOMRect",(()=>$882b6d93070905b3$re_export$DOMRect)),Hoe(ire,"GroupOptions",(()=>$882b6d93070905b3$re_export$GroupOptions)),Hoe(ire,"MoveEvent",(()=>$882b6d93070905b3$re_export$MoveEvent)),Hoe(ire,"Options",(()=>$882b6d93070905b3$re_export$Options)),Hoe(ire,"PullResult",(()=>$882b6d93070905b3$re_export$PullResult)),Hoe(ire,"PutResult",(()=>$882b6d93070905b3$re_export$PutResult)),Hoe(ire,"SortableEvent",(()=>$882b6d93070905b3$re_export$SortableEvent)),Hoe(ire,"SortableOptions",(()=>$882b6d93070905b3$re_export$SortableOptions)),Hoe(ire,"Utils",(()=>$882b6d93070905b3$re_export$Utils)),Hoe(ire,"ReactSortable",(()=>Uoe));const Boe={dragging:null};class Uoe extends d.Component{constructor(e){super(e),this.ref=d.createRef();const t=[...e.list].map((e=>Object.assign(e,{chosen:!1,selected:!1})));e.setList(t,this.sortable,Boe),Toe(koe)(!e.plugins,'\nPlugins prop is no longer supported.\nInstead, mount it with "Sortable.mount(new MultiDrag())"\nPlease read the updated README.md at https://github.com/SortableJS/react-sortablejs.\n ')}componentDidMount(){if(null===this.ref.current)return;const e=this.makeOptions();Toe(ore).create(this.ref.current,e)}componentDidUpdate(e){e.disabled!==this.props.disabled&&this.sortable&&this.sortable.option("disabled",this.props.disabled)}render(){const{tag:e,style:t,className:n,id:r}=this.props,i={style:t,className:n,id:r},o=e&&null!==e?e:"div";return d.createElement(o,{ref:this.ref,...i},this.getChildren())}getChildren(){const{children:e,dataIdAttr:t,selectedClass:n="sortable-selected",chosenClass:r="sortable-chosen",dragClass:i="sortable-drag",fallbackClass:o="sortable-falback",ghostClass:a="sortable-ghost",swapClass:l="sortable-swap-highlight",filter:s="sortable-filter",list:c}=this.props;if(!e||null==e)return null;const u=t||"data-id";return d.Children.map(e,((e,t)=>{if(void 0===e)return;const i=c[t]||{},{className:o}=e.props,a="string"==typeof s&&{[s.replace(".","")]:!!i.filtered},l=Toe(Aoe)(o,{[n]:i.selected,[r]:i.chosen,...a});return d.cloneElement(e,{[u]:e.key,className:l})}))}get sortable(){const e=this.ref.current;if(null===e)return null;const t=Object.keys(e).find((e=>e.includes("Sortable")));return t?e[t]:null}makeOptions(){const e=function(e){const{list:t,setList:n,children:r,tag:i,style:o,className:a,clone:l,onAdd:s,onChange:c,onChoose:u,onClone:h,onEnd:f,onFilter:d,onRemove:p,onSort:v,onStart:m,onUnchoose:g,onUpdate:y,onMove:b,onSpill:w,onSelect:x,onDeselect:E,..._}=e;return _}(this.props);["onAdd","onChoose","onDeselect","onEnd","onRemove","onSelect","onSpill","onStart","onUnchoose","onUpdate"].forEach((t=>e[t]=this.prepareOnHandlerPropAndDOM(t))),["onChange","onClone","onFilter","onSort"].forEach((t=>e[t]=this.prepareOnHandlerProp(t)));return{...e,onMove:(e,t)=>{const{onMove:n}=this.props,r=e.willInsertAfter||-1;if(!n)return r;const i=n(e,t,this.sortable,Boe);return void 0!==i&&i}}}prepareOnHandlerPropAndDOM(e){return t=>{this.callOnHandlerProp(t,e),this[e](t)}}prepareOnHandlerProp(e){return t=>{this.callOnHandlerProp(t,e)}}callOnHandlerProp(e,t){const n=this.props[t];n&&n(e,this.sortable,Boe)}onAdd(e){const{list:t,setList:n,clone:r}=this.props,i=Voe(e,[...Boe.dragging.props.list]);Roe(i);n(Doe(i,t,e,r).map((e=>Object.assign(e,{selected:!1}))),this.sortable,Boe)}onRemove(e){const{list:t,setList:n}=this.props,r=Foe(e),i=Voe(e,t);joe(i);let o=[...t];if("clone"!==e.pullMode)o=Ioe(i,o);else{let t=i;switch(r){case"multidrag":t=i.map(((t,n)=>({...t,element:e.clones[n]})));break;case"normal":t=i.map((t=>({...t,element:e.clone})));break;default:Toe(koe)(!0,`mode "${r}" cannot clone. Please remove "props.clone" from <ReactSortable/> when using the "${r}" plugin`)}Roe(t),i.forEach((t=>{const n=t.oldIndex,r=this.props.clone(t.item,e);o.splice(n,1,r)}))}o=o.map((e=>Object.assign(e,{selected:!1}))),n(o,this.sortable,Boe)}onUpdate(e){const{list:t,setList:n}=this.props,r=Voe(e,t);Roe(r),joe(r);const i=function(e,t){return Doe(e,Ioe(e,t))}(r,t);return n(i,this.sortable,Boe)}onStart(){Boe.dragging=this}onEnd(){Boe.dragging=null}onChoose(e){const{list:t,setList:n}=this.props;n(t.map(((t,n)=>{let r=t;return n===e.oldIndex&&(r=Object.assign(t,{chosen:!0})),r})),this.sortable,Boe)}onUnchoose(e){const{list:t,setList:n}=this.props;n(t.map(((t,n)=>{let r=t;return n===e.oldIndex&&(r=Object.assign(r,{chosen:!1})),r})),this.sortable,Boe)}onSpill(e){const{removeOnSpill:t,revertOnSpill:n}=this.props;t&&!n&&Noe(e.item)}onSelect(e){const{list:t,setList:n}=this.props,r=t.map((e=>Object.assign(e,{selected:!1})));e.newIndicies.forEach((t=>{const n=t.index;if(-1===n)return console.log(`"${e.type}" had indice of "${t.index}", which is probably -1 and doesn't usually happen here.`),void console.log(e);r[n].selected=!0})),n(r,this.sortable,Boe)}onDeselect(e){const{list:t,setList:n}=this.props,r=t.map((e=>Object.assign(e,{selected:!1})));e.newIndicies.forEach((e=>{const t=e.index;-1!==t&&(r[t].selected=!0)})),n(r,this.sortable,Boe)}}Uoe.defaultProps={clone:e=>e};var Goe,qoe;Goe=ire,qoe={},Object.keys(qoe).forEach((function(e){"default"===e||"__esModule"===e||Goe.hasOwnProperty(e)||Object.defineProperty(Goe,e,{enumerable:!0,get:function(){return qoe[e]}})}));const Woe=ei((({element:e,store:t})=>{const r=t.selectedElements.indexOf(e)>=0,[i,o]=n(d).useState(!1),a=()=>o(!1),l=i?e.name:e.name||uc(e.text)||`#${e.id}`;return(0,s.jsx)(rG,{onMouseDown:n=>{const r=n.ctrlKey||n.metaKey||n.shiftKey?[...t.selectedElementsIds]:[];r.indexOf(e.id)<0&&r.push(e.id),t.selectElements(r)},style:{padding:"5px",margin:"0px 1px 5px 1px",backgroundColor:r?"rgb(0, 161, 255, 0.2)":"",display:e.selectable?"auto":"none"},children:(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,s.jsxs)("div",{style:{lineHeight:"30px",display:"flex"},children:[(0,s.jsx)("div",{className:"drag-handle",style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"move",height:"30px"},children:(0,s.jsx)($U,{icon:"drag-handle-vertical"})}),(0,s.jsx)("div",{style:{padding:"0 7px",opacity:.5,width:"55px"},children:e.type}),(0,s.jsx)("div",{style:{maxWidth:"142px"},children:(0,s.jsx)(fG,{minWidth:130,placeholder:FK("sidePanel.namePlaceholder"),value:l,maxLines:1,onEdit:()=>o(!0),onCancel:a,onConfirm:a,onChange:t=>{e.set({name:t})}})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(tG,{minimal:!0,icon:e?.visible?"eye-open":"eye-off",onClick:()=>{e.set({visible:!e.visible})}}),(0,s.jsx)(tG,{minimal:!0,icon:e?.locked?"lock":"unlock",onClick:()=>{e.set({draggable:e.locked,contentEditable:e.locked,styleEditable:e.locked})}}),(0,s.jsx)(tG,{icon:"trash",minimal:!0,onClick:()=>{t.deleteElements([e.id])},style:{marginLeft:"auto"}})]})]})})})),Koe=ei((({store:e})=>{const t=e.activePage?.children.map((e=>({id:e.id})))||[];return t.reverse(),(0,s.jsxs)("div",{style:{height:"100%",overflow:"auto"},children:[(0,s.jsx)("div",{style:{height:"40px",paddingTop:"5px"},children:FK("sidePanel.layersTip")}),(0,s.jsxs)("div",{children:[0===t.length?(0,s.jsx)("div",{children:FK("sidePanel.noLayers")}):null,(0,s.jsx)(ire.ReactSortable,{list:t,setList:t=>{t.forEach((({id:n},r)=>{const i=t.length-r-1,o=e.getElementById(n),a=e.activePage?.children.indexOf(o);a!==i&&e.activePage?.setElementZIndex(o.id,i)}))},direction:"horizontal",children:t.map((({id:t})=>{const n=e.getElementById(t);return(0,s.jsx)(Woe,{element:n,store:e},t)}))})]})]})})),Yoe={name:"templates",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.templates"),...e,children:(0,s.jsx)($U,{icon:"control"})}))),Panel:({store:e})=>(0,s.jsx)(rre,{store:e})},$oe={name:"text",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.text"),...e,children:(0,s.jsx)($U,{icon:"new-text-box"})}))),Panel:({store:e})=>(0,s.jsx)(R8,{store:e})},Xoe={name:"photos",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.photos"),...e,children:(0,s.jsx)($U,{icon:"media"})}))),Panel:({store:e})=>(0,s.jsx)(eee,{store:e})},Qoe={name:"elements",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.elements"),iconSize:16,...e,children:(0,s.jsx)(n(g8),{})}))),Panel:({store:e})=>(0,s.jsx)(Jne,{store:e})},Zoe={name:"upload",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.upload"),...e,children:(0,s.jsx)($U,{icon:"cloud-upload"})}))),Panel:({store:e})=>(0,s.jsx)(J8,{store:e})},Joe={name:"background",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.background"),...e,children:(0,s.jsx)($U,{icon:"layout-grid"})}))),Panel:({store:e})=>(0,s.jsx)(aee,{store:e})},eae=(ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.pages"),...e,children:(0,s.jsx)(n(b8),{})}))),{name:"layers",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.layers"),...e,children:(0,s.jsx)($U,{icon:"layers"})}))),Panel:({store:e})=>(0,s.jsx)(Koe,{store:e})}),tae={name:"size",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.resize"),...e,children:(0,s.jsx)($U,{icon:"fullscreen"})}))),Panel:({store:e})=>(0,s.jsx)(K8,{store:e})},nae=(ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.more"),...e,children:(0,s.jsx)($U,{icon:"more"})}))),[Yoe,$oe,Xoe,Qoe,Zoe,Joe,eae,tae]),rae=Ch("div")`
|
|
293
|
+
*/!function(){"use strict";var e={}.hasOwnProperty;function t(){for(var n=[],r=0;r<arguments.length;r++){var i=arguments[r];if(i){var o=typeof i;if("string"===o||"number"===o)n.push(i);else if(Array.isArray(i)){if(i.length){var a=t.apply(null,i);a&&n.push(a)}}else if("object"===o)if(i.toString===Object.prototype.toString)for(var l in i)e.call(i,l)&&i[l]&&n.push(l);else n.push(i.toString())}}return n.join(" ")}Aoe?(t.default=t,Aoe=t):"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],(function(){return t})):window.classNames=t}();d=l("8NFma");var koe={};i(koe),e(koe,"default",(()=>Poe));var Loe="Invariant failed";function Poe(e,t){if(!e)throw new Error(Loe)}function Toe(e){return e&&e.__esModule?e.default:e}function Hoe(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}function Noe(e){null!==e.parentElement&&e.parentElement.removeChild(e)}function Roe(e){e.forEach((e=>Noe(e.element)))}function joe(e){e.forEach((e=>{!function(e,t,n){const r=e.children[n]||null;e.insertBefore(t,r)}(e.parentElement,e.element,e.oldIndex)}))}function Voe(e,t){const n=Foe(e),r={parentElement:e.from};let i=[];switch(n){case"normal":i=[{element:e.item,newIndex:e.newIndex,oldIndex:e.oldIndex,parentElement:e.from}];break;case"swap":i=[{element:e.item,oldIndex:e.oldIndex,newIndex:e.newIndex,...r},{element:e.swapItem,oldIndex:e.newIndex,newIndex:e.oldIndex,...r}];break;case"multidrag":i=e.oldIndicies.map(((t,n)=>({element:t.multiDragElement,oldIndex:t.index,newIndex:e.newIndicies[n].index,...r})))}const o=function(e,t){return e.map((e=>({...e,item:t[e.oldIndex]}))).sort(((e,t)=>e.oldIndex-t.oldIndex))}(i,t);return o}function Ioe(e,t){const n=[...t];return e.concat().reverse().forEach((e=>n.splice(e.oldIndex,1))),n}function Doe(e,t,n,r){const i=[...t];return e.forEach((e=>{const t=r&&n&&r(e.item,n);i.splice(e.newIndex,0,t||e.item)})),i}function Foe(e){return e.oldIndicies&&e.oldIndicies.length>0?"multidrag":e.swapItem?"swap":"normal"}Hoe(ire,"Sortable",(()=>$882b6d93070905b3$re_export$Sortable)),Hoe(ire,"Direction",(()=>$882b6d93070905b3$re_export$Direction)),Hoe(ire,"DOMRect",(()=>$882b6d93070905b3$re_export$DOMRect)),Hoe(ire,"GroupOptions",(()=>$882b6d93070905b3$re_export$GroupOptions)),Hoe(ire,"MoveEvent",(()=>$882b6d93070905b3$re_export$MoveEvent)),Hoe(ire,"Options",(()=>$882b6d93070905b3$re_export$Options)),Hoe(ire,"PullResult",(()=>$882b6d93070905b3$re_export$PullResult)),Hoe(ire,"PutResult",(()=>$882b6d93070905b3$re_export$PutResult)),Hoe(ire,"SortableEvent",(()=>$882b6d93070905b3$re_export$SortableEvent)),Hoe(ire,"SortableOptions",(()=>$882b6d93070905b3$re_export$SortableOptions)),Hoe(ire,"Utils",(()=>$882b6d93070905b3$re_export$Utils)),Hoe(ire,"ReactSortable",(()=>Uoe));const Boe={dragging:null};class Uoe extends d.Component{constructor(e){super(e),this.ref=d.createRef();const t=[...e.list].map((e=>Object.assign(e,{chosen:!1,selected:!1})));e.setList(t,this.sortable,Boe),Toe(koe)(!e.plugins,'\nPlugins prop is no longer supported.\nInstead, mount it with "Sortable.mount(new MultiDrag())"\nPlease read the updated README.md at https://github.com/SortableJS/react-sortablejs.\n ')}componentDidMount(){if(null===this.ref.current)return;const e=this.makeOptions();Toe(ore).create(this.ref.current,e)}componentDidUpdate(e){e.disabled!==this.props.disabled&&this.sortable&&this.sortable.option("disabled",this.props.disabled)}render(){const{tag:e,style:t,className:n,id:r}=this.props,i={style:t,className:n,id:r},o=e&&null!==e?e:"div";return d.createElement(o,{ref:this.ref,...i},this.getChildren())}getChildren(){const{children:e,dataIdAttr:t,selectedClass:n="sortable-selected",chosenClass:r="sortable-chosen",dragClass:i="sortable-drag",fallbackClass:o="sortable-falback",ghostClass:a="sortable-ghost",swapClass:l="sortable-swap-highlight",filter:s="sortable-filter",list:c}=this.props;if(!e||null==e)return null;const u=t||"data-id";return d.Children.map(e,((e,t)=>{if(void 0===e)return;const i=c[t]||{},{className:o}=e.props,a="string"==typeof s&&{[s.replace(".","")]:!!i.filtered},l=Toe(Aoe)(o,{[n]:i.selected,[r]:i.chosen,...a});return d.cloneElement(e,{[u]:e.key,className:l})}))}get sortable(){const e=this.ref.current;if(null===e)return null;const t=Object.keys(e).find((e=>e.includes("Sortable")));return t?e[t]:null}makeOptions(){const e=function(e){const{list:t,setList:n,children:r,tag:i,style:o,className:a,clone:l,onAdd:s,onChange:c,onChoose:u,onClone:h,onEnd:f,onFilter:d,onRemove:p,onSort:v,onStart:m,onUnchoose:g,onUpdate:y,onMove:b,onSpill:w,onSelect:x,onDeselect:E,..._}=e;return _}(this.props);["onAdd","onChoose","onDeselect","onEnd","onRemove","onSelect","onSpill","onStart","onUnchoose","onUpdate"].forEach((t=>e[t]=this.prepareOnHandlerPropAndDOM(t))),["onChange","onClone","onFilter","onSort"].forEach((t=>e[t]=this.prepareOnHandlerProp(t)));return{...e,onMove:(e,t)=>{const{onMove:n}=this.props,r=e.willInsertAfter||-1;if(!n)return r;const i=n(e,t,this.sortable,Boe);return void 0!==i&&i}}}prepareOnHandlerPropAndDOM(e){return t=>{this.callOnHandlerProp(t,e),this[e](t)}}prepareOnHandlerProp(e){return t=>{this.callOnHandlerProp(t,e)}}callOnHandlerProp(e,t){const n=this.props[t];n&&n(e,this.sortable,Boe)}onAdd(e){const{list:t,setList:n,clone:r}=this.props,i=Voe(e,[...Boe.dragging.props.list]);Roe(i);n(Doe(i,t,e,r).map((e=>Object.assign(e,{selected:!1}))),this.sortable,Boe)}onRemove(e){const{list:t,setList:n}=this.props,r=Foe(e),i=Voe(e,t);joe(i);let o=[...t];if("clone"!==e.pullMode)o=Ioe(i,o);else{let t=i;switch(r){case"multidrag":t=i.map(((t,n)=>({...t,element:e.clones[n]})));break;case"normal":t=i.map((t=>({...t,element:e.clone})));break;default:Toe(koe)(!0,`mode "${r}" cannot clone. Please remove "props.clone" from <ReactSortable/> when using the "${r}" plugin`)}Roe(t),i.forEach((t=>{const n=t.oldIndex,r=this.props.clone(t.item,e);o.splice(n,1,r)}))}o=o.map((e=>Object.assign(e,{selected:!1}))),n(o,this.sortable,Boe)}onUpdate(e){const{list:t,setList:n}=this.props,r=Voe(e,t);Roe(r),joe(r);const i=function(e,t){return Doe(e,Ioe(e,t))}(r,t);return n(i,this.sortable,Boe)}onStart(){Boe.dragging=this}onEnd(){Boe.dragging=null}onChoose(e){const{list:t,setList:n}=this.props;n(t.map(((t,n)=>{let r=t;return n===e.oldIndex&&(r=Object.assign(t,{chosen:!0})),r})),this.sortable,Boe)}onUnchoose(e){const{list:t,setList:n}=this.props;n(t.map(((t,n)=>{let r=t;return n===e.oldIndex&&(r=Object.assign(r,{chosen:!1})),r})),this.sortable,Boe)}onSpill(e){const{removeOnSpill:t,revertOnSpill:n}=this.props;t&&!n&&Noe(e.item)}onSelect(e){const{list:t,setList:n}=this.props,r=t.map((e=>Object.assign(e,{selected:!1})));e.newIndicies.forEach((t=>{const n=t.index;if(-1===n)return console.log(`"${e.type}" had indice of "${t.index}", which is probably -1 and doesn't usually happen here.`),void console.log(e);r[n].selected=!0})),n(r,this.sortable,Boe)}onDeselect(e){const{list:t,setList:n}=this.props,r=t.map((e=>Object.assign(e,{selected:!1})));e.newIndicies.forEach((e=>{const t=e.index;-1!==t&&(r[t].selected=!0)})),n(r,this.sortable,Boe)}}Uoe.defaultProps={clone:e=>e};var Goe,qoe;Goe=ire,qoe={},Object.keys(qoe).forEach((function(e){"default"===e||"__esModule"===e||Goe.hasOwnProperty(e)||Object.defineProperty(Goe,e,{enumerable:!0,get:function(){return qoe[e]}})}));const Woe=ei((({element:e,store:t})=>{const r=t.selectedElements.indexOf(e)>=0,[i,o]=n(d).useState(!1),a=()=>o(!1),l=i?e.name:e.name||uc(e.text)||`#${e.id}`;return(0,s.jsx)(rG,{onMouseDown:n=>{const r=n.ctrlKey||n.metaKey||n.shiftKey?[...t.selectedElementsIds]:[];r.indexOf(e.id)<0&&r.push(e.id),t.selectElements(r)},style:{padding:"5px",margin:"0px 1px 5px 1px",backgroundColor:r?"rgb(0, 161, 255, 0.2)":"",display:e.selectable?"auto":"none"},children:(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,s.jsxs)("div",{style:{lineHeight:"30px",display:"flex"},children:[(0,s.jsx)("div",{className:"drag-handle",style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"move",height:"30px"},children:(0,s.jsx)($U,{icon:"drag-handle-vertical"})}),(0,s.jsx)("div",{style:{padding:"0 7px",opacity:.5,width:"55px"},children:e.type}),(0,s.jsx)("div",{style:{maxWidth:"142px"},children:(0,s.jsx)(fG,{minWidth:130,placeholder:FK("sidePanel.namePlaceholder"),value:l,maxLines:1,onEdit:()=>o(!0),onCancel:a,onConfirm:a,onChange:t=>{e.set({name:t})}})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(tG,{minimal:!0,icon:e?.visible?"eye-open":"eye-off",onClick:()=>{e.set({visible:!e.visible})}}),(0,s.jsx)(tG,{minimal:!0,icon:e?.locked?"lock":"unlock",onClick:()=>{e.set({draggable:e.locked,contentEditable:e.locked,styleEditable:e.locked})}}),(0,s.jsx)(tG,{icon:"trash",minimal:!0,onClick:()=>{t.deleteElements([e.id])},style:{marginLeft:"auto"}})]})]})})})),Koe=ei((({store:e})=>{const t=e.activePage?.children.map((e=>({id:e.id})))||[];return t.reverse(),(0,s.jsxs)("div",{style:{height:"100%",overflow:"auto"},children:[(0,s.jsx)("div",{style:{height:"40px",paddingTop:"5px"},children:FK("sidePanel.layersTip")}),(0,s.jsxs)("div",{children:[0===t.length?(0,s.jsx)("div",{children:FK("sidePanel.noLayers")}):null,(0,s.jsx)(ire.ReactSortable,{list:t,setList:t=>{t.forEach((({id:n},r)=>{const i=t.length-r-1,o=e.getElementById(n),a=e.activePage?.children.indexOf(o);a!==i&&e.activePage?.setElementZIndex(o.id,i)}))},direction:"horizontal",children:t.map((({id:t})=>{const n=e.getElementById(t);return(0,s.jsx)(Woe,{element:n,store:e},t)}))})]})]})})),Yoe={name:"templates",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.templates"),...e,children:(0,s.jsx)($U,{icon:"control"})}))),Panel:({store:e})=>(0,s.jsx)(rre,{store:e})},$oe={name:"text",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.text"),...e,children:(0,s.jsx)($U,{icon:"new-text-box"})}))),Panel:({store:e})=>(0,s.jsx)(R8,{store:e})},Xoe={name:"photos",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.photos"),...e,children:(0,s.jsx)($U,{icon:"media"})}))),Panel:({store:e})=>(0,s.jsx)(eee,{store:e})},Qoe={name:"elements",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.elements"),iconSize:16,...e,children:(0,s.jsx)("span",{className:"bp4-icon",children:(0,s.jsx)(n(g8),{})})}))),Panel:({store:e})=>(0,s.jsx)(Jne,{store:e})},Zoe={name:"upload",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.upload"),...e,children:(0,s.jsx)($U,{icon:"cloud-upload"})}))),Panel:({store:e})=>(0,s.jsx)(J8,{store:e})},Joe={name:"background",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.background"),...e,children:(0,s.jsx)($U,{icon:"layout-grid"})}))),Panel:({store:e})=>(0,s.jsx)(aee,{store:e})},eae=(ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.pages"),...e,children:(0,s.jsx)(n(b8),{})}))),{name:"layers",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.layers"),...e,children:(0,s.jsx)($U,{icon:"layers"})}))),Panel:({store:e})=>(0,s.jsx)(Koe,{store:e})}),tae={name:"size",Tab:ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.resize"),...e,children:(0,s.jsx)($U,{icon:"fullscreen"})}))),Panel:({store:e})=>(0,s.jsx)(K8,{store:e})},nae=(ei((e=>(0,s.jsx)(E8,{name:FK("sidePanel.more"),...e,children:(0,s.jsx)($U,{icon:"more"})}))),[Yoe,$oe,Xoe,Qoe,Zoe,Joe,eae,tae]),rae=Ch("div")`
|
|
294
294
|
display: flex;
|
|
295
295
|
height: 100% !important;
|
|
296
296
|
padding: 0px !important;
|
|
@@ -394,7 +394,7 @@ function are(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Ob
|
|
|
394
394
|
@media screen and (max-width: 500px) {
|
|
395
395
|
display: none;
|
|
396
396
|
}
|
|
397
|
-
`,dae=[.1,.25,.5,.75,1,1.5,2,3],pae=ei((({store:e})=>{const t=Math.max(2,e.scaleToFit),n=Math.min(.5,e.scaleToFit),r=e.scale<t,i=e.scale>n;return(0,s.jsxs)(BG.Group,{align:Wh.LEFT,style:{height:"35px"},children:[(0,s.jsx)(tG,{icon:"zoom-out",minimal:!0,onClick:()=>{e.setScale(e.scale/1.2)},disabled:!i}),(0,s.jsx)(NK,{content:(0,s.jsxs)(TG,{style:{minWidth:"80px"},children:[dae.map((t=>(0,s.jsx)(RG,{text:Math.round(100*t)+"%",onClick:async()=>{e.setScale(t)}},t))),(0,s.jsx)(RG,{text:FK("scale.reset"),onClick:async()=>{e.setScale(e.scaleToFit)}})]}),children:(0,s.jsx)(tG,{minimal:!0,children:Math.round(100*e.scale)+"%"})}),(0,s.jsx)(tG,{icon:"zoom-in",minimal:!0,onClick:()=>{e.setScale(1.2*e.scale)},disabled:!r})]})}));var vae=ei((({store:e})=>(0,s.jsx)(fae,{children:(0,s.jsx)(BG,{style:{height:"35px",padding:"0 5px"},children:(0,s.jsx)(pae,{store:e})})})));const mae=function(e,t){if(e===t)return!0;if("object"==typeof e&&null!=e&&"object"==typeof t&&null!=t){if(Object.keys(e).length!=Object.keys(t).length)return!1;for(var n in e){if(!t.hasOwnProperty(n))return!1;if(!mae(e[n],t[n]))return!1}return!0}return!1},gae=Yne.model("UndoManager",{history:Yne.array(Yne.frozen()),undoIdx:-1,targetPath:""}).views((e=>({get canUndo(){return e.undoIdx>0},get canRedo(){return e.undoIdx<e.history.length-1}}))).actions((e=>{let t,n,r=!1,i=null,o=0,a=!1;function l(){const e=xee(t);return{pages:e.pages,width:e.width,height:e.height}}function s(e){wee(t.pages,e.pages),t.setSize(e.width,e.height)}return{startTransaction(){a=!0},endTransaction(e){a=!1,e||this.requestAddState(l())},async ignore(t,n=!1){o&&e.addUndoState();let r=a;r||e.startTransaction();try{await t()}catch(e){setTimeout((()=>{throw e}))}r||e.endTransaction(!0),n||r||e.replaceState(),clearTimeout(o),o=0},async transaction(t){await e.ignore(t,!0),this.addUndoState()},requestAddState(e){i=e,o||a||(r?r=!1:o=setTimeout((()=>{o=0,clearTimeout(o),a||this.addUndoState()}),100))},addUndoState(){if(r)return void(r=!1);const t=e.history[e.undoIdx];!mae(i,t)&&(clearTimeout(o),o=0,e.history.splice(e.undoIdx+1),e.history.push(i),e.undoIdx=e.history.length-1)},afterCreate(){if(t=zee(e,".."),!t)throw new Error("Failed to find target store for UndoManager. Please provide `targetPath` property, or a `targetStore` in the environment");n=yee(t,(()=>{this.requestAddState(l())})),0===e.history.length&&this.requestAddState(l())},clear(){clearTimeout(o),o=0,e.history.splice(0,e.history.length),e.undoIdx=-1,e.addUndoState(l())},beforeDestroy(){n()},undo(){o&&this.addUndoState(),e.canUndo?(e.undoIdx--,r=!0,s(e.history[e.undoIdx])):console.warn("No undo history. Please check `store.history.canUndo` before calling undo action.")},redo(){o&&this.addUndoState(),e.canRedo?(e.undoIdx++,r=!0,s(e.history[e.undoIdx])):console.warn("No redo history. Please check `store.history.canRedo` before calling redo action.")},replaceState(){e.history[e.undoIdx]=l()}}}));async function yae(e,t){const n=await(await fetch(e)).blob(),r=document.createElement("a"),i=URL.createObjectURL(n);r.href=i,r.download=t,document.body.appendChild(r),r.click(),setTimeout((function(){document.body.removeChild(r),window.URL.revokeObjectURL(i)}),0)}let bae;uee("ignore");const wae=Yne.model("Element",{id:Yne.identifier,type:"none",name:"",x:0,y:0,rotation:0,opacity:1,blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,shadowEnabled:!1,shadowBlur:5,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"black",shadowOpacity:1,custom:Yne.frozen(),visible:!0,draggable:!0,selectable:!0,contentEditable:!0,styleEditable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot((e=>{const t={...e,x:e.x||0,y:e.y||0};return"width"in e&&(t.width=t.width||1),"height"in e&&(t.height=t.height||1),e.locked&&(t.draggable=!1,t.contentEditable=!1,t.styleEditable=!1),t})).postProcessSnapshot((e=>{const t={...e},n={};for(var r in t)"_"!==r[0]&&(n[r]=e[r]);return n})).views((e=>({get locked(){return!e.draggable&&!e.contentEditable&&!e.styleEditable},get page(){return Eee(e,Mae)},get store(){return Eee(e,kae)}}))).actions((e=>({toJSON:()=>({...xee(e)})}))).actions((e=>({clone(t){const n=e.toJSON();return t.id=t.id||ere(10),Object.assign(n,t),e.page.addElement(n)},set(t){Object.assign(e,t)},moveUp(){e.page.moveElementsUp([e.id])},moveTop(){e.page.moveElementsTop([e.id])},moveDown(){e.page.moveElementsDown([e.id])},moveBottom(){e.page.moveElementsBottom([e.id])},beforeDestroy(){e.store.history.endTransaction()}}))),xae=wae.named("Text").props({type:"text",text:"",placeholder:"",fontSize:14,fontFamily:"Roboto",fontStyle:"normal",fontWeight:"normal",textDecoration:"",fill:"black",align:"center",width:100,height:0,verticalAlign:"top",strokeWidth:0,stroke:"black",lineHeight:Yne.optional(Yne.union(Yne.number,Yne.string),1.2),letterSpacing:0,_editModeEnabled:!1}).preProcessSnapshot((e=>({...e}))).actions((e=>({toggleEditMode(t){e._editModeEnabled=t??!e._editModeEnabled,e._editModeEnabled?e.store.history.startTransaction():e.store.history.endTransaction()}}))),Eae=wae.named("Image").props({type:"image",width:100,height:100,src:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,cornerRadius:0,flipX:!1,flipY:!1,clipSrc:"",borderColor:"black",borderSize:0,_cropModeEnabled:!1}).actions((e=>({toggleCropMode(t){e._cropModeEnabled=t??!e._cropModeEnabled,e._cropModeEnabled?e.store.history.startTransaction():e.store.history.endTransaction()}}))),_ae=wae.named("SVG").props({type:"svg",src:"",maskSrc:"",__svgString:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,keepRatio:!0,flipX:!1,flipY:!1,width:100,height:100,borderColor:"black",borderSize:0,cornerRadius:0,colorsReplace:Yne.map(Yne.string)}).preProcessSnapshot((e=>({...e,src:e.src||e.svgSource}))).actions((e=>({replaceColor(t,n){e.colorsReplace.set(t,n)}}))),zae={svg:_ae,text:xae,image:Eae},Sae=[];const Cae=[...new Array(20)].map(((e,t)=>Yne.late((()=>Sae[t])))),Oae=Yne.union({dispatcher:e=>{const t=zae[e.type];if(!t)throw new Error(`Unknown element type: "${e.type}"`);return t}},_ae,xae,Eae,...Cae),Mae=Yne.model("Page",{id:Yne.identifier,children:Yne.array(Oae),width:Yne.optional(Yne.union(Yne.number,Yne.literal("auto")),"auto"),height:Yne.optional(Yne.union(Yne.number,Yne.literal("auto")),"auto"),background:"white",bleed:0,custom:Yne.frozen(),_exporting:!1}).postProcessSnapshot((e=>{const t={...e},n={};for(var r in t)"_"!==r[0]&&(n[r]=e[r]);return n})).views((e=>({get store(){return Eee(e,kae)}}))).views((e=>({get computedWidth(){return"auto"===e.width?e.store.width:e.width},get computedHeight(){return"auto"===e.height?e.store.height:e.height}}))).actions((e=>({toJSON:()=>JSON.parse(JSON.stringify(xee(e))),_forEachElementUp(t,n){const r=t.map((t=>({id:t,index:e.children.findIndex((e=>e.id===t))})));r.sort(((e,t)=>t.index-e.index));for(const{index:i}of r){if(-1==i)continue;const r=i<e.children.length-1&&e.children[i+1],o=t.indexOf(r?.id)>=0;i===e.children.length-1||o||n(i)}},_forEachElementDown(t,n){const r=t.map((t=>({id:t,index:e.children.findIndex((e=>e.id===t))})));r.sort(((e,t)=>e.index-t.index));for(const{index:i}of r){if(-1==i)continue;const r=i>0&&e.children[i-1],o=t.indexOf(r?.id)>=0;0===i||o||n(i)}return!1}}))).actions((e=>({clone(t){const n=e.toJSON();n.children.forEach((e=>{e.id=ere(10)}));const r={...n,id:ere(10),...t},i=e.store.addPage(r),o=e.store.pages.indexOf(e);i.setZIndex(o+1),i.select()},setZIndex(t){e.store.setPageZIndex(e.id,t)},set(t){Object.assign(e,t)},select(){e.store.selectPage(e.id)},addElement(t){const n=zae[t.type];if(!n)return void console.error("Can not find model with type "+t.type);const r=n.create({id:ere(10),...t});return e.children.push(r),r.selectable&&e.store.selectElements([r.id]),r},canMoveElementsUp(t){let n=!1;return e._forEachElementUp(t,(()=>{n=n||!0})),n},moveElementsUp(t){e._forEachElementUp(t,(t=>{const n=e.children[t];See(n),e.children.splice(t+1,0,n)}))},canMoveElementsTop(e){return this.canMoveElementsUp(e)},moveElementsTop(t){const n=[],r=[];e.children.forEach((e=>{t.indexOf(e.id)>=0?n.push(e):r.push(e)})),e.children.replace(r.concat(n))},canMoveElementsDown(t){let n=!1;return e._forEachElementDown(t,(()=>{n=n||!0})),n},moveElementsDown(t){e._forEachElementDown(t,(t=>{const n=e.children[t];See(n),e.children.splice(t-1,0,n)}))},canMoveElementsBottom(e){return this.canMoveElementsDown(e)},moveElementsBottom(t){const n=[],r=[];e.children.forEach((e=>{t.indexOf(e.id)>=0?n.push(e):r.push(e)})),e.children.replace(n.concat(r))},setElementZIndex(t,n){const r=e.children.find((e=>e.id===t));r&&(See(r),e.children.remove(r),e.children.splice(n,0,r))},setSize({width:t,height:n},{useMagic:r}){e.width=t,e.height=n}}))).actions((e=>({moveElementUp(t){console.warn("page.moveElementUp(id) is deprecated. Please use page.moveElementsUp([id1, id2]) instead."),e.moveElementsUp([t])},moveElementDown(t){console.warn("page.moveElementDown(id) is deprecated. Please use page.moveElementsDown([id1, id2]) instead."),e.moveElementsDown([t])},moveElementTop(t){console.warn("page.moveElementTop(id) is deprecated. Please use page.moveElementsTop([id1, id2]) instead."),e.moveElementsTop([t])},moveElementBottom(t){console.warn("page.moveElementBottom(id) is deprecated. Please use page.moveElementsBottom([id1, id2]) instead."),e.moveElementsBottom([t])}}))),Aae=Yne.model("Font",{fontFamily:Yne.string,url:Yne.optional(Yne.string,""),styles:Yne.frozen()}).preProcessSnapshot((e=>({...e,fontFamily:e.fontFamily||e.name}))),kae=Yne.model("Store",{role:"",pages:Yne.array(Mae),fonts:Yne.array(Aae),width:1080,height:1080,scale:1,scaleToFit:1,unit:"px",dpi:72,bleedVisible:!1,rulesVisible:!1,openedSidePanel:"",selectedElementsIds:Yne.array(Yne.string),history:Yne.optional(gae,{targetPath:"../pages"}),_elementsPixelRatio:2,_activePageId:""}).views((e=>({get _bleedVisible(){return console.warn("store._bleedVisible is deprecated. Please use store.bleedVisible instead."),e.bleedVisible},get selectedElements(){return e.selectedElementsIds.map((t=>{for(const n of e.pages)for(const e of n.children)if(e.id===t)return e})).filter((e=>!!e))},get activePage(){return e.pages.slice().find((t=>t.id===e._activePageId))||(e.pages.length?e.pages[0]:null)}}))).actions((e=>({afterCreate(){e.history.canUndo},setUnit({unit:t,dpi:n}){e.unit=t||e.unit,e.dpi=n||e.dpi},setRole(t){e.role=t},getElementById(t){for(const n of e.pages)for(const e of n.children)if(e.id===t)return e},addPage(t){const n=Mae.create({id:ere(10),...t});return e.pages.push(n),e._activePageId=n.id,n},selectPage(t){e._activePageId=t},selectElements(t){const n=t.map((t=>e.getElementById(t))).sort(((e,t)=>e.page.children.indexOf(e)-e.page.children.indexOf(t))).filter((e=>!!e)).map((e=>e.id));e.selectedElementsIds=n},toggleBleed(t){e.bleedVisible=t??!e.bleedVisible},toggleRulers(t){e.rulesVisible=t??!e.rulesVisible},openSidePanel(t){e.openedSidePanel=t},setScale(t){e.scale=t},_setScaleToFit(t){e.scaleToFit=t},setElementsPixelRatio(t){e._elementsPixelRatio=t},setSize(t,n,r){if(r){const r=t/e.width,i=n/e.height;for(const t of e.pages)for(const e of t.children)e.set({x:e.x*r,y:e.y*i}),"text"===e.type?e.set({fontSize:e.fontSize*r,width:Math.max(e.width*r,2)}):"image"===e.type?e.set({width:e.width*r,height:e.height*i}):"svg"===e.type&&e.set({width:Math.max(e.width*r,2),height:Math.max(e.height*r,2)})}e.width=t,e.height=n},setPageZIndex(t,n){const r=e.pages.find((e=>e.id===t));r&&(See(r),e.pages.remove(r),e.pages.splice(n,0,r))},deletePages(t){const n=e.pages.indexOf(e.activePage);t.forEach((t=>{Cee(e.pages.find((e=>e.id===t)))}));const r=Math.min(e.pages.length-1,n),i=e.pages[r];i&&(e._activePageId=i.id),e.selectedElementsIds=e.selectedElementsIds.filter((t=>e.getElementById(t)))},deleteElements(t){t.forEach((t=>{e.pages.forEach((e=>{const n=e.children.find((e=>e.id===t));n&&Cee(n)}))})),e.selectedElementsIds=e.selectedElementsIds.filter((t=>e.getElementById(t)))},on(t,n){if("change"===t){let t=e.toJSON();return yee(e,(r=>{const i=e.toJSON();!mae(t,i)&&(t=i,n(i))}))}},async toDataURL({pixelRatio:t,ignoreBackground:n,pageId:r,mimeType:i,includeBleed:o,quality:a}={}){const l=t||1;r=r||e.pages[0]?.id;const s=e.pages.find((e=>e.id===r));if(!s)throw new Error(`No page for export with id ${r}`);s?.set({_exporting:!0}),await e.waitLoading();const c=pl.stages.find((e=>e.getAttr("pageId")===r));if(!c)throw new Error(`Export is failed. Can not find stage for page ${r}. Looks like <Workspace /> component is not mounted, but it is required in order to process the export.`);const u=c.findOne(".page-container");c.find("Transformer").forEach((e=>e.visible(!1))),u.find(".page-background").forEach((e=>e.shadowEnabled(!1))),u.find(".page-background").forEach((e=>e.strokeEnabled(!1))),u.find(".highlighter").forEach((e=>e.visible(!1)));const h=u.findOne(".page-background-group"),f=h.clip();h.clip({x:null,y:null,width:null,height:null});const d=u.findOne(".elements-container"),p=d.clip();d.clip({x:null,y:null,width:null,height:null});const v=u.find((e=>e.getAttr("hideInExport")));v.forEach((e=>{e.setAttr("oldVisible",e.visible()),e.hide()}));const m=u.find((e=>!e.visible()&&e.getAttr("editModeEnabled")));m.forEach((e=>{e.setAttr("oldVisible",e.visible()),e.show()})),n&&u.find(".page-background").forEach((e=>e.hide()));const g=o?s.bleed:0;let y=g;e.bleedVisible&&o?y=0:e.bleedVisible&&!o&&(y=-s.bleed);const b=document.createElement("canvas");b.width=(s.computedWidth+2*g)*l,b.height=(s.computedHeight+2*g)*l;const w=b.getContext("2d");"image/jpeg"===i&&(w.fillStyle="white",w.fillRect(0,0,b.width,b.height));const x=u.toCanvas({x:u.x()-y*u.scaleX(),y:u.y()-y*u.scaleY(),width:(s.computedWidth+2*g)*u.scaleX(),height:(s.computedHeight+2*g)*u.scaleY(),pixelRatio:1/u.scaleX()*l});w.drawImage(x,0,0);const E=b.toDataURL(i,a);return n&&u.find(".page-background").forEach((e=>e.show())),v.forEach((e=>{e.visible(e.getAttr("oldVisible"))})),m.forEach((e=>{e.visible(e.getAttr("oldVisible"))})),u.find(".page-background").forEach((e=>e.shadowEnabled(!0))),u.find(".page-background").forEach((e=>e.strokeEnabled(!0))),c.find("Transformer").forEach((e=>e.visible(!0))),u.find(".highlighter").forEach((e=>e.visible(!0))),h.clip(f),d.clip(p),s?.set({_exporting:!1}),E},async saveAsImage({fileName:t,...n}={}){const r=n.mimeType||"image/png",i=r.split("/")[1];yae(await e.toDataURL(n),t||"polotno."+i)},async _toPDF(t){const n=t.dpi||e.dpi,r=t.parallel||1,i=t.unit||("px"===e.unit?"mm":e.unit),o=t.pixelRatio||1,a=await(bae?Promise.resolve(bae):new Promise((e=>{var t=document.createElement("script");t.onload=function(){bae=window.jspdf.jsPDF,e(bae)},t.src="https://unpkg.com/jspdf@2.2.0/dist/jspdf.umd.min.js",document.head.appendChild(t)}))),l=e=>aY({px:e,unit:i,dpi:n}),s=e.pages[0]||{},c=t.includeBleed?s.bleed:0,u=l(s.computedWidth+2*c),h=l(s.computedHeight+2*c);var f=new a({unit:i,orientation:u>h?"landscape":"portrait",format:[u,h],compress:!0});f.deletePage(1);const d=e._elementsPixelRatio;e.setElementsPixelRatio(o),await new Promise((e=>setTimeout(e)));const p=((e,t)=>{for(var n=[],r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n})(e.pages,r);for(const n of p){const r=n.map((async n=>{const r=t.includeBleed?n.bleed:0,i=l(n.computedWidth+2*r),a=l(n.computedHeight+2*r);let s=0,c=o;for(;s<10;){s+=1,2===s&&console.error("Polotno can not export PDF with current settings. Quality is automatically reduced.");const r=await e.toDataURL({...t,pageId:n.id,pixelRatio:c});if(r.length>20)return{url:r,width:i,height:a};c*=.8}}));(await Promise.all(r)).forEach((({url:e,width:t,height:n})=>{f.addPage([t,n],t>n?"landscape":"portrait"),f.addImage(e,0,0,t,n,void 0,"FAST")}))}return e.setElementsPixelRatio(d),f},toPDFDataURL:async t=>(await e._toPDF({mimeType:"image/jpeg",...t})).output("datauristring"),async saveAsPDF({fileName:t,...n}={}){(await e._toPDF({mimeType:"image/jpeg",...n})).save(t||"polotno.pdf")},async waitLoading(){await new Promise((e=>setTimeout(e,100))),await Ys()},toJSON:()=>({width:e.width,height:e.height,fonts:xee(e.fonts),pages:xee(e.pages),unit:e.unit,dpi:e.dpi}),loadJSON(t,n=!1){const r={...t},i=e.pages.indexOf(e.activePage);let o=(r.pages[i]||r.pages[0])?.id;r._activePageId=o;const a={...xee(e)};Object.assign(a,r),a.history=n?e.history.toJSON():{history:[],undoIdx:-1},wee(e,a)},addFont(t){e.removeFont(t.fontFamily),e.fonts.push(t),e.loadFont(t.fontFamily)},removeFont(t){e.fonts.filter((e=>e.fontFamily===t)).forEach((e=>Cee(e)))},async loadFont(t){const n=e.fonts.find((e=>e.fontFamily===t))||tc.find((e=>e.fontFamily===t));n?function(e){const t=e.fontFamily;if(sc[t])return;if(!e.url&&!e.styles)return;const n=document.createElement("style");n.type="text/css";const r=e.styles||(e.url?[{src:`url("${e.url}")`}]:[]);let i="";r.forEach((e=>{i+=`\n @font-face {\n font-family: '${t}';\n src: ${e.src};\n font-style: ${e.fontStyle||"normal"};\n font-weight: ${e.fontWeight||"normal"};\n }\n `})),n.innerHTML=i,document.getElementsByTagName("head")[0].appendChild(n),sc[e.fontFamily]=!0}(n):function(e){if(lc[e])return;const t=`https://fonts.googleapis.com/css?family=${e.replace(/ /g,"+")}`,n=document.createElement("link");n.type="text/css",n.href=t,n.rel="stylesheet",document.getElementsByTagName("head")[0].appendChild(n),lc[e]=!0}(t),await ac(t)}})));function Lae({key:e,showCredit:t}={key:"",showCredit:!1}){const n=kae.create();return oY(e,t),n}const Pae=Ch("div")`
|
|
397
|
+
`,dae=[.1,.25,.5,.75,1,1.5,2,3],pae=ei((({store:e})=>{const t=Math.max(2,e.scaleToFit),n=Math.min(.5,e.scaleToFit),r=e.scale<t,i=e.scale>n;return(0,s.jsxs)(BG.Group,{align:Wh.LEFT,style:{height:"35px"},children:[(0,s.jsx)(tG,{icon:"zoom-out",minimal:!0,onClick:()=>{e.setScale(e.scale/1.2)},disabled:!i}),(0,s.jsx)(NK,{content:(0,s.jsxs)(TG,{style:{minWidth:"80px"},children:[dae.map((t=>(0,s.jsx)(RG,{text:Math.round(100*t)+"%",onClick:async()=>{e.setScale(t)}},t))),(0,s.jsx)(RG,{text:FK("scale.reset"),onClick:async()=>{e.setScale(e.scaleToFit)}})]}),children:(0,s.jsx)(tG,{minimal:!0,children:Math.round(100*e.scale)+"%"})}),(0,s.jsx)(tG,{icon:"zoom-in",minimal:!0,onClick:()=>{e.setScale(1.2*e.scale)},disabled:!r})]})}));var vae=ei((({store:e})=>(0,s.jsx)(fae,{children:(0,s.jsx)(BG,{style:{height:"35px",padding:"0 5px"},children:(0,s.jsx)(pae,{store:e})})})));const mae=function(e,t){if(e===t)return!0;if("object"==typeof e&&null!=e&&"object"==typeof t&&null!=t){if(Object.keys(e).length!=Object.keys(t).length)return!1;for(var n in e){if(!t.hasOwnProperty(n))return!1;if(!mae(e[n],t[n]))return!1}return!0}return!1},gae=Yne.model("UndoManager",{history:Yne.array(Yne.frozen()),undoIdx:-1,targetPath:""}).views((e=>({get canUndo(){return e.undoIdx>0},get canRedo(){return e.undoIdx<e.history.length-1}}))).actions((e=>{let t,n,r=!1,i=null,o=0,a=!1;function l(){const e=xee(t);return{pages:e.pages,width:e.width,height:e.height}}function s(e){wee(t.pages,e.pages),t.setSize(e.width,e.height)}return{startTransaction(){a=!0},endTransaction(e){a=!1,e||this.requestAddState(l())},async ignore(t,n=!1){o&&e.addUndoState();let r=a;r||e.startTransaction();try{await t()}catch(e){setTimeout((()=>{throw e}))}r||e.endTransaction(!0),n||r||e.replaceState(),clearTimeout(o),o=0},async transaction(t){await e.ignore(t,!0),this.addUndoState()},requestAddState(e){i=e,o||a||(r?r=!1:o=setTimeout((()=>{o=0,clearTimeout(o),a||this.addUndoState()}),100))},addUndoState(){if(r)return void(r=!1);const t=e.history[e.undoIdx];!mae(i,t)&&(clearTimeout(o),o=0,e.history.splice(e.undoIdx+1),e.history.push(i),e.undoIdx=e.history.length-1)},afterCreate(){if(t=zee(e,".."),!t)throw new Error("Failed to find target store for UndoManager. Please provide `targetPath` property, or a `targetStore` in the environment");n=yee(t,(()=>{this.requestAddState(l())})),0===e.history.length&&this.requestAddState(l())},clear(){clearTimeout(o),o=0,e.history.splice(0,e.history.length),e.undoIdx=-1,e.addUndoState(l())},beforeDestroy(){n()},undo(){o&&this.addUndoState(),e.canUndo?(e.undoIdx--,r=!0,s(e.history[e.undoIdx])):console.warn("No undo history. Please check `store.history.canUndo` before calling undo action.")},redo(){o&&this.addUndoState(),e.canRedo?(e.undoIdx++,r=!0,s(e.history[e.undoIdx])):console.warn("No redo history. Please check `store.history.canRedo` before calling redo action.")},replaceState(){e.history[e.undoIdx]=l()}}}));async function yae(e,t){const n=await(await fetch(e)).blob(),r=document.createElement("a"),i=URL.createObjectURL(n);r.href=i,r.download=t,document.body.appendChild(r),r.click(),setTimeout((function(){document.body.removeChild(r),window.URL.revokeObjectURL(i)}),0)}let bae;async function wae(e){for(let t=0;t<30;t++){const t=await e();if(t)return t;await new Promise((e=>setTimeout(e,50)))}}uee("ignore");const xae=Yne.model("Element",{id:Yne.identifier,type:"none",name:"",x:0,y:0,rotation:0,opacity:1,blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,shadowEnabled:!1,shadowBlur:5,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"black",shadowOpacity:1,custom:Yne.frozen(),visible:!0,draggable:!0,selectable:!0,contentEditable:!0,styleEditable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot((e=>{const t={...e,x:e.x||0,y:e.y||0};return"width"in e&&(t.width=t.width||1),"height"in e&&(t.height=t.height||1),e.locked&&(t.draggable=!1,t.contentEditable=!1,t.styleEditable=!1),t})).postProcessSnapshot((e=>{const t={...e},n={};for(var r in t)"_"!==r[0]&&(n[r]=e[r]);return n})).views((e=>({get locked(){return!e.draggable&&!e.contentEditable&&!e.styleEditable},get page(){return Eee(e,Aae)},get store(){return Eee(e,Lae)}}))).actions((e=>({toJSON:()=>({...xee(e)})}))).actions((e=>({clone(t){const n=e.toJSON();return t.id=t.id||ere(10),Object.assign(n,t),e.page.addElement(n)},set(t){Object.assign(e,t)},moveUp(){e.page.moveElementsUp([e.id])},moveTop(){e.page.moveElementsTop([e.id])},moveDown(){e.page.moveElementsDown([e.id])},moveBottom(){e.page.moveElementsBottom([e.id])},beforeDestroy(){e.store.history.endTransaction()}}))),Eae=xae.named("Text").props({type:"text",text:"",placeholder:"",fontSize:14,fontFamily:"Roboto",fontStyle:"normal",fontWeight:"normal",textDecoration:"",fill:"black",align:"center",width:100,height:0,verticalAlign:"top",strokeWidth:0,stroke:"black",lineHeight:Yne.optional(Yne.union(Yne.number,Yne.string),1.2),letterSpacing:0,_editModeEnabled:!1}).preProcessSnapshot((e=>({...e}))).actions((e=>({toggleEditMode(t){e._editModeEnabled=t??!e._editModeEnabled,e._editModeEnabled?e.store.history.startTransaction():e.store.history.endTransaction()}}))),_ae=xae.named("Image").props({type:"image",width:100,height:100,src:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,cornerRadius:0,flipX:!1,flipY:!1,clipSrc:"",borderColor:"black",borderSize:0,_cropModeEnabled:!1}).actions((e=>({toggleCropMode(t){e._cropModeEnabled=t??!e._cropModeEnabled,e._cropModeEnabled?e.store.history.startTransaction():e.store.history.endTransaction()}}))),zae=xae.named("SVG").props({type:"svg",src:"",maskSrc:"",__svgString:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,keepRatio:!0,flipX:!1,flipY:!1,width:100,height:100,borderColor:"black",borderSize:0,cornerRadius:0,colorsReplace:Yne.map(Yne.string)}).preProcessSnapshot((e=>({...e,src:e.src||e.svgSource}))).actions((e=>({replaceColor(t,n){e.colorsReplace.set(t,n)}}))),Sae={svg:zae,text:Eae,image:_ae},Cae=[];const Oae=[...new Array(20)].map(((e,t)=>Yne.late((()=>Cae[t])))),Mae=Yne.union({dispatcher:e=>{const t=Sae[e.type];if(!t)throw new Error(`Unknown element type: "${e.type}"`);return t}},zae,Eae,_ae,...Oae),Aae=Yne.model("Page",{id:Yne.identifier,children:Yne.array(Mae),width:Yne.optional(Yne.union(Yne.number,Yne.literal("auto")),"auto"),height:Yne.optional(Yne.union(Yne.number,Yne.literal("auto")),"auto"),background:"white",bleed:0,custom:Yne.frozen(),_exporting:!1}).postProcessSnapshot((e=>{const t={...e},n={};for(var r in t)"_"!==r[0]&&(n[r]=e[r]);return n})).views((e=>({get store(){return Eee(e,Lae)}}))).views((e=>({get computedWidth(){return"auto"===e.width?e.store.width:e.width},get computedHeight(){return"auto"===e.height?e.store.height:e.height}}))).actions((e=>({toJSON:()=>JSON.parse(JSON.stringify(xee(e))),_forEachElementUp(t,n){const r=t.map((t=>({id:t,index:e.children.findIndex((e=>e.id===t))})));r.sort(((e,t)=>t.index-e.index));for(const{index:i}of r){if(-1==i)continue;const r=i<e.children.length-1&&e.children[i+1],o=t.indexOf(r?.id)>=0;i===e.children.length-1||o||n(i)}},_forEachElementDown(t,n){const r=t.map((t=>({id:t,index:e.children.findIndex((e=>e.id===t))})));r.sort(((e,t)=>e.index-t.index));for(const{index:i}of r){if(-1==i)continue;const r=i>0&&e.children[i-1],o=t.indexOf(r?.id)>=0;0===i||o||n(i)}return!1}}))).actions((e=>({clone(t){const n=e.toJSON();n.children.forEach((e=>{e.id=ere(10)}));const r={...n,id:ere(10),...t},i=e.store.addPage(r),o=e.store.pages.indexOf(e);i.setZIndex(o+1),i.select()},setZIndex(t){e.store.setPageZIndex(e.id,t)},set(t){Object.assign(e,t)},select(){e.store.selectPage(e.id)},addElement(t){const n=Sae[t.type];if(!n)return void console.error("Can not find model with type "+t.type);const r=n.create({id:ere(10),...t});return e.children.push(r),r.selectable&&e.store.selectElements([r.id]),r},canMoveElementsUp(t){let n=!1;return e._forEachElementUp(t,(()=>{n=n||!0})),n},moveElementsUp(t){e._forEachElementUp(t,(t=>{const n=e.children[t];See(n),e.children.splice(t+1,0,n)}))},canMoveElementsTop(e){return this.canMoveElementsUp(e)},moveElementsTop(t){const n=[],r=[];e.children.forEach((e=>{t.indexOf(e.id)>=0?n.push(e):r.push(e)})),e.children.replace(r.concat(n))},canMoveElementsDown(t){let n=!1;return e._forEachElementDown(t,(()=>{n=n||!0})),n},moveElementsDown(t){e._forEachElementDown(t,(t=>{const n=e.children[t];See(n),e.children.splice(t-1,0,n)}))},canMoveElementsBottom(e){return this.canMoveElementsDown(e)},moveElementsBottom(t){const n=[],r=[];e.children.forEach((e=>{t.indexOf(e.id)>=0?n.push(e):r.push(e)})),e.children.replace(n.concat(r))},setElementZIndex(t,n){const r=e.children.find((e=>e.id===t));r&&(See(r),e.children.remove(r),e.children.splice(n,0,r))},setSize({width:t,height:n},{useMagic:r}){e.width=t,e.height=n}}))).actions((e=>({moveElementUp(t){console.warn("page.moveElementUp(id) is deprecated. Please use page.moveElementsUp([id1, id2]) instead."),e.moveElementsUp([t])},moveElementDown(t){console.warn("page.moveElementDown(id) is deprecated. Please use page.moveElementsDown([id1, id2]) instead."),e.moveElementsDown([t])},moveElementTop(t){console.warn("page.moveElementTop(id) is deprecated. Please use page.moveElementsTop([id1, id2]) instead."),e.moveElementsTop([t])},moveElementBottom(t){console.warn("page.moveElementBottom(id) is deprecated. Please use page.moveElementsBottom([id1, id2]) instead."),e.moveElementsBottom([t])}}))),kae=Yne.model("Font",{fontFamily:Yne.string,url:Yne.optional(Yne.string,""),styles:Yne.frozen()}).preProcessSnapshot((e=>({...e,fontFamily:e.fontFamily||e.name}))),Lae=Yne.model("Store",{role:"",pages:Yne.array(Aae),fonts:Yne.array(kae),width:1080,height:1080,scale:1,scaleToFit:1,unit:"px",dpi:72,bleedVisible:!1,rulesVisible:!1,openedSidePanel:"",selectedElementsIds:Yne.array(Yne.string),history:Yne.optional(gae,{targetPath:"../pages"}),_elementsPixelRatio:2,_activePageId:""}).views((e=>({get _bleedVisible(){return console.warn("store._bleedVisible is deprecated. Please use store.bleedVisible instead."),e.bleedVisible},get selectedElements(){return e.selectedElementsIds.map((t=>{for(const n of e.pages)for(const e of n.children)if(e.id===t)return e})).filter((e=>!!e))},get activePage(){return e.pages.slice().find((t=>t.id===e._activePageId))||(e.pages.length?e.pages[0]:null)}}))).actions((e=>({afterCreate(){e.history.canUndo},setUnit({unit:t,dpi:n}){e.unit=t||e.unit,e.dpi=n||e.dpi},setRole(t){e.role=t},getElementById(t){for(const n of e.pages)for(const e of n.children)if(e.id===t)return e},addPage(t){const n=Aae.create({id:ere(10),...t});return e.pages.push(n),e._activePageId=n.id,n},selectPage(t){e._activePageId=t},selectElements(t){const n=t.map((t=>e.getElementById(t))).sort(((e,t)=>e.page.children.indexOf(e)-e.page.children.indexOf(t))).filter((e=>!!e)).map((e=>e.id));e.selectedElementsIds=n},toggleBleed(t){e.bleedVisible=t??!e.bleedVisible},toggleRulers(t){e.rulesVisible=t??!e.rulesVisible},openSidePanel(t){e.openedSidePanel=t},setScale(t){e.scale=t},_setScaleToFit(t){e.scaleToFit=t},setElementsPixelRatio(t){e._elementsPixelRatio=t},setSize(t,n,r){if(r){const r=t/e.width,i=n/e.height;for(const t of e.pages)for(const e of t.children)e.set({x:e.x*r,y:e.y*i}),"text"===e.type?e.set({fontSize:e.fontSize*r,width:Math.max(e.width*r,2)}):"image"===e.type?e.set({width:e.width*r,height:e.height*i}):"svg"===e.type&&e.set({width:Math.max(e.width*r,2),height:Math.max(e.height*r,2)})}e.width=t,e.height=n},setPageZIndex(t,n){const r=e.pages.find((e=>e.id===t));r&&(See(r),e.pages.remove(r),e.pages.splice(n,0,r))},deletePages(t){const n=e.pages.indexOf(e.activePage);t.forEach((t=>{Cee(e.pages.find((e=>e.id===t)))}));const r=Math.min(e.pages.length-1,n),i=e.pages[r];i&&(e._activePageId=i.id),e.selectedElementsIds=e.selectedElementsIds.filter((t=>e.getElementById(t)))},deleteElements(t){t.forEach((t=>{e.pages.forEach((e=>{const n=e.children.find((e=>e.id===t));n&&Cee(n)}))})),e.selectedElementsIds=e.selectedElementsIds.filter((t=>e.getElementById(t)))},on(t,n){if("change"===t){let t=e.toJSON();return yee(e,(r=>{const i=e.toJSON();!mae(t,i)&&(t=i,n(i))}))}},async toDataURL({pixelRatio:t,ignoreBackground:n,pageId:r,mimeType:i,includeBleed:o,quality:a}={}){const l=t||1;r=r||e.pages[0]?.id;const s=e.pages.find((e=>e.id===r));if(!s)throw new Error(`No page for export with id ${r}`);s?.set({_exporting:!0});const c=await wae((()=>pl.stages.find((e=>e.getAttr("pageId")===r))));if(!c)throw new Error(`Export is failed. Can not find stage for page ${r}. Looks like <Workspace /> component is not mounted, but it is required in order to process the export.`);await e.waitLoading();const u=c.findOne(".page-container");c.find("Transformer").forEach((e=>e.visible(!1))),u.find(".page-background").forEach((e=>e.shadowEnabled(!1))),u.find(".page-background").forEach((e=>e.strokeEnabled(!1))),u.find(".highlighter").forEach((e=>e.visible(!1)));const h=u.findOne(".page-background-group"),f=h.clip();h.clip({x:null,y:null,width:null,height:null});const d=u.findOne(".elements-container"),p=d.clip();d.clip({x:null,y:null,width:null,height:null});const v=u.find((e=>e.getAttr("hideInExport")));v.forEach((e=>{e.setAttr("oldVisible",e.visible()),e.hide()}));const m=u.find((e=>!e.visible()&&e.getAttr("editModeEnabled")));m.forEach((e=>{e.setAttr("oldVisible",e.visible()),e.show()})),n&&u.find(".page-background").forEach((e=>e.hide()));const g=o?s.bleed:0;let y=g;e.bleedVisible&&o?y=0:e.bleedVisible&&!o&&(y=-s.bleed);const b=document.createElement("canvas");b.width=(s.computedWidth+2*g)*l,b.height=(s.computedHeight+2*g)*l;const w=b.getContext("2d");"image/jpeg"===i&&(w.fillStyle="white",w.fillRect(0,0,b.width,b.height));const x=u.toCanvas({x:u.x()-y*u.scaleX(),y:u.y()-y*u.scaleY(),width:(s.computedWidth+2*g)*u.scaleX(),height:(s.computedHeight+2*g)*u.scaleY(),pixelRatio:1/u.scaleX()*l});w.drawImage(x,0,0);const E=b.toDataURL(i,a);return n&&u.find(".page-background").forEach((e=>e.show())),v.forEach((e=>{e.visible(e.getAttr("oldVisible"))})),m.forEach((e=>{e.visible(e.getAttr("oldVisible"))})),u.find(".page-background").forEach((e=>e.shadowEnabled(!0))),u.find(".page-background").forEach((e=>e.strokeEnabled(!0))),c.find("Transformer").forEach((e=>e.visible(!0))),u.find(".highlighter").forEach((e=>e.visible(!0))),h.clip(f),d.clip(p),s?.set({_exporting:!1}),E},async saveAsImage({fileName:t,...n}={}){const r=n.mimeType||"image/png",i=r.split("/")[1];yae(await e.toDataURL(n),t||"polotno."+i)},async _toPDF(t){const n=t.dpi||e.dpi,r=t.parallel||1,i=t.unit||("px"===e.unit?"mm":e.unit),o=t.pixelRatio||1,a=await(bae?Promise.resolve(bae):new Promise((e=>{var t=document.createElement("script");t.onload=function(){bae=window.jspdf.jsPDF,e(bae)},t.src="https://unpkg.com/jspdf@2.2.0/dist/jspdf.umd.min.js",document.head.appendChild(t)}))),l=e=>aY({px:e,unit:i,dpi:n}),s=e.pages[0]||{},c=t.includeBleed?s.bleed:0,u=l(s.computedWidth+2*c),h=l(s.computedHeight+2*c);var f=new a({unit:i,orientation:u>h?"landscape":"portrait",format:[u,h],compress:!0});f.deletePage(1);const d=e._elementsPixelRatio;e.setElementsPixelRatio(o),await new Promise((e=>setTimeout(e)));const p=((e,t)=>{for(var n=[],r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n})(e.pages,r);for(const n of p){const r=n.map((async n=>{const r=t.includeBleed?n.bleed:0,i=l(n.computedWidth+2*r),a=l(n.computedHeight+2*r);let s=0,c=o;for(;s<10;){s+=1,2===s&&console.error("Polotno can not export PDF with current settings. Quality is automatically reduced.");const r=await e.toDataURL({...t,pageId:n.id,pixelRatio:c});if(r.length>20)return{url:r,width:i,height:a};c*=.8}}));(await Promise.all(r)).forEach((({url:e,width:t,height:n})=>{f.addPage([t,n],t>n?"landscape":"portrait"),f.addImage(e,0,0,t,n,void 0,"FAST")}))}return e.setElementsPixelRatio(d),f},toPDFDataURL:async t=>(await e._toPDF({mimeType:"image/jpeg",...t})).output("datauristring"),async saveAsPDF({fileName:t,...n}={}){(await e._toPDF({mimeType:"image/jpeg",...n})).save(t||"polotno.pdf")},async waitLoading(){await new Promise((e=>setTimeout(e,50))),await Ys()},toJSON:()=>({width:e.width,height:e.height,fonts:xee(e.fonts),pages:xee(e.pages),unit:e.unit,dpi:e.dpi}),loadJSON(t,n=!1){const r={...t},i=e.pages.indexOf(e.activePage);let o=(r.pages[i]||r.pages[0])?.id;r._activePageId=o;const a={...xee(e)};Object.assign(a,r),a.history=n?e.history.toJSON():{history:[],undoIdx:-1},wee(e,a)},addFont(t){e.removeFont(t.fontFamily),e.fonts.push(t),e.loadFont(t.fontFamily)},removeFont(t){e.fonts.filter((e=>e.fontFamily===t)).forEach((e=>Cee(e)))},async loadFont(t){const n=e.fonts.find((e=>e.fontFamily===t))||tc.find((e=>e.fontFamily===t));n?function(e){const t=e.fontFamily;if(sc[t])return;if(!e.url&&!e.styles)return;const n=document.createElement("style");n.type="text/css";const r=e.styles||(e.url?[{src:`url("${e.url}")`}]:[]);let i="";r.forEach((e=>{i+=`\n @font-face {\n font-family: '${t}';\n src: ${e.src};\n font-style: ${e.fontStyle||"normal"};\n font-weight: ${e.fontWeight||"normal"};\n }\n `})),n.innerHTML=i,document.getElementsByTagName("head")[0].appendChild(n),sc[e.fontFamily]=!0}(n):function(e){if(lc[e])return;const t=`https://fonts.googleapis.com/css?family=${e.replace(/ /g,"+")}`,n=document.createElement("link");n.type="text/css",n.href=t,n.rel="stylesheet",document.getElementsByTagName("head")[0].appendChild(n),lc[e]=!0}(t),await ac(t)}})));function Pae({key:e,showCredit:t}={key:"",showCredit:!1}){const n=Lae.create();return oY(e,t),n}const Tae=Ch("div")`
|
|
398
398
|
display: flex;
|
|
399
399
|
height: 100%;
|
|
400
400
|
width: 100%;
|
|
@@ -403,7 +403,7 @@ function are(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Ob
|
|
|
403
403
|
@media screen and (max-width: 500px) {
|
|
404
404
|
flex-direction: column-reverse;
|
|
405
405
|
}
|
|
406
|
-
`,
|
|
406
|
+
`,Hae=Ch("div")`
|
|
407
407
|
height: 100%;
|
|
408
408
|
width: auto;
|
|
409
409
|
max-height: 100vh;
|
|
@@ -412,12 +412,12 @@ function are(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Ob
|
|
|
412
412
|
height: auto;
|
|
413
413
|
width: 100vw;
|
|
414
414
|
}
|
|
415
|
-
`,
|
|
415
|
+
`,Nae=Ch("div")`
|
|
416
416
|
display: flex;
|
|
417
417
|
height: 100%;
|
|
418
418
|
width: 100%;
|
|
419
419
|
flex: 1;
|
|
420
420
|
flex-direction: column;
|
|
421
421
|
position: relative;
|
|
422
|
-
`,
|
|
422
|
+
`,Rae=({store:e,style:t})=>(0,s.jsxs)(Tae,{className:"polotno-app-container",style:t,children:[(0,s.jsx)(Hae,{children:(0,s.jsx)(hae,{store:e})}),(0,s.jsxs)(Nae,{children:[(0,s.jsx)(p8,{store:e,components:{ActionControls:()=>(0,s.jsx)(t8,{store:e})}}),(0,s.jsx)(AY,{store:e}),(0,s.jsx)(vae,{store:e})]})]});function jae({container:e,key:t,showCredit:r}){const i=Pae({key:t,showCredit:r}),o=n(h).createRoot(e);return o.render((0,s.jsx)(Rae,{store:i})),i.addPage(),i.history.clear(),{store:i,root:o}}window.createPolotnoApp=jae})();
|
|
423
423
|
//# sourceMappingURL=polotno.bundle.js.map
|