@ninesstudios/whiteboard 0.1.6 β 0.1.8
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/dist/whiteboard.es.js +1899 -1835
- package/dist/whiteboard.es.js.map +1 -1
- package/dist/whiteboard.umd.js +23 -23
- package/dist/whiteboard.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/whiteboard.umd.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(Ce,P){typeof exports=="object"&&typeof module<"u"?P(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],P):(Ce=typeof globalThis<"u"?globalThis:Ce||self,P(Ce.Whiteboard={},Ce.React,Ce.ReactDOM))})(this,(function(Ce,P,Hr){"use strict";function bo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Be=bo(P);var Vt={exports:{}},vt={};/*
|
|
2
2
|
object-assign
|
|
3
3
|
(c) Sindre Sorhus
|
|
4
4
|
@license MIT
|
|
5
|
-
*/var ar,qr;function Gr(){if(qr)return ar;qr=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function n(a){if(a==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(a)}function
|
|
5
|
+
*/var ar,qr;function Gr(){if(qr)return ar;qr=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function n(a){if(a==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(a)}function i(){try{if(!Object.assign)return!1;var a=new String("abc");if(a[5]="de",Object.getOwnPropertyNames(a)[0]==="5")return!1;for(var l={},u=0;u<10;u++)l["_"+String.fromCharCode(u)]=u;var p=Object.getOwnPropertyNames(l).map(function(v){return l[v]});if(p.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(v){c[v]=v}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return ar=i()?Object.assign:function(a,l){for(var u,p=n(a),c,v=1;v<arguments.length;v++){u=Object(arguments[v]);for(var b in u)t.call(u,b)&&(p[b]=u[b]);if(e){c=e(u);for(var s=0;s<c.length;s++)r.call(u,c[s])&&(p[c[s]]=u[c[s]])}}return p},ar}/** @license React v17.0.2
|
|
6
6
|
* react-jsx-runtime.production.min.js
|
|
7
7
|
*
|
|
8
8
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
9
9
|
*
|
|
10
10
|
* This source code is licensed under the MIT license found in the
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/var Kr;function
|
|
12
|
+
*/var Kr;function wo(){if(Kr)return vt;Kr=1,Gr();var e=P,t=60103;if(vt.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var r=Symbol.for;t=r("react.element"),vt.Fragment=r("react.fragment")}var n=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i=Object.prototype.hasOwnProperty,a={key:!0,ref:!0,__self:!0,__source:!0};function l(u,p,c){var v,b={},s=null,S=null;c!==void 0&&(s=""+c),p.key!==void 0&&(s=""+p.key),p.ref!==void 0&&(S=p.ref);for(v in p)i.call(p,v)&&!a.hasOwnProperty(v)&&(b[v]=p[v]);if(u&&u.defaultProps)for(v in p=u.defaultProps,p)b[v]===void 0&&(b[v]=p[v]);return{$$typeof:t,type:u,key:s,ref:S,props:b,_owner:n.current}}return vt.jsx=l,vt.jsxs=l,vt}var sr={};/** @license React v17.0.2
|
|
13
13
|
* react-jsx-runtime.development.js
|
|
14
14
|
*
|
|
15
15
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
16
16
|
*
|
|
17
17
|
* This source code is licensed under the MIT license found in the
|
|
18
18
|
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/var Jr;function
|
|
20
|
-
`+qe+
|
|
19
|
+
*/var Jr;function xo(){return Jr||(Jr=1,(function(e){process.env.NODE_ENV!=="production"&&(function(){var t=P,r=Gr(),n=60103,i=60106;e.Fragment=60107;var a=60108,l=60114,u=60109,p=60110,c=60112,v=60113,b=60120,s=60115,S=60116,m=60121,y=60122,E=60117,C=60129,O=60131;if(typeof Symbol=="function"&&Symbol.for){var k=Symbol.for;n=k("react.element"),i=k("react.portal"),e.Fragment=k("react.fragment"),a=k("react.strict_mode"),l=k("react.profiler"),u=k("react.provider"),p=k("react.context"),c=k("react.forward_ref"),v=k("react.suspense"),b=k("react.suspense_list"),s=k("react.memo"),S=k("react.lazy"),m=k("react.block"),y=k("react.server.block"),E=k("react.fundamental"),k("react.scope"),k("react.opaque.id"),C=k("react.debug_trace_mode"),k("react.offscreen"),O=k("react.legacy_hidden")}var I=typeof Symbol=="function"&&Symbol.iterator,x="@@iterator";function D(d){if(d===null||typeof d!="object")return null;var R=I&&d[I]||d[x];return typeof R=="function"?R:null}var F=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function j(d){{for(var R=arguments.length,W=new Array(R>1?R-1:0),U=1;U<R;U++)W[U-1]=arguments[U];X("error",d,W)}}function X(d,R,W){{var U=F.ReactDebugCurrentFrame,Z=U.getStackAddendum();Z!==""&&(R+="%s",W=W.concat([Z]));var Q=W.map(function(J){return""+J});Q.unshift("Warning: "+R),Function.prototype.apply.call(console[d],console,Q)}}var M=!1;function oe(d){return!!(typeof d=="string"||typeof d=="function"||d===e.Fragment||d===l||d===C||d===a||d===v||d===b||d===O||M||typeof d=="object"&&d!==null&&(d.$$typeof===S||d.$$typeof===s||d.$$typeof===u||d.$$typeof===p||d.$$typeof===c||d.$$typeof===E||d.$$typeof===m||d[0]===y))}function ue(d,R,W){var U=R.displayName||R.name||"";return d.displayName||(U!==""?W+"("+U+")":W)}function he(d){return d.displayName||"Context"}function pe(d){if(d==null)return null;if(typeof d.tag=="number"&&j("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d;switch(d){case e.Fragment:return"Fragment";case i:return"Portal";case l:return"Profiler";case a:return"StrictMode";case v:return"Suspense";case b:return"SuspenseList"}if(typeof d=="object")switch(d.$$typeof){case p:var R=d;return he(R)+".Consumer";case u:var W=d;return he(W._context)+".Provider";case c:return ue(d,d.render,"ForwardRef");case s:return pe(d.type);case m:return pe(d._render);case S:{var U=d,Z=U._payload,Q=U._init;try{return pe(Q(Z))}catch{return null}}}return null}var we=0,Te,Pe,ke,Ve,Re,Ne,$e;function Fe(){}Fe.__reactDisabledLog=!0;function rt(){{if(we===0){Te=console.log,Pe=console.info,ke=console.warn,Ve=console.error,Re=console.group,Ne=console.groupCollapsed,$e=console.groupEnd;var d={configurable:!0,enumerable:!0,value:Fe,writable:!0};Object.defineProperties(console,{info:d,log:d,warn:d,error:d,group:d,groupCollapsed:d,groupEnd:d})}we++}}function lt(){{if(we--,we===0){var d={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:r({},d,{value:Te}),info:r({},d,{value:Pe}),warn:r({},d,{value:ke}),error:r({},d,{value:Ve}),group:r({},d,{value:Re}),groupCollapsed:r({},d,{value:Ne}),groupEnd:r({},d,{value:$e})})}we<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Xe=F.ReactCurrentDispatcher,qe;function Ae(d,R,W){{if(qe===void 0)try{throw Error()}catch(Z){var U=Z.stack.trim().match(/\n( *(at )?)/);qe=U&&U[1]||""}return`
|
|
20
|
+
`+qe+d}}var Oe=!1,Ie;{var nt=typeof WeakMap=="function"?WeakMap:Map;Ie=new nt}function V(d,R){if(!d||Oe)return"";{var W=Ie.get(d);if(W!==void 0)return W}var U;Oe=!0;var Z=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Q;Q=Xe.current,Xe.current=null,rt();try{if(R){var J=function(){throw Error()};if(Object.defineProperty(J.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(J,[])}catch(We){U=We}Reflect.construct(d,[],J)}else{try{J.call()}catch(We){U=We}d.call(J.prototype)}}else{try{throw Error()}catch(We){U=We}d()}}catch(We){if(We&&U&&typeof We.stack=="string"){for(var G=We.stack.split(`
|
|
21
21
|
`),ce=U.stack.split(`
|
|
22
|
-
`),
|
|
23
|
-
`+G[
|
|
22
|
+
`),ae=G.length-1,de=ce.length-1;ae>=1&&de>=0&&G[ae]!==ce[de];)de--;for(;ae>=1&&de>=0;ae--,de--)if(G[ae]!==ce[de]){if(ae!==1||de!==1)do if(ae--,de--,de<0||G[ae]!==ce[de]){var Le=`
|
|
23
|
+
`+G[ae].replace(" at new "," at ");return typeof d=="function"&&Ie.set(d,Le),Le}while(ae>=1&&de>=0);break}}}finally{Oe=!1,Xe.current=Q,lt(),Error.prepareStackTrace=Z}var Ge=d?d.displayName||d.name:"",ir=Ge?Ae(Ge):"";return typeof d=="function"&&Ie.set(d,ir),ir}function Ee(d,R,W){return V(d,!1)}function $(d){var R=d.prototype;return!!(R&&R.isReactComponent)}function ge(d,R,W){if(d==null)return"";if(typeof d=="function")return V(d,$(d));if(typeof d=="string")return Ae(d);switch(d){case v:return Ae("Suspense");case b:return Ae("SuspenseList")}if(typeof d=="object")switch(d.$$typeof){case c:return Ee(d.render);case s:return ge(d.type,R,W);case m:return Ee(d._render);case S:{var U=d,Z=U._payload,Q=U._init;try{return ge(Q(Z),R,W)}catch{}}}return""}var je={},De=F.ReactDebugCurrentFrame;function xt(d){if(d){var R=d._owner,W=ge(d.type,d._source,R?R.type:null);De.setExtraStackFrame(W)}else De.setExtraStackFrame(null)}function tr(d,R,W,U,Z){{var Q=Function.call.bind(Object.prototype.hasOwnProperty);for(var J in d)if(Q(d,J)){var G=void 0;try{if(typeof d[J]!="function"){var ce=Error((U||"React class")+": "+W+" type `"+J+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof d[J]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ce.name="Invariant Violation",ce}G=d[J](R,J,U,W,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ae){G=ae}G&&!(G instanceof Error)&&(xt(Z),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",U||"React class",W,J,typeof G),xt(null)),G instanceof Error&&!(G.message in je)&&(je[G.message]=!0,xt(Z),j("Failed %s type: %s",W,G.message),xt(null))}}}var me=F.ReactCurrentOwner,Et=Object.prototype.hasOwnProperty,Nt={key:!0,ref:!0,__self:!0,__source:!0},At,It;function rr(d){if(Et.call(d,"ref")){var R=Object.getOwnPropertyDescriptor(d,"ref").get;if(R&&R.isReactWarning)return!1}return d.ref!==void 0}function St(d){if(Et.call(d,"key")){var R=Object.getOwnPropertyDescriptor(d,"key").get;if(R&&R.isReactWarning)return!1}return d.key!==void 0}function nr(d,R){typeof d.ref=="string"&&me.current}function se(d,R){{var W=function(){At||(At=!0,j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",R))};W.isReactWarning=!0,Object.defineProperty(d,"key",{get:W,configurable:!0})}}function Dt(d,R){{var W=function(){It||(It=!0,j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",R))};W.isReactWarning=!0,Object.defineProperty(d,"ref",{get:W,configurable:!0})}}var Fr=function(d,R,W,U,Z,Q,J){var G={$$typeof:n,type:d,key:R,ref:W,props:J,_owner:Q};return G._store={},Object.defineProperty(G._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(G,"_self",{configurable:!1,enumerable:!1,writable:!1,value:U}),Object.defineProperty(G,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Z}),Object.freeze&&(Object.freeze(G.props),Object.freeze(G)),G};function ut(d,R,W,U,Z){{var Q,J={},G=null,ce=null;W!==void 0&&(G=""+W),St(R)&&(G=""+R.key),rr(R)&&(ce=R.ref,nr(R,Z));for(Q in R)Et.call(R,Q)&&!Nt.hasOwnProperty(Q)&&(J[Q]=R[Q]);if(d&&d.defaultProps){var ae=d.defaultProps;for(Q in ae)J[Q]===void 0&&(J[Q]=ae[Q])}if(G||ce){var de=typeof d=="function"?d.displayName||d.name||"Unknown":d;G&&se(J,de),ce&&Dt(J,de)}return Fr(d,G,ce,Z,U,me.current,J)}}var Ct=F.ReactCurrentOwner,zt=F.ReactDebugCurrentFrame;function ze(d){if(d){var R=d._owner,W=ge(d.type,d._source,R?R.type:null);zt.setExtraStackFrame(W)}else zt.setExtraStackFrame(null)}var ot;ot=!1;function it(d){return typeof d=="object"&&d!==null&&d.$$typeof===n}function Lt(){{if(Ct.current){var d=pe(Ct.current.type);if(d)return`
|
|
24
24
|
|
|
25
|
-
Check the render method of \``+
|
|
25
|
+
Check the render method of \``+d+"`."}return""}}function _t(d){return""}var ft={};function Ot(d){{var R=Lt();if(!R){var W=typeof d=="string"?d:d.displayName||d.name;W&&(R=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+
|
|
27
|
+
Check the top-level render call using <`+W+">.")}return R}}function dt(d,R){{if(!d._store||d._store.validated||d.key!=null)return;d._store.validated=!0;var W=Ot(R);if(ft[W])return;ft[W]=!0;var U="";d&&d._owner&&d._owner!==Ct.current&&(U=" It was passed a child from "+pe(d._owner.type)+"."),ze(d),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',W,U),ze(null)}}function ht(d,R){{if(typeof d!="object")return;if(Array.isArray(d))for(var W=0;W<d.length;W++){var U=d[W];it(U)&&dt(U,R)}else if(it(d))d._store&&(d._store.validated=!0);else if(d){var Z=D(d);if(typeof Z=="function"&&Z!==d.entries)for(var Q=Z.call(d),J;!(J=Q.next()).done;)it(J.value)&&dt(J.value,R)}}}function jt(d){{var R=d.type;if(R==null||typeof R=="string")return;var W;if(typeof R=="function")W=R.propTypes;else if(typeof R=="object"&&(R.$$typeof===c||R.$$typeof===s))W=R.propTypes;else return;if(W){var U=pe(R);tr(W,d.props,"prop",U,d)}else if(R.PropTypes!==void 0&&!ot){ot=!0;var Z=pe(R);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Z||"Unknown")}typeof R.getDefaultProps=="function"&&!R.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tt(d){{for(var R=Object.keys(d.props),W=0;W<R.length;W++){var U=R[W];if(U!=="children"&&U!=="key"){ze(d),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",U),ze(null);break}}d.ref!==null&&(ze(d),j("Invalid attribute `ref` supplied to `React.Fragment`."),ze(null))}}function pt(d,R,W,U,Z,Q){{var J=oe(d);if(!J){var G="";(d===void 0||typeof d=="object"&&d!==null&&Object.keys(d).length===0)&&(G+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ce=_t();ce?G+=ce:G+=Lt();var ae;d===null?ae="null":Array.isArray(d)?ae="array":d!==void 0&&d.$$typeof===n?(ae="<"+(pe(d.type)||"Unknown")+" />",G=" Did you accidentally export a JSX literal instead of a component?"):ae=typeof d,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ae,G)}var de=ut(d,R,W,Z,Q);if(de==null)return de;if(J){var Le=R.children;if(Le!==void 0)if(U)if(Array.isArray(Le)){for(var Ge=0;Ge<Le.length;Ge++)ht(Le[Ge],d);Object.freeze&&Object.freeze(Le)}else j("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ht(Le,d)}return d===e.Fragment?Tt(de):jt(de),de}}function Wt(d,R,W){return pt(d,R,W,!0)}function or(d,R,W){return pt(d,R,W,!1)}var Pt=or,Xr=Wt;e.jsx=Pt,e.jsxs=Xr})()})(sr)),sr}var Zr;function Eo(){return Zr||(Zr=1,process.env.NODE_ENV==="production"?Vt.exports=wo():Vt.exports=xo()),Vt.exports}var h=Eo(),$t={exports:{}},cr={};/**
|
|
28
28
|
* @license React
|
|
29
29
|
* use-sync-external-store-shim.production.js
|
|
30
30
|
*
|
|
@@ -32,7 +32,7 @@ Check the top-level render call using <`+L+">.")}return R}}function dt(f,R){{if(
|
|
|
32
32
|
*
|
|
33
33
|
* This source code is licensed under the MIT license found in the
|
|
34
34
|
* LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/var Qr;function
|
|
35
|
+
*/var Qr;function So(){if(Qr)return cr;Qr=1;var e=P;function t(b,s){return b===s&&(b!==0||1/b===1/s)||b!==b&&s!==s}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,i=e.useEffect,a=e.useLayoutEffect,l=e.useDebugValue;function u(b,s){var S=s(),m=n({inst:{value:S,getSnapshot:s}}),y=m[0].inst,E=m[1];return a(function(){y.value=S,y.getSnapshot=s,p(y)&&E({inst:y})},[b,S,s]),i(function(){return p(y)&&E({inst:y}),b(function(){p(y)&&E({inst:y})})},[b]),l(S),S}function p(b){var s=b.getSnapshot;b=b.value;try{var S=s();return!r(b,S)}catch{return!0}}function c(b,s){return s()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:u;return cr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,cr}var lr={};/**
|
|
36
36
|
* @license React
|
|
37
37
|
* use-sync-external-store-shim.development.js
|
|
38
38
|
*
|
|
@@ -40,7 +40,7 @@ Check the top-level render call using <`+L+">.")}return R}}function dt(f,R){{if(
|
|
|
40
40
|
*
|
|
41
41
|
* This source code is licensed under the MIT license found in the
|
|
42
42
|
* LICENSE file in the root directory of this source tree.
|
|
43
|
-
*/var en;function
|
|
43
|
+
*/var en;function Co(){return en||(en=1,process.env.NODE_ENV!=="production"&&(function(){function e(S,m){return S===m&&(S!==0||1/S===1/m)||S!==S&&m!==m}function t(S,m){v||i.startTransition===void 0||(v=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var y=m();if(!b){var E=m();a(y,E)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),b=!0)}E=l({inst:{value:y,getSnapshot:m}});var C=E[0].inst,O=E[1];return p(function(){C.value=y,C.getSnapshot=m,r(C)&&O({inst:C})},[S,y,m]),u(function(){return r(C)&&O({inst:C}),S(function(){r(C)&&O({inst:C})})},[S]),c(y),y}function r(S){var m=S.getSnapshot;S=S.value;try{var y=m();return!a(S,y)}catch{return!0}}function n(S,m){return m()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=P,a=typeof Object.is=="function"?Object.is:e,l=i.useState,u=i.useEffect,p=i.useLayoutEffect,c=i.useDebugValue,v=!1,b=!1,s=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;lr.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:s,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),lr}var tn;function ur(){return tn||(tn=1,process.env.NODE_ENV==="production"?$t.exports=So():$t.exports=Co()),$t.exports}ur();var Ft={exports:{}},fr={};/**
|
|
44
44
|
* @license React
|
|
45
45
|
* use-sync-external-store-shim/with-selector.production.js
|
|
46
46
|
*
|
|
@@ -48,7 +48,7 @@ Check the top-level render call using <`+L+">.")}return R}}function dt(f,R){{if(
|
|
|
48
48
|
*
|
|
49
49
|
* This source code is licensed under the MIT license found in the
|
|
50
50
|
* LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/var rn;function
|
|
51
|
+
*/var rn;function _o(){if(rn)return fr;rn=1;var e=P,t=ur();function r(c,v){return c===v&&(c!==0||1/c===1/v)||c!==c&&v!==v}var n=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,a=e.useRef,l=e.useEffect,u=e.useMemo,p=e.useDebugValue;return fr.useSyncExternalStoreWithSelector=function(c,v,b,s,S){var m=a(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=u(function(){function C(D){if(!O){if(O=!0,k=D,D=s(D),S!==void 0&&y.hasValue){var F=y.value;if(S(F,D))return I=F}return I=D}if(F=I,n(k,D))return F;var j=s(D);return S!==void 0&&S(F,j)?(k=D,F):(k=D,I=j)}var O=!1,k,I,x=b===void 0?null:b;return[function(){return C(v())},x===null?void 0:function(){return C(x())}]},[v,b,s,S]);var E=i(c,m[0],m[1]);return l(function(){y.hasValue=!0,y.value=E},[E]),p(E),E},fr}var dr={};/**
|
|
52
52
|
* @license React
|
|
53
53
|
* use-sync-external-store-shim/with-selector.development.js
|
|
54
54
|
*
|
|
@@ -56,23 +56,23 @@ Check the top-level render call using <`+L+">.")}return R}}function dt(f,R){{if(
|
|
|
56
56
|
*
|
|
57
57
|
* This source code is licensed under the MIT license found in the
|
|
58
58
|
* LICENSE file in the root directory of this source tree.
|
|
59
|
-
*/var nn;function
|
|
60
|
-
Selectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization`,{state:
|
|
61
|
-
Selectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.`,{stack:I})}S.current&&(S.current=!1)}return C}}[n.name],[n,
|
|
59
|
+
*/var nn;function Oo(){return nn||(nn=1,process.env.NODE_ENV!=="production"&&(function(){function e(c,v){return c===v&&(c!==0||1/c===1/v)||c!==c&&v!==v}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=P,r=ur(),n=typeof Object.is=="function"?Object.is:e,i=r.useSyncExternalStore,a=t.useRef,l=t.useEffect,u=t.useMemo,p=t.useDebugValue;dr.useSyncExternalStoreWithSelector=function(c,v,b,s,S){var m=a(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=u(function(){function C(D){if(!O){if(O=!0,k=D,D=s(D),S!==void 0&&y.hasValue){var F=y.value;if(S(F,D))return I=F}return I=D}if(F=I,n(k,D))return F;var j=s(D);return S!==void 0&&S(F,j)?(k=D,F):(k=D,I=j)}var O=!1,k,I,x=b===void 0?null:b;return[function(){return C(v())},x===null?void 0:function(){return C(x())}]},[v,b,s,S]);var E=i(c,m[0],m[1]);return l(function(){y.hasValue=!0,y.value=E},[E]),p(E),E},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),dr}var on;function jo(){return on||(on=1,process.env.NODE_ENV==="production"?Ft.exports=_o():Ft.exports=Oo()),Ft.exports}var To=jo();function Po(e){e()}let an=Po;const ko=e=>an=e,Mo=()=>an,sn=Symbol.for("react-redux-context"),cn=typeof globalThis<"u"?globalThis:{};function Ro(){var e;if(!Be.createContext)return{};const t=(e=cn[sn])!=null?e:cn[sn]=new Map;let r=t.get(Be.createContext);return r||(r=Be.createContext(null),process.env.NODE_ENV!=="production"&&(r.displayName="ReactRedux"),t.set(Be.createContext,r)),r}const Ke=Ro();function hr(e=Ke){return function(){const r=P.useContext(e);if(process.env.NODE_ENV!=="production"&&!r)throw new Error("could not find react-redux context value; please ensure the component is wrapped in a <Provider>");return r}}const ln=hr();let un=()=>{throw new Error("uSES not initialized!")};const No=e=>{un=e},Ao=(e,t)=>e===t;function Io(e=Ke){const t=e===Ke?ln:hr(e);return function(n,i={}){const{equalityFn:a=Ao,stabilityCheck:l=void 0,noopCheck:u=void 0}=typeof i=="function"?{equalityFn:i}:i;if(process.env.NODE_ENV!=="production"){if(!n)throw new Error("You must pass a selector to useSelector");if(typeof n!="function")throw new Error("You must pass a function as a selector to useSelector");if(typeof a!="function")throw new Error("You must pass a function as an equality function to useSelector")}const{store:p,subscription:c,getServerState:v,stabilityCheck:b,noopCheck:s}=t(),S=P.useRef(!0),m=P.useCallback({[n.name](E){const C=n(E);if(process.env.NODE_ENV!=="production"){const O=typeof l>"u"?b:l;if(O==="always"||O==="once"&&S.current){const I=n(E);if(!a(C,I)){let x;try{throw new Error}catch(D){({stack:x}=D)}console.warn("Selector "+(n.name||"unknown")+` returned a different result when called with the same parameters. This can lead to unnecessary rerenders.
|
|
60
|
+
Selectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization`,{state:E,selected:C,selected2:I,stack:x})}}const k=typeof u>"u"?s:u;if((k==="always"||k==="once"&&S.current)&&C===E){let I;try{throw new Error}catch(x){({stack:I}=x)}console.warn("Selector "+(n.name||"unknown")+` returned the root state when called. This can lead to unnecessary rerenders.
|
|
61
|
+
Selectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.`,{stack:I})}S.current&&(S.current=!1)}return C}}[n.name],[n,b,l]),y=un(c.addNestedSub,p.getState,v||p.getState,m,a);return P.useDebugValue(y),y}}const xe=Io();var Xt={exports:{}},ee={};/** @license React v16.13.1
|
|
62
62
|
* react-is.production.min.js
|
|
63
63
|
*
|
|
64
64
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
65
65
|
*
|
|
66
66
|
* This source code is licensed under the MIT license found in the
|
|
67
67
|
* LICENSE file in the root directory of this source tree.
|
|
68
|
-
*/var fn;function
|
|
68
|
+
*/var fn;function Do(){if(fn)return ee;fn=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,p=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,v=e?Symbol.for("react.forward_ref"):60112,b=e?Symbol.for("react.suspense"):60113,s=e?Symbol.for("react.suspense_list"):60120,S=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,E=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,O=e?Symbol.for("react.scope"):60119;function k(x){if(typeof x=="object"&&x!==null){var D=x.$$typeof;switch(D){case t:switch(x=x.type,x){case p:case c:case n:case a:case i:case b:return x;default:switch(x=x&&x.$$typeof,x){case u:case v:case m:case S:case l:return x;default:return D}}case r:return D}}}function I(x){return k(x)===c}return ee.AsyncMode=p,ee.ConcurrentMode=c,ee.ContextConsumer=u,ee.ContextProvider=l,ee.Element=t,ee.ForwardRef=v,ee.Fragment=n,ee.Lazy=m,ee.Memo=S,ee.Portal=r,ee.Profiler=a,ee.StrictMode=i,ee.Suspense=b,ee.isAsyncMode=function(x){return I(x)||k(x)===p},ee.isConcurrentMode=I,ee.isContextConsumer=function(x){return k(x)===u},ee.isContextProvider=function(x){return k(x)===l},ee.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===t},ee.isForwardRef=function(x){return k(x)===v},ee.isFragment=function(x){return k(x)===n},ee.isLazy=function(x){return k(x)===m},ee.isMemo=function(x){return k(x)===S},ee.isPortal=function(x){return k(x)===r},ee.isProfiler=function(x){return k(x)===a},ee.isStrictMode=function(x){return k(x)===i},ee.isSuspense=function(x){return k(x)===b},ee.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===n||x===c||x===a||x===i||x===b||x===s||typeof x=="object"&&x!==null&&(x.$$typeof===m||x.$$typeof===S||x.$$typeof===l||x.$$typeof===u||x.$$typeof===v||x.$$typeof===E||x.$$typeof===C||x.$$typeof===O||x.$$typeof===y)},ee.typeOf=k,ee}var te={};/** @license React v16.13.1
|
|
69
69
|
* react-is.development.js
|
|
70
70
|
*
|
|
71
71
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
72
72
|
*
|
|
73
73
|
* This source code is licensed under the MIT license found in the
|
|
74
74
|
* LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/var dn;function
|
|
75
|
+
*/var dn;function zo(){return dn||(dn=1,process.env.NODE_ENV!=="production"&&(function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,p=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,v=e?Symbol.for("react.forward_ref"):60112,b=e?Symbol.for("react.suspense"):60113,s=e?Symbol.for("react.suspense_list"):60120,S=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,E=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,O=e?Symbol.for("react.scope"):60119;function k(V){return typeof V=="string"||typeof V=="function"||V===n||V===c||V===a||V===i||V===b||V===s||typeof V=="object"&&V!==null&&(V.$$typeof===m||V.$$typeof===S||V.$$typeof===l||V.$$typeof===u||V.$$typeof===v||V.$$typeof===E||V.$$typeof===C||V.$$typeof===O||V.$$typeof===y)}function I(V){if(typeof V=="object"&&V!==null){var Ee=V.$$typeof;switch(Ee){case t:var $=V.type;switch($){case p:case c:case n:case a:case i:case b:return $;default:var ge=$&&$.$$typeof;switch(ge){case u:case v:case m:case S:case l:return ge;default:return Ee}}case r:return Ee}}}var x=p,D=c,F=u,j=l,X=t,M=v,oe=n,ue=m,he=S,pe=r,we=a,Te=i,Pe=b,ke=!1;function Ve(V){return ke||(ke=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),Re(V)||I(V)===p}function Re(V){return I(V)===c}function Ne(V){return I(V)===u}function $e(V){return I(V)===l}function Fe(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function rt(V){return I(V)===v}function lt(V){return I(V)===n}function Xe(V){return I(V)===m}function qe(V){return I(V)===S}function Ae(V){return I(V)===r}function Oe(V){return I(V)===a}function Ie(V){return I(V)===i}function nt(V){return I(V)===b}te.AsyncMode=x,te.ConcurrentMode=D,te.ContextConsumer=F,te.ContextProvider=j,te.Element=X,te.ForwardRef=M,te.Fragment=oe,te.Lazy=ue,te.Memo=he,te.Portal=pe,te.Profiler=we,te.StrictMode=Te,te.Suspense=Pe,te.isAsyncMode=Ve,te.isConcurrentMode=Re,te.isContextConsumer=Ne,te.isContextProvider=$e,te.isElement=Fe,te.isForwardRef=rt,te.isFragment=lt,te.isLazy=Xe,te.isMemo=qe,te.isPortal=Ae,te.isProfiler=Oe,te.isStrictMode=Ie,te.isSuspense=nt,te.isValidElementType=k,te.typeOf=I})()),te}var hn;function Lo(){return hn||(hn=1,process.env.NODE_ENV==="production"?Xt.exports=Do():Xt.exports=zo()),Xt.exports}var pr,pn;function Wo(){if(pn)return pr;pn=1;var e=Lo(),t={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},n={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};a[e.ForwardRef]=n,a[e.Memo]=i;function l(m){return e.isMemo(m)?i:a[m.$$typeof]||t}var u=Object.defineProperty,p=Object.getOwnPropertyNames,c=Object.getOwnPropertySymbols,v=Object.getOwnPropertyDescriptor,b=Object.getPrototypeOf,s=Object.prototype;function S(m,y,E){if(typeof y!="string"){if(s){var C=b(y);C&&C!==s&&S(m,C,E)}var O=p(y);c&&(O=O.concat(c(y)));for(var k=l(m),I=l(y),x=0;x<O.length;++x){var D=O[x];if(!r[D]&&!(E&&E[D])&&!(I&&I[D])&&!(k&&k[D])){var F=v(y,D);try{u(m,D,F)}catch{}}}}return m}return pr=S,pr}Wo();var Bt={exports:{}},re={};/**
|
|
76
76
|
* @license React
|
|
77
77
|
* react-is.production.min.js
|
|
78
78
|
*
|
|
@@ -80,7 +80,7 @@ Selectors that return the entire state are almost certainly a mistake, as they w
|
|
|
80
80
|
*
|
|
81
81
|
* This source code is licensed under the MIT license found in the
|
|
82
82
|
* LICENSE file in the root directory of this source tree.
|
|
83
|
-
*/var vn;function
|
|
83
|
+
*/var vn;function Yo(){if(vn)return re;vn=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.server_context"),p=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),s=Symbol.for("react.lazy"),S=Symbol.for("react.offscreen"),m;m=Symbol.for("react.module.reference");function y(E){if(typeof E=="object"&&E!==null){var C=E.$$typeof;switch(C){case e:switch(E=E.type,E){case r:case i:case n:case c:case v:return E;default:switch(E=E&&E.$$typeof,E){case u:case l:case p:case s:case b:case a:return E;default:return C}}case t:return C}}}return re.ContextConsumer=l,re.ContextProvider=a,re.Element=e,re.ForwardRef=p,re.Fragment=r,re.Lazy=s,re.Memo=b,re.Portal=t,re.Profiler=i,re.StrictMode=n,re.Suspense=c,re.SuspenseList=v,re.isAsyncMode=function(){return!1},re.isConcurrentMode=function(){return!1},re.isContextConsumer=function(E){return y(E)===l},re.isContextProvider=function(E){return y(E)===a},re.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===e},re.isForwardRef=function(E){return y(E)===p},re.isFragment=function(E){return y(E)===r},re.isLazy=function(E){return y(E)===s},re.isMemo=function(E){return y(E)===b},re.isPortal=function(E){return y(E)===t},re.isProfiler=function(E){return y(E)===i},re.isStrictMode=function(E){return y(E)===n},re.isSuspense=function(E){return y(E)===c},re.isSuspenseList=function(E){return y(E)===v},re.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===i||E===n||E===c||E===v||E===S||typeof E=="object"&&E!==null&&(E.$$typeof===s||E.$$typeof===b||E.$$typeof===a||E.$$typeof===l||E.$$typeof===p||E.$$typeof===m||E.getModuleId!==void 0)},re.typeOf=y,re}var ne={};/**
|
|
84
84
|
* @license React
|
|
85
85
|
* react-is.development.js
|
|
86
86
|
*
|
|
@@ -88,13 +88,13 @@ Selectors that return the entire state are almost certainly a mistake, as they w
|
|
|
88
88
|
*
|
|
89
89
|
* This source code is licensed under the MIT license found in the
|
|
90
90
|
* LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/var yn;function Yo(){return yn||(yn=1,process.env.NODE_ENV!=="production"&&(function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.server_context"),p=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),s=Symbol.for("react.lazy"),S=Symbol.for("react.offscreen"),m=!1,y=!1,w=!1,C=!1,_=!1,k;k=Symbol.for("react.module.reference");function I($){return!!(typeof $=="string"||typeof $=="function"||$===r||$===o||_||$===n||$===c||$===v||C||$===S||m||y||w||typeof $=="object"&&$!==null&&($.$$typeof===s||$.$$typeof===g||$.$$typeof===a||$.$$typeof===l||$.$$typeof===p||$.$$typeof===k||$.getModuleId!==void 0))}function x($){if(typeof $=="object"&&$!==null){var ge=$.$$typeof;switch(ge){case e:var je=$.type;switch(je){case r:case o:case n:case c:case v:return je;default:var De=je&&je.$$typeof;switch(De){case u:case l:case p:case s:case g:case a:return De;default:return ge}}case t:return ge}}}var D=l,F=a,O=e,B=p,M=r,oe=s,ue=g,he=t,pe=o,we=n,Pe=c,Te=v,ke=!1,Ve=!1;function Re($){return ke||(ke=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function Ne($){return Ve||(Ve=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function $e($){return x($)===l}function Fe($){return x($)===a}function rt($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function lt($){return x($)===p}function Be($){return x($)===r}function qe($){return x($)===s}function Ae($){return x($)===g}function Oe($){return x($)===t}function Ie($){return x($)===o}function nt($){return x($)===n}function V($){return x($)===c}function Ee($){return x($)===v}ne.ContextConsumer=D,ne.ContextProvider=F,ne.Element=O,ne.ForwardRef=B,ne.Fragment=M,ne.Lazy=oe,ne.Memo=ue,ne.Portal=he,ne.Profiler=pe,ne.StrictMode=we,ne.Suspense=Pe,ne.SuspenseList=Te,ne.isAsyncMode=Re,ne.isConcurrentMode=Ne,ne.isContextConsumer=$e,ne.isContextProvider=Fe,ne.isElement=rt,ne.isForwardRef=lt,ne.isFragment=Be,ne.isLazy=qe,ne.isMemo=Ae,ne.isPortal=Oe,ne.isProfiler=Ie,ne.isStrictMode=nt,ne.isSuspense=V,ne.isSuspenseList=Ee,ne.isValidElementType=I,ne.typeOf=x})()),ne}var mn;function Vo(){return mn||(mn=1,process.env.NODE_ENV==="production"?Xt.exports=Wo():Xt.exports=Yo()),Xt.exports}Vo();function $o(){const e=ko();let t=null,r=null;return{clear(){t=null,r=null},notify(){e(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){let n=[],o=t;for(;o;)n.push(o),o=o.next;return n},subscribe(n){let o=!0,a=r={callback:n,next:null,prev:r};return a.prev?a.prev.next=a:t=a,function(){!o||t===null||(o=!1,a.next?a.next.prev=a.prev:r=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}const gn={notify(){},get:()=>[]};function Fo(e,t){let r,n=gn,o=0,a=!1;function l(y){v();const w=n.subscribe(y);let C=!1;return()=>{C||(C=!0,w(),g())}}function u(){n.notify()}function p(){m.onStateChange&&m.onStateChange()}function c(){return a}function v(){o++,r||(r=e.subscribe(p),n=$o())}function g(){o--,r&&o===0&&(r(),r=void 0,n.clear(),n=gn)}function s(){a||(a=!0,v())}function S(){a&&(a=!1,g())}const m={addNestedSub:l,notifyNestedSubs:u,handleChangeWrapper:p,isSubscribed:c,trySubscribe:s,tryUnsubscribe:S,getListeners:()=>n};return m}const Bo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Xe.useLayoutEffect:Xe.useEffect;function Xo({store:e,context:t,children:r,serverState:n,stabilityCheck:o="once",noopCheck:a="once"}){const l=Xe.useMemo(()=>{const c=Fo(e);return{store:e,subscription:c,getServerState:n?()=>n:void 0,stabilityCheck:o,noopCheck:a}},[e,n,o,a]),u=Xe.useMemo(()=>e.getState(),[e]);Bo(()=>{const{subscription:c}=l;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),u!==e.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[l,u]);const p=t||Ke;return Xe.createElement(p.Provider,{value:l},r)}function bn(e=Ke){const t=e===Ke?ln:hr(e);return function(){const{store:n}=t();return n}}const wn=bn();function Uo(e=Ke){const t=e===Ke?wn:bn(e);return function(){return t().dispatch}}const vr=Uo();Ro(jo.useSyncExternalStoreWithSelector),To(Hr.unstable_batchedUpdates);const Ho={en:{pointer:"Pointer",text:"Text",image:"Image",pencil:"Pencil",rectangle:"Rectangle",circle:"Circle",eraser:"Eraser",fitToView:"Fit to view",exportAsPng:"Export as PNG",toggleGrid:"Toggle Grid",moreShapes:"More Shapes",triangle:"Triangle",diamond:"Diamond",star:"Star",heart:"Heart",hexagon:"Hexagon",octagon:"Octagon",arrow:"Arrow",fontSize:"Font Size",fontColor:"Font Color",layerOrder:"Layer Order",bringToFront:"Bring to Front",sendToBack:"Send to Back",brushColor:"Brush Color",brushSize:"Brush Size",strokeColor:"Stroke Color",fillColor:"Fill Color",strokeWidth:"Stroke Width",language:"Language",english:"English",turkish:"Turkish",trash:"Trash",confirmClear:"Are you sure you want to clear the whiteboard?",cancel:"Cancel",clear:"Clear"},tr:{pointer:"Δ°ΕaretΓ§i",text:"Metin",image:"Resim",pencil:"Kalem",rectangle:"DikdΓΆrtgen",circle:"Daire",eraser:"Silgi",fitToView:"Ekrana sΔ±ΔdΔ±r",exportAsPng:"PNG olarak dΔ±Εa aktar",toggleGrid:"IzgarayΔ± AΓ§/Kapat",moreShapes:"Daha Fazla Εekil",triangle:"ΓΓ§gen",diamond:"Elmas",star:"YΔ±ldΔ±z",heart:"Kalp",hexagon:"AltΔ±gen",octagon:"Sekizgen",arrow:"Ok",fontSize:"YazΔ± Boyutu",fontColor:"YazΔ± Rengi",layerOrder:"Katman SΔ±rasΔ±",bringToFront:"Γne Getir",sendToBack:"Arkaya GΓΆnder",brushColor:"FΔ±rΓ§a Rengi",brushSize:"FΔ±rΓ§a Boyutu",strokeColor:"Γizgi Rengi",fillColor:"Dolgu Rengi",strokeWidth:"Γizgi KalΔ±nlΔ±ΔΔ±",language:"Dil",english:"Δ°ngilizce",turkish:"TΓΌrkΓ§e",trash:"ΓΓΆp Kutusu",confirmClear:"TahtayΔ± temizlemek istediΔinizden emin misiniz?",cancel:"Δ°ptal",clear:"Temizle"}},xn=T.createContext(void 0),En="whiteboard-language",qo=()=>{const e=navigator.language;return e&&e.startsWith("tr")?"tr":"en"},Go=()=>{const e=localStorage.getItem(En);return e&&(e==="en"||e==="tr")?e:qo()},Ko=({children:e})=>{const[t,r]=T.useState(Go);T.useEffect(()=>{localStorage.setItem(En,t)},[t]);const n=a=>Ho[t][a]||a,o=a=>{r(a)};return h.jsx(xn.Provider,{value:{language:t,t:n,changeLanguage:o},children:e})},Ut=()=>{const e=T.useContext(xn);if(!e)throw new Error("useLanguage must be used within a LanguageProvider");return e};function ye(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(process.env.NODE_ENV!=="production"){var o=ii[e],a=o?typeof o=="function"?o.apply(null,r):o:"unknown error nr: "+e;throw Error("[Immer] "+a)}throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.map((function(l){return"'"+l+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Je(e){return!!e&&!!e[le]}function Ue(e){var t;return!!e&&((function(r){if(!r||typeof r!="object")return!1;var n=Object.getPrototypeOf(r);if(n===null)return!0;var o=Object.hasOwnProperty.call(n,"constructor")&&n.constructor;return o===Object||typeof o=="function"&&Function.toString.call(o)===ai})(e)||Array.isArray(e)||!!e[Rn]||!!(!((t=e.constructor)===null||t===void 0)&&t[Rn])||yr(e)||mr(e))}function at(e,t,r){r===void 0&&(r=!1),yt(e)===0?(r?Object.keys:bt)(e).forEach((function(n){r&&typeof n=="symbol"||t(n,e[n],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function yt(e){var t=e[le];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:yr(e)?2:mr(e)?3:0}function mt(e,t){return yt(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Jo(e,t){return yt(e)===2?e.get(t):e[t]}function Sn(e,t,r){var n=yt(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function Cn(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function yr(e){return ni&&e instanceof Map}function mr(e){return oi&&e instanceof Set}function Ze(e){return e.o||e.t}function gr(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Nn(e);delete t[le];for(var r=bt(t),n=0;n<r.length;n++){var o=r[n],a=t[o];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function br(e,t){return t===void 0&&(t=!1),wr(e)||Je(e)||!Ue(e)||(yt(e)>1&&(e.set=e.add=e.clear=e.delete=Zo),Object.freeze(e),t&&at(e,(function(r,n){return br(n,!0)}),!0)),e}function Zo(){ye(2)}function wr(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function Ye(e){var t=Tr[e];return t||ye(18,e),t}function Qo(e,t){Tr[e]||(Tr[e]=t)}function xr(){return process.env.NODE_ENV==="production"||gt||ye(0),gt}function Er(e,t){t&&(Ye("Patches"),e.u=[],e.s=[],e.v=t)}function Ht(e){Sr(e),e.p.forEach(ei),e.p=null}function Sr(e){e===gt&&(gt=e.l)}function _n(e){return gt={p:[],l:gt,h:e,m:!0,_:0}}function ei(e){var t=e[le];t.i===0||t.i===1?t.j():t.g=!0}function Cr(e,t){t._=t.p.length;var r=t.p[0],n=e!==void 0&&e!==r;return t.h.O||Ye("ES5").S(t,e,n),n?(r[le].P&&(Ht(t),ye(4)),Ue(e)&&(e=qt(t,e),t.l||Gt(t,e)),t.u&&Ye("Patches").M(r[le].t,e,t.u,t.s)):e=qt(t,r,[]),Ht(t),t.u&&t.v(t.u,t.s),e!==Mn?e:void 0}function qt(e,t,r){if(wr(t))return t;var n=t[le];if(!n)return at(t,(function(u,p){return On(e,n,t,u,p,r)}),!0),t;if(n.A!==e)return t;if(!n.P)return Gt(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var o=n.i===4||n.i===5?n.o=gr(n.k):n.o,a=o,l=!1;n.i===3&&(a=new Set(o),o.clear(),l=!0),at(a,(function(u,p){return On(e,n,o,u,p,r,l)})),Gt(e,o,!1),r&&e.u&&Ye("Patches").N(n,r,e.u,e.s)}return n.o}function On(e,t,r,n,o,a,l){if(process.env.NODE_ENV!=="production"&&o===r&&ye(5),Je(o)){var u=qt(e,o,a&&t&&t.i!==3&&!mt(t.R,n)?a.concat(n):void 0);if(Sn(r,n,u),!Je(u))return;e.m=!1}else l&&r.add(o);if(Ue(o)&&!wr(o)){if(!e.h.D&&e._<1)return;qt(e,o),t&&t.A.l||Gt(e,o)}}function Gt(e,t,r){r===void 0&&(r=!1),!e.l&&e.h.D&&e.m&&br(t,r)}function _r(e,t){var r=e[le];return(r?Ze(r):e)[t]}function jn(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function Qe(e){e.P||(e.P=!0,e.l&&Qe(e.l))}function Or(e){e.o||(e.o=gr(e.t))}function jr(e,t,r){var n=yr(t)?Ye("MapSet").F(t,r):mr(t)?Ye("MapSet").T(t,r):e.O?(function(o,a){var l=Array.isArray(o),u={i:l?1:0,A:a?a.A:xr(),P:!1,I:!1,R:{},l:a,t:o,k:null,o:null,j:null,C:!1},p=u,c=kt;l&&(p=[u],c=Mt);var v=Proxy.revocable(p,c),g=v.revoke,s=v.proxy;return u.k=s,u.j=g,s})(t,r):Ye("ES5").J(t,r);return(r?r.A:xr()).p.push(n),n}function ti(e){return Je(e)||ye(22,e),(function t(r){if(!Ue(r))return r;var n,o=r[le],a=yt(r);if(o){if(!o.P&&(o.i<4||!Ye("ES5").K(o)))return o.t;o.I=!0,n=Pn(r,a),o.I=!1}else n=Pn(r,a);return at(n,(function(l,u){o&&Jo(o.t,l)===u||Sn(n,l,t(u))})),a===3?new Set(n):n})(e)}function Pn(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return gr(e)}function ri(){function e(l,u){var p=a[l];return p?p.enumerable=u:a[l]=p={configurable:!0,enumerable:u,get:function(){var c=this[le];return process.env.NODE_ENV!=="production"&&o(c),kt.get(c,l)},set:function(c){var v=this[le];process.env.NODE_ENV!=="production"&&o(v),kt.set(v,l,c)}},p}function t(l){for(var u=l.length-1;u>=0;u--){var p=l[u][le];if(!p.P)switch(p.i){case 5:n(p)&&Qe(p);break;case 4:r(p)&&Qe(p)}}}function r(l){for(var u=l.t,p=l.k,c=bt(p),v=c.length-1;v>=0;v--){var g=c[v];if(g!==le){var s=u[g];if(s===void 0&&!mt(u,g))return!0;var S=p[g],m=S&&S[le];if(m?m.t!==s:!Cn(S,s))return!0}}var y=!!u[le];return c.length!==bt(u).length+(y?0:1)}function n(l){var u=l.k;if(u.length!==l.t.length)return!0;var p=Object.getOwnPropertyDescriptor(u,u.length-1);if(p&&!p.get)return!0;for(var c=0;c<u.length;c++)if(!u.hasOwnProperty(c))return!0;return!1}function o(l){l.g&&ye(3,JSON.stringify(Ze(l)))}var a={};Qo("ES5",{J:function(l,u){var p=Array.isArray(l),c=(function(g,s){if(g){for(var S=Array(s.length),m=0;m<s.length;m++)Object.defineProperty(S,""+m,e(m,!0));return S}var y=Nn(s);delete y[le];for(var w=bt(y),C=0;C<w.length;C++){var _=w[C];y[_]=e(_,g||!!y[_].enumerable)}return Object.create(Object.getPrototypeOf(s),y)})(p,l),v={i:p?5:4,A:u?u.A:xr(),P:!1,I:!1,R:{},l:u,t:l,k:c,o:null,g:!1,C:!1};return Object.defineProperty(c,le,{value:v,writable:!0}),c},S:function(l,u,p){p?Je(u)&&u[le].A===l&&t(l.p):(l.u&&(function c(v){if(v&&typeof v=="object"){var g=v[le];if(g){var s=g.t,S=g.k,m=g.R,y=g.i;if(y===4)at(S,(function(I){I!==le&&(s[I]!==void 0||mt(s,I)?m[I]||c(S[I]):(m[I]=!0,Qe(g)))})),at(s,(function(I){S[I]!==void 0||mt(S,I)||(m[I]=!1,Qe(g))}));else if(y===5){if(n(g)&&(Qe(g),m.length=!0),S.length<s.length)for(var w=S.length;w<s.length;w++)m[w]=!1;else for(var C=s.length;C<S.length;C++)m[C]=!0;for(var _=Math.min(S.length,s.length),k=0;k<_;k++)S.hasOwnProperty(k)||(m[k]=!0),m[k]===void 0&&c(S[k])}}}})(l.p[0]),t(l.p))},K:function(l){return l.i===4?r(l):n(l)}})}var Tn,gt,Pr=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",ni=typeof Map<"u",oi=typeof Set<"u",kn=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",Mn=Pr?Symbol.for("immer-nothing"):((Tn={})["immer-nothing"]=!0,Tn),Rn=Pr?Symbol.for("immer-draftable"):"__$immer_draftable",le=Pr?Symbol.for("immer-state"):"__$immer_state",ii={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(e){return"Cannot apply patch, path doesn't resolve: "+e},16:'Sets cannot have "replace" patches.',17:function(e){return"Unsupported patch operation: "+e},18:function(e){return"The plugin for '"+e+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+e+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(e){return"produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+e+"'"},22:function(e){return"'current' expects a draft, got: "+e},23:function(e){return"'original' expects a draft, got: "+e},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},ai=""+Object.prototype.constructor,bt=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Nn=Object.getOwnPropertyDescriptors||function(e){var t={};return bt(e).forEach((function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)})),t},Tr={},kt={get:function(e,t){if(t===le)return e;var r=Ze(e);if(!mt(r,t))return(function(o,a,l){var u,p=jn(a,l);return p?"value"in p?p.value:(u=p.get)===null||u===void 0?void 0:u.call(o.k):void 0})(e,r,t);var n=r[t];return e.I||!Ue(n)?n:n===_r(e.t,t)?(Or(e),e.o[t]=jr(e.A.h,n,e)):n},has:function(e,t){return t in Ze(e)},ownKeys:function(e){return Reflect.ownKeys(Ze(e))},set:function(e,t,r){var n=jn(Ze(e),t);if(n!=null&&n.set)return n.set.call(e.k,r),!0;if(!e.P){var o=_r(Ze(e),t),a=o==null?void 0:o[le];if(a&&a.t===r)return e.o[t]=r,e.R[t]=!1,!0;if(Cn(r,o)&&(r!==void 0||mt(e.t,t)))return!0;Or(e),Qe(e)}return e.o[t]===r&&(r!==void 0||t in e.o)||Number.isNaN(r)&&Number.isNaN(e.o[t])||(e.o[t]=r,e.R[t]=!0),!0},deleteProperty:function(e,t){return _r(e.t,t)!==void 0||t in e.t?(e.R[t]=!1,Or(e),Qe(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=Ze(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.i!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty:function(){ye(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){ye(12)}},Mt={};at(kt,(function(e,t){Mt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Mt.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&ye(13),Mt.set.call(this,e,t,void 0)},Mt.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&ye(14),kt.set.call(this,e[0],t,r,e[0])};var si=(function(){function e(r){var n=this;this.O=kn,this.D=!0,this.produce=function(o,a,l){if(typeof o=="function"&&typeof a!="function"){var u=a;a=o;var p=n;return function(y){var w=this;y===void 0&&(y=u);for(var C=arguments.length,_=Array(C>1?C-1:0),k=1;k<C;k++)_[k-1]=arguments[k];return p.produce(y,(function(I){var x;return(x=a).call.apply(x,[w,I].concat(_))}))}}var c;if(typeof a!="function"&&ye(6),l!==void 0&&typeof l!="function"&&ye(7),Ue(o)){var v=_n(n),g=jr(n,o,void 0),s=!0;try{c=a(g),s=!1}finally{s?Ht(v):Sr(v)}return typeof Promise<"u"&&c instanceof Promise?c.then((function(y){return Er(v,l),Cr(y,v)}),(function(y){throw Ht(v),y})):(Er(v,l),Cr(c,v))}if(!o||typeof o!="object"){if((c=a(o))===void 0&&(c=o),c===Mn&&(c=void 0),n.D&&br(c,!0),l){var S=[],m=[];Ye("Patches").M(o,c,S,m),l(S,m)}return c}ye(21,o)},this.produceWithPatches=function(o,a){if(typeof o=="function")return function(c){for(var v=arguments.length,g=Array(v>1?v-1:0),s=1;s<v;s++)g[s-1]=arguments[s];return n.produceWithPatches(c,(function(S){return o.apply(void 0,[S].concat(g))}))};var l,u,p=n.produce(o,a,(function(c,v){l=c,u=v}));return typeof Promise<"u"&&p instanceof Promise?p.then((function(c){return[c,l,u]})):[p,l,u]},typeof(r==null?void 0:r.useProxies)=="boolean"&&this.setUseProxies(r.useProxies),typeof(r==null?void 0:r.autoFreeze)=="boolean"&&this.setAutoFreeze(r.autoFreeze)}var t=e.prototype;return t.createDraft=function(r){Ue(r)||ye(8),Je(r)&&(r=ti(r));var n=_n(this),o=jr(this,r,void 0);return o[le].C=!0,Sr(n),o},t.finishDraft=function(r,n){var o=r&&r[le];process.env.NODE_ENV!=="production"&&(o&&o.C||ye(9),o.I&&ye(10));var a=o.A;return Er(a,n),Cr(void 0,a)},t.setAutoFreeze=function(r){this.D=r},t.setUseProxies=function(r){r&&!kn&&ye(20),this.O=r},t.applyPatches=function(r,n){var o;for(o=n.length-1;o>=0;o--){var a=n[o];if(a.path.length===0&&a.op==="replace"){r=a.value;break}}o>-1&&(n=n.slice(o+1));var l=Ye("Patches").$;return Je(r)?l(r,n):this.produce(r,(function(u){return l(u,n)}))},e})(),Ce=new si,An=Ce.produce;Ce.produceWithPatches.bind(Ce),Ce.setAutoFreeze.bind(Ce),Ce.setUseProxies.bind(Ce),Ce.applyPatches.bind(Ce),Ce.createDraft.bind(Ce),Ce.finishDraft.bind(Ce);function Rt(e){"@babel/helpers - typeof";return Rt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rt(e)}function ci(e,t){if(Rt(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Rt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function li(e){var t=ci(e,"string");return Rt(t)=="symbol"?t:t+""}function ui(e,t,r){return(t=li(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function In(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Dn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?In(Object(r),!0).forEach(function(n){ui(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):In(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function be(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var zn=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),kr=function(){return Math.random().toString(36).substring(7).split("").join(".")},st={INIT:"@@redux/INIT"+kr(),REPLACE:"@@redux/REPLACE"+kr(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+kr()}};function Ln(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function fi(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(pi(e))return"date";if(hi(e))return"error";var r=di(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function di(e){return typeof e.constructor=="function"?e.constructor.name:null}function hi(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function pi(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function ct(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=fi(e)),t}function Wn(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?be(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?be(1):"Expected the enhancer to be a function. Instead, received: '"+ct(r)+"'");return r(Wn)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?be(2):"Expected the root reducer to be a function. Instead, received: '"+ct(e)+"'");var o=e,a=t,l=[],u=l,p=!1;function c(){u===l&&(u=l.slice())}function v(){if(p)throw new Error(process.env.NODE_ENV==="production"?be(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return a}function g(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?be(4):"Expected the listener to be a function. Instead, received: '"+ct(y)+"'");if(p)throw new Error(process.env.NODE_ENV==="production"?be(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var w=!0;return c(),u.push(y),function(){if(w){if(p)throw new Error(process.env.NODE_ENV==="production"?be(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");w=!1,c();var _=u.indexOf(y);u.splice(_,1),l=null}}}function s(y){if(!Ln(y))throw new Error(process.env.NODE_ENV==="production"?be(7):"Actions must be plain objects. Instead, the actual type was: '"+ct(y)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof y.type>"u")throw new Error(process.env.NODE_ENV==="production"?be(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(p)throw new Error(process.env.NODE_ENV==="production"?be(9):"Reducers may not dispatch actions.");try{p=!0,a=o(a,y)}finally{p=!1}for(var w=l=u,C=0;C<w.length;C++){var _=w[C];_()}return y}function S(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?be(10):"Expected the nextReducer to be a function. Instead, received: '"+ct(y));o=y,s({type:st.REPLACE})}function m(){var y,w=g;return y={subscribe:function(_){if(typeof _!="object"||_===null)throw new Error(process.env.NODE_ENV==="production"?be(11):"Expected the observer to be an object. Instead, received: '"+ct(_)+"'");function k(){_.next&&_.next(v())}k();var I=w(k);return{unsubscribe:I}}},y[zn]=function(){return this},y}return s({type:st.INIT}),n={dispatch:s,subscribe:g,getState:v,replaceReducer:S},n[zn]=m,n}function Yn(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function vi(e,t,r,n){var o=Object.keys(t),a=r&&r.type===st.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(o.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!Ln(e))return"The "+a+' has unexpected type of "'+ct(e)+'". Expected argument to be an object with the following '+('keys: "'+o.join('", "')+'"');var l=Object.keys(e).filter(function(u){return!t.hasOwnProperty(u)&&!n[u]});if(l.forEach(function(u){n[u]=!0}),!(r&&r.type===st.REPLACE)&&l.length>0)return"Unexpected "+(l.length>1?"keys":"key")+" "+('"'+l.join('", "')+'" found in '+a+". ")+"Expected to find one of the known reducer keys instead: "+('"'+o.join('", "')+'". Unexpected keys will be ignored.')}function yi(e){Object.keys(e).forEach(function(t){var r=e[t],n=r(void 0,{type:st.INIT});if(typeof n>"u")throw new Error(process.env.NODE_ENV==="production"?be(12):'The slice reducer for key "'+t+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:st.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?be(13):'The slice reducer for key "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle '"+st.INIT+`' or other actions in "redux/*" `)+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}function mi(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var o=t[n];process.env.NODE_ENV!=="production"&&typeof e[o]>"u"&&Yn('No reducer provided for key "'+o+'"'),typeof e[o]=="function"&&(r[o]=e[o])}var a=Object.keys(r),l;process.env.NODE_ENV!=="production"&&(l={});var u;try{yi(r)}catch(p){u=p}return function(c,v){if(c===void 0&&(c={}),u)throw u;if(process.env.NODE_ENV!=="production"){var g=vi(c,r,v,l);g&&Yn(g)}for(var s=!1,S={},m=0;m<a.length;m++){var y=a[m],w=r[y],C=c[y],_=w(C,v);if(typeof _>"u"){var k=v&&v.type;throw new Error(process.env.NODE_ENV==="production"?be(14):"When called with an action of type "+(k?'"'+String(k)+'"':"(unknown type)")+', the slice reducer for key "'+y+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.')}S[y]=_,s=s||_!==C}return s=s||a.length!==Object.keys(c).length,s?S:c}}function Kt(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.length===0?function(n){return n}:t.length===1?t[0]:t.reduce(function(n,o){return function(){return n(o.apply(void 0,arguments))}})}function gi(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return function(){var o=n.apply(void 0,arguments),a=function(){throw new Error(process.env.NODE_ENV==="production"?be(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},l={getState:o.getState,dispatch:function(){return a.apply(void 0,arguments)}},u=t.map(function(p){return p(l)});return a=Kt.apply(void 0,u)(o.dispatch),Dn(Dn({},o),{},{dispatch:a})}}}function Vn(e){var t=function(n){var o=n.dispatch,a=n.getState;return function(l){return function(u){return typeof u=="function"?u(o,a,e):l(u)}}};return t}var Mr=Vn();Mr.withExtraArgument=Vn;var $n=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(n[a]=o[a])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),bi=function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,l;return l={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function u(c){return function(v){return p([c,v])}}function p(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=c[0]&2?o.return:c[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,c[1])).done)return a;switch(o=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(c[0]===6&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(v){c=[6,v],o=0}finally{n=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},wt=function(e,t){for(var r=0,n=t.length,o=e.length;r<n;r++,o++)e[o]=t[r];return e},wi=Object.defineProperty,xi=Object.defineProperties,Ei=Object.getOwnPropertyDescriptors,Fn=Object.getOwnPropertySymbols,Si=Object.prototype.hasOwnProperty,Ci=Object.prototype.propertyIsEnumerable,Bn=function(e,t,r){return t in e?wi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},et=function(e,t){for(var r in t||(t={}))Si.call(t,r)&&Bn(e,r,t[r]);if(Fn)for(var n=0,o=Fn(t);n<o.length;n++){var r=o[n];Ci.call(t,r)&&Bn(e,r,t[r])}return e},Rr=function(e,t){return xi(e,Ei(t))},_i=function(e,t,r){return new Promise(function(n,o){var a=function(p){try{u(r.next(p))}catch(c){o(c)}},l=function(p){try{u(r.throw(p))}catch(c){o(c)}},u=function(p){return p.done?n(p.value):Promise.resolve(p.value).then(a,l)};u((r=r.apply(e,t)).next())})},Oi=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Kt:Kt.apply(null,arguments)};function Xn(e){if(typeof e!="object"||e===null)return!1;var t=Object.getPrototypeOf(e);if(t===null)return!0;for(var r=t;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return t===r}var ji=function(e){return e&&typeof e.match=="function"};function tt(e,t){function r(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(t){var a=t.apply(void 0,n);if(!a)throw new Error("prepareAction did not return an object");return et(et({type:e,payload:a.payload},"meta"in a&&{meta:a.meta}),"error"in a&&{error:a.error})}return{type:e,payload:n[0]}}return r.toString=function(){return""+e},r.type=e,r.match=function(n){return n.type===e},r}function Pi(e){return typeof e=="function"&&"type"in e&&ji(e)}function Ti(e){var t=e?(""+e).split("/"):[],r=t[t.length-1]||"actionCreator";return'Detected an action creator with type "'+(e||"unknown")+`" being dispatched.
|
|
92
|
-
Make sure you're calling the action creator before dispatching, i.e. \`dispatch(`+r+"())` instead of `dispatch("+r+")`. This is necessary even if the action has no payload."}function
|
|
91
|
+
*/var yn;function Vo(){return yn||(yn=1,process.env.NODE_ENV!=="production"&&(function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.server_context"),p=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),s=Symbol.for("react.lazy"),S=Symbol.for("react.offscreen"),m=!1,y=!1,E=!1,C=!1,O=!1,k;k=Symbol.for("react.module.reference");function I($){return!!(typeof $=="string"||typeof $=="function"||$===r||$===i||O||$===n||$===c||$===v||C||$===S||m||y||E||typeof $=="object"&&$!==null&&($.$$typeof===s||$.$$typeof===b||$.$$typeof===a||$.$$typeof===l||$.$$typeof===p||$.$$typeof===k||$.getModuleId!==void 0))}function x($){if(typeof $=="object"&&$!==null){var ge=$.$$typeof;switch(ge){case e:var je=$.type;switch(je){case r:case i:case n:case c:case v:return je;default:var De=je&&je.$$typeof;switch(De){case u:case l:case p:case s:case b:case a:return De;default:return ge}}case t:return ge}}}var D=l,F=a,j=e,X=p,M=r,oe=s,ue=b,he=t,pe=i,we=n,Te=c,Pe=v,ke=!1,Ve=!1;function Re($){return ke||(ke=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function Ne($){return Ve||(Ve=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function $e($){return x($)===l}function Fe($){return x($)===a}function rt($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function lt($){return x($)===p}function Xe($){return x($)===r}function qe($){return x($)===s}function Ae($){return x($)===b}function Oe($){return x($)===t}function Ie($){return x($)===i}function nt($){return x($)===n}function V($){return x($)===c}function Ee($){return x($)===v}ne.ContextConsumer=D,ne.ContextProvider=F,ne.Element=j,ne.ForwardRef=X,ne.Fragment=M,ne.Lazy=oe,ne.Memo=ue,ne.Portal=he,ne.Profiler=pe,ne.StrictMode=we,ne.Suspense=Te,ne.SuspenseList=Pe,ne.isAsyncMode=Re,ne.isConcurrentMode=Ne,ne.isContextConsumer=$e,ne.isContextProvider=Fe,ne.isElement=rt,ne.isForwardRef=lt,ne.isFragment=Xe,ne.isLazy=qe,ne.isMemo=Ae,ne.isPortal=Oe,ne.isProfiler=Ie,ne.isStrictMode=nt,ne.isSuspense=V,ne.isSuspenseList=Ee,ne.isValidElementType=I,ne.typeOf=x})()),ne}var mn;function $o(){return mn||(mn=1,process.env.NODE_ENV==="production"?Bt.exports=Yo():Bt.exports=Vo()),Bt.exports}$o();function Fo(){const e=Mo();let t=null,r=null;return{clear(){t=null,r=null},notify(){e(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){let n=[],i=t;for(;i;)n.push(i),i=i.next;return n},subscribe(n){let i=!0,a=r={callback:n,next:null,prev:r};return a.prev?a.prev.next=a:t=a,function(){!i||t===null||(i=!1,a.next?a.next.prev=a.prev:r=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}const gn={notify(){},get:()=>[]};function Xo(e,t){let r,n=gn,i=0,a=!1;function l(y){v();const E=n.subscribe(y);let C=!1;return()=>{C||(C=!0,E(),b())}}function u(){n.notify()}function p(){m.onStateChange&&m.onStateChange()}function c(){return a}function v(){i++,r||(r=e.subscribe(p),n=Fo())}function b(){i--,r&&i===0&&(r(),r=void 0,n.clear(),n=gn)}function s(){a||(a=!0,v())}function S(){a&&(a=!1,b())}const m={addNestedSub:l,notifyNestedSubs:u,handleChangeWrapper:p,isSubscribed:c,trySubscribe:s,tryUnsubscribe:S,getListeners:()=>n};return m}const Bo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Be.useLayoutEffect:Be.useEffect;function Uo({store:e,context:t,children:r,serverState:n,stabilityCheck:i="once",noopCheck:a="once"}){const l=Be.useMemo(()=>{const c=Xo(e);return{store:e,subscription:c,getServerState:n?()=>n:void 0,stabilityCheck:i,noopCheck:a}},[e,n,i,a]),u=Be.useMemo(()=>e.getState(),[e]);Bo(()=>{const{subscription:c}=l;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),u!==e.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[l,u]);const p=t||Ke;return Be.createElement(p.Provider,{value:l},r)}function bn(e=Ke){const t=e===Ke?ln:hr(e);return function(){const{store:n}=t();return n}}const wn=bn();function Ho(e=Ke){const t=e===Ke?wn:bn(e);return function(){return t().dispatch}}const vr=Ho();No(To.useSyncExternalStoreWithSelector),ko(Hr.unstable_batchedUpdates);const qo={en:{pointer:"Pointer",text:"Text",image:"Image",pencil:"Pencil",rectangle:"Rectangle",circle:"Circle",eraser:"Eraser",fitToView:"Fit to view",exportAsPng:"Export as PNG",toggleGrid:"Toggle Grid",moreShapes:"More Shapes",triangle:"Triangle",diamond:"Diamond",star:"Star",heart:"Heart",hexagon:"Hexagon",octagon:"Octagon",arrow:"Arrow",fontSize:"Font Size",fontColor:"Font Color",layerOrder:"Layer Order",bringToFront:"Bring to Front",sendToBack:"Send to Back",brushColor:"Brush Color",brushSize:"Brush Size",strokeColor:"Stroke Color",fillColor:"Fill Color",strokeWidth:"Stroke Width",language:"Language",english:"English",turkish:"Turkish",trash:"Trash",confirmClear:"Are you sure you want to clear the whiteboard?",cancel:"Cancel",clear:"Clear"},tr:{pointer:"Δ°ΕaretΓ§i",text:"Metin",image:"Resim",pencil:"Kalem",rectangle:"DikdΓΆrtgen",circle:"Daire",eraser:"Silgi",fitToView:"Ekrana sΔ±ΔdΔ±r",exportAsPng:"PNG olarak dΔ±Εa aktar",toggleGrid:"IzgarayΔ± AΓ§/Kapat",moreShapes:"Daha Fazla Εekil",triangle:"ΓΓ§gen",diamond:"Elmas",star:"YΔ±ldΔ±z",heart:"Kalp",hexagon:"AltΔ±gen",octagon:"Sekizgen",arrow:"Ok",fontSize:"YazΔ± Boyutu",fontColor:"YazΔ± Rengi",layerOrder:"Katman SΔ±rasΔ±",bringToFront:"Γne Getir",sendToBack:"Arkaya GΓΆnder",brushColor:"FΔ±rΓ§a Rengi",brushSize:"FΔ±rΓ§a Boyutu",strokeColor:"Γizgi Rengi",fillColor:"Dolgu Rengi",strokeWidth:"Γizgi KalΔ±nlΔ±ΔΔ±",language:"Dil",english:"Δ°ngilizce",turkish:"TΓΌrkΓ§e",trash:"ΓΓΆp Kutusu",confirmClear:"TahtayΔ± temizlemek istediΔinizden emin misiniz?",cancel:"Δ°ptal",clear:"Temizle"}},xn=P.createContext(void 0),En="whiteboard-language",Go=()=>{const e=navigator.language;return e&&e.startsWith("tr")?"tr":"en"},Ko=()=>{const e=localStorage.getItem(En);return e&&(e==="en"||e==="tr")?e:Go()},Jo=({children:e})=>{const[t,r]=P.useState(Ko);P.useEffect(()=>{localStorage.setItem(En,t)},[t]);const n=a=>qo[t][a]||a,i=a=>{r(a)};return h.jsx(xn.Provider,{value:{language:t,t:n,changeLanguage:i},children:e})},Ut=()=>{const e=P.useContext(xn);if(!e)throw new Error("useLanguage must be used within a LanguageProvider");return e};function ye(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(process.env.NODE_ENV!=="production"){var i=ai[e],a=i?typeof i=="function"?i.apply(null,r):i:"unknown error nr: "+e;throw Error("[Immer] "+a)}throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.map((function(l){return"'"+l+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Je(e){return!!e&&!!e[le]}function Ue(e){var t;return!!e&&((function(r){if(!r||typeof r!="object")return!1;var n=Object.getPrototypeOf(r);if(n===null)return!0;var i=Object.hasOwnProperty.call(n,"constructor")&&n.constructor;return i===Object||typeof i=="function"&&Function.toString.call(i)===si})(e)||Array.isArray(e)||!!e[Rn]||!!(!((t=e.constructor)===null||t===void 0)&&t[Rn])||yr(e)||mr(e))}function at(e,t,r){r===void 0&&(r=!1),yt(e)===0?(r?Object.keys:bt)(e).forEach((function(n){r&&typeof n=="symbol"||t(n,e[n],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function yt(e){var t=e[le];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:yr(e)?2:mr(e)?3:0}function mt(e,t){return yt(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Zo(e,t){return yt(e)===2?e.get(t):e[t]}function Sn(e,t,r){var n=yt(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function Cn(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function yr(e){return oi&&e instanceof Map}function mr(e){return ii&&e instanceof Set}function Ze(e){return e.o||e.t}function gr(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Nn(e);delete t[le];for(var r=bt(t),n=0;n<r.length;n++){var i=r[n],a=t[i];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function br(e,t){return t===void 0&&(t=!1),wr(e)||Je(e)||!Ue(e)||(yt(e)>1&&(e.set=e.add=e.clear=e.delete=Qo),Object.freeze(e),t&&at(e,(function(r,n){return br(n,!0)}),!0)),e}function Qo(){ye(2)}function wr(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function Ye(e){var t=Pr[e];return t||ye(18,e),t}function ei(e,t){Pr[e]||(Pr[e]=t)}function xr(){return process.env.NODE_ENV==="production"||gt||ye(0),gt}function Er(e,t){t&&(Ye("Patches"),e.u=[],e.s=[],e.v=t)}function Ht(e){Sr(e),e.p.forEach(ti),e.p=null}function Sr(e){e===gt&&(gt=e.l)}function _n(e){return gt={p:[],l:gt,h:e,m:!0,_:0}}function ti(e){var t=e[le];t.i===0||t.i===1?t.j():t.g=!0}function Cr(e,t){t._=t.p.length;var r=t.p[0],n=e!==void 0&&e!==r;return t.h.O||Ye("ES5").S(t,e,n),n?(r[le].P&&(Ht(t),ye(4)),Ue(e)&&(e=qt(t,e),t.l||Gt(t,e)),t.u&&Ye("Patches").M(r[le].t,e,t.u,t.s)):e=qt(t,r,[]),Ht(t),t.u&&t.v(t.u,t.s),e!==Mn?e:void 0}function qt(e,t,r){if(wr(t))return t;var n=t[le];if(!n)return at(t,(function(u,p){return On(e,n,t,u,p,r)}),!0),t;if(n.A!==e)return t;if(!n.P)return Gt(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=n.i===4||n.i===5?n.o=gr(n.k):n.o,a=i,l=!1;n.i===3&&(a=new Set(i),i.clear(),l=!0),at(a,(function(u,p){return On(e,n,i,u,p,r,l)})),Gt(e,i,!1),r&&e.u&&Ye("Patches").N(n,r,e.u,e.s)}return n.o}function On(e,t,r,n,i,a,l){if(process.env.NODE_ENV!=="production"&&i===r&&ye(5),Je(i)){var u=qt(e,i,a&&t&&t.i!==3&&!mt(t.R,n)?a.concat(n):void 0);if(Sn(r,n,u),!Je(u))return;e.m=!1}else l&&r.add(i);if(Ue(i)&&!wr(i)){if(!e.h.D&&e._<1)return;qt(e,i),t&&t.A.l||Gt(e,i)}}function Gt(e,t,r){r===void 0&&(r=!1),!e.l&&e.h.D&&e.m&&br(t,r)}function _r(e,t){var r=e[le];return(r?Ze(r):e)[t]}function jn(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function Qe(e){e.P||(e.P=!0,e.l&&Qe(e.l))}function Or(e){e.o||(e.o=gr(e.t))}function jr(e,t,r){var n=yr(t)?Ye("MapSet").F(t,r):mr(t)?Ye("MapSet").T(t,r):e.O?(function(i,a){var l=Array.isArray(i),u={i:l?1:0,A:a?a.A:xr(),P:!1,I:!1,R:{},l:a,t:i,k:null,o:null,j:null,C:!1},p=u,c=kt;l&&(p=[u],c=Mt);var v=Proxy.revocable(p,c),b=v.revoke,s=v.proxy;return u.k=s,u.j=b,s})(t,r):Ye("ES5").J(t,r);return(r?r.A:xr()).p.push(n),n}function ri(e){return Je(e)||ye(22,e),(function t(r){if(!Ue(r))return r;var n,i=r[le],a=yt(r);if(i){if(!i.P&&(i.i<4||!Ye("ES5").K(i)))return i.t;i.I=!0,n=Tn(r,a),i.I=!1}else n=Tn(r,a);return at(n,(function(l,u){i&&Zo(i.t,l)===u||Sn(n,l,t(u))})),a===3?new Set(n):n})(e)}function Tn(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return gr(e)}function ni(){function e(l,u){var p=a[l];return p?p.enumerable=u:a[l]=p={configurable:!0,enumerable:u,get:function(){var c=this[le];return process.env.NODE_ENV!=="production"&&i(c),kt.get(c,l)},set:function(c){var v=this[le];process.env.NODE_ENV!=="production"&&i(v),kt.set(v,l,c)}},p}function t(l){for(var u=l.length-1;u>=0;u--){var p=l[u][le];if(!p.P)switch(p.i){case 5:n(p)&&Qe(p);break;case 4:r(p)&&Qe(p)}}}function r(l){for(var u=l.t,p=l.k,c=bt(p),v=c.length-1;v>=0;v--){var b=c[v];if(b!==le){var s=u[b];if(s===void 0&&!mt(u,b))return!0;var S=p[b],m=S&&S[le];if(m?m.t!==s:!Cn(S,s))return!0}}var y=!!u[le];return c.length!==bt(u).length+(y?0:1)}function n(l){var u=l.k;if(u.length!==l.t.length)return!0;var p=Object.getOwnPropertyDescriptor(u,u.length-1);if(p&&!p.get)return!0;for(var c=0;c<u.length;c++)if(!u.hasOwnProperty(c))return!0;return!1}function i(l){l.g&&ye(3,JSON.stringify(Ze(l)))}var a={};ei("ES5",{J:function(l,u){var p=Array.isArray(l),c=(function(b,s){if(b){for(var S=Array(s.length),m=0;m<s.length;m++)Object.defineProperty(S,""+m,e(m,!0));return S}var y=Nn(s);delete y[le];for(var E=bt(y),C=0;C<E.length;C++){var O=E[C];y[O]=e(O,b||!!y[O].enumerable)}return Object.create(Object.getPrototypeOf(s),y)})(p,l),v={i:p?5:4,A:u?u.A:xr(),P:!1,I:!1,R:{},l:u,t:l,k:c,o:null,g:!1,C:!1};return Object.defineProperty(c,le,{value:v,writable:!0}),c},S:function(l,u,p){p?Je(u)&&u[le].A===l&&t(l.p):(l.u&&(function c(v){if(v&&typeof v=="object"){var b=v[le];if(b){var s=b.t,S=b.k,m=b.R,y=b.i;if(y===4)at(S,(function(I){I!==le&&(s[I]!==void 0||mt(s,I)?m[I]||c(S[I]):(m[I]=!0,Qe(b)))})),at(s,(function(I){S[I]!==void 0||mt(S,I)||(m[I]=!1,Qe(b))}));else if(y===5){if(n(b)&&(Qe(b),m.length=!0),S.length<s.length)for(var E=S.length;E<s.length;E++)m[E]=!1;else for(var C=s.length;C<S.length;C++)m[C]=!0;for(var O=Math.min(S.length,s.length),k=0;k<O;k++)S.hasOwnProperty(k)||(m[k]=!0),m[k]===void 0&&c(S[k])}}}})(l.p[0]),t(l.p))},K:function(l){return l.i===4?r(l):n(l)}})}var Pn,gt,Tr=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",oi=typeof Map<"u",ii=typeof Set<"u",kn=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",Mn=Tr?Symbol.for("immer-nothing"):((Pn={})["immer-nothing"]=!0,Pn),Rn=Tr?Symbol.for("immer-draftable"):"__$immer_draftable",le=Tr?Symbol.for("immer-state"):"__$immer_state",ai={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(e){return"Cannot apply patch, path doesn't resolve: "+e},16:'Sets cannot have "replace" patches.',17:function(e){return"Unsupported patch operation: "+e},18:function(e){return"The plugin for '"+e+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+e+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(e){return"produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+e+"'"},22:function(e){return"'current' expects a draft, got: "+e},23:function(e){return"'original' expects a draft, got: "+e},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},si=""+Object.prototype.constructor,bt=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Nn=Object.getOwnPropertyDescriptors||function(e){var t={};return bt(e).forEach((function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)})),t},Pr={},kt={get:function(e,t){if(t===le)return e;var r=Ze(e);if(!mt(r,t))return(function(i,a,l){var u,p=jn(a,l);return p?"value"in p?p.value:(u=p.get)===null||u===void 0?void 0:u.call(i.k):void 0})(e,r,t);var n=r[t];return e.I||!Ue(n)?n:n===_r(e.t,t)?(Or(e),e.o[t]=jr(e.A.h,n,e)):n},has:function(e,t){return t in Ze(e)},ownKeys:function(e){return Reflect.ownKeys(Ze(e))},set:function(e,t,r){var n=jn(Ze(e),t);if(n!=null&&n.set)return n.set.call(e.k,r),!0;if(!e.P){var i=_r(Ze(e),t),a=i==null?void 0:i[le];if(a&&a.t===r)return e.o[t]=r,e.R[t]=!1,!0;if(Cn(r,i)&&(r!==void 0||mt(e.t,t)))return!0;Or(e),Qe(e)}return e.o[t]===r&&(r!==void 0||t in e.o)||Number.isNaN(r)&&Number.isNaN(e.o[t])||(e.o[t]=r,e.R[t]=!0),!0},deleteProperty:function(e,t){return _r(e.t,t)!==void 0||t in e.t?(e.R[t]=!1,Or(e),Qe(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=Ze(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.i!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty:function(){ye(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){ye(12)}},Mt={};at(kt,(function(e,t){Mt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Mt.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&ye(13),Mt.set.call(this,e,t,void 0)},Mt.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&ye(14),kt.set.call(this,e[0],t,r,e[0])};var ci=(function(){function e(r){var n=this;this.O=kn,this.D=!0,this.produce=function(i,a,l){if(typeof i=="function"&&typeof a!="function"){var u=a;a=i;var p=n;return function(y){var E=this;y===void 0&&(y=u);for(var C=arguments.length,O=Array(C>1?C-1:0),k=1;k<C;k++)O[k-1]=arguments[k];return p.produce(y,(function(I){var x;return(x=a).call.apply(x,[E,I].concat(O))}))}}var c;if(typeof a!="function"&&ye(6),l!==void 0&&typeof l!="function"&&ye(7),Ue(i)){var v=_n(n),b=jr(n,i,void 0),s=!0;try{c=a(b),s=!1}finally{s?Ht(v):Sr(v)}return typeof Promise<"u"&&c instanceof Promise?c.then((function(y){return Er(v,l),Cr(y,v)}),(function(y){throw Ht(v),y})):(Er(v,l),Cr(c,v))}if(!i||typeof i!="object"){if((c=a(i))===void 0&&(c=i),c===Mn&&(c=void 0),n.D&&br(c,!0),l){var S=[],m=[];Ye("Patches").M(i,c,S,m),l(S,m)}return c}ye(21,i)},this.produceWithPatches=function(i,a){if(typeof i=="function")return function(c){for(var v=arguments.length,b=Array(v>1?v-1:0),s=1;s<v;s++)b[s-1]=arguments[s];return n.produceWithPatches(c,(function(S){return i.apply(void 0,[S].concat(b))}))};var l,u,p=n.produce(i,a,(function(c,v){l=c,u=v}));return typeof Promise<"u"&&p instanceof Promise?p.then((function(c){return[c,l,u]})):[p,l,u]},typeof(r==null?void 0:r.useProxies)=="boolean"&&this.setUseProxies(r.useProxies),typeof(r==null?void 0:r.autoFreeze)=="boolean"&&this.setAutoFreeze(r.autoFreeze)}var t=e.prototype;return t.createDraft=function(r){Ue(r)||ye(8),Je(r)&&(r=ri(r));var n=_n(this),i=jr(this,r,void 0);return i[le].C=!0,Sr(n),i},t.finishDraft=function(r,n){var i=r&&r[le];process.env.NODE_ENV!=="production"&&(i&&i.C||ye(9),i.I&&ye(10));var a=i.A;return Er(a,n),Cr(void 0,a)},t.setAutoFreeze=function(r){this.D=r},t.setUseProxies=function(r){r&&!kn&&ye(20),this.O=r},t.applyPatches=function(r,n){var i;for(i=n.length-1;i>=0;i--){var a=n[i];if(a.path.length===0&&a.op==="replace"){r=a.value;break}}i>-1&&(n=n.slice(i+1));var l=Ye("Patches").$;return Je(r)?l(r,n):this.produce(r,(function(u){return l(u,n)}))},e})(),_e=new ci,An=_e.produce;_e.produceWithPatches.bind(_e),_e.setAutoFreeze.bind(_e),_e.setUseProxies.bind(_e),_e.applyPatches.bind(_e),_e.createDraft.bind(_e),_e.finishDraft.bind(_e);function Rt(e){"@babel/helpers - typeof";return Rt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rt(e)}function li(e,t){if(Rt(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Rt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ui(e){var t=li(e,"string");return Rt(t)=="symbol"?t:t+""}function fi(e,t,r){return(t=ui(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function In(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Dn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?In(Object(r),!0).forEach(function(n){fi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):In(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function be(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var zn=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),kr=function(){return Math.random().toString(36).substring(7).split("").join(".")},st={INIT:"@@redux/INIT"+kr(),REPLACE:"@@redux/REPLACE"+kr(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+kr()}};function Ln(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function di(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(vi(e))return"date";if(pi(e))return"error";var r=hi(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function hi(e){return typeof e.constructor=="function"?e.constructor.name:null}function pi(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function vi(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function ct(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=di(e)),t}function Wn(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?be(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?be(1):"Expected the enhancer to be a function. Instead, received: '"+ct(r)+"'");return r(Wn)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?be(2):"Expected the root reducer to be a function. Instead, received: '"+ct(e)+"'");var i=e,a=t,l=[],u=l,p=!1;function c(){u===l&&(u=l.slice())}function v(){if(p)throw new Error(process.env.NODE_ENV==="production"?be(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return a}function b(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?be(4):"Expected the listener to be a function. Instead, received: '"+ct(y)+"'");if(p)throw new Error(process.env.NODE_ENV==="production"?be(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var E=!0;return c(),u.push(y),function(){if(E){if(p)throw new Error(process.env.NODE_ENV==="production"?be(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");E=!1,c();var O=u.indexOf(y);u.splice(O,1),l=null}}}function s(y){if(!Ln(y))throw new Error(process.env.NODE_ENV==="production"?be(7):"Actions must be plain objects. Instead, the actual type was: '"+ct(y)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof y.type>"u")throw new Error(process.env.NODE_ENV==="production"?be(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(p)throw new Error(process.env.NODE_ENV==="production"?be(9):"Reducers may not dispatch actions.");try{p=!0,a=i(a,y)}finally{p=!1}for(var E=l=u,C=0;C<E.length;C++){var O=E[C];O()}return y}function S(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?be(10):"Expected the nextReducer to be a function. Instead, received: '"+ct(y));i=y,s({type:st.REPLACE})}function m(){var y,E=b;return y={subscribe:function(O){if(typeof O!="object"||O===null)throw new Error(process.env.NODE_ENV==="production"?be(11):"Expected the observer to be an object. Instead, received: '"+ct(O)+"'");function k(){O.next&&O.next(v())}k();var I=E(k);return{unsubscribe:I}}},y[zn]=function(){return this},y}return s({type:st.INIT}),n={dispatch:s,subscribe:b,getState:v,replaceReducer:S},n[zn]=m,n}function Yn(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function yi(e,t,r,n){var i=Object.keys(t),a=r&&r.type===st.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(i.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!Ln(e))return"The "+a+' has unexpected type of "'+ct(e)+'". Expected argument to be an object with the following '+('keys: "'+i.join('", "')+'"');var l=Object.keys(e).filter(function(u){return!t.hasOwnProperty(u)&&!n[u]});if(l.forEach(function(u){n[u]=!0}),!(r&&r.type===st.REPLACE)&&l.length>0)return"Unexpected "+(l.length>1?"keys":"key")+" "+('"'+l.join('", "')+'" found in '+a+". ")+"Expected to find one of the known reducer keys instead: "+('"'+i.join('", "')+'". Unexpected keys will be ignored.')}function mi(e){Object.keys(e).forEach(function(t){var r=e[t],n=r(void 0,{type:st.INIT});if(typeof n>"u")throw new Error(process.env.NODE_ENV==="production"?be(12):'The slice reducer for key "'+t+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:st.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?be(13):'The slice reducer for key "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle '"+st.INIT+`' or other actions in "redux/*" `)+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}function gi(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var i=t[n];process.env.NODE_ENV!=="production"&&typeof e[i]>"u"&&Yn('No reducer provided for key "'+i+'"'),typeof e[i]=="function"&&(r[i]=e[i])}var a=Object.keys(r),l;process.env.NODE_ENV!=="production"&&(l={});var u;try{mi(r)}catch(p){u=p}return function(c,v){if(c===void 0&&(c={}),u)throw u;if(process.env.NODE_ENV!=="production"){var b=yi(c,r,v,l);b&&Yn(b)}for(var s=!1,S={},m=0;m<a.length;m++){var y=a[m],E=r[y],C=c[y],O=E(C,v);if(typeof O>"u"){var k=v&&v.type;throw new Error(process.env.NODE_ENV==="production"?be(14):"When called with an action of type "+(k?'"'+String(k)+'"':"(unknown type)")+', the slice reducer for key "'+y+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.')}S[y]=O,s=s||O!==C}return s=s||a.length!==Object.keys(c).length,s?S:c}}function Kt(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.length===0?function(n){return n}:t.length===1?t[0]:t.reduce(function(n,i){return function(){return n(i.apply(void 0,arguments))}})}function bi(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return function(){var i=n.apply(void 0,arguments),a=function(){throw new Error(process.env.NODE_ENV==="production"?be(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},l={getState:i.getState,dispatch:function(){return a.apply(void 0,arguments)}},u=t.map(function(p){return p(l)});return a=Kt.apply(void 0,u)(i.dispatch),Dn(Dn({},i),{},{dispatch:a})}}}function Vn(e){var t=function(n){var i=n.dispatch,a=n.getState;return function(l){return function(u){return typeof u=="function"?u(i,a,e):l(u)}}};return t}var Mr=Vn();Mr.withExtraArgument=Vn;var $n=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),wi=function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,l;return l={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function u(c){return function(v){return p([c,v])}}function p(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(a=c[0]&2?i.return:c[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,c[1])).done)return a;switch(i=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(c[0]===6&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(v){c=[6,v],i=0}finally{n=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},wt=function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e},xi=Object.defineProperty,Ei=Object.defineProperties,Si=Object.getOwnPropertyDescriptors,Fn=Object.getOwnPropertySymbols,Ci=Object.prototype.hasOwnProperty,_i=Object.prototype.propertyIsEnumerable,Xn=function(e,t,r){return t in e?xi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},et=function(e,t){for(var r in t||(t={}))Ci.call(t,r)&&Xn(e,r,t[r]);if(Fn)for(var n=0,i=Fn(t);n<i.length;n++){var r=i[n];_i.call(t,r)&&Xn(e,r,t[r])}return e},Rr=function(e,t){return Ei(e,Si(t))},Oi=function(e,t,r){return new Promise(function(n,i){var a=function(p){try{u(r.next(p))}catch(c){i(c)}},l=function(p){try{u(r.throw(p))}catch(c){i(c)}},u=function(p){return p.done?n(p.value):Promise.resolve(p.value).then(a,l)};u((r=r.apply(e,t)).next())})},ji=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Kt:Kt.apply(null,arguments)};function Bn(e){if(typeof e!="object"||e===null)return!1;var t=Object.getPrototypeOf(e);if(t===null)return!0;for(var r=t;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return t===r}var Ti=function(e){return e&&typeof e.match=="function"};function tt(e,t){function r(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var a=t.apply(void 0,n);if(!a)throw new Error("prepareAction did not return an object");return et(et({type:e,payload:a.payload},"meta"in a&&{meta:a.meta}),"error"in a&&{error:a.error})}return{type:e,payload:n[0]}}return r.toString=function(){return""+e},r.type=e,r.match=function(n){return n.type===e},r}function Pi(e){return typeof e=="function"&&"type"in e&&Ti(e)}function ki(e){var t=e?(""+e).split("/"):[],r=t[t.length-1]||"actionCreator";return'Detected an action creator with type "'+(e||"unknown")+`" being dispatched.
|
|
92
|
+
Make sure you're calling the action creator before dispatching, i.e. \`dispatch(`+r+"())` instead of `dispatch("+r+")`. This is necessary even if the action has no payload."}function Mi(e){if(e===void 0&&(e={}),process.env.NODE_ENV==="production")return function(){return function(n){return function(i){return n(i)}}};var t=e.isActionCreator,r=t===void 0?Pi:t;return function(){return function(n){return function(i){return r(i)&&console.warn(ki(i.type)),n(i)}}}}function Un(e,t){var r=0;return{measureTime:function(n){var i=Date.now();try{return n()}finally{var a=Date.now();r+=a-i}},warnIfExceeded:function(){r>e&&console.warn(t+" took "+r+"ms, which is more than the warning threshold of "+e+`ms.
|
|
93
93
|
If your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.
|
|
94
|
-
It is disabled in production builds, so you don't need to worry about that.`)}}}var
|
|
94
|
+
It is disabled in production builds, so you don't need to worry about that.`)}}}var Ri=(function(e){$n(t,e);function t(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=e.apply(this,r)||this;return Object.setPrototypeOf(i,t.prototype),i}return Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return e.prototype.concat.apply(this,r)},t.prototype.prepend=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.length===1&&Array.isArray(r[0])?new(t.bind.apply(t,wt([void 0],r[0].concat(this)))):new(t.bind.apply(t,wt([void 0],r.concat(this))))},t})(Array),Ni=(function(e){$n(t,e);function t(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=e.apply(this,r)||this;return Object.setPrototypeOf(i,t.prototype),i}return Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return e.prototype.concat.apply(this,r)},t.prototype.prepend=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.length===1&&Array.isArray(r[0])?new(t.bind.apply(t,wt([void 0],r[0].concat(this)))):new(t.bind.apply(t,wt([void 0],r.concat(this))))},t})(Array);function Nr(e){return Ue(e)?An(e,function(){}):e}var Ai=process.env.NODE_ENV==="production",Hn="Invariant failed";function qn(e,t){if(!e)throw Ai?new Error(Hn):new Error(Hn+": "+(t||""))}function Ii(e,t,r,n){return JSON.stringify(e,Di(t,n),r)}function Di(e,t){var r=[],n=[];return t||(t=function(i,a){return r[0]===a?"[Circular ~]":"[Circular ~."+n.slice(0,r.indexOf(a)).join(".")+"]"}),function(i,a){if(r.length>0){var l=r.indexOf(this);~l?r.splice(l+1):r.push(this),~l?n.splice(l,1/0,i):n.push(i),~r.indexOf(a)&&(a=t.call(this,i,a))}else r.push(a);return e==null?a:e.call(this,i,a)}}function zi(e){return typeof e!="object"||e==null||Object.isFrozen(e)}function Li(e,t,r){var n=Gn(e,t,r);return{detectMutations:function(){return Kn(e,t,n,r)}}}function Gn(e,t,r,n,i){t===void 0&&(t=[]),n===void 0&&(n=""),i===void 0&&(i=new Set);var a={value:r};if(!e(r)&&!i.has(r)){i.add(r),a.children={};for(var l in r){var u=n?n+"."+l:l;t.length&&t.indexOf(u)!==-1||(a.children[l]=Gn(e,t,r[l],u))}}return a}function Kn(e,t,r,n,i,a){t===void 0&&(t=[]),i===void 0&&(i=!1),a===void 0&&(a="");var l=r?r.value:void 0,u=l===n;if(i&&!u&&!Number.isNaN(n))return{wasMutated:!0,path:a};if(e(l)||e(n))return{wasMutated:!1};var p={};for(var c in r.children)p[c]=!0;for(var c in n)p[c]=!0;var v=t.length>0,b=function(S){var m=a?a+"."+S:S;if(v){var y=t.some(function(C){return C instanceof RegExp?C.test(m):m===C});if(y)return"continue"}var E=Kn(e,t,r.children[S],n[S],u,m);if(E.wasMutated)return{value:E}};for(var c in p){var s=b(c);if(typeof s=="object")return s.value}return{wasMutated:!1}}function Wi(e){if(e===void 0&&(e={}),process.env.NODE_ENV==="production")return function(){return function(p){return function(c){return p(c)}}};var t=e.isImmutable,r=t===void 0?zi:t,n=e.ignoredPaths,i=e.warnAfter,a=i===void 0?32:i,l=e.ignore;n=n||l;var u=Li.bind(null,r,n);return function(p){var c=p.getState,v=c(),b=u(v),s;return function(S){return function(m){var y=Un(a,"ImmutableStateInvariantMiddleware");y.measureTime(function(){v=c(),s=b.detectMutations(),b=u(v),qn(!s.wasMutated,"A state mutation was detected between dispatches, in the path '"+(s.path||"")+"'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)")});var E=S(m);return y.measureTime(function(){v=c(),s=b.detectMutations(),b=u(v),s.wasMutated&&qn(!s.wasMutated,"A state mutation was detected inside a dispatch, in the path: "+(s.path||"")+". Take a look at the reducer(s) handling the action "+Ii(m)+". (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)")}),y.warnIfExceeded(),E}}}}function Jn(e){var t=typeof e;return e==null||t==="string"||t==="boolean"||t==="number"||Array.isArray(e)||Bn(e)}function Ar(e,t,r,n,i,a){t===void 0&&(t=""),r===void 0&&(r=Jn),i===void 0&&(i=[]);var l;if(!r(e))return{keyPath:t||"<root>",value:e};if(typeof e!="object"||e===null||a!=null&&a.has(e))return!1;for(var u=n!=null?n(e):Object.entries(e),p=i.length>0,c=function(E,C){var O=t?t+"."+E:E;if(p){var k=i.some(function(I){return I instanceof RegExp?I.test(O):O===I});if(k)return"continue"}if(!r(C))return{value:{keyPath:O,value:C}};if(typeof C=="object"&&(l=Ar(C,O,r,n,i,a),l))return{value:l}},v=0,b=u;v<b.length;v++){var s=b[v],S=s[0],m=s[1],y=c(S,m);if(typeof y=="object")return y.value}return a&&Zn(e)&&a.add(e),!1}function Zn(e){if(!Object.isFrozen(e))return!1;for(var t=0,r=Object.values(e);t<r.length;t++){var n=r[t];if(!(typeof n!="object"||n===null)&&!Zn(n))return!1}return!0}function Yi(e){if(e===void 0&&(e={}),process.env.NODE_ENV==="production")return function(){return function(k){return function(I){return k(I)}}};var t=e.isSerializable,r=t===void 0?Jn:t,n=e.getEntries,i=e.ignoredActions,a=i===void 0?[]:i,l=e.ignoredActionPaths,u=l===void 0?["meta.arg","meta.baseQueryMeta"]:l,p=e.ignoredPaths,c=p===void 0?[]:p,v=e.warnAfter,b=v===void 0?32:v,s=e.ignoreState,S=s===void 0?!1:s,m=e.ignoreActions,y=m===void 0?!1:m,E=e.disableCache,C=E===void 0?!1:E,O=!C&&WeakSet?new WeakSet:void 0;return function(k){return function(I){return function(x){var D=I(x),F=Un(b,"SerializableStateInvariantMiddleware");return!y&&!(a.length&&a.indexOf(x.type)!==-1)&&F.measureTime(function(){var j=Ar(x,"",r,n,u,O);if(j){var X=j.keyPath,M=j.value;console.error("A non-serializable value was detected in an action, in the path: `"+X+"`. Value:",M,`
|
|
95
95
|
Take a look at the logic that dispatched this action: `,x,`
|
|
96
96
|
(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)`,`
|
|
97
|
-
(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)`)}}),S||(F.measureTime(function(){var
|
|
97
|
+
(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)`)}}),S||(F.measureTime(function(){var j=k.getState(),X=Ar(j,"",r,n,c,O);if(X){var M=X.keyPath,oe=X.value;console.error("A non-serializable value was detected in the state, in the path: `"+M+"`. Value:",oe,`
|
|
98
98
|
Take a look at the reducer(s) handling this action type: `+x.type+`.
|
|
99
|
-
(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}}),F.warnIfExceeded()),D}}}}function Jt(e){return typeof e=="boolean"}function Yi(){return function(t){return Vi(t)}}function Vi(e){e===void 0&&(e={});var t=e.thunk,r=t===void 0?!0:t,n=e.immutableCheck,o=n===void 0?!0:n,a=e.serializableCheck,l=a===void 0?!0:a,u=e.actionCreatorCheck,p=u===void 0?!0:u,c=new Mi;if(r&&(Jt(r)?c.push(Mr):c.push(Mr.withExtraArgument(r.extraArgument))),process.env.NODE_ENV!=="production"){if(o){var v={};Jt(o)||(v=o),c.unshift(Li(v))}if(l){var g={};Jt(l)||(g=l),c.push(Wi(g))}if(p){var s={};Jt(p)||(s=p),c.unshift(ki(s))}}return c}var Ir=process.env.NODE_ENV==="production";function $i(e){var t=Yi(),r=e||{},n=r.reducer,o=n===void 0?void 0:n,a=r.middleware,l=a===void 0?t():a,u=r.devTools,p=u===void 0?!0:u,c=r.preloadedState,v=c===void 0?void 0:c,g=r.enhancers,s=g===void 0?void 0:g,S;if(typeof o=="function")S=o;else if(Xn(o))S=mi(o);else throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');var m=l;if(typeof m=="function"&&(m=m(t),!Ir&&!Array.isArray(m)))throw new Error("when using a middleware builder function, an array of middleware must be returned");if(!Ir&&m.some(function(I){return typeof I!="function"}))throw new Error("each middleware provided to configureStore must be a function");var y=gi.apply(void 0,m),w=Kt;p&&(w=Oi(et({trace:!Ir},typeof p=="object"&&p)));var C=new Ri(y),_=C;Array.isArray(s)?_=wt([y],s):typeof s=="function"&&(_=s(C));var k=w.apply(void 0,_);return Wn(S,v,k)}function Qn(e){var t={},r=[],n,o={addCase:function(a,l){if(process.env.NODE_ENV!=="production"){if(r.length>0)throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");if(n)throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`")}var u=typeof a=="string"?a:a.type;if(!u)throw new Error("`builder.addCase` cannot be called with an empty action type");if(u in t)throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");return t[u]=l,o},addMatcher:function(a,l){if(process.env.NODE_ENV!=="production"&&n)throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return r.push({matcher:a,reducer:l}),o},addDefaultCase:function(a){if(process.env.NODE_ENV!=="production"&&n)throw new Error("`builder.addDefaultCase` can only be called once");return n=a,o}};return e(o),[t,r,n]}function Fi(e){return typeof e=="function"}var eo=!1;function Bi(e,t,r,n){r===void 0&&(r=[]),process.env.NODE_ENV!=="production"&&typeof t=="object"&&(eo||(eo=!0,console.warn("The object notation for `createReducer` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer")));var o=typeof t=="function"?Qn(t):[t,r,n],a=o[0],l=o[1],u=o[2],p;if(Fi(e))p=function(){return Nr(e())};else{var c=Nr(e);p=function(){return c}}function v(g,s){g===void 0&&(g=p());var S=wt([a[s.type]],l.filter(function(m){var y=m.matcher;return y(s)}).map(function(m){var y=m.reducer;return y}));return S.filter(function(m){return!!m}).length===0&&(S=[u]),S.reduce(function(m,y){if(y)if(Je(m)){var w=m,C=y(w,s);return C===void 0?m:C}else{if(Ue(m))return An(m,function(_){return y(_,s)});var C=y(m,s);if(C===void 0){if(m===null)return m;throw Error("A case reducer on a non-draftable value must not return undefined")}return C}return m},g)}return v.getInitialState=p,v}var to=!1;function Xi(e,t){return e+"/"+t}function Ui(e){var t=e.name;typeof process<"u"&&process.env.NODE_ENV==="development"&&e.initialState===void 0&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");var r=typeof e.initialState=="function"?e.initialState:Nr(e.initialState),n=e.reducers||{},o=Object.keys(n),a={},l={},u={};o.forEach(function(v){var g=n[v],s=Xi(t,v),S,m;"reducer"in g?(S=g.reducer,m=g.prepare):S=g,a[v]=S,l[s]=S,u[v]=m?tt(s,m):tt(s)});function p(){process.env.NODE_ENV!=="production"&&typeof e.extraReducers=="object"&&(to||(to=!0,console.warn("The object notation for `createSlice.extraReducers` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice")));var v=typeof e.extraReducers=="function"?Qn(e.extraReducers):[e.extraReducers],g=v[0],s=g===void 0?{}:g,S=v[1],m=S===void 0?[]:S,y=v[2],w=y===void 0?void 0:y,C=et(et({},s),l);return Bi(r,function(_){for(var k in C)_.addCase(k,C[k]);for(var I=0,x=m;I<x.length;I++){var D=x[I];_.addMatcher(D.matcher,D.reducer)}w&&_.addDefaultCase(w)})}var c;return{name:t,reducer:function(v,g){return c||(c=p()),c(v,g)},actions:u,caseReducers:a,getInitialState:function(){return c||(c=p()),c.getInitialState()}}}var Hi="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",qi=function(e){e===void 0&&(e=21);for(var t="",r=e;r--;)t+=Hi[Math.random()*64|0];return t},Gi=["name","message","stack","code"],Dr=(function(){function e(t,r){this.payload=t,this.meta=r}return e})(),ro=(function(){function e(t,r){this.payload=t,this.meta=r}return e})(),Ki=function(e){if(typeof e=="object"&&e!==null){for(var t={},r=0,n=Gi;r<n.length;r++){var o=n[r];typeof e[o]=="string"&&(t[o]=e[o])}return t}return{message:String(e)}};(function(){function e(t,r,n){var o=tt(t+"/fulfilled",function(v,g,s,S){return{payload:v,meta:Rr(et({},S||{}),{arg:s,requestId:g,requestStatus:"fulfilled"})}}),a=tt(t+"/pending",function(v,g,s){return{payload:void 0,meta:Rr(et({},s||{}),{arg:g,requestId:v,requestStatus:"pending"})}}),l=tt(t+"/rejected",function(v,g,s,S,m){return{payload:S,error:(n&&n.serializeError||Ki)(v||"Rejected"),meta:Rr(et({},m||{}),{arg:s,requestId:g,rejectedWithValue:!!S,requestStatus:"rejected",aborted:(v==null?void 0:v.name)==="AbortError",condition:(v==null?void 0:v.name)==="ConditionError"})}}),u=!1,p=typeof AbortController<"u"?AbortController:(function(){function v(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return v.prototype.abort=function(){process.env.NODE_ENV!=="production"&&(u||(u=!0,console.info("This platform does not implement AbortController. \nIf you want to use the AbortController to react to `abort` events, please consider importing a polyfill like 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'.")))},v})();function c(v){return function(g,s,S){var m=n!=null&&n.idGenerator?n.idGenerator(v):qi(),y=new p,w;function C(k){w=k,y.abort()}var _=(function(){return _i(this,null,function(){var k,I,x,D,F,O,B;return bi(this,function(M){switch(M.label){case 0:return M.trys.push([0,4,,5]),D=(k=n==null?void 0:n.condition)==null?void 0:k.call(n,v,{getState:s,extra:S}),Zi(D)?[4,D]:[3,2];case 1:D=M.sent(),M.label=2;case 2:if(D===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return F=new Promise(function(oe,ue){return y.signal.addEventListener("abort",function(){return ue({name:"AbortError",message:w||"Aborted"})})}),g(a(m,v,(I=n==null?void 0:n.getPendingMeta)==null?void 0:I.call(n,{requestId:m,arg:v},{getState:s,extra:S}))),[4,Promise.race([F,Promise.resolve(r(v,{dispatch:g,getState:s,extra:S,requestId:m,signal:y.signal,abort:C,rejectWithValue:function(oe,ue){return new Dr(oe,ue)},fulfillWithValue:function(oe,ue){return new ro(oe,ue)}})).then(function(oe){if(oe instanceof Dr)throw oe;return oe instanceof ro?o(oe.payload,m,v,oe.meta):o(oe,m,v)})])];case 3:return x=M.sent(),[3,5];case 4:return O=M.sent(),x=O instanceof Dr?l(null,m,v,O.payload,O.meta):l(O,m,v),[3,5];case 5:return B=n&&!n.dispatchConditionRejection&&l.match(x)&&x.meta.condition,B||g(x),[2,x]}})})})();return Object.assign(_,{abort:C,requestId:m,arg:v,unwrap:function(){return _.then(Ji)}})}}return Object.assign(c,{pending:a,rejected:l,fulfilled:o,typePrefix:t})}return e.withTypes=function(){return e},e})();function Ji(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Zi(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var zr="listenerMiddleware";tt(zr+"/add"),tt(zr+"/removeAll"),tt(zr+"/remove");var no;typeof queueMicrotask=="function"&&queueMicrotask.bind(typeof window<"u"?window:typeof global<"u"?global:globalThis),ri();const Qi={grid:{size:20,color:"#ccc",enabled:!0},toolbar:{selectedTool:"pointer"},toolProperties:{pencil:{strokeColor:"#000000",lineWidth:4},rectangle:{strokeColor:"#000000",fillColor:"#ffffff",lineWidth:2},circle:{strokeColor:"#000000",fillColor:"#ffffff",lineWidth:2},triangle:{strokeColor:"#000000",fillColor:"#ffffff",lineWidth:2},diamond:{strokeColor:"#000000",fillColor:"#ffffff",lineWidth:2},star:{strokeColor:"#000000",fillColor:"#ffff00",lineWidth:2},heart:{strokeColor:"#000000",fillColor:"#ff6b6b",lineWidth:2},hexagon:{strokeColor:"#000000",fillColor:"#ffffff",lineWidth:2},octagon:{strokeColor:"#000000",fillColor:"#ffffff",lineWidth:2},arrow:{strokeColor:"#000000",fillColor:"#000000",lineWidth:2},text:{fontSize:16,fontColor:"#000000"}},elements:[],selectedElementIds:[],viewport:{panX:0,panY:0,zoom:1},watermark:{text:"Nines Studios",url:"https://github.com/huzeyfecoskun",visible:!0},lock:{isLocked:!1,text:"Whiteboard drawing is only for moderator"}};function ea(e){const t=[],r=new Set;for(const n of e){const o=n==null?void 0:n.id;if(o==null){t.push(n);continue}r.has(o)||(r.add(o),t.push(n))}return t}const Lr=Ui({name:"whiteboard",initialState:Qi,reducers:{toggleGrid(e){e.grid.enabled=!e.grid.enabled},setGridSize(e,t){e.grid.size=t.payload},setGridColor(e,t){e.grid.color=t.payload},setSelectedTool(e,t){e.toolbar.selectedTool=t.payload},setToolProperty(e,t){const{tool:r,property:n,value:o}=t.payload;e.toolProperties[r]&&(e.toolProperties[r][n]=o)},addElement(e,t){const r=t.payload,n=r==null?void 0:r.id;n!=null&&e.elements.some(a=>(a==null?void 0:a.id)===n)||e.elements.push(r)},updateElement(e,t){const{id:r,updates:n}=t.payload,o=e.elements.findIndex(a=>a.id===r);o!==-1&&(e.elements[o]={...e.elements[o],...n})},updateElements(e,t){t.payload.forEach(({id:n,updates:o})=>{const a=e.elements.findIndex(l=>l.id===n);a!==-1&&(e.elements[a]={...e.elements[a],...o})})},removeElement(e,t){const r=t.payload;e.elements=e.elements.filter(n=>n.id!==r),e.selectedElementIds=e.selectedElementIds.filter(n=>n!==r)},setSelectedElements(e,t){e.selectedElementIds=t.payload},clearElements(e){e.elements=[],e.selectedElementIds=[]},setElements(e,t){const r=Array.isArray(t.payload)?t.payload:[];e.elements=ea(r),e.selectedElementIds=[]},setPan(e,t){e.viewport.panX=t.payload.x,e.viewport.panY=t.payload.y},setZoom(e,t){e.viewport.zoom=Math.max(.1,Math.min(5,t.payload))},resetViewport(e){e.viewport.panX=0,e.viewport.panY=0,e.viewport.zoom=1},bringToFront(e,t){const r=t.payload,n=e.elements.findIndex(o=>o.id===r);if(n!==-1&&n<e.elements.length-1){const[o]=e.elements.splice(n,1);e.elements.push(o)}},sendToBack(e,t){const r=t.payload,n=e.elements.findIndex(o=>o.id===r);if(n>0){const[o]=e.elements.splice(n,1);e.elements.unshift(o)}},fitToView(e,t){const{canvasWidth:r,canvasHeight:n,padding:o=50}=t.payload,a=e.elements;if(a.length===0){e.viewport.panX=0,e.viewport.panY=0,e.viewport.zoom=1;return}let l=1/0,u=1/0,p=-1/0,c=-1/0;if(a.forEach(x=>{const D=F=>F??0;if(x.type==="rectangle"){const F=D(x.x),O=D(x.y),B=D(x.width),M=D(x.height);l=Math.min(l,F),u=Math.min(u,O),p=Math.max(p,F+B),c=Math.max(c,O+M)}else if(x.type==="circle"){const F=D(x.centerX),O=D(x.centerY),B=D(x.radius);l=Math.min(l,F-B),u=Math.min(u,O-B),p=Math.max(p,F+B),c=Math.max(c,O+B)}else if(x.type==="pencil"&&x.points&&x.points.length>0)x.points.forEach(F=>{l=Math.min(l,F.x),u=Math.min(u,F.y),p=Math.max(p,F.x),c=Math.max(c,F.y)});else if(x.type==="triangle"||x.type==="diamond"||x.type==="hexagon"||x.type==="octagon"){const F=D(x.x),O=D(x.y),B=D(x.width),M=D(x.height);l=Math.min(l,F),u=Math.min(u,O),p=Math.max(p,F+B),c=Math.max(c,O+M)}else if(x.type==="star"||x.type==="heart"){const F=D(x.centerX),O=D(x.centerY),B=D(x.size);l=Math.min(l,F-B),u=Math.min(u,O-B),p=Math.max(p,F+B),c=Math.max(c,O+B)}else if(x.type==="arrow"){const F=D(x.startX),O=D(x.startY),B=D(x.endX),M=D(x.endY);l=Math.min(l,F,B),u=Math.min(u,O,M),p=Math.max(p,F,B),c=Math.max(c,O,M)}}),l===1/0)return;const v=p-l,g=c-u;if(v<=0||g<=0)return;const s=r-o*2,S=n-o*2,m=s/v,y=S/g,w=Math.min(m,y,5),C=(l+p)/2,_=(u+c)/2,k=r/2-C*w,I=n/2-_*w;e.viewport.zoom=Math.max(.1,w),e.viewport.panX=k,e.viewport.panY=I},setLocked(e,t){e.lock.isLocked=t.payload,t.payload&&(e.toolbar.selectedTool="pointer",e.selectedElementIds=[])},setWatermarkEnabled(e,t){e.watermark.visible=t.payload},setWatermarkText(e,t){e.watermark.text=t.payload}}}),{toggleGrid:ta,setGridSize:is,setGridColor:as,setSelectedTool:Me,setToolProperty:ra,addElement:_e,updateElement:Zt,updateElements:oo,removeElement:na,setSelectedElements:He,clearElements:Wr,setElements:Yr,setPan:oa,setZoom:ia,resetViewport:ss,fitToView:aa,bringToFront:sa,sendToBack:ca,setLocked:io,setWatermarkEnabled:la,setWatermarkText:ua}=Lr.actions,fa=Lr.actions,ao=Lr.reducer,da=new Set(["rectangle","circle","pencil","triangle","diamond","star","heart","hexagon","octagon","arrow","text"]),ha=new Set(["strokeColor","fillColor","lineWidth","fontSize","fontColor","textColor"]),pa=e=>{var t,r;if(!e||typeof e.type!="string"||e.type.startsWith("@@redux/"))return!1;if(e.type==="whiteboard/addElement"){const n=(t=e==null?void 0:e.payload)==null?void 0:t.type;return typeof n=="string"&&da.has(n)}if(e.type==="whiteboard/removeElement"||e.type==="whiteboard/clearElements"||e.type==="whiteboard/bringToFront"||e.type==="whiteboard/sendToBack")return!0;if(e.type==="whiteboard/setToolProperty"){const{tool:n,property:o}=(e==null?void 0:e.payload)??{};return typeof n!="string"||typeof o!="string"?!1:ha.has(o)}if(e.type==="whiteboard/updateElement")return so((r=e==null?void 0:e.payload)==null?void 0:r.updates);if(e.type==="whiteboard/updateElements"){const n=e==null?void 0:e.payload;return Array.isArray(n)?n.some(o=>so(o.updates)):!1}return!1},so=e=>{if(!e||typeof e!="object")return!1;const t=r=>Object.prototype.hasOwnProperty.call(e,r);return!!(t("text")||t("fontSize")||t("fontColor")||t("textColor")||t("strokeColor")||t("fillColor")||t("lineWidth")||t("x")||t("y")||t("width")||t("height")||t("centerX")||t("centerY")||t("radius")||t("size")||t("startX")||t("startY")||t("endX")||t("endY")||t("points"))},va=e=>t=>r=>n=>{var a;const o=r(n);return!((a=n.meta)!=null&&a.fromRemote)&&e&&e.current&&pa(n)&&e.current(n,t.getState()),o},Vr=({preloadedState:e,actionHandlerRef:t}={})=>$i({reducer:{whiteboard:ao},middleware:r=>r().concat(va(t)),preloadedState:e}),ya=Vr(),ma=()=>{const e=xe(t=>t.whiteboard.watermark);return h.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:h.jsx("div",{className:"wb-watermark",children:e.text})})};var co={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},lo=T.createContext&&T.createContext(co),ga=["attr","size","title"];function ba(e,t){if(e==null)return{};var r=wa(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function wa(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Qt(){return Qt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qt.apply(this,arguments)}function uo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function er(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uo(Object(r),!0).forEach(function(n){xa(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function xa(e,t,r){return t=Ea(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ea(e){var t=Sa(e,"string");return typeof t=="symbol"?t:t+""}function Sa(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fo(e){return e&&e.map((t,r)=>T.createElement(t.tag,er({key:r},t.attr),fo(t.child)))}function fe(e){return t=>T.createElement(Ca,Qt({attr:er({},e.attr)},t),fo(e.child))}function Ca(e){var t=r=>{var{attr:n,size:o,title:a}=e,l=ba(e,ga),u=o||r.size||"1em",p;return r.className&&(p=r.className),e.className&&(p=(p?p+" ":"")+e.className),T.createElement("svg",Qt({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,l,{className:p,style:er(er({color:e.color||r.color},r.style),e.style),height:u,width:u,xmlns:"http://www.w3.org/2000/svg"}),a&&T.createElement("title",null,a),e.children)};return lo!==void 0?T.createElement(lo.Consumer,null,r=>t(r)):t(co)}function _a(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 32H32A32 32 0 0 0 0 64v384a32 32 0 0 0 32 32h384a32 32 0 0 0 32-32V64a32 32 0 0 0-32-32zm-32 64v128H256V96zm-192 0v128H64V96zM64 416V288h128v128zm192 0V288h128v128z"},child:[]}]})(e)}function Oa(e){return fe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"},child:[]}]})(e)}function ja(e){return fe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M497.941 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.745-18.745-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48.004 48.004 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12H355.883l142.058-142.059zm-302.627-62.627l137.373 137.373L265.373 416H150.628l-80-80 124.686-124.686z"},child:[]}]})(e)}function Pa(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z"},child:[]}]})(e)}function Ta(e){return fe({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z"},child:[]}]})(e)}function ka(e){return fe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5 199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z"},child:[]}]})(e)}function Ma(e){return fe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"},child:[]}]})(e)}function Ra(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z"},child:[]}]})(e)}function Na(e){return fe({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M302.189 329.126H196.105l55.831 135.993c3.889 9.428-.555 19.999-9.444 23.999l-49.165 21.427c-9.165 4-19.443-.571-23.332-9.714l-53.053-129.136-86.664 89.138C18.729 472.71 0 463.554 0 447.977V18.299C0 1.899 19.921-6.096 30.277 5.443l284.412 292.542c11.472 11.179 3.007 31.141-12.5 31.141z"},child:[]}]})(e)}function Aa(e){return fe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"},child:[]}]})(e)}function Ia(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"},child:[]}]})(e)}function Da(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"},child:[]}]})(e)}function za(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z"},child:[]}]})(e)}function La(e){return fe({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"},child:[]}]})(e)}function Wa(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"},child:[]}]})(e)}const Ya=({text:e,shifted:t})=>h.jsxs("div",{className:`wb-lock-indicator ${t?"wb-shifted":""}`,children:[h.jsx(Ra,{}),h.jsx("span",{children:e||"Locked"})]});function Va(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z"},child:[]}]})(e)}function $a(e){return fe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M284.3 11.7c-15.6-15.6-40.9-15.6-56.6 0l-216 216c-15.6 15.6-15.6 40.9 0 56.6l216 216c15.6 15.6 40.9 15.6 56.6 0l216-216c15.6-15.6 15.6-40.9 0-56.6l-216-216z"},child:[]}]})(e)}function Fa(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"},child:[]}]})(e)}function Ba(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M144 144l0 48 160 0 0-48c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192l0-48C80 64.5 144.5 0 224 0s144 64.5 144 144l0 48 16 0c35.3 0 64 28.7 64 64l0 192c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 256c0-35.3 28.7-64 64-64l16 0z"},child:[]}]})(e)}function Xa(e){return fe({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l128 0 0 352c0 17.7 14.3 32 32 32s32-14.3 32-32l0-352 128 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 32 32 32z"},child:[]}]})(e)}function Ua(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M144 144c0-44.2 35.8-80 80-80c31.9 0 59.4 18.6 72.3 45.7c7.6 16 26.7 22.8 42.6 15.2s22.8-26.7 15.2-42.6C331 33.7 281.5 0 224 0C144.5 0 80 64.5 80 144l0 48-16 0c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-192c0-35.3-28.7-64-64-64l-240 0 0-48z"},child:[]}]})(e)}function Ha(e){return fe({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M8.5.134a1 1 0 0 0-1 0l-6 3.577a1 1 0 0 0-.5.866v6.846a1 1 0 0 0 .5.866l6 3.577a1 1 0 0 0 1 0l6-3.577a1 1 0 0 0 .5-.866V4.577a1 1 0 0 0-.5-.866z"},child:[]}]})(e)}function qa(e){return fe({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M11.107 0a.5.5 0 0 1 .353.146l4.394 4.394a.5.5 0 0 1 .146.353v6.214a.5.5 0 0 1-.146.353l-4.394 4.394a.5.5 0 0 1-.353.146H4.893a.5.5 0 0 1-.353-.146L.146 11.46A.5.5 0 0 1 0 11.107V4.893a.5.5 0 0 1 .146-.353L4.54.146A.5.5 0 0 1 4.893 0z"},child:[]}]})(e)}const Ga=({onClose:e,onConfirm:t})=>{const{t:r}=Ut(),[n,o]=T.useState(!1),a=()=>{o(!0),setTimeout(e,300)},l=()=>{o(!0),setTimeout(t,300)};return Hr.createPortal(h.jsx("div",{className:`wb-confirm-popup-overlay ${n?"wb-closing":""}`,children:h.jsxs("div",{className:"wb-confirm-popup",children:[h.jsx("p",{children:r("confirmClear")}),h.jsxs("div",{className:"wb-actions",children:[h.jsx("button",{onClick:a,children:r("cancel")}),h.jsx("button",{onClick:l,children:r("clear")})]})]})}),document.body)},Ka=({mode:e="user",onImageUpload:t})=>{const r=vr(),{t:n,language:o,changeLanguage:a}=Ut(),l=xe(B=>B.whiteboard.toolbar.selectedTool),u=xe(B=>B.whiteboard.lock.isLocked),[p,c]=T.useState(!1),[v,g]=T.useState(!1),[s,S]=T.useState(!1),m=T.useRef(null),y=T.useRef(null),w=T.useRef(null),C=T.useRef(null),_=T.useRef(null),k=async B=>{var oe;const M=(oe=B.target.files)==null?void 0:oe[0];if(M){if(t)try{const ue=URL.createObjectURL(M),he=new Image;he.onload=async()=>{const pe=he.width,we=he.height;URL.revokeObjectURL(ue);try{const Pe=await t(M),Te=Date.now().toString();r(_e({id:Te,type:"image",x:100,y:100,width:pe,height:we,src:Pe})),r(Me("pointer")),r(He([Te]))}catch(Pe){console.error("Image upload failed:",Pe)}},he.src=ue}catch(ue){console.error("Error processing image:",ue)}else{const ue=URL.createObjectURL(M),he=new Image;he.onload=()=>{const pe=Date.now().toString();r(_e({id:pe,type:"image",x:100,y:100,width:he.width,height:he.height,src:ue})),r(Me("pointer")),r(He([pe]))},he.src=ue}B.target.value=""}};T.useEffect(()=>{const B=M=>{const oe=M.target;m.current&&!m.current.contains(oe)&&y.current&&!y.current.contains(oe)&&c(!1),C.current&&!C.current.contains(oe)&&w.current&&!w.current.contains(oe)&&g(!1)};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);const I=()=>{S(!0)},x=()=>{r(Me("pointer")),r(He([])),r(Wr()),S(!1)},D=[{name:"triangle",icon:h.jsx(Ia,{style:{transform:"rotate(-30deg)"}})},{name:"diamond",icon:h.jsx($a,{})},{name:"star",icon:h.jsx(La,{})},{name:"heart",icon:h.jsx(ka,{})},{name:"hexagon",icon:h.jsx(Ha,{})},{name:"octagon",icon:h.jsx(qa,{})},{name:"arrow",icon:h.jsx(Va,{})}],F=B=>{r(Me(B)),c(!1)},O=B=>{a(B),g(!1)};return h.jsxs("div",{className:"wb-toolbar",children:[h.jsx("button",{className:l==="pointer"?"wb-active":"",onClick:()=>r(Me("pointer")),title:n("pointer"),disabled:u,children:h.jsx(Na,{})}),h.jsx("button",{className:l==="text"?"wb-active":"",onClick:()=>r(Me("text")),title:n("text"),disabled:u,children:h.jsx(Xa,{})}),h.jsx("button",{onClick:()=>{var B;return(B=_.current)==null?void 0:B.click()},title:n("image"),disabled:u,children:h.jsx(Ma,{})}),h.jsx("input",{type:"file",ref:_,style:{display:"none"},accept:"image/*",onChange:k}),h.jsx("button",{className:l==="pencil"?"wb-active":"",onClick:()=>r(Me("pencil")),title:n("pencil"),disabled:u,children:h.jsx(Aa,{})}),h.jsx("button",{className:l==="rectangle"?"wb-active":"",onClick:()=>r(Me("rectangle")),title:n("rectangle"),disabled:u,children:h.jsx(za,{})}),h.jsx("button",{className:l==="circle"?"wb-active":"",onClick:()=>r(Me("circle")),title:n("circle"),disabled:u,children:h.jsx(Oa,{})}),h.jsxs("div",{className:"wb-ellipsis-container",children:[h.jsx("button",{ref:y,className:D.some(B=>B.name===l)?"wb-active":"",onClick:()=>c(!p),title:n("moreShapes"),disabled:u,children:h.jsx(Fa,{})}),p&&h.jsxs("div",{className:"wb-shapes-popup",ref:m,children:[h.jsx("div",{className:"wb-shapes-popup-header",children:n("moreShapes")}),h.jsx("div",{className:"wb-shapes-popup-grid",children:D.map(B=>h.jsx("button",{className:l===B.name?"wb-active":"",onClick:()=>F(B.name),title:n(B.name),children:B.icon},B.name))})]})]}),h.jsx("button",{className:l==="eraser"?"wb-active":"",onClick:()=>r(Me("eraser")),title:n("eraser"),disabled:u,children:h.jsx(ja,{})}),h.jsx("button",{onClick:I,title:n("trash"),disabled:u,children:h.jsx(Wa,{})}),h.jsxs("div",{className:"wb-language-container",children:[h.jsx("button",{ref:w,onClick:()=>g(!v),title:n("language"),children:h.jsx(Ta,{})}),v&&h.jsxs("div",{className:"wb-language-popup",ref:C,children:[h.jsx("div",{className:"wb-language-popup-header",children:n("language")}),h.jsxs("div",{className:"wb-language-options",children:[h.jsxs("button",{className:o==="en"?"wb-active":"",onClick:()=>O("en"),children:["πΊπΈ ",n("english")]}),h.jsxs("button",{className:o==="tr"?"wb-active":"",onClick:()=>O("tr"),children:["πΉπ· ",n("turkish")]})]})]})]}),e==="moderator"&&h.jsx("button",{onClick:()=>r(io(!u)),title:u?"Unlock":"Lock",style:{color:u?"red":"inherit"},children:u?h.jsx(Ba,{}):h.jsx(Ua,{})}),s&&h.jsx(Ga,{onConfirm:x,onClose:()=>S(!1)})]})},Ja=({shifted:e})=>{const t=vr(),{t:r}=Ut(),n=xe(s=>s.whiteboard.toolbar.selectedTool),o=xe(s=>s.whiteboard.toolProperties),a=xe(s=>s.whiteboard.selectedElementIds||[]),l=xe(s=>s.whiteboard.elements),u=a.length>0?l.find(s=>s.id===a[0]):null,p=(s,S,m)=>{t(ra({tool:s,property:S,value:m}))},c=(s,S)=>{if(a.length>0){const m=a.map(y=>({id:y,updates:{[s]:S}}));t(oo(m))}},v=()=>{a.forEach(s=>{t(sa(s))})},g=()=>{[...a].reverse().forEach(s=>{t(ca(s))})};if(n==="pointer"&&u&&u.type==="text")return h.jsxs("div",{className:`wb-prop-tools ${e?"wb-shifted":""}`,children:[h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("fontSize")}),h.jsxs("select",{className:"font-size-selector",value:u.fontSize||16,onChange:s=>c("fontSize",parseInt(s.target.value)),children:[h.jsx("option",{value:"12",children:"12 px"}),h.jsx("option",{value:"14",children:"14 px"}),h.jsx("option",{value:"16",children:"16 px"}),h.jsx("option",{value:"18",children:"18 px"}),h.jsx("option",{value:"24",children:"24 px"}),h.jsx("option",{value:"32",children:"32 px"}),h.jsx("option",{value:"48",children:"48 px"}),h.jsx("option",{value:"64",children:"64 px"}),h.jsx("option",{value:"72",children:"72 px"})]})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("fontColor")}),h.jsx("input",{type:"color",value:u.fontColor||"#000000",onChange:s=>c("fontColor",s.target.value)})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("layerOrder")}),h.jsxs("div",{className:"wb-layer-buttons",children:[h.jsx("button",{onClick:v,title:r("bringToFront"),children:h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),h.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"white"})]})}),h.jsx("button",{onClick:g,title:r("sendToBack"),children:h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),h.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"white"})]})})]})]})]});if(n==="pointer"&&u){const s=["rectangle","circle","triangle","diamond","star","heart","hexagon","octagon","arrow"].includes(u.type),S=u.type==="pencil";return h.jsxs("div",{className:`wb-prop-tools ${e?"wb-shifted":""}`,children:[s&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("strokeColor")}),h.jsx("input",{type:"color",value:u.strokeColor,onChange:m=>c("strokeColor",m.target.value)})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("fillColor")}),h.jsx("input",{type:"color",value:u.fillColor,onChange:m=>c("fillColor",m.target.value)})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("strokeWidth")}),h.jsxs("select",{className:"stroke-width-selector",value:u.lineWidth,onChange:m=>c("lineWidth",parseInt(m.target.value)),children:[h.jsx("option",{value:"1",children:"1 px"}),h.jsx("option",{value:"2",children:"2 px"}),h.jsx("option",{value:"4",children:"4 px"}),h.jsx("option",{value:"8",children:"8 px"})]})]})]}),S&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("brushColor")}),h.jsx("input",{type:"color",value:u.strokeColor,onChange:m=>c("strokeColor",m.target.value)})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("brushSize")}),h.jsxs("select",{className:"brush-size-selector",value:u.lineWidth,onChange:m=>c("lineWidth",parseInt(m.target.value)),children:[h.jsx("option",{value:"1",children:"1 px"}),h.jsx("option",{value:"2",children:"2 px"}),h.jsx("option",{value:"4",children:"4 px"}),h.jsx("option",{value:"8",children:"8 px"}),h.jsx("option",{value:"16",children:"16 px"})]})]})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("layerOrder")}),h.jsxs("div",{className:"wb-layer-buttons",children:[h.jsx("button",{onClick:v,title:r("bringToFront"),children:h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),h.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"white"})]})}),h.jsx("button",{onClick:g,title:r("sendToBack"),children:h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),h.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"white"})]})})]})]})]})}return h.jsxs("div",{className:`wb-prop-tools ${e?"wb-shifted":""}`,children:[n==="text"&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("fontSize")}),h.jsxs("select",{className:"font-size-selector",value:o.text.fontSize,onChange:s=>p("text","fontSize",parseInt(s.target.value)),children:[h.jsx("option",{value:"12",children:"12 px"}),h.jsx("option",{value:"14",children:"14 px"}),h.jsx("option",{value:"16",children:"16 px"}),h.jsx("option",{value:"18",children:"18 px"}),h.jsx("option",{value:"24",children:"24 px"}),h.jsx("option",{value:"32",children:"32 px"}),h.jsx("option",{value:"48",children:"48 px"}),h.jsx("option",{value:"64",children:"64 px"}),h.jsx("option",{value:"72",children:"72 px"})]})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("fontColor")}),h.jsx("input",{type:"color",value:o.text.fontColor,onChange:s=>p("text","fontColor",s.target.value)})]})]}),n==="pencil"&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("brushColor")}),h.jsx("input",{type:"color",value:o.pencil.strokeColor,onChange:s=>p("pencil","strokeColor",s.target.value)})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("brushSize")}),h.jsxs("select",{className:"brush-size-selector",value:o.pencil.lineWidth,onChange:s=>p("pencil","lineWidth",parseInt(s.target.value)),children:[h.jsx("option",{value:"1",children:"1 px"}),h.jsx("option",{value:"2",children:"2 px"}),h.jsx("option",{value:"4",children:"4 px"}),h.jsx("option",{value:"8",children:"8 px"}),h.jsx("option",{value:"16",children:"16 px"})]})]})]}),(n==="rectangle"||n==="circle"||n==="triangle"||n==="diamond"||n==="star"||n==="heart"||n==="hexagon"||n==="octagon"||n==="arrow")&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("strokeColor")}),h.jsx("input",{type:"color",value:o[n].strokeColor,onChange:s=>p(n,"strokeColor",s.target.value)})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("fillColor")}),h.jsx("input",{type:"color",value:o[n].fillColor,onChange:s=>p(n,"fillColor",s.target.value)})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("strokeWidth")}),h.jsxs("select",{className:"stroke-width-selector",value:o[n].lineWidth,onChange:s=>p(n,"lineWidth",parseInt(s.target.value)),children:[h.jsx("option",{value:"1",children:"1 px"}),h.jsx("option",{value:"2",children:"2 px"}),h.jsx("option",{value:"4",children:"4 px"}),h.jsx("option",{value:"8",children:"8 px"})]})]})]})]})},Za=({onFitToView:e,onExport:t,onToggleGrid:r})=>{const{t:n}=Ut();return h.jsxs("div",{className:"wb-canvas-tools",children:[h.jsx("button",{onClick:r,title:n("toggleGrid"),children:h.jsx(_a,{})}),h.jsx("button",{onClick:e,title:n("fitToView"),children:h.jsx(Pa,{})}),h.jsx("button",{onClick:t,title:n("exportAsPng"),children:h.jsx(Da,{})})]})},$r=T.forwardRef(({watermark:e,isLocked:t,lockText:r,onLockChange:n,isWatermarkEnabled:o,watermarkText:a,mode:l,initialElements:u,onAfterMount:p,onImageUpload:c},v)=>{var yo;const g=T.useRef(null),s=vr(),S=wn(),m=xe(i=>i.whiteboard.grid),y=xe(i=>i.whiteboard.toolbar.selectedTool),w=xe(i=>i.whiteboard.elements),C=xe(i=>i.whiteboard.viewport),_=xe(i=>i.whiteboard.toolProperties),k=xe(i=>i.whiteboard.selectedElementIds||[]),I=xe(i=>i.whiteboard.lock),x=I.isLocked,[D,F]=T.useState(!1),[O,B]=T.useState({x:0,y:0}),[M,oe]=T.useState({x:0,y:0}),[ue,he]=T.useState([]),[pe,we]=T.useState(!1),[Pe,Te]=T.useState({}),[ke,Ve]=T.useState(!1),[Re,Ne]=T.useState(!1),[$e,Fe]=T.useState(!1),[rt,lt]=T.useState({x:0,y:0}),[Be,qe]=T.useState({y:0,initialZoom:1}),[Ae,Oe]=T.useState(!1),[Ie,nt]=T.useState({x:0,y:0}),[V,Ee]=T.useState(""),[$,ge]=T.useState(null),je=T.useRef(null),De=T.useRef(null),[xt,tr]=T.useState(!1),[me,Et]=T.useState(null),[Nt,At]=T.useState(null),[It,rr]=T.useState(null),[St,nr]=T.useState(!1),[ae,Dt]=T.useState(null),Fr=T.useCallback(i=>{$&&i.trim()&&(je.current&&clearTimeout(je.current),je.current=setTimeout(()=>{$&&i!==De.current&&(De.current=i,s(Zt({id:$,updates:{text:i}})))},150))},[s,$]);T.useEffect(()=>()=>{je.current&&clearTimeout(je.current)},[]),T.useImperativeHandle(v,()=>({canvas:g.current,applyAction:i=>{s({...i,meta:{...i.meta,fromRemote:!0}})},getElems:()=>S.getState().whiteboard.elements,getElements:()=>S.getState().whiteboard.elements,setElems:i=>{s({...Yr(i),meta:{fromRemote:!0}})},setElements:i=>{s({...Yr(i),meta:{fromRemote:!0}})},clearElems:()=>{s({...Wr(),meta:{fromRemote:!0}})},clearElements:()=>{s({...Wr(),meta:{fromRemote:!0}})}})),T.useEffect(()=>{t!==void 0&&s(io(t))},[t,s]),T.useEffect(()=>{n&&n(x)},[x,n]);const ut=xe(i=>i.whiteboard.watermark);T.useEffect(()=>{o!==void 0&&o!==ut.visible&&s(la(o))},[o,ut.visible,s]),T.useEffect(()=>{a!==void 0&&a!==ut.text&&s(ua(a))},[a,ut.text,s]),T.useEffect(()=>{u&&u.length>0&&s(Yr(u))},[s]),T.useEffect(()=>{p&&setTimeout(()=>{p()},0)},[]);const Ct=T.useCallback((i,d,b)=>{const E=i.canvas,j=E.width,P=E.height,A=Math.floor(-C.panX/C.zoom/d)*d,N=Math.floor(-C.panY/C.zoom/d)*d,Y=Math.ceil((j/C.zoom-C.panX/C.zoom)/d)*d,X=Math.ceil((P/C.zoom-C.panY/C.zoom)/d)*d;i.strokeStyle=b,i.lineWidth=.5/C.zoom;for(let W=A;W<=Y;W+=d)i.beginPath(),i.moveTo(W,N),i.lineTo(W,X),i.stroke();for(let W=N;W<=X;W+=d)i.beginPath(),i.moveTo(A,W),i.lineTo(Y,W),i.stroke()},[C]),zt=T.useCallback((i,d,b)=>{const E=Math.min(d.x,b.x),j=Math.min(d.y,b.y),P=Math.abs(b.x-d.x),A=Math.abs(b.y-d.y);i.strokeStyle="#0066cc",i.lineWidth=1,i.setLineDash([5,5]),i.strokeRect(E,j,P,A),i.fillStyle="rgba(0, 102, 204, 0.1)",i.fillRect(E,j,P,A),i.setLineDash([])},[]),ze=T.useCallback((i,d)=>{const{x:b=0,y:E=0,width:j=0,height:P=0,fillColor:A="#000",strokeColor:N="#000",lineWidth:Y=2}=d;i.fillStyle=A,i.fillRect(b,E,j,P),i.strokeStyle=N,i.lineWidth=Y,i.strokeRect(b,E,j,P)},[]),ot=T.useCallback((i,d)=>{const{centerX:b=0,centerY:E=0,radius:j=0,fillColor:P="#000",strokeColor:A="#000",lineWidth:N=2}=d;i.beginPath(),i.arc(b,E,j,0,Math.PI*2),i.fillStyle=P,i.fill(),i.strokeStyle=A,i.lineWidth=N,i.stroke()},[]),it=T.useCallback((i,d)=>{const{points:b=[],strokeColor:E="#000",lineWidth:j=2}=d;if(!(b.length<2)){i.strokeStyle=E,i.lineWidth=j,i.lineCap="round",i.lineJoin="round",i.beginPath(),i.moveTo(b[0].x,b[0].y);for(let P=1;P<b.length;P++)b[P]&&i.lineTo(b[P].x,b[P].y);i.stroke()}},[]),Lt=T.useCallback((i,d)=>{const{x:b=0,y:E=0,text:j="",fontSize:P=16,fontColor:A="#000"}=d;i.font=`${P}px sans-serif`,i.fillStyle=A,i.textBaseline="top",i.fillText(j,b,E)},[]),_t=T.useCallback((i,d)=>{const{x:b=0,y:E=0,width:j=0,height:P=0,fillColor:A="#fff",strokeColor:N="#000",lineWidth:Y=2}=d;i.beginPath(),i.moveTo(b+j/2,E),i.lineTo(b+j,E+P),i.lineTo(b,E+P),i.closePath(),i.fillStyle=A,i.fill(),i.strokeStyle=N,i.lineWidth=Y,i.stroke()},[]),ft=T.useCallback((i,d)=>{const{x:b=0,y:E=0,width:j=0,height:P=0,fillColor:A="#fff",strokeColor:N="#000",lineWidth:Y=2}=d;i.beginPath(),i.moveTo(b+j/2,E),i.lineTo(b+j,E+P/2),i.lineTo(b+j/2,E+P),i.lineTo(b,E+P/2),i.closePath(),i.fillStyle=A,i.fill(),i.strokeStyle=N,i.lineWidth=Y,i.stroke()},[]),Ot=T.useCallback((i,d)=>{const{centerX:b=0,centerY:E=0,size:j=0,fillColor:P="#ffff00",strokeColor:A="#000",lineWidth:N=2}=d,Y=5,X=j,W=j/2;i.beginPath();for(let z=0;z<Y*2;z++){const H=z%2===0?X:W,q=Math.PI/Y*z-Math.PI/2,K=b+Math.cos(q)*H,ie=E+Math.sin(q)*H;z===0?i.moveTo(K,ie):i.lineTo(K,ie)}i.closePath(),i.fillStyle=P,i.fill(),i.strokeStyle=A,i.lineWidth=N,i.stroke()},[]),dt=T.useCallback((i,d)=>{const{centerX:b=0,centerY:E=0,size:j=0,fillColor:P="#ff6b6b",strokeColor:A="#000",lineWidth:N=2}=d;i.beginPath();const Y=E-j/2;i.moveTo(b,Y+j/4),i.bezierCurveTo(b-j/2,Y,b-j,Y+j/2,b,E+j/2),i.bezierCurveTo(b+j,Y+j/2,b+j/2,Y,b,Y+j/4),i.fillStyle=P,i.fill(),i.strokeStyle=A,i.lineWidth=N,i.stroke()},[]),ht=T.useCallback((i,d)=>{const{x:b=0,y:E=0,width:j=0,height:P=0,fillColor:A="#fff",strokeColor:N="#000",lineWidth:Y=2}=d,X=b+j/2,W=E+P/2,z=j/2,H=P/2;i.beginPath();for(let q=0;q<6;q++){const K=Math.PI/3*q-Math.PI/2,ie=X+Math.cos(K)*z,ve=W+Math.sin(K)*H;q===0?i.moveTo(ie,ve):i.lineTo(ie,ve)}i.closePath(),i.fillStyle=A,i.fill(),i.strokeStyle=N,i.lineWidth=Y,i.stroke()},[]),jt=T.useCallback((i,d)=>{const{x:b=0,y:E=0,width:j=0,height:P=0,fillColor:A="#fff",strokeColor:N="#000",lineWidth:Y=2}=d,X=b+j/2,W=E+P/2,z=j/2,H=P/2;i.beginPath();for(let q=0;q<8;q++){const K=Math.PI/4*q-Math.PI/2,ie=X+Math.cos(K)*z,ve=W+Math.sin(K)*H;q===0?i.moveTo(ie,ve):i.lineTo(ie,ve)}i.closePath(),i.fillStyle=A,i.fill(),i.strokeStyle=N,i.lineWidth=Y,i.stroke()},[]),Pt=T.useCallback((i,d)=>{const{startX:b=0,startY:E=0,endX:j=0,endY:P=0,fillColor:A="#000",strokeColor:N="#000",lineWidth:Y=2}=d,X=15,W=Math.atan2(P-E,j-b);i.beginPath(),i.moveTo(b,E),i.lineTo(j,P),i.strokeStyle=N,i.lineWidth=Y,i.stroke(),i.beginPath(),i.moveTo(j,P),i.lineTo(j-X*Math.cos(W-Math.PI/6),P-X*Math.sin(W-Math.PI/6)),i.lineTo(j-X*Math.cos(W+Math.PI/6),P-X*Math.sin(W+Math.PI/6)),i.closePath(),i.fillStyle=A,i.fill()},[]),pt=T.useRef({}),Wt=T.useRef(null),or=T.useCallback((i,d)=>{const{x:b=0,y:E=0,width:j=0,height:P=0,src:A=""}=d;if(pt.current[A]){const N=pt.current[A];N.complete&&i.drawImage(N,b,E,j,P)}else{const N=new Image;N.onload=()=>{pt.current[A]=N,Wt.current&&Wt.current()},N.src=A,pt.current[A]=N}},[]),Tt=T.useCallback((i,d)=>{switch(d.type){case"rectangle":ze(i,d);break;case"circle":ot(i,d);break;case"pencil":it(i,d);break;case"text":Lt(i,d);break;case"triangle":_t(i,d);break;case"diamond":ft(i,d);break;case"star":Ot(i,d);break;case"heart":dt(i,d);break;case"hexagon":ht(i,d);break;case"octagon":jt(i,d);break;case"arrow":Pt(i,d);break;case"image":or(i,d);break}},[ze,ot,it,Lt,_t,ft,Ot,dt,ht,jt,Pt,or]),Br=T.useCallback(()=>{const i=g.current;if(!i)return;const d=document.createElement("canvas");d.width=i.width,d.height=i.height;const b=d.getContext("2d");if(!b)return;b.fillStyle="#ffffff",b.fillRect(0,0,d.width,d.height),b.save(),b.translate(C.panX,C.panY),b.scale(C.zoom,C.zoom),w.forEach(P=>{Tt(b,P)}),b.restore();const E=d.toDataURL("image/png"),j=document.createElement("a");j.download=`whiteboard-${Date.now()}.png`,j.href=E,j.click()},[C,w,Tt]),f=T.useCallback(()=>{const i=g.current;i&&s(aa({canvasWidth:i.width,canvasHeight:i.height,padding:50}))},[s]),R=T.useCallback(()=>{s(ta())},[s]),L=(i,d,b,E,j,P)=>{const A=i-b,N=d-E,Y=j-b,X=P-E,W=A*Y+N*X,z=Y*Y+X*X;let H=-1;z!==0&&(H=W/z);let q,K;H<0?(q=b,K=E):H>1?(q=j,K=P):(q=b+H*Y,K=E+H*X);const ie=i-q,ve=d-K;return Math.sqrt(ie*ie+ve*ve)},U=T.useCallback((i,d)=>{for(let b=w.length-1;b>=0;b--){const E=w[b],j=E.x??0,P=E.y??0,A=E.width??0,N=E.height??0,Y=E.centerX??0,X=E.centerY??0,W=E.radius??0;if(E.type==="rectangle"){if(i>=j&&i<=j+A&&d>=P&&d<=P+N)return E}else if(E.type==="circle"){if(Math.sqrt(Math.pow(i-Y,2)+Math.pow(d-X,2))<=W)return E}else if(E.type==="pencil"){const H=E.points??[];for(let q=1;q<H.length;q++){const K=H[q-1],ie=H[q];if(!K||!ie)continue;if(L(i,d,K.x,K.y,ie.x,ie.y)<=5)return E}}else if(E.type==="text"){const z=E.fontSize||16,q=(E.text||"").length*z*.6,K=z;if(i>=j&&i<=j+q&&d>=P&&d<=P+K)return E}else if(E.type==="triangle"||E.type==="diamond"||E.type==="hexagon"||E.type==="octagon"){if(i>=j&&i<=j+A&&d>=P&&d<=P+N)return E}else if(E.type==="star"||E.type==="heart"){const z=Math.sqrt(Math.pow(i-Y,2)+Math.pow(d-X,2)),H=E.size??0;if(z<=H)return E}else if(E.type==="arrow"){const H=E.startX??0,q=E.startY??0,K=E.endX??0,ie=E.endY??0;if(L(i,d,H,q,K,ie)<=10)return E}else if(E.type==="image"&&i>=j&&i<=j+A&&d>=P&&d<=P+N)return E}return null},[w]),Z=T.useCallback(i=>{let d=0,b=0,E=0,j=0;if(i.type==="rectangle"||i.type==="image"||i.type==="text"||i.type==="triangle"||i.type==="diamond"||i.type==="hexagon"||i.type==="octagon")if(d=i.x??0,b=i.y??0,i.type==="text"){const P=i.fontSize||16;E=(i.text||"").length*P*.6,j=P}else E=i.width??0,j=i.height??0;else if(i.type==="circle"){const P=i.radius??0;d=(i.centerX??0)-P,b=(i.centerY??0)-P,E=P*2,j=P*2}else if(i.type==="star"||i.type==="heart"){const P=i.size??0;d=(i.centerX??0)-P,b=(i.centerY??0)-P,E=P*2,j=P*2}else if(i.type==="pencil"&&i.points&&i.points.length>0){const P=Math.min(...i.points.map(X=>X.x)),A=Math.max(...i.points.map(X=>X.x)),N=Math.min(...i.points.map(X=>X.y)),Y=Math.max(...i.points.map(X=>X.y));d=P,b=N,E=A-P,j=Y-N}else if(i.type==="arrow")return null;return{x:d,y:b,w:E,h:j}},[]),Q=T.useCallback(i=>{const d=[];if(i.type==="arrow")return d.push({type:"start",x:i.startX??0,y:i.startY??0}),d.push({type:"end",x:i.endX??0,y:i.endY??0}),d;const b=Z(i);if(!b)return[];const{x:E,y:j,w:P,h:A}=b;return d.push({type:"nw",x:E,y:j}),d.push({type:"ne",x:E+P,y:j}),d.push({type:"se",x:E+P,y:j+A}),d.push({type:"sw",x:E,y:j+A}),d.push({type:"n",x:E+P/2,y:j}),d.push({type:"s",x:E+P/2,y:j+A}),d.push({type:"e",x:E+P,y:j+A/2}),d.push({type:"w",x:E,y:j+A/2}),d},[Z]),J=T.useCallback((i,d,b,E)=>{const j=Q(b),P=10/E;for(const A of j)if(Math.abs(i-A.x)<=P&&Math.abs(d-A.y)<=P)return A.type;return null},[Q]),G=T.useCallback((i,d)=>{i.strokeStyle="#0066cc",i.lineWidth=1/C.zoom,i.setLineDash([5/C.zoom,5/C.zoom]);const b=Z(d);b?i.strokeRect(b.x-4/C.zoom,b.y-4/C.zoom,b.w+8/C.zoom,b.h+8/C.zoom):d.type,i.setLineDash([]);const E=Q(d),j=8/C.zoom;i.fillStyle="#ffffff",i.strokeStyle="#0066cc",i.lineWidth=1/C.zoom;for(const P of E)i.fillRect(P.x-j/2,P.y-j/2,j,j),i.strokeRect(P.x-j/2,P.y-j/2,j,j)},[C.zoom,Z,Q]),ce=T.useCallback(()=>{const i=g.current;if(!i)return;const d=i.getContext("2d");d&&(d.clearRect(0,0,i.width,i.height),d.save(),d.translate(C.panX,C.panY),d.scale(C.zoom,C.zoom),m.enabled&&Ct(d,m.size,m.color),w.forEach(b=>{Tt(d,b),k.includes(b.id)&&G(d,b)}),St&&ae&&(d.fillStyle="rgba(0, 102, 204, 0.1)",d.strokeStyle="#0066cc",d.lineWidth=1/C.zoom,d.fillRect(ae.startX,ae.startY,ae.width,ae.height),d.strokeRect(ae.startX,ae.startY,ae.width,ae.height)),d.restore())},[m,Ct,w,Tt,k,G,C,St,ae]);T.useEffect(()=>{Wt.current=ce},[ce]),T.useEffect(()=>{const i=g.current;if(!i)return;const d=i.parentElement;if(!d)return;const b=()=>{const j=d.getBoundingClientRect();i.width=j.width,i.height=j.height,ce()};b();const E=new ResizeObserver(()=>{b()});return E.observe(d),()=>{E.disconnect()}},[ce]),T.useEffect(()=>{ce()},[ce]),T.useEffect(()=>{const i=b=>{b.target.tagName==="INPUT"||b.target.tagName==="TEXTAREA"||b.code==="Space"&&!b.repeat&&(b.preventDefault(),Ve(!0))},d=b=>{b.target.tagName==="INPUT"||b.target.tagName==="TEXTAREA"||b.code==="Space"&&(b.preventDefault(),Ve(!1),Ne(!1),Fe(!1))};return window.addEventListener("keydown",i),window.addEventListener("keyup",d),()=>{window.removeEventListener("keydown",i),window.removeEventListener("keyup",d)}},[]);const se=T.useCallback((i,d)=>({x:(i-C.panX)/C.zoom,y:(d-C.panY)/C.zoom}),[C]);T.useEffect(()=>{const i=g.current;if(!i||!D)return;const d=i.getContext("2d");if(d){if(ce(),d.save(),d.translate(C.panX,C.panY),d.scale(C.zoom,C.zoom),y==="pointer")zt(d,O,M);else if(y==="rectangle"){const b=Math.min(O.x,M.x),E=Math.min(O.y,M.y),j=Math.abs(M.x-O.x),P=Math.abs(M.y-O.y);ze(d,{id:"preview",type:"rectangle",x:b,y:E,width:j,height:P,fillColor:_.rectangle.fillColor,lineWidth:_.rectangle.lineWidth})}else if(y==="circle"){const b=O.x,E=O.y,j=Math.sqrt(Math.pow(M.x-O.x,2)+Math.pow(M.y-O.y,2));ot(d,{id:"preview",type:"circle",centerX:b,centerY:E,radius:j,strokeColor:_.circle.strokeColor,fillColor:_.circle.fillColor,lineWidth:_.circle.lineWidth})}else if(y==="pencil")it(d,{id:"preview",type:"pencil",points:ue,strokeColor:_.pencil.strokeColor,lineWidth:_.pencil.lineWidth});else if(y==="triangle"){const b=Math.min(O.x,M.x),E=Math.min(O.y,M.y),j=Math.abs(M.x-O.x),P=Math.abs(M.y-O.y);_t(d,{id:"preview",type:"triangle",x:b,y:E,width:j,height:P,fillColor:_.triangle.fillColor,lineWidth:_.triangle.lineWidth})}else if(y==="diamond"){const b=Math.min(O.x,M.x),E=Math.min(O.y,M.y),j=Math.abs(M.x-O.x),P=Math.abs(M.y-O.y);ft(d,{id:"preview",type:"diamond",x:b,y:E,width:j,height:P,fillColor:_.diamond.fillColor,lineWidth:_.diamond.lineWidth})}else if(y==="star"){const b=O.x,E=O.y,j=Math.sqrt(Math.pow(M.x-O.x,2)+Math.pow(M.y-O.y,2));Ot(d,{id:"preview",type:"star",centerX:b,centerY:E,size:j,fillColor:_.star.fillColor,lineWidth:_.star.lineWidth})}else if(y==="heart"){const b=O.x,E=O.y,j=Math.sqrt(Math.pow(M.x-O.x,2)+Math.pow(M.y-O.y,2));dt(d,{id:"preview",type:"heart",centerX:b,centerY:E,size:j,fillColor:_.heart.fillColor,lineWidth:_.heart.lineWidth})}else if(y==="hexagon"){const b=Math.min(O.x,M.x),E=Math.min(O.y,M.y),j=Math.abs(M.x-O.x),P=Math.abs(M.y-O.y);ht(d,{id:"preview",type:"hexagon",x:b,y:E,width:j,height:P,fillColor:_.hexagon.fillColor,lineWidth:_.hexagon.lineWidth})}else if(y==="octagon"){const b=Math.min(O.x,M.x),E=Math.min(O.y,M.y),j=Math.abs(M.x-O.x),P=Math.abs(M.y-O.y);jt(d,{id:"preview",type:"octagon",x:b,y:E,width:j,height:P,fillColor:_.octagon.fillColor,lineWidth:_.octagon.lineWidth})}else y==="arrow"&&Pt(d,{id:"preview",type:"arrow",startX:O.x,startY:O.y,endX:M.x,endY:M.y,fillColor:_.arrow.fillColor,lineWidth:_.arrow.lineWidth});d.restore()}},[D,y,O,M,ue,ce,zt,ze,ot,it,_t,ft,Ot,dt,ht,jt,Pt,C,_]);const de=i=>{const d=g.current;if(!d)return;const b=d.getBoundingClientRect(),E=i.clientX-b.left,j=i.clientY-b.top;if(Ae)return;if(ke){i.preventDefault(),i.button===0?(Ne(!0),lt({x:E-C.panX,y:j-C.panY})):i.button===2&&(Fe(!0),qe({y:j,initialZoom:C.zoom}));return}if(x)return;const{x:P,y:A}=se(E,j);if(y==="pointer"){const N=U(P,A);let Y=null;if(k.length===1){const X=k[0],W=w.find(z=>z.id===X);if(W){const z=J(P,A,W,C.zoom);z&&(Y={element:W,handle:z})}}if(Y){tr(!0),Et(Y.handle),At({x:P,y:A}),rr(JSON.parse(JSON.stringify(Y.element)));return}if(N){const X=k.includes(N.id);let W=k;if(i.shiftKey?(X?W=k.filter(z=>z!==N.id):W=[...k,N.id],s(He(W))):X||(W=[N.id],s(He(W))),W.length>0){we(!0),B({x:P,y:A});const z={};W.forEach(H=>{const q=w.find(K=>K.id===H);q&&(z[H]={...q})}),Te(z)}}else{i.shiftKey||s(He([])),nr(!0);const{x:X,y:W}=se(E,j);Dt({startX:X,startY:W,width:0,height:0})}}else if(y==="text"){const N=Date.now().toString();s(_e({id:N,type:"text",x:P,y:A,text:"Text",fontSize:_.text.fontSize,fontColor:_.text.fontColor})),s(Me("pointer")),s(He([N])),ge(N),Ee("Text"),nt({x:P,y:A}),Oe(!0)}else if(y==="eraser"){const N=U(P,A);N&&s(na(N.id))}else s(He([])),F(!0),B({x:P,y:A}),oe({x:P,y:A}),y==="pencil"&&he([{x:P,y:A}])},Le=i=>{const d=g.current;if(!d)return;const b=d.getBoundingClientRect(),E=i.clientX-b.left,j=i.clientY-b.top;if(Re){s(oa({x:E-rt.x,y:j-rt.y}));return}if($e){const N=Be.y-j,X=Be.initialZoom*(1+N*.005);s(ia(X));return}if(x)return;const{x:P,y:A}=se(E,j);if(St&&ae){const N=P-ae.startX,Y=A-ae.startY;Dt({...ae,width:N,height:Y});return}if(pe&&k.length>0){const N=P-O.x,Y=A-O.y,X=[];k.forEach(W=>{const z=Pe[W];if(!z)return;let H={};if(z.type==="rectangle")H={x:(z.x??0)+N,y:(z.y??0)+Y};else if(z.type==="circle")H={centerX:(z.centerX??0)+N,centerY:(z.centerY??0)+Y};else if(z.type==="pencil"){const q=z.points||[];if(q.length===0)return;H={points:q.map(K=>({x:K.x+N,y:K.y+Y}))}}else z.type==="text"?H={x:(z.x??0)+N,y:(z.y??0)+Y}:z.type==="triangle"||z.type==="diamond"||z.type==="hexagon"||z.type==="octagon"?H={x:(z.x??0)+N,y:(z.y??0)+Y}:z.type==="star"||z.type==="heart"?H={centerX:(z.centerX??0)+N,centerY:(z.centerY??0)+Y}:z.type==="arrow"?H={startX:(z.startX??0)+N,startY:(z.startY??0)+Y,endX:(z.endX??0)+N,endY:(z.endY??0)+Y}:z.type==="image"&&(H={x:(z.x??0)+N,y:(z.y??0)+Y});X.push({id:W,updates:H})}),X.length>0&&s(oo(X));return}if(xt&&It&&Nt&&me){let N={};const Y=P-Nt.x,X=A-Nt.y,W=It;if(W.type==="arrow")me==="start"?N={startX:(W.startX??0)+Y,startY:(W.startY??0)+X}:me==="end"&&(N={endX:(W.endX??0)+Y,endY:(W.endY??0)+X});else if(W.type==="circle"||W.type==="star"||W.type==="heart"){const z=W.radius||W.size||0,H=me.includes("e"),q=me.includes("s"),K=me.includes("w"),ie=me.includes("n");let ve=0;H&&(ve+=Y),K&&(ve-=Y),q&&(ve+=X),ie&&(ve-=X);const Yt=Math.max(5,z+ve);W.type==="circle"?N={radius:Yt}:N={size:Yt}}else if(W.type==="pencil"&&W.points){const z=Z(W);if(z){const{x:H,y:q,w:K,h:ie}=z;let ve=H,Yt=q,Xr=K,Ur=ie;me.includes("e")&&(Xr=Math.max(5,K+Y)),me.includes("w")&&(Xr=Math.max(5,K-Y),ve=H+Y),me.includes("s")&&(Ur=Math.max(5,ie+X)),me.includes("n")&&(Ur=Math.max(5,ie-X),Yt=q+X);const ts=Xr/K,rs=Ur/ie;N={points:W.points.map(mo=>({x:ve+(mo.x-H)*ts,y:Yt+(mo.y-q)*rs}))}}}else{let z=W.x??0,H=W.y??0,q=W.width??0,K=W.height??0;if(me.includes("e")&&(q=Math.max(5,(W.width??0)+Y)),me.includes("w")){const ie=(W.width??0)-Y;ie>5&&(q=ie,z=(W.x??0)+Y)}if(me.includes("s")&&(K=Math.max(5,(W.height??0)+X)),me.includes("n")){const ie=(W.height??0)-X;ie>5&&(K=ie,H=(W.y??0)+X)}N={x:z,y:H,width:q,height:K}}Object.keys(N).length>0&&s(Zt({id:W.id,updates:N}));return}D&&(oe({x:P,y:A}),y==="pencil"&&he(N=>[...N,{x:P,y:A}]))},Ge=()=>{if(Re||$e){Ne(!1),Fe(!1);return}if(x){we(!1),F(!1);return}if(pe&&we(!1),St&&ae){const i=ae.width>0?ae.startX:ae.startX+ae.width,d=ae.height>0?ae.startY:ae.startY+ae.height,b=Math.abs(ae.width),E=Math.abs(ae.height),j=[];w.forEach(P=>{const A=Z(P);A&&A.x<i+b&&A.x+A.w>i&&A.y<d+E&&A.y+A.h>d&&j.push(P.id)}),j.length>0&&s(He(j))}if(F(!1),we(!1),tr(!1),nr(!1),Dt(null),Et(null),rr(null),he([]),B({x:0,y:0}),Te({}),At(null),Ne(!1),!!D){if(y==="pointer")ce();else if(y==="rectangle"){const i=Math.min(O.x,M.x),d=Math.min(O.y,M.y),b=Math.abs(M.x-O.x),E=Math.abs(M.y-O.y);b>0&&E>0&&s(_e({id:Date.now().toString(),type:"rectangle",x:i,y:d,width:b,height:E,strokeColor:_.rectangle.strokeColor,fillColor:_.rectangle.fillColor,lineWidth:_.rectangle.lineWidth}))}else if(y==="circle"){const i=O.x,d=O.y,b=Math.sqrt(Math.pow(M.x-O.x,2)+Math.pow(M.y-O.y,2));b>0&&s(_e({id:Date.now().toString(),type:"circle",centerX:i,centerY:d,radius:b,strokeColor:_.circle.strokeColor,fillColor:_.circle.fillColor,lineWidth:_.circle.lineWidth}))}else if(y==="pencil")ue.length>1&&s(_e({id:Date.now().toString(),type:"pencil",points:[...ue],strokeColor:_.pencil.strokeColor,lineWidth:_.pencil.lineWidth})),he([]);else if(y==="triangle"){const i=Math.min(O.x,M.x),d=Math.min(O.y,M.y),b=Math.abs(M.x-O.x),E=Math.abs(M.y-O.y);b>0&&E>0&&s(_e({id:Date.now().toString(),type:"triangle",x:i,y:d,width:b,height:E,strokeColor:_.triangle.strokeColor,fillColor:_.triangle.fillColor,lineWidth:_.triangle.lineWidth}))}else if(y==="diamond"){const i=Math.min(O.x,M.x),d=Math.min(O.y,M.y),b=Math.abs(M.x-O.x),E=Math.abs(M.y-O.y);b>0&&E>0&&s(_e({id:Date.now().toString(),type:"diamond",x:i,y:d,width:b,height:E,strokeColor:_.diamond.strokeColor,fillColor:_.diamond.fillColor,lineWidth:_.diamond.lineWidth}))}else if(y==="star"){const i=O.x,d=O.y,b=Math.sqrt(Math.pow(M.x-O.x,2)+Math.pow(M.y-O.y,2));b>0&&s(_e({id:Date.now().toString(),type:"star",centerX:i,centerY:d,size:b,strokeColor:_.star.strokeColor,fillColor:_.star.fillColor,lineWidth:_.star.lineWidth}))}else if(y==="heart"){const i=O.x,d=O.y,b=Math.sqrt(Math.pow(M.x-O.x,2)+Math.pow(M.y-O.y,2));b>0&&s(_e({id:Date.now().toString(),type:"heart",centerX:i,centerY:d,size:b,strokeColor:_.heart.strokeColor,fillColor:_.heart.fillColor,lineWidth:_.heart.lineWidth}))}else if(y==="hexagon"){const i=Math.min(O.x,M.x),d=Math.min(O.y,M.y),b=Math.abs(M.x-O.x),E=Math.abs(M.y-O.y);b>0&&E>0&&s(_e({id:Date.now().toString(),type:"hexagon",x:i,y:d,width:b,height:E,strokeColor:_.hexagon.strokeColor,fillColor:_.hexagon.fillColor,lineWidth:_.hexagon.lineWidth}))}else if(y==="octagon"){const i=Math.min(O.x,M.x),d=Math.min(O.y,M.y),b=Math.abs(M.x-O.x),E=Math.abs(M.y-O.y);b>0&&E>0&&s(_e({id:Date.now().toString(),type:"octagon",x:i,y:d,width:b,height:E,strokeColor:_.octagon.strokeColor,fillColor:_.octagon.fillColor,lineWidth:_.octagon.lineWidth}))}else if(y==="arrow"){const i=M.x-O.x,d=M.y-O.y;Math.sqrt(i*i+d*d)>5&&s(_e({id:Date.now().toString(),type:"arrow",startX:O.x,startY:O.y,endX:M.x,endY:M.y,strokeColor:_.arrow.strokeColor,fillColor:_.arrow.fillColor,lineWidth:_.arrow.lineWidth}))}F(!1)}},ir=i=>{ke&&i.preventDefault()},We=(i,d,b)=>{ge(i.id),Ee(i.text||""),nt({x:i.x||d,y:i.y||b}),De.current=i.text||"",Oe(!0)},es=()=>{if(ke)return Re?"grabbing":$e?"ns-resize":"grab";if(x)return"default";if(k.length===1&&!D&&y==="pointer"){const i=w.find(d=>d.id===k[0]);if(i){const d=J(M.x,M.y,i,C.zoom);if(d)return d==="n"||d==="s"?"ns-resize":d==="e"||d==="w"?"ew-resize":d==="ne"||d==="sw"?"nesw-resize":d==="nw"||d==="se"?"nwse-resize":"pointer"}}return"default"},[po,vo]=T.useState({propTools:!1,lockIndicator:!1});return T.useEffect(()=>{const i=()=>{if(window.innerWidth<=768){vo({propTools:!1,lockIndicator:!1});return}const d=document.getElementById("wb-canvas-container");if(!d)return;const b=d.querySelector(".wb-toolbar"),E=d.querySelector(".wb-prop-tools"),j=d.querySelector(".wb-lock-indicator");let P=!1,A=!1;if(b){const N=b.getBoundingClientRect();if(E){const Y=E.getBoundingClientRect();N.bottom>Y.top-10&&(P=!0)}if(j){const Y=j.getBoundingClientRect();N.top<Y.bottom+10&&(A=!0)}}vo({propTools:P,lockIndicator:A})};return i(),window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i)}},[y,x,k]),h.jsxs("div",{id:"wb-canvas-container",style:{backgroundColor:"#fff",position:"relative",width:"100%",height:"100%"},children:[h.jsx("canvas",{ref:g,onMouseDown:de,onMouseMove:Le,onMouseUp:Ge,onMouseLeave:Ge,onDoubleClick:i=>{if(x)return;const d=g.current;if(!d)return;const b=d.getBoundingClientRect(),E=i.clientX-b.left,j=i.clientY-b.top,{x:P,y:A}=se(E,j),N=U(P,A);N&&N.type==="text"&&We(N,P,A)},onContextMenu:ir,style:{cursor:es()}}),x&&h.jsx(Ya,{text:r||e&&((yo=e.lock)==null?void 0:yo.text)||I.text,shifted:po.lockIndicator}),Ae&&h.jsx("input",{type:"text",value:V,onChange:i=>{const d=i.target.value;Ee(d),Fr(d)},onKeyDown:i=>{i.key==="Enter"&&V.trim()?($&&(s(Zt({id:$,updates:{text:V}})),De.current=V),Oe(!1),Ee(""),ge(null)):i.key==="Escape"&&(Oe(!1),Ee(""),ge(null))},onBlur:()=>{V.trim()&&$&&(s(Zt({id:$,updates:{text:V}})),De.current=V),Oe(!1),Ee(""),ge(null)},onMouseDown:i=>i.stopPropagation(),autoFocus:!0,style:{position:"absolute",left:Ie.x*C.zoom+C.panX,top:Ie.y*C.zoom+C.panY,fontSize:_.text.fontSize*C.zoom,color:_.text.fontColor,background:"white",border:"2px solid #0066cc",outline:"none",fontFamily:"sans-serif",minWidth:"150px",padding:"4px 8px",zIndex:1e3,boxShadow:"0 2px 8px rgba(0,0,0,0.2)"}}),h.jsx(Za,{onFitToView:f,onExport:Br,onToggleGrid:R}),h.jsx(Ka,{mode:l,onImageUpload:c}),h.jsx(Ja,{shifted:po.propTools}),ut.visible&&h.jsx(ma,{})]})});$r.displayName="InternalWhiteboard";class Qa extends T.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,r){console.error("Whiteboard Error:",t,r)}render(){return this.state.hasError?h.jsxs("div",{style:{padding:"20px",textAlign:"center",background:"#fff1f0",border:"1px solid #ffa39e",borderRadius:"4px",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[h.jsx("h3",{children:"Something went wrong in Whiteboard"}),h.jsx("button",{onClick:()=>this.setState({hasError:!1}),style:{marginTop:"10px",padding:"8px 16px",cursor:"pointer",background:"#fff",border:"1px solid #d9d9d9",borderRadius:"2px"},children:"Try Again"})]}):this.props.children}}const ho=T.forwardRef((e,t)=>{const{store:r,onAction:n,...o}=e,a=T.useRef(n);T.useEffect(()=>{a.current=n},[n]);const l=T.useMemo(()=>r??Vr({actionHandlerRef:a}),[r]);return h.jsx(Qa,{children:h.jsx(Xo,{store:l,children:h.jsx(Ko,{children:h.jsx($r,{ref:t,...o})})})})});ho.displayName="Whiteboard",Se.WhiteboardComponent=$r,Se.createWhiteboardStore=Vr,Se.default=ho,Se.store=ya,Se.whiteboardActions=fa,Se.whiteboardReducer=ao,Object.defineProperties(Se,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
99
|
+
(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}}),F.warnIfExceeded()),D}}}}function Jt(e){return typeof e=="boolean"}function Vi(){return function(t){return $i(t)}}function $i(e){e===void 0&&(e={});var t=e.thunk,r=t===void 0?!0:t,n=e.immutableCheck,i=n===void 0?!0:n,a=e.serializableCheck,l=a===void 0?!0:a,u=e.actionCreatorCheck,p=u===void 0?!0:u,c=new Ri;if(r&&(Jt(r)?c.push(Mr):c.push(Mr.withExtraArgument(r.extraArgument))),process.env.NODE_ENV!=="production"){if(i){var v={};Jt(i)||(v=i),c.unshift(Wi(v))}if(l){var b={};Jt(l)||(b=l),c.push(Yi(b))}if(p){var s={};Jt(p)||(s=p),c.unshift(Mi(s))}}return c}var Ir=process.env.NODE_ENV==="production";function Fi(e){var t=Vi(),r=e||{},n=r.reducer,i=n===void 0?void 0:n,a=r.middleware,l=a===void 0?t():a,u=r.devTools,p=u===void 0?!0:u,c=r.preloadedState,v=c===void 0?void 0:c,b=r.enhancers,s=b===void 0?void 0:b,S;if(typeof i=="function")S=i;else if(Bn(i))S=gi(i);else throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');var m=l;if(typeof m=="function"&&(m=m(t),!Ir&&!Array.isArray(m)))throw new Error("when using a middleware builder function, an array of middleware must be returned");if(!Ir&&m.some(function(I){return typeof I!="function"}))throw new Error("each middleware provided to configureStore must be a function");var y=bi.apply(void 0,m),E=Kt;p&&(E=ji(et({trace:!Ir},typeof p=="object"&&p)));var C=new Ni(y),O=C;Array.isArray(s)?O=wt([y],s):typeof s=="function"&&(O=s(C));var k=E.apply(void 0,O);return Wn(S,v,k)}function Qn(e){var t={},r=[],n,i={addCase:function(a,l){if(process.env.NODE_ENV!=="production"){if(r.length>0)throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");if(n)throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`")}var u=typeof a=="string"?a:a.type;if(!u)throw new Error("`builder.addCase` cannot be called with an empty action type");if(u in t)throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");return t[u]=l,i},addMatcher:function(a,l){if(process.env.NODE_ENV!=="production"&&n)throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return r.push({matcher:a,reducer:l}),i},addDefaultCase:function(a){if(process.env.NODE_ENV!=="production"&&n)throw new Error("`builder.addDefaultCase` can only be called once");return n=a,i}};return e(i),[t,r,n]}function Xi(e){return typeof e=="function"}var eo=!1;function Bi(e,t,r,n){r===void 0&&(r=[]),process.env.NODE_ENV!=="production"&&typeof t=="object"&&(eo||(eo=!0,console.warn("The object notation for `createReducer` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer")));var i=typeof t=="function"?Qn(t):[t,r,n],a=i[0],l=i[1],u=i[2],p;if(Xi(e))p=function(){return Nr(e())};else{var c=Nr(e);p=function(){return c}}function v(b,s){b===void 0&&(b=p());var S=wt([a[s.type]],l.filter(function(m){var y=m.matcher;return y(s)}).map(function(m){var y=m.reducer;return y}));return S.filter(function(m){return!!m}).length===0&&(S=[u]),S.reduce(function(m,y){if(y)if(Je(m)){var E=m,C=y(E,s);return C===void 0?m:C}else{if(Ue(m))return An(m,function(O){return y(O,s)});var C=y(m,s);if(C===void 0){if(m===null)return m;throw Error("A case reducer on a non-draftable value must not return undefined")}return C}return m},b)}return v.getInitialState=p,v}var to=!1;function Ui(e,t){return e+"/"+t}function Hi(e){var t=e.name;typeof process<"u"&&process.env.NODE_ENV==="development"&&e.initialState===void 0&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");var r=typeof e.initialState=="function"?e.initialState:Nr(e.initialState),n=e.reducers||{},i=Object.keys(n),a={},l={},u={};i.forEach(function(v){var b=n[v],s=Ui(t,v),S,m;"reducer"in b?(S=b.reducer,m=b.prepare):S=b,a[v]=S,l[s]=S,u[v]=m?tt(s,m):tt(s)});function p(){process.env.NODE_ENV!=="production"&&typeof e.extraReducers=="object"&&(to||(to=!0,console.warn("The object notation for `createSlice.extraReducers` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice")));var v=typeof e.extraReducers=="function"?Qn(e.extraReducers):[e.extraReducers],b=v[0],s=b===void 0?{}:b,S=v[1],m=S===void 0?[]:S,y=v[2],E=y===void 0?void 0:y,C=et(et({},s),l);return Bi(r,function(O){for(var k in C)O.addCase(k,C[k]);for(var I=0,x=m;I<x.length;I++){var D=x[I];O.addMatcher(D.matcher,D.reducer)}E&&O.addDefaultCase(E)})}var c;return{name:t,reducer:function(v,b){return c||(c=p()),c(v,b)},actions:u,caseReducers:a,getInitialState:function(){return c||(c=p()),c.getInitialState()}}}var qi="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Gi=function(e){e===void 0&&(e=21);for(var t="",r=e;r--;)t+=qi[Math.random()*64|0];return t},Ki=["name","message","stack","code"],Dr=(function(){function e(t,r){this.payload=t,this.meta=r}return e})(),ro=(function(){function e(t,r){this.payload=t,this.meta=r}return e})(),Ji=function(e){if(typeof e=="object"&&e!==null){for(var t={},r=0,n=Ki;r<n.length;r++){var i=n[r];typeof e[i]=="string"&&(t[i]=e[i])}return t}return{message:String(e)}};(function(){function e(t,r,n){var i=tt(t+"/fulfilled",function(v,b,s,S){return{payload:v,meta:Rr(et({},S||{}),{arg:s,requestId:b,requestStatus:"fulfilled"})}}),a=tt(t+"/pending",function(v,b,s){return{payload:void 0,meta:Rr(et({},s||{}),{arg:b,requestId:v,requestStatus:"pending"})}}),l=tt(t+"/rejected",function(v,b,s,S,m){return{payload:S,error:(n&&n.serializeError||Ji)(v||"Rejected"),meta:Rr(et({},m||{}),{arg:s,requestId:b,rejectedWithValue:!!S,requestStatus:"rejected",aborted:(v==null?void 0:v.name)==="AbortError",condition:(v==null?void 0:v.name)==="ConditionError"})}}),u=!1,p=typeof AbortController<"u"?AbortController:(function(){function v(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return v.prototype.abort=function(){process.env.NODE_ENV!=="production"&&(u||(u=!0,console.info("This platform does not implement AbortController. \nIf you want to use the AbortController to react to `abort` events, please consider importing a polyfill like 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'.")))},v})();function c(v){return function(b,s,S){var m=n!=null&&n.idGenerator?n.idGenerator(v):Gi(),y=new p,E;function C(k){E=k,y.abort()}var O=(function(){return Oi(this,null,function(){var k,I,x,D,F,j,X;return wi(this,function(M){switch(M.label){case 0:return M.trys.push([0,4,,5]),D=(k=n==null?void 0:n.condition)==null?void 0:k.call(n,v,{getState:s,extra:S}),Qi(D)?[4,D]:[3,2];case 1:D=M.sent(),M.label=2;case 2:if(D===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return F=new Promise(function(oe,ue){return y.signal.addEventListener("abort",function(){return ue({name:"AbortError",message:E||"Aborted"})})}),b(a(m,v,(I=n==null?void 0:n.getPendingMeta)==null?void 0:I.call(n,{requestId:m,arg:v},{getState:s,extra:S}))),[4,Promise.race([F,Promise.resolve(r(v,{dispatch:b,getState:s,extra:S,requestId:m,signal:y.signal,abort:C,rejectWithValue:function(oe,ue){return new Dr(oe,ue)},fulfillWithValue:function(oe,ue){return new ro(oe,ue)}})).then(function(oe){if(oe instanceof Dr)throw oe;return oe instanceof ro?i(oe.payload,m,v,oe.meta):i(oe,m,v)})])];case 3:return x=M.sent(),[3,5];case 4:return j=M.sent(),x=j instanceof Dr?l(null,m,v,j.payload,j.meta):l(j,m,v),[3,5];case 5:return X=n&&!n.dispatchConditionRejection&&l.match(x)&&x.meta.condition,X||b(x),[2,x]}})})})();return Object.assign(O,{abort:C,requestId:m,arg:v,unwrap:function(){return O.then(Zi)}})}}return Object.assign(c,{pending:a,rejected:l,fulfilled:i,typePrefix:t})}return e.withTypes=function(){return e},e})();function Zi(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Qi(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var zr="listenerMiddleware";tt(zr+"/add"),tt(zr+"/removeAll"),tt(zr+"/remove");var no;typeof queueMicrotask=="function"&&queueMicrotask.bind(typeof window<"u"?window:typeof global<"u"?global:globalThis),ni();const ea={grid:{size:20,color:"#ccc",enabled:!0},toolbar:{selectedTool:"pointer"},toolProperties:{pencil:{strokeColor:"#000000",lineWidth:4},rectangle:{strokeColor:"#000000",fillColor:"#ffffff",lineWidth:2},circle:{strokeColor:"#000000",fillColor:"#ffffff",lineWidth:2},triangle:{strokeColor:"#000000",fillColor:"#ffffff",lineWidth:2},diamond:{strokeColor:"#000000",fillColor:"#ffffff",lineWidth:2},star:{strokeColor:"#000000",fillColor:"#ffff00",lineWidth:2},heart:{strokeColor:"#000000",fillColor:"#ff6b6b",lineWidth:2},hexagon:{strokeColor:"#000000",fillColor:"#ffffff",lineWidth:2},octagon:{strokeColor:"#000000",fillColor:"#ffffff",lineWidth:2},arrow:{strokeColor:"#000000",fillColor:"#000000",lineWidth:2},text:{fontSize:16,fontColor:"#000000"}},elements:[],selectedElementIds:[],viewport:{panX:0,panY:0,zoom:1},watermark:{text:"Nines Studios",url:"https://github.com/huzeyfecoskun",visible:!0},lock:{isLocked:!1,text:"Whiteboard drawing is only for moderator"}};function ta(e){const t=[],r=new Set;for(const n of e){const i=n==null?void 0:n.id;if(i==null){t.push(n);continue}r.has(i)||(r.add(i),t.push(n))}return t}const Lr=Hi({name:"whiteboard",initialState:ea,reducers:{toggleGrid(e){e.grid.enabled=!e.grid.enabled},setGridSize(e,t){e.grid.size=t.payload},setGridColor(e,t){e.grid.color=t.payload},setSelectedTool(e,t){e.toolbar.selectedTool=t.payload},setToolProperty(e,t){const{tool:r,property:n,value:i}=t.payload;e.toolProperties[r]&&(e.toolProperties[r][n]=i)},addElement(e,t){const r=t.payload,n=r==null?void 0:r.id;n!=null&&e.elements.some(a=>(a==null?void 0:a.id)===n)||e.elements.push(r)},updateElement(e,t){const{id:r,updates:n}=t.payload,i=e.elements.findIndex(a=>a.id===r);i!==-1&&(e.elements[i]={...e.elements[i],...n})},updateElements(e,t){t.payload.forEach(({id:n,updates:i})=>{const a=e.elements.findIndex(l=>l.id===n);a!==-1&&(e.elements[a]={...e.elements[a],...i})})},removeElement(e,t){const r=t.payload;e.elements=e.elements.filter(n=>n.id!==r),e.selectedElementIds=e.selectedElementIds.filter(n=>n!==r)},setSelectedElements(e,t){e.selectedElementIds=t.payload},clearElements(e){e.elements=[],e.selectedElementIds=[]},setElements(e,t){const r=Array.isArray(t.payload)?t.payload:[];e.elements=ta(r),e.selectedElementIds=[]},setPan(e,t){e.viewport.panX=t.payload.x,e.viewport.panY=t.payload.y},setZoom(e,t){e.viewport.zoom=Math.max(.1,Math.min(5,t.payload))},resetViewport(e){e.viewport.panX=0,e.viewport.panY=0,e.viewport.zoom=1},bringToFront(e,t){const r=t.payload,n=e.elements.findIndex(i=>i.id===r);if(n!==-1&&n<e.elements.length-1){const[i]=e.elements.splice(n,1);e.elements.push(i)}},sendToBack(e,t){const r=t.payload,n=e.elements.findIndex(i=>i.id===r);if(n>0){const[i]=e.elements.splice(n,1);e.elements.unshift(i)}},fitToView(e,t){const{canvasWidth:r,canvasHeight:n,padding:i=50}=t.payload,a=e.elements;if(a.length===0){e.viewport.panX=0,e.viewport.panY=0,e.viewport.zoom=1;return}let l=1/0,u=1/0,p=-1/0,c=-1/0;if(a.forEach(x=>{const D=F=>F??0;if(x.type==="rectangle"){const F=D(x.x),j=D(x.y),X=D(x.width),M=D(x.height);l=Math.min(l,F),u=Math.min(u,j),p=Math.max(p,F+X),c=Math.max(c,j+M)}else if(x.type==="circle"){const F=D(x.centerX),j=D(x.centerY),X=D(x.radius);l=Math.min(l,F-X),u=Math.min(u,j-X),p=Math.max(p,F+X),c=Math.max(c,j+X)}else if(x.type==="pencil"&&x.points&&x.points.length>0)x.points.forEach(F=>{l=Math.min(l,F.x),u=Math.min(u,F.y),p=Math.max(p,F.x),c=Math.max(c,F.y)});else if(x.type==="triangle"||x.type==="diamond"||x.type==="hexagon"||x.type==="octagon"){const F=D(x.x),j=D(x.y),X=D(x.width),M=D(x.height);l=Math.min(l,F),u=Math.min(u,j),p=Math.max(p,F+X),c=Math.max(c,j+M)}else if(x.type==="star"||x.type==="heart"){const F=D(x.centerX),j=D(x.centerY),X=D(x.size);l=Math.min(l,F-X),u=Math.min(u,j-X),p=Math.max(p,F+X),c=Math.max(c,j+X)}else if(x.type==="arrow"){const F=D(x.startX),j=D(x.startY),X=D(x.endX),M=D(x.endY);l=Math.min(l,F,X),u=Math.min(u,j,M),p=Math.max(p,F,X),c=Math.max(c,j,M)}}),l===1/0)return;const v=p-l,b=c-u;if(v<=0||b<=0)return;const s=r-i*2,S=n-i*2,m=s/v,y=S/b,E=Math.min(m,y,5),C=(l+p)/2,O=(u+c)/2,k=r/2-C*E,I=n/2-O*E;e.viewport.zoom=Math.max(.1,E),e.viewport.panX=k,e.viewport.panY=I},setLocked(e,t){e.lock.isLocked=t.payload,t.payload&&(e.toolbar.selectedTool="pointer",e.selectedElementIds=[])},setWatermarkEnabled(e,t){e.watermark.visible=t.payload},setWatermarkText(e,t){e.watermark.text=t.payload}}}),{toggleGrid:ra,setGridSize:cs,setGridColor:ls,setSelectedTool:Me,setToolProperty:na,addElement:Se,updateElement:Zt,updateElements:oo,removeElement:oa,setSelectedElements:He,clearElements:Wr,setElements:Yr,setPan:ia,setZoom:aa,resetViewport:us,fitToView:sa,bringToFront:ca,sendToBack:la,setLocked:io,setWatermarkEnabled:ua,setWatermarkText:fa}=Lr.actions,da=Lr.actions,ao=Lr.reducer,ha=new Set(["rectangle","circle","pencil","triangle","diamond","star","heart","hexagon","octagon","arrow","text"]),pa=new Set(["strokeColor","fillColor","lineWidth","fontSize","fontColor","textColor"]),va=e=>{var t,r;if(!e||typeof e.type!="string"||e.type.startsWith("@@redux/"))return!1;if(e.type==="whiteboard/addElement"){const n=(t=e==null?void 0:e.payload)==null?void 0:t.type;return typeof n=="string"&&ha.has(n)}if(e.type==="whiteboard/removeElement"||e.type==="whiteboard/clearElements"||e.type==="whiteboard/bringToFront"||e.type==="whiteboard/sendToBack")return!0;if(e.type==="whiteboard/setToolProperty"){const{tool:n,property:i}=(e==null?void 0:e.payload)??{};return typeof n!="string"||typeof i!="string"?!1:pa.has(i)}if(e.type==="whiteboard/updateElement")return so((r=e==null?void 0:e.payload)==null?void 0:r.updates);if(e.type==="whiteboard/updateElements"){const n=e==null?void 0:e.payload;return Array.isArray(n)?n.some(i=>so(i.updates)):!1}return!1},so=e=>{if(!e||typeof e!="object")return!1;const t=r=>Object.prototype.hasOwnProperty.call(e,r);return!!(t("text")||t("fontSize")||t("fontColor")||t("textColor")||t("strokeColor")||t("fillColor")||t("lineWidth")||t("x")||t("y")||t("width")||t("height")||t("centerX")||t("centerY")||t("radius")||t("size")||t("startX")||t("startY")||t("endX")||t("endY")||t("points"))},ya=e=>t=>r=>n=>{var a;const i=r(n);return!((a=n.meta)!=null&&a.fromRemote)&&e&&e.current&&va(n)&&e.current(n,t.getState()),i},Vr=({preloadedState:e,actionHandlerRef:t}={})=>Fi({reducer:{whiteboard:ao},middleware:r=>r().concat(ya(t)),preloadedState:e}),ma=Vr(),ga=()=>{const e=xe(t=>t.whiteboard.watermark);return h.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:h.jsx("div",{className:"wb-watermark",children:e.text})})};var co={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},lo=P.createContext&&P.createContext(co),ba=["attr","size","title"];function wa(e,t){if(e==null)return{};var r=xa(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function xa(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Qt(){return Qt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qt.apply(this,arguments)}function uo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function er(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uo(Object(r),!0).forEach(function(n){Ea(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ea(e,t,r){return t=Sa(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sa(e){var t=Ca(e,"string");return typeof t=="symbol"?t:t+""}function Ca(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fo(e){return e&&e.map((t,r)=>P.createElement(t.tag,er({key:r},t.attr),fo(t.child)))}function fe(e){return t=>P.createElement(_a,Qt({attr:er({},e.attr)},t),fo(e.child))}function _a(e){var t=r=>{var{attr:n,size:i,title:a}=e,l=wa(e,ba),u=i||r.size||"1em",p;return r.className&&(p=r.className),e.className&&(p=(p?p+" ":"")+e.className),P.createElement("svg",Qt({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,l,{className:p,style:er(er({color:e.color||r.color},r.style),e.style),height:u,width:u,xmlns:"http://www.w3.org/2000/svg"}),a&&P.createElement("title",null,a),e.children)};return lo!==void 0?P.createElement(lo.Consumer,null,r=>t(r)):t(co)}function Oa(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 32H32A32 32 0 0 0 0 64v384a32 32 0 0 0 32 32h384a32 32 0 0 0 32-32V64a32 32 0 0 0-32-32zm-32 64v128H256V96zm-192 0v128H64V96zM64 416V288h128v128zm192 0V288h128v128z"},child:[]}]})(e)}function ja(e){return fe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"},child:[]}]})(e)}function Ta(e){return fe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M497.941 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.745-18.745-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48.004 48.004 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12H355.883l142.058-142.059zm-302.627-62.627l137.373 137.373L265.373 416H150.628l-80-80 124.686-124.686z"},child:[]}]})(e)}function Pa(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z"},child:[]}]})(e)}function ka(e){return fe({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z"},child:[]}]})(e)}function Ma(e){return fe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5 199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z"},child:[]}]})(e)}function Ra(e){return fe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"},child:[]}]})(e)}function Na(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z"},child:[]}]})(e)}function Aa(e){return fe({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M302.189 329.126H196.105l55.831 135.993c3.889 9.428-.555 19.999-9.444 23.999l-49.165 21.427c-9.165 4-19.443-.571-23.332-9.714l-53.053-129.136-86.664 89.138C18.729 472.71 0 463.554 0 447.977V18.299C0 1.899 19.921-6.096 30.277 5.443l284.412 292.542c11.472 11.179 3.007 31.141-12.5 31.141z"},child:[]}]})(e)}function Ia(e){return fe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"},child:[]}]})(e)}function Da(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"},child:[]}]})(e)}function za(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"},child:[]}]})(e)}function La(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z"},child:[]}]})(e)}function Wa(e){return fe({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"},child:[]}]})(e)}function Ya(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"},child:[]}]})(e)}const Va=({text:e,shifted:t})=>h.jsxs("div",{className:`wb-lock-indicator ${t?"wb-shifted":""}`,children:[h.jsx(Na,{}),h.jsx("span",{children:e||"Locked"})]});function $a(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z"},child:[]}]})(e)}function Fa(e){return fe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M284.3 11.7c-15.6-15.6-40.9-15.6-56.6 0l-216 216c-15.6 15.6-15.6 40.9 0 56.6l216 216c15.6 15.6 40.9 15.6 56.6 0l216-216c15.6-15.6 15.6-40.9 0-56.6l-216-216z"},child:[]}]})(e)}function Xa(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"},child:[]}]})(e)}function Ba(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M144 144l0 48 160 0 0-48c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192l0-48C80 64.5 144.5 0 224 0s144 64.5 144 144l0 48 16 0c35.3 0 64 28.7 64 64l0 192c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 256c0-35.3 28.7-64 64-64l16 0z"},child:[]}]})(e)}function Ua(e){return fe({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l128 0 0 352c0 17.7 14.3 32 32 32s32-14.3 32-32l0-352 128 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 32 32 32z"},child:[]}]})(e)}function Ha(e){return fe({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M144 144c0-44.2 35.8-80 80-80c31.9 0 59.4 18.6 72.3 45.7c7.6 16 26.7 22.8 42.6 15.2s22.8-26.7 15.2-42.6C331 33.7 281.5 0 224 0C144.5 0 80 64.5 80 144l0 48-16 0c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-192c0-35.3-28.7-64-64-64l-240 0 0-48z"},child:[]}]})(e)}function qa(e){return fe({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M8.5.134a1 1 0 0 0-1 0l-6 3.577a1 1 0 0 0-.5.866v6.846a1 1 0 0 0 .5.866l6 3.577a1 1 0 0 0 1 0l6-3.577a1 1 0 0 0 .5-.866V4.577a1 1 0 0 0-.5-.866z"},child:[]}]})(e)}function Ga(e){return fe({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M11.107 0a.5.5 0 0 1 .353.146l4.394 4.394a.5.5 0 0 1 .146.353v6.214a.5.5 0 0 1-.146.353l-4.394 4.394a.5.5 0 0 1-.353.146H4.893a.5.5 0 0 1-.353-.146L.146 11.46A.5.5 0 0 1 0 11.107V4.893a.5.5 0 0 1 .146-.353L4.54.146A.5.5 0 0 1 4.893 0z"},child:[]}]})(e)}const Ka=({onClose:e,onConfirm:t})=>{const{t:r}=Ut(),[n,i]=P.useState(!1),a=()=>{i(!0),setTimeout(e,300)},l=()=>{i(!0),setTimeout(t,300)};return Hr.createPortal(h.jsx("div",{className:`wb-confirm-popup-overlay ${n?"wb-closing":""}`,children:h.jsxs("div",{className:"wb-confirm-popup",children:[h.jsx("p",{children:r("confirmClear")}),h.jsxs("div",{className:"wb-actions",children:[h.jsx("button",{onClick:a,children:r("cancel")}),h.jsx("button",{onClick:l,children:r("clear")})]})]})}),document.body)},Ja=({mode:e="user",onImageUpload:t})=>{const r=vr(),{t:n,language:i,changeLanguage:a}=Ut(),l=xe(X=>X.whiteboard.toolbar.selectedTool),u=xe(X=>X.whiteboard.lock.isLocked),[p,c]=P.useState(!1),[v,b]=P.useState(!1),[s,S]=P.useState(!1),m=P.useRef(null),y=P.useRef(null),E=P.useRef(null),C=P.useRef(null),O=P.useRef(null),k=async X=>{var oe;const M=(oe=X.target.files)==null?void 0:oe[0];if(M){if(t)try{const ue=URL.createObjectURL(M),he=new Image;he.onload=async()=>{const pe=he.width,we=he.height;URL.revokeObjectURL(ue);try{const Te=await t(M),Pe=Date.now().toString();r(Se({id:Pe,type:"image",x:100,y:100,width:pe,height:we,src:Te})),r(Me("pointer")),r(He([Pe]))}catch(Te){console.error("Image upload failed:",Te)}},he.src=ue}catch(ue){console.error("Error processing image:",ue)}else{const ue=URL.createObjectURL(M),he=new Image;he.onload=()=>{const pe=Date.now().toString();r(Se({id:pe,type:"image",x:100,y:100,width:he.width,height:he.height,src:ue})),r(Me("pointer")),r(He([pe]))},he.src=ue}X.target.value=""}};P.useEffect(()=>{const X=M=>{const oe=M.target;m.current&&!m.current.contains(oe)&&y.current&&!y.current.contains(oe)&&c(!1),C.current&&!C.current.contains(oe)&&E.current&&!E.current.contains(oe)&&b(!1)};return document.addEventListener("mousedown",X),()=>document.removeEventListener("mousedown",X)},[]);const I=()=>{S(!0)},x=()=>{r(Me("pointer")),r(He([])),r(Wr()),S(!1)},D=[{name:"triangle",icon:h.jsx(Da,{style:{transform:"rotate(-30deg)"}})},{name:"diamond",icon:h.jsx(Fa,{})},{name:"star",icon:h.jsx(Wa,{})},{name:"heart",icon:h.jsx(Ma,{})},{name:"hexagon",icon:h.jsx(qa,{})},{name:"octagon",icon:h.jsx(Ga,{})},{name:"arrow",icon:h.jsx($a,{})}],F=X=>{r(Me(X)),c(!1)},j=X=>{a(X),b(!1)};return h.jsxs("div",{className:"wb-toolbar",children:[h.jsx("button",{className:l==="pointer"?"wb-active":"",onClick:()=>r(Me("pointer")),title:n("pointer"),disabled:u,children:h.jsx(Aa,{})}),h.jsx("button",{className:l==="text"?"wb-active":"",onClick:()=>r(Me("text")),title:n("text"),disabled:u,children:h.jsx(Ua,{})}),h.jsx("button",{onClick:()=>{var X;return(X=O.current)==null?void 0:X.click()},title:n("image"),disabled:u,children:h.jsx(Ra,{})}),h.jsx("input",{type:"file",ref:O,style:{display:"none"},accept:"image/*",onChange:k}),h.jsx("button",{className:l==="pencil"?"wb-active":"",onClick:()=>r(Me("pencil")),title:n("pencil"),disabled:u,children:h.jsx(Ia,{})}),h.jsx("button",{className:l==="rectangle"?"wb-active":"",onClick:()=>r(Me("rectangle")),title:n("rectangle"),disabled:u,children:h.jsx(La,{})}),h.jsx("button",{className:l==="circle"?"wb-active":"",onClick:()=>r(Me("circle")),title:n("circle"),disabled:u,children:h.jsx(ja,{})}),h.jsxs("div",{className:"wb-ellipsis-container",children:[h.jsx("button",{ref:y,className:D.some(X=>X.name===l)?"wb-active":"",onClick:()=>c(!p),title:n("moreShapes"),disabled:u,children:h.jsx(Xa,{})}),p&&h.jsxs("div",{className:"wb-shapes-popup",ref:m,children:[h.jsx("div",{className:"wb-shapes-popup-header",children:n("moreShapes")}),h.jsx("div",{className:"wb-shapes-popup-grid",children:D.map(X=>h.jsx("button",{className:l===X.name?"wb-active":"",onClick:()=>F(X.name),title:n(X.name),children:X.icon},X.name))})]})]}),h.jsx("button",{className:l==="eraser"?"wb-active":"",onClick:()=>r(Me("eraser")),title:n("eraser"),disabled:u,children:h.jsx(Ta,{})}),h.jsx("button",{onClick:I,title:n("trash"),disabled:u,children:h.jsx(Ya,{})}),h.jsxs("div",{className:"wb-language-container",children:[h.jsx("button",{ref:E,onClick:()=>b(!v),title:n("language"),children:h.jsx(ka,{})}),v&&h.jsxs("div",{className:"wb-language-popup",ref:C,children:[h.jsx("div",{className:"wb-language-popup-header",children:n("language")}),h.jsxs("div",{className:"wb-language-options",children:[h.jsxs("button",{className:i==="en"?"wb-active":"",onClick:()=>j("en"),children:["πΊπΈ ",n("english")]}),h.jsxs("button",{className:i==="tr"?"wb-active":"",onClick:()=>j("tr"),children:["πΉπ· ",n("turkish")]})]})]})]}),e==="moderator"&&h.jsx("button",{onClick:()=>r(io(!u)),title:u?"Unlock":"Lock",style:{color:u?"red":"inherit"},children:u?h.jsx(Ba,{}):h.jsx(Ha,{})}),s&&h.jsx(Ka,{onConfirm:x,onClose:()=>S(!1)})]})},Za=({shifted:e})=>{const t=vr(),{t:r}=Ut(),n=xe(s=>s.whiteboard.toolbar.selectedTool),i=xe(s=>s.whiteboard.toolProperties),a=xe(s=>s.whiteboard.selectedElementIds||[]),l=xe(s=>s.whiteboard.elements),u=a.length>0?l.find(s=>s.id===a[0]):null,p=(s,S,m)=>{t(na({tool:s,property:S,value:m}))},c=(s,S)=>{if(a.length>0){const m=a.map(y=>({id:y,updates:{[s]:S}}));t(oo(m))}},v=()=>{a.forEach(s=>{t(ca(s))})},b=()=>{[...a].reverse().forEach(s=>{t(la(s))})};if(n==="pointer"&&u&&u.type==="text")return h.jsxs("div",{className:`wb-prop-tools ${e?"wb-shifted":""}`,children:[h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("fontSize")}),h.jsxs("select",{className:"font-size-selector",value:u.fontSize||16,onChange:s=>c("fontSize",parseInt(s.target.value)),children:[h.jsx("option",{value:"12",children:"12 px"}),h.jsx("option",{value:"14",children:"14 px"}),h.jsx("option",{value:"16",children:"16 px"}),h.jsx("option",{value:"18",children:"18 px"}),h.jsx("option",{value:"24",children:"24 px"}),h.jsx("option",{value:"32",children:"32 px"}),h.jsx("option",{value:"48",children:"48 px"}),h.jsx("option",{value:"64",children:"64 px"}),h.jsx("option",{value:"72",children:"72 px"})]})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("fontColor")}),h.jsx("input",{type:"color",value:u.fontColor||"#000000",onChange:s=>c("fontColor",s.target.value)})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("layerOrder")}),h.jsxs("div",{className:"wb-layer-buttons",children:[h.jsx("button",{onClick:v,title:r("bringToFront"),children:h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),h.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"white"})]})}),h.jsx("button",{onClick:b,title:r("sendToBack"),children:h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),h.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"white"})]})})]})]})]});if(n==="pointer"&&u){const s=["rectangle","circle","triangle","diamond","star","heart","hexagon","octagon","arrow"].includes(u.type),S=u.type==="pencil";return h.jsxs("div",{className:`wb-prop-tools ${e?"wb-shifted":""}`,children:[s&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("strokeColor")}),h.jsx("input",{type:"color",value:u.strokeColor,onChange:m=>c("strokeColor",m.target.value)})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("fillColor")}),h.jsx("input",{type:"color",value:u.fillColor,onChange:m=>c("fillColor",m.target.value)})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("strokeWidth")}),h.jsxs("select",{className:"stroke-width-selector",value:u.lineWidth,onChange:m=>c("lineWidth",parseInt(m.target.value)),children:[h.jsx("option",{value:"1",children:"1 px"}),h.jsx("option",{value:"2",children:"2 px"}),h.jsx("option",{value:"4",children:"4 px"}),h.jsx("option",{value:"8",children:"8 px"})]})]})]}),S&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("brushColor")}),h.jsx("input",{type:"color",value:u.strokeColor,onChange:m=>c("strokeColor",m.target.value)})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("brushSize")}),h.jsxs("select",{className:"brush-size-selector",value:u.lineWidth,onChange:m=>c("lineWidth",parseInt(m.target.value)),children:[h.jsx("option",{value:"1",children:"1 px"}),h.jsx("option",{value:"2",children:"2 px"}),h.jsx("option",{value:"4",children:"4 px"}),h.jsx("option",{value:"8",children:"8 px"}),h.jsx("option",{value:"16",children:"16 px"})]})]})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("layerOrder")}),h.jsxs("div",{className:"wb-layer-buttons",children:[h.jsx("button",{onClick:v,title:r("bringToFront"),children:h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),h.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"white"})]})}),h.jsx("button",{onClick:b,title:r("sendToBack"),children:h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),h.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"white"})]})})]})]})]})}return h.jsxs("div",{className:`wb-prop-tools ${e?"wb-shifted":""}`,children:[n==="text"&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("fontSize")}),h.jsxs("select",{className:"font-size-selector",value:i.text.fontSize,onChange:s=>p("text","fontSize",parseInt(s.target.value)),children:[h.jsx("option",{value:"12",children:"12 px"}),h.jsx("option",{value:"14",children:"14 px"}),h.jsx("option",{value:"16",children:"16 px"}),h.jsx("option",{value:"18",children:"18 px"}),h.jsx("option",{value:"24",children:"24 px"}),h.jsx("option",{value:"32",children:"32 px"}),h.jsx("option",{value:"48",children:"48 px"}),h.jsx("option",{value:"64",children:"64 px"}),h.jsx("option",{value:"72",children:"72 px"})]})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("fontColor")}),h.jsx("input",{type:"color",value:i.text.fontColor,onChange:s=>p("text","fontColor",s.target.value)})]})]}),n==="pencil"&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("brushColor")}),h.jsx("input",{type:"color",value:i.pencil.strokeColor,onChange:s=>p("pencil","strokeColor",s.target.value)})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("brushSize")}),h.jsxs("select",{className:"brush-size-selector",value:i.pencil.lineWidth,onChange:s=>p("pencil","lineWidth",parseInt(s.target.value)),children:[h.jsx("option",{value:"1",children:"1 px"}),h.jsx("option",{value:"2",children:"2 px"}),h.jsx("option",{value:"4",children:"4 px"}),h.jsx("option",{value:"8",children:"8 px"}),h.jsx("option",{value:"16",children:"16 px"})]})]})]}),(n==="rectangle"||n==="circle"||n==="triangle"||n==="diamond"||n==="star"||n==="heart"||n==="hexagon"||n==="octagon"||n==="arrow")&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("strokeColor")}),h.jsx("input",{type:"color",value:i[n].strokeColor,onChange:s=>p(n,"strokeColor",s.target.value)})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("fillColor")}),h.jsx("input",{type:"color",value:i[n].fillColor,onChange:s=>p(n,"fillColor",s.target.value)})]}),h.jsxs("div",{className:"wb-prop-tool-item",children:[h.jsx("span",{children:r("strokeWidth")}),h.jsxs("select",{className:"stroke-width-selector",value:i[n].lineWidth,onChange:s=>p(n,"lineWidth",parseInt(s.target.value)),children:[h.jsx("option",{value:"1",children:"1 px"}),h.jsx("option",{value:"2",children:"2 px"}),h.jsx("option",{value:"4",children:"4 px"}),h.jsx("option",{value:"8",children:"8 px"})]})]})]})]})},Qa=({onFitToView:e,onExport:t,onToggleGrid:r})=>{const{t:n}=Ut();return h.jsxs("div",{className:"wb-canvas-tools",children:[h.jsx("button",{onClick:r,title:n("toggleGrid"),children:h.jsx(Oa,{})}),h.jsx("button",{onClick:e,title:n("fitToView"),children:h.jsx(Pa,{})}),h.jsx("button",{onClick:t,title:n("exportAsPng"),children:h.jsx(za,{})})]})},$r=P.forwardRef(({watermark:e,isLocked:t,lockText:r,onLockChange:n,isWatermarkEnabled:i,watermarkText:a,mode:l,initialElements:u,onAfterMount:p,onImageUpload:c},v)=>{var mo;const b=P.useRef(null),s=vr(),S=wn(),m=xe(o=>o.whiteboard.grid),y=xe(o=>o.whiteboard.toolbar.selectedTool),E=xe(o=>o.whiteboard.elements),C=xe(o=>o.whiteboard.viewport),O=xe(o=>o.whiteboard.toolProperties),k=xe(o=>o.whiteboard.selectedElementIds||[]),I=xe(o=>o.whiteboard.lock),x=I.isLocked,[D,F]=P.useState(!1),[j,X]=P.useState({x:0,y:0}),[M,oe]=P.useState({x:0,y:0}),[ue,he]=P.useState([]),[pe,we]=P.useState(!1),[Te,Pe]=P.useState({}),[ke,Ve]=P.useState(!1),[Re,Ne]=P.useState(!1),[$e,Fe]=P.useState(!1),[rt,lt]=P.useState({x:0,y:0}),[Xe,qe]=P.useState({y:0,initialZoom:1}),[Ae,Oe]=P.useState(!1),[Ie,nt]=P.useState({x:0,y:0}),[V,Ee]=P.useState(""),[$,ge]=P.useState(null),je=P.useRef(null),De=P.useRef(null),[xt,tr]=P.useState(!1),[me,Et]=P.useState(null),[Nt,At]=P.useState(null),[It,rr]=P.useState(null),[St,nr]=P.useState(!1),[se,Dt]=P.useState(null),Fr=P.useCallback(o=>{$&&o.trim()&&(je.current&&clearTimeout(je.current),je.current=setTimeout(()=>{$&&o!==De.current&&(De.current=o,s(Zt({id:$,updates:{text:o}})))},150))},[s,$]);P.useEffect(()=>()=>{je.current&&clearTimeout(je.current)},[]),P.useImperativeHandle(v,()=>({canvas:b.current,applyAction:o=>{s({...o,meta:{...o.meta,fromRemote:!0}})},getElems:()=>S.getState().whiteboard.elements,getElements:()=>S.getState().whiteboard.elements,setElems:o=>{s({...Yr(o),meta:{fromRemote:!0}})},setElements:o=>{s({...Yr(o),meta:{fromRemote:!0}})},clearElems:()=>{s({...Wr(),meta:{fromRemote:!0}})},clearElements:()=>{s({...Wr(),meta:{fromRemote:!0}})}})),P.useEffect(()=>{t!==void 0&&s(io(t))},[t,s]),P.useEffect(()=>{n&&n(x)},[x,n]);const ut=xe(o=>o.whiteboard.watermark);P.useEffect(()=>{i!==void 0&&i!==ut.visible&&s(ua(i))},[i,ut.visible,s]),P.useEffect(()=>{a!==void 0&&a!==ut.text&&s(fa(a))},[a,ut.text,s]),P.useEffect(()=>{u&&u.length>0&&s(Yr(u))},[s]),P.useEffect(()=>{p&&setTimeout(()=>{p()},0)},[]);const Ct=P.useCallback((o,f,g)=>{const w=o.canvas,_=w.width,T=w.height,N=Math.floor(-C.panX/C.zoom/f)*f,A=Math.floor(-C.panY/C.zoom/f)*f,z=Math.ceil((_/C.zoom-C.panX/C.zoom)/f)*f,B=Math.ceil((T/C.zoom-C.panY/C.zoom)/f)*f;o.strokeStyle=g,o.lineWidth=.5/C.zoom;for(let Y=N;Y<=z;Y+=f)o.beginPath(),o.moveTo(Y,A),o.lineTo(Y,B),o.stroke();for(let Y=A;Y<=B;Y+=f)o.beginPath(),o.moveTo(N,Y),o.lineTo(z,Y),o.stroke()},[C]),zt=P.useCallback((o,f,g)=>{const w=Math.min(f.x,g.x),_=Math.min(f.y,g.y),T=Math.abs(g.x-f.x),N=Math.abs(g.y-f.y);o.strokeStyle="#0066cc",o.lineWidth=1,o.setLineDash([5,5]),o.strokeRect(w,_,T,N),o.fillStyle="rgba(0, 102, 204, 0.1)",o.fillRect(w,_,T,N),o.setLineDash([])},[]),ze=P.useCallback((o,f)=>{const{x:g=0,y:w=0,width:_=0,height:T=0,fillColor:N="#000",strokeColor:A="#000",lineWidth:z=2}=f;o.fillStyle=N,o.fillRect(g,w,_,T),o.strokeStyle=A,o.lineWidth=z,o.strokeRect(g,w,_,T)},[]),ot=P.useCallback((o,f)=>{const{centerX:g=0,centerY:w=0,radius:_=0,fillColor:T="#000",strokeColor:N="#000",lineWidth:A=2}=f;o.beginPath(),o.arc(g,w,_,0,Math.PI*2),o.fillStyle=T,o.fill(),o.strokeStyle=N,o.lineWidth=A,o.stroke()},[]),it=P.useCallback((o,f)=>{const{points:g=[],strokeColor:w="#000",lineWidth:_=2}=f;if(!(g.length<2)){o.strokeStyle=w,o.lineWidth=_,o.lineCap="round",o.lineJoin="round",o.beginPath(),o.moveTo(g[0].x,g[0].y);for(let T=1;T<g.length;T++)g[T]&&o.lineTo(g[T].x,g[T].y);o.stroke()}},[]),Lt=P.useCallback((o,f)=>{const{x:g=0,y:w=0,text:_="",fontSize:T=16,fontColor:N="#000"}=f;o.font=`${T}px sans-serif`,o.fillStyle=N,o.textBaseline="top",o.fillText(_,g,w)},[]),_t=P.useCallback((o,f)=>{const{x:g=0,y:w=0,width:_=0,height:T=0,fillColor:N="#fff",strokeColor:A="#000",lineWidth:z=2}=f;o.beginPath(),o.moveTo(g+_/2,w),o.lineTo(g+_,w+T),o.lineTo(g,w+T),o.closePath(),o.fillStyle=N,o.fill(),o.strokeStyle=A,o.lineWidth=z,o.stroke()},[]),ft=P.useCallback((o,f)=>{const{x:g=0,y:w=0,width:_=0,height:T=0,fillColor:N="#fff",strokeColor:A="#000",lineWidth:z=2}=f;o.beginPath(),o.moveTo(g+_/2,w),o.lineTo(g+_,w+T/2),o.lineTo(g+_/2,w+T),o.lineTo(g,w+T/2),o.closePath(),o.fillStyle=N,o.fill(),o.strokeStyle=A,o.lineWidth=z,o.stroke()},[]),Ot=P.useCallback((o,f)=>{const{centerX:g=0,centerY:w=0,size:_=0,fillColor:T="#ffff00",strokeColor:N="#000",lineWidth:A=2}=f,z=5,B=_,Y=_/2;o.beginPath();for(let L=0;L<z*2;L++){const H=L%2===0?B:Y,q=Math.PI/z*L-Math.PI/2,K=g+Math.cos(q)*H,ie=w+Math.sin(q)*H;L===0?o.moveTo(K,ie):o.lineTo(K,ie)}o.closePath(),o.fillStyle=T,o.fill(),o.strokeStyle=N,o.lineWidth=A,o.stroke()},[]),dt=P.useCallback((o,f)=>{const{centerX:g=0,centerY:w=0,size:_=0,fillColor:T="#ff6b6b",strokeColor:N="#000",lineWidth:A=2}=f;o.beginPath();const z=w-_/2;o.moveTo(g,z+_/4),o.bezierCurveTo(g-_/2,z,g-_,z+_/2,g,w+_/2),o.bezierCurveTo(g+_,z+_/2,g+_/2,z,g,z+_/4),o.fillStyle=T,o.fill(),o.strokeStyle=N,o.lineWidth=A,o.stroke()},[]),ht=P.useCallback((o,f)=>{const{x:g=0,y:w=0,width:_=0,height:T=0,fillColor:N="#fff",strokeColor:A="#000",lineWidth:z=2}=f,B=g+_/2,Y=w+T/2,L=_/2,H=T/2;o.beginPath();for(let q=0;q<6;q++){const K=Math.PI/3*q-Math.PI/2,ie=B+Math.cos(K)*L,ve=Y+Math.sin(K)*H;q===0?o.moveTo(ie,ve):o.lineTo(ie,ve)}o.closePath(),o.fillStyle=N,o.fill(),o.strokeStyle=A,o.lineWidth=z,o.stroke()},[]),jt=P.useCallback((o,f)=>{const{x:g=0,y:w=0,width:_=0,height:T=0,fillColor:N="#fff",strokeColor:A="#000",lineWidth:z=2}=f,B=g+_/2,Y=w+T/2,L=_/2,H=T/2;o.beginPath();for(let q=0;q<8;q++){const K=Math.PI/4*q-Math.PI/2,ie=B+Math.cos(K)*L,ve=Y+Math.sin(K)*H;q===0?o.moveTo(ie,ve):o.lineTo(ie,ve)}o.closePath(),o.fillStyle=N,o.fill(),o.strokeStyle=A,o.lineWidth=z,o.stroke()},[]),Tt=P.useCallback((o,f)=>{const{startX:g=0,startY:w=0,endX:_=0,endY:T=0,fillColor:N="#000",strokeColor:A="#000",lineWidth:z=2}=f,B=15,Y=Math.atan2(T-w,_-g);o.beginPath(),o.moveTo(g,w),o.lineTo(_,T),o.strokeStyle=A,o.lineWidth=z,o.stroke(),o.beginPath(),o.moveTo(_,T),o.lineTo(_-B*Math.cos(Y-Math.PI/6),T-B*Math.sin(Y-Math.PI/6)),o.lineTo(_-B*Math.cos(Y+Math.PI/6),T-B*Math.sin(Y+Math.PI/6)),o.closePath(),o.fillStyle=N,o.fill()},[]),pt=P.useRef({}),Wt=P.useRef(null),or=P.useCallback((o,f)=>{const{x:g=0,y:w=0,width:_=0,height:T=0,src:N=""}=f;if(pt.current[N]){const A=pt.current[N];A.complete&&o.drawImage(A,g,w,_,T)}else{const A=new Image;A.onload=()=>{pt.current[N]=A,Wt.current&&Wt.current()},A.src=N,pt.current[N]=A}},[]),Pt=P.useCallback((o,f)=>{switch(f.type){case"rectangle":ze(o,f);break;case"circle":ot(o,f);break;case"pencil":it(o,f);break;case"text":Lt(o,f);break;case"triangle":_t(o,f);break;case"diamond":ft(o,f);break;case"star":Ot(o,f);break;case"heart":dt(o,f);break;case"hexagon":ht(o,f);break;case"octagon":jt(o,f);break;case"arrow":Tt(o,f);break;case"image":or(o,f);break}},[ze,ot,it,Lt,_t,ft,Ot,dt,ht,jt,Tt,or]),Xr=P.useCallback(()=>{const o=b.current;if(!o)return;const f=document.createElement("canvas");f.width=o.width,f.height=o.height;const g=f.getContext("2d");if(!g)return;g.fillStyle="#ffffff",g.fillRect(0,0,f.width,f.height),g.save(),g.translate(C.panX,C.panY),g.scale(C.zoom,C.zoom),E.forEach(T=>{Pt(g,T)}),g.restore();const w=f.toDataURL("image/png"),_=document.createElement("a");_.download=`whiteboard-${Date.now()}.png`,_.href=w,_.click()},[C,E,Pt]),d=P.useCallback(()=>{const o=b.current;o&&s(sa({canvasWidth:o.width,canvasHeight:o.height,padding:50}))},[s]),R=P.useCallback(()=>{s(ra())},[s]),W=(o,f,g,w,_,T)=>{const N=o-g,A=f-w,z=_-g,B=T-w,Y=N*z+A*B,L=z*z+B*B;let H=-1;L!==0&&(H=Y/L);let q,K;H<0?(q=g,K=w):H>1?(q=_,K=T):(q=g+H*z,K=w+H*B);const ie=o-q,ve=f-K;return Math.sqrt(ie*ie+ve*ve)},U=P.useCallback((o,f)=>{for(let g=E.length-1;g>=0;g--){const w=E[g],_=w.x??0,T=w.y??0,N=w.width??0,A=w.height??0,z=w.centerX??0,B=w.centerY??0,Y=w.radius??0;if(w.type==="rectangle"){if(o>=_&&o<=_+N&&f>=T&&f<=T+A)return w}else if(w.type==="circle"){if(Math.sqrt(Math.pow(o-z,2)+Math.pow(f-B,2))<=Y)return w}else if(w.type==="pencil"){const H=w.points??[];for(let q=1;q<H.length;q++){const K=H[q-1],ie=H[q];if(!K||!ie)continue;if(W(o,f,K.x,K.y,ie.x,ie.y)<=5)return w}}else if(w.type==="text"){const L=w.fontSize||16,q=(w.text||"").length*L*.6,K=L;if(o>=_&&o<=_+q&&f>=T&&f<=T+K)return w}else if(w.type==="triangle"||w.type==="diamond"||w.type==="hexagon"||w.type==="octagon"){if(o>=_&&o<=_+N&&f>=T&&f<=T+A)return w}else if(w.type==="star"||w.type==="heart"){const L=Math.sqrt(Math.pow(o-z,2)+Math.pow(f-B,2)),H=w.size??0;if(L<=H)return w}else if(w.type==="arrow"){const H=w.startX??0,q=w.startY??0,K=w.endX??0,ie=w.endY??0;if(W(o,f,H,q,K,ie)<=10)return w}else if(w.type==="image"&&o>=_&&o<=_+N&&f>=T&&f<=T+A)return w}return null},[E]),Z=P.useCallback(o=>{let f=0,g=0,w=0,_=0;if(o.type==="rectangle"||o.type==="image"||o.type==="text"||o.type==="triangle"||o.type==="diamond"||o.type==="hexagon"||o.type==="octagon")if(f=o.x??0,g=o.y??0,o.type==="text"){const T=o.fontSize||16;w=(o.text||"").length*T*.6,_=T}else w=o.width??0,_=o.height??0;else if(o.type==="circle"){const T=o.radius??0;f=(o.centerX??0)-T,g=(o.centerY??0)-T,w=T*2,_=T*2}else if(o.type==="star"||o.type==="heart"){const T=o.size??0;f=(o.centerX??0)-T,g=(o.centerY??0)-T,w=T*2,_=T*2}else if(o.type==="pencil"&&o.points&&o.points.length>0){const T=Math.min(...o.points.map(B=>B.x)),N=Math.max(...o.points.map(B=>B.x)),A=Math.min(...o.points.map(B=>B.y)),z=Math.max(...o.points.map(B=>B.y));f=T,g=A,w=N-T,_=z-A}else if(o.type==="arrow")return null;return{x:f,y:g,w,h:_}},[]),Q=P.useCallback(o=>{const f=[];if(o.type==="arrow")return f.push({type:"start",x:o.startX??0,y:o.startY??0}),f.push({type:"end",x:o.endX??0,y:o.endY??0}),f;const g=Z(o);if(!g)return[];const{x:w,y:_,w:T,h:N}=g;return f.push({type:"nw",x:w,y:_}),f.push({type:"ne",x:w+T,y:_}),f.push({type:"se",x:w+T,y:_+N}),f.push({type:"sw",x:w,y:_+N}),f.push({type:"n",x:w+T/2,y:_}),f.push({type:"s",x:w+T/2,y:_+N}),f.push({type:"e",x:w+T,y:_+N/2}),f.push({type:"w",x:w,y:_+N/2}),f},[Z]),J=P.useCallback((o,f,g,w)=>{const _=Q(g),T=10/w;for(const N of _)if(Math.abs(o-N.x)<=T&&Math.abs(f-N.y)<=T)return N.type;return null},[Q]),G=P.useCallback((o,f)=>{o.strokeStyle="#0066cc",o.lineWidth=1/C.zoom,o.setLineDash([5/C.zoom,5/C.zoom]);const g=Z(f);g?o.strokeRect(g.x-4/C.zoom,g.y-4/C.zoom,g.w+8/C.zoom,g.h+8/C.zoom):f.type,o.setLineDash([]);const w=Q(f),_=8/C.zoom;o.fillStyle="#ffffff",o.strokeStyle="#0066cc",o.lineWidth=1/C.zoom;for(const T of w)o.fillRect(T.x-_/2,T.y-_/2,_,_),o.strokeRect(T.x-_/2,T.y-_/2,_,_)},[C.zoom,Z,Q]),ce=P.useCallback(()=>{const o=b.current;if(!o)return;const f=o.getContext("2d");f&&(f.clearRect(0,0,o.width,o.height),f.save(),f.translate(C.panX,C.panY),f.scale(C.zoom,C.zoom),m.enabled&&Ct(f,m.size,m.color),E.forEach(g=>{Pt(f,g),k.includes(g.id)&&G(f,g)}),St&&se&&(f.fillStyle="rgba(0, 102, 204, 0.1)",f.strokeStyle="#0066cc",f.lineWidth=1/C.zoom,f.fillRect(se.startX,se.startY,se.width,se.height),f.strokeRect(se.startX,se.startY,se.width,se.height)),f.restore())},[m,Ct,E,Pt,k,G,C,St,se]);P.useEffect(()=>{Wt.current=ce},[ce]),P.useEffect(()=>{const o=b.current;if(!o)return;const f=o.parentElement;if(!f)return;const g=()=>{const _=f.getBoundingClientRect();o.width=_.width,o.height=_.height,ce()};g();const w=new ResizeObserver(()=>{g()});return w.observe(f),()=>{w.disconnect()}},[ce]),P.useEffect(()=>{ce()},[ce]),P.useEffect(()=>{const o=g=>{g.target.tagName==="INPUT"||g.target.tagName==="TEXTAREA"||g.code==="Space"&&!g.repeat&&(g.preventDefault(),Ve(!0))},f=g=>{g.target.tagName==="INPUT"||g.target.tagName==="TEXTAREA"||g.code==="Space"&&(g.preventDefault(),Ve(!1),Ne(!1),Fe(!1))};return window.addEventListener("keydown",o),window.addEventListener("keyup",f),()=>{window.removeEventListener("keydown",o),window.removeEventListener("keyup",f)}},[]);const ae=P.useCallback((o,f)=>({x:(o-C.panX)/C.zoom,y:(f-C.panY)/C.zoom}),[C]);P.useEffect(()=>{const o=b.current;if(!o||!D)return;const f=o.getContext("2d");if(f){if(ce(),f.save(),f.translate(C.panX,C.panY),f.scale(C.zoom,C.zoom),y==="pointer")zt(f,j,M);else if(y==="rectangle"){const g=Math.min(j.x,M.x),w=Math.min(j.y,M.y),_=Math.abs(M.x-j.x),T=Math.abs(M.y-j.y);ze(f,{id:"preview",type:"rectangle",x:g,y:w,width:_,height:T,fillColor:O.rectangle.fillColor,lineWidth:O.rectangle.lineWidth})}else if(y==="circle"){const g=j.x,w=j.y,_=Math.sqrt(Math.pow(M.x-j.x,2)+Math.pow(M.y-j.y,2));ot(f,{id:"preview",type:"circle",centerX:g,centerY:w,radius:_,strokeColor:O.circle.strokeColor,fillColor:O.circle.fillColor,lineWidth:O.circle.lineWidth})}else if(y==="pencil")it(f,{id:"preview",type:"pencil",points:ue,strokeColor:O.pencil.strokeColor,lineWidth:O.pencil.lineWidth});else if(y==="triangle"){const g=Math.min(j.x,M.x),w=Math.min(j.y,M.y),_=Math.abs(M.x-j.x),T=Math.abs(M.y-j.y);_t(f,{id:"preview",type:"triangle",x:g,y:w,width:_,height:T,fillColor:O.triangle.fillColor,lineWidth:O.triangle.lineWidth})}else if(y==="diamond"){const g=Math.min(j.x,M.x),w=Math.min(j.y,M.y),_=Math.abs(M.x-j.x),T=Math.abs(M.y-j.y);ft(f,{id:"preview",type:"diamond",x:g,y:w,width:_,height:T,fillColor:O.diamond.fillColor,lineWidth:O.diamond.lineWidth})}else if(y==="star"){const g=j.x,w=j.y,_=Math.sqrt(Math.pow(M.x-j.x,2)+Math.pow(M.y-j.y,2));Ot(f,{id:"preview",type:"star",centerX:g,centerY:w,size:_,fillColor:O.star.fillColor,lineWidth:O.star.lineWidth})}else if(y==="heart"){const g=j.x,w=j.y,_=Math.sqrt(Math.pow(M.x-j.x,2)+Math.pow(M.y-j.y,2));dt(f,{id:"preview",type:"heart",centerX:g,centerY:w,size:_,fillColor:O.heart.fillColor,lineWidth:O.heart.lineWidth})}else if(y==="hexagon"){const g=Math.min(j.x,M.x),w=Math.min(j.y,M.y),_=Math.abs(M.x-j.x),T=Math.abs(M.y-j.y);ht(f,{id:"preview",type:"hexagon",x:g,y:w,width:_,height:T,fillColor:O.hexagon.fillColor,lineWidth:O.hexagon.lineWidth})}else if(y==="octagon"){const g=Math.min(j.x,M.x),w=Math.min(j.y,M.y),_=Math.abs(M.x-j.x),T=Math.abs(M.y-j.y);jt(f,{id:"preview",type:"octagon",x:g,y:w,width:_,height:T,fillColor:O.octagon.fillColor,lineWidth:O.octagon.lineWidth})}else y==="arrow"&&Tt(f,{id:"preview",type:"arrow",startX:j.x,startY:j.y,endX:M.x,endY:M.y,fillColor:O.arrow.fillColor,lineWidth:O.arrow.lineWidth});f.restore()}},[D,y,j,M,ue,ce,zt,ze,ot,it,_t,ft,Ot,dt,ht,jt,Tt,C,O]);const de=o=>{const f=b.current;if(!f)return;const g=f.getBoundingClientRect(),w=o.clientX-g.left,_=o.clientY-g.top;if(Ae)return;if(ke){o.preventDefault(),o.button===0?(Ne(!0),lt({x:w-C.panX,y:_-C.panY})):o.button===2&&(Fe(!0),qe({y:_,initialZoom:C.zoom}));return}if(x)return;const{x:T,y:N}=ae(w,_);if(y==="pointer"){const A=U(T,N);let z=null;if(k.length===1){const B=k[0],Y=E.find(L=>L.id===B);if(Y){const L=J(T,N,Y,C.zoom);L&&(z={element:Y,handle:L})}}if(z){tr(!0),Et(z.handle),At({x:T,y:N}),rr(JSON.parse(JSON.stringify(z.element)));return}if(A){const B=k.includes(A.id);let Y=k;if(o.shiftKey?(B?Y=k.filter(L=>L!==A.id):Y=[...k,A.id],s(He(Y))):B||(Y=[A.id],s(He(Y))),Y.length>0){we(!0),X({x:T,y:N});const L={};Y.forEach(H=>{const q=E.find(K=>K.id===H);q&&(L[H]={...q})}),Pe(L)}}else{o.shiftKey||s(He([])),nr(!0);const{x:B,y:Y}=ae(w,_);Dt({startX:B,startY:Y,width:0,height:0})}}else if(y==="text"){const A=Date.now().toString();s(Se({id:A,type:"text",x:T,y:N,text:"Text",fontSize:O.text.fontSize,fontColor:O.text.fontColor})),s(Me("pointer")),s(He([A])),ge(A),Ee("Text"),nt({x:T,y:N}),Oe(!0)}else if(y==="eraser"){const A=U(T,N);A&&s(oa(A.id))}else s(He([])),F(!0),X({x:T,y:N}),oe({x:T,y:N}),y==="pencil"&&he([{x:T,y:N}])},Le=o=>{const f=b.current;if(!f)return;const g=f.getBoundingClientRect(),w=o.clientX-g.left,_=o.clientY-g.top;if(Re){s(ia({x:w-rt.x,y:_-rt.y}));return}if($e){const A=Xe.y-_,B=Xe.initialZoom*(1+A*.005);s(aa(B));return}if(x)return;const{x:T,y:N}=ae(w,_);if(St&&se){const A=T-se.startX,z=N-se.startY;Dt({...se,width:A,height:z});return}if(pe&&k.length>0){const A=T-j.x,z=N-j.y,B=[];k.forEach(Y=>{const L=Te[Y];if(!L)return;let H={};if(L.type==="rectangle")H={x:(L.x??0)+A,y:(L.y??0)+z};else if(L.type==="circle")H={centerX:(L.centerX??0)+A,centerY:(L.centerY??0)+z};else if(L.type==="pencil"){const q=L.points||[];if(q.length===0)return;H={points:q.map(K=>({x:K.x+A,y:K.y+z}))}}else L.type==="text"?H={x:(L.x??0)+A,y:(L.y??0)+z}:L.type==="triangle"||L.type==="diamond"||L.type==="hexagon"||L.type==="octagon"?H={x:(L.x??0)+A,y:(L.y??0)+z}:L.type==="star"||L.type==="heart"?H={centerX:(L.centerX??0)+A,centerY:(L.centerY??0)+z}:L.type==="arrow"?H={startX:(L.startX??0)+A,startY:(L.startY??0)+z,endX:(L.endX??0)+A,endY:(L.endY??0)+z}:L.type==="image"&&(H={x:(L.x??0)+A,y:(L.y??0)+z});B.push({id:Y,updates:H})}),B.length>0&&s(oo(B));return}if(xt&&It&&Nt&&me){let A={};const z=T-Nt.x,B=N-Nt.y,Y=It;if(Y.type==="arrow")me==="start"?A={startX:(Y.startX??0)+z,startY:(Y.startY??0)+B}:me==="end"&&(A={endX:(Y.endX??0)+z,endY:(Y.endY??0)+B});else if(Y.type==="circle"||Y.type==="star"||Y.type==="heart"){const L=Y.radius||Y.size||0,H=me.includes("e"),q=me.includes("s"),K=me.includes("w"),ie=me.includes("n");let ve=0;H&&(ve+=z),K&&(ve-=z),q&&(ve+=B),ie&&(ve-=B);const Yt=Math.max(5,L+ve);Y.type==="circle"?A={radius:Yt}:A={size:Yt}}else if(Y.type==="pencil"&&Y.points){const L=Z(Y);if(L){const{x:H,y:q,w:K,h:ie}=L;let ve=H,Yt=q,Br=K,Ur=ie;me.includes("e")&&(Br=Math.max(5,K+z)),me.includes("w")&&(Br=Math.max(5,K-z),ve=H+z),me.includes("s")&&(Ur=Math.max(5,ie+B)),me.includes("n")&&(Ur=Math.max(5,ie-B),Yt=q+B);const os=Br/K,is=Ur/ie;A={points:Y.points.map(go=>({x:ve+(go.x-H)*os,y:Yt+(go.y-q)*is}))}}}else{let L=Y.x??0,H=Y.y??0,q=Y.width??0,K=Y.height??0;if(me.includes("e")&&(q=Math.max(5,(Y.width??0)+z)),me.includes("w")){const ie=(Y.width??0)-z;ie>5&&(q=ie,L=(Y.x??0)+z)}if(me.includes("s")&&(K=Math.max(5,(Y.height??0)+B)),me.includes("n")){const ie=(Y.height??0)-B;ie>5&&(K=ie,H=(Y.y??0)+B)}A={x:L,y:H,width:q,height:K}}Object.keys(A).length>0&&s(Zt({id:Y.id,updates:A}));return}D&&(oe({x:T,y:N}),y==="pencil"&&he(A=>[...A,{x:T,y:N}]))},Ge=()=>{if(Re||$e){Ne(!1),Fe(!1);return}if(x){we(!1),F(!1);return}if(pe&&we(!1),St&&se){const o=se.width>0?se.startX:se.startX+se.width,f=se.height>0?se.startY:se.startY+se.height,g=Math.abs(se.width),w=Math.abs(se.height),_=[];E.forEach(T=>{const N=Z(T);N&&N.x<o+g&&N.x+N.w>o&&N.y<f+w&&N.y+N.h>f&&_.push(T.id)}),_.length>0&&s(He(_))}if(F(!1),we(!1),tr(!1),nr(!1),Dt(null),Et(null),rr(null),he([]),X({x:0,y:0}),Pe({}),At(null),Ne(!1),!!D){if(y==="pointer")ce();else if(y==="rectangle"){const o=Math.min(j.x,M.x),f=Math.min(j.y,M.y),g=Math.abs(M.x-j.x),w=Math.abs(M.y-j.y);g>0&&w>0&&s(Se({id:Date.now().toString(),type:"rectangle",x:o,y:f,width:g,height:w,strokeColor:O.rectangle.strokeColor,fillColor:O.rectangle.fillColor,lineWidth:O.rectangle.lineWidth}))}else if(y==="circle"){const o=j.x,f=j.y,g=Math.sqrt(Math.pow(M.x-j.x,2)+Math.pow(M.y-j.y,2));g>0&&s(Se({id:Date.now().toString(),type:"circle",centerX:o,centerY:f,radius:g,strokeColor:O.circle.strokeColor,fillColor:O.circle.fillColor,lineWidth:O.circle.lineWidth}))}else if(y==="pencil")ue.length>1&&s(Se({id:Date.now().toString(),type:"pencil",points:[...ue],strokeColor:O.pencil.strokeColor,lineWidth:O.pencil.lineWidth})),he([]);else if(y==="triangle"){const o=Math.min(j.x,M.x),f=Math.min(j.y,M.y),g=Math.abs(M.x-j.x),w=Math.abs(M.y-j.y);g>0&&w>0&&s(Se({id:Date.now().toString(),type:"triangle",x:o,y:f,width:g,height:w,strokeColor:O.triangle.strokeColor,fillColor:O.triangle.fillColor,lineWidth:O.triangle.lineWidth}))}else if(y==="diamond"){const o=Math.min(j.x,M.x),f=Math.min(j.y,M.y),g=Math.abs(M.x-j.x),w=Math.abs(M.y-j.y);g>0&&w>0&&s(Se({id:Date.now().toString(),type:"diamond",x:o,y:f,width:g,height:w,strokeColor:O.diamond.strokeColor,fillColor:O.diamond.fillColor,lineWidth:O.diamond.lineWidth}))}else if(y==="star"){const o=j.x,f=j.y,g=Math.sqrt(Math.pow(M.x-j.x,2)+Math.pow(M.y-j.y,2));g>0&&s(Se({id:Date.now().toString(),type:"star",centerX:o,centerY:f,size:g,strokeColor:O.star.strokeColor,fillColor:O.star.fillColor,lineWidth:O.star.lineWidth}))}else if(y==="heart"){const o=j.x,f=j.y,g=Math.sqrt(Math.pow(M.x-j.x,2)+Math.pow(M.y-j.y,2));g>0&&s(Se({id:Date.now().toString(),type:"heart",centerX:o,centerY:f,size:g,strokeColor:O.heart.strokeColor,fillColor:O.heart.fillColor,lineWidth:O.heart.lineWidth}))}else if(y==="hexagon"){const o=Math.min(j.x,M.x),f=Math.min(j.y,M.y),g=Math.abs(M.x-j.x),w=Math.abs(M.y-j.y);g>0&&w>0&&s(Se({id:Date.now().toString(),type:"hexagon",x:o,y:f,width:g,height:w,strokeColor:O.hexagon.strokeColor,fillColor:O.hexagon.fillColor,lineWidth:O.hexagon.lineWidth}))}else if(y==="octagon"){const o=Math.min(j.x,M.x),f=Math.min(j.y,M.y),g=Math.abs(M.x-j.x),w=Math.abs(M.y-j.y);g>0&&w>0&&s(Se({id:Date.now().toString(),type:"octagon",x:o,y:f,width:g,height:w,strokeColor:O.octagon.strokeColor,fillColor:O.octagon.fillColor,lineWidth:O.octagon.lineWidth}))}else if(y==="arrow"){const o=M.x-j.x,f=M.y-j.y;Math.sqrt(o*o+f*f)>5&&s(Se({id:Date.now().toString(),type:"arrow",startX:j.x,startY:j.y,endX:M.x,endY:M.y,strokeColor:O.arrow.strokeColor,fillColor:O.arrow.fillColor,lineWidth:O.arrow.lineWidth}))}F(!1)}},ir=o=>{ke&&o.preventDefault()},We=(o,f,g)=>{ge(o.id),Ee(o.text||""),nt({x:o.x||f,y:o.y||g}),De.current=o.text||"",Oe(!0)},ts=()=>{if(ke)return Re?"grabbing":$e?"ns-resize":"grab";if(x)return"default";if(k.length===1&&!D&&y==="pointer"){const o=E.find(f=>f.id===k[0]);if(o){const f=J(M.x,M.y,o,C.zoom);if(f)return f==="n"||f==="s"?"ns-resize":f==="e"||f==="w"?"ew-resize":f==="ne"||f==="sw"?"nesw-resize":f==="nw"||f==="se"?"nwse-resize":"pointer"}}return"default"},[po,vo]=P.useState({propTools:!1,lockIndicator:!1});P.useEffect(()=>{const o=()=>{if(window.innerWidth<=768){vo({propTools:!1,lockIndicator:!1});return}const f=document.getElementById("wb-canvas-container");if(!f)return;const g=f.querySelector(".wb-toolbar"),w=f.querySelector(".wb-prop-tools"),_=f.querySelector(".wb-lock-indicator");let T=!1,N=!1;if(g){const A=g.getBoundingClientRect();if(w){const z=w.getBoundingClientRect();A.bottom>z.top-10&&(T=!0)}if(_){const z=_.getBoundingClientRect();A.top<z.bottom+10&&(N=!0)}}vo({propTools:T,lockIndicator:N})};return o(),window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}},[y,x,k]);const yo=async(o,f,g)=>{try{let w="";c?w=await c(o):w=URL.createObjectURL(o);const _=new Image;_.onload=()=>{const T=_.width/_.height,N=200,A=N/T;s(Se({id:Date.now().toString(),type:"image",x:f-N/2,y:g-A/2,width:N,height:A,src:w}))},_.src=w}catch(w){console.error("Failed to upload image:",w)}};P.useEffect(()=>{const o=f=>{if(!(f.target.tagName==="INPUT"||f.target.tagName==="TEXTAREA")&&!x&&f.clipboardData&&f.clipboardData.files.length>0){const g=f.clipboardData.files[0];if(g.type.startsWith("image/")){f.preventDefault();const w=b.current;if(w){const _=w.getBoundingClientRect(),T=_.width/2,N=_.height/2,{x:A,y:z}=ae(T,N);yo(g,A,z)}}}};return window.addEventListener("paste",o),()=>window.removeEventListener("paste",o)},[x,ae,c,s]);const rs=o=>{o.preventDefault()},ns=o=>{if(o.preventDefault(),!x&&o.dataTransfer.files&&o.dataTransfer.files.length>0){const f=o.dataTransfer.files[0];if(f.type.startsWith("image/")){const g=b.current;if(g){const w=g.getBoundingClientRect(),_=o.clientX-w.left,T=o.clientY-w.top,{x:N,y:A}=ae(_,T);yo(f,N,A)}}}};return h.jsxs("div",{id:"wb-canvas-container",style:{backgroundColor:"#fff",position:"relative",width:"100%",height:"100%"},onDragOver:rs,onDrop:ns,children:[h.jsx("canvas",{ref:b,onMouseDown:de,onMouseMove:Le,onMouseUp:Ge,onMouseLeave:Ge,onDoubleClick:o=>{if(x)return;const f=b.current;if(!f)return;const g=f.getBoundingClientRect(),w=o.clientX-g.left,_=o.clientY-g.top,{x:T,y:N}=ae(w,_),A=U(T,N);A&&A.type==="text"&&We(A,T,N)},onContextMenu:ir,style:{cursor:ts()}}),x&&h.jsx(Va,{text:r||e&&((mo=e.lock)==null?void 0:mo.text)||I.text,shifted:po.lockIndicator}),Ae&&h.jsx("input",{type:"text",value:V,onChange:o=>{const f=o.target.value;Ee(f),Fr(f)},onKeyDown:o=>{o.key==="Enter"&&V.trim()?($&&(s(Zt({id:$,updates:{text:V}})),De.current=V),Oe(!1),Ee(""),ge(null)):o.key==="Escape"&&(Oe(!1),Ee(""),ge(null))},onBlur:()=>{V.trim()&&$&&(s(Zt({id:$,updates:{text:V}})),De.current=V),Oe(!1),Ee(""),ge(null)},onMouseDown:o=>o.stopPropagation(),autoFocus:!0,style:{position:"absolute",left:Ie.x*C.zoom+C.panX,top:Ie.y*C.zoom+C.panY,fontSize:O.text.fontSize*C.zoom,color:O.text.fontColor,background:"white",border:"2px solid #0066cc",outline:"none",fontFamily:"sans-serif",minWidth:"150px",padding:"4px 8px",zIndex:1e3,boxShadow:"0 2px 8px rgba(0,0,0,0.2)"}}),h.jsx(Qa,{onFitToView:d,onExport:Xr,onToggleGrid:R}),h.jsx(Ja,{mode:l,onImageUpload:c}),h.jsx(Za,{shifted:po.propTools}),ut.visible&&h.jsx(ga,{})]})});$r.displayName="InternalWhiteboard";class es extends P.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,r){console.error("Whiteboard Error:",t,r)}render(){return this.state.hasError?h.jsxs("div",{style:{padding:"20px",textAlign:"center",background:"#fff1f0",border:"1px solid #ffa39e",borderRadius:"4px",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[h.jsx("h3",{children:"Something went wrong in Whiteboard"}),h.jsx("button",{onClick:()=>this.setState({hasError:!1}),style:{marginTop:"10px",padding:"8px 16px",cursor:"pointer",background:"#fff",border:"1px solid #d9d9d9",borderRadius:"2px"},children:"Try Again"})]}):this.props.children}}const ho=P.forwardRef((e,t)=>{const{store:r,onAction:n,...i}=e,a=P.useRef(n);P.useEffect(()=>{a.current=n},[n]);const l=P.useMemo(()=>r??Vr({actionHandlerRef:a}),[r]);return h.jsx(es,{children:h.jsx(Uo,{store:l,children:h.jsx(Jo,{children:h.jsx($r,{ref:t,...i})})})})});ho.displayName="Whiteboard",Ce.WhiteboardComponent=$r,Ce.createWhiteboardStore=Vr,Ce.default=ho,Ce.store=ma,Ce.whiteboardActions=da,Ce.whiteboardReducer=ao,Object.defineProperties(Ce,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
100
100
|
//# sourceMappingURL=whiteboard.umd.js.map
|