@ninesstudios/whiteboard 0.0.3 β 0.0.4
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 +2330 -2327
- package/dist/whiteboard.umd.js +26 -26
- package/package.json +2 -2
package/dist/whiteboard.umd.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(me,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],k):(me=typeof globalThis<"u"?globalThis:me||self,k(me.Whiteboard={},me.React,me.ReactDOM))})(this,(function(me,k,Vn){"use strict";function $n(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 je=$n(k);var wt={exports:{}},Qe={};/*
|
|
2
2
|
object-assign
|
|
3
3
|
(c) Sindre Sorhus
|
|
4
4
|
@license MIT
|
|
5
|
-
*/var Yt,xr;function Er(){if(xr)return Yt;xr=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function n(
|
|
5
|
+
*/var Yt,xr;function Er(){if(xr)return Yt;xr=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 o(){try{if(!Object.assign)return!1;var a=new String("abc");if(a[5]="de",Object.getOwnPropertyNames(a)[0]==="5")return!1;for(var u={},h=0;h<10;h++)u["_"+String.fromCharCode(h)]=h;var p=Object.getOwnPropertyNames(u).map(function(f){return u[f]});if(p.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(f){l[f]=f}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Yt=o()?Object.assign:function(a,u){for(var h,p=n(a),l,f=1;f<arguments.length;f++){h=Object(arguments[f]);for(var g in h)t.call(h,g)&&(p[g]=h[g]);if(e){l=e(h);for(var m=0;m<l.length;m++)r.call(h,l[m])&&(p[l[m]]=h[l[m]])}}return p},Yt}/** @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 Sr;function Fn(){if(Sr)return
|
|
12
|
+
*/var Sr;function Fn(){if(Sr)return Qe;Sr=1,Er();var e=k,t=60103;if(Qe.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var r=Symbol.for;t=r("react.element"),Qe.Fragment=r("react.fragment")}var n=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o=Object.prototype.hasOwnProperty,a={key:!0,ref:!0,__self:!0,__source:!0};function u(h,p,l){var f,g={},m=null,x=null;l!==void 0&&(m=""+l),p.key!==void 0&&(m=""+p.key),p.ref!==void 0&&(x=p.ref);for(f in p)o.call(p,f)&&!a.hasOwnProperty(f)&&(g[f]=p[f]);if(h&&h.defaultProps)for(f in p=h.defaultProps,p)g[f]===void 0&&(g[f]=p[f]);return{$$typeof:t,type:h,key:m,ref:x,props:g,_owner:n.current}}return Qe.jsx=u,Qe.jsxs=u,Qe}var Vt={};/** @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 Cr;function Xn(){return Cr||(Cr=1,(function(e){process.env.NODE_ENV!=="production"&&(function(){var t=
|
|
20
|
-
`+
|
|
21
|
-
`),
|
|
22
|
-
`),
|
|
23
|
-
`+
|
|
19
|
+
*/var Cr;function Xn(){return Cr||(Cr=1,(function(e){process.env.NODE_ENV!=="production"&&(function(){var t=k,r=Er(),n=60103,o=60106;e.Fragment=60107;var a=60108,u=60114,h=60109,p=60110,l=60112,f=60113,g=60120,m=60115,x=60116,y=60121,d=60122,S=60117,M=60129,R=60131;if(typeof Symbol=="function"&&Symbol.for){var T=Symbol.for;n=T("react.element"),o=T("react.portal"),e.Fragment=T("react.fragment"),a=T("react.strict_mode"),u=T("react.profiler"),h=T("react.provider"),p=T("react.context"),l=T("react.forward_ref"),f=T("react.suspense"),g=T("react.suspense_list"),m=T("react.memo"),x=T("react.lazy"),y=T("react.block"),d=T("react.server.block"),S=T("react.fundamental"),T("react.scope"),T("react.opaque.id"),M=T("react.debug_trace_mode"),T("react.offscreen"),R=T("react.legacy_hidden")}var A=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function N(i){if(i===null||typeof i!="object")return null;var v=A&&i[A]||i[c];return typeof v=="function"?v:null}var O=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function V(i){{for(var v=arguments.length,_=new Array(v>1?v-1:0),D=1;D<v;D++)_[D-1]=arguments[D];ee("error",i,_)}}function ee(i,v,_){{var D=O.ReactDebugCurrentFrame,L=D.getStackAddendum();L!==""&&(v+="%s",_=_.concat([L]));var $=_.map(function(Y){return""+Y});$.unshift("Warning: "+v),Function.prototype.apply.call(console[i],console,$)}}var K=!1;function J(i){return!!(typeof i=="string"||typeof i=="function"||i===e.Fragment||i===u||i===M||i===a||i===f||i===g||i===R||K||typeof i=="object"&&i!==null&&(i.$$typeof===x||i.$$typeof===m||i.$$typeof===h||i.$$typeof===p||i.$$typeof===l||i.$$typeof===S||i.$$typeof===y||i[0]===d))}function ae(i,v,_){var D=v.displayName||v.name||"";return i.displayName||(D!==""?_+"("+D+")":_)}function Z(i){return i.displayName||"Context"}function re(i){if(i==null)return null;if(typeof i.tag=="number"&&V("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case e.Fragment:return"Fragment";case o:return"Portal";case u:return"Profiler";case a:return"StrictMode";case f:return"Suspense";case g:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case p:var v=i;return Z(v)+".Consumer";case h:var _=i;return Z(_._context)+".Provider";case l:return ae(i,i.render,"ForwardRef");case m:return re(i.type);case y:return re(i._render);case x:{var D=i,L=D._payload,$=D._init;try{return re($(L))}catch{return null}}}return null}var fe=0,Me,Ee,ve,be,we,ke,Fe;function Re(){}Re.__reactDisabledLog=!0;function Ge(){{if(fe===0){Me=console.log,Ee=console.info,ve=console.warn,be=console.error,we=console.group,ke=console.groupCollapsed,Fe=console.groupEnd;var i={configurable:!0,enumerable:!0,value:Re,writable:!0};Object.defineProperties(console,{info:i,log:i,warn:i,error:i,group:i,groupCollapsed:i,groupEnd:i})}fe++}}function Xe(){{if(fe--,fe===0){var i={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:r({},i,{value:Me}),info:r({},i,{value:Ee}),warn:r({},i,{value:ve}),error:r({},i,{value:be}),group:r({},i,{value:we}),groupCollapsed:r({},i,{value:ke}),groupEnd:r({},i,{value:Fe})})}fe<0&&V("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ye=O.ReactCurrentDispatcher,Se;function Ce(i,v,_){{if(Se===void 0)try{throw Error()}catch(L){var D=L.stack.trim().match(/\n( *(at )?)/);Se=D&&D[1]||""}return`
|
|
20
|
+
`+Se+i}}var de=!1,se;{var _e=typeof WeakMap=="function"?WeakMap:Map;se=new _e}function I(i,v){if(!i||de)return"";{var _=se.get(i);if(_!==void 0)return _}var D;de=!0;var L=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var $;$=ye.current,ye.current=null,Ge();try{if(v){var Y=function(){throw Error()};if(Object.defineProperty(Y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Y,[])}catch(Ie){D=Ie}Reflect.construct(i,[],Y)}else{try{Y.call()}catch(Ie){D=Ie}i.call(Y.prototype)}}else{try{throw Error()}catch(Ie){D=Ie}i()}}catch(Ie){if(Ie&&D&&typeof Ie.stack=="string"){for(var W=Ie.stack.split(`
|
|
21
|
+
`),H=D.stack.split(`
|
|
22
|
+
`),F=W.length-1,G=H.length-1;F>=1&&G>=0&&W[F]!==H[G];)G--;for(;F>=1&&G>=0;F--,G--)if(W[F]!==H[G]){if(F!==1||G!==1)do if(F--,G--,G<0||W[F]!==H[G]){var De=`
|
|
23
|
+
`+W[F].replace(" at new "," at ");return typeof i=="function"&&se.set(i,De),De}while(F>=1&&G>=0);break}}}finally{de=!1,ye.current=$,Xe(),Error.prepareStackTrace=L}var ht=i?i.displayName||i.name:"",Yn=ht?Ce(ht):"";return typeof i=="function"&&se.set(i,Yn),Yn}function ce(i,v,_){return I(i,!1)}function z(i){var v=i.prototype;return!!(v&&v.isReactComponent)}function le(i,v,_){if(i==null)return"";if(typeof i=="function")return I(i,z(i));if(typeof i=="string")return Ce(i);switch(i){case f:return Ce("Suspense");case g:return Ce("SuspenseList")}if(typeof i=="object")switch(i.$$typeof){case l:return ce(i.render);case m:return le(i.type,v,_);case y:return ce(i._render);case x:{var D=i,L=D._payload,$=D._init;try{return le($(L),v,_)}catch{}}}return""}var ge={},Oe=O.ReactDebugCurrentFrame;function Ne(i){if(i){var v=i._owner,_=le(i.type,i._source,v?v.type:null);Oe.setExtraStackFrame(_)}else Oe.setExtraStackFrame(null)}function Nt(i,v,_,D,L){{var $=Function.call.bind(Object.prototype.hasOwnProperty);for(var Y in i)if($(i,Y)){var W=void 0;try{if(typeof i[Y]!="function"){var H=Error((D||"React class")+": "+_+" type `"+Y+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[Y]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw H.name="Invariant Violation",H}W=i[Y](v,Y,D,_,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(F){W=F}W&&!(W instanceof Error)&&(Ne(L),V("%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).",D||"React class",_,Y,typeof W),Ne(null)),W instanceof Error&&!(W.message in ge)&&(ge[W.message]=!0,Ne(L),V("Failed %s type: %s",_,W.message),Ne(null))}}}var Ke=O.ReactCurrentOwner,Be=Object.prototype.hasOwnProperty,it={key:!0,ref:!0,__self:!0,__source:!0},Je,Ze;function at(i){if(Be.call(i,"ref")){var v=Object.getOwnPropertyDescriptor(i,"ref").get;if(v&&v.isReactWarning)return!1}return i.ref!==void 0}function st(i){if(Be.call(i,"key")){var v=Object.getOwnPropertyDescriptor(i,"key").get;if(v&&v.isReactWarning)return!1}return i.key!==void 0}function ct(i,v){typeof i.ref=="string"&&Ke.current}function mt(i,v){{var _=function(){Je||(Je=!0,V("%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)",v))};_.isReactWarning=!0,Object.defineProperty(i,"key",{get:_,configurable:!0})}}function At(i,v){{var _=function(){Ze||(Ze=!0,V("%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)",v))};_.isReactWarning=!0,Object.defineProperty(i,"ref",{get:_,configurable:!0})}}var lt=function(i,v,_,D,L,$,Y){var W={$$typeof:n,type:i,key:v,ref:_,props:Y,_owner:$};return W._store={},Object.defineProperty(W._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(W,"_self",{configurable:!1,enumerable:!1,writable:!1,value:D}),Object.defineProperty(W,"_source",{configurable:!1,enumerable:!1,writable:!1,value:L}),Object.freeze&&(Object.freeze(W.props),Object.freeze(W)),W};function br(i,v,_,D,L){{var $,Y={},W=null,H=null;_!==void 0&&(W=""+_),st(v)&&(W=""+v.key),at(v)&&(H=v.ref,ct(v,L));for($ in v)Be.call(v,$)&&!it.hasOwnProperty($)&&(Y[$]=v[$]);if(i&&i.defaultProps){var F=i.defaultProps;for($ in F)Y[$]===void 0&&(Y[$]=F[$])}if(W||H){var G=typeof i=="function"?i.displayName||i.name||"Unknown":i;W&&mt(Y,G),H&&At(Y,G)}return lt(i,W,H,L,D,Ke.current,Y)}}var bt=O.ReactCurrentOwner,ut=O.ReactDebugCurrentFrame;function Ae(i){if(i){var v=i._owner,_=le(i.type,i._source,v?v.type:null);ut.setExtraStackFrame(_)}else ut.setExtraStackFrame(null)}var ft;ft=!1;function he(i){return typeof i=="object"&&i!==null&&i.$$typeof===n}function dt(){{if(bt.current){var i=re(bt.current.type);if(i)return`
|
|
24
24
|
|
|
25
|
-
Check the render method of \``+
|
|
25
|
+
Check the render method of \``+i+"`."}return""}}function wr(i){return""}var Dt={};function It(i){{var v=dt();if(!v){var _=typeof i=="string"?i:i.displayName||i.name;_&&(v=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+
|
|
27
|
+
Check the top-level render call using <`+_+">.")}return v}}function zt(i,v){{if(!i._store||i._store.validated||i.key!=null)return;i._store.validated=!0;var _=It(v);if(Dt[_])return;Dt[_]=!0;var D="";i&&i._owner&&i._owner!==bt.current&&(D=" It was passed a child from "+re(i._owner.type)+"."),Ae(i),V('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',_,D),Ae(null)}}function Wt(i,v){{if(typeof i!="object")return;if(Array.isArray(i))for(var _=0;_<i.length;_++){var D=i[_];he(D)&&zt(D,v)}else if(he(i))i._store&&(i._store.validated=!0);else if(i){var L=N(i);if(typeof L=="function"&&L!==i.entries)for(var $=L.call(i),Y;!(Y=$.next()).done;)he(Y.value)&&zt(Y.value,v)}}}function Lt(i){{var v=i.type;if(v==null||typeof v=="string")return;var _;if(typeof v=="function")_=v.propTypes;else if(typeof v=="object"&&(v.$$typeof===l||v.$$typeof===m))_=v.propTypes;else return;if(_){var D=re(v);Nt(_,i.props,"prop",D,i)}else if(v.PropTypes!==void 0&&!ft){ft=!0;var L=re(v);V("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",L||"Unknown")}typeof v.getDefaultProps=="function"&&!v.getDefaultProps.isReactClassApproved&&V("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function s(i){{for(var v=Object.keys(i.props),_=0;_<v.length;_++){var D=v[_];if(D!=="children"&&D!=="key"){Ae(i),V("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",D),Ae(null);break}}i.ref!==null&&(Ae(i),V("Invalid attribute `ref` supplied to `React.Fragment`."),Ae(null))}}function b(i,v,_,D,L,$){{var Y=J(i);if(!Y){var W="";(i===void 0||typeof i=="object"&&i!==null&&Object.keys(i).length===0)&&(W+=" 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 H=wr();H?W+=H:W+=dt();var F;i===null?F="null":Array.isArray(i)?F="array":i!==void 0&&i.$$typeof===n?(F="<"+(re(i.type)||"Unknown")+" />",W=" Did you accidentally export a JSX literal instead of a component?"):F=typeof i,V("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",F,W)}var G=br(i,v,_,L,$);if(G==null)return G;if(Y){var De=v.children;if(De!==void 0)if(D)if(Array.isArray(De)){for(var ht=0;ht<De.length;ht++)Wt(De[ht],i);Object.freeze&&Object.freeze(De)}else V("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 Wt(De,i)}return i===e.Fragment?s(G):Lt(G),G}}function C(i,v,_){return b(i,v,_,!0)}function E(i,v,_){return b(i,v,_,!1)}var j=E,P=C;e.jsx=j,e.jsxs=P})()})(Vt)),Vt}var _r;function Bn(){return _r||(_r=1,process.env.NODE_ENV==="production"?wt.exports=Fn():wt.exports=Xn()),wt.exports}var w=Bn(),xt={exports:{}},$t={};/**
|
|
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 <`+R+">.")}return O}}function Et(s,O){{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 Or;function Un(){if(Or)return $t;Or=1;var e=
|
|
35
|
+
*/var Or;function Un(){if(Or)return $t;Or=1;var e=k;function t(g,m){return g===m&&(g!==0||1/g===1/m)||g!==g&&m!==m}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,o=e.useEffect,a=e.useLayoutEffect,u=e.useDebugValue;function h(g,m){var x=m(),y=n({inst:{value:x,getSnapshot:m}}),d=y[0].inst,S=y[1];return a(function(){d.value=x,d.getSnapshot=m,p(d)&&S({inst:d})},[g,x,m]),o(function(){return p(d)&&S({inst:d}),g(function(){p(d)&&S({inst:d})})},[g]),u(x),x}function p(g){var m=g.getSnapshot;g=g.value;try{var x=m();return!r(g,x)}catch{return!0}}function l(g,m){return m()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:h;return $t.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,$t}var Ft={};/**
|
|
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 <`+R+">.")}return O}}function Et(s,O){{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 jr;function qn(){return jr||(jr=1,process.env.NODE_ENV!=="production"&&(function(){function e(
|
|
43
|
+
*/var jr;function qn(){return jr||(jr=1,process.env.NODE_ENV!=="production"&&(function(){function e(x,y){return x===y&&(x!==0||1/x===1/y)||x!==x&&y!==y}function t(x,y){f||o.startTransition===void 0||(f=!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 d=y();if(!g){var S=y();a(d,S)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),g=!0)}S=u({inst:{value:d,getSnapshot:y}});var M=S[0].inst,R=S[1];return p(function(){M.value=d,M.getSnapshot=y,r(M)&&R({inst:M})},[x,d,y]),h(function(){return r(M)&&R({inst:M}),x(function(){r(M)&&R({inst:M})})},[x]),l(d),d}function r(x){var y=x.getSnapshot;x=x.value;try{var d=y();return!a(x,d)}catch{return!0}}function n(x,y){return y()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=k,a=typeof Object.is=="function"?Object.is:e,u=o.useState,h=o.useEffect,p=o.useLayoutEffect,l=o.useDebugValue,f=!1,g=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;Ft.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ft}var Pr;function Xt(){return Pr||(Pr=1,process.env.NODE_ENV==="production"?xt.exports=Un():xt.exports=qn()),xt.exports}Xt();var Et={exports:{}},Bt={};/**
|
|
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 <`+R+">.")}return O}}function Et(s,O){{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 Tr;function Hn(){if(Tr)return Bt;Tr=1;var e=
|
|
51
|
+
*/var Tr;function Hn(){if(Tr)return Bt;Tr=1;var e=k,t=Xt();function r(l,f){return l===f&&(l!==0||1/l===1/f)||l!==l&&f!==f}var n=typeof Object.is=="function"?Object.is:r,o=t.useSyncExternalStore,a=e.useRef,u=e.useEffect,h=e.useMemo,p=e.useDebugValue;return Bt.useSyncExternalStoreWithSelector=function(l,f,g,m,x){var y=a(null);if(y.current===null){var d={hasValue:!1,value:null};y.current=d}else d=y.current;y=h(function(){function M(N){if(!R){if(R=!0,T=N,N=m(N),x!==void 0&&d.hasValue){var O=d.value;if(x(O,N))return A=O}return A=N}if(O=A,n(T,N))return O;var V=m(N);return x!==void 0&&x(O,V)?(T=N,O):(T=N,A=V)}var R=!1,T,A,c=g===void 0?null:g;return[function(){return M(f())},c===null?void 0:function(){return M(c())}]},[f,g,m,x]);var S=o(l,y[0],y[1]);return u(function(){d.hasValue=!0,d.value=S},[S]),p(S),S},Bt}var Ut={};/**
|
|
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 <`+R+">.")}return O}}function Et(s,O){{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 Mr;function Gn(){return Mr||(Mr=1,process.env.NODE_ENV!=="production"&&(function(){function e(
|
|
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:S,selected:
|
|
61
|
-
Selectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.`,{stack:
|
|
59
|
+
*/var Mr;function Gn(){return Mr||(Mr=1,process.env.NODE_ENV!=="production"&&(function(){function e(l,f){return l===f&&(l!==0||1/l===1/f)||l!==l&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=k,r=Xt(),n=typeof Object.is=="function"?Object.is:e,o=r.useSyncExternalStore,a=t.useRef,u=t.useEffect,h=t.useMemo,p=t.useDebugValue;Ut.useSyncExternalStoreWithSelector=function(l,f,g,m,x){var y=a(null);if(y.current===null){var d={hasValue:!1,value:null};y.current=d}else d=y.current;y=h(function(){function M(N){if(!R){if(R=!0,T=N,N=m(N),x!==void 0&&d.hasValue){var O=d.value;if(x(O,N))return A=O}return A=N}if(O=A,n(T,N))return O;var V=m(N);return x!==void 0&&x(O,V)?(T=N,O):(T=N,A=V)}var R=!1,T,A,c=g===void 0?null:g;return[function(){return M(f())},c===null?void 0:function(){return M(c())}]},[f,g,m,x]);var S=o(l,y[0],y[1]);return u(function(){d.hasValue=!0,d.value=S},[S]),p(S),S},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ut}var kr;function Kn(){return kr||(kr=1,process.env.NODE_ENV==="production"?Et.exports=Hn():Et.exports=Gn()),Et.exports}var Jn=Kn();function Zn(e){e()}let Rr=Zn;const Qn=e=>Rr=e,eo=()=>Rr,Nr=Symbol.for("react-redux-context"),Ar=typeof globalThis<"u"?globalThis:{};function to(){var e;if(!je.createContext)return{};const t=(e=Ar[Nr])!=null?e:Ar[Nr]=new Map;let r=t.get(je.createContext);return r||(r=je.createContext(null),process.env.NODE_ENV!=="production"&&(r.displayName="ReactRedux"),t.set(je.createContext,r)),r}const ze=to();function qt(e=ze){return function(){const r=k.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 Dr=qt();let Ir=()=>{throw new Error("uSES not initialized!")};const ro=e=>{Ir=e},no=(e,t)=>e===t;function oo(e=ze){const t=e===ze?Dr:qt(e);return function(n,o={}){const{equalityFn:a=no,stabilityCheck:u=void 0,noopCheck:h=void 0}=typeof o=="function"?{equalityFn:o}:o;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:l,getServerState:f,stabilityCheck:g,noopCheck:m}=t(),x=k.useRef(!0),y=k.useCallback({[n.name](S){const M=n(S);if(process.env.NODE_ENV!=="production"){const R=typeof u>"u"?g:u;if(R==="always"||R==="once"&&x.current){const A=n(S);if(!a(M,A)){let c;try{throw new Error}catch(N){({stack:c}=N)}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:S,selected:M,selected2:A,stack:c})}}const T=typeof h>"u"?m:h;if((T==="always"||T==="once"&&x.current)&&M===S){let A;try{throw new Error}catch(c){({stack:A}=c)}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:A})}x.current&&(x.current=!1)}return M}}[n.name],[n,g,u]),d=Ir(l.addNestedSub,p.getState,f||p.getState,y,a);return k.useDebugValue(d),d}}const ie=oo();var St={exports:{}},X={};/** @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 zr;function io(){if(zr)return
|
|
68
|
+
*/var zr;function io(){if(zr)return X;zr=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,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,u=e?Symbol.for("react.provider"):60109,h=e?Symbol.for("react.context"):60110,p=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,g=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,x=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,d=e?Symbol.for("react.block"):60121,S=e?Symbol.for("react.fundamental"):60117,M=e?Symbol.for("react.responder"):60118,R=e?Symbol.for("react.scope"):60119;function T(c){if(typeof c=="object"&&c!==null){var N=c.$$typeof;switch(N){case t:switch(c=c.type,c){case p:case l:case n:case a:case o:case g:return c;default:switch(c=c&&c.$$typeof,c){case h:case f:case y:case x:case u:return c;default:return N}}case r:return N}}}function A(c){return T(c)===l}return X.AsyncMode=p,X.ConcurrentMode=l,X.ContextConsumer=h,X.ContextProvider=u,X.Element=t,X.ForwardRef=f,X.Fragment=n,X.Lazy=y,X.Memo=x,X.Portal=r,X.Profiler=a,X.StrictMode=o,X.Suspense=g,X.isAsyncMode=function(c){return A(c)||T(c)===p},X.isConcurrentMode=A,X.isContextConsumer=function(c){return T(c)===h},X.isContextProvider=function(c){return T(c)===u},X.isElement=function(c){return typeof c=="object"&&c!==null&&c.$$typeof===t},X.isForwardRef=function(c){return T(c)===f},X.isFragment=function(c){return T(c)===n},X.isLazy=function(c){return T(c)===y},X.isMemo=function(c){return T(c)===x},X.isPortal=function(c){return T(c)===r},X.isProfiler=function(c){return T(c)===a},X.isStrictMode=function(c){return T(c)===o},X.isSuspense=function(c){return T(c)===g},X.isValidElementType=function(c){return typeof c=="string"||typeof c=="function"||c===n||c===l||c===a||c===o||c===g||c===m||typeof c=="object"&&c!==null&&(c.$$typeof===y||c.$$typeof===x||c.$$typeof===u||c.$$typeof===h||c.$$typeof===f||c.$$typeof===S||c.$$typeof===M||c.$$typeof===R||c.$$typeof===d)},X.typeOf=T,X}var B={};/** @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 Wr;function ao(){return Wr||(Wr=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,o=e?Symbol.for("react.strict_mode"):60108,
|
|
75
|
+
*/var Wr;function ao(){return Wr||(Wr=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,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,u=e?Symbol.for("react.provider"):60109,h=e?Symbol.for("react.context"):60110,p=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,g=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,x=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,d=e?Symbol.for("react.block"):60121,S=e?Symbol.for("react.fundamental"):60117,M=e?Symbol.for("react.responder"):60118,R=e?Symbol.for("react.scope"):60119;function T(I){return typeof I=="string"||typeof I=="function"||I===n||I===l||I===a||I===o||I===g||I===m||typeof I=="object"&&I!==null&&(I.$$typeof===y||I.$$typeof===x||I.$$typeof===u||I.$$typeof===h||I.$$typeof===f||I.$$typeof===S||I.$$typeof===M||I.$$typeof===R||I.$$typeof===d)}function A(I){if(typeof I=="object"&&I!==null){var ce=I.$$typeof;switch(ce){case t:var z=I.type;switch(z){case p:case l:case n:case a:case o:case g:return z;default:var le=z&&z.$$typeof;switch(le){case h:case f:case y:case x:case u:return le;default:return ce}}case r:return ce}}}var c=p,N=l,O=h,V=u,ee=t,K=f,J=n,ae=y,Z=x,re=r,fe=a,Me=o,Ee=g,ve=!1;function be(I){return ve||(ve=!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.")),we(I)||A(I)===p}function we(I){return A(I)===l}function ke(I){return A(I)===h}function Fe(I){return A(I)===u}function Re(I){return typeof I=="object"&&I!==null&&I.$$typeof===t}function Ge(I){return A(I)===f}function Xe(I){return A(I)===n}function ye(I){return A(I)===y}function Se(I){return A(I)===x}function Ce(I){return A(I)===r}function de(I){return A(I)===a}function se(I){return A(I)===o}function _e(I){return A(I)===g}B.AsyncMode=c,B.ConcurrentMode=N,B.ContextConsumer=O,B.ContextProvider=V,B.Element=ee,B.ForwardRef=K,B.Fragment=J,B.Lazy=ae,B.Memo=Z,B.Portal=re,B.Profiler=fe,B.StrictMode=Me,B.Suspense=Ee,B.isAsyncMode=be,B.isConcurrentMode=we,B.isContextConsumer=ke,B.isContextProvider=Fe,B.isElement=Re,B.isForwardRef=Ge,B.isFragment=Xe,B.isLazy=ye,B.isMemo=Se,B.isPortal=Ce,B.isProfiler=de,B.isStrictMode=se,B.isSuspense=_e,B.isValidElementType=T,B.typeOf=A})()),B}var Lr;function so(){return Lr||(Lr=1,process.env.NODE_ENV==="production"?St.exports=io():St.exports=ao()),St.exports}var Ht,Yr;function co(){if(Yr)return Ht;Yr=1;var e=so(),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},o={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};a[e.ForwardRef]=n,a[e.Memo]=o;function u(y){return e.isMemo(y)?o:a[y.$$typeof]||t}var h=Object.defineProperty,p=Object.getOwnPropertyNames,l=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,g=Object.getPrototypeOf,m=Object.prototype;function x(y,d,S){if(typeof d!="string"){if(m){var M=g(d);M&&M!==m&&x(y,M,S)}var R=p(d);l&&(R=R.concat(l(d)));for(var T=u(y),A=u(d),c=0;c<R.length;++c){var N=R[c];if(!r[N]&&!(S&&S[N])&&!(A&&A[N])&&!(T&&T[N])){var O=f(d,N);try{h(y,N,O)}catch{}}}}return y}return Ht=x,Ht}co();var Ct={exports:{}},U={};/**
|
|
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 Vr;function lo(){if(Vr)return
|
|
83
|
+
*/var Vr;function lo(){if(Vr)return U;Vr=1;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"),u=Symbol.for("react.context"),h=Symbol.for("react.server_context"),p=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function d(S){if(typeof S=="object"&&S!==null){var M=S.$$typeof;switch(M){case e:switch(S=S.type,S){case r:case o:case n:case l:case f:return S;default:switch(S=S&&S.$$typeof,S){case h:case u:case p:case m:case g:case a:return S;default:return M}}case t:return M}}}return U.ContextConsumer=u,U.ContextProvider=a,U.Element=e,U.ForwardRef=p,U.Fragment=r,U.Lazy=m,U.Memo=g,U.Portal=t,U.Profiler=o,U.StrictMode=n,U.Suspense=l,U.SuspenseList=f,U.isAsyncMode=function(){return!1},U.isConcurrentMode=function(){return!1},U.isContextConsumer=function(S){return d(S)===u},U.isContextProvider=function(S){return d(S)===a},U.isElement=function(S){return typeof S=="object"&&S!==null&&S.$$typeof===e},U.isForwardRef=function(S){return d(S)===p},U.isFragment=function(S){return d(S)===r},U.isLazy=function(S){return d(S)===m},U.isMemo=function(S){return d(S)===g},U.isPortal=function(S){return d(S)===t},U.isProfiler=function(S){return d(S)===o},U.isStrictMode=function(S){return d(S)===n},U.isSuspense=function(S){return d(S)===l},U.isSuspenseList=function(S){return d(S)===f},U.isValidElementType=function(S){return typeof S=="string"||typeof S=="function"||S===r||S===o||S===n||S===l||S===f||S===x||typeof S=="object"&&S!==null&&(S.$$typeof===m||S.$$typeof===g||S.$$typeof===a||S.$$typeof===u||S.$$typeof===p||S.$$typeof===y||S.getModuleId!==void 0)},U.typeOf=d,U}var q={};/**
|
|
84
84
|
* @license React
|
|
85
85
|
* react-is.development.js
|
|
86
86
|
*
|
|
@@ -88,12 +88,12 @@ 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 $r;function uo(){return $r||($r=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"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),d=Symbol.for("react.server_context"),h=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),u=!1,x=!1,S=!1,T=!1,A=!1,M;M=Symbol.for("react.module.reference");function m(W){return!!(typeof W=="string"||typeof W=="function"||W===r||W===o||A||W===n||W===c||W===v||T||W===p||u||x||S||typeof W=="object"&&W!==null&&(W.$$typeof===w||W.$$typeof===f||W.$$typeof===i||W.$$typeof===l||W.$$typeof===h||W.$$typeof===M||W.getModuleId!==void 0))}function b(W){if(typeof W=="object"&&W!==null){var se=W.$$typeof;switch(se){case e:var me=W.type;switch(me){case r:case o:case n:case c:case v:return me;default:var Te=me&&me.$$typeof;switch(Te){case d:case l:case h:case w:case f:case i:return Te;default:return se}}case t:return se}}}var _=l,X=i,$=e,ee=h,ne=r,Z=w,G=f,ue=t,ae=o,ye=n,Se=c,Ce=v,ge=!1,we=!1;function _e(W){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function Fe(W){return we||(we=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function Ne(W){return b(W)===l}function Xe(W){return b(W)===i}function Be(W){return typeof W=="object"&&W!==null&&W.$$typeof===e}function Oe(W){return b(W)===h}function je(W){return b(W)===r}function Ae(W){return b(W)===w}function fe(W){return b(W)===f}function he(W){return b(W)===t}function pe(W){return b(W)===o}function Pe(W){return b(W)===n}function I(W){return b(W)===c}function xe(W){return b(W)===v}H.ContextConsumer=_,H.ContextProvider=X,H.Element=$,H.ForwardRef=ee,H.Fragment=ne,H.Lazy=Z,H.Memo=G,H.Portal=ue,H.Profiler=ae,H.StrictMode=ye,H.Suspense=Se,H.SuspenseList=Ce,H.isAsyncMode=_e,H.isConcurrentMode=Fe,H.isContextConsumer=Ne,H.isContextProvider=Xe,H.isElement=Be,H.isForwardRef=Oe,H.isFragment=je,H.isLazy=Ae,H.isMemo=fe,H.isPortal=he,H.isProfiler=pe,H.isStrictMode=Pe,H.isSuspense=I,H.isSuspenseList=xe,H.isValidElementType=m,H.typeOf=b})()),H}var Fr;function fo(){return Fr||(Fr=1,process.env.NODE_ENV==="production"?jt.exports=lo():jt.exports=uo()),jt.exports}fo();function ho(){const e=eo();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,i=r={callback:n,next:null,prev:r};return i.prev?i.prev.next=i:t=i,function(){!o||t===null||(o=!1,i.next?i.next.prev=i.prev:r=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}const Xr={notify(){},get:()=>[]};function po(e,t){let r,n=Xr,o=0,i=!1;function l(x){v();const S=n.subscribe(x);let T=!1;return()=>{T||(T=!0,S(),f())}}function d(){n.notify()}function h(){u.onStateChange&&u.onStateChange()}function c(){return i}function v(){o++,r||(r=e.subscribe(h),n=ho())}function f(){o--,r&&o===0&&(r(),r=void 0,n.clear(),n=Xr)}function w(){i||(i=!0,v())}function p(){i&&(i=!1,f())}const u={addNestedSub:l,notifyNestedSubs:d,handleChangeWrapper:h,isSubscribed:c,trySubscribe:w,tryUnsubscribe:p,getListeners:()=>n};return u}const vo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Me.useLayoutEffect:Me.useEffect;function yo({store:e,context:t,children:r,serverState:n,stabilityCheck:o="once",noopCheck:i="once"}){const l=Me.useMemo(()=>{const c=po(e);return{store:e,subscription:c,getServerState:n?()=>n:void 0,stabilityCheck:o,noopCheck:i}},[e,n,o,i]),d=Me.useMemo(()=>e.getState(),[e]);vo(()=>{const{subscription:c}=l;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),d!==e.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[l,d]);const h=t||ze;return Me.createElement(h.Provider,{value:l},r)}function Br(e=ze){const t=e===ze?Dr:qt(e);return function(){const{store:n}=t();return n}}const go=Br();function mo(e=ze){const t=e===ze?go:Br(e);return function(){return t().dispatch}}const Gt=mo();ro(Jn.useSyncExternalStoreWithSelector),Qn(Vn.unstable_batchedUpdates);const bo={en:{pointer:"Pointer",text:"Text",image:"Image",pencil:"Pencil",rectangle:"Rectangle",circle:"Circle",eraser:"Eraser",fitToView:"Fit to view",exportAsPng:"Export as PNG",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"},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",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"}},Ur=N.createContext(),qr="whiteboard-language",wo=()=>(navigator.language||navigator.userLanguage).startsWith("tr")?"tr":"en",xo=()=>{const e=localStorage.getItem(qr);return e&&(e==="en"||e==="tr")?e:wo()},Eo=({children:e})=>{const[t,r]=N.useState(xo);N.useEffect(()=>{localStorage.setItem(qr,t)},[t]);const n=i=>bo[t][i]||i,o=i=>{(i==="en"||i==="tr")&&r(i)};return g.jsx(Ur.Provider,{value:{language:t,t:n,changeLanguage:o},children:e})},Hr=()=>{const e=N.useContext(Ur);if(!e)throw new Error("useLanguage must be used within a LanguageProvider");return e};function oe(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=ko[e],i=o?typeof o=="function"?o.apply(null,r):o:"unknown error nr: "+e;throw Error("[Immer] "+i)}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 We(e){return!!e&&!!e[K]}function ke(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)===Ro})(e)||Array.isArray(e)||!!e[on]||!!(!((t=e.constructor)===null||t===void 0)&&t[on])||Kt(e)||Jt(e))}function qe(e,t,r){r===void 0&&(r=!1),rt(e)===0?(r?Object.keys:it)(e).forEach((function(n){r&&typeof n=="symbol"||t(n,e[n],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function rt(e){var t=e[K];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:Kt(e)?2:Jt(e)?3:0}function nt(e,t){return rt(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function So(e,t){return rt(e)===2?e.get(t):e[t]}function Gr(e,t,r){var n=rt(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function Kr(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function Kt(e){return To&&e instanceof Map}function Jt(e){return Mo&&e instanceof Set}function Le(e){return e.o||e.t}function Zt(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=an(e);delete t[K];for(var r=it(t),n=0;n<r.length;n++){var o=r[n],i=t[o];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function Qt(e,t){return t===void 0&&(t=!1),er(e)||We(e)||!ke(e)||(rt(e)>1&&(e.set=e.add=e.clear=e.delete=Co),Object.freeze(e),t&&qe(e,(function(r,n){return Qt(n,!0)}),!0)),e}function Co(){oe(2)}function er(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function Ee(e){var t=lr[e];return t||oe(18,e),t}function _o(e,t){lr[e]||(lr[e]=t)}function tr(){return process.env.NODE_ENV==="production"||ot||oe(0),ot}function rr(e,t){t&&(Ee("Patches"),e.u=[],e.s=[],e.v=t)}function Pt(e){nr(e),e.p.forEach(Oo),e.p=null}function nr(e){e===ot&&(ot=e.l)}function Jr(e){return ot={p:[],l:ot,h:e,m:!0,_:0}}function Oo(e){var t=e[K];t.i===0||t.i===1?t.j():t.g=!0}function or(e,t){t._=t.p.length;var r=t.p[0],n=e!==void 0&&e!==r;return t.h.O||Ee("ES5").S(t,e,n),n?(r[K].P&&(Pt(t),oe(4)),ke(e)&&(e=Tt(t,e),t.l||Mt(t,e)),t.u&&Ee("Patches").M(r[K].t,e,t.u,t.s)):e=Tt(t,r,[]),Pt(t),t.u&&t.v(t.u,t.s),e!==nn?e:void 0}function Tt(e,t,r){if(er(t))return t;var n=t[K];if(!n)return qe(t,(function(d,h){return Zr(e,n,t,d,h,r)}),!0),t;if(n.A!==e)return t;if(!n.P)return Mt(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var o=n.i===4||n.i===5?n.o=Zt(n.k):n.o,i=o,l=!1;n.i===3&&(i=new Set(o),o.clear(),l=!0),qe(i,(function(d,h){return Zr(e,n,o,d,h,r,l)})),Mt(e,o,!1),r&&e.u&&Ee("Patches").N(n,r,e.u,e.s)}return n.o}function Zr(e,t,r,n,o,i,l){if(process.env.NODE_ENV!=="production"&&o===r&&oe(5),We(o)){var d=Tt(e,o,i&&t&&t.i!==3&&!nt(t.R,n)?i.concat(n):void 0);if(Gr(r,n,d),!We(d))return;e.m=!1}else l&&r.add(o);if(ke(o)&&!er(o)){if(!e.h.D&&e._<1)return;Tt(e,o),t&&t.A.l||Mt(e,o)}}function Mt(e,t,r){r===void 0&&(r=!1),!e.l&&e.h.D&&e.m&&Qt(t,r)}function ir(e,t){var r=e[K];return(r?Le(r):e)[t]}function Qr(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 Ye(e){e.P||(e.P=!0,e.l&&Ye(e.l))}function ar(e){e.o||(e.o=Zt(e.t))}function sr(e,t,r){var n=Kt(t)?Ee("MapSet").F(t,r):Jt(t)?Ee("MapSet").T(t,r):e.O?(function(o,i){var l=Array.isArray(o),d={i:l?1:0,A:i?i.A:tr(),P:!1,I:!1,R:{},l:i,t:o,k:null,o:null,j:null,C:!1},h=d,c=pt;l&&(h=[d],c=vt);var v=Proxy.revocable(h,c),f=v.revoke,w=v.proxy;return d.k=w,d.j=f,w})(t,r):Ee("ES5").J(t,r);return(r?r.A:tr()).p.push(n),n}function jo(e){return We(e)||oe(22,e),(function t(r){if(!ke(r))return r;var n,o=r[K],i=rt(r);if(o){if(!o.P&&(o.i<4||!Ee("ES5").K(o)))return o.t;o.I=!0,n=en(r,i),o.I=!1}else n=en(r,i);return qe(n,(function(l,d){o&&So(o.t,l)===d||Gr(n,l,t(d))})),i===3?new Set(n):n})(e)}function en(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Zt(e)}function Po(){function e(l,d){var h=i[l];return h?h.enumerable=d:i[l]=h={configurable:!0,enumerable:d,get:function(){var c=this[K];return process.env.NODE_ENV!=="production"&&o(c),pt.get(c,l)},set:function(c){var v=this[K];process.env.NODE_ENV!=="production"&&o(v),pt.set(v,l,c)}},h}function t(l){for(var d=l.length-1;d>=0;d--){var h=l[d][K];if(!h.P)switch(h.i){case 5:n(h)&&Ye(h);break;case 4:r(h)&&Ye(h)}}}function r(l){for(var d=l.t,h=l.k,c=it(h),v=c.length-1;v>=0;v--){var f=c[v];if(f!==K){var w=d[f];if(w===void 0&&!nt(d,f))return!0;var p=h[f],u=p&&p[K];if(u?u.t!==w:!Kr(p,w))return!0}}var x=!!d[K];return c.length!==it(d).length+(x?0:1)}function n(l){var d=l.k;if(d.length!==l.t.length)return!0;var h=Object.getOwnPropertyDescriptor(d,d.length-1);if(h&&!h.get)return!0;for(var c=0;c<d.length;c++)if(!d.hasOwnProperty(c))return!0;return!1}function o(l){l.g&&oe(3,JSON.stringify(Le(l)))}var i={};_o("ES5",{J:function(l,d){var h=Array.isArray(l),c=(function(f,w){if(f){for(var p=Array(w.length),u=0;u<w.length;u++)Object.defineProperty(p,""+u,e(u,!0));return p}var x=an(w);delete x[K];for(var S=it(x),T=0;T<S.length;T++){var A=S[T];x[A]=e(A,f||!!x[A].enumerable)}return Object.create(Object.getPrototypeOf(w),x)})(h,l),v={i:h?5:4,A:d?d.A:tr(),P:!1,I:!1,R:{},l:d,t:l,k:c,o:null,g:!1,C:!1};return Object.defineProperty(c,K,{value:v,writable:!0}),c},S:function(l,d,h){h?We(d)&&d[K].A===l&&t(l.p):(l.u&&(function c(v){if(v&&typeof v=="object"){var f=v[K];if(f){var w=f.t,p=f.k,u=f.R,x=f.i;if(x===4)qe(p,(function(m){m!==K&&(w[m]!==void 0||nt(w,m)?u[m]||c(p[m]):(u[m]=!0,Ye(f)))})),qe(w,(function(m){p[m]!==void 0||nt(p,m)||(u[m]=!1,Ye(f))}));else if(x===5){if(n(f)&&(Ye(f),u.length=!0),p.length<w.length)for(var S=p.length;S<w.length;S++)u[S]=!1;else for(var T=w.length;T<p.length;T++)u[T]=!0;for(var A=Math.min(p.length,w.length),M=0;M<A;M++)p.hasOwnProperty(M)||(u[M]=!0),u[M]===void 0&&c(p[M])}}}})(l.p[0]),t(l.p))},K:function(l){return l.i===4?r(l):n(l)}})}var tn,ot,cr=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",To=typeof Map<"u",Mo=typeof Set<"u",rn=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",nn=cr?Symbol.for("immer-nothing"):((tn={})["immer-nothing"]=!0,tn),on=cr?Symbol.for("immer-draftable"):"__$immer_draftable",K=cr?Symbol.for("immer-state"):"__$immer_state",ko={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"},Ro=""+Object.prototype.constructor,it=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,an=Object.getOwnPropertyDescriptors||function(e){var t={};return it(e).forEach((function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)})),t},lr={},pt={get:function(e,t){if(t===K)return e;var r=Le(e);if(!nt(r,t))return(function(o,i,l){var d,h=Qr(i,l);return h?"value"in h?h.value:(d=h.get)===null||d===void 0?void 0:d.call(o.k):void 0})(e,r,t);var n=r[t];return e.I||!ke(n)?n:n===ir(e.t,t)?(ar(e),e.o[t]=sr(e.A.h,n,e)):n},has:function(e,t){return t in Le(e)},ownKeys:function(e){return Reflect.ownKeys(Le(e))},set:function(e,t,r){var n=Qr(Le(e),t);if(n!=null&&n.set)return n.set.call(e.k,r),!0;if(!e.P){var o=ir(Le(e),t),i=o==null?void 0:o[K];if(i&&i.t===r)return e.o[t]=r,e.R[t]=!1,!0;if(Kr(r,o)&&(r!==void 0||nt(e.t,t)))return!0;ar(e),Ye(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 ir(e.t,t)!==void 0||t in e.t?(e.R[t]=!1,ar(e),Ye(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=Le(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.i!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty:function(){oe(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){oe(12)}},vt={};qe(pt,(function(e,t){vt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),vt.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&oe(13),vt.set.call(this,e,t,void 0)},vt.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&oe(14),pt.set.call(this,e[0],t,r,e[0])};var No=(function(){function e(r){var n=this;this.O=rn,this.D=!0,this.produce=function(o,i,l){if(typeof o=="function"&&typeof i!="function"){var d=i;i=o;var h=n;return function(x){var S=this;x===void 0&&(x=d);for(var T=arguments.length,A=Array(T>1?T-1:0),M=1;M<T;M++)A[M-1]=arguments[M];return h.produce(x,(function(m){var b;return(b=i).call.apply(b,[S,m].concat(A))}))}}var c;if(typeof i!="function"&&oe(6),l!==void 0&&typeof l!="function"&&oe(7),ke(o)){var v=Jr(n),f=sr(n,o,void 0),w=!0;try{c=i(f),w=!1}finally{w?Pt(v):nr(v)}return typeof Promise<"u"&&c instanceof Promise?c.then((function(x){return rr(v,l),or(x,v)}),(function(x){throw Pt(v),x})):(rr(v,l),or(c,v))}if(!o||typeof o!="object"){if((c=i(o))===void 0&&(c=o),c===nn&&(c=void 0),n.D&&Qt(c,!0),l){var p=[],u=[];Ee("Patches").M(o,c,p,u),l(p,u)}return c}oe(21,o)},this.produceWithPatches=function(o,i){if(typeof o=="function")return function(c){for(var v=arguments.length,f=Array(v>1?v-1:0),w=1;w<v;w++)f[w-1]=arguments[w];return n.produceWithPatches(c,(function(p){return o.apply(void 0,[p].concat(f))}))};var l,d,h=n.produce(o,i,(function(c,v){l=c,d=v}));return typeof Promise<"u"&&h instanceof Promise?h.then((function(c){return[c,l,d]})):[h,l,d]},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){ke(r)||oe(8),We(r)&&(r=jo(r));var n=Jr(this),o=sr(this,r,void 0);return o[K].C=!0,nr(n),o},t.finishDraft=function(r,n){var o=r&&r[K];process.env.NODE_ENV!=="production"&&(o&&o.C||oe(9),o.I&&oe(10));var i=o.A;return rr(i,n),or(void 0,i)},t.setAutoFreeze=function(r){this.D=r},t.setUseProxies=function(r){r&&!rn&&oe(20),this.O=r},t.applyPatches=function(r,n){var o;for(o=n.length-1;o>=0;o--){var i=n[o];if(i.path.length===0&&i.op==="replace"){r=i.value;break}}o>-1&&(n=n.slice(o+1));var l=Ee("Patches").$;return We(r)?l(r,n):this.produce(r,(function(d){return l(d,n)}))},e})(),de=new No,sn=de.produce;de.produceWithPatches.bind(de),de.setAutoFreeze.bind(de),de.setUseProxies.bind(de),de.applyPatches.bind(de),de.createDraft.bind(de),de.finishDraft.bind(de);function yt(e){"@babel/helpers - typeof";return yt=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},yt(e)}function Ao(e,t){if(yt(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(yt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Do(e){var t=Ao(e,"string");return yt(t)=="symbol"?t:t+""}function Io(e,t,r){return(t=Do(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cn(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 ln(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cn(Object(r),!0).forEach(function(n){Io(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ie(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 un=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),ur=function(){return Math.random().toString(36).substring(7).split("").join(".")},He={INIT:"@@redux/INIT"+ur(),REPLACE:"@@redux/REPLACE"+ur(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+ur()}};function fn(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 zo(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(Yo(e))return"date";if(Lo(e))return"error";var r=Wo(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 Wo(e){return typeof e.constructor=="function"?e.constructor.name:null}function Lo(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Yo(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Ge(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=zo(e)),t}function dn(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"?ie(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"?ie(1):"Expected the enhancer to be a function. Instead, received: '"+Ge(r)+"'");return r(dn)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?ie(2):"Expected the root reducer to be a function. Instead, received: '"+Ge(e)+"'");var o=e,i=t,l=[],d=l,h=!1;function c(){d===l&&(d=l.slice())}function v(){if(h)throw new Error(process.env.NODE_ENV==="production"?ie(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 i}function f(x){if(typeof x!="function")throw new Error(process.env.NODE_ENV==="production"?ie(4):"Expected the listener to be a function. Instead, received: '"+Ge(x)+"'");if(h)throw new Error(process.env.NODE_ENV==="production"?ie(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 S=!0;return c(),d.push(x),function(){if(S){if(h)throw new Error(process.env.NODE_ENV==="production"?ie(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.");S=!1,c();var A=d.indexOf(x);d.splice(A,1),l=null}}}function w(x){if(!fn(x))throw new Error(process.env.NODE_ENV==="production"?ie(7):"Actions must be plain objects. Instead, the actual type was: '"+Ge(x)+"'. 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 x.type>"u")throw new Error(process.env.NODE_ENV==="production"?ie(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(h)throw new Error(process.env.NODE_ENV==="production"?ie(9):"Reducers may not dispatch actions.");try{h=!0,i=o(i,x)}finally{h=!1}for(var S=l=d,T=0;T<S.length;T++){var A=S[T];A()}return x}function p(x){if(typeof x!="function")throw new Error(process.env.NODE_ENV==="production"?ie(10):"Expected the nextReducer to be a function. Instead, received: '"+Ge(x));o=x,w({type:He.REPLACE})}function u(){var x,S=f;return x={subscribe:function(A){if(typeof A!="object"||A===null)throw new Error(process.env.NODE_ENV==="production"?ie(11):"Expected the observer to be an object. Instead, received: '"+Ge(A)+"'");function M(){A.next&&A.next(v())}M();var m=S(M);return{unsubscribe:m}}},x[un]=function(){return this},x}return w({type:He.INIT}),n={dispatch:w,subscribe:f,getState:v,replaceReducer:p},n[un]=u,n}function hn(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function Vo(e,t,r,n){var o=Object.keys(t),i=r&&r.type===He.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(!fn(e))return"The "+i+' has unexpected type of "'+Ge(e)+'". Expected argument to be an object with the following '+('keys: "'+o.join('", "')+'"');var l=Object.keys(e).filter(function(d){return!t.hasOwnProperty(d)&&!n[d]});if(l.forEach(function(d){n[d]=!0}),!(r&&r.type===He.REPLACE)&&l.length>0)return"Unexpected "+(l.length>1?"keys":"key")+" "+('"'+l.join('", "')+'" found in '+i+". ")+"Expected to find one of the known reducer keys instead: "+('"'+o.join('", "')+'". Unexpected keys will be ignored.')}function $o(e){Object.keys(e).forEach(function(t){var r=e[t],n=r(void 0,{type:He.INIT});if(typeof n>"u")throw new Error(process.env.NODE_ENV==="production"?ie(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:He.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?ie(13):'The slice reducer for key "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle '"+He.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 Fo(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"&&hn('No reducer provided for key "'+o+'"'),typeof e[o]=="function"&&(r[o]=e[o])}var i=Object.keys(r),l;process.env.NODE_ENV!=="production"&&(l={});var d;try{$o(r)}catch(h){d=h}return function(c,v){if(c===void 0&&(c={}),d)throw d;if(process.env.NODE_ENV!=="production"){var f=Vo(c,r,v,l);f&&hn(f)}for(var w=!1,p={},u=0;u<i.length;u++){var x=i[u],S=r[x],T=c[x],A=S(T,v);if(typeof A>"u"){var M=v&&v.type;throw new Error(process.env.NODE_ENV==="production"?ie(14):"When called with an action of type "+(M?'"'+String(M)+'"':"(unknown type)")+', the slice reducer for key "'+x+'" 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.')}p[x]=A,w=w||A!==T}return w=w||i.length!==Object.keys(c).length,w?p: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 Xo(){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),i=function(){throw new Error(process.env.NODE_ENV==="production"?ie(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 i.apply(void 0,arguments)}},d=t.map(function(h){return h(l)});return i=kt.apply(void 0,d)(o.dispatch),ln(ln({},o),{},{dispatch:i})}}}function pn(e){var t=function(n){var o=n.dispatch,i=n.getState;return function(l){return function(d){return typeof d=="function"?d(o,i,e):l(d)}}};return t}var fr=pn();fr.withExtraArgument=pn;var vn=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},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)}})(),Bo=function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,l;return l={next:d(0),throw:d(1),return:d(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function d(c){return function(v){return h([c,v])}}function h(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=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(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(v){c=[6,v],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},at=function(e,t){for(var r=0,n=t.length,o=e.length;r<n;r++,o++)e[o]=t[r];return e},Uo=Object.defineProperty,qo=Object.defineProperties,Ho=Object.getOwnPropertyDescriptors,yn=Object.getOwnPropertySymbols,Go=Object.prototype.hasOwnProperty,Ko=Object.prototype.propertyIsEnumerable,gn=function(e,t,r){return t in e?Uo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},Ve=function(e,t){for(var r in t||(t={}))Go.call(t,r)&&gn(e,r,t[r]);if(yn)for(var n=0,o=yn(t);n<o.length;n++){var r=o[n];Ko.call(t,r)&&gn(e,r,t[r])}return e},dr=function(e,t){return qo(e,Ho(t))},Jo=function(e,t,r){return new Promise(function(n,o){var i=function(h){try{d(r.next(h))}catch(c){o(c)}},l=function(h){try{d(r.throw(h))}catch(c){o(c)}},d=function(h){return h.done?n(h.value):Promise.resolve(h.value).then(i,l)};d((r=r.apply(e,t)).next())})},Zo=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 mn(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 Qo=function(e){return e&&typeof e.match=="function"};function $e(e,t){function r(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(t){var i=t.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return Ve(Ve({type:e,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.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 ei(e){return typeof e=="function"&&"type"in e&&Qo(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 ri(e){if(e===void 0&&(e={}),process.env.NODE_ENV==="production")return function(){return function(n){return function(o){return n(o)}}};var t=e.isActionCreator,r=t===void 0?ei:t;return function(){return function(n){return function(o){return r(o)&&console.warn(ti(o.type)),n(o)}}}}function bn(e,t){var r=0;return{measureTime:function(n){var o=Date.now();try{return n()}finally{var
|
|
91
|
+
*/var $r;function uo(){return $r||($r=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"),u=Symbol.for("react.context"),h=Symbol.for("react.server_context"),p=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),y=!1,d=!1,S=!1,M=!1,R=!1,T;T=Symbol.for("react.module.reference");function A(z){return!!(typeof z=="string"||typeof z=="function"||z===r||z===o||R||z===n||z===l||z===f||M||z===x||y||d||S||typeof z=="object"&&z!==null&&(z.$$typeof===m||z.$$typeof===g||z.$$typeof===a||z.$$typeof===u||z.$$typeof===p||z.$$typeof===T||z.getModuleId!==void 0))}function c(z){if(typeof z=="object"&&z!==null){var le=z.$$typeof;switch(le){case e:var ge=z.type;switch(ge){case r:case o:case n:case l:case f:return ge;default:var Oe=ge&&ge.$$typeof;switch(Oe){case h:case u:case p:case m:case g:case a:return Oe;default:return le}}case t:return le}}}var N=u,O=a,V=e,ee=p,K=r,J=m,ae=g,Z=t,re=o,fe=n,Me=l,Ee=f,ve=!1,be=!1;function we(z){return ve||(ve=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function ke(z){return be||(be=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function Fe(z){return c(z)===u}function Re(z){return c(z)===a}function Ge(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function Xe(z){return c(z)===p}function ye(z){return c(z)===r}function Se(z){return c(z)===m}function Ce(z){return c(z)===g}function de(z){return c(z)===t}function se(z){return c(z)===o}function _e(z){return c(z)===n}function I(z){return c(z)===l}function ce(z){return c(z)===f}q.ContextConsumer=N,q.ContextProvider=O,q.Element=V,q.ForwardRef=ee,q.Fragment=K,q.Lazy=J,q.Memo=ae,q.Portal=Z,q.Profiler=re,q.StrictMode=fe,q.Suspense=Me,q.SuspenseList=Ee,q.isAsyncMode=we,q.isConcurrentMode=ke,q.isContextConsumer=Fe,q.isContextProvider=Re,q.isElement=Ge,q.isForwardRef=Xe,q.isFragment=ye,q.isLazy=Se,q.isMemo=Ce,q.isPortal=de,q.isProfiler=se,q.isStrictMode=_e,q.isSuspense=I,q.isSuspenseList=ce,q.isValidElementType=A,q.typeOf=c})()),q}var Fr;function fo(){return Fr||(Fr=1,process.env.NODE_ENV==="production"?Ct.exports=lo():Ct.exports=uo()),Ct.exports}fo();function ho(){const e=eo();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 Xr={notify(){},get:()=>[]};function po(e,t){let r,n=Xr,o=0,a=!1;function u(d){f();const S=n.subscribe(d);let M=!1;return()=>{M||(M=!0,S(),g())}}function h(){n.notify()}function p(){y.onStateChange&&y.onStateChange()}function l(){return a}function f(){o++,r||(r=e.subscribe(p),n=ho())}function g(){o--,r&&o===0&&(r(),r=void 0,n.clear(),n=Xr)}function m(){a||(a=!0,f())}function x(){a&&(a=!1,g())}const y={addNestedSub:u,notifyNestedSubs:h,handleChangeWrapper:p,isSubscribed:l,trySubscribe:m,tryUnsubscribe:x,getListeners:()=>n};return y}const vo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?je.useLayoutEffect:je.useEffect;function yo({store:e,context:t,children:r,serverState:n,stabilityCheck:o="once",noopCheck:a="once"}){const u=je.useMemo(()=>{const l=po(e);return{store:e,subscription:l,getServerState:n?()=>n:void 0,stabilityCheck:o,noopCheck:a}},[e,n,o,a]),h=je.useMemo(()=>e.getState(),[e]);vo(()=>{const{subscription:l}=u;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),h!==e.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[u,h]);const p=t||ze;return je.createElement(p.Provider,{value:u},r)}function Br(e=ze){const t=e===ze?Dr:qt(e);return function(){const{store:n}=t();return n}}const go=Br();function mo(e=ze){const t=e===ze?go:Br(e);return function(){return t().dispatch}}const Gt=mo();ro(Jn.useSyncExternalStoreWithSelector),Qn(Vn.unstable_batchedUpdates);const bo={en:{pointer:"Pointer",text:"Text",image:"Image",pencil:"Pencil",rectangle:"Rectangle",circle:"Circle",eraser:"Eraser",fitToView:"Fit to view",exportAsPng:"Export as PNG",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"},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",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"}},Ur=k.createContext(),qr="whiteboard-language",wo=()=>(navigator.language||navigator.userLanguage).startsWith("tr")?"tr":"en",xo=()=>{const e=localStorage.getItem(qr);return e&&(e==="en"||e==="tr")?e:wo()},Eo=({children:e})=>{const[t,r]=k.useState(xo);k.useEffect(()=>{localStorage.setItem(qr,t)},[t]);const n=a=>bo[t][a]||a,o=a=>{(a==="en"||a==="tr")&&r(a)};return w.jsx(Ur.Provider,{value:{language:t,t:n,changeLanguage:o},children:e})},Hr=()=>{const e=k.useContext(Ur);if(!e)throw new Error("useLanguage must be used within a LanguageProvider");return e};function ne(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=ko[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(u){return"'"+u+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function We(e){return!!e&&!!e[Q]}function Pe(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)===Ro})(e)||Array.isArray(e)||!!e[on]||!!(!((t=e.constructor)===null||t===void 0)&&t[on])||Kt(e)||Jt(e))}function Ue(e,t,r){r===void 0&&(r=!1),et(e)===0?(r?Object.keys:nt)(e).forEach((function(n){r&&typeof n=="symbol"||t(n,e[n],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function et(e){var t=e[Q];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:Kt(e)?2:Jt(e)?3:0}function tt(e,t){return et(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function So(e,t){return et(e)===2?e.get(t):e[t]}function Gr(e,t,r){var n=et(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function Kr(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function Kt(e){return To&&e instanceof Map}function Jt(e){return Mo&&e instanceof Set}function Le(e){return e.o||e.t}function Zt(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=an(e);delete t[Q];for(var r=nt(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 Qt(e,t){return t===void 0&&(t=!1),er(e)||We(e)||!Pe(e)||(et(e)>1&&(e.set=e.add=e.clear=e.delete=Co),Object.freeze(e),t&&Ue(e,(function(r,n){return Qt(n,!0)}),!0)),e}function Co(){ne(2)}function er(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function xe(e){var t=lr[e];return t||ne(18,e),t}function _o(e,t){lr[e]||(lr[e]=t)}function tr(){return process.env.NODE_ENV==="production"||rt||ne(0),rt}function rr(e,t){t&&(xe("Patches"),e.u=[],e.s=[],e.v=t)}function _t(e){nr(e),e.p.forEach(Oo),e.p=null}function nr(e){e===rt&&(rt=e.l)}function Jr(e){return rt={p:[],l:rt,h:e,m:!0,_:0}}function Oo(e){var t=e[Q];t.i===0||t.i===1?t.j():t.g=!0}function or(e,t){t._=t.p.length;var r=t.p[0],n=e!==void 0&&e!==r;return t.h.O||xe("ES5").S(t,e,n),n?(r[Q].P&&(_t(t),ne(4)),Pe(e)&&(e=Ot(t,e),t.l||jt(t,e)),t.u&&xe("Patches").M(r[Q].t,e,t.u,t.s)):e=Ot(t,r,[]),_t(t),t.u&&t.v(t.u,t.s),e!==nn?e:void 0}function Ot(e,t,r){if(er(t))return t;var n=t[Q];if(!n)return Ue(t,(function(h,p){return Zr(e,n,t,h,p,r)}),!0),t;if(n.A!==e)return t;if(!n.P)return jt(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var o=n.i===4||n.i===5?n.o=Zt(n.k):n.o,a=o,u=!1;n.i===3&&(a=new Set(o),o.clear(),u=!0),Ue(a,(function(h,p){return Zr(e,n,o,h,p,r,u)})),jt(e,o,!1),r&&e.u&&xe("Patches").N(n,r,e.u,e.s)}return n.o}function Zr(e,t,r,n,o,a,u){if(process.env.NODE_ENV!=="production"&&o===r&&ne(5),We(o)){var h=Ot(e,o,a&&t&&t.i!==3&&!tt(t.R,n)?a.concat(n):void 0);if(Gr(r,n,h),!We(h))return;e.m=!1}else u&&r.add(o);if(Pe(o)&&!er(o)){if(!e.h.D&&e._<1)return;Ot(e,o),t&&t.A.l||jt(e,o)}}function jt(e,t,r){r===void 0&&(r=!1),!e.l&&e.h.D&&e.m&&Qt(t,r)}function ir(e,t){var r=e[Q];return(r?Le(r):e)[t]}function Qr(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 Ye(e){e.P||(e.P=!0,e.l&&Ye(e.l))}function ar(e){e.o||(e.o=Zt(e.t))}function sr(e,t,r){var n=Kt(t)?xe("MapSet").F(t,r):Jt(t)?xe("MapSet").T(t,r):e.O?(function(o,a){var u=Array.isArray(o),h={i:u?1:0,A:a?a.A:tr(),P:!1,I:!1,R:{},l:a,t:o,k:null,o:null,j:null,C:!1},p=h,l=pt;u&&(p=[h],l=vt);var f=Proxy.revocable(p,l),g=f.revoke,m=f.proxy;return h.k=m,h.j=g,m})(t,r):xe("ES5").J(t,r);return(r?r.A:tr()).p.push(n),n}function jo(e){return We(e)||ne(22,e),(function t(r){if(!Pe(r))return r;var n,o=r[Q],a=et(r);if(o){if(!o.P&&(o.i<4||!xe("ES5").K(o)))return o.t;o.I=!0,n=en(r,a),o.I=!1}else n=en(r,a);return Ue(n,(function(u,h){o&&So(o.t,u)===h||Gr(n,u,t(h))})),a===3?new Set(n):n})(e)}function en(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Zt(e)}function Po(){function e(u,h){var p=a[u];return p?p.enumerable=h:a[u]=p={configurable:!0,enumerable:h,get:function(){var l=this[Q];return process.env.NODE_ENV!=="production"&&o(l),pt.get(l,u)},set:function(l){var f=this[Q];process.env.NODE_ENV!=="production"&&o(f),pt.set(f,u,l)}},p}function t(u){for(var h=u.length-1;h>=0;h--){var p=u[h][Q];if(!p.P)switch(p.i){case 5:n(p)&&Ye(p);break;case 4:r(p)&&Ye(p)}}}function r(u){for(var h=u.t,p=u.k,l=nt(p),f=l.length-1;f>=0;f--){var g=l[f];if(g!==Q){var m=h[g];if(m===void 0&&!tt(h,g))return!0;var x=p[g],y=x&&x[Q];if(y?y.t!==m:!Kr(x,m))return!0}}var d=!!h[Q];return l.length!==nt(h).length+(d?0:1)}function n(u){var h=u.k;if(h.length!==u.t.length)return!0;var p=Object.getOwnPropertyDescriptor(h,h.length-1);if(p&&!p.get)return!0;for(var l=0;l<h.length;l++)if(!h.hasOwnProperty(l))return!0;return!1}function o(u){u.g&&ne(3,JSON.stringify(Le(u)))}var a={};_o("ES5",{J:function(u,h){var p=Array.isArray(u),l=(function(g,m){if(g){for(var x=Array(m.length),y=0;y<m.length;y++)Object.defineProperty(x,""+y,e(y,!0));return x}var d=an(m);delete d[Q];for(var S=nt(d),M=0;M<S.length;M++){var R=S[M];d[R]=e(R,g||!!d[R].enumerable)}return Object.create(Object.getPrototypeOf(m),d)})(p,u),f={i:p?5:4,A:h?h.A:tr(),P:!1,I:!1,R:{},l:h,t:u,k:l,o:null,g:!1,C:!1};return Object.defineProperty(l,Q,{value:f,writable:!0}),l},S:function(u,h,p){p?We(h)&&h[Q].A===u&&t(u.p):(u.u&&(function l(f){if(f&&typeof f=="object"){var g=f[Q];if(g){var m=g.t,x=g.k,y=g.R,d=g.i;if(d===4)Ue(x,(function(A){A!==Q&&(m[A]!==void 0||tt(m,A)?y[A]||l(x[A]):(y[A]=!0,Ye(g)))})),Ue(m,(function(A){x[A]!==void 0||tt(x,A)||(y[A]=!1,Ye(g))}));else if(d===5){if(n(g)&&(Ye(g),y.length=!0),x.length<m.length)for(var S=x.length;S<m.length;S++)y[S]=!1;else for(var M=m.length;M<x.length;M++)y[M]=!0;for(var R=Math.min(x.length,m.length),T=0;T<R;T++)x.hasOwnProperty(T)||(y[T]=!0),y[T]===void 0&&l(x[T])}}}})(u.p[0]),t(u.p))},K:function(u){return u.i===4?r(u):n(u)}})}var tn,rt,cr=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",To=typeof Map<"u",Mo=typeof Set<"u",rn=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",nn=cr?Symbol.for("immer-nothing"):((tn={})["immer-nothing"]=!0,tn),on=cr?Symbol.for("immer-draftable"):"__$immer_draftable",Q=cr?Symbol.for("immer-state"):"__$immer_state",ko={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"},Ro=""+Object.prototype.constructor,nt=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,an=Object.getOwnPropertyDescriptors||function(e){var t={};return nt(e).forEach((function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)})),t},lr={},pt={get:function(e,t){if(t===Q)return e;var r=Le(e);if(!tt(r,t))return(function(o,a,u){var h,p=Qr(a,u);return p?"value"in p?p.value:(h=p.get)===null||h===void 0?void 0:h.call(o.k):void 0})(e,r,t);var n=r[t];return e.I||!Pe(n)?n:n===ir(e.t,t)?(ar(e),e.o[t]=sr(e.A.h,n,e)):n},has:function(e,t){return t in Le(e)},ownKeys:function(e){return Reflect.ownKeys(Le(e))},set:function(e,t,r){var n=Qr(Le(e),t);if(n!=null&&n.set)return n.set.call(e.k,r),!0;if(!e.P){var o=ir(Le(e),t),a=o==null?void 0:o[Q];if(a&&a.t===r)return e.o[t]=r,e.R[t]=!1,!0;if(Kr(r,o)&&(r!==void 0||tt(e.t,t)))return!0;ar(e),Ye(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 ir(e.t,t)!==void 0||t in e.t?(e.R[t]=!1,ar(e),Ye(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=Le(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.i!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty:function(){ne(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){ne(12)}},vt={};Ue(pt,(function(e,t){vt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),vt.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&ne(13),vt.set.call(this,e,t,void 0)},vt.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&ne(14),pt.set.call(this,e[0],t,r,e[0])};var No=(function(){function e(r){var n=this;this.O=rn,this.D=!0,this.produce=function(o,a,u){if(typeof o=="function"&&typeof a!="function"){var h=a;a=o;var p=n;return function(d){var S=this;d===void 0&&(d=h);for(var M=arguments.length,R=Array(M>1?M-1:0),T=1;T<M;T++)R[T-1]=arguments[T];return p.produce(d,(function(A){var c;return(c=a).call.apply(c,[S,A].concat(R))}))}}var l;if(typeof a!="function"&&ne(6),u!==void 0&&typeof u!="function"&&ne(7),Pe(o)){var f=Jr(n),g=sr(n,o,void 0),m=!0;try{l=a(g),m=!1}finally{m?_t(f):nr(f)}return typeof Promise<"u"&&l instanceof Promise?l.then((function(d){return rr(f,u),or(d,f)}),(function(d){throw _t(f),d})):(rr(f,u),or(l,f))}if(!o||typeof o!="object"){if((l=a(o))===void 0&&(l=o),l===nn&&(l=void 0),n.D&&Qt(l,!0),u){var x=[],y=[];xe("Patches").M(o,l,x,y),u(x,y)}return l}ne(21,o)},this.produceWithPatches=function(o,a){if(typeof o=="function")return function(l){for(var f=arguments.length,g=Array(f>1?f-1:0),m=1;m<f;m++)g[m-1]=arguments[m];return n.produceWithPatches(l,(function(x){return o.apply(void 0,[x].concat(g))}))};var u,h,p=n.produce(o,a,(function(l,f){u=l,h=f}));return typeof Promise<"u"&&p instanceof Promise?p.then((function(l){return[l,u,h]})):[p,u,h]},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){Pe(r)||ne(8),We(r)&&(r=jo(r));var n=Jr(this),o=sr(this,r,void 0);return o[Q].C=!0,nr(n),o},t.finishDraft=function(r,n){var o=r&&r[Q];process.env.NODE_ENV!=="production"&&(o&&o.C||ne(9),o.I&&ne(10));var a=o.A;return rr(a,n),or(void 0,a)},t.setAutoFreeze=function(r){this.D=r},t.setUseProxies=function(r){r&&!rn&&ne(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 u=xe("Patches").$;return We(r)?u(r,n):this.produce(r,(function(h){return u(h,n)}))},e})(),ue=new No,sn=ue.produce;ue.produceWithPatches.bind(ue),ue.setAutoFreeze.bind(ue),ue.setUseProxies.bind(ue),ue.applyPatches.bind(ue),ue.createDraft.bind(ue),ue.finishDraft.bind(ue);function yt(e){"@babel/helpers - typeof";return yt=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},yt(e)}function Ao(e,t){if(yt(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(yt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Do(e){var t=Ao(e,"string");return yt(t)=="symbol"?t:t+""}function Io(e,t,r){return(t=Do(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cn(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 ln(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cn(Object(r),!0).forEach(function(n){Io(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function oe(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 un=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),ur=function(){return Math.random().toString(36).substring(7).split("").join(".")},qe={INIT:"@@redux/INIT"+ur(),REPLACE:"@@redux/REPLACE"+ur(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+ur()}};function fn(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 zo(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(Yo(e))return"date";if(Lo(e))return"error";var r=Wo(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 Wo(e){return typeof e.constructor=="function"?e.constructor.name:null}function Lo(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Yo(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function He(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=zo(e)),t}function dn(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"?oe(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"?oe(1):"Expected the enhancer to be a function. Instead, received: '"+He(r)+"'");return r(dn)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?oe(2):"Expected the root reducer to be a function. Instead, received: '"+He(e)+"'");var o=e,a=t,u=[],h=u,p=!1;function l(){h===u&&(h=u.slice())}function f(){if(p)throw new Error(process.env.NODE_ENV==="production"?oe(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(d){if(typeof d!="function")throw new Error(process.env.NODE_ENV==="production"?oe(4):"Expected the listener to be a function. Instead, received: '"+He(d)+"'");if(p)throw new Error(process.env.NODE_ENV==="production"?oe(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 S=!0;return l(),h.push(d),function(){if(S){if(p)throw new Error(process.env.NODE_ENV==="production"?oe(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.");S=!1,l();var R=h.indexOf(d);h.splice(R,1),u=null}}}function m(d){if(!fn(d))throw new Error(process.env.NODE_ENV==="production"?oe(7):"Actions must be plain objects. Instead, the actual type was: '"+He(d)+"'. 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 d.type>"u")throw new Error(process.env.NODE_ENV==="production"?oe(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"?oe(9):"Reducers may not dispatch actions.");try{p=!0,a=o(a,d)}finally{p=!1}for(var S=u=h,M=0;M<S.length;M++){var R=S[M];R()}return d}function x(d){if(typeof d!="function")throw new Error(process.env.NODE_ENV==="production"?oe(10):"Expected the nextReducer to be a function. Instead, received: '"+He(d));o=d,m({type:qe.REPLACE})}function y(){var d,S=g;return d={subscribe:function(R){if(typeof R!="object"||R===null)throw new Error(process.env.NODE_ENV==="production"?oe(11):"Expected the observer to be an object. Instead, received: '"+He(R)+"'");function T(){R.next&&R.next(f())}T();var A=S(T);return{unsubscribe:A}}},d[un]=function(){return this},d}return m({type:qe.INIT}),n={dispatch:m,subscribe:g,getState:f,replaceReducer:x},n[un]=y,n}function hn(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function Vo(e,t,r,n){var o=Object.keys(t),a=r&&r.type===qe.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(!fn(e))return"The "+a+' has unexpected type of "'+He(e)+'". Expected argument to be an object with the following '+('keys: "'+o.join('", "')+'"');var u=Object.keys(e).filter(function(h){return!t.hasOwnProperty(h)&&!n[h]});if(u.forEach(function(h){n[h]=!0}),!(r&&r.type===qe.REPLACE)&&u.length>0)return"Unexpected "+(u.length>1?"keys":"key")+" "+('"'+u.join('", "')+'" found in '+a+". ")+"Expected to find one of the known reducer keys instead: "+('"'+o.join('", "')+'". Unexpected keys will be ignored.')}function $o(e){Object.keys(e).forEach(function(t){var r=e[t],n=r(void 0,{type:qe.INIT});if(typeof n>"u")throw new Error(process.env.NODE_ENV==="production"?oe(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:qe.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?oe(13):'The slice reducer for key "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle '"+qe.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 Fo(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"&&hn('No reducer provided for key "'+o+'"'),typeof e[o]=="function"&&(r[o]=e[o])}var a=Object.keys(r),u;process.env.NODE_ENV!=="production"&&(u={});var h;try{$o(r)}catch(p){h=p}return function(l,f){if(l===void 0&&(l={}),h)throw h;if(process.env.NODE_ENV!=="production"){var g=Vo(l,r,f,u);g&&hn(g)}for(var m=!1,x={},y=0;y<a.length;y++){var d=a[y],S=r[d],M=l[d],R=S(M,f);if(typeof R>"u"){var T=f&&f.type;throw new Error(process.env.NODE_ENV==="production"?oe(14):"When called with an action of type "+(T?'"'+String(T)+'"':"(unknown type)")+', the slice reducer for key "'+d+'" 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.')}x[d]=R,m=m||R!==M}return m=m||a.length!==Object.keys(l).length,m?x:l}}function Pt(){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 Xo(){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"?oe(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},u={getState:o.getState,dispatch:function(){return a.apply(void 0,arguments)}},h=t.map(function(p){return p(u)});return a=Pt.apply(void 0,h)(o.dispatch),ln(ln({},o),{},{dispatch:a})}}}function pn(e){var t=function(n){var o=n.dispatch,a=n.getState;return function(u){return function(h){return typeof h=="function"?h(o,a,e):u(h)}}};return t}var fr=pn();fr.withExtraArgument=pn;var vn=(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)}})(),Bo=function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,u;return u={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function h(l){return function(f){return p([l,f])}}function p(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=l[0]&2?o.return:l[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,l[1])).done)return a;switch(o=0,a&&(l=[l[0]&2,a.value]),l[0]){case 0:case 1:a=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]<a[3])){r.label=l[1];break}if(l[0]===6&&r.label<a[1]){r.label=a[1],a=l;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(l);break}a[2]&&r.ops.pop(),r.trys.pop();continue}l=t.call(e,r)}catch(f){l=[6,f],o=0}finally{n=a=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},ot=function(e,t){for(var r=0,n=t.length,o=e.length;r<n;r++,o++)e[o]=t[r];return e},Uo=Object.defineProperty,qo=Object.defineProperties,Ho=Object.getOwnPropertyDescriptors,yn=Object.getOwnPropertySymbols,Go=Object.prototype.hasOwnProperty,Ko=Object.prototype.propertyIsEnumerable,gn=function(e,t,r){return t in e?Uo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},Ve=function(e,t){for(var r in t||(t={}))Go.call(t,r)&&gn(e,r,t[r]);if(yn)for(var n=0,o=yn(t);n<o.length;n++){var r=o[n];Ko.call(t,r)&&gn(e,r,t[r])}return e},dr=function(e,t){return qo(e,Ho(t))},Jo=function(e,t,r){return new Promise(function(n,o){var a=function(p){try{h(r.next(p))}catch(l){o(l)}},u=function(p){try{h(r.throw(p))}catch(l){o(l)}},h=function(p){return p.done?n(p.value):Promise.resolve(p.value).then(a,u)};h((r=r.apply(e,t)).next())})},Zo=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Pt:Pt.apply(null,arguments)};function mn(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 Qo=function(e){return e&&typeof e.match=="function"};function $e(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 Ve(Ve({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 ei(e){return typeof e=="function"&&"type"in e&&Qo(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 ri(e){if(e===void 0&&(e={}),process.env.NODE_ENV==="production")return function(){return function(n){return function(o){return n(o)}}};var t=e.isActionCreator,r=t===void 0?ei:t;return function(){return function(n){return function(o){return r(o)&&console.warn(ti(o.type)),n(o)}}}}function bn(e,t){var r=0;return{measureTime:function(n){var o=Date.now();try{return n()}finally{var a=Date.now();r+=a-o}},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 ni=(function(e){vn(t,e);function t(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=e.apply(this,r)||this;return Object.setPrototypeOf(o,t.prototype),o}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,
|
|
95
|
-
Take a look at the logic that dispatched this action: `,
|
|
94
|
+
It is disabled in production builds, so you don't need to worry about that.`)}}}var ni=(function(e){vn(t,e);function t(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=e.apply(this,r)||this;return Object.setPrototypeOf(o,t.prototype),o}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,ot([void 0],r[0].concat(this)))):new(t.bind.apply(t,ot([void 0],r.concat(this))))},t})(Array),oi=(function(e){vn(t,e);function t(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=e.apply(this,r)||this;return Object.setPrototypeOf(o,t.prototype),o}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,ot([void 0],r[0].concat(this)))):new(t.bind.apply(t,ot([void 0],r.concat(this))))},t})(Array);function hr(e){return Pe(e)?sn(e,function(){}):e}var ii=process.env.NODE_ENV==="production",wn="Invariant failed";function xn(e,t){if(!e)throw ii?new Error(wn):new Error(wn+": "+(t||""))}function ai(e,t,r,n){return JSON.stringify(e,si(t,n),r)}function si(e,t){var r=[],n=[];return t||(t=function(o,a){return r[0]===a?"[Circular ~]":"[Circular ~."+n.slice(0,r.indexOf(a)).join(".")+"]"}),function(o,a){if(r.length>0){var u=r.indexOf(this);~u?r.splice(u+1):r.push(this),~u?n.splice(u,1/0,o):n.push(o),~r.indexOf(a)&&(a=t.call(this,o,a))}else r.push(a);return e==null?a:e.call(this,o,a)}}function ci(e){return typeof e!="object"||e==null||Object.isFrozen(e)}function li(e,t,r){var n=En(e,t,r);return{detectMutations:function(){return Sn(e,t,n,r)}}}function En(e,t,r,n,o){t===void 0&&(t=[]),n===void 0&&(n=""),o===void 0&&(o=new Set);var a={value:r};if(!e(r)&&!o.has(r)){o.add(r),a.children={};for(var u in r){var h=n?n+"."+u:u;t.length&&t.indexOf(h)!==-1||(a.children[u]=En(e,t,r[u],h))}}return a}function Sn(e,t,r,n,o,a){t===void 0&&(t=[]),o===void 0&&(o=!1),a===void 0&&(a="");var u=r?r.value:void 0,h=u===n;if(o&&!h&&!Number.isNaN(n))return{wasMutated:!0,path:a};if(e(u)||e(n))return{wasMutated:!1};var p={};for(var l in r.children)p[l]=!0;for(var l in n)p[l]=!0;var f=t.length>0,g=function(x){var y=a?a+"."+x:x;if(f){var d=t.some(function(M){return M instanceof RegExp?M.test(y):y===M});if(d)return"continue"}var S=Sn(e,t,r.children[x],n[x],h,y);if(S.wasMutated)return{value:S}};for(var l in p){var m=g(l);if(typeof m=="object")return m.value}return{wasMutated:!1}}function ui(e){if(e===void 0&&(e={}),process.env.NODE_ENV==="production")return function(){return function(p){return function(l){return p(l)}}};var t=e.isImmutable,r=t===void 0?ci:t,n=e.ignoredPaths,o=e.warnAfter,a=o===void 0?32:o,u=e.ignore;n=n||u;var h=li.bind(null,r,n);return function(p){var l=p.getState,f=l(),g=h(f),m;return function(x){return function(y){var d=bn(a,"ImmutableStateInvariantMiddleware");d.measureTime(function(){f=l(),m=g.detectMutations(),g=h(f),xn(!m.wasMutated,"A state mutation was detected between dispatches, in the path '"+(m.path||"")+"'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)")});var S=x(y);return d.measureTime(function(){f=l(),m=g.detectMutations(),g=h(f),m.wasMutated&&xn(!m.wasMutated,"A state mutation was detected inside a dispatch, in the path: "+(m.path||"")+". Take a look at the reducer(s) handling the action "+ai(y)+". (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)")}),d.warnIfExceeded(),S}}}}function Cn(e){var t=typeof e;return e==null||t==="string"||t==="boolean"||t==="number"||Array.isArray(e)||mn(e)}function pr(e,t,r,n,o,a){t===void 0&&(t=""),r===void 0&&(r=Cn),o===void 0&&(o=[]);var u;if(!r(e))return{keyPath:t||"<root>",value:e};if(typeof e!="object"||e===null||a!=null&&a.has(e))return!1;for(var h=n!=null?n(e):Object.entries(e),p=o.length>0,l=function(S,M){var R=t?t+"."+S:S;if(p){var T=o.some(function(A){return A instanceof RegExp?A.test(R):R===A});if(T)return"continue"}if(!r(M))return{value:{keyPath:R,value:M}};if(typeof M=="object"&&(u=pr(M,R,r,n,o,a),u))return{value:u}},f=0,g=h;f<g.length;f++){var m=g[f],x=m[0],y=m[1],d=l(x,y);if(typeof d=="object")return d.value}return a&&_n(e)&&a.add(e),!1}function _n(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)&&!_n(n))return!1}return!0}function fi(e){if(e===void 0&&(e={}),process.env.NODE_ENV==="production")return function(){return function(T){return function(A){return T(A)}}};var t=e.isSerializable,r=t===void 0?Cn:t,n=e.getEntries,o=e.ignoredActions,a=o===void 0?[]:o,u=e.ignoredActionPaths,h=u===void 0?["meta.arg","meta.baseQueryMeta"]:u,p=e.ignoredPaths,l=p===void 0?[]:p,f=e.warnAfter,g=f===void 0?32:f,m=e.ignoreState,x=m===void 0?!1:m,y=e.ignoreActions,d=y===void 0?!1:y,S=e.disableCache,M=S===void 0?!1:S,R=!M&&WeakSet?new WeakSet:void 0;return function(T){return function(A){return function(c){var N=A(c),O=bn(g,"SerializableStateInvariantMiddleware");return!d&&!(a.length&&a.indexOf(c.type)!==-1)&&O.measureTime(function(){var V=pr(c,"",r,n,h,R);if(V){var ee=V.keyPath,K=V.value;console.error("A non-serializable value was detected in an action, in the path: `"+ee+"`. Value:",K,`
|
|
95
|
+
Take a look at the logic that dispatched this action: `,c,`
|
|
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)`)}}),
|
|
98
|
-
Take a look at the reducer(s) handling this action type: `+
|
|
99
|
-
(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}}),X.warnIfExceeded()),_}}}}function Rt(e){return typeof e=="boolean"}function di(){return function(t){return hi(t)}}function hi(e){e===void 0&&(e={});var t=e.thunk,r=t===void 0?!0:t,n=e.immutableCheck,o=n===void 0?!0:n,i=e.serializableCheck,l=i===void 0?!0:i,d=e.actionCreatorCheck,h=d===void 0?!0:d,c=new ni;if(r&&(Rt(r)?c.push(fr):c.push(fr.withExtraArgument(r.extraArgument))),process.env.NODE_ENV!=="production"){if(o){var v={};Rt(o)||(v=o),c.unshift(ui(v))}if(l){var f={};Rt(l)||(f=l),c.push(fi(f))}if(h){var w={};Rt(h)||(w=h),c.unshift(ri(w))}}return c}var vr=process.env.NODE_ENV==="production";function pi(e){var t=di(),r=e||{},n=r.reducer,o=n===void 0?void 0:n,i=r.middleware,l=i===void 0?t():i,d=r.devTools,h=d===void 0?!0:d,c=r.preloadedState,v=c===void 0?void 0:c,f=r.enhancers,w=f===void 0?void 0:f,p;if(typeof o=="function")p=o;else if(mn(o))p=Fo(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 u=l;if(typeof u=="function"&&(u=u(t),!vr&&!Array.isArray(u)))throw new Error("when using a middleware builder function, an array of middleware must be returned");if(!vr&&u.some(function(m){return typeof m!="function"}))throw new Error("each middleware provided to configureStore must be a function");var x=Xo.apply(void 0,u),S=kt;h&&(S=Zo(Ve({trace:!vr},typeof h=="object"&&h)));var T=new oi(x),A=T;Array.isArray(w)?A=at([x],w):typeof w=="function"&&(A=w(T));var M=S.apply(void 0,A);return dn(p,v,M)}function On(e){var t={},r=[],n,o={addCase:function(i,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 d=typeof i=="string"?i:i.type;if(!d)throw new Error("`builder.addCase` cannot be called with an empty action type");if(d in t)throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");return t[d]=l,o},addMatcher:function(i,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:i,reducer:l}),o},addDefaultCase:function(i){if(process.env.NODE_ENV!=="production"&&n)throw new Error("`builder.addDefaultCase` can only be called once");return n=i,o}};return e(o),[t,r,n]}function vi(e){return typeof e=="function"}var jn=!1;function yi(e,t,r,n){r===void 0&&(r=[]),process.env.NODE_ENV!=="production"&&typeof t=="object"&&(jn||(jn=!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"?On(t):[t,r,n],i=o[0],l=o[1],d=o[2],h;if(vi(e))h=function(){return hr(e())};else{var c=hr(e);h=function(){return c}}function v(f,w){f===void 0&&(f=h());var p=at([i[w.type]],l.filter(function(u){var x=u.matcher;return x(w)}).map(function(u){var x=u.reducer;return x}));return p.filter(function(u){return!!u}).length===0&&(p=[d]),p.reduce(function(u,x){if(x)if(We(u)){var S=u,T=x(S,w);return T===void 0?u:T}else{if(ke(u))return sn(u,function(A){return x(A,w)});var T=x(u,w);if(T===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return T}return u},f)}return v.getInitialState=h,v}var Pn=!1;function gi(e,t){return e+"/"+t}function mi(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:hr(e.initialState),n=e.reducers||{},o=Object.keys(n),i={},l={},d={};o.forEach(function(v){var f=n[v],w=gi(t,v),p,u;"reducer"in f?(p=f.reducer,u=f.prepare):p=f,i[v]=p,l[w]=p,d[v]=u?$e(w,u):$e(w)});function h(){process.env.NODE_ENV!=="production"&&typeof e.extraReducers=="object"&&(Pn||(Pn=!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"?On(e.extraReducers):[e.extraReducers],f=v[0],w=f===void 0?{}:f,p=v[1],u=p===void 0?[]:p,x=v[2],S=x===void 0?void 0:x,T=Ve(Ve({},w),l);return yi(r,function(A){for(var M in T)A.addCase(M,T[M]);for(var m=0,b=u;m<b.length;m++){var _=b[m];A.addMatcher(_.matcher,_.reducer)}S&&A.addDefaultCase(S)})}var c;return{name:t,reducer:function(v,f){return c||(c=h()),c(v,f)},actions:d,caseReducers:i,getInitialState:function(){return c||(c=h()),c.getInitialState()}}}var bi="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",wi=function(e){e===void 0&&(e=21);for(var t="",r=e;r--;)t+=bi[Math.random()*64|0];return t},xi=["name","message","stack","code"],yr=(function(){function e(t,r){this.payload=t,this.meta=r}return e})(),Tn=(function(){function e(t,r){this.payload=t,this.meta=r}return e})(),Ei=function(e){if(typeof e=="object"&&e!==null){for(var t={},r=0,n=xi;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=$e(t+"/fulfilled",function(v,f,w,p){return{payload:v,meta:dr(Ve({},p||{}),{arg:w,requestId:f,requestStatus:"fulfilled"})}}),i=$e(t+"/pending",function(v,f,w){return{payload:void 0,meta:dr(Ve({},w||{}),{arg:f,requestId:v,requestStatus:"pending"})}}),l=$e(t+"/rejected",function(v,f,w,p,u){return{payload:p,error:(n&&n.serializeError||Ei)(v||"Rejected"),meta:dr(Ve({},u||{}),{arg:w,requestId:f,rejectedWithValue:!!p,requestStatus:"rejected",aborted:(v==null?void 0:v.name)==="AbortError",condition:(v==null?void 0:v.name)==="ConditionError"})}}),d=!1,h=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"&&(d||(d=!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(f,w,p){var u=n!=null&&n.idGenerator?n.idGenerator(v):wi(),x=new h,S;function T(M){S=M,x.abort()}var A=(function(){return Jo(this,null,function(){var M,m,b,_,X,$,ee;return Bo(this,function(ne){switch(ne.label){case 0:return ne.trys.push([0,4,,5]),_=(M=n==null?void 0:n.condition)==null?void 0:M.call(n,v,{getState:w,extra:p}),Ci(_)?[4,_]:[3,2];case 1:_=ne.sent(),ne.label=2;case 2:if(_===!1||x.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return X=new Promise(function(Z,G){return x.signal.addEventListener("abort",function(){return G({name:"AbortError",message:S||"Aborted"})})}),f(i(u,v,(m=n==null?void 0:n.getPendingMeta)==null?void 0:m.call(n,{requestId:u,arg:v},{getState:w,extra:p}))),[4,Promise.race([X,Promise.resolve(r(v,{dispatch:f,getState:w,extra:p,requestId:u,signal:x.signal,abort:T,rejectWithValue:function(Z,G){return new yr(Z,G)},fulfillWithValue:function(Z,G){return new Tn(Z,G)}})).then(function(Z){if(Z instanceof yr)throw Z;return Z instanceof Tn?o(Z.payload,u,v,Z.meta):o(Z,u,v)})])];case 3:return b=ne.sent(),[3,5];case 4:return $=ne.sent(),b=$ instanceof yr?l(null,u,v,$.payload,$.meta):l($,u,v),[3,5];case 5:return ee=n&&!n.dispatchConditionRejection&&l.match(b)&&b.meta.condition,ee||f(b),[2,b]}})})})();return Object.assign(A,{abort:T,requestId:u,arg:v,unwrap:function(){return A.then(Si)}})}}return Object.assign(c,{pending:i,rejected:l,fulfilled:o,typePrefix:t})}return e.withTypes=function(){return e},e})();function Si(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Ci(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var gr="listenerMiddleware";$e(gr+"/add"),$e(gr+"/removeAll"),$e(gr+"/remove");var Mn;typeof queueMicrotask=="function"&&queueMicrotask.bind(typeof window<"u"?window:typeof global<"u"?global:globalThis),Po();const kn=mi({name:"whiteboard",initialState:{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:[],selectedElementId:null,viewport:{panX:0,panY:0,zoom:1},watermark:{text:"Nines Studios",url:"https://github.com/huzeyfecoskun",visible:!0},lock:{isLocked:!0,text:"Whiteboard drawing is only for moderator"}},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){e.elements.push(t.payload)},updateElement(e,t){const{id:r,updates:n}=t.payload,o=e.elements.findIndex(i=>i.id===r);o!==-1&&(e.elements[o]={...e.elements[o],...n})},removeElement(e,t){const r=t.payload;e.elements=e.elements.filter(n=>n.id!==r),e.selectedElementId===r&&(e.selectedElementId=null)},setSelectedElement(e,t){e.selectedElementId=t.payload},clearElements(e){e.elements=[]},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,i=e.elements;if(i.length===0){e.viewport.panX=0,e.viewport.panY=0,e.viewport.zoom=1;return}let l=1/0,d=1/0,h=-1/0,c=-1/0;i.forEach(b=>{b.type==="rectangle"?(l=Math.min(l,b.x),d=Math.min(d,b.y),h=Math.max(h,b.x+b.width),c=Math.max(c,b.y+b.height)):b.type==="circle"?(l=Math.min(l,b.centerX-b.radius),d=Math.min(d,b.centerY-b.radius),h=Math.max(h,b.centerX+b.radius),c=Math.max(c,b.centerY+b.radius)):b.type==="pencil"&&b.points.length>0?b.points.forEach(_=>{l=Math.min(l,_.x),d=Math.min(d,_.y),h=Math.max(h,_.x),c=Math.max(c,_.y)}):b.type==="triangle"||b.type==="diamond"||b.type==="hexagon"||b.type==="octagon"?(l=Math.min(l,b.x),d=Math.min(d,b.y),h=Math.max(h,b.x+b.width),c=Math.max(c,b.y+b.height)):b.type==="star"||b.type==="heart"?(l=Math.min(l,b.centerX-b.size),d=Math.min(d,b.centerY-b.size),h=Math.max(h,b.centerX+b.size),c=Math.max(c,b.centerY+b.size)):b.type==="arrow"&&(l=Math.min(l,b.startX,b.endX),d=Math.min(d,b.startY,b.endY),h=Math.max(h,b.startX,b.endX),c=Math.max(c,b.startY,b.endY))});const v=h-l,f=c-d;if(v<=0||f<=0)return;const w=r-o*2,p=n-o*2,u=w/v,x=p/f,S=Math.min(u,x,5),T=(l+h)/2,A=(d+c)/2,M=r/2-T*S,m=n/2-A*S;e.viewport.zoom=Math.max(.1,S),e.viewport.panX=M,e.viewport.panY=m},setLocked(e,t){e.lock.isLocked=t.payload,t.payload&&(e.toolbar.selectedTool="pointer",e.selectedElementId=null)},setWatermarkEnabled(e,t){e.watermark.visible=t.payload},setWatermarkText(e,t){e.watermark.text=t.payload}}}),{setSelectedTool:Re,setToolProperty:_i,addElement:ve,updateElement:Nt,removeElement:Oi,setSelectedElement:gt,setPan:ji,setZoom:Pi,fitToView:Ti,bringToFront:Mi,sendToBack:ki,setLocked:Rn,setWatermarkEnabled:Ri,setWatermarkText:Ni}=kn.actions,Nn=kn.reducer;let mr=null;const Ai=e=>{mr=e},Di=e=>t=>r=>{var o;const n=t(r);return!((o=r.meta)!=null&&o.fromRemote)&&mr&&mr(r),n},An=pi({reducer:{whiteboard:Nn},middleware:e=>e().concat(Di)}),Ii=()=>{const e=le(t=>t.whiteboard.watermark);return g.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:g.jsx("div",{className:"wb-watermark",children:e.text})})};var Dn={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},In=N.createContext&&N.createContext(Dn),zi=["attr","size","title"];function Wi(e,t){if(e==null)return{};var r=Li(e,t),n,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Li(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 At(){return At=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},At.apply(this,arguments)}function zn(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 Dt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zn(Object(r),!0).forEach(function(n){Yi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Yi(e,t,r){return t=Vi(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Vi(e){var t=$i(e,"string");return typeof t=="symbol"?t:t+""}function $i(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 Wn(e){return e&&e.map((t,r)=>N.createElement(t.tag,Dt({key:r},t.attr),Wn(t.child)))}function Q(e){return t=>N.createElement(Fi,At({attr:Dt({},e.attr)},t),Wn(e.child))}function Fi(e){var t=r=>{var{attr:n,size:o,title:i}=e,l=Wi(e,zi),d=o||r.size||"1em",h;return r.className&&(h=r.className),e.className&&(h=(h?h+" ":"")+e.className),N.createElement("svg",At({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,l,{className:h,style:Dt(Dt({color:e.color||r.color},r.style),e.style),height:d,width:d,xmlns:"http://www.w3.org/2000/svg"}),i&&N.createElement("title",null,i),e.children)};return In!==void 0?N.createElement(In.Consumer,null,r=>t(r)):t(Dn)}function Xi(e){return Q({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 Bi(e){return Q({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 Ui(e){return Q({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 qi(e){return Q({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 Hi(e){return Q({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 Gi(e){return Q({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 Ki(e){return Q({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 Ji(e){return Q({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 Zi(e){return Q({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 Qi(e){return Q({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 ea(e){return Q({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 ta(e){return Q({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 ra(e){return Q({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)}const na=({text:e})=>g.jsxs("div",{style:{position:"absolute",top:"10px",left:"10px",backgroundColor:"rgba(255, 68, 68, 0.9)",color:"white",padding:"8px 16px",borderRadius:"4px",display:"flex",alignItems:"center",gap:"8px",boxShadow:"0 2px 4px rgba(0,0,0,0.2)",zIndex:1e3,pointerEvents:"none",userSelect:"none",fontFamily:"sans-serif",fontSize:"14px",fontWeight:"500"},children:[g.jsx(Ki,{}),g.jsx("span",{children:e||"Locked"})]});function oa(e){return Q({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 ia(e){return Q({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 aa(e){return Q({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 sa(e){return Q({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 ca(e){return Q({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 la(e){return Q({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 ua(e){return Q({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 fa(e){return Q({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 da=({onExport:e})=>{const t=Gt(),{t:r,language:n,changeLanguage:o}=Hr(),i=le(m=>m.whiteboard.toolbar.selectedTool),l=le(m=>m.whiteboard.lock.isLocked),[d,h]=N.useState(!1),[c,v]=N.useState(!1),f=N.useRef(null),w=N.useRef(null),p=N.useRef(null),u=N.useRef(null),x=N.useRef(null),S=m=>{const b=m.target.files[0];if(!b)return;const _=new FileReader;_.onload=X=>{const $=new Image;$.onload=()=>{const ee=Date.now().toString();t(ve({id:ee,type:"image",x:100,y:100,width:$.width,height:$.height,src:X.target.result})),t(Re("pointer")),t(gt(ee))},$.src=X.target.result},_.readAsDataURL(b),m.target.value=""};N.useEffect(()=>{const m=b=>{f.current&&!f.current.contains(b.target)&&w.current&&!w.current.contains(b.target)&&h(!1),u.current&&!u.current.contains(b.target)&&p.current&&!p.current.contains(b.target)&&v(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const T=[{name:"triangle",icon:g.jsx(Qi,{style:{transform:"rotate(-30deg)"}})},{name:"diamond",icon:g.jsx(ia,{})},{name:"star",icon:g.jsx(ra,{})},{name:"heart",icon:g.jsx(Hi,{})},{name:"hexagon",icon:g.jsx(ua,{})},{name:"octagon",icon:g.jsx(fa,{})},{name:"arrow",icon:g.jsx(oa,{})}],A=m=>{t(Re(m)),h(!1)},M=m=>{o(m),v(!1)};return g.jsxs("div",{className:"wb-toolbar",children:[g.jsx("button",{className:i==="pointer"?"wb-active":"",onClick:()=>t(Re("pointer")),title:r("pointer"),disabled:l,children:g.jsx(Ji,{})}),g.jsx("button",{className:i==="text"?"wb-active":"",onClick:()=>t(Re("text")),title:r("text"),disabled:l,children:g.jsx(ca,{})}),g.jsx("button",{onClick:()=>{var m;return(m=x.current)==null?void 0:m.click()},title:r("image"),disabled:l,children:g.jsx(Gi,{})}),g.jsx("input",{type:"file",ref:x,style:{display:"none"},accept:"image/*",onChange:S}),g.jsx("button",{className:i==="pencil"?"wb-active":"",onClick:()=>t(Re("pencil")),title:r("pencil"),disabled:l,children:g.jsx(Zi,{})}),g.jsx("button",{className:i==="rectangle"?"wb-active":"",onClick:()=>t(Re("rectangle")),title:r("rectangle"),disabled:l,children:g.jsx(ta,{})}),g.jsx("button",{className:i==="circle"?"wb-active":"",onClick:()=>t(Re("circle")),title:r("circle"),disabled:l,children:g.jsx(Xi,{})}),g.jsxs("div",{className:"wb-ellipsis-container",children:[g.jsx("button",{ref:w,className:T.some(m=>m.name===i)?"wb-active":"",onClick:()=>h(!d),title:r("moreShapes"),disabled:l,children:g.jsx(aa,{})}),d&&g.jsxs("div",{className:"wb-shapes-popup",ref:f,children:[g.jsx("div",{className:"wb-shapes-popup-header",children:r("moreShapes")}),g.jsx("div",{className:"wb-shapes-popup-grid",children:T.map(m=>g.jsx("button",{className:i===m.name?"wb-active":"",onClick:()=>A(m.name),title:r(m.name),children:m.icon},m.name))})]})]}),g.jsx("button",{className:i==="eraser"?"wb-active":"",onClick:()=>t(Re("eraser")),title:r("eraser"),disabled:l,children:g.jsx(Bi,{})}),g.jsx("button",{onClick:()=>t(Ti({canvasWidth:window.innerWidth,canvasHeight:window.innerHeight,padding:50})),title:r("fitToView"),children:g.jsx(Ui,{})}),g.jsx("button",{onClick:e,title:r("exportAsPng"),children:g.jsx(ea,{})}),g.jsxs("div",{className:"wb-language-container",children:[g.jsx("button",{ref:p,onClick:()=>v(!c),title:r("language"),children:g.jsx(qi,{})}),c&&g.jsxs("div",{className:"wb-language-popup",ref:u,children:[g.jsx("div",{className:"wb-language-popup-header",children:r("language")}),g.jsxs("div",{className:"wb-language-options",children:[g.jsxs("button",{className:n==="en"?"wb-active":"",onClick:()=>M("en"),children:["πΊπΈ ",r("english")]}),g.jsxs("button",{className:n==="tr"?"wb-active":"",onClick:()=>M("tr"),children:["πΉπ· ",r("turkish")]})]})]})]}),g.jsx("button",{onClick:()=>t(Rn(!l)),title:l?"Unlock":"Lock",style:{color:l?"red":"inherit"},children:l?g.jsx(sa,{}):g.jsx(la,{})})]})},ha=()=>{const e=Gt(),{t}=Hr(),r=le(f=>f.whiteboard.toolbar.selectedTool),n=le(f=>f.whiteboard.toolProperties),o=le(f=>f.whiteboard.selectedElementId),i=le(f=>f.whiteboard.elements),l=o?i.find(f=>f.id===o):null,d=(f,w,p)=>{e(_i({tool:f,property:w,value:p}))},h=(f,w)=>{o&&e(Nt({id:o,updates:{[f]:w}}))},c=()=>{o&&e(Mi(o))},v=()=>{o&&e(ki(o))};if(r==="pointer"&&l&&l.type==="text")return g.jsxs("div",{className:"wb-prop-tools",children:[g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("fontSize")}),g.jsxs("select",{className:"font-size-selector",value:l.fontSize||16,onChange:f=>h("fontSize",parseInt(f.target.value)),children:[g.jsx("option",{value:"12",children:"12 px"}),g.jsx("option",{value:"14",children:"14 px"}),g.jsx("option",{value:"16",children:"16 px"}),g.jsx("option",{value:"18",children:"18 px"}),g.jsx("option",{value:"24",children:"24 px"}),g.jsx("option",{value:"32",children:"32 px"}),g.jsx("option",{value:"48",children:"48 px"}),g.jsx("option",{value:"64",children:"64 px"}),g.jsx("option",{value:"72",children:"72 px"})]})]}),g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("fontColor")}),g.jsx("input",{type:"color",value:l.fontColor||"#000000",onChange:f=>h("fontColor",f.target.value)})]}),g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("layerOrder")}),g.jsxs("div",{className:"wb-layer-buttons",children:[g.jsx("button",{onClick:c,title:t("bringToFront"),children:g.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[g.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),g.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"white"})]})}),g.jsx("button",{onClick:v,title:t("sendToBack"),children:g.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[g.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),g.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"white"})]})})]})]})]});if(r==="pointer"&&l){const f=["rectangle","circle","triangle","diamond","star","heart","hexagon","octagon","arrow"].includes(l.type),w=l.type==="pencil";return g.jsxs("div",{className:"wb-prop-tools",children:[f&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("strokeColor")}),g.jsx("input",{type:"color",value:l.strokeColor,onChange:p=>h("strokeColor",p.target.value)})]}),g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("fillColor")}),g.jsx("input",{type:"color",value:l.fillColor,onChange:p=>h("fillColor",p.target.value)})]}),g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("strokeWidth")}),g.jsxs("select",{className:"stroke-width-selector",value:l.lineWidth,onChange:p=>h("lineWidth",parseInt(p.target.value)),children:[g.jsx("option",{value:"1",children:"1 px"}),g.jsx("option",{value:"2",children:"2 px"}),g.jsx("option",{value:"4",children:"4 px"}),g.jsx("option",{value:"8",children:"8 px"})]})]})]}),w&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("brushColor")}),g.jsx("input",{type:"color",value:l.strokeColor,onChange:p=>h("strokeColor",p.target.value)})]}),g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("brushSize")}),g.jsxs("select",{className:"brush-size-selector",value:l.lineWidth,onChange:p=>h("lineWidth",parseInt(p.target.value)),children:[g.jsx("option",{value:"1",children:"1 px"}),g.jsx("option",{value:"2",children:"2 px"}),g.jsx("option",{value:"4",children:"4 px"}),g.jsx("option",{value:"8",children:"8 px"}),g.jsx("option",{value:"16",children:"16 px"})]})]})]}),g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("layerOrder")}),g.jsxs("div",{className:"wb-layer-buttons",children:[g.jsx("button",{onClick:c,title:t("bringToFront"),children:g.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[g.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),g.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"white"})]})}),g.jsx("button",{onClick:v,title:t("sendToBack"),children:g.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[g.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),g.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"white"})]})})]})]})]})}return g.jsxs("div",{className:"wb-prop-tools",children:[r==="text"&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("fontSize")}),g.jsxs("select",{className:"font-size-selector",value:n.text.fontSize,onChange:f=>d("text","fontSize",parseInt(f.target.value)),children:[g.jsx("option",{value:"12",children:"12 px"}),g.jsx("option",{value:"14",children:"14 px"}),g.jsx("option",{value:"16",children:"16 px"}),g.jsx("option",{value:"18",children:"18 px"}),g.jsx("option",{value:"24",children:"24 px"}),g.jsx("option",{value:"32",children:"32 px"}),g.jsx("option",{value:"48",children:"48 px"}),g.jsx("option",{value:"64",children:"64 px"}),g.jsx("option",{value:"72",children:"72 px"})]})]}),g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("fontColor")}),g.jsx("input",{type:"color",value:n.text.fontColor,onChange:f=>d("text","fontColor",f.target.value)})]})]}),r==="pencil"&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("brushColor")}),g.jsx("input",{type:"color",value:n.pencil.strokeColor,onChange:f=>d("pencil","strokeColor",f.target.value)})]}),g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("brushSize")}),g.jsxs("select",{className:"brush-size-selector",value:n.pencil.lineWidth,onChange:f=>d("pencil","lineWidth",parseInt(f.target.value)),children:[g.jsx("option",{value:"1",children:"1 px"}),g.jsx("option",{value:"2",children:"2 px"}),g.jsx("option",{value:"4",children:"4 px"}),g.jsx("option",{value:"8",children:"8 px"}),g.jsx("option",{value:"16",children:"16 px"})]})]})]}),(r==="rectangle"||r==="circle"||r==="triangle"||r==="diamond"||r==="star"||r==="heart"||r==="hexagon"||r==="octagon"||r==="arrow")&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("strokeColor")}),g.jsx("input",{type:"color",value:n[r].strokeColor,onChange:f=>d(r,"strokeColor",f.target.value)})]}),g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("fillColor")}),g.jsx("input",{type:"color",value:n[r].fillColor,onChange:f=>d(r,"fillColor",f.target.value)})]}),g.jsxs("div",{className:"wb-prop-tool-item",children:[g.jsx("span",{children:t("strokeWidth")}),g.jsxs("select",{className:"stroke-width-selector",value:n[r].lineWidth,onChange:f=>d(r,"lineWidth",parseInt(f.target.value)),children:[g.jsx("option",{value:"1",children:"1 px"}),g.jsx("option",{value:"2",children:"2 px"}),g.jsx("option",{value:"4",children:"4 px"}),g.jsx("option",{value:"8",children:"8 px"})]})]})]})]})},Ln=N.forwardRef(({onAction:e,watermark:t,isLocked:r,lockText:n,onLockChange:o,isWatermarkEnabled:i,watermarkText:l},d)=>{var Et;const h=N.useRef(null),c=Gt(),v=le(a=>a.whiteboard.grid),f=le(a=>a.whiteboard.toolbar.selectedTool),w=le(a=>a.whiteboard.elements),p=le(a=>a.whiteboard.viewport),u=le(a=>a.whiteboard.toolProperties),x=le(a=>a.whiteboard.selectedElementId),S=le(a=>a.whiteboard.lock),T=S.isLocked,[A,M]=N.useState(!1),[m,b]=N.useState({x:0,y:0}),[_,X]=N.useState({x:0,y:0}),[$,ee]=N.useState([]),[ne,Z]=N.useState(!1),[G,ue]=N.useState({x:0,y:0}),[ae,ye]=N.useState(!1),[Se,Ce]=N.useState(!1),[ge,we]=N.useState(!1),[_e,Fe]=N.useState({x:0,y:0}),[Ne,Xe]=N.useState({y:0,initialZoom:1}),[Be,Oe]=N.useState(!1),[je,Ae]=N.useState({x:0,y:0}),[fe,he]=N.useState(""),[pe,Pe]=N.useState(null);N.useEffect(()=>{e&&Ai(e)},[e]),N.useImperativeHandle(d,()=>({canvas:h.current,applyAction:a=>{c({...a,meta:{...a.meta,fromRemote:!0}})}})),N.useEffect(()=>{r!==void 0&&r!==T&&c(Rn(r))},[r,T,c]),N.useEffect(()=>{o&&o(T)},[T,o]);const I=le(a=>a.whiteboard.watermark);N.useEffect(()=>{i!==void 0&&i!==I.visible&&c(Ri(i))},[i,I.visible,c]),N.useEffect(()=>{l!==void 0&&l!==I.text&&c(Ni(l))},[l,I.text,c]);const xe=N.useCallback((a,y,C)=>{const E=a.canvas,k=E.width,P=E.height,D=Math.floor(-p.panX/p.zoom/y)*y,j=Math.floor(-p.panY/p.zoom/y)*y,s=Math.ceil((k/p.zoom-p.panX/p.zoom)/y)*y,O=Math.ceil((P/p.zoom-p.panY/p.zoom)/y)*y;a.strokeStyle=C,a.lineWidth=.5/p.zoom;for(let R=D;R<=s;R+=y)a.beginPath(),a.moveTo(R,j),a.lineTo(R,O),a.stroke();for(let R=j;R<=O;R+=y)a.beginPath(),a.moveTo(D,R),a.lineTo(s,R),a.stroke()},[p]),W=N.useCallback((a,y,C)=>{const E=Math.min(y.x,C.x),k=Math.min(y.y,C.y),P=Math.abs(C.x-y.x),D=Math.abs(C.y-y.y);a.strokeStyle="#0066cc",a.lineWidth=1,a.setLineDash([5,5]),a.strokeRect(E,k,P,D),a.fillStyle="rgba(0, 102, 204, 0.1)",a.fillRect(E,k,P,D),a.setLineDash([])},[]),se=N.useCallback((a,y)=>{const{x:C,y:E,width:k,height:P,fillColor:D="#000",strokeColor:j="#000",lineWidth:s=2}=y;a.fillStyle=D,a.fillRect(C,E,k,P),a.strokeStyle=j,a.lineWidth=s,a.strokeRect(C,E,k,P)},[]),me=N.useCallback((a,y)=>{const{centerX:C,centerY:E,radius:k,fillColor:P="#000",strokeColor:D="#000",lineWidth:j=2}=y;a.beginPath(),a.arc(C,E,k,0,Math.PI*2),a.fillStyle=P,a.fill(),a.strokeStyle=D,a.lineWidth=j,a.stroke()},[]),Te=N.useCallback((a,y)=>{const{points:C,strokeColor:E="#000",lineWidth:k=2}=y;if(!(C.length<2)){a.strokeStyle=E,a.lineWidth=k,a.lineCap="round",a.lineJoin="round",a.beginPath(),a.moveTo(C[0].x,C[0].y);for(let P=1;P<C.length;P++)a.lineTo(C[P].x,C[P].y);a.stroke()}},[]),Ke=N.useCallback((a,y)=>{const{x:C,y:E,text:k,fontSize:P=16,fontColor:D="#000"}=y;a.font=`${P}px sans-serif`,a.fillStyle=D,a.textBaseline="top",a.fillText(k,C,E)},[]),st=N.useCallback((a,y)=>{const{x:C,y:E,width:k,height:P,fillColor:D="#fff",strokeColor:j="#000",lineWidth:s=2}=y;a.beginPath(),a.moveTo(C+k/2,E),a.lineTo(C+k,E+P),a.lineTo(C,E+P),a.closePath(),a.fillStyle=D,a.fill(),a.strokeStyle=j,a.lineWidth=s,a.stroke()},[]),Je=N.useCallback((a,y)=>{const{x:C,y:E,width:k,height:P,fillColor:D="#fff",strokeColor:j="#000",lineWidth:s=2}=y;a.beginPath(),a.moveTo(C+k/2,E),a.lineTo(C+k,E+P/2),a.lineTo(C+k/2,E+P),a.lineTo(C,E+P/2),a.closePath(),a.fillStyle=D,a.fill(),a.strokeStyle=j,a.lineWidth=s,a.stroke()},[]),Ue=N.useCallback((a,y)=>{const{centerX:C,centerY:E,size:k,fillColor:P="#ffff00",strokeColor:D="#000",lineWidth:j=2}=y,s=5,O=k,R=k/2;a.beginPath();for(let z=0;z<s*2;z++){const F=z%2===0?O:R,L=Math.PI/s*z-Math.PI/2,Y=C+Math.cos(L)*F,V=E+Math.sin(L)*F;z===0?a.moveTo(Y,V):a.lineTo(Y,V)}a.closePath(),a.fillStyle=P,a.fill(),a.strokeStyle=D,a.lineWidth=j,a.stroke()},[]),ct=N.useCallback((a,y)=>{const{centerX:C,centerY:E,size:k,fillColor:P="#ff6b6b",strokeColor:D="#000",lineWidth:j=2}=y;a.beginPath();const s=E-k/2;a.moveTo(C,s+k/4),a.bezierCurveTo(C-k/2,s,C-k,s+k/2,C,E+k/2),a.bezierCurveTo(C+k,s+k/2,C+k/2,s,C,s+k/4),a.fillStyle=P,a.fill(),a.strokeStyle=D,a.lineWidth=j,a.stroke()},[]),Ze=N.useCallback((a,y)=>{const{x:C,y:E,width:k,height:P,fillColor:D="#fff",strokeColor:j="#000",lineWidth:s=2}=y,O=C+k/2,R=E+P/2,z=k/2,F=P/2;a.beginPath();for(let L=0;L<6;L++){const Y=Math.PI/3*L-Math.PI/2,V=O+Math.cos(Y)*z,J=R+Math.sin(Y)*F;L===0?a.moveTo(V,J):a.lineTo(V,J)}a.closePath(),a.fillStyle=D,a.fill(),a.strokeStyle=j,a.lineWidth=s,a.stroke()},[]),Qe=N.useCallback((a,y)=>{const{x:C,y:E,width:k,height:P,fillColor:D="#fff",strokeColor:j="#000",lineWidth:s=2}=y,O=C+k/2,R=E+P/2,z=k/2,F=P/2;a.beginPath();for(let L=0;L<8;L++){const Y=Math.PI/4*L-Math.PI/2,V=O+Math.cos(Y)*z,J=R+Math.sin(Y)*F;L===0?a.moveTo(V,J):a.lineTo(V,J)}a.closePath(),a.fillStyle=D,a.fill(),a.strokeStyle=j,a.lineWidth=s,a.stroke()},[]),lt=N.useCallback((a,y)=>{const{startX:C,startY:E,endX:k,endY:P,fillColor:D="#000",strokeColor:j="#000",lineWidth:s=2}=y,O=15,R=Math.atan2(P-E,k-C);a.beginPath(),a.moveTo(C,E),a.lineTo(k,P),a.strokeStyle=j,a.lineWidth=s,a.stroke(),a.beginPath(),a.moveTo(k,P),a.lineTo(k-O*Math.cos(R-Math.PI/6),P-O*Math.sin(R-Math.PI/6)),a.lineTo(k-O*Math.cos(R+Math.PI/6),P-O*Math.sin(R+Math.PI/6)),a.closePath(),a.fillStyle=D,a.fill()},[]),ut=N.useRef({}),mt=N.useRef(null),It=N.useCallback((a,y)=>{const{x:C,y:E,width:k,height:P,src:D}=y;if(ut.current[D]){const j=ut.current[D];j.complete&&a.drawImage(j,C,E,k,P)}else{const j=new Image;j.onload=()=>{ut.current[D]=j,mt.current&&mt.current()},j.src=D,ut.current[D]=j}},[]),ft=N.useCallback((a,y)=>{switch(y.type){case"rectangle":se(a,y);break;case"circle":me(a,y);break;case"pencil":Te(a,y);break;case"text":Ke(a,y);break;case"triangle":st(a,y);break;case"diamond":Je(a,y);break;case"star":Ue(a,y);break;case"heart":ct(a,y);break;case"hexagon":Ze(a,y);break;case"octagon":Qe(a,y);break;case"arrow":lt(a,y);break;case"image":It(a,y);break}},[se,me,Te,Ke,st,Je,Ue,ct,Ze,Qe,lt,It]),br=N.useCallback(()=>{const a=h.current;if(!a)return;const y=document.createElement("canvas");y.width=a.width,y.height=a.height;const C=y.getContext("2d");C.fillStyle="#ffffff",C.fillRect(0,0,y.width,y.height),C.save(),C.translate(p.panX,p.panY),C.scale(p.zoom,p.zoom),w.forEach(P=>{ft(C,P)}),C.restore();const E=y.toDataURL("image/png"),k=document.createElement("a");k.download=`whiteboard-${Date.now()}.png`,k.href=E,k.click()},[p,w,ft]),bt=N.useCallback((a,y)=>{for(let C=w.length-1;C>=0;C--){const E=w[C];if(E.type==="rectangle"){if(a>=E.x&&a<=E.x+E.width&&y>=E.y&&y<=E.y+E.height)return E}else if(E.type==="circle"){if(Math.sqrt(Math.pow(a-E.centerX,2)+Math.pow(y-E.centerY,2))<=E.radius)return E}else if(E.type==="pencil")for(let P=1;P<E.points.length;P++){const D=E.points[P-1],j=E.points[P];if(dt(a,y,D.x,D.y,j.x,j.y)<=5)return E}else if(E.type==="text"){const k=E.fontSize||16,P=E.text.length*k*.6,D=k;if(a>=E.x&&a<=E.x+P&&y>=E.y&&y<=E.y+D)return E}else if(E.type==="triangle"||E.type==="diamond"||E.type==="hexagon"||E.type==="octagon"){if(a>=E.x&&a<=E.x+E.width&&y>=E.y&&y<=E.y+E.height)return E}else if(E.type==="star"||E.type==="heart"){if(Math.sqrt(Math.pow(a-E.centerX,2)+Math.pow(y-E.centerY,2))<=E.size)return E}else if(E.type==="arrow"){if(dt(a,y,E.startX,E.startY,E.endX,E.endY)<=10)return E}else if(E.type==="image"&&a>=E.x&&a<=E.x+E.width&&y>=E.y&&y<=E.y+E.height)return E}return null},[w]),dt=(a,y,C,E,k,P)=>{const D=a-C,j=y-E,s=k-C,O=P-E,R=D*s+j*O,z=s*s+O*O;let F=-1;z!==0&&(F=R/z);let L,Y;F<0?(L=C,Y=E):F>1?(L=k,Y=P):(L=C+F*s,Y=E+F*O);const V=a-L,J=y-Y;return Math.sqrt(V*V+J*J)},wt=N.useCallback((a,y)=>{if(a.strokeStyle="#0066cc",a.lineWidth=2,a.setLineDash([5,5]),y.type==="rectangle")a.strokeRect(y.x-4,y.y-4,y.width+8,y.height+8);else if(y.type==="circle")a.beginPath(),a.arc(y.centerX,y.centerY,y.radius+4,0,Math.PI*2),a.stroke();else if(y.type==="pencil"&&y.points.length>0){const C=Math.min(...y.points.map(D=>D.x)),E=Math.max(...y.points.map(D=>D.x)),k=Math.min(...y.points.map(D=>D.y)),P=Math.max(...y.points.map(D=>D.y));a.strokeRect(C-4,k-4,E-C+8,P-k+8)}else if(y.type==="text"){const C=y.fontSize||16,E=y.text.length*C*.6,k=C;a.strokeRect(y.x-4,y.y-4,E+8,k+8)}else if(y.type==="triangle"||y.type==="diamond"||y.type==="hexagon"||y.type==="octagon")a.strokeRect(y.x-4,y.y-4,y.width+8,y.height+8);else if(y.type==="star"||y.type==="heart")a.beginPath(),a.arc(y.centerX,y.centerY,y.size+4,0,Math.PI*2),a.stroke();else if(y.type==="arrow"){const C=Math.min(y.startX,y.endX),E=Math.max(y.startX,y.endX),k=Math.min(y.startY,y.endY),P=Math.max(y.startY,y.endY);a.strokeRect(C-4,k-4,E-C+8,P-k+8)}else y.type==="image"&&a.strokeRect(y.x-4,y.y-4,y.width+8,y.height+8);a.setLineDash([])},[]),ce=N.useCallback(()=>{const a=h.current;if(!a)return;const y=a.getContext("2d");y.clearRect(0,0,a.width,a.height),y.save(),y.translate(p.panX,p.panY),y.scale(p.zoom,p.zoom),v.enabled&&xe(y,v.size,v.color),w.forEach(C=>{ft(y,C),C.id===x&&wt(y,C)}),y.restore()},[v,xe,w,ft,x,wt,p]);N.useEffect(()=>{mt.current=ce},[ce]),N.useEffect(()=>{const a=h.current;if(!a)return;const y=()=>{a.width=window.innerWidth,a.height=window.innerHeight,ce()};return y(),window.addEventListener("resize",y),()=>{window.removeEventListener("resize",y)}},[ce]),N.useEffect(()=>{ce()},[ce]),N.useEffect(()=>{const a=C=>{C.target.tagName==="INPUT"||C.target.tagName==="TEXTAREA"||C.code==="Space"&&!C.repeat&&(C.preventDefault(),ye(!0))},y=C=>{C.target.tagName==="INPUT"||C.target.tagName==="TEXTAREA"||C.code==="Space"&&(C.preventDefault(),ye(!1),Ce(!1),we(!1))};return window.addEventListener("keydown",a),window.addEventListener("keyup",y),()=>{window.removeEventListener("keydown",a),window.removeEventListener("keyup",y)}},[]);const et=N.useCallback((a,y)=>({x:(a-p.panX)/p.zoom,y:(y-p.panY)/p.zoom}),[p]);N.useEffect(()=>{const a=h.current;if(!a||!A)return;const y=a.getContext("2d");if(ce(),y.save(),y.translate(p.panX,p.panY),y.scale(p.zoom,p.zoom),f==="pointer")W(y,m,_);else if(f==="rectangle"){const C=Math.min(m.x,_.x),E=Math.min(m.y,_.y),k=Math.abs(_.x-m.x),P=Math.abs(_.y-m.y);se(y,{x:C,y:E,width:k,height:P,strokeColor:u.rectangle.strokeColor,fillColor:u.rectangle.fillColor,lineWidth:u.rectangle.lineWidth})}else if(f==="circle"){const C=m.x,E=m.y,k=Math.sqrt(Math.pow(_.x-m.x,2)+Math.pow(_.y-m.y,2));me(y,{centerX:C,centerY:E,radius:k,strokeColor:u.circle.strokeColor,fillColor:u.circle.fillColor,lineWidth:u.circle.lineWidth})}else if(f==="pencil")Te(y,{points:$,strokeColor:u.pencil.strokeColor,lineWidth:u.pencil.lineWidth});else if(f==="triangle"){const C=Math.min(m.x,_.x),E=Math.min(m.y,_.y),k=Math.abs(_.x-m.x),P=Math.abs(_.y-m.y);st(y,{x:C,y:E,width:k,height:P,strokeColor:u.triangle.strokeColor,fillColor:u.triangle.fillColor,lineWidth:u.triangle.lineWidth})}else if(f==="diamond"){const C=Math.min(m.x,_.x),E=Math.min(m.y,_.y),k=Math.abs(_.x-m.x),P=Math.abs(_.y-m.y);Je(y,{x:C,y:E,width:k,height:P,strokeColor:u.diamond.strokeColor,fillColor:u.diamond.fillColor,lineWidth:u.diamond.lineWidth})}else if(f==="star"){const C=m.x,E=m.y,k=Math.sqrt(Math.pow(_.x-m.x,2)+Math.pow(_.y-m.y,2));Ue(y,{centerX:C,centerY:E,size:k,strokeColor:u.star.strokeColor,fillColor:u.star.fillColor,lineWidth:u.star.lineWidth})}else if(f==="heart"){const C=m.x,E=m.y,k=Math.sqrt(Math.pow(_.x-m.x,2)+Math.pow(_.y-m.y,2));ct(y,{centerX:C,centerY:E,size:k,strokeColor:u.heart.strokeColor,fillColor:u.heart.fillColor,lineWidth:u.heart.lineWidth})}else if(f==="hexagon"){const C=Math.min(m.x,_.x),E=Math.min(m.y,_.y),k=Math.abs(_.x-m.x),P=Math.abs(_.y-m.y);Ze(y,{x:C,y:E,width:k,height:P,strokeColor:u.hexagon.strokeColor,fillColor:u.hexagon.fillColor,lineWidth:u.hexagon.lineWidth})}else if(f==="octagon"){const C=Math.min(m.x,_.x),E=Math.min(m.y,_.y),k=Math.abs(_.x-m.x),P=Math.abs(_.y-m.y);Qe(y,{x:C,y:E,width:k,height:P,strokeColor:u.octagon.strokeColor,fillColor:u.octagon.fillColor,lineWidth:u.octagon.lineWidth})}else f==="arrow"&<(y,{startX:m.x,startY:m.y,endX:_.x,endY:_.y,strokeColor:u.arrow.strokeColor,fillColor:u.arrow.fillColor,lineWidth:u.arrow.lineWidth});y.restore()},[A,f,m,_,$,ce,W,se,me,Te,st,Je,Ue,ct,Ze,Qe,lt,p,u]);const xt=a=>{const C=h.current.getBoundingClientRect(),E=a.clientX-C.left,k=a.clientY-C.top;if(T||Be)return;if(ae){a.preventDefault(),a.button===0?(Ce(!0),Fe({x:E-p.panX,y:k-p.panY})):a.button===2&&(we(!0),Xe({y:k,initialZoom:p.zoom}));return}const{x:P,y:D}=et(E,k);if(f==="pointer"){const j=bt(P,D);if(j)if(c(gt(j.id)),Z(!0),j.type==="rectangle")ue({x:P-j.x,y:D-j.y});else if(j.type==="circle")ue({x:P-j.centerX,y:D-j.centerY});else if(j.type==="pencil"){const s=Math.min(...j.points.map(R=>R.x)),O=Math.min(...j.points.map(R=>R.y));ue({x:P-s,y:D-O})}else j.type==="text"?ue({x:P-j.x,y:D-j.y}):j.type==="triangle"||j.type==="diamond"||j.type==="hexagon"||j.type==="octagon"?ue({x:P-j.x,y:D-j.y}):j.type==="star"||j.type==="heart"?ue({x:P-j.centerX,y:D-j.centerY}):j.type==="arrow"?ue({x:P-j.startX,y:D-j.startY}):j.type==="image"&&ue({x:P-j.x,y:D-j.y});else c(gt(null)),M(!0),b({x:P,y:D}),X({x:P,y:D})}else if(f==="text"){const j=Date.now().toString();c(ve({id:j,type:"text",x:P,y:D,text:"Text",fontSize:u.text.fontSize,fontColor:u.text.fontColor})),c(Re("pointer")),c(gt(j))}else if(f==="eraser"){const j=bt(P,D);j&&c(Oi(j.id))}else c(gt(null)),M(!0),b({x:P,y:D}),X({x:P,y:D}),f==="pencil"&&ee([{x:P,y:D}])},zt=a=>{const C=h.current.getBoundingClientRect(),E=a.clientX-C.left,k=a.clientY-C.top;if(Se){c(ji({x:E-_e.x,y:k-_e.y}));return}if(ge){const j=Ne.y-k,O=Ne.initialZoom*(1+j*.005);c(Pi(O));return}const{x:P,y:D}=et(E,k);if(ne&&x){const j=w.find(O=>O.id===x);if(!j)return;let s={};if(j.type==="rectangle")s={x:P-G.x,y:D-G.y};else if(j.type==="circle")s={centerX:P-G.x,centerY:D-G.y};else if(j.type==="pencil"){const O=Math.min(...j.points.map(L=>L.x)),R=Math.min(...j.points.map(L=>L.y)),z=P-G.x-O,F=D-G.y-R;s={points:j.points.map(L=>({x:L.x+z,y:L.y+F}))}}else if(j.type==="text")s={x:P-G.x,y:D-G.y};else if(j.type==="triangle"||j.type==="diamond"||j.type==="hexagon"||j.type==="octagon")s={x:P-G.x,y:D-G.y};else if(j.type==="star"||j.type==="heart")s={centerX:P-G.x,centerY:D-G.y};else if(j.type==="arrow"){const O=j.endX-j.startX,R=j.endY-j.startY;s={startX:P-G.x,startY:D-G.y,endX:P-G.x+O,endY:D-G.y+R}}else j.type==="image"&&(s={x:P-G.x,y:D-G.y});c(Nt({id:x,updates:s}));return}A&&(X({x:P,y:D}),f==="pencil"&&ee(j=>[...j,{x:P,y:D}]))},Wt=()=>{if(Se||ge){Ce(!1),we(!1);return}if(ne){Z(!1);return}if(A){if(f==="pointer")ce();else if(f==="rectangle"){const a=Math.min(m.x,_.x),y=Math.min(m.y,_.y),C=Math.abs(_.x-m.x),E=Math.abs(_.y-m.y);C>0&&E>0&&c(ve({id:Date.now().toString(),type:"rectangle",x:a,y,width:C,height:E,strokeColor:u.rectangle.strokeColor,fillColor:u.rectangle.fillColor,lineWidth:u.rectangle.lineWidth}))}else if(f==="circle"){const a=m.x,y=m.y,C=Math.sqrt(Math.pow(_.x-m.x,2)+Math.pow(_.y-m.y,2));C>0&&c(ve({id:Date.now().toString(),type:"circle",centerX:a,centerY:y,radius:C,strokeColor:u.circle.strokeColor,fillColor:u.circle.fillColor,lineWidth:u.circle.lineWidth}))}else if(f==="pencil")$.length>1&&c(ve({id:Date.now().toString(),type:"pencil",points:[...$],strokeColor:u.pencil.strokeColor,lineWidth:u.pencil.lineWidth})),ee([]);else if(f==="triangle"){const a=Math.min(m.x,_.x),y=Math.min(m.y,_.y),C=Math.abs(_.x-m.x),E=Math.abs(_.y-m.y);C>0&&E>0&&c(ve({id:Date.now().toString(),type:"triangle",x:a,y,width:C,height:E,strokeColor:u.triangle.strokeColor,fillColor:u.triangle.fillColor,lineWidth:u.triangle.lineWidth}))}else if(f==="diamond"){const a=Math.min(m.x,_.x),y=Math.min(m.y,_.y),C=Math.abs(_.x-m.x),E=Math.abs(_.y-m.y);C>0&&E>0&&c(ve({id:Date.now().toString(),type:"diamond",x:a,y,width:C,height:E,strokeColor:u.diamond.strokeColor,fillColor:u.diamond.fillColor,lineWidth:u.diamond.lineWidth}))}else if(f==="star"){const a=m.x,y=m.y,C=Math.sqrt(Math.pow(_.x-m.x,2)+Math.pow(_.y-m.y,2));C>0&&c(ve({id:Date.now().toString(),type:"star",centerX:a,centerY:y,size:C,strokeColor:u.star.strokeColor,fillColor:u.star.fillColor,lineWidth:u.star.lineWidth}))}else if(f==="heart"){const a=m.x,y=m.y,C=Math.sqrt(Math.pow(_.x-m.x,2)+Math.pow(_.y-m.y,2));C>0&&c(ve({id:Date.now().toString(),type:"heart",centerX:a,centerY:y,size:C,strokeColor:u.heart.strokeColor,fillColor:u.heart.fillColor,lineWidth:u.heart.lineWidth}))}else if(f==="hexagon"){const a=Math.min(m.x,_.x),y=Math.min(m.y,_.y),C=Math.abs(_.x-m.x),E=Math.abs(_.y-m.y);C>0&&E>0&&c(ve({id:Date.now().toString(),type:"hexagon",x:a,y,width:C,height:E,strokeColor:u.hexagon.strokeColor,fillColor:u.hexagon.fillColor,lineWidth:u.hexagon.lineWidth}))}else if(f==="octagon"){const a=Math.min(m.x,_.x),y=Math.min(m.y,_.y),C=Math.abs(_.x-m.x),E=Math.abs(_.y-m.y);C>0&&E>0&&c(ve({id:Date.now().toString(),type:"octagon",x:a,y,width:C,height:E,strokeColor:u.octagon.strokeColor,fillColor:u.octagon.fillColor,lineWidth:u.octagon.lineWidth}))}else if(f==="arrow"){const a=_.x-m.x,y=_.y-m.y;Math.sqrt(a*a+y*y)>5&&c(ve({id:Date.now().toString(),type:"arrow",startX:m.x,startY:m.y,endX:_.x,endY:_.y,strokeColor:u.arrow.strokeColor,fillColor:u.arrow.fillColor,lineWidth:u.arrow.lineWidth}))}M(!1)}},Lt=a=>{ae&&a.preventDefault()},wr=()=>ae?Se?"grabbing":ge?"ns-resize":"grab":"default";return g.jsxs("div",{style:{backgroundColor:"#fff",position:"relative",width:"100%",height:"100%"},children:[g.jsx("canvas",{ref:h,onMouseDown:xt,onMouseMove:zt,onMouseUp:Wt,onMouseLeave:Wt,onDoubleClick:a=>{const C=h.current.getBoundingClientRect(),E=a.clientX-C.left,k=a.clientY-C.top,{x:P,y:D}=et(E,k),j=bt(P,D);j&&j.type==="text"&&(Pe(j.id),Ae({x:j.x,y:j.y}),he(j.text),Oe(!0))},onContextMenu:Lt,style:{cursor:wr()}}),T&&g.jsx(na,{text:n||((Et=t==null?void 0:t.lock)==null?void 0:Et.text)||S.text}),Be&&g.jsx("input",{type:"text",value:fe,onChange:a=>he(a.target.value),onKeyDown:a=>{a.key==="Enter"&&fe.trim()?(pe&&c(Nt({id:pe,updates:{text:fe}})),Oe(!1),he(""),Pe(null)):a.key==="Escape"&&(Oe(!1),he(""),Pe(null))},onBlur:()=>{fe.trim()&&pe&&c(Nt({id:pe,updates:{text:fe}})),Oe(!1),he(""),Pe(null)},onMouseDown:a=>a.stopPropagation(),autoFocus:!0,style:{position:"absolute",left:je.x*p.zoom+p.panX,top:je.y*p.zoom+p.panY,fontSize:u.text.fontSize*p.zoom,color:u.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)"}}),g.jsx(da,{onExport:br}),g.jsx(ha,{}),I.visible&&g.jsx(Ii,{})]})}),pa=e=>g.jsx(yo,{store:An,children:g.jsx(Eo,{children:g.jsx(Ln,{...e})})});be.WhiteboardComponent=Ln,be.default=pa,be.store=An,be.whiteboardReducer=Nn,Object.defineProperties(be,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
97
|
+
(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)`)}}),x||(O.measureTime(function(){var V=T.getState(),ee=pr(V,"",r,n,l,R);if(ee){var K=ee.keyPath,J=ee.value;console.error("A non-serializable value was detected in the state, in the path: `"+K+"`. Value:",J,`
|
|
98
|
+
Take a look at the reducer(s) handling this action type: `+c.type+`.
|
|
99
|
+
(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}}),O.warnIfExceeded()),N}}}}function Tt(e){return typeof e=="boolean"}function di(){return function(t){return hi(t)}}function hi(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,u=a===void 0?!0:a,h=e.actionCreatorCheck,p=h===void 0?!0:h,l=new ni;if(r&&(Tt(r)?l.push(fr):l.push(fr.withExtraArgument(r.extraArgument))),process.env.NODE_ENV!=="production"){if(o){var f={};Tt(o)||(f=o),l.unshift(ui(f))}if(u){var g={};Tt(u)||(g=u),l.push(fi(g))}if(p){var m={};Tt(p)||(m=p),l.unshift(ri(m))}}return l}var vr=process.env.NODE_ENV==="production";function pi(e){var t=di(),r=e||{},n=r.reducer,o=n===void 0?void 0:n,a=r.middleware,u=a===void 0?t():a,h=r.devTools,p=h===void 0?!0:h,l=r.preloadedState,f=l===void 0?void 0:l,g=r.enhancers,m=g===void 0?void 0:g,x;if(typeof o=="function")x=o;else if(mn(o))x=Fo(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 y=u;if(typeof y=="function"&&(y=y(t),!vr&&!Array.isArray(y)))throw new Error("when using a middleware builder function, an array of middleware must be returned");if(!vr&&y.some(function(A){return typeof A!="function"}))throw new Error("each middleware provided to configureStore must be a function");var d=Xo.apply(void 0,y),S=Pt;p&&(S=Zo(Ve({trace:!vr},typeof p=="object"&&p)));var M=new oi(d),R=M;Array.isArray(m)?R=ot([d],m):typeof m=="function"&&(R=m(M));var T=S.apply(void 0,R);return dn(x,f,T)}function On(e){var t={},r=[],n,o={addCase:function(a,u){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 h=typeof a=="string"?a:a.type;if(!h)throw new Error("`builder.addCase` cannot be called with an empty action type");if(h in t)throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");return t[h]=u,o},addMatcher:function(a,u){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:u}),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 vi(e){return typeof e=="function"}var jn=!1;function yi(e,t,r,n){r===void 0&&(r=[]),process.env.NODE_ENV!=="production"&&typeof t=="object"&&(jn||(jn=!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"?On(t):[t,r,n],a=o[0],u=o[1],h=o[2],p;if(vi(e))p=function(){return hr(e())};else{var l=hr(e);p=function(){return l}}function f(g,m){g===void 0&&(g=p());var x=ot([a[m.type]],u.filter(function(y){var d=y.matcher;return d(m)}).map(function(y){var d=y.reducer;return d}));return x.filter(function(y){return!!y}).length===0&&(x=[h]),x.reduce(function(y,d){if(d)if(We(y)){var S=y,M=d(S,m);return M===void 0?y:M}else{if(Pe(y))return sn(y,function(R){return d(R,m)});var M=d(y,m);if(M===void 0){if(y===null)return y;throw Error("A case reducer on a non-draftable value must not return undefined")}return M}return y},g)}return f.getInitialState=p,f}var Pn=!1;function gi(e,t){return e+"/"+t}function mi(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:hr(e.initialState),n=e.reducers||{},o=Object.keys(n),a={},u={},h={};o.forEach(function(f){var g=n[f],m=gi(t,f),x,y;"reducer"in g?(x=g.reducer,y=g.prepare):x=g,a[f]=x,u[m]=x,h[f]=y?$e(m,y):$e(m)});function p(){process.env.NODE_ENV!=="production"&&typeof e.extraReducers=="object"&&(Pn||(Pn=!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 f=typeof e.extraReducers=="function"?On(e.extraReducers):[e.extraReducers],g=f[0],m=g===void 0?{}:g,x=f[1],y=x===void 0?[]:x,d=f[2],S=d===void 0?void 0:d,M=Ve(Ve({},m),u);return yi(r,function(R){for(var T in M)R.addCase(T,M[T]);for(var A=0,c=y;A<c.length;A++){var N=c[A];R.addMatcher(N.matcher,N.reducer)}S&&R.addDefaultCase(S)})}var l;return{name:t,reducer:function(f,g){return l||(l=p()),l(f,g)},actions:h,caseReducers:a,getInitialState:function(){return l||(l=p()),l.getInitialState()}}}var bi="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",wi=function(e){e===void 0&&(e=21);for(var t="",r=e;r--;)t+=bi[Math.random()*64|0];return t},xi=["name","message","stack","code"],yr=(function(){function e(t,r){this.payload=t,this.meta=r}return e})(),Tn=(function(){function e(t,r){this.payload=t,this.meta=r}return e})(),Ei=function(e){if(typeof e=="object"&&e!==null){for(var t={},r=0,n=xi;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=$e(t+"/fulfilled",function(f,g,m,x){return{payload:f,meta:dr(Ve({},x||{}),{arg:m,requestId:g,requestStatus:"fulfilled"})}}),a=$e(t+"/pending",function(f,g,m){return{payload:void 0,meta:dr(Ve({},m||{}),{arg:g,requestId:f,requestStatus:"pending"})}}),u=$e(t+"/rejected",function(f,g,m,x,y){return{payload:x,error:(n&&n.serializeError||Ei)(f||"Rejected"),meta:dr(Ve({},y||{}),{arg:m,requestId:g,rejectedWithValue:!!x,requestStatus:"rejected",aborted:(f==null?void 0:f.name)==="AbortError",condition:(f==null?void 0:f.name)==="ConditionError"})}}),h=!1,p=typeof AbortController<"u"?AbortController:(function(){function f(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return f.prototype.abort=function(){process.env.NODE_ENV!=="production"&&(h||(h=!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'.")))},f})();function l(f){return function(g,m,x){var y=n!=null&&n.idGenerator?n.idGenerator(f):wi(),d=new p,S;function M(T){S=T,d.abort()}var R=(function(){return Jo(this,null,function(){var T,A,c,N,O,V,ee;return Bo(this,function(K){switch(K.label){case 0:return K.trys.push([0,4,,5]),N=(T=n==null?void 0:n.condition)==null?void 0:T.call(n,f,{getState:m,extra:x}),Ci(N)?[4,N]:[3,2];case 1:N=K.sent(),K.label=2;case 2:if(N===!1||d.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return O=new Promise(function(J,ae){return d.signal.addEventListener("abort",function(){return ae({name:"AbortError",message:S||"Aborted"})})}),g(a(y,f,(A=n==null?void 0:n.getPendingMeta)==null?void 0:A.call(n,{requestId:y,arg:f},{getState:m,extra:x}))),[4,Promise.race([O,Promise.resolve(r(f,{dispatch:g,getState:m,extra:x,requestId:y,signal:d.signal,abort:M,rejectWithValue:function(J,ae){return new yr(J,ae)},fulfillWithValue:function(J,ae){return new Tn(J,ae)}})).then(function(J){if(J instanceof yr)throw J;return J instanceof Tn?o(J.payload,y,f,J.meta):o(J,y,f)})])];case 3:return c=K.sent(),[3,5];case 4:return V=K.sent(),c=V instanceof yr?u(null,y,f,V.payload,V.meta):u(V,y,f),[3,5];case 5:return ee=n&&!n.dispatchConditionRejection&&u.match(c)&&c.meta.condition,ee||g(c),[2,c]}})})})();return Object.assign(R,{abort:M,requestId:y,arg:f,unwrap:function(){return R.then(Si)}})}}return Object.assign(l,{pending:a,rejected:u,fulfilled:o,typePrefix:t})}return e.withTypes=function(){return e},e})();function Si(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Ci(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var gr="listenerMiddleware";$e(gr+"/add"),$e(gr+"/removeAll"),$e(gr+"/remove");var Mn;typeof queueMicrotask=="function"&&queueMicrotask.bind(typeof window<"u"?window:typeof global<"u"?global:globalThis),Po();const kn=mi({name:"whiteboard",initialState:{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:[],selectedElementId:null,viewport:{panX:0,panY:0,zoom:1},watermark:{text:"Nines Studios",url:"https://github.com/huzeyfecoskun",visible:!0},lock:{isLocked:!0,text:"Whiteboard drawing is only for moderator"}},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){e.elements.push(t.payload)},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})},removeElement(e,t){const r=t.payload;e.elements=e.elements.filter(n=>n.id!==r),e.selectedElementId===r&&(e.selectedElementId=null)},setSelectedElement(e,t){e.selectedElementId=t.payload},clearElements(e){e.elements=[]},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 u=1/0,h=1/0,p=-1/0,l=-1/0;a.forEach(c=>{c.type==="rectangle"?(u=Math.min(u,c.x),h=Math.min(h,c.y),p=Math.max(p,c.x+c.width),l=Math.max(l,c.y+c.height)):c.type==="circle"?(u=Math.min(u,c.centerX-c.radius),h=Math.min(h,c.centerY-c.radius),p=Math.max(p,c.centerX+c.radius),l=Math.max(l,c.centerY+c.radius)):c.type==="pencil"&&c.points.length>0?c.points.forEach(N=>{u=Math.min(u,N.x),h=Math.min(h,N.y),p=Math.max(p,N.x),l=Math.max(l,N.y)}):c.type==="triangle"||c.type==="diamond"||c.type==="hexagon"||c.type==="octagon"?(u=Math.min(u,c.x),h=Math.min(h,c.y),p=Math.max(p,c.x+c.width),l=Math.max(l,c.y+c.height)):c.type==="star"||c.type==="heart"?(u=Math.min(u,c.centerX-c.size),h=Math.min(h,c.centerY-c.size),p=Math.max(p,c.centerX+c.size),l=Math.max(l,c.centerY+c.size)):c.type==="arrow"&&(u=Math.min(u,c.startX,c.endX),h=Math.min(h,c.startY,c.endY),p=Math.max(p,c.startX,c.endX),l=Math.max(l,c.startY,c.endY))});const f=p-u,g=l-h;if(f<=0||g<=0)return;const m=r-o*2,x=n-o*2,y=m/f,d=x/g,S=Math.min(y,d,5),M=(u+p)/2,R=(h+l)/2,T=r/2-M*S,A=n/2-R*S;e.viewport.zoom=Math.max(.1,S),e.viewport.panX=T,e.viewport.panY=A},setLocked(e,t){e.lock.isLocked=t.payload,t.payload&&(e.toolbar.selectedTool="pointer",e.selectedElementId=null)},setWatermarkEnabled(e,t){e.watermark.visible=t.payload},setWatermarkText(e,t){e.watermark.text=t.payload}}}),{setSelectedTool:Te,setToolProperty:_i,addElement:pe,updateElement:Mt,removeElement:Oi,setSelectedElement:gt,setPan:ji,setZoom:Pi,fitToView:Ti,bringToFront:Mi,sendToBack:ki,setLocked:Rn,setWatermarkEnabled:Ri,setWatermarkText:Ni}=kn.actions,Nn=kn.reducer;let mr=null;const Ai=e=>{mr=e},Di=e=>t=>r=>{var o;const n=t(r);return!((o=r.meta)!=null&&o.fromRemote)&&mr&&mr(r),n},An=pi({reducer:{whiteboard:Nn},middleware:e=>e().concat(Di)}),Ii=()=>{const e=ie(t=>t.whiteboard.watermark);return w.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:w.jsx("div",{className:"wb-watermark",children:e.text})})};var Dn={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},In=k.createContext&&k.createContext(Dn),zi=["attr","size","title"];function Wi(e,t){if(e==null)return{};var r=Li(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 Li(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 kt(){return kt=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},kt.apply(this,arguments)}function zn(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 Rt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zn(Object(r),!0).forEach(function(n){Yi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Yi(e,t,r){return t=Vi(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Vi(e){var t=$i(e,"string");return typeof t=="symbol"?t:t+""}function $i(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 Wn(e){return e&&e.map((t,r)=>k.createElement(t.tag,Rt({key:r},t.attr),Wn(t.child)))}function te(e){return t=>k.createElement(Fi,kt({attr:Rt({},e.attr)},t),Wn(e.child))}function Fi(e){var t=r=>{var{attr:n,size:o,title:a}=e,u=Wi(e,zi),h=o||r.size||"1em",p;return r.className&&(p=r.className),e.className&&(p=(p?p+" ":"")+e.className),k.createElement("svg",kt({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,u,{className:p,style:Rt(Rt({color:e.color||r.color},r.style),e.style),height:h,width:h,xmlns:"http://www.w3.org/2000/svg"}),a&&k.createElement("title",null,a),e.children)};return In!==void 0?k.createElement(In.Consumer,null,r=>t(r)):t(Dn)}function Xi(e){return te({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 Bi(e){return te({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 Ui(e){return te({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 qi(e){return te({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 Hi(e){return te({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 Gi(e){return te({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 Ki(e){return te({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 Ji(e){return te({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 Zi(e){return te({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 Qi(e){return te({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 ea(e){return te({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 ta(e){return te({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 ra(e){return te({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)}const na=({text:e})=>w.jsxs("div",{style:{position:"absolute",top:"10px",left:"10px",backgroundColor:"rgba(255, 68, 68, 0.9)",color:"white",padding:"8px 16px",borderRadius:"4px",display:"flex",alignItems:"center",gap:"8px",boxShadow:"0 2px 4px rgba(0,0,0,0.2)",zIndex:1e3,pointerEvents:"none",userSelect:"none",fontFamily:"sans-serif",fontSize:"14px",fontWeight:"500"},children:[w.jsx(Ki,{}),w.jsx("span",{children:e||"Locked"})]});function oa(e){return te({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 ia(e){return te({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 aa(e){return te({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 sa(e){return te({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 ca(e){return te({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 la(e){return te({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 ua(e){return te({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 fa(e){return te({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 da=({onExport:e,onFitToView:t,mode:r})=>{const n=Gt(),{t:o,language:a,changeLanguage:u}=Hr(),h=ie(N=>N.whiteboard.toolbar.selectedTool),p=ie(N=>N.whiteboard.lock.isLocked),[l,f]=k.useState(!1),[g,m]=k.useState(!1),x=k.useRef(null),y=k.useRef(null),d=k.useRef(null),S=k.useRef(null),M=k.useRef(null),R=N=>{const O=N.target.files[0];if(!O)return;const V=new FileReader;V.onload=ee=>{const K=new Image;K.onload=()=>{const J=Date.now().toString();n(pe({id:J,type:"image",x:100,y:100,width:K.width,height:K.height,src:ee.target.result})),n(Te("pointer")),n(gt(J))},K.src=ee.target.result},V.readAsDataURL(O),N.target.value=""};k.useEffect(()=>{const N=O=>{x.current&&!x.current.contains(O.target)&&y.current&&!y.current.contains(O.target)&&f(!1),S.current&&!S.current.contains(O.target)&&d.current&&!d.current.contains(O.target)&&m(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[]);const T=[{name:"triangle",icon:w.jsx(Qi,{style:{transform:"rotate(-30deg)"}})},{name:"diamond",icon:w.jsx(ia,{})},{name:"star",icon:w.jsx(ra,{})},{name:"heart",icon:w.jsx(Hi,{})},{name:"hexagon",icon:w.jsx(ua,{})},{name:"octagon",icon:w.jsx(fa,{})},{name:"arrow",icon:w.jsx(oa,{})}],A=N=>{n(Te(N)),f(!1)},c=N=>{u(N),m(!1)};return w.jsxs("div",{className:"wb-toolbar",children:[w.jsx("button",{className:h==="pointer"?"wb-active":"",onClick:()=>n(Te("pointer")),title:o("pointer"),disabled:p,children:w.jsx(Ji,{})}),w.jsx("button",{className:h==="text"?"wb-active":"",onClick:()=>n(Te("text")),title:o("text"),disabled:p,children:w.jsx(ca,{})}),w.jsx("button",{onClick:()=>{var N;return(N=M.current)==null?void 0:N.click()},title:o("image"),disabled:p,children:w.jsx(Gi,{})}),w.jsx("input",{type:"file",ref:M,style:{display:"none"},accept:"image/*",onChange:R}),w.jsx("button",{className:h==="pencil"?"wb-active":"",onClick:()=>n(Te("pencil")),title:o("pencil"),disabled:p,children:w.jsx(Zi,{})}),w.jsx("button",{className:h==="rectangle"?"wb-active":"",onClick:()=>n(Te("rectangle")),title:o("rectangle"),disabled:p,children:w.jsx(ta,{})}),w.jsx("button",{className:h==="circle"?"wb-active":"",onClick:()=>n(Te("circle")),title:o("circle"),disabled:p,children:w.jsx(Xi,{})}),w.jsxs("div",{className:"wb-ellipsis-container",children:[w.jsx("button",{ref:y,className:T.some(N=>N.name===h)?"wb-active":"",onClick:()=>f(!l),title:o("moreShapes"),disabled:p,children:w.jsx(aa,{})}),l&&w.jsxs("div",{className:"wb-shapes-popup",ref:x,children:[w.jsx("div",{className:"wb-shapes-popup-header",children:o("moreShapes")}),w.jsx("div",{className:"wb-shapes-popup-grid",children:T.map(N=>w.jsx("button",{className:h===N.name?"wb-active":"",onClick:()=>A(N.name),title:o(N.name),children:N.icon},N.name))})]})]}),w.jsx("button",{className:h==="eraser"?"wb-active":"",onClick:()=>n(Te("eraser")),title:o("eraser"),disabled:p,children:w.jsx(Bi,{})}),w.jsx("button",{onClick:t,title:o("fitToView"),children:w.jsx(Ui,{})}),w.jsx("button",{onClick:e,title:o("exportAsPng"),children:w.jsx(ea,{})}),w.jsxs("div",{className:"wb-language-container",children:[w.jsx("button",{ref:d,onClick:()=>m(!g),title:o("language"),children:w.jsx(qi,{})}),g&&w.jsxs("div",{className:"wb-language-popup",ref:S,children:[w.jsx("div",{className:"wb-language-popup-header",children:o("language")}),w.jsxs("div",{className:"wb-language-options",children:[w.jsxs("button",{className:a==="en"?"wb-active":"",onClick:()=>c("en"),children:["πΊπΈ ",o("english")]}),w.jsxs("button",{className:a==="tr"?"wb-active":"",onClick:()=>c("tr"),children:["πΉπ· ",o("turkish")]})]})]})]}),r==="moderator"&&w.jsx("button",{onClick:()=>n(Rn(!p)),title:p?"Unlock":"Lock",style:{color:p?"red":"inherit"},children:p?w.jsx(sa,{}):w.jsx(la,{})})]})},ha=()=>{const e=Gt(),{t}=Hr(),r=ie(g=>g.whiteboard.toolbar.selectedTool),n=ie(g=>g.whiteboard.toolProperties),o=ie(g=>g.whiteboard.selectedElementId),a=ie(g=>g.whiteboard.elements),u=o?a.find(g=>g.id===o):null,h=(g,m,x)=>{e(_i({tool:g,property:m,value:x}))},p=(g,m)=>{o&&e(Mt({id:o,updates:{[g]:m}}))},l=()=>{o&&e(Mi(o))},f=()=>{o&&e(ki(o))};if(r==="pointer"&&u&&u.type==="text")return w.jsxs("div",{className:"wb-prop-tools",children:[w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("fontSize")}),w.jsxs("select",{className:"font-size-selector",value:u.fontSize||16,onChange:g=>p("fontSize",parseInt(g.target.value)),children:[w.jsx("option",{value:"12",children:"12 px"}),w.jsx("option",{value:"14",children:"14 px"}),w.jsx("option",{value:"16",children:"16 px"}),w.jsx("option",{value:"18",children:"18 px"}),w.jsx("option",{value:"24",children:"24 px"}),w.jsx("option",{value:"32",children:"32 px"}),w.jsx("option",{value:"48",children:"48 px"}),w.jsx("option",{value:"64",children:"64 px"}),w.jsx("option",{value:"72",children:"72 px"})]})]}),w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("fontColor")}),w.jsx("input",{type:"color",value:u.fontColor||"#000000",onChange:g=>p("fontColor",g.target.value)})]}),w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("layerOrder")}),w.jsxs("div",{className:"wb-layer-buttons",children:[w.jsx("button",{onClick:l,title:t("bringToFront"),children:w.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[w.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),w.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"white"})]})}),w.jsx("button",{onClick:f,title:t("sendToBack"),children:w.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[w.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),w.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"white"})]})})]})]})]});if(r==="pointer"&&u){const g=["rectangle","circle","triangle","diamond","star","heart","hexagon","octagon","arrow"].includes(u.type),m=u.type==="pencil";return w.jsxs("div",{className:"wb-prop-tools",children:[g&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("strokeColor")}),w.jsx("input",{type:"color",value:u.strokeColor,onChange:x=>p("strokeColor",x.target.value)})]}),w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("fillColor")}),w.jsx("input",{type:"color",value:u.fillColor,onChange:x=>p("fillColor",x.target.value)})]}),w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("strokeWidth")}),w.jsxs("select",{className:"stroke-width-selector",value:u.lineWidth,onChange:x=>p("lineWidth",parseInt(x.target.value)),children:[w.jsx("option",{value:"1",children:"1 px"}),w.jsx("option",{value:"2",children:"2 px"}),w.jsx("option",{value:"4",children:"4 px"}),w.jsx("option",{value:"8",children:"8 px"})]})]})]}),m&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("brushColor")}),w.jsx("input",{type:"color",value:u.strokeColor,onChange:x=>p("strokeColor",x.target.value)})]}),w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("brushSize")}),w.jsxs("select",{className:"brush-size-selector",value:u.lineWidth,onChange:x=>p("lineWidth",parseInt(x.target.value)),children:[w.jsx("option",{value:"1",children:"1 px"}),w.jsx("option",{value:"2",children:"2 px"}),w.jsx("option",{value:"4",children:"4 px"}),w.jsx("option",{value:"8",children:"8 px"}),w.jsx("option",{value:"16",children:"16 px"})]})]})]}),w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("layerOrder")}),w.jsxs("div",{className:"wb-layer-buttons",children:[w.jsx("button",{onClick:l,title:t("bringToFront"),children:w.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[w.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),w.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"white"})]})}),w.jsx("button",{onClick:f,title:t("sendToBack"),children:w.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[w.jsx("rect",{x:"4",y:"4",width:"12",height:"12",rx:"1",fill:"#0066cc",stroke:"#0066cc"}),w.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"1",fill:"white"})]})})]})]})]})}return w.jsxs("div",{className:"wb-prop-tools",children:[r==="text"&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("fontSize")}),w.jsxs("select",{className:"font-size-selector",value:n.text.fontSize,onChange:g=>h("text","fontSize",parseInt(g.target.value)),children:[w.jsx("option",{value:"12",children:"12 px"}),w.jsx("option",{value:"14",children:"14 px"}),w.jsx("option",{value:"16",children:"16 px"}),w.jsx("option",{value:"18",children:"18 px"}),w.jsx("option",{value:"24",children:"24 px"}),w.jsx("option",{value:"32",children:"32 px"}),w.jsx("option",{value:"48",children:"48 px"}),w.jsx("option",{value:"64",children:"64 px"}),w.jsx("option",{value:"72",children:"72 px"})]})]}),w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("fontColor")}),w.jsx("input",{type:"color",value:n.text.fontColor,onChange:g=>h("text","fontColor",g.target.value)})]})]}),r==="pencil"&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("brushColor")}),w.jsx("input",{type:"color",value:n.pencil.strokeColor,onChange:g=>h("pencil","strokeColor",g.target.value)})]}),w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("brushSize")}),w.jsxs("select",{className:"brush-size-selector",value:n.pencil.lineWidth,onChange:g=>h("pencil","lineWidth",parseInt(g.target.value)),children:[w.jsx("option",{value:"1",children:"1 px"}),w.jsx("option",{value:"2",children:"2 px"}),w.jsx("option",{value:"4",children:"4 px"}),w.jsx("option",{value:"8",children:"8 px"}),w.jsx("option",{value:"16",children:"16 px"})]})]})]}),(r==="rectangle"||r==="circle"||r==="triangle"||r==="diamond"||r==="star"||r==="heart"||r==="hexagon"||r==="octagon"||r==="arrow")&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("strokeColor")}),w.jsx("input",{type:"color",value:n[r].strokeColor,onChange:g=>h(r,"strokeColor",g.target.value)})]}),w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("fillColor")}),w.jsx("input",{type:"color",value:n[r].fillColor,onChange:g=>h(r,"fillColor",g.target.value)})]}),w.jsxs("div",{className:"wb-prop-tool-item",children:[w.jsx("span",{children:t("strokeWidth")}),w.jsxs("select",{className:"stroke-width-selector",value:n[r].lineWidth,onChange:g=>h(r,"lineWidth",parseInt(g.target.value)),children:[w.jsx("option",{value:"1",children:"1 px"}),w.jsx("option",{value:"2",children:"2 px"}),w.jsx("option",{value:"4",children:"4 px"}),w.jsx("option",{value:"8",children:"8 px"})]})]})]})]})},Ln=k.forwardRef(({onAction:e,watermark:t,isLocked:r,lockText:n,onLockChange:o,isWatermarkEnabled:a,watermarkText:u,mode:h},p)=>{var Lt;const l=k.useRef(null),f=Gt(),g=ie(s=>s.whiteboard.grid),m=ie(s=>s.whiteboard.toolbar.selectedTool),x=ie(s=>s.whiteboard.elements),y=ie(s=>s.whiteboard.viewport),d=ie(s=>s.whiteboard.toolProperties),S=ie(s=>s.whiteboard.selectedElementId),M=ie(s=>s.whiteboard.lock),R=M.isLocked,[T,A]=k.useState(!1),[c,N]=k.useState({x:0,y:0}),[O,V]=k.useState({x:0,y:0}),[ee,K]=k.useState([]),[J,ae]=k.useState(!1),[Z,re]=k.useState({x:0,y:0}),[fe,Me]=k.useState(!1),[Ee,ve]=k.useState(!1),[be,we]=k.useState(!1),[ke,Fe]=k.useState({x:0,y:0}),[Re,Ge]=k.useState({y:0,initialZoom:1}),[Xe,ye]=k.useState(!1),[Se,Ce]=k.useState({x:0,y:0}),[de,se]=k.useState(""),[_e,I]=k.useState(null);k.useEffect(()=>{e&&Ai(e)},[e]),k.useImperativeHandle(p,()=>({canvas:l.current,applyAction:s=>{f({...s,meta:{...s.meta,fromRemote:!0}})}})),k.useEffect(()=>{r!==void 0&&r!==R&&f(Rn(r))},[r,R,f]),k.useEffect(()=>{o&&o(R)},[R,o]);const ce=ie(s=>s.whiteboard.watermark);k.useEffect(()=>{a!==void 0&&a!==ce.visible&&f(Ri(a))},[a,ce.visible,f]),k.useEffect(()=>{u!==void 0&&u!==ce.text&&f(Ni(u))},[u,ce.text,f]);const z=k.useCallback((s,b,C)=>{const E=s.canvas,j=E.width,P=E.height,i=Math.floor(-y.panX/y.zoom/b)*b,v=Math.floor(-y.panY/y.zoom/b)*b,_=Math.ceil((j/y.zoom-y.panX/y.zoom)/b)*b,D=Math.ceil((P/y.zoom-y.panY/y.zoom)/b)*b;s.strokeStyle=C,s.lineWidth=.5/y.zoom;for(let L=i;L<=_;L+=b)s.beginPath(),s.moveTo(L,v),s.lineTo(L,D),s.stroke();for(let L=v;L<=D;L+=b)s.beginPath(),s.moveTo(i,L),s.lineTo(_,L),s.stroke()},[y]),le=k.useCallback((s,b,C)=>{const E=Math.min(b.x,C.x),j=Math.min(b.y,C.y),P=Math.abs(C.x-b.x),i=Math.abs(C.y-b.y);s.strokeStyle="#0066cc",s.lineWidth=1,s.setLineDash([5,5]),s.strokeRect(E,j,P,i),s.fillStyle="rgba(0, 102, 204, 0.1)",s.fillRect(E,j,P,i),s.setLineDash([])},[]),ge=k.useCallback((s,b)=>{const{x:C,y:E,width:j,height:P,fillColor:i="#000",strokeColor:v="#000",lineWidth:_=2}=b;s.fillStyle=i,s.fillRect(C,E,j,P),s.strokeStyle=v,s.lineWidth=_,s.strokeRect(C,E,j,P)},[]),Oe=k.useCallback((s,b)=>{const{centerX:C,centerY:E,radius:j,fillColor:P="#000",strokeColor:i="#000",lineWidth:v=2}=b;s.beginPath(),s.arc(C,E,j,0,Math.PI*2),s.fillStyle=P,s.fill(),s.strokeStyle=i,s.lineWidth=v,s.stroke()},[]),Ne=k.useCallback((s,b)=>{const{points:C,strokeColor:E="#000",lineWidth:j=2}=b;if(!(C.length<2)){s.strokeStyle=E,s.lineWidth=j,s.lineCap="round",s.lineJoin="round",s.beginPath(),s.moveTo(C[0].x,C[0].y);for(let P=1;P<C.length;P++)s.lineTo(C[P].x,C[P].y);s.stroke()}},[]),Nt=k.useCallback((s,b)=>{const{x:C,y:E,text:j,fontSize:P=16,fontColor:i="#000"}=b;s.font=`${P}px sans-serif`,s.fillStyle=i,s.textBaseline="top",s.fillText(j,C,E)},[]),Ke=k.useCallback((s,b)=>{const{x:C,y:E,width:j,height:P,fillColor:i="#fff",strokeColor:v="#000",lineWidth:_=2}=b;s.beginPath(),s.moveTo(C+j/2,E),s.lineTo(C+j,E+P),s.lineTo(C,E+P),s.closePath(),s.fillStyle=i,s.fill(),s.strokeStyle=v,s.lineWidth=_,s.stroke()},[]),Be=k.useCallback((s,b)=>{const{x:C,y:E,width:j,height:P,fillColor:i="#fff",strokeColor:v="#000",lineWidth:_=2}=b;s.beginPath(),s.moveTo(C+j/2,E),s.lineTo(C+j,E+P/2),s.lineTo(C+j/2,E+P),s.lineTo(C,E+P/2),s.closePath(),s.fillStyle=i,s.fill(),s.strokeStyle=v,s.lineWidth=_,s.stroke()},[]),it=k.useCallback((s,b)=>{const{centerX:C,centerY:E,size:j,fillColor:P="#ffff00",strokeColor:i="#000",lineWidth:v=2}=b,_=5,D=j,L=j/2;s.beginPath();for(let $=0;$<_*2;$++){const Y=$%2===0?D:L,W=Math.PI/_*$-Math.PI/2,H=C+Math.cos(W)*Y,F=E+Math.sin(W)*Y;$===0?s.moveTo(H,F):s.lineTo(H,F)}s.closePath(),s.fillStyle=P,s.fill(),s.strokeStyle=i,s.lineWidth=v,s.stroke()},[]),Je=k.useCallback((s,b)=>{const{centerX:C,centerY:E,size:j,fillColor:P="#ff6b6b",strokeColor:i="#000",lineWidth:v=2}=b;s.beginPath();const _=E-j/2;s.moveTo(C,_+j/4),s.bezierCurveTo(C-j/2,_,C-j,_+j/2,C,E+j/2),s.bezierCurveTo(C+j,_+j/2,C+j/2,_,C,_+j/4),s.fillStyle=P,s.fill(),s.strokeStyle=i,s.lineWidth=v,s.stroke()},[]),Ze=k.useCallback((s,b)=>{const{x:C,y:E,width:j,height:P,fillColor:i="#fff",strokeColor:v="#000",lineWidth:_=2}=b,D=C+j/2,L=E+P/2,$=j/2,Y=P/2;s.beginPath();for(let W=0;W<6;W++){const H=Math.PI/3*W-Math.PI/2,F=D+Math.cos(H)*$,G=L+Math.sin(H)*Y;W===0?s.moveTo(F,G):s.lineTo(F,G)}s.closePath(),s.fillStyle=i,s.fill(),s.strokeStyle=v,s.lineWidth=_,s.stroke()},[]),at=k.useCallback((s,b)=>{const{x:C,y:E,width:j,height:P,fillColor:i="#fff",strokeColor:v="#000",lineWidth:_=2}=b,D=C+j/2,L=E+P/2,$=j/2,Y=P/2;s.beginPath();for(let W=0;W<8;W++){const H=Math.PI/4*W-Math.PI/2,F=D+Math.cos(H)*$,G=L+Math.sin(H)*Y;W===0?s.moveTo(F,G):s.lineTo(F,G)}s.closePath(),s.fillStyle=i,s.fill(),s.strokeStyle=v,s.lineWidth=_,s.stroke()},[]),st=k.useCallback((s,b)=>{const{startX:C,startY:E,endX:j,endY:P,fillColor:i="#000",strokeColor:v="#000",lineWidth:_=2}=b,D=15,L=Math.atan2(P-E,j-C);s.beginPath(),s.moveTo(C,E),s.lineTo(j,P),s.strokeStyle=v,s.lineWidth=_,s.stroke(),s.beginPath(),s.moveTo(j,P),s.lineTo(j-D*Math.cos(L-Math.PI/6),P-D*Math.sin(L-Math.PI/6)),s.lineTo(j-D*Math.cos(L+Math.PI/6),P-D*Math.sin(L+Math.PI/6)),s.closePath(),s.fillStyle=i,s.fill()},[]),ct=k.useRef({}),mt=k.useRef(null),At=k.useCallback((s,b)=>{const{x:C,y:E,width:j,height:P,src:i}=b;if(ct.current[i]){const v=ct.current[i];v.complete&&s.drawImage(v,C,E,j,P)}else{const v=new Image;v.onload=()=>{ct.current[i]=v,mt.current&&mt.current()},v.src=i,ct.current[i]=v}},[]),lt=k.useCallback((s,b)=>{switch(b.type){case"rectangle":ge(s,b);break;case"circle":Oe(s,b);break;case"pencil":Ne(s,b);break;case"text":Nt(s,b);break;case"triangle":Ke(s,b);break;case"diamond":Be(s,b);break;case"star":it(s,b);break;case"heart":Je(s,b);break;case"hexagon":Ze(s,b);break;case"octagon":at(s,b);break;case"arrow":st(s,b);break;case"image":At(s,b);break}},[ge,Oe,Ne,Nt,Ke,Be,it,Je,Ze,at,st,At]),br=k.useCallback(()=>{const s=l.current;if(!s)return;const b=document.createElement("canvas");b.width=s.width,b.height=s.height;const C=b.getContext("2d");C.fillStyle="#ffffff",C.fillRect(0,0,b.width,b.height),C.save(),C.translate(y.panX,y.panY),C.scale(y.zoom,y.zoom),x.forEach(P=>{lt(C,P)}),C.restore();const E=b.toDataURL("image/png"),j=document.createElement("a");j.download=`whiteboard-${Date.now()}.png`,j.href=E,j.click()},[y,x,lt]),bt=k.useCallback(()=>{const s=l.current;s&&f(Ti({canvasWidth:s.width,canvasHeight:s.height,padding:50}))},[f]),ut=k.useCallback((s,b)=>{for(let C=x.length-1;C>=0;C--){const E=x[C];if(E.type==="rectangle"){if(s>=E.x&&s<=E.x+E.width&&b>=E.y&&b<=E.y+E.height)return E}else if(E.type==="circle"){if(Math.sqrt(Math.pow(s-E.centerX,2)+Math.pow(b-E.centerY,2))<=E.radius)return E}else if(E.type==="pencil")for(let P=1;P<E.points.length;P++){const i=E.points[P-1],v=E.points[P];if(Ae(s,b,i.x,i.y,v.x,v.y)<=5)return E}else if(E.type==="text"){const j=E.fontSize||16,P=E.text.length*j*.6,i=j;if(s>=E.x&&s<=E.x+P&&b>=E.y&&b<=E.y+i)return E}else if(E.type==="triangle"||E.type==="diamond"||E.type==="hexagon"||E.type==="octagon"){if(s>=E.x&&s<=E.x+E.width&&b>=E.y&&b<=E.y+E.height)return E}else if(E.type==="star"||E.type==="heart"){if(Math.sqrt(Math.pow(s-E.centerX,2)+Math.pow(b-E.centerY,2))<=E.size)return E}else if(E.type==="arrow"){if(Ae(s,b,E.startX,E.startY,E.endX,E.endY)<=10)return E}else if(E.type==="image"&&s>=E.x&&s<=E.x+E.width&&b>=E.y&&b<=E.y+E.height)return E}return null},[x]),Ae=(s,b,C,E,j,P)=>{const i=s-C,v=b-E,_=j-C,D=P-E,L=i*_+v*D,$=_*_+D*D;let Y=-1;$!==0&&(Y=L/$);let W,H;Y<0?(W=C,H=E):Y>1?(W=j,H=P):(W=C+Y*_,H=E+Y*D);const F=s-W,G=b-H;return Math.sqrt(F*F+G*G)},ft=k.useCallback((s,b)=>{if(s.strokeStyle="#0066cc",s.lineWidth=2,s.setLineDash([5,5]),b.type==="rectangle")s.strokeRect(b.x-4,b.y-4,b.width+8,b.height+8);else if(b.type==="circle")s.beginPath(),s.arc(b.centerX,b.centerY,b.radius+4,0,Math.PI*2),s.stroke();else if(b.type==="pencil"&&b.points.length>0){const C=Math.min(...b.points.map(i=>i.x)),E=Math.max(...b.points.map(i=>i.x)),j=Math.min(...b.points.map(i=>i.y)),P=Math.max(...b.points.map(i=>i.y));s.strokeRect(C-4,j-4,E-C+8,P-j+8)}else if(b.type==="text"){const C=b.fontSize||16,E=b.text.length*C*.6,j=C;s.strokeRect(b.x-4,b.y-4,E+8,j+8)}else if(b.type==="triangle"||b.type==="diamond"||b.type==="hexagon"||b.type==="octagon")s.strokeRect(b.x-4,b.y-4,b.width+8,b.height+8);else if(b.type==="star"||b.type==="heart")s.beginPath(),s.arc(b.centerX,b.centerY,b.size+4,0,Math.PI*2),s.stroke();else if(b.type==="arrow"){const C=Math.min(b.startX,b.endX),E=Math.max(b.startX,b.endX),j=Math.min(b.startY,b.endY),P=Math.max(b.startY,b.endY);s.strokeRect(C-4,j-4,E-C+8,P-j+8)}else b.type==="image"&&s.strokeRect(b.x-4,b.y-4,b.width+8,b.height+8);s.setLineDash([])},[]),he=k.useCallback(()=>{const s=l.current;if(!s)return;const b=s.getContext("2d");b.clearRect(0,0,s.width,s.height),b.save(),b.translate(y.panX,y.panY),b.scale(y.zoom,y.zoom),g.enabled&&z(b,g.size,g.color),x.forEach(C=>{lt(b,C),C.id===S&&ft(b,C)}),b.restore()},[g,z,x,lt,S,ft,y]);k.useEffect(()=>{mt.current=he},[he]),k.useEffect(()=>{const s=l.current;if(!s)return;const b=s.parentElement;if(!b)return;const C=()=>{const j=b.getBoundingClientRect();s.width=j.width,s.height=j.height,he()};C();const E=new ResizeObserver(()=>{C()});return E.observe(b),()=>{E.disconnect()}},[he]),k.useEffect(()=>{he()},[he]),k.useEffect(()=>{const s=C=>{C.target.tagName==="INPUT"||C.target.tagName==="TEXTAREA"||C.code==="Space"&&!C.repeat&&(C.preventDefault(),Me(!0))},b=C=>{C.target.tagName==="INPUT"||C.target.tagName==="TEXTAREA"||C.code==="Space"&&(C.preventDefault(),Me(!1),ve(!1),we(!1))};return window.addEventListener("keydown",s),window.addEventListener("keyup",b),()=>{window.removeEventListener("keydown",s),window.removeEventListener("keyup",b)}},[]);const dt=k.useCallback((s,b)=>({x:(s-y.panX)/y.zoom,y:(b-y.panY)/y.zoom}),[y]);k.useEffect(()=>{const s=l.current;if(!s||!T)return;const b=s.getContext("2d");if(he(),b.save(),b.translate(y.panX,y.panY),b.scale(y.zoom,y.zoom),m==="pointer")le(b,c,O);else if(m==="rectangle"){const C=Math.min(c.x,O.x),E=Math.min(c.y,O.y),j=Math.abs(O.x-c.x),P=Math.abs(O.y-c.y);ge(b,{x:C,y:E,width:j,height:P,strokeColor:d.rectangle.strokeColor,fillColor:d.rectangle.fillColor,lineWidth:d.rectangle.lineWidth})}else if(m==="circle"){const C=c.x,E=c.y,j=Math.sqrt(Math.pow(O.x-c.x,2)+Math.pow(O.y-c.y,2));Oe(b,{centerX:C,centerY:E,radius:j,strokeColor:d.circle.strokeColor,fillColor:d.circle.fillColor,lineWidth:d.circle.lineWidth})}else if(m==="pencil")Ne(b,{points:ee,strokeColor:d.pencil.strokeColor,lineWidth:d.pencil.lineWidth});else if(m==="triangle"){const C=Math.min(c.x,O.x),E=Math.min(c.y,O.y),j=Math.abs(O.x-c.x),P=Math.abs(O.y-c.y);Ke(b,{x:C,y:E,width:j,height:P,strokeColor:d.triangle.strokeColor,fillColor:d.triangle.fillColor,lineWidth:d.triangle.lineWidth})}else if(m==="diamond"){const C=Math.min(c.x,O.x),E=Math.min(c.y,O.y),j=Math.abs(O.x-c.x),P=Math.abs(O.y-c.y);Be(b,{x:C,y:E,width:j,height:P,strokeColor:d.diamond.strokeColor,fillColor:d.diamond.fillColor,lineWidth:d.diamond.lineWidth})}else if(m==="star"){const C=c.x,E=c.y,j=Math.sqrt(Math.pow(O.x-c.x,2)+Math.pow(O.y-c.y,2));it(b,{centerX:C,centerY:E,size:j,strokeColor:d.star.strokeColor,fillColor:d.star.fillColor,lineWidth:d.star.lineWidth})}else if(m==="heart"){const C=c.x,E=c.y,j=Math.sqrt(Math.pow(O.x-c.x,2)+Math.pow(O.y-c.y,2));Je(b,{centerX:C,centerY:E,size:j,strokeColor:d.heart.strokeColor,fillColor:d.heart.fillColor,lineWidth:d.heart.lineWidth})}else if(m==="hexagon"){const C=Math.min(c.x,O.x),E=Math.min(c.y,O.y),j=Math.abs(O.x-c.x),P=Math.abs(O.y-c.y);Ze(b,{x:C,y:E,width:j,height:P,strokeColor:d.hexagon.strokeColor,fillColor:d.hexagon.fillColor,lineWidth:d.hexagon.lineWidth})}else if(m==="octagon"){const C=Math.min(c.x,O.x),E=Math.min(c.y,O.y),j=Math.abs(O.x-c.x),P=Math.abs(O.y-c.y);at(b,{x:C,y:E,width:j,height:P,strokeColor:d.octagon.strokeColor,fillColor:d.octagon.fillColor,lineWidth:d.octagon.lineWidth})}else m==="arrow"&&st(b,{startX:c.x,startY:c.y,endX:O.x,endY:O.y,strokeColor:d.arrow.strokeColor,fillColor:d.arrow.fillColor,lineWidth:d.arrow.lineWidth});b.restore()},[T,m,c,O,ee,he,le,ge,Oe,Ne,Ke,Be,it,Je,Ze,at,st,y,d]);const wr=s=>{const C=l.current.getBoundingClientRect(),E=s.clientX-C.left,j=s.clientY-C.top;if(R||Xe)return;if(fe){s.preventDefault(),s.button===0?(ve(!0),Fe({x:E-y.panX,y:j-y.panY})):s.button===2&&(we(!0),Ge({y:j,initialZoom:y.zoom}));return}const{x:P,y:i}=dt(E,j);if(m==="pointer"){const v=ut(P,i);if(v)if(f(gt(v.id)),ae(!0),v.type==="rectangle")re({x:P-v.x,y:i-v.y});else if(v.type==="circle")re({x:P-v.centerX,y:i-v.centerY});else if(v.type==="pencil"){const _=Math.min(...v.points.map(L=>L.x)),D=Math.min(...v.points.map(L=>L.y));re({x:P-_,y:i-D})}else v.type==="text"?re({x:P-v.x,y:i-v.y}):v.type==="triangle"||v.type==="diamond"||v.type==="hexagon"||v.type==="octagon"?re({x:P-v.x,y:i-v.y}):v.type==="star"||v.type==="heart"?re({x:P-v.centerX,y:i-v.centerY}):v.type==="arrow"?re({x:P-v.startX,y:i-v.startY}):v.type==="image"&&re({x:P-v.x,y:i-v.y});else f(gt(null)),A(!0),N({x:P,y:i}),V({x:P,y:i})}else if(m==="text"){const v=Date.now().toString();f(pe({id:v,type:"text",x:P,y:i,text:"Text",fontSize:d.text.fontSize,fontColor:d.text.fontColor})),f(Te("pointer")),f(gt(v))}else if(m==="eraser"){const v=ut(P,i);v&&f(Oi(v.id))}else f(gt(null)),A(!0),N({x:P,y:i}),V({x:P,y:i}),m==="pencil"&&K([{x:P,y:i}])},Dt=s=>{const C=l.current.getBoundingClientRect(),E=s.clientX-C.left,j=s.clientY-C.top;if(Ee){f(ji({x:E-ke.x,y:j-ke.y}));return}if(be){const v=Re.y-j,D=Re.initialZoom*(1+v*.005);f(Pi(D));return}const{x:P,y:i}=dt(E,j);if(J&&S){const v=x.find(D=>D.id===S);if(!v)return;let _={};if(v.type==="rectangle")_={x:P-Z.x,y:i-Z.y};else if(v.type==="circle")_={centerX:P-Z.x,centerY:i-Z.y};else if(v.type==="pencil"){const D=Math.min(...v.points.map(W=>W.x)),L=Math.min(...v.points.map(W=>W.y)),$=P-Z.x-D,Y=i-Z.y-L;_={points:v.points.map(W=>({x:W.x+$,y:W.y+Y}))}}else if(v.type==="text")_={x:P-Z.x,y:i-Z.y};else if(v.type==="triangle"||v.type==="diamond"||v.type==="hexagon"||v.type==="octagon")_={x:P-Z.x,y:i-Z.y};else if(v.type==="star"||v.type==="heart")_={centerX:P-Z.x,centerY:i-Z.y};else if(v.type==="arrow"){const D=v.endX-v.startX,L=v.endY-v.startY;_={startX:P-Z.x,startY:i-Z.y,endX:P-Z.x+D,endY:i-Z.y+L}}else v.type==="image"&&(_={x:P-Z.x,y:i-Z.y});f(Mt({id:S,updates:_}));return}T&&(V({x:P,y:i}),m==="pencil"&&K(v=>[...v,{x:P,y:i}]))},It=()=>{if(Ee||be){ve(!1),we(!1);return}if(J){ae(!1);return}if(T){if(m==="pointer")he();else if(m==="rectangle"){const s=Math.min(c.x,O.x),b=Math.min(c.y,O.y),C=Math.abs(O.x-c.x),E=Math.abs(O.y-c.y);C>0&&E>0&&f(pe({id:Date.now().toString(),type:"rectangle",x:s,y:b,width:C,height:E,strokeColor:d.rectangle.strokeColor,fillColor:d.rectangle.fillColor,lineWidth:d.rectangle.lineWidth}))}else if(m==="circle"){const s=c.x,b=c.y,C=Math.sqrt(Math.pow(O.x-c.x,2)+Math.pow(O.y-c.y,2));C>0&&f(pe({id:Date.now().toString(),type:"circle",centerX:s,centerY:b,radius:C,strokeColor:d.circle.strokeColor,fillColor:d.circle.fillColor,lineWidth:d.circle.lineWidth}))}else if(m==="pencil")ee.length>1&&f(pe({id:Date.now().toString(),type:"pencil",points:[...ee],strokeColor:d.pencil.strokeColor,lineWidth:d.pencil.lineWidth})),K([]);else if(m==="triangle"){const s=Math.min(c.x,O.x),b=Math.min(c.y,O.y),C=Math.abs(O.x-c.x),E=Math.abs(O.y-c.y);C>0&&E>0&&f(pe({id:Date.now().toString(),type:"triangle",x:s,y:b,width:C,height:E,strokeColor:d.triangle.strokeColor,fillColor:d.triangle.fillColor,lineWidth:d.triangle.lineWidth}))}else if(m==="diamond"){const s=Math.min(c.x,O.x),b=Math.min(c.y,O.y),C=Math.abs(O.x-c.x),E=Math.abs(O.y-c.y);C>0&&E>0&&f(pe({id:Date.now().toString(),type:"diamond",x:s,y:b,width:C,height:E,strokeColor:d.diamond.strokeColor,fillColor:d.diamond.fillColor,lineWidth:d.diamond.lineWidth}))}else if(m==="star"){const s=c.x,b=c.y,C=Math.sqrt(Math.pow(O.x-c.x,2)+Math.pow(O.y-c.y,2));C>0&&f(pe({id:Date.now().toString(),type:"star",centerX:s,centerY:b,size:C,strokeColor:d.star.strokeColor,fillColor:d.star.fillColor,lineWidth:d.star.lineWidth}))}else if(m==="heart"){const s=c.x,b=c.y,C=Math.sqrt(Math.pow(O.x-c.x,2)+Math.pow(O.y-c.y,2));C>0&&f(pe({id:Date.now().toString(),type:"heart",centerX:s,centerY:b,size:C,strokeColor:d.heart.strokeColor,fillColor:d.heart.fillColor,lineWidth:d.heart.lineWidth}))}else if(m==="hexagon"){const s=Math.min(c.x,O.x),b=Math.min(c.y,O.y),C=Math.abs(O.x-c.x),E=Math.abs(O.y-c.y);C>0&&E>0&&f(pe({id:Date.now().toString(),type:"hexagon",x:s,y:b,width:C,height:E,strokeColor:d.hexagon.strokeColor,fillColor:d.hexagon.fillColor,lineWidth:d.hexagon.lineWidth}))}else if(m==="octagon"){const s=Math.min(c.x,O.x),b=Math.min(c.y,O.y),C=Math.abs(O.x-c.x),E=Math.abs(O.y-c.y);C>0&&E>0&&f(pe({id:Date.now().toString(),type:"octagon",x:s,y:b,width:C,height:E,strokeColor:d.octagon.strokeColor,fillColor:d.octagon.fillColor,lineWidth:d.octagon.lineWidth}))}else if(m==="arrow"){const s=O.x-c.x,b=O.y-c.y;Math.sqrt(s*s+b*b)>5&&f(pe({id:Date.now().toString(),type:"arrow",startX:c.x,startY:c.y,endX:O.x,endY:O.y,strokeColor:d.arrow.strokeColor,fillColor:d.arrow.fillColor,lineWidth:d.arrow.lineWidth}))}A(!1)}},zt=s=>{fe&&s.preventDefault()},Wt=()=>fe?Ee?"grabbing":be?"ns-resize":"grab":"default";return w.jsxs("div",{id:"wb-canvas-container",style:{backgroundColor:"#fff",position:"relative",width:"100%",height:"100%"},children:[w.jsx("canvas",{ref:l,onMouseDown:wr,onMouseMove:Dt,onMouseUp:It,onMouseLeave:It,onDoubleClick:s=>{const C=l.current.getBoundingClientRect(),E=s.clientX-C.left,j=s.clientY-C.top,{x:P,y:i}=dt(E,j),v=ut(P,i);v&&v.type==="text"&&(I(v.id),Ce({x:v.x,y:v.y}),se(v.text),ye(!0))},onContextMenu:zt,style:{cursor:Wt()}}),R&&w.jsx(na,{text:n||((Lt=t==null?void 0:t.lock)==null?void 0:Lt.text)||M.text}),Xe&&w.jsx("input",{type:"text",value:de,onChange:s=>se(s.target.value),onKeyDown:s=>{s.key==="Enter"&&de.trim()?(_e&&f(Mt({id:_e,updates:{text:de}})),ye(!1),se(""),I(null)):s.key==="Escape"&&(ye(!1),se(""),I(null))},onBlur:()=>{de.trim()&&_e&&f(Mt({id:_e,updates:{text:de}})),ye(!1),se(""),I(null)},onMouseDown:s=>s.stopPropagation(),autoFocus:!0,style:{position:"absolute",left:Se.x*y.zoom+y.panX,top:Se.y*y.zoom+y.panY,fontSize:d.text.fontSize*y.zoom,color:d.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)"}}),w.jsx(da,{onExport:br,onFitToView:bt,mode:h}),w.jsx(ha,{}),ce.visible&&w.jsx(Ii,{})]})}),pa=e=>w.jsx(yo,{store:An,children:w.jsx(Eo,{children:w.jsx(Ln,{...e})})});me.WhiteboardComponent=Ln,me.default=pa,me.store=An,me.whiteboardReducer=Nn,Object.defineProperties(me,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|