@hyxf/cover-editor 0.0.0-stage → 0.0.6
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/README.md +69 -2
- package/bin/ximage.js +15 -0
- package/dist/assets/index-227Gs3cf.js +515 -0
- package/dist/assets/index-BVq-pIyA.css +1 -0
- package/dist/fonts/DouyinSansBold.otf +0 -0
- package/dist/icons/18.svg +9 -0
- package/dist/icons/18a.svg +12 -0
- package/dist/icons/18c.svg +11 -0
- package/dist/icons/18d.svg +11 -0
- package/dist/index.html +17 -0
- package/package.json +58 -3
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const h of u.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function a(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(o){if(o.ep)return;o.ep=!0;const u=a(o);fetch(o.href,u)}})();function fy(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var zf={exports:{}},Zr={};var _v;function l_(){if(_v)return Zr;_v=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function a(r,o,u){var h=null;if(u!==void 0&&(h=""+u),o.key!==void 0&&(h=""+o.key),"key"in o){u={};for(var d in o)d!=="key"&&(u[d]=o[d])}else u=o;return o=u.ref,{$$typeof:n,type:r,key:h,ref:o!==void 0?o:null,props:u}}return Zr.Fragment=e,Zr.jsx=a,Zr.jsxs=a,Zr}var Cv;function r_(){return Cv||(Cv=1,zf.exports=l_()),zf.exports}var T=r_(),Nf={exports:{}},vt={};var Tv;function s_(){if(Tv)return vt;Tv=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),h=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),S=Symbol.iterator;function _(E){return E===null||typeof E!="object"?null:(E=S&&E[S]||E["@@iterator"],typeof E=="function"?E:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,Y={};function X(E,F,st){this.props=E,this.context=F,this.refs=Y,this.updater=st||w}X.prototype.isReactComponent={},X.prototype.setState=function(E,F){if(typeof E!="object"&&typeof E!="function"&&E!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,E,F,"setState")},X.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function q(){}q.prototype=X.prototype;function I(E,F,st){this.props=E,this.context=F,this.refs=Y,this.updater=st||w}var W=I.prototype=new q;W.constructor=I,R(W,X.prototype),W.isPureReactComponent=!0;var $=Array.isArray;function B(){}var G={H:null,A:null,T:null,S:null},lt=Object.prototype.hasOwnProperty;function ut(E,F,st){var N=st.ref;return{$$typeof:n,type:E,key:F,ref:N!==void 0?N:null,props:st}}function pt(E,F){return ut(E.type,F,E.props)}function mt(E){return typeof E=="object"&&E!==null&&E.$$typeof===n}function St(E){var F={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(st){return F[st]})}var Dt=/\/+/g;function yt(E,F){return typeof E=="object"&&E!==null&&E.key!=null?St(""+E.key):F.toString(36)}function P(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(B,B):(E.status="pending",E.then(function(F){E.status==="pending"&&(E.status="fulfilled",E.value=F)},function(F){E.status==="pending"&&(E.status="rejected",E.reason=F)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function tt(E,F,st,N,K){var Q=typeof E;(Q==="undefined"||Q==="boolean")&&(E=null);var it=!1;if(E===null)it=!0;else switch(Q){case"bigint":case"string":case"number":it=!0;break;case"object":switch(E.$$typeof){case n:case e:it=!0;break;case p:return it=E._init,tt(it(E._payload),F,st,N,K)}}if(it)return K=K(E),it=N===""?"."+yt(E,0):N,$(K)?(st="",it!=null&&(st=it.replace(Dt,"$&/")+"/"),tt(K,F,st,"",function(ri){return ri})):K!=null&&(mt(K)&&(K=pt(K,st+(K.key==null||E&&E.key===K.key?"":(""+K.key).replace(Dt,"$&/")+"/")+it)),F.push(K)),1;it=0;var J=N===""?".":N+":";if($(E))for(var ft=0;ft<E.length;ft++)N=E[ft],Q=J+yt(N,ft),it+=tt(N,F,st,Q,K);else if(ft=_(E),typeof ft=="function")for(E=ft.call(E),ft=0;!(N=E.next()).done;)N=N.value,Q=J+yt(N,ft++),it+=tt(N,F,st,Q,K);else if(Q==="object"){if(typeof E.then=="function")return tt(P(E),F,st,N,K);throw F=String(E),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return it}function rt(E,F,st){if(E==null)return E;var N=[],K=0;return tt(E,N,"","",function(Q){return F.call(st,Q,K++)}),N}function ct(E){if(E._status===-1){var F=E._result,st=F();st.then(function(N){(E._status===0||E._status===-1)&&(E._status=1,E._result=N,st.status===void 0&&(st.status="fulfilled",st.value=N))},function(N){(E._status===0||E._status===-1)&&(E._status=2,E._result=N,st.status===void 0&&(st.status="rejected",st.reason=N))}),E._status===-1&&(E._status=0,E._result=st)}if(E._status===1)return E._result.default;throw E._result}var dt=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)};function Jt(E){var F=G.T,st={};st.types=F!==null?F.types:null,G.T=st;try{var N=E(),K=G.S;K!==null&&K(st,N),typeof N=="object"&&N!==null&&typeof N.then=="function"&&N.then(B,dt)}catch(Q){dt(Q)}finally{F!==null&&st.types!==null&&(F.types=st.types),G.T=F}}function se(E){var F=G.T;if(F!==null){var st=F.types;st===null?F.types=[E]:st.indexOf(E)===-1&&st.push(E)}else Jt(se.bind(null,E))}var ee={map:rt,forEach:function(E,F,st){rt(E,function(){F.apply(this,arguments)},st)},count:function(E){var F=0;return rt(E,function(){F++}),F},toArray:function(E){return rt(E,function(F){return F})||[]},only:function(E){if(!mt(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return vt.Activity=y,vt.Children=ee,vt.Component=X,vt.Fragment=a,vt.Profiler=o,vt.PureComponent=I,vt.StrictMode=r,vt.Suspense=g,vt.ViewTransition=b,vt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=G,vt.__COMPILER_RUNTIME={__proto__:null,c:function(E){return G.H.useMemoCache(E)}},vt.addTransitionType=se,vt.cache=function(E){return function(){return E.apply(null,arguments)}},vt.cacheSignal=function(){return null},vt.cloneElement=function(E,F,st){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var N=R({},E.props),K=E.key;if(F!=null)for(Q in F.key!==void 0&&(K=""+F.key),F)!lt.call(F,Q)||Q==="key"||Q==="__self"||Q==="__source"||Q==="ref"&&F.ref===void 0||(N[Q]=F[Q]);var Q=arguments.length-2;if(Q===1)N.children=st;else if(1<Q){for(var it=Array(Q),J=0;J<Q;J++)it[J]=arguments[J+2];N.children=it}return ut(E.type,K,N)},vt.createContext=function(E){return E={$$typeof:h,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:u,_context:E},E},vt.createElement=function(E,F,st){var N,K={},Q=null;if(F!=null)for(N in F.key!==void 0&&(Q=""+F.key),F)lt.call(F,N)&&N!=="key"&&N!=="__self"&&N!=="__source"&&(K[N]=F[N]);var it=arguments.length-2;if(it===1)K.children=st;else if(1<it){for(var J=Array(it),ft=0;ft<it;ft++)J[ft]=arguments[ft+2];K.children=J}if(E&&E.defaultProps)for(N in it=E.defaultProps,it)K[N]===void 0&&(K[N]=it[N]);return ut(E,Q,K)},vt.createRef=function(){return{current:null}},vt.forwardRef=function(E){return{$$typeof:d,render:E}},vt.isValidElement=mt,vt.lazy=function(E){return{$$typeof:p,_payload:{_status:-1,_result:E},_init:ct}},vt.memo=function(E,F){return{$$typeof:m,type:E,compare:F===void 0?null:F}},vt.startTransition=Jt,vt.unstable_useCacheRefresh=function(){return G.H.useCacheRefresh()},vt.use=function(E){return G.H.use(E)},vt.useActionState=function(E,F,st){return G.H.useActionState(E,F,st)},vt.useCallback=function(E,F){return G.H.useCallback(E,F)},vt.useContext=function(E){return G.H.useContext(E)},vt.useDebugValue=function(){},vt.useDeferredValue=function(E,F){return G.H.useDeferredValue(E,F)},vt.useEffect=function(E,F){return G.H.useEffect(E,F)},vt.useEffectEvent=function(E){return G.H.useEffectEvent(E)},vt.useId=function(){return G.H.useId()},vt.useImperativeHandle=function(E,F,st){return G.H.useImperativeHandle(E,F,st)},vt.useInsertionEffect=function(E,F){return G.H.useInsertionEffect(E,F)},vt.useLayoutEffect=function(E,F){return G.H.useLayoutEffect(E,F)},vt.useMemo=function(E,F){return G.H.useMemo(E,F)},vt.useOptimistic=function(E,F){return G.H.useOptimistic(E,F)},vt.useReducer=function(E,F,st){return G.H.useReducer(E,F,st)},vt.useRef=function(E){return G.H.useRef(E)},vt.useState=function(E){return G.H.useState(E)},vt.useSyncExternalStore=function(E,F,st){return G.H.useSyncExternalStore(E,F,st)},vt.useTransition=function(){return G.H.useTransition()},vt.version="19.3.1",vt}var wv;function xd(){return wv||(wv=1,Nf.exports=s_()),Nf.exports}var at=xd();const jt=fy(at);var kf={exports:{}},$r={},Bf={exports:{}},Lf={};var Ov;function o_(){return Ov||(Ov=1,(function(n){function e(P,tt){var rt=P.length;P.push(tt);t:for(;0<rt;){var ct=rt-1>>>1,dt=P[ct];if(0<o(dt,tt))P[ct]=tt,P[rt]=dt,rt=ct;else break t}}function a(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var tt=P[0],rt=P.pop();if(rt!==tt){P[0]=rt;t:for(var ct=0,dt=P.length,Jt=dt>>>1;ct<Jt;){var se=2*(ct+1)-1,ee=P[se],E=se+1,F=P[E];if(0>o(ee,rt))E<dt&&0>o(F,ee)?(P[ct]=F,P[E]=rt,ct=E):(P[ct]=ee,P[se]=rt,ct=se);else if(E<dt&&0>o(F,rt))P[ct]=F,P[E]=rt,ct=E;else break t}}return tt}function o(P,tt){var rt=P.sortIndex-tt.sortIndex;return rt!==0?rt:P.id-tt.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var h=Date,d=h.now();n.unstable_now=function(){return h.now()-d}}var g=[],m=[],p=1,y=null,b=3,S=!1,_=!1,w=!1,R=!1,Y=typeof setTimeout=="function"?setTimeout:null,X=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function I(P){for(var tt=a(m);tt!==null;){if(tt.callback===null)r(m);else if(tt.startTime<=P)r(m),tt.sortIndex=tt.expirationTime,e(g,tt);else break;tt=a(m)}}function W(P){if(w=!1,I(P),!_)if(a(g)!==null)_=!0,$||($=!0,mt());else{var tt=a(m);tt!==null&&yt(W,tt.startTime-P)}}var $=!1,B=-1,G=5,lt=-1;function ut(){return R?!0:!(n.unstable_now()-lt<G)}function pt(){if(R=!1,$){var P=n.unstable_now();lt=P;var tt=!0;try{t:{_=!1,w&&(w=!1,X(B),B=-1),S=!0;var rt=b;try{e:{for(I(P),y=a(g);y!==null&&!(y.expirationTime>P&&ut());){var ct=y.callback;if(typeof ct=="function"){y.callback=null,b=y.priorityLevel;var dt=ct(y.expirationTime<=P);if(P=n.unstable_now(),typeof dt=="function"){y.callback=dt,I(P),tt=!0;break e}y===a(g)&&r(g),I(P)}else r(g);y=a(g)}if(y!==null)tt=!0;else{var Jt=a(m);Jt!==null&&yt(W,Jt.startTime-P),tt=!1}}break t}finally{y=null,b=rt,S=!1}tt=void 0}}finally{tt?mt():$=!1}}}var mt;if(typeof q=="function")mt=function(){q(pt)};else if(typeof MessageChannel<"u"){var St=new MessageChannel,Dt=St.port2;St.port1.onmessage=pt,mt=function(){Dt.postMessage(null)}}else mt=function(){Y(pt,0)};function yt(P,tt){B=Y(function(){P(n.unstable_now())},tt)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(P){P.callback=null},n.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<P?Math.floor(1e3/P):5},n.unstable_getCurrentPriorityLevel=function(){return b},n.unstable_next=function(P){switch(b){case 1:case 2:case 3:var tt=3;break;default:tt=b}var rt=b;b=tt;try{return P()}finally{b=rt}},n.unstable_requestPaint=function(){R=!0},n.unstable_runWithPriority=function(P,tt){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var rt=b;b=P;try{return tt()}finally{b=rt}},n.unstable_scheduleCallback=function(P,tt,rt){var ct=n.unstable_now();switch(typeof rt=="object"&&rt!==null?(rt=rt.delay,rt=typeof rt=="number"&&0<rt?ct+rt:ct):rt=ct,P){case 1:var dt=-1;break;case 2:dt=250;break;case 5:dt=1073741823;break;case 4:dt=1e4;break;default:dt=5e3}return dt=rt+dt,P={id:p++,callback:tt,priorityLevel:P,startTime:rt,expirationTime:dt,sortIndex:-1},rt>ct?(P.sortIndex=rt,e(m,P),a(g)===null&&P===a(m)&&(w?(X(B),B=-1):w=!0,yt(W,rt-ct))):(P.sortIndex=dt,e(g,P),_||S||(_=!0,$||($=!0,mt()))),P},n.unstable_shouldYield=ut,n.unstable_wrapCallback=function(P){var tt=b;return function(){var rt=b;b=tt;try{return P.apply(this,arguments)}finally{b=rt}}}})(Lf)),Lf}var Ev;function u_(){return Ev||(Ev=1,Bf.exports=o_()),Bf.exports}var Hf={exports:{}},Se={};var Dv;function c_(){if(Dv)return Se;Dv=1;var n=xd();function e(p){var y="https://react.dev/errors/"+p;if(1<arguments.length){y+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)y+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+p+"; visit "+y+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var r={d:{f:a,r:function(){throw Error(e(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},o=Symbol.for("react.portal"),u=Symbol.for("react.recoverable"),h=Symbol.for("react.optimistic_key");function d(p,y,b){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:S==null?null:S===h?h:""+S,children:p,containerInfo:y,implementation:b}}var g=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,y){if(p==="font")return"";if(typeof y=="string")return y==="use-credentials"?y:""}return Se.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Se.browser=function(p){return{$$typeof:u,_reason:p}},Se.createPortal=function(p,y){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!y||y.nodeType!==1&&y.nodeType!==9&&y.nodeType!==11)throw Error(e(299));return d(p,y,null,b)},Se.flushSync=function(p){var y=g.T,b=r.p;try{if(g.T=null,r.p=2,p)return p()}finally{g.T=y,r.p=b,r.d.f()}},Se.preconnect=function(p,y){typeof p=="string"&&(y?(y=y.crossOrigin,y=typeof y=="string"?y==="use-credentials"?y:"":void 0):y=null,r.d.C(p,y))},Se.prefetchDNS=function(p){typeof p=="string"&&r.d.D(p)},Se.preinit=function(p,y){if(typeof p=="string"&&y&&typeof y.as=="string"){var b=y.as,S=m(b,y.crossOrigin),_=typeof y.integrity=="string"?y.integrity:void 0,w=typeof y.fetchPriority=="string"?y.fetchPriority:void 0;b==="style"?r.d.S(p,typeof y.precedence=="string"?y.precedence:void 0,{crossOrigin:S,integrity:_,fetchPriority:w}):b==="script"&&r.d.X(p,{crossOrigin:S,integrity:_,fetchPriority:w,nonce:typeof y.nonce=="string"?y.nonce:void 0})}},Se.preinitModule=function(p,y){if(typeof p=="string")if(typeof y=="object"&&y!==null){if(y.as==null||y.as==="script"){var b=m(y.as,y.crossOrigin);r.d.M(p,{crossOrigin:b,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0,fetchPriority:typeof y.fetchPriority=="string"?y.fetchPriority:void 0})}}else y==null&&r.d.M(p)},Se.preload=function(p,y){if(typeof p=="string"&&typeof y=="object"&&y!==null&&typeof y.as=="string"){var b=y.as,S=m(b,y.crossOrigin);r.d.L(p,b,{crossOrigin:S,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0,type:typeof y.type=="string"?y.type:void 0,fetchPriority:typeof y.fetchPriority=="string"?y.fetchPriority:void 0,referrerPolicy:typeof y.referrerPolicy=="string"?y.referrerPolicy:void 0,imageSrcSet:typeof y.imageSrcSet=="string"?y.imageSrcSet:void 0,imageSizes:typeof y.imageSizes=="string"?y.imageSizes:void 0,media:typeof y.media=="string"?y.media:void 0})}},Se.preloadModule=function(p,y){if(typeof p=="string")if(y){var b=m(y.as,y.crossOrigin);r.d.m(p,{as:typeof y.as=="string"&&y.as!=="script"?y.as:void 0,crossOrigin:b,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0,fetchPriority:typeof y.fetchPriority=="string"?y.fetchPriority:void 0})}else r.d.m(p)},Se.requestFormReset=function(p){r.d.r(p)},Se.unstable_batchedUpdates=function(p,y){return p(y)},Se.useFormState=function(p,y,b){return g.H.useFormState(p,y,b)},Se.useFormStatus=function(){return g.H.useHostTransitionStatus()},Se.version="19.3.1",Se}var Mv;function h_(){if(Mv)return Hf.exports;Mv=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Hf.exports=c_(),Hf.exports}var Av;function f_(){if(Av)return $r;Av=1;var n=u_(),e=xd(),a=h_();function r(t){var i="https://react.dev/errors/"+t;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)i+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+t+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){for(var i=t,l=i;l&&!l.alternate;)i=l,(i.flags&4098)!==0&&(t=i.return),l=i.return;for(;i.return;)i=i.return;return i.tag===3?t:null}function h(t){if(t.tag===13){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function d(t){if(t.tag===31){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function g(t){if(u(t)!==t)throw Error(r(188))}function m(t){var i=t.alternate;if(!i){if(i=u(t),i===null)throw Error(r(188));return i!==t?null:t}for(var l=t,s=i;;){var c=l.return;if(c===null)break;var f=c.alternate;if(f===null){if(s=c.return,s!==null){l=s;continue}break}if(c.child===f.child){for(f=c.child;f;){if(f===l)return g(c),t;if(f===s)return g(c),i;f=f.sibling}throw Error(r(188))}if(l.return!==s.return)l=c,s=f;else{for(var v=!1,x=c.child;x;){if(x===l){v=!0,l=c,s=f;break}if(x===s){v=!0,s=c,l=f;break}x=x.sibling}if(!v){for(x=f.child;x;){if(x===l){v=!0,l=f,s=c;break}if(x===s){v=!0,s=f,l=c;break}x=x.sibling}if(!v)throw Error(r(189))}}if(l.alternate!==s)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?t:i}function p(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t;for(t=t.child;t!==null;){if(i=p(t),i!==null)return i;t=t.sibling}return null}function y(t,i,l,s,c,f){for(;t!==null;){if((t.tag===5||t.tag===27||t.tag===6)&&l(t,s,c,f)||(t.tag!==22||t.memoizedState===null)&&(i||t.tag!==5&&t.tag!==27)&&y(t.child,i,l,s,c,f))return!0;t=t.sibling}return!1}function b(t){for(t=t.return;t!==null;){if(t.tag===3||t.tag===5||t.tag===27)return t;t=t.return}return null}function S(t){var i=!1;for(t=t.return;t!==null&&(t.tag===4&&(i=!0),!(t.tag===3||t.tag===5||t.tag===27));)t=t.return;return i}function _(t){var i=[null,null],l=b(t);return l===null||w(i,t,l.child,{foundSelf:!1}),i}function w(t,i,l,s){for(;l!==null;){if(l===i)s.foundSelf=!0;else if(l.tag===5||l.tag===27||l.tag===6){if(s.foundSelf)return t[1]=l,!0;t[0]=l}else if((l.tag!==22||l.memoizedState===null)&&w(t,i,l.child,s))return!0;l=l.sibling}return!1}function R(t){switch(t.tag){case 5:case 27:case 6:return t.stateNode;case 3:return t.stateNode.containerInfo;default:throw Error(r(559))}}var Y=null,X=null;function q(t,i,l){return t===l?!0:t===i?(Y=t,!0):!1}function I(t,i,l){return t===l?(X=t,!1):t===i?(X!==null&&(Y=t),!0):!1}function W(t){if(t===null)return null;do t=t===null?null:t.return;while(t&&t.tag!==5&&t.tag!==27&&t.tag!==3);return t||null}function $(t,i,l){for(var s=0,c=t;c;c=l(c))s++;c=0;for(var f=i;f;f=l(f))c++;for(;0<s-c;)t=l(t),s--;for(;0<c-s;)i=l(i),c--;for(;s--;){if(t===i||i!==null&&t===i.alternate)return t;t=l(t),i=l(i)}return null}var B=Object.assign,G=Symbol.for("react.element"),lt=Symbol.for("react.transitional.element"),ut=Symbol.for("react.portal"),pt=Symbol.for("react.fragment"),mt=Symbol.for("react.strict_mode"),St=Symbol.for("react.profiler"),Dt=Symbol.for("react.consumer"),yt=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),tt=Symbol.for("react.suspense"),rt=Symbol.for("react.suspense_list"),ct=Symbol.for("react.memo"),dt=Symbol.for("react.lazy"),Jt=Symbol.for("react.activity"),se=Symbol.for("react.legacy_hidden"),ee=Symbol.for("react.memo_cache_sentinel"),E=Symbol.for("react.view_transition"),F=Symbol.for("react.recoverable"),st=Symbol.iterator;function N(t){return t===null||typeof t!="object"?null:(t=st&&t[st]||t["@@iterator"],typeof t=="function"?t:null)}var K=Symbol.for("react.client.reference");function Q(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===K?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case pt:return"Fragment";case St:return"Profiler";case mt:return"StrictMode";case tt:return"Suspense";case rt:return"SuspenseList";case Jt:return"Activity";case E:return"ViewTransition"}if(typeof t=="object")switch(t.$$typeof){case ut:return"Portal";case yt:return t.displayName||"Context";case Dt:return(t._context.displayName||"Context")+".Consumer";case P:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ct:return i=t.displayName||null,i!==null?i:Q(t.type)||"Memo";case dt:i=t._payload,t=t._init;try{return Q(t(i))}catch{}}return null}var it=Array.isArray,J=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ft=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ri={pending:!1,data:null,method:null,action:null},on=[],xa=-1;function zi(t){return{current:t}}function ge(t){0>xa||(t.current=on[xa],on[xa]=null,xa--)}function Gt(t,i){xa++,on[xa]=t.current,t.current=i}var Ni=zi(null),ar=zi(null),Sa=zi(null),ks=zi(null);function Bs(t,i){switch(Gt(Sa,i),Gt(ar,t),Gt(Ni,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?jp(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=jp(i),t=Rp(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}ge(Ni),Gt(Ni,t)}function qn(){ge(Ni),ge(ar),ge(Sa)}function $u(t){var i=t.memoizedState;i!==null&&(Rl._currentValue=i.memoizedState,Gt(ks,t)),i=Ni.current;var l=Rp(i,t.type);i!==l&&(Gt(ar,t),Gt(Ni,l))}function Ls(t){ar.current===t&&(ge(Ni),ge(ar)),ks.current===t&&(ge(ks),Rl._currentValue=ri)}var Ju,$d;function _a(t){if(Ju===void 0)try{throw Error()}catch(l){var i=l.stack.trim().match(/\n( *(at )?)/);Ju=i&&i[1]||"",$d=-1<l.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+Ju+t+$d}var tc=!1;function ec(t,i){if(!t||tc)return"";tc=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(i){var V=function(){throw Error()};if(Object.defineProperty(V.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(V,[])}catch(Z){var M=Z}Reflect.construct(t,[],V)}else{try{V.call()}catch(Z){M=Z}V=!1;try{var k=Object.getOwnPropertyDescriptor(t.prototype,"props");Object.defineProperty(t.prototype,"props",{configurable:!0,set:function(){throw Error()}}),V=!0,new t}finally{V&&(k!==void 0?Object.defineProperty(t.prototype,"props",k):delete t.prototype.props)}}}else{try{throw Error()}catch(Z){M=Z}(V=t())&&typeof V.catch=="function"&&V.catch(function(){})}}catch(Z){if(Z&&M&&typeof Z.stack=="string")return[Z.stack,M.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=s.DetermineComponentFrameRoot(),v=f[0],x=f[1];if(v&&x){var C=v.split(`
|
|
4
|
+
`),j=x.split(`
|
|
5
|
+
`);for(c=s=0;s<C.length&&!C[s].includes("DetermineComponentFrameRoot");)s++;for(;c<j.length&&!j[c].includes("DetermineComponentFrameRoot");)c++;if(s===C.length||c===j.length)for(s=C.length-1,c=j.length-1;1<=s&&0<=c&&C[s]!==j[c];)c--;for(;1<=s&&0<=c;s--,c--)if(C[s]!==j[c]){if(s!==1||c!==1)do if(s--,c--,0>c||C[s]!==j[c]){var L=`
|
|
6
|
+
`+C[s].replace(" at new "," at ");return t.displayName&&L.includes("<anonymous>")&&(L=L.replace("<anonymous>",t.displayName)),L}while(1<=s&&0<=c);break}}}finally{tc=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?_a(l):""}function ux(t,i){switch(t.tag){case 26:case 27:case 5:return _a(t.type);case 16:return _a("Lazy");case 13:return t.child!==i&&i!==null?_a("Suspense Fallback"):_a("Suspense");case 19:return _a("SuspenseList");case 0:case 15:return ec(t.type,!1);case 11:return ec(t.type.render,!1);case 1:return ec(t.type,!0);case 31:return _a("Activity");case 30:return _a("ViewTransition");default:return""}}function Jd(t){try{var i="",l=null;do i+=ux(t,l),l=t,t=t.return;while(t);return i}catch(s){return`
|
|
7
|
+
Error generating stack: `+s.message+`
|
|
8
|
+
`+s.stack}}var ic=Object.prototype.hasOwnProperty,ac=n.unstable_scheduleCallback,nc=n.unstable_cancelCallback,cx=n.unstable_shouldYield,hx=n.unstable_requestPaint,Ve=n.unstable_now,fx=n.unstable_getCurrentPriorityLevel,tg=n.unstable_ImmediatePriority,eg=n.unstable_UserBlockingPriority,Hs=n.unstable_NormalPriority,dx=n.unstable_LowPriority,ig=n.unstable_IdlePriority,gx=n.log,mx=n.unstable_setDisableYieldValue,nr=null,Fe=null;function Ca(t){if(typeof gx=="function"&&mx(t),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(nr,t)}catch{}}var Ge=Math.clz32?Math.clz32:yx,px=Math.log,vx=Math.LN2;function yx(t){return t>>>=0,t===0?32:31-(px(t)/vx|0)|0}var Ys=256,Us=262144,Xs=4194304;function un(t){var i=t&42;if(i!==0)return i;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&-t;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Vs(t,i,l){var s=t.pendingLanes;if(s===0)return 0;var c=0,f=t.suspendedLanes,v=t.pingedLanes;t=t.warmLanes;var x=s&134217727;return x!==0?(s=x&~f,s!==0?c=un(s):(v&=x,v!==0?c=un(v):l||(l=x&~t,l!==0&&(c=un(l))))):(x=s&~f,x!==0?c=un(x):v!==0?c=un(v):l||(l=s&~t,l!==0&&(c=un(l)))),c===0?0:i!==0&&i!==c&&(i&f)===0&&(f=c&-c,l=i&-i,f>=l||f===32&&(l&4194048)!==0)?i:c}function lr(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function ag(t,i){(i&8)!==0&&(i|=i&32);var l=t.entangledLanes;if(l!==0)for(t=t.entanglements,l&=i;0<l;){var s=31-Ge(l),c=1<<s;i|=t[s],l&=~c}return i}function bx(t,i){switch(t){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ng(){var t=Xs;return Xs<<=1,(Xs&62914560)===0&&(Xs=4194304),t}function lc(t){for(var i=[],l=0;31>l;l++)i.push(t);return i}function rr(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function xx(t,i,l,s,c,f){var v=t.pendingLanes;t.pendingLanes=l,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=l,t.entangledLanes&=l,t.errorRecoveryDisabledLanes&=l,t.shellSuspendCounter=0;var x=t.entanglements,C=t.expirationTimes,j=t.hiddenUpdates;for(l=v&~l;0<l;){var L=31-Ge(l),V=1<<L;x[L]=0,C[L]=-1;var M=j[L];if(M!==null)for(j[L]=null,L=0;L<M.length;L++){var k=M[L];k!==null&&(k.lane&=-536870913)}l&=~V}s!==0&&lg(t,s,0),f!==0&&c===0&&t.tag!==0&&(t.suspendedLanes|=f&~(v&~i))}function lg(t,i,l){t.pendingLanes|=i,t.suspendedLanes&=~i;var s=31-Ge(i);t.entangledLanes|=i,t.entanglements[s]=t.entanglements[s]|1073741824|l&261930}function rg(t,i){var l=t.entangledLanes|=i;for(t=t.entanglements;l;){var s=31-Ge(l),c=1<<s;c&i|t[s]&i&&(t[s]|=i),l&=~c}}function sg(t,i){var l=i&-i;return l=(l&42)!==0?1:rc(l),(l&(t.suspendedLanes|i))!==0?0:l}function rc(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function sc(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function og(){var t=ft.p;return t!==0?t:(t=window.event,t===void 0?32:mv(t.type))}function ug(t,i){var l=ft.p;try{return ft.p=t,i()}finally{ft.p=l}}var Zi=Math.random().toString(36).slice(2),me="__reactFiber$"+Zi,ke="__reactProps$"+Zi,Pn="__reactContainer$"+Zi,cg="__reactEvents$"+Zi,Sx="__reactListeners$"+Zi,_x="__reactHandles$"+Zi,hg="__reactResources$"+Zi,sr="__reactMarker$"+Zi,Fs="__reactLoad$"+Zi;function Gs(t){delete t[me],delete t[ke],delete t[Sx],delete t[_x]}function cn(t){var i;if(i=t[me])return i;for(var l=t.parentNode;l;){if(i=l[Pn]||l[me]){if(l=i.alternate,i.child!==null||l!==null&&l.child!==null)for(t=Ip(t);t!==null;){if(l=t[me])return l;t=Ip(t)}return i}t=l,l=t.parentNode}return null}function Qn(t){if(t=t[me]||t[Pn]){var i=t.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return t}return null}function or(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t.stateNode;throw Error(r(33))}function Kn(t){var i=t[hg];return i||(i=t[hg]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function ue(t){t[sr]=!0}function fg(t){t[Fs]=void 0}var dg=new Set,gg={};function hn(t,i){In(t,i),In(t+"Capture",i)}function In(t,i){for(gg[t]=i,t=0;t<i.length;t++)dg.add(i[t])}var Cx=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),mg={},pg={};function Tx(t){return ic.call(pg,t)?!0:ic.call(mg,t)?!1:Cx.test(t)?pg[t]=!0:(mg[t]=!0,!1)}var Rt=!1;function vg(){var t=Rt;return Rt=!1,t}function qs(t,i,l){if(Tx(i))if(l===null)t.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":t.removeAttribute(i);return;case"boolean":var s=i.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){t.removeAttribute(i);return}}t.setAttribute(i,l)}}function Ps(t,i,l){if(l===null)t.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttribute(i,l)}}function $i(t,i,l,s){if(s===null)t.removeAttribute(l);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(l);return}t.setAttributeNS(i,l,s)}}function qe(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function yg(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function wx(t,i,l){var s=Object.getOwnPropertyDescriptor(t.constructor.prototype,i);if(!t.hasOwnProperty(i)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,f=s.set;return Object.defineProperty(t,i,{configurable:!0,get:function(){return c.call(this)},set:function(v){l=""+v,f.call(this,v)}}),Object.defineProperty(t,i,{enumerable:s.enumerable}),{getValue:function(){return l},setValue:function(v){l=""+v},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function oc(t){if(!t._valueTracker){var i=yg(t)?"checked":"value";t._valueTracker=wx(t,i,""+t[i])}}function bg(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var l=i.getValue(),s="";return t&&(s=yg(t)?t.checked?"true":"false":t.value),t=s,t!==l?(i.setValue(t),!0):!1}var Ox=/[\n"\\]/g;function si(t){return t.replace(Ox,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function uc(t,i,l,s,c,f,v,x){t.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?t.type=v:t.removeAttribute("type"),i!=null?v==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+qe(i)):t.value!==""+qe(i)&&(t.value=""+qe(i)):v!=="submit"&&v!=="reset"||t.removeAttribute("value"),i!=null?v==="number"&&t.value==i?cc(t,qe(t.value)):cc(t,qe(i)):l!=null?cc(t,qe(l)):s!=null&&t.removeAttribute("value"),c==null&&f!=null&&(t.defaultChecked=!!f),c!=null&&(t.checked=c&&typeof c!="function"&&typeof c!="symbol"),x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?t.name=""+qe(x):t.removeAttribute("name")}function xg(t,i,l,s,c,f,v,x){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(t.type=f),i!=null||l!=null){if(!(f!=="submit"&&f!=="reset"||i!=null)){oc(t);return}l=l!=null?""+qe(l):"",i=i!=null?""+qe(i):l,x||i===t.value||(t.value=i),t.defaultValue=i}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,t.checked=x?t.checked:!!s,t.defaultChecked=!!s,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(t.name=v),oc(t)}function cc(t,i){t.defaultValue!==""+i&&(t.defaultValue=""+i)}function Wn(t,i,l,s){if(t=t.options,i){i={};for(var c=0;c<l.length;c++)i["$"+l[c]]=!0;for(l=0;l<t.length;l++)c=i.hasOwnProperty("$"+t[l].value),t[l].selected!==c&&(t[l].selected=c),c&&s&&(t[l].defaultSelected=!0)}else{for(l=""+qe(l),i=null,c=0;c<t.length;c++){if(t[c].value===l){t[c].selected=!0,s&&(t[c].defaultSelected=!0);return}i!==null||t[c].disabled||(i=t[c])}i!==null&&(i.selected=!0)}}function Sg(t,i,l){if(i!=null&&(i=""+qe(i),i!==t.value&&(t.value=i),l==null)){t.defaultValue!==i&&(t.defaultValue=i);return}t.defaultValue=l!=null?""+qe(l):""}function _g(t,i,l,s){if(i==null){if(s!=null){if(l!=null)throw Error(r(92));if(it(s)){if(1<s.length)throw Error(r(93));s=s[0]}l=s}l==null&&(l=""),i=l}l=qe(i),t.defaultValue=l,s=t.textContent,s===l&&s!==""&&s!==null&&(t.value=s),oc(t)}function Zn(t,i){if(i){var l=t.firstChild;if(l&&l===t.lastChild&&l.nodeType===3){l.nodeValue=i;return}}t.textContent=i}var Ex=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Cg(t,i,l){var s=i.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?s?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="":s?t.setProperty(i,l):typeof l!="number"||l===0||Ex.has(i)?i==="float"?t.cssFloat=l:t[i]=(""+l).trim():t[i]=l+"px"}function Tg(t,i,l){if(i!=null&&typeof i!="object")throw Error(r(62));if(t=t.style,l!=null){for(var s in l)!l.hasOwnProperty(s)||i!=null&&i.hasOwnProperty(s)||(s.indexOf("--")===0?t.setProperty(s,""):s==="float"?t.cssFloat="":t[s]="",Rt=!0);for(var c in i)s=i[c],i.hasOwnProperty(c)&&l[c]!==s&&(Cg(t,c,s),Rt=!0)}else for(var f in i)i.hasOwnProperty(f)&&Cg(t,f,i[f])}function hc(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Dx=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Mx=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Qs(t){return Mx.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function ki(){}var fc=null;function dc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var $n=null,Jn=null;function wg(t){var i=Qn(t);if(i&&(t=i.stateNode)){var l=t[ke]||null;t:switch(t=i.stateNode,i.type){case"input":if(uc(t,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),i=l.name,l.type==="radio"&&i!=null){for(l=t;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+si(""+i)+'"][type="radio"]'),i=0;i<l.length;i++){var s=l[i];if(s!==t&&s.form===t.form){var c=s[ke]||null;if(!c)throw Error(r(90));uc(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(i=0;i<l.length;i++)s=l[i],s.form===t.form&&bg(s)}break t;case"textarea":Sg(t,l.value,l.defaultValue);break t;case"select":i=l.value,i!=null&&Wn(t,!!l.multiple,i,!1)}}}var gc=!1;function Og(t,i,l){if(gc)return t(i,l);gc=!0;try{var s=t(i);return s}finally{if(gc=!1,($n!==null||Jn!==null)&&(Ko(),$n&&(i=$n,t=Jn,Jn=$n=null,wg(i),t)))for(i=0;i<t.length;i++)wg(t[i])}}function ur(t,i){var l=t.stateNode;if(l===null)return null;var s=l[ke]||null;if(s===null)return null;l=s[i];t:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(t=t.type,s=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!s;break t;default:t=!1}if(t)return null;if(l&&typeof l!="function")throw Error(r(231,i,typeof l));return l}var Ji=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mc=!1;if(Ji)try{var cr={};Object.defineProperty(cr,"passive",{get:function(){mc=!0}}),window.addEventListener("test",cr,cr),window.removeEventListener("test",cr,cr)}catch{mc=!1}var Ta=null,pc=null,Ks=null;function Eg(){if(Ks)return Ks;var t,i=pc,l=i.length,s,c="value"in Ta?Ta.value:Ta.textContent,f=c.length;for(t=0;t<l&&i[t]===c[t];t++);var v=l-t;for(s=1;s<=v&&i[l-s]===c[f-s];s++);return Ks=c.slice(t,1<s?1-s:void 0)}function Is(t){var i=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&i===13&&(t=13)):t=i,t===10&&(t=13),32<=t||t===13?t:0}function Ws(){return!0}function Dg(){return!1}function Ee(t){function i(l,s,c,f,v){this._reactName=l,this._targetInst=c,this.type=s,this.nativeEvent=f,this.target=v,this.currentTarget=null;for(var x in t)t.hasOwnProperty(x)&&(l=t[x],this[x]=l?l(f):f[x]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Ws:Dg,this.isPropagationStopped=Dg,this}return B(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Ws)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Ws)},persist:function(){},isPersistent:Ws}),i}var wa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zs=Ee(wa),hr=B({},wa,{view:0,detail:0}),Ax=Ee(hr),vc,yc,fr,$s=B({},hr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==fr&&(fr&&t.type==="mousemove"?(vc=t.screenX-fr.screenX,yc=t.screenY-fr.screenY):yc=vc=0,fr=t),vc)},movementY:function(t){return"movementY"in t?t.movementY:yc}}),Mg=Ee($s),jx=B({},$s,{dataTransfer:0}),Rx=Ee(jx),zx=B({},hr,{relatedTarget:0}),bc=Ee(zx),Nx=B({},wa,{animationName:0,elapsedTime:0,pseudoElement:0}),kx=Ee(Nx),Bx=B({},wa,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Lx=Ee(Bx),Hx=B({},wa,{data:0}),Ag=Ee(Hx),Yx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ux={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Xx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Vx(t){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(t):(t=Xx[t])?!!i[t]:!1}function xc(){return Vx}var Fx=B({},hr,{key:function(t){if(t.key){var i=Yx[t.key]||t.key;if(i!=="Unidentified")return i}return t.type==="keypress"?(t=Is(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Ux[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xc,charCode:function(t){return t.type==="keypress"?Is(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Is(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Gx=Ee(Fx),qx=B({},$s,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jg=Ee(qx),Px=B({},wa,{submitter:0}),Qx=Ee(Px),Kx=B({},hr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xc}),Ix=Ee(Kx),Wx=B({},wa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Zx=Ee(Wx),$x=B({},$s,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Jx=Ee($x),t1=B({},wa,{newState:0,oldState:0,source:0}),e1=Ee(t1),i1=[9,13,27,32],Sc=Ji&&"CompositionEvent"in window,dr=null;Ji&&"documentMode"in document&&(dr=document.documentMode);var a1=Ji&&"TextEvent"in window&&!dr,Rg=Ji&&(!Sc||dr&&8<dr&&11>=dr),zg=" ",Ng=!1;function kg(t,i){switch(t){case"keyup":return i1.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var tl=!1;function n1(t,i){switch(t){case"compositionend":return Bg(i);case"keypress":return i.which!==32?null:(Ng=!0,zg);case"textInput":return t=i.data,t===zg&&Ng?null:t;default:return null}}function l1(t,i){if(tl)return t==="compositionend"||!Sc&&kg(t,i)?(t=Eg(),Ks=pc=Ta=null,tl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Rg&&i.locale!=="ko"?null:i.data;default:return null}}var r1={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Lg(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i==="input"?!!r1[t.type]:i==="textarea"}function Hg(t,i,l,s){$n?Jn?Jn.push(s):Jn=[s]:$n=s,i=tu(i,"onChange"),0<i.length&&(l=new Zs("onChange","change",null,l,s),t.push({event:l,listeners:i}))}var gr=null,mr=null;function s1(t){wp(t,0)}function Js(t){var i=or(t);if(bg(i))return t}function Yg(t,i){if(t==="change")return i}var Ug=!1;if(Ji){var _c;if(Ji){var Cc="oninput"in document;if(!Cc){var Xg=document.createElement("div");Xg.setAttribute("oninput","return;"),Cc=typeof Xg.oninput=="function"}_c=Cc}else _c=!1;Ug=_c&&(!document.documentMode||9<document.documentMode)}function Vg(){gr&&(gr.detachEvent("onpropertychange",Fg),mr=gr=null)}function Fg(t){if(t.propertyName==="value"&&Js(mr)){var i=[];Hg(i,mr,t,dc(t)),Og(s1,i)}}function o1(t,i,l){t==="focusin"?(Vg(),gr=i,mr=l,gr.attachEvent("onpropertychange",Fg)):t==="focusout"&&Vg()}function u1(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Js(mr)}function c1(t,i){if(t==="click")return Js(i)}function h1(t,i){if(t==="input"||t==="change")return Js(i)}function f1(t,i){return t===i&&(t!==0||1/t===1/i)||t!==t&&i!==i}var Pe=typeof Object.is=="function"?Object.is:f1;function pr(t,i){if(Pe(t,i))return!0;if(typeof t!="object"||t===null||typeof i!="object"||i===null)return!1;var l=Object.keys(t),s=Object.keys(i);if(l.length!==s.length)return!1;for(s=0;s<l.length;s++){var c=l[s];if(!ic.call(i,c)||!Pe(t[c],i[c]))return!1}return!0}function Tc(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Gg(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function qg(t,i){var l=Gg(t);t=0;for(var s;l;){if(l.nodeType===3){if(s=t+l.textContent.length,t<=i&&s>=i)return{node:l,offset:i-t};t=s}t:{for(;l;){if(l.nextSibling){l=l.nextSibling;break t}l=l.parentNode}l=void 0}l=Gg(l)}}function Pg(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Pg(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Qg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=Tc(t.document);i instanceof t.HTMLIFrameElement;){try{var l=typeof i.contentWindow.location.href=="string"}catch{l=!1}if(l)t=i.contentWindow;else break;i=Tc(t.document)}return i}function wc(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}var d1=Ji&&"documentMode"in document&&11>=document.documentMode,el=null,Oc=null,vr=null,Ec=!1;function Kg(t,i,l){var s=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Ec||el==null||el!==Tc(s)||(s=el,"selectionStart"in s&&wc(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),vr&&pr(vr,s)||(vr=s,s=tu(Oc,"onSelect"),0<s.length&&(i=new Zs("onSelect","select",null,i,l),t.push({event:i,listeners:s}),i.target=el)))}function fn(t,i){var l={};return l[t.toLowerCase()]=i.toLowerCase(),l["Webkit"+t]="webkit"+i,l["Moz"+t]="moz"+i,l}var il={animationend:fn("Animation","AnimationEnd"),animationiteration:fn("Animation","AnimationIteration"),animationstart:fn("Animation","AnimationStart"),transitionrun:fn("Transition","TransitionRun"),transitionstart:fn("Transition","TransitionStart"),transitioncancel:fn("Transition","TransitionCancel"),transitionend:fn("Transition","TransitionEnd")},Dc={},Ig={};Ji&&(Ig=document.createElement("div").style,"AnimationEvent"in window||(delete il.animationend.animation,delete il.animationiteration.animation,delete il.animationstart.animation),"TransitionEvent"in window||delete il.transitionend.transition);function dn(t){if(Dc[t])return Dc[t];if(!il[t])return t;var i=il[t],l;for(l in i)if(i.hasOwnProperty(l)&&l in Ig)return Dc[t]=i[l];return t}var Wg=dn("animationend"),Zg=dn("animationiteration"),$g=dn("animationstart"),g1=dn("transitionrun"),m1=dn("transitionstart"),p1=dn("transitioncancel"),Jg=dn("transitionend"),tm=new Map,Mc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Mc.push("scrollEnd");function bi(t,i){tm.set(t,i),hn(i,[t])}var v1=0;function ta(t,i){if(t.name!=null&&t.name!=="auto")return t.name;if(i.autoName!==null)return i.autoName;t=Ci.identifierPrefix;var l=v1++;return t="_"+t+"t_"+l.toString(32)+"_",i.autoName=t}function em(t){if(t==null||typeof t=="string")return t;var i=null,l=_l;if(l!==null)for(var s=0;s<l.length;s++){var c=t[l[s]];if(c!=null){if(c==="none")return"none";i=i==null?c:i+(" "+c)}}return i??t.default}function ea(t,i){return t=em(t),i=em(i),i==null?t==="auto"?null:t:i==="auto"?null:i}var to=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},oi=[],al=0,Ac=0;function eo(){for(var t=al,i=Ac=al=0;i<t;){var l=oi[i];oi[i++]=null;var s=oi[i];oi[i++]=null;var c=oi[i];oi[i++]=null;var f=oi[i];if(oi[i++]=null,s!==null&&c!==null){var v=s.pending;v===null?c.next=c:(c.next=v.next,v.next=c),s.pending=c}f!==0&&im(l,c,f)}}function io(t,i,l,s){oi[al++]=t,oi[al++]=i,oi[al++]=l,oi[al++]=s,Ac|=s,t.lanes|=s,t=t.alternate,t!==null&&(t.lanes|=s)}function jc(t,i,l,s){return io(t,i,l,s),ao(t)}function gn(t,i){return io(t,null,null,i),ao(t)}function im(t,i,l){t.lanes|=l;var s=t.alternate;s!==null&&(s.lanes|=l);for(var c=!1,f=t.return;f!==null;)f.childLanes|=l,s=f.alternate,s!==null&&(s.childLanes|=l),f.tag===22&&(t=f.stateNode,t===null||t._visibility&1||(c=!0)),t=f,f=f.return;return t.tag===3?(f=t.stateNode,c&&i!==null&&(c=31-Ge(l),t=f.hiddenUpdates,s=t[c],s===null?t[c]=[i]:s.push(i),i.lane=l|536870912),f):null}function ao(t){if(50<Yr)throw Yr=0,Qo=null,Error(r(185));for(var i=t.return;i!==null;)t=i,i=t.return;return t.tag===3?t.stateNode:null}var nl={};function y1(t,i,l,s){this.tag=t,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Be(t,i,l,s){return new y1(t,i,l,s)}function Rc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ia(t,i){var l=t.alternate;return l===null?(l=Be(t.tag,i,t.key,t.mode),l.elementType=t.elementType,l.type=t.type,l.stateNode=t.stateNode,l.alternate=t,t.alternate=l):(l.pendingProps=i,l.type=t.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=t.flags&1206910976,l.childLanes=t.childLanes,l.lanes=t.lanes,l.child=t.child,l.memoizedProps=t.memoizedProps,l.memoizedState=t.memoizedState,l.updateQueue=t.updateQueue,i=t.dependencies,l.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},l.sibling=t.sibling,l.index=t.index,l.ref=t.ref,l.refCleanup=t.refCleanup,l}function am(t,i){t.flags&=1206910978;var l=t.alternate;return l===null?(t.childLanes=0,t.lanes=i,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=l.childLanes,t.lanes=l.lanes,t.child=l.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=l.memoizedProps,t.memoizedState=l.memoizedState,t.updateQueue=l.updateQueue,t.type=l.type,i=l.dependencies,t.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),t}function no(t,i,l,s,c,f){var v=0;if(s=t,typeof s=="function")Rc(s)&&(v=1);else if(typeof s=="string")v=PS(t,l,Ni.current)?26:t==="html"||t==="head"||t==="body"?27:5;else t:switch(s){case Jt:return t=Be(31,l,i,c),t.elementType=Jt,t.lanes=f,t;case pt:return mn(l.children,c,f,i);case mt:v=8,c|=24;break;case St:return t=Be(12,l,i,c|2),t.elementType=St,t.lanes=f,t;case tt:return t=Be(13,l,i,c),t.elementType=tt,t.lanes=f,t;case rt:return t=Be(19,l,i,c),t.elementType=rt,t.lanes=f,t;case se:case E:return t=c|32,t=Be(30,l,i,t),t.elementType=E,t.lanes=f,t.stateNode={autoName:null,paired:null,clones:null,ref:null},t;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case yt:v=10;break t;case Dt:v=9;break t;case P:v=11;break t;case ct:v=14;break t;case dt:v=16,s=null;break t}v=29,l=Error(r(130,t===null?"null":typeof t,"")),s=null}return i=Be(v,l,i,c),i.elementType=t,i.type=s,i.lanes=f,i}function mn(t,i,l,s){return t=Be(7,t,s,i),t.lanes=l,t}function zc(t,i,l){return t=Be(6,t,null,i),t.lanes=l,t}function nm(t){var i=Be(18,null,null,0);return i.stateNode=t,i}function Nc(t,i,l){return i=Be(4,t.children!==null?t.children:[],t.key,i),i.lanes=l,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}var lm=new WeakMap;function ui(t,i){if(typeof t=="object"&&t!==null){var l=lm.get(t);return l!==void 0?l:(i={value:t,source:i,stack:Jd(i)},lm.set(t,i),i)}return{value:t,source:i,stack:Jd(i)}}var ll=[],rl=0,lo=null,yr=0,ci=[],hi=0,Oa=null,Bi=1,Li="";function aa(t,i){ll[rl++]=yr,ll[rl++]=lo,lo=t,yr=i}function rm(t,i,l){ci[hi++]=Bi,ci[hi++]=Li,ci[hi++]=Oa,Oa=t;var s=Bi;t=Li;var c=32-Ge(s)-1;s&=~(1<<c),l+=1;var f=32-Ge(i)+c;if(30<f){var v=c-c%5;f=(s&(1<<v)-1).toString(32),s>>=v,c-=v,Bi=1<<32-Ge(i)+c|l<<c|s,Li=f+t}else Bi=1<<f|l<<c|s,Li=t}function ro(t){t.return!==null&&(aa(t,1),rm(t,1,0))}function kc(t){for(;t===lo;)lo=ll[--rl],ll[rl]=null,yr=ll[--rl],ll[rl]=null;for(;t===Oa;)Oa=ci[--hi],ci[hi]=null,Li=ci[--hi],ci[hi]=null,Bi=ci[--hi],ci[hi]=null}function sm(t,i){ci[hi++]=Bi,ci[hi++]=Li,ci[hi++]=Oa,Bi=i.id,Li=i.overflow,Oa=t}var ce=null,qt=null,Ct=!1,Ea=null,fi=!1,Bc=Error(r(519));function Da(t){var i=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw br(ui(i,t)),Bc}function om(t){var i=t.stateNode,l=t.type,s=t.memoizedProps;switch(i[me]=t,i[ke]=s,l){case"dialog":wt("cancel",i),wt("close",i);break;case"iframe":case"object":case"embed":wt("load",i);break;case"video":case"audio":for(l=0;l<Xr.length;l++)wt(Xr[l],i);break;case"source":wt("error",i);break;case"img":case"image":case"link":wt("error",i),wt("load",i);break;case"details":wt("toggle",i);break;case"input":wt("invalid",i),xg(i,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":wt("invalid",i);break;case"textarea":wt("invalid",i),_g(i,s.value,s.defaultValue,s.children)}l=s.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||i.textContent===""+l||s.suppressHydrationWarning===!0||Mp(i.textContent,l)?(s.popover!=null&&(wt("beforetoggle",i),wt("toggle",i)),s.onScroll!=null&&wt("scroll",i),s.onScrollEnd!=null&&wt("scrollend",i),s.onClick!=null&&(i.onclick=ki),i=!0):i=!1,i||Da(t,!0)}function so(t){for(ce=t.return;ce;)switch(ce.tag){case 5:case 31:case 13:fi=!1;return;case 27:case 3:fi=!0;return;default:ce=ce.return}}function sl(t){if(t!==ce)return!1;if(!Ct)return so(t),Ct=!0,!1;var i=t.tag,l;if((l=i!==3&&i!==27)&&((l=i===5)&&(l=t.type,l=!(l!=="form"&&l!=="button")||df(t.type,t.memoizedProps)),l=!l),l&&qt&&Da(t),so(t),i===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));qt=Kp(t)}else if(i===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));qt=Kp(t)}else i===27?(i=qt,Ga(t.type)?(t=_f,_f=null,qt=t):qt=i):qt=ce?gi(t.stateNode.nextSibling):null;return!0}function pn(){qt=ce=null,Ct=!1}function Lc(){var t=Ea;return t!==null&&(Ye===null?Ye=t:Ye.push.apply(Ye,t),Ea=null),t}function br(t){Ea===null?Ea=[t]:Ea.push(t)}var Hc=zi(null),vn=null,na=null;function Ma(t,i,l){Gt(Hc,i._currentValue),i._currentValue=l}function la(t){t._currentValue=Hc.current,ge(Hc)}function oo(t,i,l){for(;t!==null;){var s=t.alternate;if((t.childLanes&i)!==i?(t.childLanes|=i,s!==null&&(s.childLanes|=i)):s!==null&&(s.childLanes&i)!==i&&(s.childLanes|=i),t===l)break;t=t.return}}function Yc(t,i,l,s){var c=t.child;for(c!==null&&(c.return=t);c!==null;){var f=c.dependencies;if(f!==null){var v=c.child;f=f.firstContext;t:for(;f!==null;){var x=f;f=c;for(var C=0;C<i.length;C++)if(x.context===i[C]){f.lanes|=l,x=f.alternate,x!==null&&(x.lanes|=l),oo(f.return,l,t),s||(v=null);break t}f=x.next}}else if(c.tag===18){if(v=c.return,v===null)throw Error(r(341));v.lanes|=l,f=v.alternate,f!==null&&(f.lanes|=l),oo(v,l,t),v=null}else c.tag===13&&c.memoizedState!==null&&c.memoizedState.dehydrated===null?(c.lanes|=l,v=c.alternate,v!==null&&(v.lanes|=l),oo(c.return,l,t),v=c.child,v=v!==null?v.sibling:null):v=c.child;if(v!==null)v.return=c;else for(v=c;v!==null;){if(v===t){v=null;break}if(c=v.sibling,c!==null){c.return=v.return,v=c;break}v=v.return}c=v}}function yn(t,i,l,s){t=null;for(var c=i,f=!1;c!==null;){if(!f){if((c.flags&524288)!==0)f=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var v=c.alternate;if(v===null)throw Error(r(387));if(v=v.memoizedProps,v!==null){var x=c.type;Pe(c.pendingProps.value,v.value)||(t!==null?t.push(x):t=[x])}}else if(c===ks.current){if(v=c.alternate,v===null)throw Error(r(387));v.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(t!==null?t.push(Rl):t=[Rl])}c=c.return}return t!==null&&Yc(i,t,l,s),i.flags|=262144,t!==null}function uo(t){for(t=t.firstContext;t!==null;){if(!Pe(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function bn(t){vn=t,na=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function pe(t){return um(vn,t)}function co(t,i){return vn===null&&bn(t),um(t,i)}function um(t,i){var l=i._currentValue;if(i={context:i,memoizedValue:l,next:null},na===null){if(t===null)throw Error(r(308));na=i,t.dependencies={lanes:0,firstContext:i},t.flags|=524288}else na=na.next=i;return l}var b1=typeof AbortController<"u"?AbortController:function(){var t=[],i=this.signal={aborted:!1,addEventListener:function(l,s){t.push(s)}};this.abort=function(){i.aborted=!0,t.forEach(function(l){return l()})}},x1=n.unstable_scheduleCallback,S1=n.unstable_NormalPriority,ie={$$typeof:yt,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uc(){return{controller:new b1,data:new Map,refCount:0}}function xr(t){t.refCount--,t.refCount===0&&x1(S1,function(){t.controller.abort()})}function cm(t,i){if((t.pendingLanes&4194048)!==0){var l=t.transitionTypes;for(l===null&&(l=t.transitionTypes=[]),t=0;t<i.length;t++){var s=i[t];l.indexOf(s)===-1&&l.push(s)}}}var Sr=null;function _1(t){var i=t.transitionTypes;return t.transitionTypes=null,i}var _r=null,Xc=0,xn=0,ol=null;function C1(t,i){if(_r===null){var l=_r=[];Xc=0,xn=nf(),ol={status:"pending",value:void 0,then:function(s){l.push(s)}}}return Xc++,i.then(hm,hm),i}function hm(){if(--Xc===0&&(Sr=null,_r!==null)){ol!==null&&(ol.status="fulfilled");var t=_r;_r=null,xn=0,ol=null;for(var i=0;i<t.length;i++)(0,t[i])()}}function T1(t,i){var l=[],s={status:"pending",value:null,reason:null,then:function(c){l.push(c)}};return t.then(function(){s.status="fulfilled",s.value=i;for(var c=0;c<l.length;c++)(0,l[c])(i)},function(c){for(s.status="rejected",s.reason=c,c=0;c<l.length;c++)(0,l[c])(void 0)}),s}var fm=J.S;J.S=function(t,i){if(np=Ve(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&C1(t,i),Sr!==null)for(var l=Ol;l!==null;)cm(l,Sr),l=l.next;if(l=t.types,l!==null){for(var s=Ol;s!==null;)cm(s,l),s=s.next;if(xn!==0){s=Sr,s===null&&(s=Sr=[]);for(var c=0;c<l.length;c++){var f=l[c];s.indexOf(f)===-1&&s.push(f)}}}fm!==null&&fm(t,i)};var Sn=zi(null);function Vc(){var t=Sn.current;return t!==null?t:Xt.pooledCache}function ho(t,i){i===null?Gt(Sn,Sn.current):Gt(Sn,i.pool)}function dm(){var t=Vc();return t===null?null:{parent:ie._currentValue,pool:t}}var ul=Error(r(460)),Fc=Error(r(474)),fo=Error(r(542)),go={then:function(){}};function gm(t){return t=t.status,t==="fulfilled"||t==="rejected"}function mm(t,i,l){switch(l=t[l],l===void 0?t.push(i):l!==i&&(i.then(ki,ki),i=l),i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,vm(t),t===void 0&&!("reason"in i)?Error(r(600)):t;default:if(typeof i.status=="string")i.then(ki,ki);else{if(t=Xt,t!==null&&100<t.shellSuspendCounter)throw Error(r(482));t=i,t.status="pending",t.then(function(s){if(i.status==="pending"){var c=i;c.status="fulfilled",c.value=s}},function(s){if(i.status==="pending"){var c=i;c.status="rejected",c.reason=s}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,vm(t),t}throw Cn=i,ul}}function _n(t){try{var i=t._init;return i(t._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Cn=l,ul):l}}var Cn=null;function pm(){if(Cn===null)throw Error(r(459));var t=Cn;return Cn=null,t}function vm(t){if(t===ul||t===fo)throw Error(r(483))}var cl=null,Cr=0;function mo(t){var i=Cr;return Cr+=1,cl===null&&(cl=[]),mm(cl,t,i)}function Aa(t,i){i=i.props.ref,t.ref=i!==void 0?i:null}function po(t,i){throw i.$$typeof===G?Error(r(525)):(t=Object.prototype.toString.call(i),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)))}function ym(t){function i(A,O){if(t){var z=A.deletions;z===null?(A.deletions=[O],A.flags|=16):z.push(O)}}function l(A,O){if(!t)return null;for(;O!==null;)i(A,O),O=O.sibling;return null}function s(A){for(var O=new Map;A!==null;)A.key===null?O.set(A.index,A):O.set(A.key,A),A=A.sibling;return O}function c(A,O){return A=ia(A,O),A.index=0,A.sibling=null,A}function f(A,O,z){return A.index=z,t?(z=A.alternate,z!==null?(z=z.index,z<O?(A.flags|=2,O):z):(A.flags|=134217730,O)):(A.flags|=1048576,O)}function v(A){return t&&A.alternate===null&&(A.flags|=134217730),A}function x(A,O,z,U){return O===null||O.tag!==6?(O=zc(z,A.mode,U),O.return=A,O):(O=c(O,z),O.return=A,O)}function C(A,O,z,U){var et=z.type;return et===pt?(A=L(A,O,z.props.children,U,z.key),Aa(A,z),A):O!==null&&(O.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===dt&&_n(et)===O.type)?(O=c(O,z.props),Aa(O,z),O.return=A,O):(O=no(z.type,z.key,z.props,null,A.mode,U),Aa(O,z),O.return=A,O)}function j(A,O,z,U){return O===null||O.tag!==4||O.stateNode.containerInfo!==z.containerInfo||O.stateNode.implementation!==z.implementation?(O=Nc(z,A.mode,U),O.return=A,O):(O=c(O,z.children||[]),O.return=A,O)}function L(A,O,z,U,et){return O===null||O.tag!==7?(O=mn(z,A.mode,U,et),O.return=A,O):(O=c(O,z),O.return=A,O)}function V(A,O,z){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=zc(""+O,A.mode,z),O.return=A,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case lt:return z=no(O.type,O.key,O.props,null,A.mode,z),Aa(z,O),z.return=A,z;case ut:return O=Nc(O,A.mode,z),O.return=A,O;case dt:return O=_n(O),V(A,O,z)}if(it(O)||N(O))return O=mn(O,A.mode,z,null),O.return=A,O;if(typeof O.then=="function")return V(A,mo(O),z);if(O.$$typeof===yt)return V(A,co(A,O),z);po(A,O)}return null}function M(A,O,z,U){var et=O!==null?O.key:null;if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return et!==null?null:x(A,O,""+z,U);if(typeof z=="object"&&z!==null){switch(z.$$typeof){case lt:return z.key===et?C(A,O,z,U):null;case ut:return z.key===et?j(A,O,z,U):null;case dt:return z=_n(z),M(A,O,z,U)}if(it(z)||N(z))return et!==null?null:L(A,O,z,U,null);if(typeof z.then=="function")return M(A,O,mo(z),U);if(z.$$typeof===yt)return M(A,O,co(A,z),U);po(A,z)}return null}function k(A,O,z,U,et){if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return A=A.get(z)||null,x(O,A,""+U,et);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case lt:return A=A.get(U.key===null?z:U.key)||null,C(O,A,U,et);case ut:return A=A.get(U.key===null?z:U.key)||null,j(O,A,U,et);case dt:return U=_n(U),k(A,O,z,U,et)}if(it(U)||N(U))return A=A.get(z)||null,L(O,A,U,et,null);if(typeof U.then=="function")return k(A,O,z,mo(U),et);if(U.$$typeof===yt)return k(A,O,z,co(O,U),et);po(O,U)}return null}function Z(A,O,z,U){for(var et=null,Et=null,ht=O,gt=O=0,le=null;ht!==null&><z.length;gt++){ht.index>gt?(le=ht,ht=null):le=ht.sibling;var Mt=M(A,ht,z[gt],U);if(Mt===null){ht===null&&(ht=le);break}t&&ht&&Mt.alternate===null&&i(A,ht),O=f(Mt,O,gt),Et===null?et=Mt:Et.sibling=Mt,Et=Mt,ht=le}if(gt===z.length)return l(A,ht),Ct&&aa(A,gt),et;if(ht===null){for(;gt<z.length;gt++)ht=V(A,z[gt],U),ht!==null&&(O=f(ht,O,gt),Et===null?et=ht:Et.sibling=ht,Et=ht);return Ct&&aa(A,gt),et}for(ht=s(ht);gt<z.length;gt++)le=k(ht,A,gt,z[gt],U),le!==null&&(t&&(Mt=le.alternate,Mt!==null&&ht.delete(Mt.key===null?gt:Mt.key)),O=f(le,O,gt),Et===null?et=le:Et.sibling=le,Et=le);return t&&ht.forEach(function(Ia){return i(A,Ia)}),Ct&&aa(A,gt),et}function ot(A,O,z,U){if(z==null)throw Error(r(151));for(var et=null,Et=null,ht=O,gt=O=0,le=null,Mt=z.next();ht!==null&&!Mt.done;gt++,Mt=z.next()){ht.index>gt?(le=ht,ht=null):le=ht.sibling;var Ia=M(A,ht,Mt.value,U);if(Ia===null){ht===null&&(ht=le);break}t&&ht&&Ia.alternate===null&&i(A,ht),O=f(Ia,O,gt),Et===null?et=Ia:Et.sibling=Ia,Et=Ia,ht=le}if(Mt.done)return l(A,ht),Ct&&aa(A,gt),et;if(ht===null){for(;!Mt.done;gt++,Mt=z.next())Mt=V(A,Mt.value,U),Mt!==null&&(O=f(Mt,O,gt),Et===null?et=Mt:Et.sibling=Mt,Et=Mt);return Ct&&aa(A,gt),et}for(ht=s(ht);!Mt.done;gt++,Mt=z.next())Mt=k(ht,A,gt,Mt.value,U),Mt!==null&&(t&&(le=Mt.alternate,le!==null&&ht.delete(le.key===null?gt:le.key)),O=f(Mt,O,gt),Et===null?et=Mt:Et.sibling=Mt,Et=Mt);return t&&ht.forEach(function(n_){return i(A,n_)}),Ct&&aa(A,gt),et}function xt(A,O,z,U){if(typeof z=="object"&&z!==null&&z.type===pt&&z.key===null&&z.props.ref===void 0&&(z=z.props.children),typeof z=="object"&&z!==null){switch(z.$$typeof){case lt:t:{for(var et=z.key;O!==null;){if(O.key===et){if(et=z.type,et===pt){if(O.tag===7){l(A,O.sibling),U=c(O,z.props.children),Aa(U,z),U.return=A,A=U;break t}}else if(O.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===dt&&_n(et)===O.type){l(A,O.sibling),U=c(O,z.props),Aa(U,z),U.return=A,A=U;break t}l(A,O);break}else i(A,O);O=O.sibling}z.type===pt?(U=mn(z.props.children,A.mode,U,z.key),Aa(U,z),U.return=A,A=U):(U=no(z.type,z.key,z.props,null,A.mode,U),Aa(U,z),U.return=A,A=U)}return v(A);case ut:t:{for(et=z.key;O!==null;){if(O.key===et)if(O.tag===4&&O.stateNode.containerInfo===z.containerInfo&&O.stateNode.implementation===z.implementation){l(A,O.sibling),U=c(O,z.children||[]),U.return=A,A=U;break t}else{l(A,O);break}else i(A,O);O=O.sibling}U=Nc(z,A.mode,U),U.return=A,A=U}return v(A);case dt:return z=_n(z),xt(A,O,z,U)}if(it(z))return Z(A,O,z,U);if(N(z)){if(et=N(z),typeof et!="function")throw Error(r(150));return z=et.call(z),ot(A,O,z,U)}if(typeof z.then=="function")return xt(A,O,mo(z),U);if(z.$$typeof===yt)return xt(A,O,co(A,z),U);po(A,z)}return typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint"?(z=""+z,O!==null&&O.tag===6?(l(A,O.sibling),U=c(O,z),U.return=A,A=U):(l(A,O),U=zc(z,A.mode,U),U.return=A,A=U),v(A)):l(A,O)}return function(A,O,z,U){try{Cr=0;var et=xt(A,O,z,U);return cl=null,et}catch(ht){if(ht===ul||ht===fo)throw ht;var Et=Be(29,ht,null,A.mode);return Et.lanes=U,Et.return=A,Et}}}var Tn=ym(!0),bm=ym(!1),ja=!1;function Gc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qc(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ra(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function za(t,i,l){var s=t.updateQueue;if(s===null)return null;if(s=s.shared,(zt&2)!==0){var c=s.pending;return c===null?i.next=i:(i.next=c.next,c.next=i),s.pending=i,i=ao(t),im(t,null,l),i}return io(t,s,i,l),ao(t)}function Tr(t,i,l){if(i=i.updateQueue,i!==null&&(i=i.shared,(l&4194048)!==0)){var s=i.lanes;s&=t.pendingLanes,l|=s,i.lanes=l,rg(t,l)}}function Pc(t,i){var l=t.updateQueue,s=t.alternate;if(s!==null&&(s=s.updateQueue,l===s)){var c=null,f=null;if(l=l.firstBaseUpdate,l!==null){do{var v={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};f===null?c=f=v:f=f.next=v,l=l.next}while(l!==null);f===null?c=f=i:f=f.next=i}else c=f=i;l={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:f,shared:s.shared,callbacks:s.callbacks},t.updateQueue=l;return}t=l.lastBaseUpdate,t===null?l.firstBaseUpdate=i:t.next=i,l.lastBaseUpdate=i}var Qc=!1;function wr(){if(Qc){var t=ol;if(t!==null)throw t}}function Or(t,i,l,s){Qc=!1;var c=t.updateQueue;ja=!1;var f=c.firstBaseUpdate,v=c.lastBaseUpdate,x=c.shared.pending;if(x!==null){c.shared.pending=null;var C=x,j=C.next;C.next=null,v===null?f=j:v.next=j,v=C;var L=t.alternate;L!==null&&(L=L.updateQueue,x=L.lastBaseUpdate,x!==v&&(x===null?L.firstBaseUpdate=j:x.next=j,L.lastBaseUpdate=C))}if(f!==null){var V=c.baseState;v=0,L=j=C=null,x=f;do{var M=x.lane&-536870913,k=M!==x.lane;if(k?(Ot&M)===M:(s&M)===M){M!==0&&M===xn&&(Qc=!0),L!==null&&(L=L.next={lane:0,tag:x.tag,payload:x.payload,callback:null,next:null});t:{var Z=t,ot=x;M=i;var xt=l;switch(ot.tag){case 1:if(Z=ot.payload,typeof Z=="function"){V=Z.call(xt,V,M);break t}V=Z;break t;case 3:Z.flags=Z.flags&-65537|128;case 0:if(Z=ot.payload,M=typeof Z=="function"?Z.call(xt,V,M):Z,M==null)break t;V=B({},V,M);break t;case 2:ja=!0}}M=x.callback,M!==null&&(t.flags|=64,k&&(t.flags|=8192),k=c.callbacks,k===null?c.callbacks=[M]:k.push(M))}else k={lane:M,tag:x.tag,payload:x.payload,callback:x.callback,next:null},L===null?(j=L=k,C=V):L=L.next=k,v|=M;if(x=x.next,x===null){if(x=c.shared.pending,x===null)break;k=x,x=k.next,k.next=null,c.lastBaseUpdate=k,c.shared.pending=null}}while(!0);L===null&&(C=V),c.baseState=C,c.firstBaseUpdate=j,c.lastBaseUpdate=L,f===null&&(c.shared.lanes=0),Ua|=v,t.lanes=v,t.memoizedState=V}}function xm(t,i){if(typeof t!="function")throw Error(r(191,t));t.call(i)}function Sm(t,i){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;t<l.length;t++)xm(l[t],i)}var Na=zi(null),vo=zi(0);function _m(t,i){t=ca,Gt(vo,t),Gt(Na,i),ca=t|i.baseLanes}function Kc(){Gt(vo,ca),Gt(Na,Na.current)}function Ic(){ca=vo.current,ge(Na),ge(vo)}var ve=zi(null),Ce=null;function ka(t){var i=t.alternate;Gt(ye,ye.current&1),Gt(ve,t),Ce===null&&(i===null||Na.current!==null||i.memoizedState!==null)&&(Ce=t)}function Wc(t){Gt(ye,ye.current),Gt(ve,t),Ce===null&&(Ce=t)}function Cm(t){t.tag===22?(Gt(ye,ye.current),Gt(ve,t),Ce===null&&(Ce=t)):Ba()}function Ba(){Gt(ye,ye.current),Gt(ve,ve.current)}function Qe(t){ge(ve),Ce===t&&(Ce=null),ge(ye)}var ye=zi(0);function Er(t,i){Gt(ve,ve.current),Gt(ye,i)}function Zc(t){ge(ye),ge(ve),Ce===t&&(Ce=null)}function yo(t){for(var i=t;i!==null;){if(i.tag===13){var l=i.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||xf(l)||Sf(l)))return i}else if(i.tag===19&&i.memoizedProps.revealOrder!=="independent"){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var ra=0,bt=null,Ut=null,ae=null,bo=!1,hl=!1,wn=!1,xo=0,Dr=0,fl=null,w1=0;function Wt(){throw Error(r(321))}function $c(t,i){if(i===null)return!1;for(var l=0;l<i.length&&l<t.length;l++)if(!Pe(t[l],i[l]))return!1;return!0}function Jc(t,i,l,s,c,f){return ra=f,bt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,J.H=t===null||t.memoizedState===null?r0:s0,wn=!1,f=l(s,c),wn=!1,hl&&(f=wm(i,l,s,c)),Tm(t),f}function Tm(t){J.H=Eo;var i=Ut!==null&&Ut.next!==null;if(ra=0,ae=Ut=bt=null,bo=!1,Dr=0,fl=null,i)throw Error(r(300));t===null||ne||(t=t.dependencies,t!==null&&uo(t)&&(ne=!0))}function wm(t,i,l,s){bt=t;var c=0;do{if(hl&&(fl=null),Dr=0,hl=!1,25<=c)throw Error(r(301));if(c+=1,ae=Ut=null,t.updateQueue!=null){var f=t.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}J.H=z1,f=i(l,s)}while(hl);return f}function O1(){var t=J.H,i=t.useState()[0];return i=typeof i.then=="function"?Mr(i):i,t=t.useState()[0],(Ut!==null?Ut.memoizedState:null)!==t&&(bt.flags|=1024),i}function th(){var t=xo!==0;return xo=0,t}function eh(t,i,l){i.updateQueue=t.updateQueue,i.flags&=-2053,t.lanes&=~l}function ih(t){if(bo){for(t=t.memoizedState;t!==null;){var i=t.queue;i!==null&&(i.pending=null),t=t.next}bo=!1}ra=0,ae=Ut=bt=null,hl=!1,Dr=xo=0,fl=null}function De(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ae===null?bt.memoizedState=ae=t:ae=ae.next=t,ae}function te(){if(Ut===null){var t=bt.alternate;t=t!==null?t.memoizedState:null}else t=Ut.next;var i=ae===null?bt.memoizedState:ae.next;if(i!==null)ae=i,Ut=t;else{if(t===null)throw bt.alternate===null?Error(r(467)):Error(r(310));Ut=t,t={memoizedState:Ut.memoizedState,baseState:Ut.baseState,baseQueue:Ut.baseQueue,queue:Ut.queue,next:null},ae===null?bt.memoizedState=ae=t:ae=ae.next=t}return ae}function So(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Mr(t){var i=Dr;return Dr+=1,fl===null&&(fl=[]),t=mm(fl,t,i),i=bt,(ae===null?i.memoizedState:ae.next)===null&&(i=i.alternate,J.H=i===null||i.memoizedState===null?r0:s0),t}function _o(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Mr(t);if(t.$$typeof===F)return;if(t.$$typeof===yt)return pe(t)}throw Error(r(438,String(t)))}function ah(t){var i=null,l=bt.updateQueue;if(l!==null&&(i=l.memoCache),i==null){var s=bt.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(i={data:s.data.map(function(c){return c.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),l===null&&(l=So(),bt.updateQueue=l),l.memoCache=i,l=i.data[i.index],l===void 0)for(l=i.data[i.index]=Array(t),s=0;s<t;s++)l[s]=ee;return i.index++,l}function sa(t,i){return typeof i=="function"?i(t):i}function Co(t){var i=te();return nh(i,Ut,t)}function nh(t,i,l){var s=t.queue;if(s===null)throw Error(r(311));s.lastRenderedReducer=l;var c=t.baseQueue,f=s.pending;if(f!==null){if(c!==null){var v=c.next;c.next=f.next,f.next=v}i.baseQueue=c=f,s.pending=null}if(f=t.baseState,c===null)t.memoizedState=f;else{i=c.next;var x=v=null,C=null,j=i,L=!1;do{var V=j.lane&-536870913;if(V!==j.lane?(Ot&V)===V:(ra&V)===V){var M=j.revertLane;if(M===0)C!==null&&(C=C.next={lane:0,revertLane:0,gesture:null,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null}),V===xn&&(L=!0);else if((ra&M)===M){j=j.next,M===xn&&(L=!0);continue}else V={lane:0,revertLane:j.revertLane,gesture:null,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},C===null?(x=C=V,v=f):C=C.next=V,bt.lanes|=M,Ua|=M;V=j.action,wn&&l(f,V),f=j.hasEagerState?j.eagerState:l(f,V)}else M={lane:V,revertLane:j.revertLane,gesture:j.gesture,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},C===null?(x=C=M,v=f):C=C.next=M,bt.lanes|=V,Ua|=V;j=j.next}while(j!==null&&j!==i);if(C===null?v=f:C.next=x,!Pe(f,t.memoizedState)&&(ne=!0,L&&(l=ol,l!==null)))throw l;t.memoizedState=f,t.baseState=v,t.baseQueue=C,s.lastRenderedState=f}return c===null&&(s.lanes=0),[t.memoizedState,s.dispatch]}function lh(t){var i=te(),l=i.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=t;var s=l.dispatch,c=l.pending,f=i.memoizedState;if(c!==null){l.pending=null;var v=c=c.next;do f=t(f,v.action),v=v.next;while(v!==c);Pe(f,i.memoizedState)||(ne=!0),i.memoizedState=f,i.baseQueue===null&&(i.baseState=f),l.lastRenderedState=f}return[f,s]}function Om(t,i,l){var s=bt,c=te(),f=Ct;if(f){if(l===void 0)throw Error(r(407));l=l()}else l=i();var v=!Pe((Ut||c).memoizedState,l);if(v&&(c.memoizedState=l,ne=!0),c=c.queue,oh(Mm.bind(null,s,c,t),[t]),t=c.getSnapshot!==i||v||ae!==null&&(ae.memoizedState.tag&1)!==0,dl(t?9:8,{destroy:void 0},Dm.bind(null,s,c,l,i),null),t){if(s.flags|=2048,Xt===null)throw Error(r(349));f||(ra&127)!==0||Em(s,i,l)}return l}function Em(t,i,l){t.flags|=16384,t={getSnapshot:i,value:l},i=bt.updateQueue,i===null?(i=So(),bt.updateQueue=i,i.stores=[t]):(l=i.stores,l===null?i.stores=[t]:l.push(t))}function Dm(t,i,l,s){i.value=l,i.getSnapshot=s,Am(i)&&jm(t)}function Mm(t,i,l){return l(function(){Am(i)&&jm(t)})}function Am(t){var i=t.getSnapshot;t=t.value;try{var l=i();return!Pe(t,l)}catch{return!0}}function jm(t){var i=gn(t,2);i!==null&&Ue(i,t,2)}function rh(t){var i=De();if(typeof t=="function"){var l=t;if(t=l(),wn){Ca(!0);try{l()}finally{Ca(!1)}}}return i.memoizedState=i.baseState=t,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:t},i}function Rm(t,i,l,s){return t.baseState=l,nh(t,Ut,typeof s=="function"?s:sa)}function E1(t,i,l,s,c){if(Oo(t))throw Error(r(485));if(t=i.action,t!==null){var f={payload:c,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){f.listeners.push(v)}};J.T!==null?l(!0):f.isTransition=!1,s(f),l=i.pending,l===null?(f.next=i.pending=f,zm(i,f)):(f.next=l.next,i.pending=l.next=f)}}function zm(t,i){var l=i.action,s=i.payload,c=t.state;if(i.isTransition){var f=J.T,v={};v.types=f!==null?f.types:null,J.T=v;try{var x=l(c,s),C=J.S;C!==null&&C(v,x),Nm(t,i,x)}catch(j){sh(t,i,j)}finally{f!==null&&v.types!==null&&(f.types=v.types),J.T=f}}else try{f=l(c,s),Nm(t,i,f)}catch(j){sh(t,i,j)}}function Nm(t,i,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(s){km(t,i,s)},function(s){return sh(t,i,s)}):km(t,i,l)}function km(t,i,l){i.status="fulfilled",i.value=l,Bm(i),t.state=l,i=t.pending,i!==null&&(l=i.next,l===i?t.pending=null:(l=l.next,i.next=l,zm(t,l)))}function sh(t,i,l){var s=t.pending;if(t.pending=null,s!==null){s=s.next;do i.status="rejected",i.reason=l,Bm(i),i=i.next;while(i!==s)}t.action=null}function Bm(t){t=t.listeners;for(var i=0;i<t.length;i++)(0,t[i])()}function Lm(t,i){return i}function Hm(t,i){if(Ct){var l=Xt.formState;if(l!==null){t:{var s=bt;if(Ct){if(qt){e:{for(var c=qt,f=fi;c.nodeType!==8;){if(!f){c=null;break e}if(c=gi(c.nextSibling),c===null){c=null;break e}}f=c.data,c=f==="F!"||f==="F"?c:null}if(c){qt=gi(c.nextSibling),s=c.data==="F!";break t}}Da(s)}s=!1}s&&(i=l[0])}}return l=De(),l.memoizedState=l.baseState=i,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lm,lastRenderedState:i},l.queue=s,l=a0.bind(null,bt,s),s.dispatch=l,s=rh(!1),f=dh.bind(null,bt,!1,s.queue),s=De(),c={state:i,dispatch:null,action:t,pending:null},s.queue=c,l=E1.bind(null,bt,c,f,l),c.dispatch=l,s.memoizedState=t,[i,l,!1]}function Ym(t){var i=te();return Um(i,Ut,t)}function Um(t,i,l){if(i=nh(t,i,Lm)[0],t=Co(sa)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var s=Mr(i)}catch(v){throw v===ul?fo:v}else s=i;i=te();var c=i.queue,f=c.dispatch;return l!==i.memoizedState&&(bt.flags|=2048,dl(9,{destroy:void 0},D1.bind(null,c,l),null)),[s,f,t]}function D1(t,i){t.action=i}function Xm(t){var i=te(),l=Ut;if(l!==null)return Um(i,l,t);te(),i=i.memoizedState,l=te();var s=l.queue.dispatch;return l.memoizedState=t,[i,s,!1]}function dl(t,i,l,s){return t={tag:t,create:l,deps:s,inst:i,next:null},i=bt.updateQueue,i===null&&(i=So(),bt.updateQueue=i),l=i.lastEffect,l===null?i.lastEffect=t.next=t:(s=l.next,l.next=t,t.next=s,i.lastEffect=t),t}function Vm(){return te().memoizedState}function To(t,i,l,s){var c=De();bt.flags|=t,c.memoizedState=dl(1|i,{destroy:void 0},l,s===void 0?null:s)}function wo(t,i,l,s){var c=te();s=s===void 0?null:s;var f=c.memoizedState.inst;Ut!==null&&s!==null&&$c(s,Ut.memoizedState.deps)?c.memoizedState=dl(i,f,l,s):(bt.flags|=t,c.memoizedState=dl(1|i,f,l,s))}function Fm(t,i){To(8390656,8,t,i)}function oh(t,i){wo(2048,8,t,i)}function M1(t){bt.flags|=4;var i=bt.updateQueue;if(i===null)i=So(),bt.updateQueue=i,i.events=[t];else{var l=i.events;l===null?i.events=[t]:l.push(t)}}function Gm(t){var i=te().memoizedState;return M1({ref:i,nextImpl:t}),function(){if((zt&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}function qm(t,i){return wo(4,2,t,i)}function Pm(t,i){return wo(4,4,t,i)}function Qm(t,i){if(typeof i=="function"){t=t();var l=i(t);return function(){typeof l=="function"?l():i(null)}}if(i!=null)return t=t(),i.current=t,function(){i.current=null}}function Km(t,i,l){l=l!=null?l.concat([t]):null,wo(4,4,Qm.bind(null,i,t),l)}function uh(){}function Im(t,i){var l=te();i=i===void 0?null:i;var s=l.memoizedState;return i!==null&&$c(i,s[1])?s[0]:(l.memoizedState=[t,i],t)}function Wm(t,i){var l=te();i=i===void 0?null:i;var s=l.memoizedState;if(i!==null&&$c(i,s[1]))return s[0];if(s=t(),wn){Ca(!0);try{t()}finally{Ca(!1)}}return l.memoizedState=[s,i],s}function ch(t,i,l){return l===void 0||(ra&1073741824)!==0&&(Ot&261930)===0?t.memoizedState=i:(t.memoizedState=l,t=rp(),bt.lanes|=t,Ua|=t,l)}function Zm(t,i,l,s){return Pe(l,i)?l:Na.current!==null?(t=ch(t,l,s),Pe(t,i)||(ne=!0),t):(ra&106)===0||(ra&1073741824)!==0&&(Ot&261930)===0?(ne=!0,t.memoizedState=l):(t=rp(),bt.lanes|=t,Ua|=t,i)}function $m(t,i,l,s,c){var f=ft.p;ft.p=f!==0&&8>f?f:8;var v=J.T,x={};x.types=v!==null?v.types:null,J.T=x,dh(t,!1,i,l);try{var C=c(),j=J.S;if(j!==null&&j(x,C),C!==null&&typeof C=="object"&&typeof C.then=="function"){var L=T1(C,s);Ar(t,i,L,Ze(t))}else Ar(t,i,s,Ze(t))}catch(V){Ar(t,i,{then:function(){},status:"rejected",reason:V},Ze())}finally{ft.p=f,v!==null&&x.types!==null&&(v.types=x.types),J.T=v}}function A1(){}function hh(t,i,l,s){if(t.tag!==5)throw Error(r(476));var c=Jm(t).queue;$m(t,c,i,ri,l===null?A1:function(){return t0(t),l(s)})}function Jm(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:ri,baseState:ri,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:ri},next:null};var l={};return i.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:l},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function t0(t){var i=Jm(t);i.next===null&&(i=t.alternate.memoizedState),Ar(t,i.next.queue,{},Ze())}function fh(){return pe(Rl)}function e0(){return te().memoizedState}function i0(){return te().memoizedState}function j1(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var l=Ze();t=Ra(l);var s=za(i,t,l);s!==null&&(Ue(s,i,l),Tr(s,i,l)),i={cache:Uc()},t.payload=i;return}i=i.return}}function R1(t,i,l){var s=Ze();l={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Oo(t)?n0(i,l):(l=jc(t,i,l,s),l!==null&&(Ue(l,t,s),l0(l,i,s)))}function a0(t,i,l){var s=Ze();Ar(t,i,l,s)}function Ar(t,i,l,s){var c={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Oo(t))n0(i,c);else{var f=t.alternate;if(t.lanes===0&&(f===null||f.lanes===0)&&(f=i.lastRenderedReducer,f!==null))try{var v=i.lastRenderedState,x=f(v,l);if(c.hasEagerState=!0,c.eagerState=x,Pe(x,v))return io(t,i,c,0),Xt===null&&eo(),!1}catch{}if(l=jc(t,i,c,s),l!==null)return Ue(l,t,s),l0(l,i,s),!0}return!1}function dh(t,i,l,s){if(s={lane:2,revertLane:nf(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Oo(t)){if(i)throw Error(r(479))}else i=jc(t,l,s,2),i!==null&&Ue(i,t,2)}function Oo(t){var i=t.alternate;return t===bt||i!==null&&i===bt}function n0(t,i){hl=bo=!0;var l=t.pending;l===null?i.next=i:(i.next=l.next,l.next=i),t.pending=i}function l0(t,i,l){if((l&4194048)!==0){var s=i.lanes;s&=t.pendingLanes,l|=s,i.lanes=l,rg(t,l)}}var Eo={readContext:pe,use:_o,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useLayoutEffect:Wt,useInsertionEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useSyncExternalStore:Wt,useId:Wt,useHostTransitionStatus:Wt,useFormState:Wt,useActionState:Wt,useOptimistic:Wt,useMemoCache:Wt,useCacheRefresh:Wt,useEffectEvent:Wt},r0={readContext:pe,use:_o,useCallback:function(t,i){return De().memoizedState=[t,i===void 0?null:i],t},useContext:pe,useEffect:Fm,useImperativeHandle:function(t,i,l){l=l!=null?l.concat([t]):null,To(4194308,4,Qm.bind(null,i,t),l)},useLayoutEffect:function(t,i){return To(4194308,4,t,i)},useInsertionEffect:function(t,i){To(4,2,t,i)},useMemo:function(t,i){var l=De();i=i===void 0?null:i;var s=t();if(wn){Ca(!0);try{t()}finally{Ca(!1)}}return l.memoizedState=[s,i],s},useReducer:function(t,i,l){var s=De();if(l!==void 0){var c=l(i);if(wn){Ca(!0);try{l(i)}finally{Ca(!1)}}}else c=i;return s.memoizedState=s.baseState=c,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:c},s.queue=t,t=t.dispatch=R1.bind(null,bt,t),[s.memoizedState,t]},useRef:function(t){var i=De();return t={current:t},i.memoizedState=t},useState:function(t){t=rh(t);var i=t.queue,l=a0.bind(null,bt,i);return i.dispatch=l,[t.memoizedState,l]},useDebugValue:uh,useDeferredValue:function(t,i){var l=De();return ch(l,t,i)},useTransition:function(){var t=rh(!1);return t=$m.bind(null,bt,t.queue,!0,!1),De().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,l){var s=bt,c=De();if(Ct){if(l===void 0)throw Error(r(407));l=l()}else{if(l=i(),Xt===null)throw Error(r(349));(Ot&127)!==0||Em(s,i,l)}c.memoizedState=l;var f={value:l,getSnapshot:i};return c.queue=f,Fm(Mm.bind(null,s,f,t),[t]),s.flags|=2048,dl(9,{destroy:void 0},Dm.bind(null,s,f,l,i),null),l},useId:function(){var t=De(),i=Xt.identifierPrefix;if(Ct){var l=Li,s=Bi;l=(s&~(1<<32-Ge(s)-1)).toString(32)+l,i="_"+i+"R_"+l,l=xo++,0<l&&(i+="H"+l.toString(32)),i+="_"}else l=w1++,i="_"+i+"r_"+l.toString(32)+"_";return t.memoizedState=i},useHostTransitionStatus:fh,useFormState:Hm,useActionState:Hm,useOptimistic:function(t){var i=De();i.memoizedState=i.baseState=t;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=l,i=dh.bind(null,bt,!0,l),l.dispatch=i,[t,i]},useMemoCache:ah,useCacheRefresh:function(){return De().memoizedState=j1.bind(null,bt)},useEffectEvent:function(t){var i=De(),l={impl:t};return i.memoizedState=l,function(){if((zt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}},s0={readContext:pe,use:_o,useCallback:Im,useContext:pe,useEffect:oh,useImperativeHandle:Km,useInsertionEffect:qm,useLayoutEffect:Pm,useMemo:Wm,useReducer:Co,useRef:Vm,useState:function(){return Co(sa)},useDebugValue:uh,useDeferredValue:function(t,i){var l=te();return Zm(l,Ut.memoizedState,t,i)},useTransition:function(){var t=Co(sa)[0],i=te().memoizedState;return[typeof t=="boolean"?t:Mr(t),i]},useSyncExternalStore:Om,useId:e0,useHostTransitionStatus:fh,useFormState:Ym,useActionState:Ym,useOptimistic:function(t,i){var l=te();return Rm(l,Ut,t,i)},useMemoCache:ah,useCacheRefresh:i0,useEffectEvent:Gm},z1={readContext:pe,use:_o,useCallback:Im,useContext:pe,useEffect:oh,useImperativeHandle:Km,useInsertionEffect:qm,useLayoutEffect:Pm,useMemo:Wm,useReducer:lh,useRef:Vm,useState:function(){return lh(sa)},useDebugValue:uh,useDeferredValue:function(t,i){var l=te();return Ut===null?ch(l,t,i):Zm(l,Ut.memoizedState,t,i)},useTransition:function(){var t=lh(sa)[0],i=te().memoizedState;return[typeof t=="boolean"?t:Mr(t),i]},useSyncExternalStore:Om,useId:e0,useHostTransitionStatus:fh,useFormState:Xm,useActionState:Xm,useOptimistic:function(t,i){var l=te();return Ut!==null?Rm(l,Ut,t,i):(l.baseState=t,[t,l.queue.dispatch])},useMemoCache:ah,useCacheRefresh:i0,useEffectEvent:Gm};function gh(t,i,l,s){i=t.memoizedState,l=l(s,i),l=l==null?i:B({},i,l),t.memoizedState=l,t.lanes===0&&(t.updateQueue.baseState=l)}var mh={enqueueSetState:function(t,i,l){t=t._reactInternals;var s=Ze(),c=Ra(s);c.payload=i,l!=null&&(c.callback=l),i=za(t,c,s),i!==null&&(Ue(i,t,s),Tr(i,t,s))},enqueueReplaceState:function(t,i,l){t=t._reactInternals;var s=Ze(),c=Ra(s);c.tag=1,c.payload=i,l!=null&&(c.callback=l),i=za(t,c,s),i!==null&&(Ue(i,t,s),Tr(i,t,s))},enqueueForceUpdate:function(t,i){t=t._reactInternals;var l=Ze(),s=Ra(l);s.tag=2,i!=null&&(s.callback=i),i=za(t,s,l),i!==null&&(Ue(i,t,l),Tr(i,t,l))}};function o0(t,i,l,s,c,f,v){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(s,f,v):i.prototype&&i.prototype.isPureReactComponent?!pr(l,s)||!pr(c,f):!0}function u0(t,i,l,s){t=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(l,s),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(l,s),i.state!==t&&mh.enqueueReplaceState(i,i.state,null)}function On(t,i){var l=i;if("ref"in i){l={};for(var s in i)s!=="ref"&&(l[s]=i[s])}if(t=t.defaultProps){l===i&&(l=B({},l));for(var c in t)l[c]===void 0&&(l[c]=t[c])}return l}function c0(t){to(t)}function h0(t){console.error(t)}function f0(t){to(t)}function Do(t,i){try{var l=t.onUncaughtError;l(i.value,{componentStack:i.stack})}catch(s){setTimeout(function(){throw s})}}function d0(t,i,l){try{var s=t.onCaughtError;s(l.value,{componentStack:l.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function ph(t,i,l){return l=Ra(l),l.tag=3,l.payload={element:null},l.callback=function(){Do(t,i)},l}function g0(t){return t=Ra(t),t.tag=3,t}function m0(t,i,l,s){var c=l.type.getDerivedStateFromError;if(typeof c=="function"){var f=s.value;t.payload=function(){return c(f)},t.callback=function(){d0(i,l,s)}}var v=l.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(t.callback=function(){d0(i,l,s),typeof c!="function"&&(Xa===null?Xa=new Set([this]):Xa.add(this));var x=s.stack;this.componentDidCatch(s.value,{componentStack:x!==null?x:""})})}function N1(t,i,l,s,c){if(l.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(i=l.alternate,i!==null&&yn(i,l,c,!0),l=ve.current,l!==null){switch(l.tag){case 31:case 13:case 19:return Ce===null?Io():l.alternate===null&&Zt===0&&(Zt=3),l.flags&=-257,l.flags|=65536,l.lanes=c,s===go?l.flags|=16384:(i=l.updateQueue,i===null?l.updateQueue=new Set([s]):i.add(s),tf(t,s,c)),!1;case 22:return l.flags|=65536,s===go?l.flags|=16384:(i=l.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([s])},l.updateQueue=i):(l=i.retryQueue,l===null?i.retryQueue=new Set([s]):l.add(s)),tf(t,s,c)),!1}throw Error(r(435,l.tag))}return tf(t,s,c),Io(),!1}if(Ct)return i=ve.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=c,s!==Bc&&(t=Error(r(422),{cause:s}),br(ui(t,l)))):(s!==Bc&&(i=Error(r(423),{cause:s}),br(ui(i,l))),t=t.current.alternate,t.flags|=65536,c&=-c,t.lanes|=c,s=ui(s,l),c=ph(t.stateNode,s,c),Pc(t,c),Zt!==4&&(Zt=2)),!1;var f=Error(r(520),{cause:s});if(f=ui(f,l),Hr===null?Hr=[f]:Hr.push(f),Zt!==4&&(Zt=2),i===null)return!0;s=ui(s,l),l=i;do{switch(l.tag){case 3:return l.flags|=65536,t=c&-c,l.lanes|=t,t=ph(l.stateNode,s,t),Pc(l,t),!1;case 1:if(i=l.type,f=l.stateNode,(l.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Xa===null||!Xa.has(f))))return l.flags|=65536,c&=-c,l.lanes|=c,c=g0(c),m0(c,t,l,s),Pc(l,c),!1;break;case 22:if(l.memoizedState!==null)return l.flags|=65536,!1}l=l.return}while(l!==null);return!1}var vh=Error(r(461)),ne=!1;function oe(t,i,l,s){i.child=t===null?bm(i,null,l,s):Tn(i,t.child,l,s)}function p0(t,i,l,s,c){l=l.render;var f=i.ref;if("ref"in s){var v={};for(var x in s)x!=="ref"&&(v[x]=s[x])}else v=s;return bn(i),s=Jc(t,i,l,v,f,c),x=th(),t!==null&&!ne?(eh(t,i,c),oa(t,i,c)):(Ct&&x&&ro(i),i.flags|=1,oe(t,i,s,c),i.child)}function v0(t,i,l,s,c){if(t===null){var f=l.type;return typeof f=="function"&&!Rc(f)&&f.defaultProps===void 0&&l.compare===null?(i.tag=15,i.type=f,y0(t,i,f,s,c)):(t=no(l.type,null,s,i,i.mode,c),t.ref=i.ref,t.return=i,i.child=t)}if(f=t.child,!wh(t,c)){var v=f.memoizedProps;if(l=l.compare,l=l!==null?l:pr,l(v,s)&&t.ref===i.ref)return oa(t,i,c)}return i.flags|=1,t=ia(f,s),t.ref=i.ref,t.return=i,i.child=t}function y0(t,i,l,s,c){if(t!==null){var f=t.memoizedProps;if(pr(f,s)&&t.ref===i.ref)if(ne=!1,i.pendingProps=s=f,wh(t,c))(t.flags&131072)!==0&&(ne=!0);else return i.lanes=t.lanes,oa(t,i,c)}return yh(t,i,l,s,c)}function b0(t,i,l,s){var c=s.children,f=t!==null?t.memoizedState:null;if(t===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((i.flags&128)!==0){if(f=f!==null?f.baseLanes|l:l,t!==null){for(s=i.child=t.child,c=0;s!==null;)c=c|s.lanes|s.childLanes,s=s.sibling;s=c&~f}else s=0,i.child=null;return x0(t,i,f,l,s)}if((l&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},t!==null&&ho(i,f!==null?f.cachePool:null),f!==null?_m(i,f):Kc(),Cm(i);else return s=i.lanes=536870912,x0(t,i,f!==null?f.baseLanes|l:l,l,s)}else f!==null?(ho(i,f.cachePool),_m(i,f),Ba(),i.memoizedState=null):(t!==null&&ho(i,null),Kc(),Ba());return oe(t,i,c,l),i.child}function jr(t,i){return t!==null&&t.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function x0(t,i,l,s,c){var f=Vc();return f=f===null?null:{parent:ie._currentValue,pool:f},i.memoizedState={baseLanes:l,cachePool:f},t!==null&&ho(i,null),Kc(),Cm(i),t!==null&&yn(t,i,s,!0),i.childLanes=c,null}function Mo(t,i){return i=Ao({mode:i.mode,children:i.children},t.mode),i.ref=t.ref,t.child=i,i.return=t,i}function S0(t,i,l){return Tn(i,t.child,null,l),t=Mo(i,i.pendingProps),t.flags|=2,Qe(i),i.memoizedState=null,t}function k1(t,i,l){var s=i.pendingProps,c=(i.flags&128)!==0;if(i.flags&=-129,t===null){if(Ct){if(s.mode==="hidden")return t=Mo(i,s),i.lanes=536870912,t.memoizedState={baseLanes:0,cachePool:null},jr(null,t);if(Wc(i),(t=qt)?(t=Qp(t,fi),t=t!==null&&t.data==="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:Oa!==null?{id:Bi,overflow:Li}:null,retryLane:536870912,hydrationErrors:null},l=nm(t),l.return=i,i.child=l,ce=i,qt=null)):t=null,t===null)throw Da(i);return i.lanes=536870912,null}return Mo(i,s)}var f=t.memoizedState;if(f!==null){var v=f.dehydrated;if(Wc(i),c)if(i.flags&256)i.flags&=-257,i=S0(t,i,l);else if(i.memoizedState!==null)i.child=t.child,i.flags|=128,i=null;else throw Error(r(558));else if(ne||yn(t,i,l,!1),c=(l&t.childLanes)!==0,ne||c){if(Na.current===null){if(s=Xt,s!==null&&(v=sg(s,l),v!==0&&v!==f.retryLane))throw f.retryLane=v,gn(t,v),Ue(s,t,v),vh;Io()}i=S0(t,i,l)}else t=f.treeContext,qt=gi(v.nextSibling),ce=i,Ct=!0,Ea=null,fi=!1,t!==null&&sm(i,t),i=Mo(i,s),i.flags|=134221824;return i}return t=ia(t.child,{mode:s.mode,children:s.children}),t.ref=i.ref,i.child=t,t.return=i,t}function gl(t,i){var l=i.ref;if(l===null)t!==null&&t.ref!==null&&(i.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(r(284));(t===null||t.ref!==l)&&(i.flags|=4194816)}}function yh(t,i,l,s,c){return bn(i),l=Jc(t,i,l,s,void 0,c),s=th(),t!==null&&!ne?(eh(t,i,c),oa(t,i,c)):(Ct&&s&&ro(i),i.flags|=1,oe(t,i,l,c),i.child)}function _0(t,i,l,s,c,f){return bn(i),i.updateQueue=null,l=wm(i,s,l,c),Tm(t),s=th(),t!==null&&!ne?(eh(t,i,f),oa(t,i,f)):(Ct&&s&&ro(i),i.flags|=1,oe(t,i,l,f),i.child)}function C0(t,i,l,s,c){if(bn(i),i.stateNode===null){var f=nl,v=l.contextType;typeof v=="object"&&v!==null&&(f=pe(v)),f=new l(s,f),i.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=mh,i.stateNode=f,f._reactInternals=i,f=i.stateNode,f.props=s,f.state=i.memoizedState,f.refs={},Gc(i),v=l.contextType,f.context=typeof v=="object"&&v!==null?pe(v):nl,f.state=i.memoizedState,v=l.getDerivedStateFromProps,typeof v=="function"&&(gh(i,l,v,s),f.state=i.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(v=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),v!==f.state&&mh.enqueueReplaceState(f,f.state,null),Or(i,s,f,c),wr(),f.state=i.memoizedState),typeof f.componentDidMount=="function"&&(i.flags|=4194308),s=!0}else if(t===null){f=i.stateNode;var x=i.memoizedProps,C=On(l,x);f.props=C;var j=f.context,L=l.contextType;v=nl,typeof L=="object"&&L!==null&&(v=pe(L));var V=l.getDerivedStateFromProps;L=typeof V=="function"||typeof f.getSnapshotBeforeUpdate=="function",x=i.pendingProps!==x,L||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(x||j!==v)&&u0(i,f,s,v),ja=!1;var M=i.memoizedState;f.state=M,Or(i,s,f,c),wr(),j=i.memoizedState,x||M!==j||ja?(typeof V=="function"&&(gh(i,l,V,s),j=i.memoizedState),(C=ja||o0(i,l,C,s,M,j,v))?(L||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(i.flags|=4194308)):(typeof f.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=s,i.memoizedState=j),f.props=s,f.state=j,f.context=v,s=C):(typeof f.componentDidMount=="function"&&(i.flags|=4194308),s=!1)}else{f=i.stateNode,qc(t,i),v=i.memoizedProps,L=On(l,v),f.props=L,V=i.pendingProps,M=f.context,j=l.contextType,C=nl,typeof j=="object"&&j!==null&&(C=pe(j)),x=l.getDerivedStateFromProps,(j=typeof x=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(v!==V||M!==C)&&u0(i,f,s,C),ja=!1,M=i.memoizedState,f.state=M,Or(i,s,f,c),wr();var k=i.memoizedState;v!==V||M!==k||ja||t!==null&&t.dependencies!==null&&uo(t.dependencies)?(typeof x=="function"&&(gh(i,l,x,s),k=i.memoizedState),(L=ja||o0(i,l,L,s,M,k,C)||t!==null&&t.dependencies!==null&&uo(t.dependencies))?(j||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(s,k,C),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(s,k,C)),typeof f.componentDidUpdate=="function"&&(i.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof f.componentDidUpdate!="function"||v===t.memoizedProps&&M===t.memoizedState||(i.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||v===t.memoizedProps&&M===t.memoizedState||(i.flags|=1024),i.memoizedProps=s,i.memoizedState=k),f.props=s,f.state=k,f.context=C,s=L):(typeof f.componentDidUpdate!="function"||v===t.memoizedProps&&M===t.memoizedState||(i.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||v===t.memoizedProps&&M===t.memoizedState||(i.flags|=1024),s=!1)}return f=s,gl(t,i),s=(i.flags&128)!==0,f||s?(f=i.stateNode,l=s&&typeof l.getDerivedStateFromError!="function"?null:f.render(),i.flags|=1,t!==null&&s?(i.child=Tn(i,t.child,null,c),i.child=Tn(i,null,l,c)):oe(t,i,l,c),i.memoizedState=f.state,t=i.child):t=oa(t,i,c),t}function T0(t,i,l,s){return pn(),i.flags|=256,oe(t,i,l,s),i.child}var bh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xh(t){return{baseLanes:t,cachePool:dm()}}function Sh(t,i,l){return t=t!==null?t.childLanes&~l:0,i&&(t|=We),t}function w0(t,i,l){var s=i.pendingProps,c=!1,f=(i.flags&128)!==0,v;if((v=f)||(v=t!==null&&t.memoizedState===null?!1:(ye.current&2)!==0),v&&(c=!0,i.flags&=-129),v=(i.flags&32)!==0,i.flags&=-33,t===null){if(Ct){if(c?ka(i):Ba(),(t=qt)?(t=Qp(t,fi),t=t!==null&&t.data!=="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:Oa!==null?{id:Bi,overflow:Li}:null,retryLane:536870912,hydrationErrors:null},l=nm(t),l.return=i,i.child=l,ce=i,qt=null)):t=null,t===null)throw Da(i);return Sf(t)?i.lanes=32:i.lanes=536870912,null}return f=s.children,s=s.fallback,c?(Ba(),c=i.mode,f=Ao({mode:"hidden",children:f},c),s=mn(s,c,l,null),f.return=i,s.return=i,f.sibling=s,i.child=f,s=i.child,s.memoizedState=xh(l),s.childLanes=Sh(t,v,l),i.memoizedState=bh,jr(null,s)):(ka(i),_h(i,f))}var x=t.memoizedState;if(x!==null){var C=x.dehydrated;if(C!==null)return B1(t,i,f,v,s,C,x,l)}return c?(Ba(),c=s.fallback,f=i.mode,x=t.child,C=x.sibling,s=ia(x,{mode:"hidden",children:s.children}),s.subtreeFlags=x.subtreeFlags&1206910976,C!==null?c=ia(C,c):(c=mn(c,f,l,null),c.flags|=2),c.return=i,s.return=i,s.sibling=c,i.child=s,jr(null,s),s=i.child,c=t.child.memoizedState,c===null?c=xh(l):(f=c.cachePool,f!==null?(x=ie._currentValue,f=f.parent!==x?{parent:x,pool:x}:f):f=dm(),c={baseLanes:c.baseLanes|l,cachePool:f}),s.memoizedState=c,s.childLanes=Sh(t,v,l),i.memoizedState=bh,jr(t.child,s)):(ka(i),l=t.child,t=l.sibling,l=ia(l,{mode:"visible",children:s.children}),l.return=i,l.sibling=null,t!==null&&(v=i.deletions,v===null?(i.deletions=[t],i.flags|=16):v.push(t)),i.child=l,i.memoizedState=null,l)}function _h(t,i){return i=Ao({mode:"visible",children:i},t.mode),i.return=t,t.child=i}function Ao(t,i){return t=Be(22,t,null,i),t.lanes=0,t}function jo(t,i,l){return Tn(i,t.child,null,l),t=_h(i,i.pendingProps.children),t.flags|=2,i.memoizedState=null,t}function B1(t,i,l,s,c,f,v,x){if(l)return i.flags&256?(ka(i),i.flags&=-257,jo(t,i,x)):i.memoizedState!==null?(Ba(),i.child=t.child,i.flags|=128,null):(Ba(),f=c.fallback,v=i.mode,c=Ao({mode:"visible",children:c.children},v),f=mn(f,v,x,null),f.flags|=2,c.return=i,f.return=i,c.sibling=f,i.child=c,Tn(i,t.child,null,x),c=i.child,c.memoizedState=xh(x),c.childLanes=Sh(t,s,x),i.memoizedState=bh,jr(null,c));if(ka(i),Sf(f)){if(s=f.nextSibling&&f.nextSibling.dataset,s)var C=s.dgst;return s=C,s!==""&&(c=Error(r(419)),c.stack="",c.digest=s,br({value:c,source:null,stack:null})),jo(t,i,x)}if(ne||yn(t,i,x,!1),s=(x&t.childLanes)!==0,ne||s){if(Na.current!==null)return jo(t,i,x);if(s=Xt,s!==null&&(c=sg(s,x),c!==0&&c!==v.retryLane))throw v.retryLane=c,gn(t,c),Ue(s,t,c),vh;return xf(f)||Io(),jo(t,i,x)}return xf(f)?(i.flags|=192,i.child=t.child,null):(t=v.treeContext,qt=gi(f.nextSibling),ce=i,Ct=!0,Ea=null,fi=!1,t!==null&&sm(i,t),i=_h(i,c.children),i.flags|=134221824,i)}function O0(t,i,l){t.lanes|=i;var s=t.alternate;s!==null&&(s.lanes|=i),oo(t.return,i,l)}function E0(t){for(var i=null;t!==null;){var l=t.alternate;l!==null&&yo(l)===null&&(i=t),t=t.sibling}return i}function Ro(t,i,l,s,c,f){var v=t.memoizedState;v===null?t.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:s,tail:l,tailMode:c,treeForkCount:f}:(v.isBackwards=i,v.rendering=null,v.renderingStartTime=0,v.last=s,v.tail=l,v.tailMode=c,v.treeForkCount=f)}function Ch(t){var i=t.child;for(t.child=null;i!==null;){var l=i.sibling;i.sibling=t.child,t.child=i,i=l}}function Th(t,i,l){var s=i.pendingProps,c=s.revealOrder,f=s.tail;s=s.children;var v=ye.current;if(i.flags&128)return Er(i,v),null;var x=(v&2)!==0;if(x?(v=v&1|2,i.flags|=128):v&=1,Er(i,v),c==="backwards"&&t!==null?(Ch(t),oe(t,i,s,l),Ch(t)):oe(t,i,s,l),s=Ct?yr:0,!x&&t!==null&&(t.flags&128)!==0)t:for(t=i.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&O0(t,l,i);else if(t.tag===19)O0(t,l,i);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break t;for(;t.sibling===null;){if(t.return===null||t.return===i)break t;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(c){case"backwards":l=E0(i.child),l===null?(c=i.child,i.child=null):(c=l.sibling,l.sibling=null,Ch(i)),Ro(i,!0,c,null,f,s);break;case"unstable_legacy-backwards":for(l=null,c=i.child,i.child=null;c!==null;){if(t=c.alternate,t!==null&&yo(t)===null){i.child=c;break}t=c.sibling,c.sibling=l,l=c,c=t}Ro(i,!0,l,null,f,s);break;case"together":Ro(i,!1,null,null,void 0,s);break;case"independent":i.memoizedState=null;break;default:l=E0(i.child),l===null?(c=i.child,i.child=null):(c=l.sibling,l.sibling=null),Ro(i,!1,c,l,f,s)}return i.child}function D0(t,i,l){var s=i.pendingProps;return Ma(i,i.type,s.value),oe(t,i,s.children,l),i.child}function oa(t,i,l){if(t!==null&&(i.dependencies=t.dependencies),Ua|=i.lanes,(l&i.childLanes)===0)if(t!==null){if(yn(t,i,l,!1),(l&i.childLanes)===0)return null}else return null;if(t!==null&&i.child!==t.child)throw Error(r(153));if(i.child!==null){for(t=i.child,l=ia(t,t.pendingProps),i.child=l,l.return=i;t.sibling!==null;)t=t.sibling,l=l.sibling=ia(t,t.pendingProps),l.return=i;l.sibling=null}return i.child}function wh(t,i){return(t.lanes&i)!==0?!0:(t=t.dependencies,!!(t!==null&&uo(t)))}function L1(t,i,l){switch(i.tag){case 3:Bs(i,i.stateNode.containerInfo),Ma(i,ie,t.memoizedState.cache),pn();break;case 27:case 5:$u(i);break;case 4:Bs(i,i.stateNode.containerInfo);break;case 10:Ma(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Wc(i),null;break;case 13:var s=i.memoizedState;if(s!==null){if(s.dehydrated!==null)return ka(i),i.flags|=128,null;s=yn(t,i,l,!1);var c=i.child.childLanes;return s||(l&c)!==0?w0(t,i,l):(ka(i),t=oa(t,i,l),t!==null?t.sibling:null)}ka(i);break;case 19:if(i.flags&128)return Th(t,i,l);if(c=(t.flags&128)!==0,s=(l&i.childLanes)!==0,s||(yn(t,i,l,!1),s=(l&i.childLanes)!==0),c){if(s)return Th(t,i,l);i.flags|=128}if(c=i.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Er(i,ye.current),s)break;return null;case 22:return i.lanes=0,b0(t,i,l,i.pendingProps);case 24:Ma(i,ie,t.memoizedState.cache)}return oa(t,i,l)}function M0(t,i,l){if(t!==null)if(t.memoizedProps!==i.pendingProps)ne=!0;else{if(!wh(t,l)&&(i.flags&128)===0)return ne=!1,L1(t,i,l);ne=(t.flags&131072)!==0}else ne=!1,Ct&&(i.flags&1048576)!==0&&rm(i,yr,i.index);switch(i.lanes=0,i.tag){case 16:t:{var s=i.pendingProps;if(t=_n(i.elementType),i.type=t,typeof t=="function")Rc(t)?(s=On(t,s),i.tag=1,i=C0(null,i,t,s,l)):(i.tag=0,i=yh(null,i,t,s,l));else{if(t!=null){var c=t.$$typeof;if(c===P){i.tag=11,i=p0(null,i,t,s,l);break t}else if(c===ct){i.tag=14,i=v0(null,i,t,s,l);break t}else if(c===yt){i.tag=10,i.type=t,i=D0(null,i,l);break t}}throw i=Q(t)||t,Error(r(306,i,""))}}return i;case 0:return yh(t,i,i.type,i.pendingProps,l);case 1:return s=i.type,c=On(s,i.pendingProps),C0(t,i,s,c,l);case 3:t:{if(Bs(i,i.stateNode.containerInfo),t===null)throw Error(r(387));s=i.pendingProps;var f=i.memoizedState;c=f.element,qc(t,i),Or(i,s,null,l);var v=i.memoizedState;if(s=v.cache,Ma(i,ie,s),s!==f.cache&&Yc(i,[ie],l,!0),wr(),s=v.element,f.isDehydrated)if(f={element:s,isDehydrated:!1,cache:v.cache},i.updateQueue.baseState=f,i.memoizedState=f,i.flags&256){i=T0(t,i,s,l);break t}else if(s!==c){c=ui(Error(r(424)),i),br(c),i=T0(t,i,s,l);break t}else for(t=i.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,qt=gi(t.firstChild),ce=i,Ct=!0,Ea=null,fi=!0,l=bm(i,null,s,l),i.child=l;l;)l.flags=l.flags&-3|134221824,l=l.sibling;else{if(pn(),s===c){i=oa(t,i,l);break t}oe(t,i,s,l)}i=i.child}return i;case 26:return gl(t,i),t===null?(l=tv(i.type,null,i.pendingProps,null))?i.memoizedState=l:Ct||(i.stateNode=zp(i.type,i.pendingProps,Sa.current,i)):i.memoizedState=tv(i.type,t.memoizedProps,i.pendingProps,t.memoizedState),null;case 27:return $u(i),t===null&&Ct&&(s=i.stateNode=Wp(i.type,i.pendingProps,Sa.current),ce=i,fi=!0,c=qt,Ga(i.type)?(_f=c,qt=gi(s.firstChild)):qt=c),oe(t,i,i.pendingProps.children,l),gl(t,i),t===null&&(i.flags|=4194304),i.child;case 5:return t===null&&Ct&&((c=s=qt)&&(s=jS(s,i.type,i.pendingProps,fi),s!==null?(i.stateNode=s,ce=i,qt=gi(s.firstChild),fi=!1,c=!0):c=!1),c||Da(i)),$u(i),c=i.type,f=i.pendingProps,v=t!==null?t.memoizedProps:null,s=f.children,df(c,f)?s=null:v!==null&&df(c,v)&&(i.flags|=32),i.memoizedState!==null&&(c=Jc(t,i,O1,null,null,l),Rl._currentValue=c),gl(t,i),oe(t,i,s,l),i.child;case 6:return t===null&&Ct&&((t=l=qt)&&(l=RS(l,i.pendingProps,fi),l!==null?(i.stateNode=l,ce=i,qt=null,t=!0):t=!1),t||Da(i)),null;case 13:return w0(t,i,l);case 4:return Bs(i,i.stateNode.containerInfo),s=i.pendingProps,t===null?i.child=Tn(i,null,s,l):oe(t,i,s,l),i.child;case 11:return p0(t,i,i.type,i.pendingProps,l);case 7:return s=i.pendingProps,gl(t,i),oe(t,i,s,l),i.child;case 8:return oe(t,i,i.pendingProps.children,l),i.child;case 12:return oe(t,i,i.pendingProps.children,l),i.child;case 10:return D0(t,i,l);case 9:return c=i.type._context,s=i.pendingProps.children,bn(i),c=pe(c),s=s(c),i.flags|=1,oe(t,i,s,l),i.child;case 14:return v0(t,i,i.type,i.pendingProps,l);case 15:return y0(t,i,i.type,i.pendingProps,l);case 19:return Th(t,i,l);case 31:return k1(t,i,l);case 22:return b0(t,i,l,i.pendingProps);case 24:return bn(i),s=pe(ie),t===null?(c=Vc(),c===null&&(c=Xt,f=Uc(),c.pooledCache=f,f.refCount++,f!==null&&(c.pooledCacheLanes|=l),c=f),i.memoizedState={parent:s,cache:c},Gc(i),Ma(i,ie,c)):((t.lanes&l)!==0&&(qc(t,i),Or(i,null,null,l),wr()),c=t.memoizedState,f=i.memoizedState,c.parent!==s?(c={parent:s,cache:s},i.memoizedState=c,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=c),Ma(i,ie,s)):(s=f.cache,Ma(i,ie,s),s!==c.cache&&Yc(i,[ie],l,!0))),oe(t,i,i.pendingProps.children,l),i.child;case 30:return i.stateNode===null&&(i.stateNode={autoName:null,paired:null,clones:null,ref:null}),s=i.pendingProps,s.name!=null&&s.name!=="auto"?i.flags|=t===null?18882560:18874368:Ct&&ro(i),t!==null&&t.memoizedProps.name!==s.name?i.flags|=4194816:gl(t,i),oe(t,i,s.children,l),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function ua(t){t.flags|=4}function Oh(t,i,l,s,c){var f;if((f=(t.mode&32)!==0)&&(f=l===null?nv(i,s):nv(i,s)&&(s.src!==l.src||s.srcSet!==l.srcSet)),f){if(t.flags|=16777216,(c&335544128)===c)if(t.stateNode.complete)t.flags|=8192;else if(cp())t.flags|=8192;else throw Cn=go,Fc}else t.flags&=-16777217}function A0(t,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!lv(i))if(cp())t.flags|=8192;else throw Cn=go,Fc}function zo(t,i){i!==null&&(t.flags|=4),t.flags&16384&&(i=t.tag!==22?ng():536870912,t.lanes|=i,bl|=i)}function Rr(t,i){if(!Ct)switch(t.tailMode){case"visible":break;case"collapsed":for(var l=t.tail,s=null;l!==null;)l.alternate!==null&&(s=l),l=l.sibling;s===null?i||t.tail===null?t.tail=null:t.tail.sibling=null:s.sibling=null;break;default:for(i=t.tail,l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?t.tail=null:l.sibling=null}}function Pt(t){var i=t.alternate!==null&&t.alternate.child===t.child,l=0,s=0;if(i)for(var c=t.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags&1206910976,s|=c.flags&1206910976,c.return=t,c=c.sibling;else for(c=t.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags,s|=c.flags,c.return=t,c=c.sibling;return t.subtreeFlags|=s,t.childLanes=l,i}function H1(t,i,l){var s=i.pendingProps;switch(kc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pt(i),null;case 1:return Pt(i),null;case 3:return l=i.stateNode,s=null,t!==null&&(s=t.memoizedState.cache),i.memoizedState.cache!==s&&(i.flags|=2048),la(ie),qn(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(t===null||t.child===null)&&(sl(i)?ua(i):t===null||t.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Lc())),Pt(i),null;case 26:var c=i.type,f=i.memoizedState;return t===null?(ua(i),f!==null?(Pt(i),A0(i,f)):(Pt(i),Oh(i,c,null,s,l))):f?f!==t.memoizedState?(ua(i),Pt(i),A0(i,f)):(Pt(i),i.flags&=-16777217):(t=t.memoizedProps,t!==s&&ua(i),Pt(i),Oh(i,c,t,s,l)),null;case 27:if(Ls(i),l=Sa.current,c=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==s&&ua(i);else{if(!s){if(i.stateNode===null)throw Error(r(166));return Pt(i),i.subtreeFlags&=-33554433,null}t=Ni.current,sl(i)?om(i):(t=Wp(c,s,l),i.stateNode=t,ua(i))}return Pt(i),i.subtreeFlags&=-33554433,null;case 5:if(Ls(i),c=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==s&&ua(i);else{if(!s){if(i.stateNode===null)throw Error(r(166));return Pt(i),i.subtreeFlags&=-33554433,null}if(f=Ni.current,sl(i))om(i);else{var v=Fr(Sa.current);switch(f){case 1:f=v.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:f=v.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":f=v.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":f=v.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":f=v.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof s.is=="string"?v.createElement("select",{is:s.is}):v.createElement("select"),s.multiple?f.multiple=!0:s.size&&(f.size=s.size);break;default:f=typeof s.is=="string"?v.createElement(c,{is:s.is}):v.createElement(c)}}f[me]=i,f[ke]=s;t:for(v=i.child;v!==null;){if(v.tag===5||v.tag===6)f.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===i)break t;for(;v.sibling===null;){if(v.return===null||v.return===i)break t;v=v.return}v.sibling.return=v.return,v=v.sibling}i.stateNode=f;t:switch(xe(f,c,s),c){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break t;case"img":s=!0;break t;default:s=!1}s&&ua(i)}}return Pt(i),i.subtreeFlags&=-33554433,Oh(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,l),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==s&&ua(i);else{if(typeof s!="string"&&i.stateNode===null)throw Error(r(166));if(t=Sa.current,sl(i)){if(t=i.stateNode,l=i.memoizedProps,s=null,c=ce,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}t[me]=i,t=!!(t.nodeValue===l||s!==null&&s.suppressHydrationWarning===!0||Mp(t.nodeValue,l)),t||Da(i,!0)}else t=Fr(t).createTextNode(s),t[me]=i,i.stateNode=t}return Pt(i),null;case 31:if(l=i.memoizedState,t===null||t.memoizedState!==null){if(s=sl(i),l!==null){if(t===null){if(!s)throw Error(r(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(557));t[me]=i}else pn(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Pt(i),t=!1}else l=Lc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return i.flags&256?(Qe(i),i):(Qe(i),null);if((i.flags&128)!==0)throw Error(r(558))}return Pt(i),null;case 13:if(s=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(c=sl(i),s!==null&&s.dehydrated!==null){if(t===null){if(!c)throw Error(r(318));if(c=i.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(r(317));c[me]=i}else pn(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Pt(i),c=!1}else c=Lc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=c),c=!0;if(!c)return i.flags&256?(Qe(i),i):(Qe(i),null)}return Qe(i),(i.flags&128)!==0?(i.lanes=l,i):(l=s!==null,t=t!==null&&t.memoizedState!==null,l&&(s=i.child,c=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(c=s.alternate.memoizedState.cachePool.pool),f=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(f=s.memoizedState.cachePool.pool),f!==c&&(s.flags|=2048)),l!==t&&l&&(i.child.flags|=8192),zo(i,i.updateQueue),Pt(i),null);case 4:return qn(),t===null&&of(i.stateNode.containerInfo),i.flags|=67108864,Pt(i),null;case 10:return la(i.type),Pt(i),null;case 19:if(Zc(i),s=i.memoizedState,s===null)return Pt(i),null;if(c=(i.flags&128)!==0,f=s.rendering,f===null)if(c)Rr(s,!1);else{if(Zt!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(f=yo(t),f!==null){for(i.flags|=128,Rr(s,!1),t=f.updateQueue,i.updateQueue=t,zo(i,t),i.subtreeFlags=0,t=l,l=i.child;l!==null;)am(l,t),l=l.sibling;return Er(i,ye.current&1|2),Ct&&aa(i,s.treeForkCount),i.child}t=t.sibling}s.tail!==null&&Ve()>qo&&(i.flags|=128,c=!0,Rr(s,!1),i.lanes=4194304)}else{if(!c)if(t=yo(f),t!==null){if(i.flags|=128,c=!0,t=t.updateQueue,i.updateQueue=t,zo(i,t),Rr(s,!0),s.tail===null&&s.tailMode!=="collapsed"&&s.tailMode!=="visible"&&!f.alternate&&!Ct)return Pt(i),null}else 2*Ve()-s.renderingStartTime>qo&&l!==536870912&&(i.flags|=128,c=!0,Rr(s,!1),i.lanes=4194304);s.isBackwards?(f.sibling=i.child,i.child=f):(t=s.last,t!==null?t.sibling=f:i.child=f,s.last=f)}if(s.tail!==null){t=s.tail;t:{for(l=t;l!==null;){if(l.alternate!==null){l=!1;break t}l=l.sibling}l=!0}return s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Ve(),t.sibling=null,f=ye.current,f=c?f&1|2:f&1,s.tailMode==="visible"||s.tailMode==="collapsed"||!l||Ct?Er(i,f):(l=f,Gt(ve,i),Gt(ye,l),Ce===null&&(Ce=i)),Ct&&aa(i,s.treeForkCount),t}return Pt(i),null;case 22:case 23:return Qe(i),Ic(),s=i.memoizedState!==null,t!==null?t.memoizedState!==null!==s&&(i.flags|=8192):s&&(i.flags|=8192),s?(l&536870912)!==0&&(i.flags&128)===0&&(Pt(i),i.subtreeFlags&6&&(i.flags|=8192)):Pt(i),l=i.updateQueue,l!==null&&zo(i,l.retryQueue),l=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),s=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==l&&(i.flags|=2048),t!==null&&ge(Sn),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),i.memoizedState.cache!==l&&(i.flags|=2048),la(ie),Pt(i),null;case 25:return null;case 30:return i.flags|=33554432,Pt(i),null}throw Error(r(156,i.tag))}function Y1(t,i){switch(kc(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return la(ie),qn(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return Ls(i),null;case 31:if(i.memoizedState!==null){if(Qe(i),i.alternate===null)throw Error(r(340));pn()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if(Qe(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(r(340));pn()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return Zc(i),t=i.flags,t&65536?(i.flags=t&-65537|128,t=i.memoizedState,t!==null&&(t.rendering=null,t.tail=null),i.flags|=4,i):null;case 4:return qn(),null;case 10:return la(i.type),null;case 22:case 23:return Qe(i),Ic(),t!==null&&ge(Sn),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return la(ie),null;case 25:return null;default:return null}}function j0(t,i){switch(kc(i),i.tag){case 3:la(ie),qn();break;case 26:case 27:case 5:Ls(i);break;case 4:qn();break;case 31:i.memoizedState!==null&&Qe(i);break;case 13:Qe(i);break;case 19:Zc(i);break;case 10:la(i.type);break;case 22:case 23:Qe(i),Ic(),t!==null&&ge(Sn);break;case 24:la(ie)}}function zr(t,i){try{var l=i.updateQueue,s=l!==null?l.lastEffect:null;if(s!==null){var c=s.next;l=c;do{if((l.tag&t)===t){s=void 0;var f=l.create,v=l.inst;s=f(),v.destroy=s}l=l.next}while(l!==c)}}catch(x){Lt(i,i.return,x)}}function La(t,i,l){try{var s=i.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var f=c.next;s=f;do{if((s.tag&t)===t){var v=s.inst,x=v.destroy;if(x!==void 0){v.destroy=void 0,c=i;var C=l,j=x;try{j()}catch(L){Lt(c,C,L)}}}s=s.next}while(s!==f)}}catch(L){Lt(i,i.return,L)}}function R0(t){var i=t.updateQueue;if(i!==null){var l=t.stateNode;try{Sm(i,l)}catch(s){Lt(t,t.return,s)}}}function z0(t,i,l){l.props=On(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(s){Lt(t,i,s)}}function Hi(t,i){try{var l=t.ref;if(l!==null){switch(t.tag){case 26:case 27:case 5:var s=t.stateNode;break;case 30:var c=t.stateNode,f=ta(t.memoizedProps,c);(c.ref===null||c.ref.name!==f)&&(c.ref=Up(f)),s=c.ref;break;case 7:if(t.stateNode===null){var v=new $e(t);y(t.child,!1,MS,v,void 0,void 0),t.stateNode=v}s=t.stateNode;break;default:s=t.stateNode}typeof l=="function"?t.refCleanup=l(s):l.current=s}}catch(x){Lt(t,i,x)}}function be(t,i){var l=t.ref,s=t.refCleanup;if(l!==null)if(typeof s=="function")try{s()}catch(c){Lt(t,i,c)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(c){Lt(t,i,c)}else l.current=null}function No(t,i){if((t.tag===5||t.tag===27||t.tag===6)&&t.alternate===null&&i!==null)for(var l=0;l<i.length;l++)Pp(t.stateNode,i[l])}function N0(t){for(var i=t.return;i!==null&&(Dh(i)&&Pp(t.stateNode,i.stateNode),!Eh(i));)i=i.return}function Nr(t){for(var i=t.return;i!==null&&(Dh(i)&&AS(t.stateNode,i.stateNode),!Eh(i));)i=i.return}function Eh(t){return t.tag===5||t.tag===3||t.tag===27}function Dh(t){return t&&t.tag===7&&t.stateNode!==null}function Mh(t){var i=t.type,l=t.memoizedProps,s=t.stateNode;try{t:switch(i){case"button":case"input":case"select":case"textarea":l.autoFocus&&s.focus();break t;case"img":l.src?s.src=l.src:l.srcSet&&(s.srcset=l.srcSet)}}catch(c){Lt(t,t.return,c)}}function Ah(t,i,l){try{var s=t.stateNode;hS(s,t.type,l,i),s[ke]=i}catch(c){Lt(t,t.return,c)}}function k0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ga(t.type)||t.tag===4}function jh(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||k0(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Ga(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Rh(t,i,l,s){var c=t.tag;if(c===5||c===6)c=t.stateNode,i?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(c,i):(i=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,i.appendChild(c),l=l._reactRootContainer,l!=null||i.onclick!==null||(i.onclick=ki)),No(t,s),Rt=!0;else if(c!==4&&(c===27&&(No(t,s),s=null,Ga(t.type)&&(l=t.stateNode,i=null)),t=t.child,t!==null))for(Rh(t,i,l,s),t=t.sibling;t!==null;)Rh(t,i,l,s),t=t.sibling}function ko(t,i,l,s){var c=t.tag;if(c===5||c===6)c=t.stateNode,i?l.insertBefore(c,i):l.appendChild(c),No(t,s),Rt=!0;else if(c!==4&&(c===27&&(No(t,s),s=null,Ga(t.type)&&(l=t.stateNode)),t=t.child,t!==null))for(ko(t,i,l,s),t=t.sibling;t!==null;)ko(t,i,l,s),t=t.sibling}function B0(t){var i=t.stateNode,l=t.memoizedProps;try{for(var s=t.type,c=i.attributes;c.length;)i.removeAttributeNode(c[0]);xe(i,s,l),i[me]=t,i[ke]=l}catch(f){Lt(t,t.return,f)}}var Bo=!1,Ke=null;function L0(t){(t.tag===30||(t.subtreeFlags&33554432)!==0)&&(Bo=!0)}var Yi=null;function H0(){var t=Yi;return Yi=null,t}var Le=0;function ml(t,i,l,s,c){return Le=0,Y0(t.child,i,l,s,c)}function Y0(t,i,l,s,c){for(var f=!1;t!==null;){if(t.tag===5){var v=t.stateNode;if(s!==null){var x=pf(v);s.push(x),x.view&&(f=!0)}else f||pf(v).view&&(f=!0);Bo=!0,Hp(v,Le===0?i:i+"_"+Le,l),Le++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&c||Y0(t.child,i,l,s,c)&&(f=!0));t=t.sibling}return f}function Ui(t,i){for(;t!==null;)t.tag===5?Yp(t.stateNode,t.memoizedProps):(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&i||Ui(t.child,i)),t=t.sibling}function Lo(t){if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if((t.tag!==22||t.memoizedState===null)&&(Lo(t),t.tag===30&&(t.flags&18874368)!==0&&t.stateNode.paired)){var i=t.memoizedProps;if(i.name==null||i.name==="auto")throw Error(r(544));var l=i.name;i=ea(i.default,i.share),i!=="none"&&(ml(t,l,i,null,!1)||Ui(t.child,!1))}t=t.sibling}}function zh(t,i){if(t.tag===30){var l=t.stateNode,s=t.memoizedProps,c=ta(s,l),f=ea(s.default,l.paired?s.share:s.enter);f!=="none"?ml(t,c,f,null,!1)?(Lo(t),l.paired||i||Cl(t,s.onEnter)):Ui(t.child,!1):Lo(t)}else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)zh(t,i),t=t.sibling;else Lo(t)}function Nh(t){if(Ke!==null&&Ke.size!==0){var i=Ke;if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if(t.tag!==22||t.memoizedState===null){if(t.tag===30&&(t.flags&18874368)!==0){var l=t.memoizedProps,s=l.name;if(s!=null&&s!=="auto"){var c=i.get(s);if(c!==void 0){var f=ea(l.default,l.share);if(f!=="none"&&(ml(t,s,f,null,!1)?(f=t.stateNode,c.paired=f,f.paired=c,Cl(t,l.onShare)):Ui(t.child,!1)),i.delete(s),i.size===0)break}}}Nh(t)}t=t.sibling}}}function kh(t){if(t.tag===30){var i=t.memoizedProps,l=ta(i,t.stateNode),s=Ke!==null?Ke.get(l):void 0,c=ea(i.default,s!==void 0?i.share:i.exit);c!=="none"&&(ml(t,l,c,null,!1)?s!==void 0?(c=t.stateNode,s.paired=c,c.paired=s,Ke.delete(l),Cl(t,i.onShare)):Cl(t,i.onExit):Ui(t.child,!1)),Ke!==null&&Nh(t)}else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)kh(t),t=t.sibling;else Ke!==null&&Nh(t)}function U0(t){for(t=t.child;t!==null;){if(t.tag===30){var i=t.memoizedProps,l=ta(i,t.stateNode);i=ea(i.default,i.update),t.flags&=-5,i!=="none"&&ml(t,l,i,t.memoizedState=[],!1)}else(t.subtreeFlags&33554432)!==0&&U0(t);t=t.sibling}}function Bh(t){if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if(t.tag!==22||t.memoizedState===null){if(t.tag===30&&(t.flags&18874368)!==0){var i=t.stateNode;i.paired!==null&&(i.paired=null,Ui(t.child,!1))}Bh(t)}t=t.sibling}}function Ho(t){if(t.tag===30)t.stateNode.paired=null,Ui(t.child,!1),Bh(t);else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)Ho(t),t=t.sibling;else Bh(t)}function X0(t){for(t=t.child;t!==null;)t.tag===30?Ui(t.child,!1):(t.subtreeFlags&33554432)!==0&&X0(t),t=t.sibling}function Lh(t,i,l,s,c,f,v){for(var x=!1;i!==null;){if(i.tag===5){var C=i.stateNode;if(f!==null&&Le<f.length){var j=f[Le],L=pf(C);(j.view||L.view)&&(x=!0);var V;if(V=(t.flags&4)===0)if(L.clip)V=!0;else{V=j.rect;var M=L.rect;V=V.y!==M.y||V.x!==M.x||V.height!==M.height||V.width!==M.width}V&&(t.flags|=4),L.abs?L=!j.abs:(j=j.rect,L=L.rect,L=j.height!==L.height||j.width!==L.width),L&&(t.flags|=32)}else t.flags|=32;(t.flags&4)!==0&&Hp(C,Le===0?l:l+"_"+Le,c),x&&(t.flags&4)!==0||(Yi===null&&(Yi=[]),Yi.push(C,Le===0?s:s+"_"+Le,i.memoizedProps)),Le++}else(i.tag!==22||i.memoizedState===null)&&(i.tag===30&&v?t.flags|=i.flags&32:Lh(t,i.child,l,s,c,f,v)&&(x=!0));i=i.sibling}return x}function V0(t,i){for(t=t.child;t!==null;){if(t.tag===30){var l=t.memoizedProps,s=t.stateNode,c=ta(l,s),f=ea(l.default,l.update),v;v=t.memoizedState,t.memoizedState=null,s=t;var x=t.child;Le=0,c=Lh(s,x,c,c,f,v,!1),(t.flags&4)!==0&&c&&Cl(t,l.onUpdate)}else(t.subtreeFlags&33554432)!==0&&V0(t);t=t.sibling}}var he=!1,kt=!1,Xi=!1,Hh=!1,F0=typeof WeakSet=="function"?WeakSet:Set,fe=null,Vi=!1,kr=!1,Yo=!1,Yh=!1;function U1(t,i,l){if(t=t.containerInfo,hf=zl,t=Qg(t),wc(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else t:{s=(s=t.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var f=c.anchorOffset,v=c.focusNode;c=c.focusOffset;try{s.nodeType,v.nodeType}catch{s=null;break t}var x=0,C=-1,j=-1,L=0,V=0,M=t,k=null;e:for(;;){for(var Z;M!==s||f!==0&&M.nodeType!==3||(C=x+f),M!==v||c!==0&&M.nodeType!==3||(j=x+c),M.nodeType===3&&(x+=M.nodeValue.length),(Z=M.firstChild)!==null;)k=M,M=Z;for(;;){if(M===t)break e;if(k===s&&++L===f&&(C=x),k===v&&++V===c&&(j=x),(Z=M.nextSibling)!==null)break;M=k,k=M.parentNode}M=Z}s=C===-1||j===-1?null:{start:C,end:j}}else s=null}s=s||{start:0,end:0}}else s=null;for(ff={focusedElem:t,selectionRange:s},zl=!1,l=(l&335544064)===l,fe=i,i=l?9270:1024;fe!==null;){if(t=fe,l&&(s=t.deletions,s!==null))for(f=0;f<s.length;f++)l&&kh(s[f]);if(t.alternate===null&&(t.flags&2)!==0)l&&L0(t),Uo(l);else{if(t.tag===22){if(s=t.alternate,t.memoizedState!==null){s!==null&&s.memoizedState===null&&l&&kh(s),Uo(l);continue}else if(s!==null&&s.memoizedState!==null){l&&L0(t),Uo(l);continue}}s=t.child,(t.subtreeFlags&i)!==0&&s!==null?(s.return=t,fe=s):(l&&U0(t),Uo(l))}}Ke=null}function Uo(t){for(;fe!==null;){var i=fe,l=t,s=i.alternate,c=i.flags;switch(i.tag){case 0:case 11:case 15:break;case 1:if((c&1024)!==0&&s!==null){l=void 0,c=s.memoizedProps,s=s.memoizedState;var f=i.stateNode;try{var v=On(i.type,c);l=f.getSnapshotBeforeUpdate(v,s),f.__reactInternalSnapshotBeforeUpdate=l}catch(x){Lt(i,i.return,x)}}break;case 3:if((c&1024)!==0){if(s=i.stateNode.containerInfo,l=s.nodeType,l===9)bf(s);else if(l===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":bf(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:l&&s!==null&&(l=ta(s.memoizedProps,s.stateNode),c=i.memoizedProps,c=ea(c.default,c.update),c!=="none"&&ml(s,l,c,s.memoizedState=[],!0));break;default:if((c&1024)!==0)throw Error(r(163))}if(s=i.sibling,s!==null){s.return=i.return,fe=s;break}fe=i.return}}function G0(t,i,l){var s=l.flags;switch(l.tag){case 0:case 11:case 15:Fi(t,l),s&4&&zr(5,l);break;case 1:if(Fi(t,l),s&4)if(t=l.stateNode,i===null)try{t.componentDidMount()}catch(v){Lt(l,l.return,v)}else{var c=On(l.type,i.memoizedProps);i=i.memoizedState;try{t.componentDidUpdate(c,i,t.__reactInternalSnapshotBeforeUpdate)}catch(v){Lt(l,l.return,v)}}s&64&&R0(l),s&512&&Hi(l,l.return);break;case 3:if(Fi(t,l),s&64&&(t=l.updateQueue,t!==null)){if(i=null,l.child!==null)switch(l.child.tag){case 27:case 5:i=l.child.stateNode;break;case 1:i=l.child.stateNode}try{Sm(t,i)}catch(v){Lt(l,l.return,v)}}break;case 27:i===null&&s&4&&B0(l);case 26:case 5:Fi(t,l),i===null&&s&4&&Mh(l),s&512&&Hi(l,l.return);break;case 12:Fi(t,l);break;case 31:Fi(t,l),s&4&&K0(t,l);break;case 13:Fi(t,l),s&4&&I0(t,l),s&64&&(t=l.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(l=$1.bind(null,l),zS(t,l))));break;case 22:if(s=l.memoizedState!==null||he,!s){var f=i!==null&&i.memoizedState!==null||kt;i=he,c=kt,he=s,(kt=f)&&!c?(s=2,(l.subtreeFlags&8772)!==0&&(s|=1),_i(t,l,s)):Fi(t,l),he=i,kt=c}break;case 30:Fi(t,l),s&512&&Hi(l,l.return);break;case 7:s&512&&Hi(l,l.return);default:Fi(t,l)}}function Uh(t,i){for(t=t.child;t!==null;)q0(t,i),t=t.sibling}function q0(t,i){switch(t.tag){case 5:case 26:try{var l=t.stateNode;if(i){var s=l.style;typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"}else{var c=t.stateNode,f=t.memoizedProps.style,v=f!=null&&f.hasOwnProperty("display")?f.display:null;c.style.display=v==null||typeof v=="boolean"?"":(""+v).trim()}}catch(C){Lt(t,t.return,C)}Xh(t,i);break;case 6:try{t.stateNode.nodeValue=i?"":t.memoizedProps,Rt=!0}catch(C){Lt(t,t.return,C)}break;case 18:try{var x=t.stateNode;i?Lp(x,!0):Lp(t.stateNode,!1)}catch(C){Lt(t,t.return,C)}break;case 22:case 23:t.memoizedState===null&&Uh(t,i);break;default:Uh(t,i)}}function Xh(t,i){if(t.subtreeFlags&67108864)for(t=t.child;t!==null;){t:{var l=t,s=i;switch(l.tag){case 4:q0(l,s);break t;case 22:l.memoizedState===null&&Xh(l,s);break t;default:Xh(l,s)}}t=t.sibling}}function P0(t){var i=t.alternate;i!==null&&(t.alternate=null,P0(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&Gs(i)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Qt=null,He=!1;function xi(t,i,l){for(l=l.child;l!==null;)Q0(t,i,l),l=l.sibling}function Q0(t,i,l){if(Fe&&typeof Fe.onCommitFiberUnmount=="function")try{Fe.onCommitFiberUnmount(nr,l)}catch{}switch(l.tag){case 26:kt||be(l,i),xi(t,i,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&!kt&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:kt||be(l,i),Nr(l);var s=Qt,c=He;Ga(l.type)&&(Qt=l.stateNode,He=!1),xi(t,i,l),Zp(l.stateNode,l.type,l.memoizedProps),Qt=s,He=c;break;case 5:kt||be(l,i),Nr(l);case 6:if(l.tag===6&&Nr(l),s=Qt,c=He,Qt=null,xi(t,i,l),Qt=s,He=c,Qt!==null)if(He)try{(Qt.nodeType===9?Qt.body:Qt.nodeName==="HTML"?Qt.ownerDocument.body:Qt).removeChild(l.stateNode),Rt=!0}catch(f){Lt(l,i,f)}else try{Qt.removeChild(l.stateNode),Rt=!0}catch(f){Lt(l,i,f)}break;case 18:Qt!==null&&(He?(t=Qt,Bp(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,l.stateNode),Nl(t)):Bp(Qt,l.stateNode));break;case 4:s=Qt,c=He,Qt=l.stateNode.containerInfo,He=!0,xi(t,i,l),Qt=s,He=c;break;case 0:case 11:case 14:case 15:La(2,l,i),kt||La(4,l,i),xi(t,i,l);break;case 1:kt||(be(l,i),s=l.stateNode,typeof s.componentWillUnmount=="function"&&z0(l,i,s)),xi(t,i,l);break;case 21:xi(t,i,l);break;case 22:kt=(s=kt)||l.memoizedState!==null,xi(t,i,l),kt=s;break;case 30:be(l,i),xi(t,i,l);break;case 7:kt||be(l,i),xi(t,i,l);break;default:xi(t,i,l)}}function K0(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Nl(t)}catch(l){Lt(i,i.return,l)}}}function I0(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Nl(t)}catch(l){Lt(i,i.return,l)}}function X1(t){switch(t.tag){case 31:case 13:case 19:var i=t.stateNode;return i===null&&(i=t.stateNode=new F0),i;case 22:return t=t.stateNode,i=t._retryCache,i===null&&(i=t._retryCache=new F0),i;default:throw Error(r(435,t.tag))}}function Xo(t,i){var l=X1(t);i.forEach(function(s){if(!l.has(s)){l.add(s);var c=J1.bind(null,t,s);s.then(c,c)}})}function Me(t,i,l){var s=i.deletions;if(s!==null)for(var c=0;c<s.length;c++){var f=s[c],v=t,x=i,C=x;t:for(;C!==null;){switch(C.tag){case 27:if(Ga(C.type)){Qt=C.stateNode,He=!1;break t}break;case 5:Qt=C.stateNode,He=!1;break t;case 3:case 4:Qt=C.stateNode.containerInfo,He=!0;break t}C=C.return}if(Qt===null)throw Error(r(160));Q0(v,x,f),Qt=null,He=!1,v=f.alternate,v!==null&&(v.return=null),f.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)W0(i,t,l),i=i.sibling}var Si=null;function W0(t,i,l){var s=t.alternate,c=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(c&4&&(s=t.updateQueue,s=s!==null?s.events:null,s!==null))for(var f=0;f<s.length;f++){var v=s[f];v.ref.impl=v.nextImpl}Me(i,t,l),Ae(t),c&4&&(La(3,t,t.return),zr(3,t),La(5,t,t.return));break;case 1:Me(i,t,l),Ae(t),c&512&&(kt||s===null||be(s,s.return)),c&64&&he&&(t=t.updateQueue,t!==null&&(i=t.callbacks,i!==null&&(l=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=l===null?i:l.concat(i))));break;case 26:if(f=Si,Me(i,t,l),Ae(t),c&512&&(kt||s===null||be(s,s.return)),c&4)if(c=s!==null?s.memoizedState:null,l=t.memoizedState,s===null)if(l===null)if(t.stateNode===null)if(he)t.stateNode=zp(t.type,t.memoizedProps,i.containerInfo,t);else{t:{i=t.type,l=t.memoizedProps,c=f.ownerDocument||f;e:switch(i){case"title":s=c.getElementsByTagName("title")[0],(!s||s[sr]||s[me]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=c.createElement(i),c.head.insertBefore(s,c.querySelector("head > title"))),xe(s,i,l),s[me]=t,ue(s),i=s;break t;case"link":if(f=av("link","href",c).get(i+(l.href||""))){for(v=0;v<f.length;v++)if(s=f[v],s.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&s.getAttribute("rel")===(l.rel==null?null:l.rel)&&s.getAttribute("title")===(l.title==null?null:l.title)&&s.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){f.splice(v,1);break e}}s=c.createElement(i),xe(s,i,l),c.head.appendChild(s);break;case"meta":if(f=av("meta","content",c).get(i+(l.content||""))){for(v=0;v<f.length;v++)if(s=f[v],s.getAttribute("content")===(l.content==null?null:""+l.content)&&s.getAttribute("name")===(l.name==null?null:l.name)&&s.getAttribute("property")===(l.property==null?null:l.property)&&s.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&s.getAttribute("charset")===(l.charSet==null?null:l.charSet)){f.splice(v,1);break e}}s=c.createElement(i),xe(s,i,l),c.head.appendChild(s);break;default:throw Error(r(468,i))}s[me]=t,ue(s),i=s}t.stateNode=i}else he||Of(f,t.type,t.stateNode);else t.stateNode=iv(f,l,t.memoizedProps);else c!==l?(c===null?(i=s.stateNode,i===null||kt||i.parentNode.removeChild(i)):c.count--,l===null?he||Of(f,t.type,t.stateNode):iv(f,l,t.memoizedProps)):l===null&&t.stateNode!==null&&Ah(t,t.memoizedProps,s.memoizedProps);break;case 27:Me(i,t,l),Ae(t),c&512&&(kt||s===null||be(s,s.return)),s!==null&&c&4&&Ah(t,t.memoizedProps,s.memoizedProps);break;case 5:if(f=Xi,Xi=!1,Me(i,t,l),Xi=f,Ae(t),c&512&&(kt||s===null||be(s,s.return)),t.flags&32){i=t.stateNode;try{Zn(i,""),Rt=!0}catch(L){Lt(t,t.return,L)}}c&4&&t.stateNode!=null&&(i=t.memoizedProps,Ah(t,i,s!==null?s.memoizedProps:i)),c&1024&&(Hh=!0);break;case 6:if(Me(i,t,l),Ae(t),c&4){if(t.stateNode===null)throw Error(r(162));i=t.memoizedProps,l=t.stateNode;try{l.nodeValue=i,Rt=!0}catch(L){Lt(t,t.return,L)}}break;case 3:if(Rt=!1,iu=null,f=Si,Si=Gr(i.containerInfo),Me(i,t,l),Si=f,Ae(t),c&4&&s!==null&&s.memoizedState.isDehydrated)try{Nl(i.containerInfo)}catch(L){Lt(t,t.return,L)}Hh&&(Hh=!1,Z0(t)),Rt=!1;break;case 4:c=Xi,Xi=he,s=vg(),f=Si,Si=Gr(t.stateNode.containerInfo),Me(i,t,l),Ae(t),Si=f,Rt&&kr&&(Yo=!0),Rt=s,Xi=c;break;case 12:Me(i,t,l),Ae(t);break;case 31:Me(i,t,l),Ae(t),c&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,Xo(t,i)));break;case 13:Me(i,t,l),Ae(t),t.child.flags&8192&&t.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Go=Ve()),c&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,Xo(t,i)));break;case 22:f=t.memoizedState!==null,v=s!==null&&s.memoizedState!==null;var x=he,C=kt,j=Xi;he=x||f,Xi=j||f,kt=C||v,Me(i,t,l),kt=C,Xi=j,he=x,Ae(t),c&8192&&(i=t.stateNode,i._visibility=f?i._visibility&-2:i._visibility|1,!f||s===null||v||he||kt||(i=v||kt,l=he,s=kt,he=f||he,kt=i,Ha(t,2),he=l,kt=s),!f&&Xi||Uh(t,f)),c&4&&(i=t.updateQueue,i!==null&&(l=i.retryQueue,l!==null&&(i.retryQueue=null,Xo(t,l))));break;case 19:Me(i,t,l),Ae(t),c&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,Xo(t,i)));break;case 30:c&512&&(kt||s===null||be(s,s.return)),c=vg(),f=kr,v=(l&335544064)===l,x=t.memoizedProps,kr=v&&ea(x.default,x.update)!=="none",Me(i,t,l),Ae(t),v&&s!==null&&Rt&&(t.flags|=4),kr=f,Rt=c;break;case 21:break;case 7:c&512&&(kt||s===null||be(s,s.return)),s&&s.stateNode!==null&&(s.stateNode._fragmentFiber=t);default:Me(i,t,l),Ae(t)}}function Ae(t){var i=t.flags;if(i&2){try{for(var l,s=t.return;s!==null;){if(k0(s)){l=s;break}s=s.return}s=null;for(var c=t.return;c!==null;){if(Dh(c)){var f=c.stateNode;s===null?s=[f]:s.push(f)}if(Eh(c))break;c=c.return}var v=s;if(l==null)throw Error(r(160));switch(l.tag){case 27:var x=l.stateNode,C=jh(t);ko(t,C,x,v);break;case 5:var j=l.stateNode;l.flags&32&&(Zn(j,""),l.flags&=-33);var L=jh(t);ko(t,L,j,v);break;case 3:case 4:var V=l.stateNode.containerInfo,M=jh(t);Rh(t,M,V,v);break;default:throw Error(r(161))}}catch(k){Lt(t,t.return,k)}t.flags&=-3}i&4096&&(t.flags&=-4097)}function Z0(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var i=t;Z0(i),i.tag===5&&i.flags&1024&&(i=i.stateNode,zl=!0,i.reset(),zl=!1),t=t.sibling}}function pl(t,i){if(i.subtreeFlags&9270)for(i=i.child;i!==null;)$0(i,t),i=i.sibling;else V0(i)}function $0(t,i){var l=t.alternate;if(l===null)zh(t,!1);else switch(t.tag){case 3:if(Yh=Vi=!1,H0(),pl(i,t),!Vi&&!Yo){if(t=Yi,t!==null)for(var s=0;s<t.length;s+=3){l=t[s];var c=t[s+1];Yp(l,t[s+2]),l=l.ownerDocument.documentElement,l!==null&&l.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+c+")"})}t=i.containerInfo,t=t.nodeType===9?t.documentElement:t.ownerDocument.documentElement,t!==null&&t.style.viewTransitionName===""&&(t.style.viewTransitionName="none",t.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),t.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Yh=!0}Yi=null;break;case 5:pl(i,t);break;case 4:s=Vi,Vi=!1,pl(i,t),Vi&&(Yo=!0),Vi=s;break;case 22:t.memoizedState===null&&(l.memoizedState!==null?zh(t,!1):pl(i,t));break;case 30:s=Vi,c=H0(),Vi=!1,pl(i,t),Vi&&(t.flags|=4);var f=t.memoizedProps,v=t.stateNode;i=ta(f,v),v=ta(l.memoizedProps,v);var x=ea(f.default,f.update);x==="none"?i=!1:(f=l.memoizedState,l.memoizedState=null,l=t.child,Le=0,i=Lh(t,l,i,v,x,f,!0),Le!==(f===null?0:f.length)&&(t.flags|=32)),(t.flags&4)!==0&&i?(Cl(t,t.memoizedProps.onUpdate),Yi=c):c!==null&&(c.push.apply(c,Yi),Yi=c),Vi=(t.flags&32)!==0?!0:s;break;default:pl(i,t)}}function Fi(t,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)G0(t,i.alternate,i),i=i.sibling}function Ha(t,i){for(t=t.child;t!==null;){var l=t,s=i;switch(l.tag){case 0:case 11:case 14:case 15:La(4,l,l.return),Ha(l,s);break;case 1:be(l,l.return);var c=l.stateNode;typeof c.componentWillUnmount=="function"&&z0(l,l.return,c),Ha(l,s);break;case 27:(s&2)!==0&&Zp(l.stateNode,l.type,l.memoizedProps);case 5:be(l,l.return),l.tag!==5&&l.tag!==27||Nr(l),Ha(l,s);break;case 6:Nr(l);break;case 26:be(l,l.return),c=l.stateNode,l.memoizedState!==null||c===null||kt||c.parentNode.removeChild(c),Ha(l,s);break;case 22:l.memoizedState===null&&Ha(l,s);break;case 30:be(l,l.return),Ha(l,s);break;case 7:be(l,l.return);default:Ha(l,s)}t=t.sibling}}function _i(t,i,l){for(l=(i.subtreeFlags&8772)!==0?l:l&-2,i=i.child;i!==null;){var s=i.alternate,c=t,f=i,v=f.flags,x=(l&1)!==0;switch(f.tag){case 0:case 11:case 15:_i(c,f,l),zr(4,f);break;case 1:if(_i(c,f,l),s=f,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(L){Lt(s,s.return,L)}if(s=f,c=s.updateQueue,c!==null){var C=s.stateNode;try{var j=c.shared.hiddenCallbacks;if(j!==null)for(c.shared.hiddenCallbacks=null,c=0;c<j.length;c++)xm(j[c],C)}catch(L){Lt(s,s.return,L)}}x&&v&64&&R0(f),Hi(f,f.return);break;case 27:(l&2)!==0&&B0(f);case 5:f.tag!==5&&f.tag!==27||N0(f),_i(c,f,l),x&&s===null&&v&4&&Mh(f),Hi(f,f.return);break;case 6:N0(f);break;case 26:C=f.stateNode,f.memoizedState!==null||C===null||he||Of(Gr(C.ownerDocument),f.type,C),_i(c,f,l),x&&s===null&&v&4&&Mh(f),Hi(f,f.return);break;case 12:_i(c,f,l);break;case 31:_i(c,f,l),x&&v&4&&K0(c,f);break;case 13:_i(c,f,l),x&&v&4&&I0(c,f);break;case 22:f.memoizedState===null&&_i(c,f,l),Hi(f,f.return);break;case 30:_i(c,f,l),Hi(f,f.return);break;case 7:Hi(f,f.return);default:_i(c,f,l)}i=i.sibling}}function Vh(t,i){var l=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),t=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(t=i.memoizedState.cachePool.pool),t!==l&&(t!=null&&t.refCount++,l!=null&&xr(l))}function Fh(t,i){t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&xr(t))}function di(t,i,l,s){var c=(l&335544064)===l;if(i.subtreeFlags&(c?10262:10256))for(i=i.child;i!==null;)J0(t,i,l,s),i=i.sibling;else c&&X0(i)}function J0(t,i,l,s){var c=(l&335544064)===l;c&&i.alternate===null&&i.return!==null&&i.return.alternate!==null&&Ho(i);var f=i.flags;switch(i.tag){case 0:case 11:case 15:di(t,i,l,s),f&2048&&zr(9,i);break;case 1:di(t,i,l,s);break;case 3:di(t,i,l,s),c&&Yh&&(t=t.containerInfo,t=t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,t.style.viewTransitionName==="root"&&(t.style.viewTransitionName=""),t=t.ownerDocument.documentElement,t!==null&&t.style.viewTransitionName==="none"&&(t.style.viewTransitionName="")),f&2048&&(f=null,i.alternate!==null&&(f=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==f&&(i.refCount++,f!=null&&xr(f)));break;case 12:if(f&2048){di(t,i,l,s),f=i.stateNode;try{var v=i.memoizedProps,x=v.id,C=v.onPostCommit;typeof C=="function"&&C(x,i.alternate===null?"mount":"update",f.passiveEffectDuration,-0)}catch(j){Lt(i,i.return,j)}}else di(t,i,l,s);break;case 31:di(t,i,l,s);break;case 13:di(t,i,l,s);break;case 23:break;case 22:v=i.stateNode,x=i.alternate,i.memoizedState!==null?(c&&x!==null&&x.memoizedState===null&&Ho(x),v._visibility&2?di(t,i,l,s):Br(t,i)):(c&&x!==null&&x.memoizedState!==null&&Ho(i),v._visibility&2?di(t,i,l,s):(v._visibility|=2,vl(t,i,l,s,(i.subtreeFlags&10256)!==0||!1))),f&2048&&Vh(x,i);break;case 24:di(t,i,l,s),f&2048&&Fh(i.alternate,i);break;case 30:c&&(f=i.alternate,f!==null&&(Ui(f.child,!0),Ui(i.child,!0))),di(t,i,l,s);break;default:di(t,i,l,s)}}function vl(t,i,l,s,c){for(c=c&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var f=t,v=i,x=l,C=s,j=v.flags;switch(v.tag){case 0:case 11:case 15:vl(f,v,x,C,c),zr(8,v);break;case 23:break;case 22:var L=v.stateNode;v.memoizedState!==null?L._visibility&2?vl(f,v,x,C,c):Br(f,v):(L._visibility|=2,vl(f,v,x,C,c)),c&&j&2048&&Vh(v.alternate,v);break;case 24:vl(f,v,x,C,c),c&&j&2048&&Fh(v.alternate,v);break;default:vl(f,v,x,C,c)}i=i.sibling}}function Br(t,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var l=t,s=i,c=s.flags;switch(s.tag){case 22:Br(l,s),c&2048&&Vh(s.alternate,s);break;case 24:Br(l,s),c&2048&&Fh(s.alternate,s);break;default:Br(l,s)}i=i.sibling}}var En=8192;function Dn(t,i,l){if(t.subtreeFlags&En)for(t=t.child;t!==null;)tp(t,i,l),t=t.sibling}function tp(t,i,l){switch(t.tag){case 26:Dn(t,i,l),t.flags&En&&(t.memoizedState!==null?QS(l,Si,t.memoizedState,t.memoizedProps):(t=t.stateNode,(i&335544128)===i&&sv(l,t)));break;case 5:Dn(t,i,l),t.flags&En&&(t=t.stateNode,(i&335544128)===i&&sv(l,t));break;case 3:case 4:var s=Si;Si=Gr(t.stateNode.containerInfo),Dn(t,i,l),Si=s;break;case 22:t.memoizedState===null&&(s=t.alternate,s!==null&&s.memoizedState!==null?(s=En,En=16777216,Dn(t,i,l),En=s):Dn(t,i,l));break;case 30:if((t.flags&En)!==0&&(s=t.memoizedProps.name,s!=null&&s!=="auto")){var c=t.stateNode;c.paired=null,Ke===null&&(Ke=new Map),Ke.set(s,c)}Dn(t,i,l);break;default:Dn(t,i,l)}}function ep(t){var i=t.alternate;if(i!==null&&(t=i.child,t!==null)){i.child=null;do i=t.sibling,t.sibling=null,t=i;while(t!==null)}}function Lr(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var s=i[l];fe=s,ap(s,t)}ep(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)ip(t),t=t.sibling}function ip(t){switch(t.tag){case 0:case 11:case 15:Lr(t),t.flags&2048&&La(9,t,t.return);break;case 3:Lr(t);break;case 12:Lr(t);break;case 22:var i=t.stateNode;t.memoizedState!==null&&i._visibility&2&&(t.return===null||t.return.tag!==13)?(i._visibility&=-3,Vo(t)):Lr(t);break;default:Lr(t)}}function Vo(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var s=i[l];fe=s,ap(s,t)}ep(t)}for(t=t.child;t!==null;){switch(i=t,i.tag){case 0:case 11:case 15:La(8,i,i.return),Vo(i);break;case 22:l=i.stateNode,l._visibility&2&&(l._visibility&=-3,Vo(i));break;default:Vo(i)}t=t.sibling}}function ap(t,i){for(;fe!==null;){var l=fe;switch(l.tag){case 0:case 11:case 15:La(8,l,i);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var s=l.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:xr(l.memoizedState.cache)}if(s=l.child,s!==null)s.return=l,fe=s;else t:for(l=t;fe!==null;){s=fe;var c=s.sibling,f=s.return;if(P0(s),s===l){fe=null;break t}if(c!==null){c.return=f,fe=c;break t}fe=f}}}var V1={getCacheForType:function(t){var i=pe(ie),l=i.data.get(t);return l===void 0&&(l=t(),i.data.set(t,l)),l},cacheSignal:function(){return pe(ie).controller.signal}},F1=typeof WeakMap=="function"?WeakMap:Map,zt=0,Xt=null,Tt=null,Ot=0,Bt=0,Ie=null,Ya=!1,yl=!1,Gh=!1,ca=0,Zt=0,Ua=0,Mn=0,Fo=0,We=0,bl=0,Hr=null,Ye=null,qh=!1,Go=0,np=0,qo=1/0,Po=null,Xa=null,Kt=0,Ci=null,An=null,Gi=0,Ph=0,Qh=null,lp=null,xl=null,Sl=null,_l=null,Yr=0,Qo=null;function Ze(){return(zt&2)!==0&&Ot!==0?Ot&-Ot:J.T!==null?nf():og()}function rp(){if(We===0)if((Ot&536870912)===0||Ct){var t=Us;Us<<=1,(Us&3932160)===0&&(Us=262144),We=t}else We=536870912;return t=ve.current,t!==null&&(t.flags|=32),We}function Cl(t,i){if(i!=null){var l=t.stateNode,s=l.ref;s===null&&(s=l.ref=Up(ta(t.memoizedProps,l))),Sl===null&&(Sl=[]),Sl.push(i.bind(null,s))}}function Ue(t,i,l){(t===Xt&&(Bt===2||Bt===9)||t.cancelPendingCommit!==null)&&(Tl(t,0),Va(t,Ot,We,!1)),rr(t,l),((zt&2)===0||t!==Xt)&&(t===Xt&&((zt&2)===0&&(Mn|=l),Zt===4&&Va(t,Ot,We,!1)),qi(t))}function sp(t,i,l){if((zt&6)!==0)throw Error(r(327));var s=!l&&(i&127)===0&&(i&t.expiredLanes)===0||lr(t,i),c=s?P1(t,i):Ih(t,i,!0),f=s;do{if(c===0){yl&&!s&&Va(t,i,0,!1);break}else{if(l=t.current.alternate,f&&!G1(l)){c=Ih(t,i,!1),f=!1;continue}if(c===2){if(f=i,t.errorRecoveryDisabledLanes&f)var v=0;else v=t.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){i=v;t:{var x=t;c=Hr;var C=x.current.memoizedState.isDehydrated;if(C&&(Tl(x,v).flags|=256),v=Ih(x,v,!1),v!==2&&v!==6){if(Gh&&!C){x.errorRecoveryDisabledLanes|=f,Mn|=f,c=4;break t}f=Ye,Ye=c,f!==null&&(Ye===null?Ye=f:Ye.push.apply(Ye,f))}c=v}if(f=!1,c!==2)continue}}if(c===1){Tl(t,0),Va(t,i,0,!0);break}t:{switch(s=t,f=c,f){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i&&(i&62914560)!==i)break;case 6:Va(s,i,We,!Ya);break t;case 2:Ye=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(c=Go+300-Ve(),10<c)){if(Va(s,i,We,!Ya),Vs(s,0,!0)!==0)break t;Gi=i,s.timeoutHandle=mf(op.bind(null,s,l,Ye,Po,qh,i,We,Mn,bl,Ya,f,"Throttled",-0,0),c);break t}op(s,l,Ye,Po,qh,i,We,Mn,bl,Ya,f,null,-0,0)}}break}while(!0);qi(t)}function op(t,i,l,s,c,f,v,x,C,j,L,V,M,k){t.timeoutHandle=-1;var Z=i.subtreeFlags,ot=(f&335544064)===f;if(V=null,(ot||Z&8192||(Z&16785408)===16785408)&&(V={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ki},Ke=null,tp(i,f,V),ot&&(Z=V,ot=t.containerInfo,ot=(ot.nodeType===9?ot:ot.ownerDocument).__reactViewTransition,ot!=null&&(Z.count++,Z.waitingForViewTransition=!0,Z=Qr.bind(Z),ot.finished.then(Z,Z))),Z=(f&62914560)===f?Go-Ve():(f&4194048)===f?np-Ve():0,Z=KS(V,Z),Z!==null)){Gi=f,t.cancelPendingCommit=Z(pp.bind(null,t,i,f,l,s,c,v,x,C,j,L,V,null,M,k)),Va(t,f,v,!j);return}pp(t,i,f,l,s,c,v,x,C,j,L,V)}function G1(t){for(var i=t;;){var l=i.tag;if((l===0||l===11||l===15)&&i.flags&16384&&(l=i.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var s=0;s<l.length;s++){var c=l[s],f=c.getSnapshot;c=c.value;try{if(!Pe(f(),c))return!1}catch{return!1}}if(l=i.child,i.subtreeFlags&16384&&l!==null)l.return=i,i=l;else{if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Va(t,i,l,s){i=ag(t,i),i&=~Fo,i&=~Mn,t.suspendedLanes|=i,t.pingedLanes&=~i,s&&(t.warmLanes|=i),s=t.expirationTimes;for(var c=i;0<c;){var f=31-Ge(c),v=1<<f;s[f]=-1,c&=~v}l!==0&&lg(t,l,i)}function Ko(){return(zt&6)===0?(Ur(0),!1):!0}function Kh(){if(Tt!==null){if(Bt===0)var t=Tt.return;else t=Tt,na=vn=null,ih(t),cl=null,Cr=0,t=Tt;for(;t!==null;)j0(t.alternate,t),t=t.return;Tt=null}}function Tl(t,i){var l=t.timeoutHandle;return l!==-1&&(t.timeoutHandle=-1,gS(l)),l=t.cancelPendingCommit,l!==null&&(t.cancelPendingCommit=null,l()),Gi=0,Kh(),Xt=t,Tt=l=ia(t.current,null),Ot=i,Bt=0,Ie=null,Ya=!1,yl=lr(t,i),Gh=!1,bl=We=Fo=Mn=Ua=Zt=0,Ye=Hr=null,qh=!1,ca=ag(t,i),eo(),l}function up(t,i){bt=null,J.H=Eo,i===ul||i===fo?(i=pm(),Bt=3):i===Fc?(i=pm(),Bt=4):Bt=i===vh?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Ie=i,Tt===null&&(Zt=1,Do(t,ui(i,t.current)))}function cp(){var t=ve.current;return t===null?!0:(Ot&4194048)===Ot?Ce===null:(Ot&62914560)===Ot||(Ot&536870912)!==0?t===Ce:!1}function hp(){var t=J.H;return J.H=Eo,t===null?Eo:t}function fp(){var t=J.A;return J.A=V1,t}function Io(){Zt=4,Ya||(Ot&4194048)!==Ot&&ve.current!==null||(yl=!0),(Ua&134217727)===0&&(Mn&134217727)===0||Xt===null||Va(Xt,Ot,We,!1)}function Ih(t,i,l){var s=zt;zt|=2;var c=hp(),f=fp();(Xt!==t||Ot!==i)&&(Po=null,Tl(t,i)),i=!1;var v=Zt;t:do try{if(Bt!==0&&Tt!==null){var x=Tt,C=Ie;switch(Bt){case 8:Kh(),v=6;break t;case 3:case 2:case 9:case 6:ve.current===null&&(i=!0);var j=Bt;if(Bt=0,Ie=null,wl(t,x,C,j),l&&yl){v=0;break t}break;default:j=Bt,Bt=0,Ie=null,wl(t,x,C,j)}}q1(),v=Zt;break}catch(L){up(t,L)}while(!0);return i&&t.shellSuspendCounter++,na=vn=null,zt=s,J.H=c,J.A=f,Tt===null&&(Xt=null,Ot=0,eo()),v}function q1(){for(;Tt!==null;)dp(Tt)}function P1(t,i){var l=zt;zt|=2;var s=hp(),c=fp();Xt!==t||Ot!==i?(Po=null,qo=Ve()+500,Tl(t,i)):yl=lr(t,i);t:do try{if(Bt!==0&&Tt!==null){i=Tt;var f=Ie;e:switch(Bt){case 1:Bt=0,Ie=null,wl(t,i,f,1);break;case 2:case 9:if(gm(f)){Bt=0,Ie=null,gp(i);break}i=function(){Bt!==2&&Bt!==9||Xt!==t||(Bt=7),qi(t)},f.then(i,i);break t;case 3:Bt=7;break t;case 4:Bt=5;break t;case 7:gm(f)?(Bt=0,Ie=null,gp(i)):(Bt=0,Ie=null,wl(t,i,f,7));break;case 5:var v=null;switch(Tt.tag){case 26:v=Tt.memoizedState;case 5:case 27:var x=Tt;if(v?lv(v):x.stateNode.complete){Bt=0,Ie=null;var C=x.sibling;if(C!==null)Tt=C;else{var j=x.return;j!==null?(Tt=j,Wo(j)):Tt=null}break e}}Bt=0,Ie=null,wl(t,i,f,5);break;case 6:Bt=0,Ie=null,wl(t,i,f,6);break;case 8:Kh(),Zt=6;break t;default:throw Error(r(462))}}Q1();break}catch(L){up(t,L)}while(!0);return na=vn=null,J.H=s,J.A=c,zt=l,Tt!==null?0:(Xt=null,Ot=0,eo(),Zt)}function Q1(){for(;Tt!==null&&!cx();)dp(Tt)}function dp(t){var i=M0(t.alternate,t,ca);t.memoizedProps=t.pendingProps,i===null?Wo(t):Tt=i}function gp(t){var i=t,l=i.alternate;switch(i.tag){case 15:case 0:i=_0(l,i,i.pendingProps,i.type,void 0,Ot);break;case 11:i=_0(l,i,i.pendingProps,i.type.render,i.ref,Ot);break;case 5:ih(i);var s=i;s===ce&&(Ct?(so(s),s.tag===5&&s.stateNode!=null&&(qt=s.stateNode)):(so(s),Ct=!0));default:j0(l,i),i=Tt=am(i,ca),i=M0(l,i,ca)}t.memoizedProps=t.pendingProps,i===null?Wo(t):Tt=i}function wl(t,i,l,s){na=vn=null,ih(i),cl=null,Cr=0;var c=i.return;try{if(N1(t,c,i,l,Ot)){Zt=1,Do(t,ui(l,t.current)),Tt=null;return}}catch(f){if(c!==null)throw Tt=c,f;Zt=1,Do(t,ui(l,t.current)),Tt=null;return}i.flags&32768?(Ct||s===1?t=!0:yl||(Ot&536870912)!==0?t=!1:(Ya=t=!0,(s===2||s===9||s===3||s===6)&&(s=ve.current,s!==null&&s.tag===13&&(s.flags|=16384))),mp(i,t)):Wo(i)}function Wo(t){var i=t;do{if((i.flags&32768)!==0){mp(i,Ya);return}t=i.return;var l=H1(i.alternate,i,ca);if(l!==null){Tt=l;return}if(i=i.sibling,i!==null){Tt=i;return}Tt=i=t}while(i!==null);Zt===0&&(Zt=5)}function mp(t,i){do{var l=Y1(t.alternate,t);if(l!==null){l.flags&=32767,Tt=l;return}if(l=t.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!i&&(t=t.sibling,t!==null)){Tt=t;return}Tt=t=l}while(t!==null);Zt=6,Tt=null}function pp(t,i,l,s,c,f,v,x,C,j,L,V){t.cancelPendingCommit=null;do Zo();while(Kt!==0);if((zt&6)!==0)throw Error(r(327));if(i!==null){if(i===t.current)throw Error(r(177));t===Xt&&(Tt=Xt=null,Ot=0),An=i,Ci=t,Gi=l,Qh=c,lp=s,K1(t,i,l,v,x,C,V)}}function K1(t,i,l,s,c,f,v){var x=i.lanes|i.childLanes;if(Ph=x,x|=Ac,xx(t,l,x,s,c,f),Sl=null,(l&335544064)===l?(_l=_1(t),s=10262):(_l=null,s=10256),(i.subtreeFlags&s)!==0||(i.flags&s)!==0?(t.callbackNode=null,t.callbackPriority=0,tS(Hs,function(){return Jh(),null})):(t.callbackNode=null,t.callbackPriority=0),Bo=!1,s=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||s){s=J.T,J.T=null,c=ft.p,ft.p=2,f=zt,zt|=4;try{U1(t,i,l)}finally{zt=f,ft.p=c,J.T=s}}Kt=1,Bo?xl=xS(v,t.containerInfo,_l,Wh,Zh,W1,$h,Jh,I1):(Wh(),Zh(),$h())}function I1(t){if(Kt!==0){var i=Ci.onRecoverableError;i(t,{componentStack:null})}}function W1(){Kt===3&&(Kt=0,$0(An,Ci),Kt=4)}function Wh(){if(Kt===1){Kt=0;var t=Ci,i=An,l=Gi,s=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||s){s=J.T,J.T=null;var c=ft.p;ft.p=2;var f=zt;zt|=4;try{kr=Yo=!1,W0(i,t,l),l=ff;var v=Qg(t.containerInfo),x=l.focusedElem,C=l.selectionRange;if(v!==x&&x&&x.ownerDocument&&Pg(x.ownerDocument.documentElement,x)){if(C!==null&&wc(x)){var j=C.start,L=C.end;if(L===void 0&&(L=j),"selectionStart"in x)x.selectionStart=j,x.selectionEnd=Math.min(L,x.value.length);else{var V=x.ownerDocument||document,M=V&&V.defaultView||window;if(M.getSelection){var k=M.getSelection(),Z=x.textContent.length,ot=Math.min(C.start,Z),xt=C.end===void 0?ot:Math.min(C.end,Z);!k.extend&&ot>xt&&(v=xt,xt=ot,ot=v);var A=qg(x,ot),O=qg(x,xt);if(A&&O&&(k.rangeCount!==1||k.anchorNode!==A.node||k.anchorOffset!==A.offset||k.focusNode!==O.node||k.focusOffset!==O.offset)){var z=V.createRange();z.setStart(A.node,A.offset),k.removeAllRanges(),ot>xt?(k.addRange(z),k.extend(O.node,O.offset)):(z.setEnd(O.node,O.offset),k.addRange(z))}}}}for(V=[],k=x;k=k.parentNode;)k.nodeType===1&&V.push({element:k,left:k.scrollLeft,top:k.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<V.length;x++){var U=V[x];U.element.scrollLeft=U.left,U.element.scrollTop=U.top}}zl=!!hf,ff=hf=null}finally{zt=f,ft.p=c,J.T=s}}t.current=i,Kt=2}}function Zh(){if(Kt===2){Kt=0;var t=Ci,i=An,l=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||l){l=J.T,J.T=null;var s=ft.p;ft.p=2;var c=zt;zt|=4;try{G0(t,i.alternate,i)}finally{zt=c,ft.p=s,J.T=l}}Kt=3}}function $h(){if(Kt===4||Kt===3){Kt=0;var t=xl;xl=null,hx();var i=Ci,l=An,s=Gi,c=lp,f=(s&335544064)===s?10262:10256;if((l.subtreeFlags&f)!==0||(l.flags&f)!==0?Kt=5:(Kt=0,An=Ci=null,vp(i,i.pendingLanes)),f=i.pendingLanes,f===0&&(Xa=null),sc(s),l=l.stateNode,Fe&&typeof Fe.onCommitFiberRoot=="function")try{Fe.onCommitFiberRoot(nr,l,void 0,(l.current.flags&128)===128)}catch{}if(c!==null){l=J.T,f=ft.p,ft.p=2,J.T=null;try{for(var v=i.onRecoverableError,x=0;x<c.length;x++){var C=c[x];v(C.value,{componentStack:C.stack})}}finally{J.T=l,ft.p=f}}if(c=Sl,v=_l,_l=null,c!==null&&(Sl=null,v===null&&(v=[]),t!==null))for(C=0;C<c.length;C++)l=(0,c[C])(v),l!==void 0&&t.finished.finally(l);(Gi&3)!==0&&Zo(),qi(i),f=i.pendingLanes,(s&261930)!==0&&(f&42)!==0?i===Qo?Yr++:(Yr=0,Qo=i):(Yr=0,Qo=null),Ur(0)}}function vp(t,i){(t.pooledCacheLanes&=i)===0&&(i=t.pooledCache,i!=null&&(t.pooledCache=null,xr(i)))}function Zo(){return xl!==null&&(xl.skipTransition(),xl=null),Wh(),Zh(),$h(),Jh()}function Jh(){if(Kt!==5)return!1;var t=Ci,i=Ph;Ph=0;var l=sc(Gi),s=J.T,c=ft.p;try{ft.p=32>l?32:l,J.T=null,l=Qh,Qh=null;var f=Ci,v=Gi;if(Kt=0,An=Ci=null,Gi=0,(zt&6)!==0)throw Error(r(331));var x=zt;if(zt|=4,ip(f.current),J0(f,f.current,v,l),zt=x,Ur(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(nr,f)}catch{}return!0}finally{ft.p=c,J.T=s,vp(t,i)}}function yp(t,i,l){i=ui(l,i),i=ph(t.stateNode,i,2),t=za(t,i,2),t!==null&&(rr(t,2),qi(t))}function Lt(t,i,l){if(t.tag===3)yp(t,t,l);else for(;i!==null;){if(i.tag===3){yp(i,t,l);break}else if(i.tag===1){var s=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Xa===null||!Xa.has(s))){t=ui(l,t),l=g0(2),s=za(i,l,2),s!==null&&(m0(l,s,i,t),rr(s,2),qi(s));break}}i=i.return}}function tf(t,i,l){var s=t.pingCache;if(s===null){s=t.pingCache=new F1;var c=new Set;s.set(i,c)}else c=s.get(i),c===void 0&&(c=new Set,s.set(i,c));c.has(l)||(Gh=!0,c.add(l),t=Z1.bind(null,t,i,l),i.then(t,t))}function Z1(t,i,l){var s=t.pingCache;s!==null&&s.delete(i),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,Xt===t&&(Ot&l)===l&&((Zt===4||Zt===3&&(Ot&62914560)===Ot&&300>Ve()-Go)&&(zt&2)===0?Tl(t,0):Fo|=l,bl===Ot&&(bl=0)),qi(t)}function bp(t,i){i===0&&(i=ng()),t=gn(t,i),t!==null&&(rr(t,i),qi(t))}function $1(t){var i=t.memoizedState,l=0;i!==null&&(l=i.retryLane),bp(t,l)}function J1(t,i){var l=0;switch(t.tag){case 31:case 13:var s=t.stateNode,c=t.memoizedState;c!==null&&(l=c.retryLane);break;case 19:s=t.stateNode;break;case 22:s=t.stateNode._retryCache;break;default:throw Error(r(314))}s!==null&&s.delete(i),bp(t,l)}function tS(t,i){return ac(t,i)}var Ol=null,El=null,ef=!1,$o=!1,af=!1,Fa=0;function qi(t){t!==El&&t.next===null&&(El===null?Ol=El=t:El=El.next=t),$o=!0,ef||(ef=!0,iS())}function Ur(t,i){if(!af&&$o){af=!0;do for(var l=!1,s=Ol;s!==null;){if(t!==0){var c=s.pendingLanes;if(c===0)var f=0;else{var v=s.suspendedLanes,x=s.pingedLanes;f=(1<<31-Ge(42|t)+1)-1,f&=c&~(v&~x),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(l=!0,Cp(s,f))}else f=Ot,f=Vs(s,s===Xt?f:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(f&3)===0||lr(s,f)||(l=!0,Cp(s,f));s=s.next}while(l);af=!1}}function eS(){xp()}function xp(){$o=ef=!1;var t=0;Fa!==0&&dS()&&(t=Fa);for(var i=Ve(),l=null,s=Ol;s!==null;){var c=s.next,f=Sp(s,i);f===0?(s.next=null,l===null?Ol=c:l.next=c,c===null&&(El=l)):(l=s,(t!==0||(f&3)!==0)&&($o=!0)),s=c}Kt!==0&&Kt!==5||Ur(t),Fa!==0&&(Fa=0)}function Sp(t,i){for(var l=t.suspendedLanes,s=t.pingedLanes,c=t.expirationTimes,f=t.pendingLanes&-62914561;0<f;){var v=31-Ge(f),x=1<<v,C=c[v];C===-1?((x&l)===0||(x&s)!==0)&&(c[v]=bx(x,i)):C<=i&&(t.expiredLanes|=x),f&=~x}if(i=Xt,l=Ot,l=Vs(t,t===i?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),s=t.callbackNode,l===0||t===i&&(Bt===2||Bt===9)||t.cancelPendingCommit!==null)return s!==null&&s!==null&&nc(s),t.callbackNode=null,t.callbackPriority=0;if((l&3)===0||lr(t,l)){if(i=l&-l,i===t.callbackPriority)return i;switch(s!==null&&nc(s),sc(l)){case 2:case 8:l=eg;break;case 32:l=Hs;break;case 268435456:l=ig;break;default:l=Hs}return s=_p.bind(null,t),l=ac(l,s),t.callbackPriority=i,t.callbackNode=l,i}return s!==null&&s!==null&&nc(s),t.callbackPriority=2,t.callbackNode=null,2}function _p(t,i){if(Kt!==0&&Kt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var l=t.callbackNode;if(Zo()&&t.callbackNode!==l)return null;var s=Ot;return s=Vs(t,t===Xt?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),s===0?null:(sp(t,s,i),Sp(t,Ve()),t.callbackNode!=null&&t.callbackNode===l?_p.bind(null,t):null)}function Cp(t,i){if(Zo())return null;sp(t,i,!0)}function iS(){mS(function(){(zt&6)!==0?ac(tg,eS):xp()})}function nf(){if(Fa===0){var t=xn;t===0&&(t=Ys,Ys<<=1,(Ys&261888)===0&&(Ys=256)),Fa=t}return Fa}function Tp(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Qs(t)}function aS(t,i,l,s,c){if(i==="submit"&&l&&l.stateNode===c){var f=Tp((c[ke]||null).action),v=s.submitter;v&&(i=(i=v[ke]||null)?Tp(i.formAction):v.getAttribute("formAction"),i!==null&&(f=i,v=null));var x=new Zs("action","action",null,s,c);t.push({event:x,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Fa!==0){var C=new FormData(c,v);hh(l,{pending:!0,data:C,method:c.method,action:f},null,C)}}else typeof f=="function"&&(x.preventDefault(),C=new FormData(c,v),hh(l,{pending:!0,data:C,method:c.method,action:f},f,C))},currentTarget:c}]})}}for(var lf=0;lf<Mc.length;lf++){var rf=Mc[lf],nS=rf.toLowerCase(),lS=rf[0].toUpperCase()+rf.slice(1);bi(nS,"on"+lS)}bi(Wg,"onAnimationEnd"),bi(Zg,"onAnimationIteration"),bi($g,"onAnimationStart"),bi("dblclick","onDoubleClick"),bi("focusin","onFocus"),bi("focusout","onBlur"),bi(g1,"onTransitionRun"),bi(m1,"onTransitionStart"),bi(p1,"onTransitionCancel"),bi(Jg,"onTransitionEnd"),In("onMouseEnter",["mouseout","mouseover"]),In("onMouseLeave",["mouseout","mouseover"]),In("onPointerEnter",["pointerout","pointerover"]),In("onPointerLeave",["pointerout","pointerover"]),hn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),hn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),hn("onBeforeInput",["compositionend","keypress","textInput","paste"]),hn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),hn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),hn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),rS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xr));function wp(t,i){i=(i&4)!==0;for(var l=0;l<t.length;l++){var s=t[l],c=s.event;s=s.listeners;t:{var f=void 0;if(i)for(var v=s.length-1;0<=v;v--){var x=s[v],C=x.instance,j=x.currentTarget;if(x=x.listener,C!==f&&c.isPropagationStopped())break t;f=x,c.currentTarget=j;try{f(c)}catch(L){to(L)}c.currentTarget=null,f=C}else for(v=0;v<s.length;v++){if(x=s[v],C=x.instance,j=x.currentTarget,x=x.listener,C!==f&&c.isPropagationStopped())break t;f=x,c.currentTarget=j;try{f(c)}catch(L){to(L)}c.currentTarget=null,f=C}}}}function wt(t,i){var l=i[cg];l===void 0&&(l=i[cg]=new Set);var s=t+"__bubble";l.has(s)||(Op(i,t,2,!1),l.add(s))}function sf(t,i,l){var s=0;i&&(s|=4),Op(l,t,s,i)}var Jo="_reactListening"+Math.random().toString(36).slice(2);function of(t){if(!t[Jo]){t[Jo]=!0,dg.forEach(function(l){l!=="selectionchange"&&(rS.has(l)||sf(l,!1,t),sf(l,!0,t))});var i=t.nodeType===9?t:t.ownerDocument;i===null||i[Jo]||(i[Jo]=!0,sf("selectionchange",!1,i))}}function Op(t,i,l,s){switch(mv(i)){case 2:var c=$S;break;case 8:c=JS;break;default:c=Df}l=c.bind(null,i,l,t),c=void 0,!mc||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(c=!0),s?c!==void 0?t.addEventListener(i,l,{capture:!0,passive:c}):t.addEventListener(i,l,!0):c!==void 0?t.addEventListener(i,l,{passive:c}):t.addEventListener(i,l,!1)}function uf(t,i,l,s,c){var f=s;if((i&1)===0&&(i&2)===0&&s!==null)t:for(;;){if(s===null)return;var v=s.tag;if(v===3||v===4){var x=s.stateNode.containerInfo;if(x===c)break;if(v===4)for(v=s.return;v!==null;){var C=v.tag;if((C===3||C===4)&&v.stateNode.containerInfo===c)return;v=v.return}for(;x!==null;){if(v=cn(x),v===null)return;if(C=v.tag,C===5||C===6||C===26||C===27){s=f=v;continue t}x=x.parentNode}}s=s.return}Og(function(){var j=f,L=dc(l),V=[];t:{var M=tm.get(t);if(M!==void 0){var k=Zs,Z=t;switch(t){case"keypress":if(Is(l)===0)break t;case"keydown":case"keyup":k=Gx;break;case"focusin":Z="focus",k=bc;break;case"focusout":Z="blur",k=bc;break;case"beforeblur":case"afterblur":k=bc;break;case"click":if(l.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":k=Mg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":k=Rx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":k=Ix;break;case Wg:case Zg:case $g:k=kx;break;case Jg:k=Zx;break;case"scroll":case"scrollend":k=Ax;break;case"wheel":k=Jx;break;case"copy":case"cut":case"paste":k=Lx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":k=jg;break;case"submit":k=Qx;break;case"toggle":case"beforetoggle":k=e1}var ot=(i&4)!==0,xt=!ot&&(t==="scroll"||t==="scrollend"),A=ot?M!==null?M+"Capture":null:M;ot=[];for(var O=j,z;O!==null;){var U=O;if(z=U.stateNode,U=U.tag,U!==5&&U!==26&&U!==27||z===null||A===null||(U=ur(O,A),U!=null&&ot.push(Vr(O,U,z))),xt)break;O=O.return}0<ot.length&&(M=new k(M,Z,null,l,L),V.push({event:M,listeners:ot}))}}if((i&7)===0){t:{if(k=t==="mouseover"||t==="pointerover",M=t==="mouseout"||t==="pointerout",k&&l!==fc&&(Z=l.relatedTarget||l.fromElement)&&(cn(Z)||Z[Pn]))break t;(M||k)&&(Z=L.window===L?L:(k=L.ownerDocument)?k.defaultView||k.parentWindow:window,M?(k=l.relatedTarget||l.toElement,M=j,k=k?cn(k):null,k!==null&&(xt=u(k),ot=k.tag,k!==xt||ot!==5&&ot!==27&&ot!==6)&&(k=null)):(M=null,k=j),M!==k&&(ot=Mg,U="onMouseLeave",A="onMouseEnter",O="mouse",(t==="pointerout"||t==="pointerover")&&(ot=jg,U="onPointerLeave",A="onPointerEnter",O="pointer"),xt=M==null?Z:or(M),z=k==null?Z:or(k),Z=new ot(U,O+"leave",M,l,L),Z.target=xt,Z.relatedTarget=z,U=null,cn(L)===j&&(ot=new ot(A,O+"enter",k,l,L),ot.target=z,ot.relatedTarget=xt,U=ot),xt=U,ot=M&&k?$(M,k,sS):null,M!==null&&Ep(V,Z,M,ot,!1),k!==null&&xt!==null&&Ep(V,xt,k,ot,!0)))}t:{if(M=j?or(j):window,k=M.nodeName&&M.nodeName.toLowerCase(),k==="select"||k==="input"&&M.type==="file")var et=Yg;else if(Lg(M))if(Ug)et=h1;else{et=u1;var Et=o1}else k=M.nodeName,!k||k.toLowerCase()!=="input"||M.type!=="checkbox"&&M.type!=="radio"?j&&hc(j.elementType)&&(et=Yg):et=c1;if(et&&(et=et(t,j))){Hg(V,et,l,L);break t}Et&&Et(t,M,j)}switch(Et=j?or(j):window,t){case"focusin":(Lg(Et)||Et.contentEditable==="true")&&(el=Et,Oc=j,vr=null);break;case"focusout":vr=Oc=el=null;break;case"mousedown":Ec=!0;break;case"contextmenu":case"mouseup":case"dragend":Ec=!1,Kg(V,l,L);break;case"selectionchange":if(d1)break;case"keydown":case"keyup":Kg(V,l,L)}var ht;if(Sc)t:{switch(t){case"compositionstart":var gt="onCompositionStart";break t;case"compositionend":gt="onCompositionEnd";break t;case"compositionupdate":gt="onCompositionUpdate";break t}gt=void 0}else tl?kg(t,l)&&(gt="onCompositionEnd"):t==="keydown"&&l.keyCode===229&&(gt="onCompositionStart");gt&&(Rg&&l.locale!=="ko"&&(tl||gt!=="onCompositionStart"?gt==="onCompositionEnd"&&tl&&(ht=Eg()):(Ta=L,pc="value"in Ta?Ta.value:Ta.textContent,tl=!0)),Et=tu(j,gt),0<Et.length&&(gt=new Ag(gt,t,null,l,L),V.push({event:gt,listeners:Et}),ht?gt.data=ht:(ht=Bg(l),ht!==null&&(gt.data=ht)))),(ht=a1?n1(t,l):l1(t,l))&&(gt=tu(j,"onBeforeInput"),0<gt.length&&(Et=new Ag("onBeforeInput","beforeinput",null,l,L),V.push({event:Et,listeners:gt}),Et.data=ht)),aS(V,t,j,l,L)}wp(V,i)})}function Vr(t,i,l){return{instance:t,listener:i,currentTarget:l}}function tu(t,i){for(var l=i+"Capture",s=[];t!==null;){var c=t,f=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||f===null||(c=ur(t,l),c!=null&&s.unshift(Vr(t,c,f)),c=ur(t,i),c!=null&&s.push(Vr(t,c,f))),t.tag===3)return s;t=t.return}return[]}function sS(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Ep(t,i,l,s,c){for(var f=i._reactName,v=[];l!==null&&l!==s;){var x=l,C=x.alternate,j=x.stateNode;if(x=x.tag,C!==null&&C===s)break;x!==5&&x!==26&&x!==27||j===null||(C=j,c?(j=ur(l,f),j!=null&&v.unshift(Vr(l,j,C))):c||(j=ur(l,f),j!=null&&v.push(Vr(l,j,C)))),l=l.return}v.length!==0&&t.push({event:i,listeners:v})}var oS=/\r\n?/g,uS=/\u0000|\uFFFD/g;function Dp(t){return(typeof t=="string"?t:""+t).replace(oS,`
|
|
9
|
+
`).replace(uS,"")}function Mp(t,i){return i=Dp(i),Dp(t)===i}function Ht(t,i,l,s,c,f){switch(l){case"children":if(typeof s=="string")i==="body"||i==="textarea"&&s===""||Zn(t,s);else if(typeof s=="number"||typeof s=="bigint")i!=="body"&&Zn(t,""+s);else return;break;case"className":Ps(t,"class",s);break;case"tabIndex":Ps(t,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Ps(t,l,s);break;case"style":Tg(t,s,f);return;case"data":if(i!=="object"){Ps(t,"data",s);break}case"src":case"href":if(s===""&&(i!=="a"||l!=="href")){t.removeAttribute(l);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){t.removeAttribute(l);break}s=Qs(s),t.setAttribute(l,s);break;case"action":case"formAction":if(typeof s=="function"){t.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(l==="formAction"?(i!=="input"&&Ht(t,i,"name",c.name,c,null),Ht(t,i,"formEncType",c.formEncType,c,null),Ht(t,i,"formMethod",c.formMethod,c,null),Ht(t,i,"formTarget",c.formTarget,c,null)):(Ht(t,i,"encType",c.encType,c,null),Ht(t,i,"method",c.method,c,null),Ht(t,i,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){t.removeAttribute(l);break}s=Qs(s),t.setAttribute(l,s);break;case"onClick":s!=null&&(t.onclick=ki);return;case"onScroll":s!=null&&wt("scroll",t);return;case"onScrollEnd":s!=null&&wt("scrollend",t);return;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(r(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(r(60));f?.__html!==l&&(t.innerHTML=l)}}break;case"multiple":t.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":t.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){t.removeAttribute("xlink:href");break}l=Qs(s),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?t.setAttribute(l,s):t.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?t.setAttribute(l,""):t.removeAttribute(l);break;case"capture":case"download":s===!0?t.setAttribute(l,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?t.setAttribute(l,s):t.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?t.setAttribute(l,s):t.removeAttribute(l);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?t.removeAttribute(l):t.setAttribute(l,s);break;case"popover":wt("beforetoggle",t),wt("toggle",t),qs(t,"popover",s);break;case"xlinkActuate":$i(t,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":$i(t,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":$i(t,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":$i(t,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":$i(t,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":$i(t,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":$i(t,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":$i(t,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":$i(t,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":qs(t,"is",s);break;case"innerText":case"textContent":return;default:if(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")l=Dx.get(l)||l,qs(t,l,s);else return}Rt=!0}function cf(t,i,l,s,c,f){switch(l){case"style":Tg(t,s,f);return;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(r(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(r(60));f?.__html!==l&&(t.innerHTML=l)}}break;case"children":if(typeof s=="string")Zn(t,s);else if(typeof s=="number"||typeof s=="bigint")Zn(t,""+s);else return;break;case"onScroll":s!=null&&wt("scroll",t);return;case"onScrollEnd":s!=null&&wt("scrollend",t);return;case"onClick":s!=null&&(t.onclick=ki);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!gg.hasOwnProperty(l))t:{if(l[0]==="o"&&l[1]==="n"&&(c=l.endsWith("Capture"),f=l.slice(2,c?l.length-7:void 0),i=t[ke]||null,i=i!=null?i[l]:null,typeof i=="function"&&t.removeEventListener(f,i,c),typeof s=="function")){typeof i!="function"&&i!==null&&(l in t?t[l]=null:t.hasAttribute(l)&&t.removeAttribute(l)),t.addEventListener(f,s,c);break t}Rt=!0,l in t?t[l]=s:s===!0?t.setAttribute(l,""):qs(t,l,s)}return}Rt=!0}function xe(t,i,l){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":wt("error",t),wt("load",t);var s=!1,c=!1,f;for(f in l)if(l.hasOwnProperty(f)){var v=l[f];if(v!=null)switch(f){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:Ht(t,i,f,v,l,null)}}c&&Ht(t,i,"srcSet",l.srcSet,l,null),s&&Ht(t,i,"src",l.src,l,null);return;case"input":wt("invalid",t);var x=f=v=c=null,C=null,j=null;for(s in l)if(l.hasOwnProperty(s)){var L=l[s];if(L!=null)switch(s){case"name":c=L;break;case"type":v=L;break;case"checked":C=L;break;case"defaultChecked":j=L;break;case"value":f=L;break;case"defaultValue":x=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(r(137,i));break;default:Ht(t,i,s,L,l,null)}}xg(t,f,x,C,j,v,c,!1);return;case"select":wt("invalid",t),s=v=f=null;for(c in l)if(l.hasOwnProperty(c)&&(x=l[c],x!=null))switch(c){case"value":f=x;break;case"defaultValue":v=x;break;case"multiple":s=x;default:Ht(t,i,c,x,l,null)}i=f,l=v,t.multiple=!!s,i!=null?Wn(t,!!s,i,!1):l!=null&&Wn(t,!!s,l,!0);return;case"textarea":wt("invalid",t),f=c=s=null;for(v in l)if(l.hasOwnProperty(v)&&(x=l[v],x!=null))switch(v){case"value":s=x;break;case"defaultValue":c=x;break;case"children":f=x;break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:Ht(t,i,v,x,l,null)}_g(t,s,c,f);return;case"option":for(C in l)l.hasOwnProperty(C)&&(s=l[C],s!=null)&&(C==="selected"?t.selected=s&&typeof s!="function"&&typeof s!="symbol":Ht(t,i,C,s,l,null));return;case"dialog":wt("beforetoggle",t),wt("toggle",t),wt("cancel",t),wt("close",t);break;case"iframe":case"object":wt("load",t);break;case"video":case"audio":for(s=0;s<Xr.length;s++)wt(Xr[s],t);break;case"image":wt("error",t),wt("load",t);break;case"details":wt("toggle",t);break;case"embed":case"source":case"link":wt("error",t),wt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(j in l)if(l.hasOwnProperty(j)&&(s=l[j],s!=null))switch(j){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:Ht(t,i,j,s,l,null)}return;default:if(hc(i)){for(L in l)l.hasOwnProperty(L)&&(s=l[L],s!==void 0&&cf(t,i,L,s,l,void 0));return}}for(x in l)l.hasOwnProperty(x)&&(s=l[x],s!=null&&Ht(t,i,x,s,l,null))}var cS={};function hS(t,i,l,s){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,f=null,v=null,x=null,C=null,j=null,L=null;for(k in l){var V=l[k];if(l.hasOwnProperty(k)&&V!=null)switch(k){case"checked":break;case"value":break;case"defaultValue":C=V;default:s.hasOwnProperty(k)||Ht(t,i,k,null,s,V)}}for(var M in s){var k=s[M];if(V=l[M],s.hasOwnProperty(M)&&(k!=null||V!=null))switch(M){case"type":k!==V&&(Rt=!0),f=k;break;case"name":k!==V&&(Rt=!0),c=k;break;case"checked":k!==V&&(Rt=!0),j=k;break;case"defaultChecked":k!==V&&(Rt=!0),L=k;break;case"value":k!==V&&(Rt=!0),v=k;break;case"defaultValue":k!==V&&(Rt=!0),x=k;break;case"children":case"dangerouslySetInnerHTML":if(k!=null)throw Error(r(137,i));break;default:k!==V&&Ht(t,i,M,k,s,V)}}uc(t,v,x,C,j,L,f,c);return;case"select":k=v=x=M=null;for(f in l)if(C=l[f],l.hasOwnProperty(f)&&C!=null)switch(f){case"value":break;case"multiple":k=C;default:s.hasOwnProperty(f)||Ht(t,i,f,null,s,C)}for(c in s)if(f=s[c],C=l[c],s.hasOwnProperty(c)&&(f!=null||C!=null))switch(c){case"value":f!==C&&(Rt=!0),M=f;break;case"defaultValue":f!==C&&(Rt=!0),x=f;break;case"multiple":f!==C&&(Rt=!0),v=f;default:f!==C&&Ht(t,i,c,f,s,C)}i=x,l=v,s=k,M!=null?Wn(t,!!l,M,!1):!!s!=!!l&&(i!=null?Wn(t,!!l,i,!0):Wn(t,!!l,l?[]:"",!1));return;case"textarea":k=M=null;for(x in l)if(c=l[x],l.hasOwnProperty(x)&&c!=null&&!s.hasOwnProperty(x))switch(x){case"value":break;case"children":break;default:Ht(t,i,x,null,s,c)}for(v in s)if(c=s[v],f=l[v],s.hasOwnProperty(v)&&(c!=null||f!=null))switch(v){case"value":c!==f&&(Rt=!0),M=c;break;case"defaultValue":c!==f&&(Rt=!0),k=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(r(91));break;default:c!==f&&Ht(t,i,v,c,s,f)}Sg(t,M,k);return;case"option":for(var Z in l)M=l[Z],l.hasOwnProperty(Z)&&M!=null&&!s.hasOwnProperty(Z)&&(Z==="selected"?t.selected=!1:Ht(t,i,Z,null,s,M));for(C in s)M=s[C],k=l[C],s.hasOwnProperty(C)&&M!==k&&(M!=null||k!=null)&&(C==="selected"?(M!==k&&(Rt=!0),t.selected=M&&typeof M!="function"&&typeof M!="symbol"):Ht(t,i,C,M,s,k));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ot in l)M=l[ot],l.hasOwnProperty(ot)&&M!=null&&!s.hasOwnProperty(ot)&&Ht(t,i,ot,null,s,M);for(j in s)if(M=s[j],k=l[j],s.hasOwnProperty(j)&&M!==k&&(M!=null||k!=null))switch(j){case"children":case"dangerouslySetInnerHTML":if(M!=null)throw Error(r(137,i));break;default:Ht(t,i,j,M,s,k)}return;default:if(hc(i)){for(var xt in l)M=l[xt],l.hasOwnProperty(xt)&&M!==void 0&&!s.hasOwnProperty(xt)&&cf(t,i,xt,void 0,s,M);for(L in s)M=s[L],k=l[L],!s.hasOwnProperty(L)||M===k||M===void 0&&k===void 0||cf(t,i,L,M,s,k);return}}for(var A in l)M=l[A],l.hasOwnProperty(A)&&M!=null&&!s.hasOwnProperty(A)&&Ht(t,i,A,null,s,M);for(V in s)M=s[V],k=l[V],!s.hasOwnProperty(V)||M===k||M==null&&k==null||Ht(t,i,V,M,s,k)}function Ap(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function fS(){if(typeof performance.getEntriesByType=="function"){for(var t=0,i=0,l=performance.getEntriesByType("resource"),s=0;s<l.length;s++){var c=l[s],f=c.transferSize,v=c.initiatorType,x=c.duration;if(f&&x&&Ap(v)){for(v=0,x=c.responseEnd,s+=1;s<l.length;s++){var C=l[s],j=C.startTime;if(j>x)break;var L=C.transferSize,V=C.initiatorType;L&&Ap(V)&&(C=C.responseEnd,v+=L*(C<x?1:(x-j)/(C-j)))}if(--s,i+=8*(f+v)/(c.duration/1e3),t++,10<t)break}}if(0<t)return i/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var hf=null,ff=null;function Fr(t){return t.nodeType===9?t:t.ownerDocument}function jp(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Rp(t,i){if(t===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&i==="foreignObject"?0:t}function zp(t,i,l,s){return l=Fr(l).createElement(t),l[me]=s,l[ke]=i,xe(l,t,i),ue(l),l}function df(t,i){return t==="textarea"||t==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var gf=null;function dS(){var t=window.event;return t&&t.type==="popstate"?t===gf?!1:(gf=t,!0):(gf=null,!1)}var mf=typeof setTimeout=="function"?setTimeout:void 0,gS=typeof clearTimeout=="function"?clearTimeout:void 0,Np=typeof Promise=="function"?Promise:void 0,kp=typeof requestAnimationFrame=="function"?requestAnimationFrame:mf,mS=typeof queueMicrotask=="function"?queueMicrotask:typeof Np<"u"?function(t){return Np.resolve(null).then(t).catch(pS)}:mf;function pS(t){setTimeout(function(){throw t})}function Ga(t){return t==="head"}function Bp(t,i){var l=i,s=0;do{var c=l.nextSibling;if(t.removeChild(l),c&&c.nodeType===8)if(l=c.data,l==="/$"||l==="/&"){if(s===0){t.removeChild(c),Nl(i);return}s--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")s++;else if(l==="html")Cf(t.ownerDocument.documentElement);else if(l==="head"){l=t.ownerDocument.head,Cf(l);for(var f=l.firstChild;f;){var v=f.nextSibling,x=f.nodeName;f[sr]||x==="SCRIPT"||x==="STYLE"||x==="LINK"&&f.rel.toLowerCase()==="stylesheet"||l.removeChild(f),f=v}}else l==="body"&&Cf(t.ownerDocument.body);l=c}while(l);Nl(i)}function Lp(t,i){var l=t;t=0;do{var s=l.nextSibling;if(l.nodeType===1?i?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(i?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),s&&s.nodeType===8)if(l=s.data,l==="/$"){if(t===0)break;t--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||t++;l=s}while(l)}function Hp(t,i,l){if(i=CSS.escape(i)!==i?"r-"+btoa(i).replace(/=/g,""):i,t.style.viewTransitionName=i,l!=null&&(t.style.viewTransitionClass=l),l=getComputedStyle(t),l.display==="inline"){if(i=t.getClientRects(),i.length===1)var s=1;else for(var c=s=0;c<i.length;c++){var f=i[c];0<f.width&&0<f.height&&s++}s===1&&(t=t.style,t.display=i.length===1?"inline-block":"block",t.marginTop="-"+l.paddingTop,t.marginBottom="-"+l.paddingBottom)}}function Yp(t,i){t=t.style,i=i.style;var l=i!=null?i.hasOwnProperty("viewTransitionName")?i.viewTransitionName:i.hasOwnProperty("view-transition-name")?i["view-transition-name"]:null:null;t.viewTransitionName=l==null||typeof l=="boolean"?"":(""+l).trim(),l=i!=null?i.hasOwnProperty("viewTransitionClass")?i.viewTransitionClass:i.hasOwnProperty("view-transition-class")?i["view-transition-class"]:null:null,t.viewTransitionClass=l==null||typeof l=="boolean"?"":(""+l).trim(),t.display==="inline-block"&&(i==null?t.display=t.margin="":(l=i.display,t.display=l==null||typeof l=="boolean"?"":l,l=i.margin,l!=null?t.margin=l:(l=i.hasOwnProperty("marginTop")?i.marginTop:i["margin-top"],t.marginTop=l==null||typeof l=="boolean"?"":l,i=i.hasOwnProperty("marginBottom")?i.marginBottom:i["margin-bottom"],t.marginBottom=i==null||typeof i=="boolean"?"":i)))}function vS(t,i,l){return l=l.ownerDocument.defaultView,{rect:t,abs:i.position==="absolute"||i.position==="fixed",clip:i.clipPath!=="none"||i.overflow!=="visible"||i.filter!=="none"||i.mask!=="none"||i.mask!=="none"||i.borderRadius!=="0px",view:0<=t.bottom&&0<=t.right&&t.top<=l.innerHeight&&t.left<=l.innerWidth}}function pf(t){var i=t.getBoundingClientRect(),l=getComputedStyle(t);return vS(i,l,t)}function yS(t){return t.documentElement.clientHeight}function bS(t){this.addEventListener("load",t),this.addEventListener("error",t)}function xS(t,i,l,s,c,f,v,x,C){var j=i.nodeType===9?i:i.ownerDocument;try{var L=j.startViewTransition({update:function(){var M=j.defaultView,k=M.navigation&&M.navigation.transition,Z=j.fonts.status;s();var ot=[];if(Z==="loaded"&&(yS(j),j.fonts.status==="loading"&&ot.push(j.fonts.ready)),Z=ot.length,t!==null)for(var xt=t.suspenseyImages,A=0,O=0;O<xt.length;O++){var z=xt[O];if(!z.complete){var U=z.getBoundingClientRect();if(0<U.bottom&&0<U.right&&U.top<M.innerHeight&&U.left<M.innerWidth){if(A+=rv(z),A>au){ot.length=Z;break}z=new Promise(bS.bind(z)),ot.push(z)}}}if(0<ot.length)return M=Promise.race([Promise.all(ot),new Promise(function(et){return setTimeout(et,500)})]).then(c,c),(k?Promise.allSettled([k.finished,M]):M).then(f,f);if(c(),k)return k.finished.then(f,f);f()},types:l});j.__reactViewTransition=L;var V=[];return L.ready.then(function(){for(var M=j.documentElement.getAnimations({subtree:!0}),k=0;k<M.length;k++){var Z=M[k],ot=Z.effect,xt=ot.pseudoElement;if(xt!=null&&xt.startsWith("::view-transition")){V.push(Z),Z=ot.getKeyframes();for(var A=xt=void 0,O=!0,z=0;z<Z.length;z++){var U=Z[z],et=U.width;if(xt===void 0)xt=et;else if(xt!==et){O=!1;break}if(et=U.height,A===void 0)A=et;else if(A!==et){O=!1;break}delete U.width,delete U.height,U.transform==="none"&&delete U.transform}O&&xt!==void 0&&A!==void 0&&(ot.setKeyframes(Z),O=getComputedStyle(ot.target,ot.pseudoElement),O.width!==xt||O.height!==A)&&(O=Z[0],O.width=xt,O.height=A,O=Z[Z.length-1],O.width=xt,O.height=A,ot.setKeyframes(Z))}}v()},function(M){j.__reactViewTransition===L&&(j.__reactViewTransition=null);try{typeof M=="object"&&M!==null&&M.name==="InvalidStateError"&&(M.message==="View transition was skipped because document visibility state is hidden."||M.message==="Skipping view transition because document visibility state has become hidden."||M.message==="Skipping view transition because viewport size changed."||M.message==="Transition was aborted because of invalid state")&&(M=null),M!==null&&C(M)}finally{s(),c(),v()}}),L.finished.finally(function(){for(var M=0;M<V.length;M++)V[M].cancel();j.__reactViewTransition===L&&(j.__reactViewTransition=null),x()}),L}catch{return s(),c(),v(),null}}function jn(t,i){this._scope=document.documentElement,this._selector="::view-transition-"+t+"("+i+")"}jn.prototype.animate=function(t,i){return i=typeof i=="number"?{duration:i}:B({},i),i.pseudoElement=this._selector,this._scope.animate(t,i)},jn.prototype.getAnimations=function(){for(var t=this._scope,i=this._selector,l=t.getAnimations({subtree:!0}),s=[],c=0;c<l.length;c++){var f=l[c].effect;f!==null&&f.target===t&&f.pseudoElement===i&&s.push(l[c])}return s},jn.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Up(t){return{name:t,group:new jn("group",t),imagePair:new jn("image-pair",t),old:new jn("old",t),new:new jn("new",t)}}function $e(t){this._fragmentFiber=t,this._observers=this._eventListeners=null}$e.prototype.addEventListener=function(t,i,l){var s=null,c=null;if(!(l!=null&&typeof l!="boolean"&&(s=l.signal||null,s!==null&&s.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var f=this._eventListeners;if(Vp(f,t,i,l)===-1){var v=this,x=i;l!=null&&typeof l!="boolean"&&l.once===!0&&(x=function(C){v.removeEventListener(t,i,l),typeof i=="function"?i.call(this,C):i.handleEvent(C)}),s!==null&&(c=v.removeEventListener.bind(v,t,i,l),s.addEventListener("abort",c,{once:!0}),c=s.removeEventListener.bind(s,"abort",c)),s=Dl(l),f.push({type:t,listener:i,optionsOrUseCapture:l,attachedListener:x,cleanup:c}),y(this._fragmentFiber.child,!1,SS,t,x,s)}this._eventListeners=f}};function SS(t,i,l,s){return R(t).addEventListener(i,l,s),!1}$e.prototype.removeEventListener=function(t,i,l){var s=this._eventListeners;if(s!==null&&(i=Vp(s,t,i,l),i!==-1)){var c=s[i];l=c.attachedListener;var f=c.cleanup;c=Dl(c.optionsOrUseCapture),y(this._fragmentFiber.child,!1,_S,t,l,c),s.splice(i,1),f!==null&&f()}};function _S(t,i,l,s){return R(t).removeEventListener(i,l,s),!1}function Dl(t){return t!=null&&typeof t!="boolean"&&(t.once===!0||t.signal instanceof AbortSignal)?{capture:t.capture,passive:t.passive}:t}function Xp(t){return t==null?"c=0":typeof t=="boolean"?"c="+(t?"1":"0"):"c="+(t.capture?"1":"0")}function Vp(t,i,l,s){if(t.length===0)return-1;s=Xp(s);for(var c=0;c<t.length;c++){var f=t[c];if(f.type===i&&f.listener===l&&Xp(f.optionsOrUseCapture)===s)return c}return-1}$e.prototype.dispatchEvent=function(t){var i=b(this._fragmentFiber);if(i===null)return!0;i=R(i);var l=this._eventListeners;if(l!==null&&0<l.length||!t.bubbles){var s=i.nodeType===9?i.createComment(""):document.createTextNode("");if(l)for(var c=0;c<l.length;c++){var f=l[c];s.addEventListener(f.type,f.attachedListener,Dl(f.optionsOrUseCapture))}if(i.appendChild(s),t=s.dispatchEvent(t),l)for(c=0;c<l.length;c++)f=l[c],s.removeEventListener(f.type,f.attachedListener,Dl(f.optionsOrUseCapture));return i.removeChild(s),t}return i.dispatchEvent(t)},$e.prototype.focus=function(t){y(this._fragmentFiber.child,!0,Fp,t,void 0,void 0)};function Fp(t,i){return t.tag===6?!1:(t=R(t),NS(t,i))}$e.prototype.focusLast=function(t){var i=[];y(this._fragmentFiber.child,!0,vf,i,void 0,void 0);for(var l=i.length-1;0<=l&&!Fp(i[l],t);l--);};function vf(t,i){return i.push(t),!1}$e.prototype.blur=function(){var t=b(this._fragmentFiber);t!==null&&(t=R(t),t=Fr(t).activeElement,t!==null&&y(this._fragmentFiber.child,!1,CS,t,void 0,void 0))};function CS(t,i){return t.tag===6?!1:(t=R(t),t===i||t.contains(i)?(i.blur(),!0):!1)}$e.prototype.observeUsing=function(t){this._observers===null&&(this._observers=new Set),this._observers.add(t),y(this._fragmentFiber.child,!1,TS,t,void 0,void 0)};function TS(t,i){return t.tag===6||(t=R(t),i.observe(t)),!1}$e.prototype.unobserveUsing=function(t){var i=this._observers;if(i!==null&&i.has(t)){i.delete(t),y(this._fragmentFiber.child,!1,wS,t,void 0,void 0);for(var l=i=0;l<Ti.length;l++){var s=Ti[l];s.fragmentInstance===this&&s.observer===t?t.unobserve(s.instance):Ti[i++]=s}Ti.length=i}};function wS(t,i){return t.tag===6||(t=R(t),i.unobserve(t)),!1}var Ti=[],yf=!1;function OS(t,i,l){Ti.push({fragmentInstance:t,observer:i,instance:l}),yf||(yf=!0,kS(function(){yf=!1;var s=Ti;Ti=[];for(var c=0;c<s.length;c++){var f=s[c];f.observer.unobserve(f.instance)}}))}$e.prototype.getClientRects=function(){var t=[];return y(this._fragmentFiber.child,!1,ES,t,void 0,void 0),t};function ES(t,i){if(t.tag===6){t=t.stateNode;var l=t.ownerDocument.createRange();l.selectNodeContents(t),i.push.apply(i,l.getClientRects())}else t=R(t),i.push.apply(i,t.getClientRects());return!1}$e.prototype.getRootNode=function(t){var i=b(this._fragmentFiber);return i===null?this:R(i).getRootNode(t)},$e.prototype.compareDocumentPosition=function(t){var i=b(this._fragmentFiber);if(i===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var l=[];y(this._fragmentFiber.child,!1,vf,l,void 0,void 0);var s=R(i);if(l.length===0){if(l=s,S(this._fragmentFiber)){t:{for(i=this._fragmentFiber.return;i!==null;){if(i.tag===4){i=i.stateNode.containerInfo;break t}if(i.tag===3||i.tag===5||i.tag===27)break;i=i.return}i=null}i!=null&&(l=i)}i=this._fragmentFiber;var c=s=l.compareDocumentPosition(t);return l===t?c=Node.DOCUMENT_POSITION_CONTAINS:s&Node.DOCUMENT_POSITION_CONTAINED_BY&&(l=_(i)[1],l===null?c=Node.DOCUMENT_POSITION_PRECEDING:(t=R(l).compareDocumentPosition(t),c=t===0||t&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),c|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}i=R(l[0]),c=R(l[l.length-1]);var f=S(this._fragmentFiber)?i.parentElement:s;if(f==null)return Node.DOCUMENT_POSITION_DISCONNECTED;s=f.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY,f=f.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_CONTAINED_BY;var v=i.compareDocumentPosition(t),x=c.compareDocumentPosition(t),C=v&Node.DOCUMENT_POSITION_CONTAINED_BY||x&Node.DOCUMENT_POSITION_CONTAINED_BY;return x=s&&f&&v&Node.DOCUMENT_POSITION_FOLLOWING&&x&Node.DOCUMENT_POSITION_PRECEDING,i=s&&i===t||f&&c===t||C||x?Node.DOCUMENT_POSITION_CONTAINED_BY:!s&&i===t||!f&&c===t?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:v,i&Node.DOCUMENT_POSITION_DISCONNECTED||i&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||DS(i,this._fragmentFiber,l[0],l[l.length-1],t)?i:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function DS(t,i,l,s,c){var f=cn(c);if(t&Node.DOCUMENT_POSITION_CONTAINED_BY){if(l=!!f)t:{for(;f!==null;){if(f.tag===7&&(f===i||f.alternate===i)){l=!0;break t}f=f.return}l=!1}return l}if(t&Node.DOCUMENT_POSITION_CONTAINS){if(f===null)return f=c.ownerDocument,c===f||c===f.documentElement||c===f.body;t:{for(f=i,i=b(i);f!==null;){if(!(f.tag!==5&&f.tag!==3&&f.tag!==27||f!==i&&f.alternate!==i)){f=!0;break t}f=f.return}f=!1}return f}return t&Node.DOCUMENT_POSITION_PRECEDING?((i=!!f)&&!(i=f===l)&&(i=$(l,f,W),i===null?i=!1:(y(i,!0,q,f,l),f=Y,Y=null,i=f!==null)),i):t&Node.DOCUMENT_POSITION_FOLLOWING?((i=!!f)&&!(i=f===s)&&(i=$(s,f,W),i===null?i=!1:(y(i,!0,I,f,s),f=Y,X=Y=null,i=f!==null)),i):!1}function Gp(t,i){var l=t.ownerDocument.createRange();l.selectNodeContents(t),t=l.getBoundingClientRect(),window.scrollTo(window.scrollX+t.left,i?window.scrollY+t.top:window.scrollY+t.bottom-window.innerHeight)}$e.prototype.scrollIntoView=function(t){if(typeof t=="object")throw Error(r(566));var i=[];y(this._fragmentFiber.child,!1,vf,i,void 0,void 0);var l=t!==!1;if(i.length===0){var s=_(this._fragmentFiber);if(s=l?s[1]||s[0]||b(this._fragmentFiber):s[0]||s[1],s===null)return;if(s.tag===6){t=R(s),Gp(t,l);return}if(s=R(s),s.nodeType!==9){if(s.nodeType===11){l="host"in s?s.host:null,l!==null&&l.scrollIntoView(t);return}s.scrollIntoView(t)}}for(s=l?i.length-1:0;s!==(l?-1:i.length);){var c=i[s];c.tag===6?(c=R(c),Gp(c,l)):R(c).scrollIntoView(t),s+=l?-1:1}};function MS(t,i){return t=R(t),qp(t,i),!1}function qp(t,i){t.reactFragments==null&&(t.reactFragments=new Set),t.reactFragments.add(i)}function Pp(t,i){var l=i._eventListeners;if(l!==null)for(var s=0;s<l.length;s++){var c=l[s];t.addEventListener(c.type,c.attachedListener,Dl(c.optionsOrUseCapture))}t.nodeType!==3&&(l=i._observers,l!==null&&l.forEach(function(f){for(var v=0,x=0;x<Ti.length;x++){var C=Ti[x];(C.fragmentInstance!==i||C.observer!==f||C.instance!==t)&&(Ti[v++]=C)}Ti.length=v,f.observe(t)}),qp(t,i))}function AS(t,i){var l=i._eventListeners;if(l!==null)for(var s=0;s<l.length;s++){var c=l[s];t.removeEventListener(c.type,c.attachedListener,Dl(c.optionsOrUseCapture))}t.nodeType!==3&&(l=i._observers,l!==null&&l.forEach(function(f){typeof f.rootMargin=="string"?OS(i,f,t):f.unobserve(t)}),t.reactFragments!=null&&t.reactFragments.delete(i))}function bf(t){var i=t.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var l=i;switch(i=i.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":bf(l),Gs(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}t.removeChild(l)}}function jS(t,i,l,s){for(;t.nodeType===1;){var c=l;if(t.nodeName.toLowerCase()!==i.toLowerCase()){if(!s&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(s){if(!t[sr])switch(i){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(f=t.getAttribute("rel"),f==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(f!==c.rel||t.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||t.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||t.getAttribute("title")!==(c.title==null?null:c.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(f=t.getAttribute("src"),(f!==(c.src==null?null:c.src)||t.getAttribute("type")!==(c.type==null?null:c.type)||t.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&f&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(i==="input"&&t.type==="hidden"){var f=c.name==null?null:""+c.name;if(c.type==="hidden"&&t.getAttribute("name")===f)return t}else return t;if(t=gi(t.nextSibling),t===null)break}return null}function RS(t,i,l){if(i==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!l||(t=gi(t.nextSibling),t===null))return null;return t}function Qp(t,i){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=gi(t.nextSibling),t===null))return null;return t}function xf(t){return t.data==="$?"||t.data==="$~"}function Sf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function zS(t,i){var l=t.ownerDocument;if(t.data==="$~")t._reactRetry=i;else if(t.data!=="$?"||l.readyState!=="loading")i();else{var s=function(){i(),l.removeEventListener("DOMContentLoaded",s)};l.addEventListener("DOMContentLoaded",s),t._reactRetry=s}}function gi(t){for(;t!=null;t=t.nextSibling){var i=t.nodeType;if(i===1||i===3)break;if(i===8){if(i=t.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return t}var _f=null;function Kp(t){t=t.nextSibling;for(var i=0;t;){if(t.nodeType===8){var l=t.data;if(l==="/$"||l==="/&"){if(i===0)return gi(t.nextSibling);i--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||i++}t=t.nextSibling}return null}function Ip(t){t=t.previousSibling;for(var i=0;t;){if(t.nodeType===8){var l=t.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(i===0)return t;i--}else l!=="/$"&&l!=="/&"||i++}t=t.previousSibling}return null}function NS(t,i){function l(){s=!0}if(t.ownerDocument.activeElement===t)return!0;var s=!1;try{t.ownerDocument.addEventListener("focus",l,!0),(t.focus||HTMLElement.prototype.focus).call(t,i)}finally{t.ownerDocument.removeEventListener("focus",l,!0)}return s}function kS(t){kp(function(){kp(function(i){return t(i)})})}function Wp(t,i,l){switch(i=Fr(l),t){case"html":if(t=i.documentElement,!t)throw Error(r(452));return t;case"head":if(t=i.head,!t)throw Error(r(453));return t;case"body":if(t=i.body,!t)throw Error(r(454));return t;default:throw Error(r(451))}}function Zp(t,i,l){for(var s in l){var c=l[s];l.hasOwnProperty(s)&&c!=null&&Ht(t,i,s,null,cS,c)}l.dangerouslySetInnerHTML!=null&&(t.textContent=""),t.onclick===ki&&(t.onclick=null),Gs(t)}function Cf(t){for(var i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Gs(t)}var mi=new Map,$p=new Set;function Gr(t){if(typeof t.getRootNode=="function"){var i=t.getRootNode();if(i.nodeType===9||i.nodeType===11)return i}return t.nodeType===9?t:t.ownerDocument}var ha=ft.d;ft.d={f:BS,r:LS,D:HS,C:YS,L:US,m:XS,X:FS,S:VS,M:GS};function BS(){var t=ha.f(),i=Ko();return t||i}function LS(t){var i=Qn(t);i!==null&&i.tag===5&&i.type==="form"?t0(i):ha.r(t)}var Ml=typeof document>"u"?null:document;function Jp(t,i,l){var s=Ml;if(s&&typeof i=="string"&&i){var c=si(i);c='link[rel="'+t+'"][href="'+c+'"]',typeof l=="string"&&(c+='[crossorigin="'+l+'"]'),$p.has(c)||($p.add(c),t={rel:t,crossOrigin:l,href:i},s.querySelector(c)===null&&(i=s.createElement("link"),xe(i,"link",t),ue(i),s.head.appendChild(i)))}}function HS(t){ha.D(t),Jp("dns-prefetch",t,null)}function YS(t,i){ha.C(t,i),Jp("preconnect",t,i)}function US(t,i,l){ha.L(t,i,l);var s=Ml;if(s&&t&&i){var c='link[rel="preload"][as="'+si(i)+'"]';i==="image"&&l&&l.imageSrcSet?(c+='[imagesrcset="'+si(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(c+='[imagesizes="'+si(l.imageSizes)+'"]')):c+='[href="'+si(t)+'"]';var f=c;switch(i){case"style":f=Al(t);break;case"script":f=jl(t)}if(!(mi.has(f)||(t=B({rel:"preload",href:i==="image"&&l&&l.imageSrcSet?void 0:t,as:i},l),mi.set(f,t),s.querySelector(c)!==null||i==="style"&&s.querySelector(qr(f))||i==="script"&&s.querySelector(Pr(f))))){var v=s.createElement("link");xe(v,"link",t),i==="style"&&(v[Fs]=!0,v.onload=v.onerror=function(){fg(v)}),ue(v),s.head.appendChild(v)}}}function XS(t,i){ha.m(t,i);var l=Ml;if(l&&t){var s=i&&typeof i.as=="string"?i.as:"script",c='link[rel="modulepreload"][as="'+si(s)+'"][href="'+si(t)+'"]',f=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=jl(t)}if(!mi.has(f)&&(t=B({rel:"modulepreload",href:t},i),mi.set(f,t),l.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Pr(f)))return}s=l.createElement("link"),xe(s,"link",t),ue(s),l.head.appendChild(s)}}}function VS(t,i,l){ha.S(t,i,l);var s=Ml;if(s&&t){var c=Kn(s).hoistableStyles,f=Al(t);i=i||"default";var v=c.get(f);if(!v){var x={loading:0,preload:null};if(v=s.querySelector(qr(f)))x.loading=5;else{t=B({rel:"stylesheet",href:t,"data-precedence":i},l),(l=mi.get(f))&&Tf(t,l);var C=v=s.createElement("link");ue(C),xe(C,"link",t),C._p=new Promise(function(j,L){C.onload=j,C.onerror=L}),C.addEventListener("load",function(){x.loading|=1}),C.addEventListener("error",function(){x.loading|=2}),x.loading|=4,eu(v,i,s)}v={type:"stylesheet",instance:v,count:1,state:x},c.set(f,v)}}}function FS(t,i){ha.X(t,i);var l=Ml;if(l&&t){var s=Kn(l).hoistableScripts,c=jl(t),f=s.get(c);f||(f=l.querySelector(Pr(c)),f||(t=B({src:t,async:!0},i),(i=mi.get(c))&&wf(t,i),f=l.createElement("script"),ue(f),xe(f,"link",t),l.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},s.set(c,f))}}function GS(t,i){ha.M(t,i);var l=Ml;if(l&&t){var s=Kn(l).hoistableScripts,c=jl(t),f=s.get(c);f||(f=l.querySelector(Pr(c)),f||(t=B({src:t,async:!0,type:"module"},i),(i=mi.get(c))&&wf(t,i),f=l.createElement("script"),ue(f),xe(f,"link",t),l.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},s.set(c,f))}}function tv(t,i,l,s){var c=(c=Sa.current)?Gr(c):null;if(!c)throw Error(r(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(l=Al(l.href),i=Kn(c).hoistableStyles,s=i.get(l),s||(s={type:"style",instance:null,count:0,state:null},i.set(l,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=Al(l.href);var f=Kn(c).hoistableStyles,v=f.get(t);if(v||(c=c.ownerDocument||c,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(t,v),(f=c.querySelector(qr(t)))?f._p||(v.instance=f,v.state.loading=5):(f=mi.get(t),f||(f={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},mi.set(t,f)),qS(c,t,f,v.state))),i&&s===null)throw Error(r(528,""));return v}if(i&&s!==null)throw Error(r(529,""));return null;case"script":return i=l.async,l=l.src,typeof l=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(l=jl(l),i=Kn(c).hoistableScripts,s=i.get(l),s||(s={type:"script",instance:null,count:0,state:null},i.set(l,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,t))}}function Al(t){return'href="'+si(t)+'"'}function qr(t){return'link[rel="stylesheet"]['+t+"]"}function ev(t){return B({},t,{"data-precedence":t.precedence,precedence:null})}function qS(t,i,l,s){if(i=t.querySelector('link[rel="preload"][as="style"]['+i+"]")){if(i[Fs]!==!0){s.loading=1;return}}else i=t.createElement("link"),i[Fs]=!0,i.onload=i.onerror=fg.bind(null,i),xe(i,"link",l),ue(i),t.head.appendChild(i);s.preload=i,i.addEventListener("load",function(){return s.loading|=1}),i.addEventListener("error",function(){return s.loading|=2})}function jl(t){return'[src="'+si(t)+'"]'}function Pr(t){return"script[async]"+t}function iv(t,i,l){if(i.count++,i.instance===null)switch(i.type){case"style":var s=t.querySelector('style[data-href~="'+si(l.href)+'"]');if(s)return i.instance=s,ue(s),s;var c=B({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return s=(t.ownerDocument||t).createElement("style"),ue(s),xe(s,"style",c),eu(s,l.precedence,t),i.instance=s;case"stylesheet":c=Al(l.href);var f=t.querySelector(qr(c));if(f)return i.state.loading|=4,i.instance=f,ue(f),f;s=ev(l),(c=mi.get(c))&&Tf(s,c),f=(t.ownerDocument||t).createElement("link"),ue(f);var v=f;return v._p=new Promise(function(x,C){v.onload=x,v.onerror=C}),xe(f,"link",s),i.state.loading|=4,eu(f,l.precedence,t),i.instance=f;case"script":return f=jl(l.src),(c=t.querySelector(Pr(f)))?(i.instance=c,ue(c),c):(s=l,(c=mi.get(f))&&(s=B({},l),wf(s,c)),t=t.ownerDocument||t,c=t.createElement("script"),ue(c),xe(c,"link",s),t.head.appendChild(c),i.instance=c);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(s=i.instance,i.state.loading|=4,eu(s,l.precedence,t));return i.instance}function eu(t,i,l){for(var s=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,f=c,v=0;v<s.length;v++){var x=s[v];if(x.dataset.precedence===i)f=x;else if(f!==c)break}f?f.parentNode.insertBefore(t,f.nextSibling):(i=l.nodeType===9?l.head:l,i.insertBefore(t,i.firstChild))}function Tf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.title==null&&(t.title=i.title)}function wf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.integrity==null&&(t.integrity=i.integrity)}var iu=null;function av(t,i,l){if(iu===null){var s=new Map,c=iu=new Map;c.set(l,s)}else c=iu,s=c.get(l),s||(s=new Map,c.set(l,s));if(s.has(t))return s;for(s.set(t,null),l=l.getElementsByTagName(t),c=0;c<l.length;c++){var f=l[c];if(!(f[sr]||f[me]||t==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var v=f.getAttribute(i)||"";v=t+v;var x=s.get(v);x?x.push(f):s.set(v,[f])}}return s}function Of(t,i,l){t=t.ownerDocument||t,t.head.insertBefore(l,i==="title"?t.querySelector("head > title"):null)}function PS(t,i,l){if(l===1||i.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;return i.rel==="stylesheet"?(t=i.disabled,typeof i.precedence=="string"&&t==null):!0;case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function nv(t,i){return t==="img"&&i.src!=null&&i.src!==""&&i.onLoad==null&&i.loading!=="lazy"}function lv(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function rv(t){return(t.width||100)*(t.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function sv(t,i){typeof i.decode=="function"&&(t.imgCount++,i.complete||(t.imgBytes+=rv(i),t.suspenseyImages.push(i)),t=IS.bind(t),i.decode().then(t,t))}function QS(t,i,l,s){if(l.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var c=Al(s.href),f=i.querySelector(qr(c));if(f){i=f._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=Qr.bind(t),i.then(t,t)),l.state.loading|=4,l.instance=f,ue(f);return}f=i.ownerDocument||i,s=ev(s),(c=mi.get(c))&&Tf(s,c),f=f.createElement("link"),ue(f);var v=f;v._p=new Promise(function(x,C){v.onload=x,v.onerror=C}),xe(f,"link",s),l.instance=f}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(l,i),(i=l.state.preload)&&(l.state.loading&3)===0&&(t.count++,l=Qr.bind(t),i.addEventListener("load",l),i.addEventListener("error",l))}}var au=0;function KS(t,i){return t.stylesheets&&t.count===0&&lu(t,t.stylesheets),0<t.count||0<t.imgCount?function(l){var s=setTimeout(function(){if(t.stylesheets&&lu(t,t.stylesheets),t.unsuspend){var f=t.unsuspend;t.unsuspend=null,f()}},6e4+i);0<t.imgBytes&&au===0&&(au=62500*fS());var c=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&lu(t,t.stylesheets),t.unsuspend)){var f=t.unsuspend;t.unsuspend=null,f()}},(t.imgBytes>au?50:800)+i);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function ov(t){if(t.count===0&&(t.imgCount===0||!t.waitingForImages)){if(t.stylesheets)lu(t,t.stylesheets);else if(t.unsuspend){var i=t.unsuspend;t.unsuspend=null,i()}}}function Qr(){this.count--,ov(this)}function IS(){this.imgCount--,ov(this)}var nu=null;function lu(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,nu=new Map,i.forEach(WS,t),nu=null,Qr.call(t))}function WS(t,i){if(!(i.state.loading&4)){var l=nu.get(t);if(l)var s=l.get(null);else{l=new Map,nu.set(t,l);for(var c=t.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<c.length;f++){var v=c[f];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(l.set(v.dataset.precedence,v),s=v)}s&&l.set(null,s)}c=i.instance,v=c.getAttribute("data-precedence"),f=l.get(v)||s,f===s&&l.set(null,c),l.set(v,c),this.count++,s=Qr.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),f?f.parentNode.insertBefore(c,f.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(c,t.firstChild)),i.state.loading|=4}}var Rl={$$typeof:yt,Provider:null,Consumer:null,_currentValue:ri,_currentValue2:ri,_threadCount:0};function ZS(t,i,l,s,c,f,v,x,C){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=lc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=lc(0),this.hiddenUpdates=lc(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=f,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=C,this.transitionTypes=null,this.incompleteTransitions=new Map}function uv(t,i,l,s,c,f,v,x,C,j,L,V){return t=new ZS(t,i,l,v,C,j,L,V,x),i=1,f===!0&&(i|=24),f=Be(3,null,null,i),t.current=f,f.stateNode=t,i=Uc(),i.refCount++,t.pooledCache=i,i.refCount++,f.memoizedState={element:s,isDehydrated:l,cache:i},Gc(f),t}function cv(t){return t?(t=nl,t):nl}function hv(t,i,l,s,c,f){c=cv(c),s.context===null?s.context=c:s.pendingContext=c,s=Ra(i),s.payload={element:l},f=f===void 0?null:f,f!==null&&(s.callback=f),l=za(t,s,i),l!==null&&(Ue(l,t,i),Tr(l,t,i))}function fv(t,i){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var l=t.retryLane;t.retryLane=l!==0&&l<i?l:i}}function Ef(t,i){fv(t,i),(t=t.alternate)&&fv(t,i)}function dv(t){if(t.tag===13||t.tag===31){var i=gn(t,67108864);i!==null&&Ue(i,t,67108864),Ef(t,67108864)}}function gv(t){if(t.tag===13||t.tag===31){var i=Ze();i=rc(i);var l=gn(t,i);l!==null&&Ue(l,t,i),Ef(t,i)}}var zl=!0;function $S(t,i,l,s){var c=J.T;J.T=null;var f=ft.p;try{ft.p=2,Df(t,i,l,s)}finally{ft.p=f,J.T=c}}function JS(t,i,l,s){var c=J.T;J.T=null;var f=ft.p;try{ft.p=8,Df(t,i,l,s)}finally{ft.p=f,J.T=c}}function Df(t,i,l,s){if(zl){var c=Mf(s);if(c===null)uf(t,i,s,ru,l),pv(t,s);else if(e_(c,t,i,l,s))s.stopPropagation();else if(pv(t,s),i&4&&-1<t_.indexOf(t)){for(;c!==null;){var f=Qn(c);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var v=un(f.pendingLanes);if(v!==0){var x=f;for(x.pendingLanes|=2,x.entangledLanes|=2;v;){var C=1<<31-Ge(v);x.entanglements[1]|=C,v&=~C}qi(f),(zt&6)===0&&(qo=Ve()+500,Ur(0))}}break;case 31:case 13:x=gn(f,2),x!==null&&Ue(x,f,2),Ko(),Ef(f,2)}if(f=Mf(s),f===null&&uf(t,i,s,ru,l),f===c)break;c=f}c!==null&&s.stopPropagation()}else uf(t,i,s,null,l)}}function Mf(t){return t=dc(t),Af(t)}var ru=null;function Af(t){if(ru=null,t=cn(t),t!==null){var i=u(t);if(i===null)t=null;else{var l=i.tag;if(l===13){if(t=h(i),t!==null)return t;t=null}else if(l===31){if(t=d(i),t!==null)return t;t=null}else if(l===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;t=null}else i!==t&&(t=null)}}return ru=t,null}function mv(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(fx()){case tg:return 2;case eg:return 8;case Hs:case dx:return 32;case ig:return 268435456;default:return 32}default:return 32}}var jf=!1,qa=null,Pa=null,Qa=null,Kr=new Map,Ir=new Map,Ka=[],t_="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function pv(t,i){switch(t){case"focusin":case"focusout":qa=null;break;case"dragenter":case"dragleave":Pa=null;break;case"mouseover":case"mouseout":Qa=null;break;case"pointerover":case"pointerout":Kr.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ir.delete(i.pointerId)}}function Wr(t,i,l,s,c,f){return t===null||t.nativeEvent!==f?(t={blockedOn:i,domEventName:l,eventSystemFlags:s,nativeEvent:f,targetContainers:[c]},i!==null&&(i=Qn(i),i!==null&&dv(i)),t):(t.eventSystemFlags|=s,i=t.targetContainers,c!==null&&i.indexOf(c)===-1&&i.push(c),t)}function e_(t,i,l,s,c){switch(i){case"focusin":return qa=Wr(qa,t,i,l,s,c),!0;case"dragenter":return Pa=Wr(Pa,t,i,l,s,c),!0;case"mouseover":return Qa=Wr(Qa,t,i,l,s,c),!0;case"pointerover":var f=c.pointerId;return Kr.set(f,Wr(Kr.get(f)||null,t,i,l,s,c)),!0;case"gotpointercapture":return f=c.pointerId,Ir.set(f,Wr(Ir.get(f)||null,t,i,l,s,c)),!0}return!1}function vv(t){var i=cn(t.target);if(i!==null){var l=u(i);if(l!==null){if(i=l.tag,i===13){if(i=h(l),i!==null){t.blockedOn=i,ug(t.priority,function(){gv(l)});return}}else if(i===31){if(i=d(l),i!==null){t.blockedOn=i,ug(t.priority,function(){gv(l)});return}}else if(i===3&&l.stateNode.current.memoizedState.isDehydrated){t.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}t.blockedOn=null}function su(t){if(t.blockedOn!==null)return!1;for(var i=t.targetContainers;0<i.length;){var l=Mf(t.nativeEvent);if(l===null){l=t.nativeEvent;var s=new l.constructor(l.type,l);fc=s,l.target.dispatchEvent(s),fc=null}else return i=Qn(l),i!==null&&dv(i),t.blockedOn=l,!1;i.shift()}return!0}function yv(t,i,l){su(t)&&l.delete(i)}function i_(){jf=!1,qa!==null&&su(qa)&&(qa=null),Pa!==null&&su(Pa)&&(Pa=null),Qa!==null&&su(Qa)&&(Qa=null),Kr.forEach(yv),Ir.forEach(yv)}function ou(t,i){t.blockedOn===i&&(t.blockedOn=null,jf||(jf=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,i_)))}var uu=null;function bv(t){uu!==t&&(uu=t,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){uu===t&&(uu=null);for(var i=0;i<t.length;i+=3){var l=t[i],s=t[i+1],c=t[i+2];if(typeof s!="function"){if(Af(s||l)===null)continue;break}var f=Qn(l);f!==null&&(t.splice(i,3),i-=3,hh(f,{pending:!0,data:c,method:l.method,action:s},s,c))}}))}function Nl(t){function i(C){return ou(C,t)}qa!==null&&ou(qa,t),Pa!==null&&ou(Pa,t),Qa!==null&&ou(Qa,t),Kr.forEach(i),Ir.forEach(i);for(var l=0;l<Ka.length;l++){var s=Ka[l];s.blockedOn===t&&(s.blockedOn=null)}for(;0<Ka.length&&(l=Ka[0],l.blockedOn===null);)vv(l),l.blockedOn===null&&Ka.shift();if(l=(t.ownerDocument||t).$$reactFormReplay,l!=null)for(s=0;s<l.length;s+=3){var c=l[s],f=l[s+1],v=c[ke]||null;if(typeof f=="function")v||bv(l);else if(v){var x=null;if(f&&f.hasAttribute("formAction")){if(c=f,v=f[ke]||null)x=v.formAction;else if(Af(c)!==null)continue}else x=v.action;typeof x=="function"?l[s+1]=x:(l.splice(s,3),s-=3),bv(l)}}}function xv(){function t(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(v){return c=v})},focusReset:"manual",scroll:"manual"})}function i(){c!==null&&(c(),c=null),s||setTimeout(l,20)}function l(){if(!s&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,c=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(l,100),function(){s=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),c!==null&&(c(),c=null)}}}function Rf(t){this._internalRoot=t}cu.prototype.render=Rf.prototype.render=function(t){var i=this._internalRoot;if(i===null)throw Error(r(409));var l=i.current,s=Ze();hv(l,s,t,i,null,null)},cu.prototype.unmount=Rf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var i=t.containerInfo;hv(t.current,2,null,t,null,null),Ko(),i[Pn]=null}};function cu(t){this._internalRoot=t}cu.prototype.unstable_scheduleHydration=function(t){if(t){var i=og();t={blockedOn:null,target:t,priority:i};for(var l=0;l<Ka.length&&i!==0&&i<Ka[l].priority;l++);Ka.splice(l,0,t),l===0&&vv(t)}};var Sv=e.version;if(Sv!=="19.3.1")throw Error(r(527,Sv,"19.3.1"));ft.findDOMNode=function(t){var i=t._reactInternals;if(i===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=m(i),t=t!==null?p(t):null,t=t===null?null:t.stateNode,t};var a_={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:J,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var hu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!hu.isDisabled&&hu.supportsFiber)try{nr=hu.inject(a_),Fe=hu}catch{}}return $r.createRoot=function(t,i){if(!o(t))throw Error(r(299));var l=!1,s="",c=c0,f=h0,v=f0;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(s=i.identifierPrefix),i.onUncaughtError!==void 0&&(c=i.onUncaughtError),i.onCaughtError!==void 0&&(f=i.onCaughtError),i.onRecoverableError!==void 0&&(v=i.onRecoverableError)),i=uv(t,1,!1,null,null,l,s,null,c,f,v,xv),t[Pn]=i.current,of(t),new Rf(i)},$r.hydrateRoot=function(t,i,l){if(!o(t))throw Error(r(299));var s=!1,c="",f=c0,v=h0,x=f0,C=null;return l!=null&&(l.unstable_strictMode===!0&&(s=!0),l.identifierPrefix!==void 0&&(c=l.identifierPrefix),l.onUncaughtError!==void 0&&(f=l.onUncaughtError),l.onCaughtError!==void 0&&(v=l.onCaughtError),l.onRecoverableError!==void 0&&(x=l.onRecoverableError),l.formState!==void 0&&(C=l.formState)),i=uv(t,1,!0,i,l??null,s,c,C,f,v,x,xv),i.context=cv(null),l=i.current,s=Ze(),s=rc(s),c=Ra(s),c.callback=null,za(l,c,s),l=s,i.current.lanes=l,rr(i,l),qi(i),t[Pn]=i.current,of(t),new cu(i)},$r.version="19.3.1",$r}var jv;function d_(){if(jv)return kf.exports;jv=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),kf.exports=f_(),kf.exports}var g_=d_();const m_=fy(g_),Rv=n=>{let e;const a=new Set,r=(m,p)=>{const y=typeof m=="function"?m(e):m;if(!Object.is(y,e)){const b=e;e=p??(typeof y!="object"||y===null)?y:Object.assign({},e,y),a.forEach(S=>S(e,b))}},o=()=>e,d={setState:r,getState:o,getInitialState:()=>g,subscribe:m=>(a.add(m),()=>a.delete(m))},g=e=n(r,o,d);return d},p_=(n=>n?Rv(n):Rv),v_=n=>n;function y_(n,e=v_){const a=jt.useSyncExternalStore(n.subscribe,jt.useCallback(()=>e(n.getState()),[n,e]),jt.useCallback(()=>e(n.getInitialState()),[n,e]));return jt.useDebugValue(a),a}const b_=n=>{const e=p_(n),a=r=>y_(e,r);return Object.assign(a,e),a},x_=(n=>b_);var zv=Object.defineProperty,js=(n,e)=>{let a={};for(var r in n)zv(a,r,{get:n[r],enumerable:!0});return zv(a,Symbol.toStringTag,{value:"Module"}),a};function Ss(n){return Ss=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ss(n)}function S_(n){var e=(function(a,r){if(Ss(a)!="object"||!a)return a;var o=a[Symbol.toPrimitive];if(o!==void 0){var u=o.call(a,r);if(Ss(u)!="object")return u;throw TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(a)})(n,"string");return Ss(e)=="symbol"?e:e+""}function D(n,e,a){return(e=S_(e))in n?Object.defineProperty(n,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[e]=a,n}var Nv=class{constructor(){D(this,"browserShadowBlurConstant",1),D(this,"DPI",96),D(this,"devicePixelRatio",typeof window<"u"?window.devicePixelRatio:1),D(this,"perfLimitSizeTotal",2097152),D(this,"maxCacheSideLimit",4096),D(this,"minCacheSideLimit",256),D(this,"disableStyleCopyPaste",!1),D(this,"enableGLFiltering",!0),D(this,"textureSize",4096),D(this,"forceGLPutImageData",!1),D(this,"cachesBoundsOfCurve",!1),D(this,"fontPaths",{}),D(this,"NUM_FRACTION_DIGITS",4)}};const Yt=new class extends Nv{constructor(n){super(),this.configure(n)}configure(n={}){Object.assign(this,n)}addFonts(n={}){this.fontPaths={...this.fontPaths,...n}}removeFonts(n=[]){n.forEach(e=>{delete this.fontPaths[e]})}clearFonts(){this.fontPaths={}}restoreDefaults(n){let e=new Nv,a=n?.reduce((r,o)=>(r[o]=e[o],r),{})||e;this.configure(a)}},tn=(n,...e)=>console[n]("fabric",...e);var Qi=class extends Error{constructor(e,a){super(`fabric: ${e}`,a)}},__=class extends Qi{constructor(e){super(`${e} 'options.signal' is in 'aborted' state`)}},C_=class{},T_=class extends C_{testPrecision(e,a){let r=`precision ${a} float;
|
|
10
|
+
void main(){}`,o=e.createShader(e.FRAGMENT_SHADER);return!!o&&(e.shaderSource(o,r),e.compileShader(o),!!e.getShaderParameter(o,e.COMPILE_STATUS))}queryWebGL(e){let a=e.getContext("webgl");a&&(this.maxTextureSize=a.getParameter(a.MAX_TEXTURE_SIZE),this.GLPrecision=["highp","mediump","lowp"].find(r=>this.testPrecision(a,r)),a.getExtension("WEBGL_lose_context").loseContext(),tn("log",`WebGL: max texture size ${this.maxTextureSize}`))}isSupported(e){return!!this.maxTextureSize&&this.maxTextureSize>=e}};const w_={};let kv;const Ii=()=>kv||(kv={document,window,isTouchSupported:"ontouchstart"in window||"ontouchstart"in document||window&&window.navigator&&window.navigator.maxTouchPoints>0,WebGLProbe:new T_,dispose(){},copyPasteData:w_}),Jl=()=>Ii().document,Ql=()=>Ii().window,dy=()=>{var n;return Math.max((n=Yt.devicePixelRatio)==null?Ql().devicePixelRatio:n,1)},_s=new class{constructor(){D(this,"boundsOfCurveCache",{}),this.charWidthsCache=new Map}getFontCache({fontFamily:n,fontStyle:e,fontWeight:a}){n=n.toLowerCase();let r=this.charWidthsCache;r.has(n)||r.set(n,new Map);let o=r.get(n),u=`${e.toLowerCase()}_${(a+"").toLowerCase()}`;return o.has(u)||o.set(u,new Map),o.get(u)}clearFontCache(n){n?this.charWidthsCache.delete((n||"").toLowerCase()):this.charWidthsCache=new Map}limitDimsByArea(n){let{perfLimitSizeTotal:e}=Yt,a=Math.sqrt(e*n);return[Math.floor(a),Math.floor(e/a)]}},Qf="7.4.0";function Cu(){}const an=Math.PI/2,O_=Math.PI/4,Ai=2*Math.PI,Sd=Math.PI/180,Ne=Object.freeze([1,0,0,1,0,0]),Ft="center",de="left",gy="bottom",Di="right",Bu="none",_d=/\r?\n/,my="moving",Lu="scaling",py="rotating",vy="rotate",yy="skewing",Es="resizing",by="modifyPoly",Mu="changed",xy="scale",nn="scaleX",ln="scaleY",tr="skewX",er="skewY",Xe="fill",ga="stroke",Sy="modified",Bv="normal",kl="json",nt=new class{constructor(){this[kl]=new Map,this.svg=new Map}has(n){return this[kl].has(n)}getClass(n){let e=this[kl].get(n);if(!e)throw new Qi(`No class registered for ${n}`);return e}setClass(n,e){e?this[kl].set(e,n):(this[kl].set(n.type,n),this[kl].set(n.type.toLowerCase(),n))}getSVGClass(n){return this.svg.get(n)}setSVGClass(n,e){this.svg.set(e??n.type.toLowerCase(),n)}},Au=new class extends Array{remove(n){let e=this.indexOf(n);e>-1&&this.splice(e,1)}cancelAll(){let n=this.splice(0);return n.forEach(e=>e.abort()),n}cancelByCanvas(n){if(!n)return[];let e=this.filter(a=>{var r;return a.target===n||typeof a.target=="object"&&((r=a.target)==null?void 0:r.canvas)===n});return e.forEach(a=>a.abort()),e}cancelByTarget(n){if(!n)return[];let e=this.filter(a=>a.target===n);return e.forEach(a=>a.abort()),e}};var E_=class{constructor(){D(this,"__eventListeners",{})}on(n,e){if(this.__eventListeners||(this.__eventListeners={}),typeof n=="object")return Object.entries(n).forEach(([a,r])=>{this.on(a,r)}),()=>this.off(n);if(e){let a=n;return this.__eventListeners[a]||(this.__eventListeners[a]=[]),this.__eventListeners[a].push(e),()=>this.off(a,e)}return()=>!1}once(n,e){if(typeof n=="object"){let a=[];return Object.entries(n).forEach(([r,o])=>{a.push(this.once(r,o))}),()=>a.forEach(r=>r())}if(e){let a=this.on(n,function(...r){e.call(this,...r),a()});return a}return()=>!1}_removeEventListener(n,e){if(this.__eventListeners[n])if(e){let a=this.__eventListeners[n],r=a.indexOf(e);r>-1&&a.splice(r,1)}else this.__eventListeners[n]=[]}off(n,e){if(this.__eventListeners)if(n===void 0)for(let a in this.__eventListeners)this._removeEventListener(a);else typeof n=="object"?Object.entries(n).forEach(([a,r])=>{this._removeEventListener(a,r)}):this._removeEventListener(n,e)}fire(n,e){var a;if(!this.__eventListeners)return;let r=(a=this.__eventListeners[n])==null?void 0:a.concat();if(r)for(let o=0;o<r.length;o++)r[o].call(this,e||{})}};const Rn=(n,e)=>{let a=n.indexOf(e);return a!==-1&&n.splice(a,1),n},ji=n=>{if(n===0)return 1;switch(Math.abs(n)/an){case 1:case 3:return 0;case 2:return-1}return Math.cos(n)},Ri=n=>{if(n===0)return 0;let e=n/an,a=Math.sign(n);switch(e){case 1:return a;case 2:return 0;case 3:return-a}return Math.sin(n)};var H=class je{constructor(e=0,a=0){typeof e=="object"?(this.x=e.x,this.y=e.y):(this.x=e,this.y=a)}add(e){return new je(this.x+e.x,this.y+e.y)}addEquals(e){return this.x+=e.x,this.y+=e.y,this}scalarAdd(e){return new je(this.x+e,this.y+e)}scalarAddEquals(e){return this.x+=e,this.y+=e,this}subtract(e){return new je(this.x-e.x,this.y-e.y)}subtractEquals(e){return this.x-=e.x,this.y-=e.y,this}scalarSubtract(e){return new je(this.x-e,this.y-e)}scalarSubtractEquals(e){return this.x-=e,this.y-=e,this}multiply(e){return new je(this.x*e.x,this.y*e.y)}scalarMultiply(e){return new je(this.x*e,this.y*e)}scalarMultiplyEquals(e){return this.x*=e,this.y*=e,this}divide(e){return new je(this.x/e.x,this.y/e.y)}scalarDivide(e){return new je(this.x/e,this.y/e)}scalarDivideEquals(e){return this.x/=e,this.y/=e,this}eq(e){return this.x===e.x&&this.y===e.y}lt(e){return this.x<e.x&&this.y<e.y}lte(e){return this.x<=e.x&&this.y<=e.y}gt(e){return this.x>e.x&&this.y>e.y}gte(e){return this.x>=e.x&&this.y>=e.y}lerp(e,a=.5){return a=Math.max(Math.min(1,a),0),new je(this.x+(e.x-this.x)*a,this.y+(e.y-this.y)*a)}distanceFrom(e){let a=this.x-e.x,r=this.y-e.y;return Math.sqrt(a*a+r*r)}midPointFrom(e){return this.lerp(e)}min(e){return new je(Math.min(this.x,e.x),Math.min(this.y,e.y))}max(e){return new je(Math.max(this.x,e.x),Math.max(this.y,e.y))}toString(){return`${this.x},${this.y}`}setXY(e,a){return this.x=e,this.y=a,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setFromPoint(e){return this.x=e.x,this.y=e.y,this}swap(e){let a=this.x,r=this.y;this.x=e.x,this.y=e.y,e.x=a,e.y=r}clone(){return new je(this.x,this.y)}rotate(e,a=Cd){let r=Ri(e),o=ji(e),u=this.subtract(a);return new je(u.x*o-u.y*r,u.x*r+u.y*o).add(a)}transform(e,a=!1){return new je(e[0]*this.x+e[2]*this.y+(a?0:e[4]),e[1]*this.x+e[3]*this.y+(a?0:e[5]))}};const Cd=new H(0,0),Tu=n=>!!n&&Array.isArray(n._objects);function _y(n){class e extends n{constructor(...r){super(...r),D(this,"_objects",[])}_onObjectAdded(r){}_onObjectRemoved(r){}_onStackOrderChanged(r){}add(...r){let o=this._objects.push(...r);return r.forEach(u=>this._onObjectAdded(u)),o}insertAt(r,...o){return this._objects.splice(r,0,...o),o.forEach(u=>this._onObjectAdded(u)),this._objects.length}remove(...r){let o=this._objects,u=[];return r.forEach(h=>{let d=o.indexOf(h);d!==-1&&(o.splice(d,1),u.push(h),this._onObjectRemoved(h))}),u}forEachObject(r){this.getObjects().forEach((o,u,h)=>r(o,u,h))}getObjects(...r){return r.length===0?[...this._objects]:this._objects.filter(o=>o.isType(...r))}item(r){return this._objects[r]}isEmpty(){return this._objects.length===0}size(){return this._objects.length}contains(r,o){return!!this._objects.includes(r)||!!o&&this._objects.some(u=>u instanceof e&&u.contains(r,!0))}complexity(){return this._objects.reduce((r,o)=>r+=o.complexity?o.complexity():0,0)}sendObjectToBack(r){return!(!r||r===this._objects[0])&&(Rn(this._objects,r),this._objects.unshift(r),this._onStackOrderChanged(r),!0)}bringObjectToFront(r){return!(!r||r===this._objects[this._objects.length-1])&&(Rn(this._objects,r),this._objects.push(r),this._onStackOrderChanged(r),!0)}sendObjectBackwards(r,o){if(!r)return!1;let u=this._objects.indexOf(r);if(u!==0){let h=this.findNewLowerIndex(r,u,o);return Rn(this._objects,r),this._objects.splice(h,0,r),this._onStackOrderChanged(r),!0}return!1}bringObjectForward(r,o){if(!r)return!1;let u=this._objects.indexOf(r);if(u!==this._objects.length-1){let h=this.findNewUpperIndex(r,u,o);return Rn(this._objects,r),this._objects.splice(h,0,r),this._onStackOrderChanged(r),!0}return!1}moveObjectTo(r,o){return r!==this._objects[o]&&(Rn(this._objects,r),this._objects.splice(o,0,r),this._onStackOrderChanged(r),!0)}findNewLowerIndex(r,o,u){let h;if(u){h=o;for(let d=o-1;d>=0;--d)if(r.isOverlapping(this._objects[d])){h=d;break}}else h=o-1;return h}findNewUpperIndex(r,o,u){let h;if(u){h=o;for(let d=o+1;d<this._objects.length;++d)if(r.isOverlapping(this._objects[d])){h=d;break}}else h=o+1;return h}collectObjects({left:r,top:o,width:u,height:h},{includeIntersecting:d=!0}={}){let g=[],m=new H(r,o),p=m.add(new H(u,h));for(let y=this._objects.length-1;y>=0;y--){let b=this._objects[y];b.selectable&&b.visible&&(d&&b.intersectsWithRect(m,p)||b.isContainedWithinRect(m,p)||d&&b.containsPoint(m)||d&&b.containsPoint(p))&&g.push(b)}return g}}return e}var Cy=class extends E_{_setOptions(n={}){for(let e in n)this.set(e,n[e])}_setObject(n){for(let e in n)this._set(e,n[e])}set(n,e){return typeof n=="object"?this._setObject(n):this._set(n,e),this}_set(n,e){this[n]=e}toggle(n){let e=this.get(n);return typeof e=="boolean"&&this.set(n,!e),this}get(n){return this[n]}};function Cs(n){return Ql().requestAnimationFrame(n)}function Ty(n){return Ql().cancelAnimationFrame(n)}let D_=0;const en=()=>D_++,Wi=()=>{let n=Jl().createElement("canvas");if(!n||n.getContext===void 0)throw new Qi("Failed to create `canvas` element");return n},wy=()=>Jl().createElement("img"),M_=n=>{var e;let a=ai(n);return(e=a.getContext("2d"))==null||e.drawImage(n,0,0),a},ai=n=>{let e=Wi();return e.width=n.width,e.height=n.height,e},Td=(n,e,a)=>n.toDataURL(`image/${e}`,a),wd=(n,e,a)=>new Promise((r,o)=>{n.toBlob(r,`image/${e}`,a)}),It=n=>n*Sd,ma=n=>n/Sd,Oy=n=>n.every((e,a)=>e===Ne[a]),we=(n,e,a)=>new H(n).transform(e,a),ii=n=>{let e=1/(n[0]*n[3]-n[1]*n[2]),a=[e*n[3],-e*n[1],-e*n[2],e*n[0],0,0],{x:r,y:o}=new H(n[4],n[5]).transform(a,!0);return a[4]=-r,a[5]=-o,a},$t=(n,e,a)=>[n[0]*e[0]+n[2]*e[1],n[1]*e[0]+n[3]*e[1],n[0]*e[2]+n[2]*e[3],n[1]*e[2]+n[3]*e[3],a?0:n[0]*e[4]+n[2]*e[5]+n[4],a?0:n[1]*e[4]+n[3]*e[5]+n[5]],Hu=(n,e)=>n.reduceRight((a,r)=>r&&a?$t(r,a,e):r||a,void 0)||Ne.concat(),Od=([n,e])=>Math.atan2(e,n),Ed=([n,e])=>Math.sqrt(n*n+e*e),Ey=([,,n,e])=>Math.sqrt(n*n+e*e),Kl=n=>{let e=Od(n),a=n[0]**2+n[1]**2,r=Math.sqrt(a),o=(n[0]*n[3]-n[2]*n[1])/r,u=Math.atan2(n[0]*n[2]+n[1]*n[3],a);return{angle:ma(e),scaleX:r,scaleY:o,skewX:ma(u),skewY:0,translateX:n[4]||0,translateY:n[5]||0}},ir=(n,e=0)=>[1,0,0,1,n,e];function Vn({angle:n=0}={},{x:e=0,y:a=0}={}){let r=It(n),o=ji(r),u=Ri(r);return[o,u,-u,o,e?e-(o*e-u*a):0,a?a-(u*e+o*a):0]}const Yu=(n,e=n)=>[n,0,0,e,0,0],Dy=n=>Math.tan(It(n)),Dd=n=>[1,0,Dy(n),1,0,0],Md=n=>[1,Dy(n),0,1,0,0],Rs=({scaleX:n=1,scaleY:e=1,flipX:a=!1,flipY:r=!1,skewX:o=0,skewY:u=0})=>{let h=Yu(a?-n:n,r?-e:e);return o&&(h=$t(h,Dd(o),!0)),u&&(h=$t(h,Md(u),!0)),h},My=n=>{let{translateX:e=0,translateY:a=0,angle:r=0}=n,o=ir(e,a);r&&(o=$t(o,Vn({angle:r})));let u=Rs(n);return Oy(u)||(o=$t(o,u)),o},Ts=(n,{signal:e,crossOrigin:a=null}={})=>new Promise(function(r,o){if(e&&e.aborted)return o(new __("loadImage"));let u=wy(),h;e&&(h=function(g){u.src="",o(g)},e.addEventListener("abort",h,{once:!0}));let d=function(){u.onload=u.onerror=null,h&&e?.removeEventListener("abort",h),r(u)};n?(u.onload=d,u.onerror=function(){h&&e?.removeEventListener("abort",h),o(new Qi(`Error loading ${u.src}`))},a&&(u.crossOrigin=a),u.src=n):d()}),Il=(n,{signal:e,reviver:a=Cu}={})=>new Promise((r,o)=>{let u=[];e&&e.addEventListener("abort",o,{once:!0}),Promise.allSettled(n.map(h=>nt.getClass(h.type).fromObject(h,{signal:e}))).then(async h=>{for(let[d,g]of h.entries())if(g.status==="fulfilled"&&(await a(n[d],g.value),u.push(g.value)),g.status==="rejected"){let m=await a(n[d],void 0,g.reason);m&&u.push(m)}r(u)}).catch(h=>{u.forEach(d=>{d.dispose&&d.dispose()}),o(h)}).finally(()=>{e&&e.removeEventListener("abort",o)})}),zs=(n,{signal:e}={})=>new Promise((a,r)=>{let o=[];e&&e.addEventListener("abort",r,{once:!0});let u=Object.values(n).map(d=>d&&d.type&&nt.has(d.type)?Il([d],{signal:e}).then(([g])=>(o.push(g),g)):d),h=Object.keys(n);Promise.all(u).then(d=>d.reduce((g,m,p)=>(g[h[p]]=m,g),{})).then(a).catch(d=>{o.forEach(g=>{g.dispose&&g.dispose()}),r(d)}).finally(()=>{e&&e.removeEventListener("abort",r)})}),Fn=(n,e=[])=>e.reduce((a,r)=>(r in n&&(a[r]=n[r]),a),{}),Ad=(n,e)=>Object.keys(n).reduce((a,r)=>(e(n[r],r,n)&&(a[r]=n[r]),a),{}),Vt=(n,e)=>parseFloat(Number(n).toFixed(e)),Wl=n=>"matrix("+n.map(e=>Vt(e,Yt.NUM_FRACTION_DIGITS)).join(" ")+")",yi=n=>!!n&&n.toLive!==void 0,Lv=n=>!!n&&typeof n.toObject=="function",Hv=n=>!!n&&n.offsetX!==void 0&&"source"in n,zn=n=>!!n&&"multiSelectionStacking"in n;function Ay(n){let e=n&&Ei(n),a=0,r=0;if(!n||!e)return{left:a,top:r};let o=n,u=e.documentElement,h=e.body||{scrollLeft:0,scrollTop:0};for(;o&&(o.parentNode||o.host)&&(o=o.parentNode||o.host,o===e?(a=h.scrollLeft||u.scrollLeft||0,r=h.scrollTop||u.scrollTop||0):(a+=o.scrollLeft||0,r+=o.scrollTop||0),o.nodeType!==1||o.style.position!=="fixed"););return{left:a,top:r}}const Ei=n=>n.ownerDocument||null,jy=n=>{var e;return((e=n.ownerDocument)==null?void 0:e.defaultView)||null},Ry=(n,e,{width:a,height:r},o=1)=>{n.width=a,n.height=r,o>1&&(n.setAttribute("width",(a*o).toString()),n.setAttribute("height",(r*o).toString()),e.scale(o,o))},Kf=(n,{width:e,height:a})=>{e&&(n.style.width=typeof e=="number"?`${e}px`:e),a&&(n.style.height=typeof a=="number"?`${a}px`:a)};function Yv(n){return n.onselectstart!==void 0&&(n.onselectstart=()=>!1),n.style.userSelect=Bu,n}var zy=class{constructor(n){D(this,"_originalCanvasStyle",void 0),D(this,"lower",void 0);let e=this.createLowerCanvas(n);this.lower={el:e,ctx:e.getContext("2d")}}createLowerCanvas(n){let e=(a=n)&&a.getContext!==void 0?n:n&&Jl().getElementById(n)||Wi();var a;if(e.hasAttribute("data-fabric"))throw new Qi("Trying to initialize a canvas that has already been initialized. Did you forget to dispose the canvas?");return this._originalCanvasStyle=e.style.cssText,e.setAttribute("data-fabric","main"),e.classList.add("lower-canvas"),e}cleanupDOM({width:n,height:e}){let{el:a}=this.lower;a.classList.remove("lower-canvas"),a.removeAttribute("data-fabric"),a.setAttribute("width",`${n}`),a.setAttribute("height",`${e}`),a.style.cssText=this._originalCanvasStyle||"",this._originalCanvasStyle=void 0}setDimensions(n,e){let{el:a,ctx:r}=this.lower;Ry(a,r,n,e)}setCSSDimensions(n){Kf(this.lower.el,n)}calcOffset(){return(function(n){var e;let a=n&&Ei(n),r={left:0,top:0};if(!a)return r;let o=((e=jy(n))==null?void 0:e.getComputedStyle(n,null))||{};r.left+=parseInt(o.borderLeftWidth,10)||0,r.top+=parseInt(o.borderTopWidth,10)||0,r.left+=parseInt(o.paddingLeft,10)||0,r.top+=parseInt(o.paddingTop,10)||0;let u={left:0,top:0},h=a.documentElement;n.getBoundingClientRect!==void 0&&(u=n.getBoundingClientRect());let d=Ay(n);return{left:u.left+d.left-(h.clientLeft||0)+r.left,top:u.top+d.top-(h.clientTop||0)+r.top}})(this.lower.el)}dispose(){Ii().dispose(this.lower.el),delete this.lower}};const A_={backgroundVpt:!0,backgroundColor:"",overlayVpt:!0,overlayColor:"",includeDefaultValues:!0,svgViewportTransformation:!0,renderOnAddRemove:!0,skipOffscreen:!0,enableRetinaScaling:!0,imageSmoothingEnabled:!0,controlsAboveOverlay:!1,allowTouchScrolling:!1,viewportTransform:[...Ne],patternQuality:"best"};var j_=js({capitalize:()=>R_,escapeXml:()=>_t,graphemeSplit:()=>Uu});const R_=(n,e=!1)=>`${n.charAt(0).toUpperCase()}${e?n.slice(1):n.slice(1).toLowerCase()}`,_t=n=>n.toString().replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">");let Jr;const Uu=n=>{if(Jr||Jr||(Jr="Intl"in Ql()&&"Segmenter"in Intl&&new Intl.Segmenter(void 0,{granularity:"grapheme"})),Jr){let e=Jr.segment(n);return Array.from(e).map(({segment:a})=>a)}return z_(n)},z_=n=>{let e=[];for(let a,r=0;r<n.length;r++)(a=N_(n,r))!==!1&&e.push(a);return e},N_=(n,e)=>{let a=n.charCodeAt(e);if(isNaN(a))return"";if(a<55296||a>57343)return n.charAt(e);if(55296<=a&&a<=56319){if(n.length<=e+1)throw"High surrogate without following low surrogate";let o=n.charCodeAt(e+1);if(56320>o||o>57343)throw"High surrogate without following low surrogate";return n.charAt(e)+n.charAt(e+1)}if(e===0)throw"Low surrogate without preceding high surrogate";let r=n.charCodeAt(e-1);if(55296>r||r>56319)throw"Low surrogate without preceding high surrogate";return!1};var jd=class Ny extends _y(Cy){get lowerCanvasEl(){var e;return(e=this.elements.lower)==null?void 0:e.el}get contextContainer(){var e;return(e=this.elements.lower)==null?void 0:e.ctx}static getDefaults(){return Ny.ownDefaults}constructor(e,a={}){super(),Object.assign(this,this.constructor.getDefaults()),this.set(a),this.initElements(e),this._setDimensionsImpl({width:this.width||this.elements.lower.el.width||0,height:this.height||this.elements.lower.el.height||0}),this.skipControlsDrawing=!1,this.viewportTransform=[...this.viewportTransform],this.calcViewportBoundaries()}initElements(e){this.elements=new zy(e)}add(...e){let a=super.add(...e);return e.length>0&&this.renderOnAddRemove&&this.requestRenderAll(),a}insertAt(e,...a){let r=super.insertAt(e,...a);return a.length>0&&this.renderOnAddRemove&&this.requestRenderAll(),r}remove(...e){let a=super.remove(...e);return a.length>0&&this.renderOnAddRemove&&this.requestRenderAll(),a}_onObjectAdded(e){e.canvas&&e.canvas!==this&&(tn("warn",`Canvas is trying to add an object that belongs to a different canvas.
|
|
11
|
+
Resulting to default behavior: removing object from previous canvas and adding to new canvas`),e.canvas.remove(e)),e._set("canvas",this),e.setCoords(),this.fire("object:added",{target:e}),e.fire("added",{target:this})}_onObjectRemoved(e){e._set("canvas",void 0),this.fire("object:removed",{target:e}),e.fire("removed",{target:this})}_onStackOrderChanged(){this.renderOnAddRemove&&this.requestRenderAll()}getRetinaScaling(){return this.enableRetinaScaling?dy():1}calcOffset(){return this._offset=this.elements.calcOffset()}getWidth(){return this.width}getHeight(){return this.height}_setDimensionsImpl(e,{cssOnly:a=!1,backstoreOnly:r=!1}={}){if(!a){let o={width:this.width,height:this.height,...e};this.elements.setDimensions(o,this.getRetinaScaling()),this.hasLostContext=!0,this.width=o.width,this.height=o.height}r||this.elements.setCSSDimensions(e),this.calcOffset()}setDimensions(e,a){this._setDimensionsImpl(e,a),a&&a.cssOnly||this.requestRenderAll()}getZoom(){return Ed(this.viewportTransform)}setViewportTransform(e){this.viewportTransform=e,this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll()}zoomToPoint(e,a){let r=e,o=[...this.viewportTransform],u=we(e,ii(o));o[0]=a,o[3]=a;let h=we(u,o);o[4]+=r.x-h.x,o[5]+=r.y-h.y,this.setViewportTransform(o)}setZoom(e){this.zoomToPoint(new H(0,0),e)}absolutePan(e){let a=[...this.viewportTransform];return a[4]=-e.x,a[5]=-e.y,this.setViewportTransform(a)}relativePan(e){return this.absolutePan(new H(-e.x-this.viewportTransform[4],-e.y-this.viewportTransform[5]))}getElement(){return this.elements.lower.el}clearContext(e){e.clearRect(0,0,this.width,this.height)}getContext(){return this.elements.lower.ctx}clear(){this.remove(...this.getObjects()),this.backgroundImage=void 0,this.overlayImage=void 0,this.backgroundColor="",this.overlayColor="",this.clearContext(this.getContext()),this.fire("canvas:cleared"),this.renderOnAddRemove&&this.requestRenderAll()}renderAll(){this.cancelRequestedRender(),this.destroyed||this.renderCanvas(this.getContext(),this._objects)}renderAndReset(){this.nextRenderHandle=0,this.renderAll()}requestRenderAll(){this.nextRenderHandle||this.disposed||this.destroyed||(this.nextRenderHandle=Cs(()=>this.renderAndReset()))}calcViewportBoundaries(){let e=this.width,a=this.height,r=ii(this.viewportTransform),o=we({x:0,y:0},r),u=we({x:e,y:a},r),h=o.min(u),d=o.max(u);return this.vptCoords={tl:h,tr:new H(d.x,h.y),bl:new H(h.x,d.y),br:d}}cancelRequestedRender(){this.nextRenderHandle&&(Ty(this.nextRenderHandle),this.nextRenderHandle=0)}drawControls(e){}renderCanvas(e,a){if(this.destroyed)return;let r=this.viewportTransform,o=this.clipPath;this.calcViewportBoundaries(),this.clearContext(e),e.imageSmoothingEnabled=this.imageSmoothingEnabled,e.patternQuality=this.patternQuality,this.fire("before:render",{ctx:e}),this._renderBackground(e),e.save(),e.transform(r[0],r[1],r[2],r[3],r[4],r[5]),this._renderObjects(e,a),e.restore(),this.controlsAboveOverlay||this.skipControlsDrawing||this.drawControls(e),o&&(o._set("canvas",this),o.shouldCache(),o._transformDone=!0,o.renderCache({forClipping:!0}),this.drawClipPathOnCanvas(e,o)),this._renderOverlay(e),this.controlsAboveOverlay&&!this.skipControlsDrawing&&this.drawControls(e),this.fire("after:render",{ctx:e}),this.__cleanupTask&&(this.__cleanupTask(),this.__cleanupTask=void 0)}drawClipPathOnCanvas(e,a){let r=this.viewportTransform;e.save(),e.transform(...r),e.globalCompositeOperation="destination-in",a.transform(e),e.scale(1/a.zoomX,1/a.zoomY),e.drawImage(a._cacheCanvas,-a.cacheTranslationX,-a.cacheTranslationY),e.restore()}_renderObjects(e,a){for(let r=0,o=a.length;r<o;++r)a[r]&&a[r].render(e)}_renderBackgroundOrOverlay(e,a){let r=this[`${a}Color`],o=this[`${a}Image`],u=this.viewportTransform,h=this[`${a}Vpt`];if(!r&&!o)return;let d=yi(r);if(r){if(e.save(),e.beginPath(),e.moveTo(0,0),e.lineTo(this.width,0),e.lineTo(this.width,this.height),e.lineTo(0,this.height),e.closePath(),e.fillStyle=d?r.toLive(e):r,h&&e.transform(...u),d){e.transform(1,0,0,1,r.offsetX||0,r.offsetY||0);let g=r.gradientTransform||r.patternTransform;g&&e.transform(...g)}e.fill(),e.restore()}if(o){e.save();let{skipOffscreen:g}=this;this.skipOffscreen=h,h&&e.transform(...u),o.render(e),this.skipOffscreen=g,e.restore()}}_renderBackground(e){this._renderBackgroundOrOverlay(e,"background")}_renderOverlay(e){this._renderBackgroundOrOverlay(e,"overlay")}getCenterPoint(){return new H(this.width/2,this.height/2)}centerObjectH(e){return this._centerObject(e,new H(this.getCenterPoint().x,e.getCenterPoint().y))}centerObjectV(e){return this._centerObject(e,new H(e.getCenterPoint().x,this.getCenterPoint().y))}centerObject(e){return this._centerObject(e,this.getCenterPoint())}viewportCenterObject(e){return this._centerObject(e,this.getVpCenter())}viewportCenterObjectH(e){return this._centerObject(e,new H(this.getVpCenter().x,e.getCenterPoint().y))}viewportCenterObjectV(e){return this._centerObject(e,new H(e.getCenterPoint().x,this.getVpCenter().y))}getVpCenter(){return we(this.getCenterPoint(),ii(this.viewportTransform))}_centerObject(e,a){e.setXY(a,Ft,Ft),e.setCoords(),this.renderOnAddRemove&&this.requestRenderAll()}toDatalessJSON(e){return this.toDatalessObject(e)}toObject(e){return this._toObjectMethod("toObject",e)}toJSON(){return this.toObject()}toDatalessObject(e){return this._toObjectMethod("toDatalessObject",e)}_toObjectMethod(e,a){let r=this.clipPath,o=r&&!r.excludeFromExport?this._toObject(r,e,a):null;return{version:Qf,...Fn(this,a),objects:this._objects.filter(u=>!u.excludeFromExport).map(u=>this._toObject(u,e,a)),...this.__serializeBgOverlay(e,a),...o?{clipPath:o}:null}}_toObject(e,a,r){let o;this.includeDefaultValues||(o=e.includeDefaultValues,e.includeDefaultValues=!1);let u=e[a](r);return this.includeDefaultValues||(e.includeDefaultValues=!!o),u}__serializeBgOverlay(e,a){let r={},o=this.backgroundImage,u=this.overlayImage,h=this.backgroundColor,d=this.overlayColor;return yi(h)?h.excludeFromExport||(r.background=h.toObject(a)):h&&(r.background=h),yi(d)?d.excludeFromExport||(r.overlay=d.toObject(a)):d&&(r.overlay=d),o&&!o.excludeFromExport&&(r.backgroundImage=this._toObject(o,e,a)),u&&!u.excludeFromExport&&(r.overlayImage=this._toObject(u,e,a)),r}toSVG(e={},a){e.reviver=a;let r=[];var o;return this._setSVGPreamble(r,e),this._setSVGHeader(r,e),this.clipPath&&r.push(`<g clip-path="url(#${_t((o=this.clipPath.clipPathId)==null?"":o)})" >
|
|
12
|
+
`),this._setSVGBgOverlayColor(r,"background"),this._setSVGBgOverlayImage(r,"backgroundImage",a),this._setSVGObjects(r,a),this.clipPath&&r.push(`</g>
|
|
13
|
+
`),this._setSVGBgOverlayColor(r,"overlay"),this._setSVGBgOverlayImage(r,"overlayImage",a),r.push("</svg>"),r.join("")}_setSVGPreamble(e,a){a.suppressPreamble||e.push('<?xml version="1.0" encoding="',a.encoding||"UTF-8",`" standalone="no" ?>
|
|
14
|
+
`,'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ',`"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
15
|
+
`)}_setSVGHeader(e,a){let r=a.width||`${this.width}`,o=a.height||`${this.height}`,u=Yt.NUM_FRACTION_DIGITS,h=a.viewBox,d;if(h)d=`viewBox="${h.x} ${h.y} ${h.width} ${h.height}" `;else if(this.svgViewportTransformation){let g=this.viewportTransform;d=`viewBox="${Vt(-g[4]/g[0],u)} ${Vt(-g[5]/g[3],u)} ${Vt(this.width/g[0],u)} ${Vt(this.height/g[3],u)}" `}else d=`viewBox="0 0 ${this.width} ${this.height}" `;e.push("<svg ",'xmlns="http://www.w3.org/2000/svg" ','xmlns:xlink="http://www.w3.org/1999/xlink" ','version="1.1" ','width="',r,'" ','height="',o,'" ',d,`xml:space="preserve">
|
|
16
|
+
`,"<desc>Created with Fabric.js ",Qf,`</desc>
|
|
17
|
+
`,`<defs>
|
|
18
|
+
`,this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),this.createSVGClipPathMarkup(a),`</defs>
|
|
19
|
+
`)}createSVGClipPathMarkup(e){let a=this.clipPath;return a?(a.clipPathId=`CLIPPATH_${en()}`,`<clipPath id="${a.clipPathId}" >
|
|
20
|
+
${a.toClipPathSVG(e.reviver)}</clipPath>
|
|
21
|
+
`):""}createSVGRefElementsMarkup(){return["background","overlay"].map(e=>{let a=this[`${e}Color`];if(yi(a)){let r=this[`${e}Vpt`],o=this.viewportTransform,u={isType:()=>!1,width:this.width/(r?o[0]:1),height:this.height/(r?o[3]:1)};return a.toSVG(u,{additionalTransform:r?Wl(o):""})}}).join("")}createSVGFontFacesMarkup(){let e=[],a={},r=Yt.fontPaths;this._objects.forEach(function u(h){e.push(h),Tu(h)&&h._objects.forEach(u)}),e.forEach(u=>{if(!(h=u)||typeof h._renderText!="function")return;var h;let{styles:d,fontFamily:g}=u;!a[g]&&r[g]&&(a[g]=!0,d&&Object.values(d).forEach(m=>{Object.values(m).forEach(({fontFamily:p=""})=>{!a[p]&&r[p]&&(a[p]=!0)})}))});let o=Object.keys(a).map(u=>` @font-face {
|
|
22
|
+
font-family: '${u}';
|
|
23
|
+
src: url('${r[u]}');
|
|
24
|
+
}
|
|
25
|
+
`).join("");return o?` <style type="text/css"><![CDATA[
|
|
26
|
+
${o}]]></style>
|
|
27
|
+
`:""}_setSVGObjects(e,a){this.forEachObject(r=>{r.excludeFromExport||this._setSVGObject(e,r,a)})}_setSVGObject(e,a,r){e.push(a.toSVG(r))}_setSVGBgOverlayImage(e,a,r){let o=this[a];o&&!o.excludeFromExport&&o.toSVG&&e.push(o.toSVG(r))}_setSVGBgOverlayColor(e,a){let r=this[`${a}Color`];if(r)if(yi(r)){let o=r.repeat||"",u=this.width,h=this.height,d=this[`${a}Vpt`]?Wl(ii(this.viewportTransform)):"";e.push(`<rect transform="${d} translate(${u/2},${h/2})" x="${r.offsetX-u/2}" y="${r.offsetY-h/2}" width="${o!=="repeat-y"&&o!=="no-repeat"||!Hv(r)?u:r.source.width}" height="${o!=="repeat-x"&&o!=="no-repeat"||!Hv(r)?h:r.source.height}" fill="url(#SVGID_${r.id})"></rect>
|
|
28
|
+
`)}else e.push('<rect x="0" y="0" width="100%" height="100%" ','fill="',r,'"',`></rect>
|
|
29
|
+
`)}loadFromJSON(e,a,{signal:r}={}){if(!e)return Promise.reject(new Qi("`json` is undefined"));let{objects:o=[],...u}=typeof e=="string"?JSON.parse(e):e,{backgroundImage:h,background:d,overlayImage:g,overlay:m,clipPath:p}=u,y=this.renderOnAddRemove;return this.renderOnAddRemove=!1,Promise.all([Il(o,{reviver:a,signal:r}),zs({backgroundImage:h,backgroundColor:d,overlayImage:g,overlayColor:m,clipPath:p},{signal:r})]).then(([b,S])=>(this.clear(),this.add(...b),this.set(u),this.set(S),this.renderOnAddRemove=y,this))}clone(e){let a=this.toObject(e);return this.cloneWithoutData().loadFromJSON(a)}cloneWithoutData(){let e=ai(this);return new this.constructor(e)}toDataURL(e={}){let{format:a="png",quality:r=1,multiplier:o=1,enableRetinaScaling:u=!1}=e,h=o*(u?this.getRetinaScaling():1);return Td(this.toCanvasElement(h,e),a,r)}toBlob(e={}){let{format:a="png",quality:r=1,multiplier:o=1,enableRetinaScaling:u=!1}=e,h=o*(u?this.getRetinaScaling():1);return wd(this.toCanvasElement(h,e),a,r)}toCanvasElement(e=1,{width:a,height:r,left:o,top:u,filter:h}={}){let d=(a||this.width)*e,g=(r||this.height)*e,m=this.getZoom(),p=this.width,y=this.height,b=this.skipControlsDrawing,S=m*e,_=this.viewportTransform,w=[S,0,0,S,(_[4]-(o||0))*e,(_[5]-(u||0))*e],R=this.enableRetinaScaling,Y=ai({width:d,height:g}),X=h?this._objects.filter(q=>h(q)):this._objects;return this.enableRetinaScaling=!1,this.viewportTransform=w,this.width=d,this.height=g,this.skipControlsDrawing=!0,this.calcViewportBoundaries(),this.renderCanvas(Y.getContext("2d"),X),this.viewportTransform=_,this.width=p,this.height=y,this.calcViewportBoundaries(),this.enableRetinaScaling=R,this.skipControlsDrawing=b,Y}dispose(){return!this.disposed&&this.elements.cleanupDOM({width:this.width,height:this.height}),Au.cancelByCanvas(this),this.disposed=!0,new Promise((e,a)=>{let r=()=>{this.destroy(),e(!0)};r.kill=a,this.__cleanupTask&&this.__cleanupTask.kill("aborted"),this.destroyed?e(!1):this.nextRenderHandle?this.__cleanupTask=r:r()})}destroy(){this.destroyed=!0,this.cancelRequestedRender(),this.forEachObject(e=>e.dispose()),this._objects=[],this.backgroundImage&&this.backgroundImage.dispose(),this.backgroundImage=void 0,this.overlayImage&&this.overlayImage.dispose(),this.overlayImage=void 0,this.elements.dispose()}toString(){return`#<Canvas (${this.complexity()}): { objects: ${this._objects.length} }>`}};D(jd,"ownDefaults",A_);const k_=["touchstart","touchmove","touchend"],ky=n=>{let e=Ay(n.target),a=(function(r){let o=r.changedTouches;return o&&o[0]?o[0]:r})(n);return new H(a.clientX+e.left,a.clientY+e.top)},ju=n=>k_.includes(n.type)||n.pointerType==="touch",Uv=n=>{n.preventDefault(),n.stopPropagation()},Ki=n=>{let e=0,a=0,r=0,o=0;for(let u=0,h=n.length;u<h;u++){let{x:d,y:g}=n[u];(d>r||!u)&&(r=d),(d<e||!u)&&(e=d),(g>o||!u)&&(o=g),(g<a||!u)&&(a=g)}return{left:e,top:a,width:r-e,height:o-a}},B_=(n,e)=>{Zl(n,$t(ii(e),n.calcOwnMatrix()))},By=(n,e)=>Zl(n,$t(e,n.calcOwnMatrix())),Zl=(n,e)=>{let{translateX:a,translateY:r,scaleX:o,scaleY:u,...h}=Kl(e),d=new H(a,r);n.flipX=!1,n.flipY=!1,Object.assign(n,h),n.set({scaleX:o,scaleY:u}),n.setPositionByOrigin(d,Ft,Ft)},Ly=n=>{n.scaleX=1,n.scaleY=1,n.skewX=0,n.skewY=0,n.flipX=!1,n.flipY=!1,n.rotate(0)},Rd=n=>({scaleX:n.scaleX,scaleY:n.scaleY,skewX:n.skewX,skewY:n.skewY,angle:n.angle,left:n.left,flipX:n.flipX,flipY:n.flipY,top:n.top}),Xu=(n,e,a)=>{let r=n/2,o=e/2,u=Ki([new H(-r,-o),new H(r,-o),new H(-r,o),new H(r,o)].map(h=>h.transform(a)));return new H(u.width,u.height)},Ns=(n=Ne,e=Ne)=>$t(ii(e),n),pa=(n,e=Ne,a=Ne)=>n.transform(Ns(e,a)),Hy=(n,e=Ne,a=Ne)=>n.transform(Ns(e,a),!0),zd=(n,e,a)=>{let r=Ns(e,a);return Zl(n,$t(r,n.calcOwnMatrix())),r},L_={left:-.5,top:-.5,center:0,bottom:.5,right:.5},Re=n=>typeof n=="string"?L_[n]:n-.5,H_=new H(1,0),Yy=new H,Nd=(n,e)=>n.rotate(e),Ds=(n,e)=>new H(e).subtract(n),Ru=n=>n.distanceFrom(Yy),zu=(n,e)=>Math.atan2(Pl(n,e),Uy(n,e)),kd=n=>zu(H_,n),Vu=n=>n.eq(Yy)?n:n.scalarDivide(Ru(n)),Bd=(n,e=!0)=>Vu(new H(-n.y,n.x).scalarMultiply(e?1:-1)),Pl=(n,e)=>n.x*e.y-n.y*e.x,Uy=(n,e)=>n.x*e.x+n.y*e.y,If=(n,e,a)=>{if(n.eq(e)||n.eq(a))return!0;let r=Pl(e,a),o=Pl(e,n),u=Pl(a,n);return r>=0?o>=0&&u<=0:!(o<=0&&u>=0)},Ld="not-allowed";function Xy(n){return Re(n.originX)===Re("center")&&Re(n.originY)===Re("center")}function Xv(n){return .5-Re(n)}const Mi=(n,e)=>n[e],Hd=(n,e,a,r)=>({e:n,transform:e,pointer:new H(a,r)});function Vy(n,e,a){let r=a,o=kd(Ds(pa(n.getCenterPoint(),n.canvas.viewportTransform,void 0),r))+Ai;return Math.round(o%Ai/O_)}function Fu({target:n,corner:e},a,r,o,u){var h;let d=n.controls[e],g=((h=n.canvas)==null?void 0:h.getZoom())||1,m=n.padding/g,p=(function(y,b,S,_){let w=y.getRelativeCenterPoint(),R=S!==void 0&&_!==void 0?y.translateToGivenOrigin(w,Ft,Ft,S,_):new H(y.left,y.top);return(y.angle?b.rotate(-It(y.angle),w):b).subtract(R)})(n,new H(o,u),a,r);return p.x>=m&&(p.x-=m),p.x<=-m&&(p.x+=m),p.y>=m&&(p.y-=m),p.y<=m&&(p.y+=m),p.x-=d.offsetX,p.y-=d.offsetY,p}const Y_=new RegExp(String.raw`[\0-\x1F\x7F;<>\\]|\/\*|\*\/|url\s*\(|expression\s*\(|(?:java|vb)script\s*:|data\s*:|@import\b`,"iu"),Gu=n=>typeof n=="string"&&n.trim().length>0&&!Y_.test(n),kn=(n,e="")=>{let a=Number(n);return Number.isFinite(a)?`${a}`:e},Bn=(n,e="")=>typeof n=="string"&&Gu(n)?n:e,Nu=n=>n.replace(/\s+/g," "),Vv={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#0FF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000",blanchedalmond:"#FFEBCD",blue:"#00F",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#0FF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#F0F",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#789",lightslategrey:"#789",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#0F0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#F0F",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#639",red:"#F00",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFF",whitesmoke:"#F5F5F5",yellow:"#FF0",yellowgreen:"#9ACD32"},Yf=(n,e,a)=>(a<0&&(a+=1),a>1&&--a,a<1/6?n+6*(e-n)*a:a<.5?e:a<2/3?n+(e-n)*(2/3-a)*6:n),Fv=(n,e,a,r)=>{n/=255,e/=255,a/=255;let o=Math.max(n,e,a),u=Math.min(n,e,a),h,d,g=(o+u)/2;if(o===u)h=d=0;else{let m=o-u;switch(d=g>.5?m/(2-o-u):m/(o+u),o){case n:h=(e-a)/m+(e<a?6:0);break;case e:h=(a-n)/m+2;break;case a:h=(n-e)/m+4}h/=6}return[Math.round(360*h),Math.round(100*d),Math.round(100*g),r]},Gv=(n="1")=>parseFloat(n)/(n.endsWith("%")?100:1),fu=n=>Math.min(Math.round(n),255).toString(16).toUpperCase().padStart(2,"0"),qv=([n,e,a,r=1])=>{let o=Math.round(.3*n+.59*e+.11*a);return[o,o,o,r]};var ni=class Te{constructor(e){if(D(this,"isUnrecognised",!1),e)if(e instanceof Te)this.setSource([...e._source]);else if(Array.isArray(e)){let[a,r,o,u=1]=e;this.setSource([a,r,o,u])}else this.setSource(this._tryParsingColor(e));else this.setSource([0,0,0,1])}_tryParsingColor(e){return(e=e.toLowerCase())in Vv&&(e=Vv[e]),e==="transparent"?[255,255,255,0]:Te.sourceFromHex(e)||Te.sourceFromRgb(e)||Te.sourceFromHsl(e)||(this.isUnrecognised=!0)&&[0,0,0,1]}getSource(){return this._source}setSource(e){this._source=e}toRgb(){let[e,a,r]=this.getSource();return`rgb(${e},${a},${r})`}toRgba(){return`rgba(${this.getSource().join(",")})`}toHsl(){let[e,a,r]=Fv(...this.getSource());return`hsl(${e},${a}%,${r}%)`}toHsla(){let[e,a,r,o]=Fv(...this.getSource());return`hsla(${e},${a}%,${r}%,${o})`}toHex(){return this.toHexa().slice(0,6)}toHexa(){let[e,a,r,o]=this.getSource();return`${fu(e)}${fu(a)}${fu(r)}${fu(Math.round(255*o))}`}getAlpha(){return this.getSource()[3]}setAlpha(e){return this._source[3]=e,this}toGrayscale(){return this.setSource(qv(this.getSource())),this}toBlackWhite(e){let[a,,,r]=qv(this.getSource()),o=a<(e||127)?0:255;return this.setSource([o,o,o,r]),this}overlayWith(e){e instanceof Te||(e=new Te(e));let a=this.getSource(),r=e.getSource(),[o,u,h]=a.map((d,g)=>Math.round(.5*d+.5*r[g]));return this.setSource([o,u,h,a[3]]),this}static fromRgb(e){return Te.fromRgba(e)}static fromRgba(e){return new Te(Te.sourceFromRgb(e))}static sourceFromRgb(e){let a=Nu(e).match(/^rgba?\(\s?(\d{0,3}(?:\.\d+)?%?)\s?[\s|,]\s?(\d{0,3}(?:\.\d+)?%?)\s?[\s|,]\s?(\d{0,3}(?:\.\d+)?%?)\s?(?:\s?[,/]\s?(\d{0,3}(?:\.\d+)?%?)\s?)?\)$/i);if(a){let[r,o,u]=a.slice(1,4).map(h=>{let d=parseFloat(h);return h.endsWith("%")?Math.round(2.55*d):d});return[r,o,u,Gv(a[4])]}}static fromHsl(e){return Te.fromHsla(e)}static fromHsla(e){return new Te(Te.sourceFromHsl(e))}static sourceFromHsl(e){let a=Nu(e).match(/^hsla?\(\s?([+-]?\d{0,3}(?:\.\d+)?(?:deg|turn|rad)?)\s?[\s|,]\s?(\d{0,3}(?:\.\d+)?%?)\s?[\s|,]\s?(\d{0,3}(?:\.\d+)?%?)\s?(?:\s?[,/]\s?(\d*(?:\.\d+)?%?)\s?)?\)$/i);if(!a)return;let r=(Te.parseAngletoDegrees(a[1])%360+360)%360/360,o=parseFloat(a[2])/100,u=parseFloat(a[3])/100,h,d,g;if(o===0)h=d=g=u;else{let m=u<=.5?u*(o+1):u+o-u*o,p=2*u-m;h=Yf(p,m,r+1/3),d=Yf(p,m,r),g=Yf(p,m,r-1/3)}return[Math.round(255*h),Math.round(255*d),Math.round(255*g),Gv(a[4])]}static fromHex(e){return new Te(Te.sourceFromHex(e))}static sourceFromHex(e){if(e.match(/^#?(([0-9a-f]){3,4}|([0-9a-f]{2}){3,4})$/i)){let a=e.slice(e.indexOf("#")+1),r;r=a.length<=4?a.split("").map(g=>g+g):a.match(/.{2}/g);let[o,u,h,d=255]=r.map(g=>parseInt(g,16));return[o,u,h,d/255]}}static parseAngletoDegrees(e){let a=e.toLowerCase(),r=parseFloat(a);return a.includes("rad")?ma(r):a.includes("turn")?360*r:r}};const U_=n=>{let e=["instantiated_by_use","style","id","class"];switch(n){case"linearGradient":return e.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);case"radialGradient":return e.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);case"stop":return e.concat(["offset","stop-color","stop-opacity"])}return e},Yn=(n,e=16)=>{let a=/\D{0,2}$/.exec(n),r=parseFloat(n),o=Yt.DPI;switch(a?.[0]){case"mm":return r*o/25.4;case"cm":return r*o/2.54;case"in":return r*o;case"pt":return r*o/72;case"pc":return r*o/72*12;case"em":return r*e;default:return r}},Fy=n=>{let[e,a]=n.trim().split(" "),[r,o]=(u=e)&&u!=="none"?[u.slice(1,4),u.slice(5,8)]:u==="none"?[u,u]:["Mid","Mid"];var u;return{meetOrSlice:a||"meet",alignX:r,alignY:o}},Ms=(n,e,a=!0)=>{let r,o;if(e)if(e.toLive)r=`url(#SVGID_${_t(e.id)})`;else{let u=String(e);if(Gu(u)){let h=new ni(u),d=h.getAlpha();r=h.toRgb(),d!==1&&(o=d.toString())}else r=new ni("black").toRgb()}else r="none";return a?`${n}: ${r}; ${o?`${n}-opacity: ${o}; `:""}`:`${n}="${r}" ${o?`${n}-opacity="${o}" `:""}`};var Gy=class{getSvgStyles(n){let e=this.fillRule==null?"nonzero":Bn(this.fillRule),a=this.strokeWidth==null?"0":kn(this.strokeWidth),r=this.strokeDashArray==null?Bu:this.strokeDashArray.every(b=>Number.isFinite(Number(b)))?this.strokeDashArray.join(" "):"",o=this.strokeDashOffset==null?"0":kn(this.strokeDashOffset),u=this.strokeLineCap==null?"butt":Bn(this.strokeLineCap),h=this.strokeLineJoin==null?"miter":Bn(this.strokeLineJoin),d=this.strokeMiterLimit==null?"4":kn(this.strokeMiterLimit),g=this.opacity==null?"1":kn(this.opacity),m=this.visible?"":" visibility: hidden;",p=n?"":this.getSvgFilter(),y=Ms(Xe,this.fill);return[Ms(ga,this.stroke),a?`stroke-width: ${a}; `:"",r?`stroke-dasharray: ${r}; `:"",u?`stroke-linecap: ${u}; `:"",o?`stroke-dashoffset: ${o}; `:"",h?`stroke-linejoin: ${h}; `:"",d?`stroke-miterlimit: ${d}; `:"",y,e?`fill-rule: ${e}; `:"",g?`opacity: ${g};`:"",p,m].map(b=>_t(b)).join("")}getSvgFilter(){return this.shadow?`filter: url(#SVGID_${_t(this.shadow.id)});`:""}getSvgCommons(){return[this.id?`id="${_t(String(this.id))}" `:"",this.clipPath?`clip-path="url(#${_t(this.clipPath.clipPathId)})" `:""].join("")}getSvgTransform(n,e=""){return`transform="${Wl(n?this.calcTransformMatrix():this.calcOwnMatrix())}${e}" `}_toSVG(n){return[""]}toSVG(n){return this._createBaseSVGMarkup(this._toSVG(n),{reviver:n})}toClipPathSVG(n){return" "+this._createBaseClipPathSVGMarkup(this._toSVG(n),{reviver:n})}_createBaseClipPathSVGMarkup(n,{reviver:e,additionalTransform:a=""}={}){let r=[this.getSvgTransform(!0,a),this.getSvgCommons()].join(""),o=n.indexOf("COMMON_PARTS");return n[o]=r,e?e(n.join("")):n.join("")}_createBaseSVGMarkup(n,{noStyle:e,reviver:a,withShadow:r,additionalTransform:o}={}){let u=e?"":`style="${this.getSvgStyles()}" `,h=r?`style="${this.getSvgFilter()}" `:"",d=this.clipPath,g=this.strokeUniform?'vector-effect="non-scaling-stroke" ':"",m=d&&d.absolutePositioned,p=this.stroke,y=this.fill,b=this.shadow,S=[],_=n.indexOf("COMMON_PARTS"),w;return d&&(d.clipPathId=`CLIPPATH_${en()}`,w=`<clipPath id="${d.clipPathId}" >
|
|
30
|
+
${d.toClipPathSVG(a)}</clipPath>
|
|
31
|
+
`),m&&S.push("<g ",h,this.getSvgCommons(),` >
|
|
32
|
+
`),S.push("<g ",this.getSvgTransform(!1),m?"":h+this.getSvgCommons(),` >
|
|
33
|
+
`),n[_]=[u,g,e?"":this.addPaintOrder()," ",o?`transform="${o}" `:""].join(""),yi(y)&&S.push(y.toSVG(this)),yi(p)&&S.push(p.toSVG(this)),b&&S.push(b.toSVG(this)),d&&S.push(w),S.push(n.join("")),S.push(`</g>
|
|
34
|
+
`),m&&S.push(`</g>
|
|
35
|
+
`),a?a(S.join("")):S.join("")}addPaintOrder(){return this.paintFirst==="fill"?"":` paint-order="${_t(this.paintFirst)}" `}};function qu(n){return RegExp("^("+n.join("|")+")\\b","i")}const $l="textDecorationThickness",Pu="textDecorationColor",qy=["fontSize","fontWeight","fontFamily","fontStyle"],Py=["underline","overline","linethrough"],Qy=[...qy,"lineHeight","text","charSpacing","textAlign","styles","path","pathStartOffset","pathSide","pathAlign"],Ky=[...Qy,...Py,"textBackgroundColor","direction",$l,Pu],X_=[...qy,...Py,ga,"strokeWidth",Xe,"deltaY","textBackgroundColor",$l,Pu],V_={_reNewline:_d,_reSpacesAndTabs:/[ \t\r]/g,_reSpaceAndTab:/[ \t\r]/,_reWords:/\S+/g,fontSize:40,fontWeight:Bv,fontFamily:"Times New Roman",underline:!1,overline:!1,linethrough:!1,textAlign:de,fontStyle:Bv,lineHeight:1.16,textBackgroundColor:"",stroke:null,shadow:null,path:void 0,pathStartOffset:0,pathSide:de,pathAlign:"baseline",charSpacing:0,deltaY:0,direction:"ltr",CACHE_FONT_SIZE:400,MIN_TEXT_WIDTH:2,superscript:{size:.6,baseline:-.35},subscript:{size:.6,baseline:.11},_fontSizeFraction:.222,offsets:{underline:.1,linethrough:-.28167,overline:-.81333},_fontSizeMult:1.13,[$l]:66.667},Yd="justify",Un=String.raw`[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?`,F_=RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+Un+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+Un+"))?\\s+(.*)"),G_={cx:de,x:de,r:"radius",cy:"top",y:"top",display:"visible",visibility:"visible",transform:"transformMatrix","fill-opacity":"fillOpacity","fill-rule":"fillRule","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","letter-spacing":"charSpacing","paint-order":"paintFirst","stroke-dasharray":"strokeDashArray","stroke-dashoffset":"strokeDashOffset","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"textAnchor",opacity:"opacity","clip-path":"clipPath","clip-rule":"clipRule","vector-effect":"strokeUniform","image-rendering":"imageSmoothing","text-decoration-thickness":$l,"text-decoration-color":Pu},Pv="font-size",Qv="clip-path";qu(["path","circle","polygon","polyline","ellipse","rect","line","image","text"]);qu(["symbol","image","marker","pattern","view","svg"]);const Kv=qu(["symbol","g","a","svg","clipPath","defs"]),Iv="(-?\\d+(?:\\.\\d*)?(?:px)?(?:\\s?|$))?",Wv=RegExp("(?:\\s|^)"+Iv+Iv+"("+Un+"?(?:px)?)?(?:\\s?|$)(?:$|\\s)");var ws=class wu{constructor(e={}){let a=typeof e=="string"?wu.parseShadow(e):e;Object.assign(this,wu.ownDefaults,a),this.id=en()}static parseShadow(e){let a=e.trim(),[,r=0,o=0,u=0]=(Wv.exec(a)||[]).map(h=>parseFloat(h)||0);return{color:(a.replace(Wv,"")||"rgb(0,0,0)").trim(),offsetX:r,offsetY:o,blur:u}}toString(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")}toSVG(e){let a=Nd(new H(this.offsetX,this.offsetY),It(-e.angle)),r=Yt.NUM_FRACTION_DIGITS,o=new ni(this.color),u=40,h=40;return e.width&&e.height&&(u=100*Vt((Math.abs(a.x)+this.blur)/e.width,r)+20,h=100*Vt((Math.abs(a.y)+this.blur)/e.height,r)+20),e.flipX&&(a.x*=-1),e.flipY&&(a.y*=-1),`<filter id="SVGID_${_t(this.id)}" y="-${h}%" height="${100+2*h}%" x="-${u}%" width="${100+2*u}%" >
|
|
36
|
+
<feGaussianBlur in="SourceAlpha" stdDeviation="${Vt(this.blur?this.blur/2:0,r)}"></feGaussianBlur>
|
|
37
|
+
<feOffset dx="${Vt(a.x,r)}" dy="${Vt(a.y,r)}" result="oBlur" ></feOffset>
|
|
38
|
+
<feFlood flood-color="${o.toRgb()}" flood-opacity="${o.getAlpha()}"/>
|
|
39
|
+
<feComposite in2="oBlur" operator="in" />
|
|
40
|
+
<feMerge>
|
|
41
|
+
<feMergeNode></feMergeNode>
|
|
42
|
+
<feMergeNode in="SourceGraphic"></feMergeNode>
|
|
43
|
+
</feMerge>
|
|
44
|
+
</filter>
|
|
45
|
+
`}toObject(){let e={color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY,affectStroke:this.affectStroke,nonScaling:this.nonScaling,type:this.constructor.type},a=wu.ownDefaults;return this.includeDefaultValues?e:Ad(e,(r,o)=>r!==a[o])}static async fromObject(e){return new this(e)}};D(ws,"ownDefaults",{color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,nonScaling:!1}),D(ws,"type","shadow"),nt.setClass(ws,"shadow");const Xn=(n,e,a)=>Math.max(n,Math.min(e,a)),q_=["top",de,nn,ln,"flipX","flipY","originX","originY","angle","opacity","globalCompositeOperation","shadow","visible",tr,er],va=[Xe,ga,"strokeWidth","strokeDashArray","width","height","paintFirst","strokeUniform","strokeLineCap","strokeDashOffset","strokeLineJoin","strokeMiterLimit","backgroundColor","clipPath"],P_={top:0,left:0,width:0,height:0,angle:0,flipX:!1,flipY:!1,scaleX:1,scaleY:1,minScaleLimit:0,skewX:0,skewY:0,originX:Ft,originY:Ft,strokeWidth:1,strokeUniform:!1,padding:0,opacity:1,paintFirst:Xe,fill:"rgb(0,0,0)",fillRule:"nonzero",stroke:null,strokeDashArray:null,strokeDashOffset:0,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:4,globalCompositeOperation:"source-over",backgroundColor:"",shadow:null,visible:!0,includeDefaultValues:!0,excludeFromExport:!1,objectCaching:!0,clipPath:void 0,inverted:!1,absolutePositioned:!1,centeredRotation:!0,centeredScaling:!1,dirty:!0};var Q_=js({defaultEasing:()=>Wy,easeInBack:()=>mC,easeInBounce:()=>Zy,easeInCirc:()=>uC,easeInCubic:()=>K_,easeInElastic:()=>fC,easeInExpo:()=>rC,easeInOutBack:()=>vC,easeInOutBounce:()=>yC,easeInOutCirc:()=>hC,easeInOutCubic:()=>W_,easeInOutElastic:()=>gC,easeInOutExpo:()=>oC,easeInOutQuad:()=>SC,easeInOutQuart:()=>J_,easeInOutQuint:()=>iC,easeInOutSine:()=>lC,easeInQuad:()=>bC,easeInQuart:()=>Z_,easeInQuint:()=>tC,easeInSine:()=>aC,easeOutBack:()=>pC,easeOutBounce:()=>Xd,easeOutCirc:()=>cC,easeOutCubic:()=>I_,easeOutElastic:()=>dC,easeOutExpo:()=>sC,easeOutQuad:()=>xC,easeOutQuart:()=>$_,easeOutQuint:()=>eC,easeOutSine:()=>nC});const Ud=(n,e,a,r)=>(n<Math.abs(e)?(n=e,r=a/4):r=e===0&&n===0?a/Ai*Math.asin(1):a/Ai*Math.asin(e/n),{a:n,c:e,p:a,s:r}),Iy=(n,e,a,r,o)=>n*2**(10*--r)*Math.sin((r*o-e)*Ai/a),Wy=(n,e,a,r)=>-a*Math.cos(n/r*an)+a+e,K_=(n,e,a,r)=>a*(n/r)**3+e,I_=(n,e,a,r)=>a*((n/r-1)**3+1)+e,W_=(n,e,a,r)=>(n/=r/2)<1?a/2*n**3+e:a/2*((n-2)**3+2)+e,Z_=(n,e,a,r)=>a*(n/=r)*n**3+e,$_=(n,e,a,r)=>-a*((n=n/r-1)*n**3-1)+e,J_=(n,e,a,r)=>(n/=r/2)<1?a/2*n**4+e:-a/2*((n-=2)*n**3-2)+e,tC=(n,e,a,r)=>a*(n/r)**5+e,eC=(n,e,a,r)=>a*((n/r-1)**5+1)+e,iC=(n,e,a,r)=>(n/=r/2)<1?a/2*n**5+e:a/2*((n-2)**5+2)+e,aC=(n,e,a,r)=>-a*Math.cos(n/r*an)+a+e,nC=(n,e,a,r)=>a*Math.sin(n/r*an)+e,lC=(n,e,a,r)=>-a/2*(Math.cos(Math.PI*n/r)-1)+e,rC=(n,e,a,r)=>n===0?e:a*2**(10*(n/r-1))+e,sC=(n,e,a,r)=>n===r?e+a:a*-(2**(-10*n/r)+1)+e,oC=(n,e,a,r)=>n===0?e:n===r?e+a:(n/=r/2)<1?a/2*2**(10*(n-1))+e:a/2*-(2**(-10*(n-1))+2)+e,uC=(n,e,a,r)=>-a*(Math.sqrt(1-(n/=r)*n)-1)+e,cC=(n,e,a,r)=>a*Math.sqrt(1-(n=n/r-1)*n)+e,hC=(n,e,a,r)=>(n/=r/2)<1?-a/2*(Math.sqrt(1-n**2)-1)+e:a/2*(Math.sqrt(1-(n-=2)*n)+1)+e,fC=(n,e,a,r)=>{let o=a,u=0;if(n===0)return e;if((n/=r)===1)return e+a;u||(u=.3*r);let{a:h,s:d,p:g}=Ud(o,a,u,1.70158);return-Iy(h,d,g,n,r)+e},dC=(n,e,a,r)=>{let o=a,u=0;if(n===0)return e;if((n/=r)===1)return e+a;u||(u=.3*r);let{a:h,s:d,p:g,c:m}=Ud(o,a,u,1.70158);return h*2**(-10*n)*Math.sin((n*r-d)*Ai/g)+m+e},gC=(n,e,a,r)=>{let o=a,u=0;if(n===0)return e;if((n/=r/2)==2)return e+a;u||(u=.3*1.5*r);let{a:h,s:d,p:g,c:m}=Ud(o,a,u,1.70158);return n<1?-.5*Iy(h,d,g,n,r)+e:h*2**(-10*--n)*Math.sin((n*r-d)*Ai/g)*.5+m+e},mC=(n,e,a,r,o=1.70158)=>a*(n/=r)*n*((o+1)*n-o)+e,pC=(n,e,a,r,o=1.70158)=>a*((n=n/r-1)*n*((o+1)*n+o)+1)+e,vC=(n,e,a,r,o=1.70158)=>(n/=r/2)<1?a/2*(n*n*((1+(o*=1.525))*n-o))+e:a/2*((n-=2)*n*((1+(o*=1.525))*n+o)+2)+e,Xd=(n,e,a,r)=>(n/=r)<1/2.75?a*(7.5625*n*n)+e:n<2/2.75?a*(7.5625*(n-=1.5/2.75)*n+.75)+e:n<2.5/2.75?a*(7.5625*(n-=2.25/2.75)*n+.9375)+e:a*(7.5625*(n-=2.625/2.75)*n+.984375)+e,Zy=(n,e,a,r)=>a-Xd(r-n,0,a,r)+e,yC=(n,e,a,r)=>n<r/2?.5*Zy(2*n,0,a,r)+e:.5*Xd(2*n-r,0,a,r)+.5*a+e,bC=(n,e,a,r)=>a*(n/=r)*n+e,xC=(n,e,a,r)=>-a*(n/=r)*(n-2)+e,SC=(n,e,a,r)=>(n/=r/2)<1?a/2*n**2+e:-a/2*(--n*(n-2)-1)+e,_C=()=>!1;var Vd=class{constructor({startValue:n,byValue:e,duration:a=500,delay:r=0,easing:o=Wy,onStart:u=Cu,onChange:h=Cu,onComplete:d=Cu,abort:g=_C,target:m}){D(this,"_state","pending"),D(this,"durationProgress",0),D(this,"valueProgress",0),this.tick=this.tick.bind(this),this.duration=a,this.delay=r,this.easing=o,this._onStart=u,this._onChange=h,this._onComplete=d,this._abort=g,this.target=m,this.startValue=n,this.byValue=e,this.value=this.startValue,this.endValue=Object.freeze(this.calculate(this.duration).value)}get state(){return this._state}isDone(){return this._state==="aborted"||this._state==="completed"}start(){let n=e=>{this._state==="pending"&&(this.startTime=e||+new Date,this._state="running",this._onStart(),this.tick(this.startTime))};this.register(),this.delay>0?this.timeout=Ql().setTimeout(()=>Cs(n),this.delay):Cs(n)}tick(n){let e=(n||+new Date)-this.startTime,a=Math.min(e,this.duration);this.durationProgress=a/this.duration;let{value:r,valueProgress:o}=this.calculate(a);this.value=Object.freeze(r),this.valueProgress=o,this._state!=="aborted"&&(this._abort(this.value,this.valueProgress,this.durationProgress)?(this._state="aborted",this.unregister()):e>=this.duration?(this.durationProgress=this.valueProgress=1,this._onChange(this.endValue,this.valueProgress,this.durationProgress),this._state="completed",this._onComplete(this.endValue,this.valueProgress,this.durationProgress),this.unregister(),this.timeout=null):(this._onChange(this.value,this.valueProgress,this.durationProgress),Cs(this.tick)))}register(){Au.push(this)}unregister(){Au.remove(this)}abort(){this._state="aborted",this.unregister(),this.timeout&&Ql().clearTimeout(this.timeout)}},CC=class extends Vd{constructor({startValue:n=0,endValue:e=100,...a}){super({...a,startValue:n,byValue:e-n})}calculate(n){let e=this.easing(n,this.startValue,this.byValue,this.duration);return{value:e,valueProgress:Math.abs((e-this.startValue)/this.byValue)}}},TC=class extends Vd{constructor({startValue:n=[0],endValue:e=[100],...a}){super({...a,startValue:n,byValue:e.map((r,o)=>r-n[o])})}calculate(n){let e=this.startValue.map((a,r)=>this.easing(n,a,this.byValue[r],this.duration,r));return{value:e,valueProgress:Math.abs((e[0]-this.startValue[0])/this.byValue[0])}}};const wC=(n,e,a,r)=>e+a*(1-Math.cos(n/r*an)),Uf=n=>n&&((e,a,r)=>n(new ni(e).toRgba(),a,r));var OC=class extends Vd{constructor({startValue:n,endValue:e,easing:a=wC,onChange:r,onComplete:o,abort:u,...h}){let d=new ni(n).getSource(),g=new ni(e).getSource();super({...h,startValue:d,byValue:g.map((m,p)=>m-d[p]),easing:a,onChange:Uf(r),onComplete:Uf(o),abort:Uf(u)})}calculate(n){let[e,a,r,o]=this.startValue.map((h,d)=>this.easing(n,h,this.byValue[d],this.duration,d)),u=[...[e,a,r].map(Math.round),Xn(0,o,1)];return{value:u,valueProgress:u.map((h,d)=>this.byValue[d]===0?0:Math.abs((h-this.startValue[d])/this.byValue[d])).find(h=>h!==0)||0}}};function Fd(n){let e=(a=>Array.isArray(a.startValue)||Array.isArray(a.endValue))(n)?new TC(n):new CC(n);return e.start(),e}function $y(n){let e=new OC(n);return e.start(),e}var Os=class _e{constructor(e){this.status=e,this.points=[]}includes(e){return this.points.some(a=>a.eq(e))}append(...e){return this.points=this.points.concat(e.filter(a=>!this.includes(a))),this}static isPointContained(e,a,r,o=!1){if(a.eq(r))return e.eq(a);if(a.x===r.x)return e.x===a.x&&(o||e.y>=Math.min(a.y,r.y)&&e.y<=Math.max(a.y,r.y));if(a.y===r.y)return e.y===a.y&&(o||e.x>=Math.min(a.x,r.x)&&e.x<=Math.max(a.x,r.x));{let u=Ds(a,r),h=Ds(a,e).divide(u);return o?Math.abs(h.x)===Math.abs(h.y):h.x===h.y&&h.x>=0&&h.x<=1}}static isPointInPolygon(e,a){let r=new H(e).setX(Math.min(e.x-1,...a.map(u=>u.x))),o=0;for(let u=0;u<a.length;u++){let h=this.intersectSegmentSegment(a[u],a[(u+1)%a.length],e,r);if(h.includes(e))return!0;o+=+(h.status==="Intersection")}return o%2==1}static intersectLineLine(e,a,r,o,u=!0,h=!0){let d=a.x-e.x,g=a.y-e.y,m=o.x-r.x,p=o.y-r.y,y=e.x-r.x,b=e.y-r.y,S=m*b-p*y,_=d*b-g*y,w=p*d-m*g;if(w!==0){let R=S/w,Y=_/w;return(u||0<=R&&R<=1)&&(h||0<=Y&&Y<=1)?new _e("Intersection").append(new H(e.x+R*d,e.y+R*g)):new _e}return new _e(S===0||_===0?u||h||_e.isPointContained(e,r,o)||_e.isPointContained(a,r,o)||_e.isPointContained(r,e,a)||_e.isPointContained(o,e,a)?"Coincident":void 0:"Parallel")}static intersectSegmentLine(e,a,r,o){return _e.intersectLineLine(e,a,r,o,!1,!0)}static intersectSegmentSegment(e,a,r,o){return _e.intersectLineLine(e,a,r,o,!1,!1)}static intersectLinePolygon(e,a,r,o=!0){let u=new _e,h=r.length;for(let d,g,m,p=0;p<h;p++){if(d=r[p],g=r[(p+1)%h],m=_e.intersectLineLine(e,a,d,g,o,!1),m.status==="Coincident")return m;u.append(...m.points)}return u.points.length>0&&(u.status="Intersection"),u}static intersectSegmentPolygon(e,a,r){return _e.intersectLinePolygon(e,a,r,!1)}static intersectPolygonPolygon(e,a){let r=new _e,o=e.length,u=[];for(let h=0;h<o;h++){let d=e[h],g=e[(h+1)%o],m=_e.intersectSegmentPolygon(d,g,a);m.status==="Coincident"?(u.push(m),r.append(d,g)):r.append(...m.points)}return u.length>0&&u.length===e.length?new _e("Coincident"):(r.points.length>0&&(r.status="Intersection"),r)}static intersectPolygonRectangle(e,a,r){let o=a.min(r),u=a.max(r),h=new H(u.x,o.y),d=new H(o.x,u.y);return _e.intersectPolygonPolygon(e,[o,h,u,d])}},EC=class extends Cy{getX(){return this.getXY().x}setX(n){this.setXY(this.getXY().setX(n))}getY(){return this.getXY().y}setY(n){this.setXY(this.getXY().setY(n))}getRelativeX(){return this.left}setRelativeX(n){this.left=n}getRelativeY(){return this.top}setRelativeY(n){this.top=n}getXY(){let n=this.getRelativeXY();return this.group?we(n,this.group.calcTransformMatrix()):n}setXY(n,e,a){this.group&&(n=we(n,ii(this.group.calcTransformMatrix()))),this.setRelativeXY(n,e,a)}getRelativeXY(){return new H(this.left,this.top)}setRelativeXY(n,e=this.originX,a=this.originY){this.setPositionByOrigin(n,e,a)}isStrokeAccountedForInDimensions(){return!1}getCoords(){let{tl:n,tr:e,br:a,bl:r}=this.aCoords||(this.aCoords=this.calcACoords()),o=[n,e,a,r];if(this.group){let u=this.group.calcTransformMatrix();return o.map(h=>we(h,u))}return o}intersectsWithRect(n,e){return Os.intersectPolygonRectangle(this.getCoords(),n,e).status==="Intersection"}intersectsWithObject(n){let e=Os.intersectPolygonPolygon(this.getCoords(),n.getCoords());return e.status==="Intersection"||e.status==="Coincident"||n.isContainedWithinObject(this)||this.isContainedWithinObject(n)}isContainedWithinObject(n){return this.getCoords().every(e=>n.containsPoint(e))}isContainedWithinRect(n,e){let{left:a,top:r,width:o,height:u}=this.getBoundingRect();return a>=n.x&&a+o<=e.x&&r>=n.y&&r+u<=e.y}isOverlapping(n){return this.intersectsWithObject(n)||this.isContainedWithinObject(n)||n.isContainedWithinObject(this)}containsPoint(n){return Os.isPointInPolygon(n,this.getCoords())}isOnScreen(){if(!this.canvas)return!1;let{tl:n,br:e}=this.canvas.vptCoords;return!!this.getCoords().some(a=>a.x<=e.x&&a.x>=n.x&&a.y<=e.y&&a.y>=n.y)||!!this.intersectsWithRect(n,e)||this.containsPoint(n.midPointFrom(e))}isPartiallyOnScreen(){if(!this.canvas)return!1;let{tl:n,br:e}=this.canvas.vptCoords;return!!this.intersectsWithRect(n,e)||this.getCoords().every(a=>(a.x>=e.x||a.x<=n.x)&&(a.y>=e.y||a.y<=n.y))&&this.containsPoint(n.midPointFrom(e))}getBoundingRect(){return Ki(this.getCoords())}getScaledWidth(){return this._getTransformedDimensions().x}getScaledHeight(){return this._getTransformedDimensions().y}scale(n){this._set(nn,n),this._set(ln,n),this.setCoords()}scaleToWidth(n){let e=this.getBoundingRect().width/this.getScaledWidth();return this.scale(n/this.width/e)}scaleToHeight(n){let e=this.getBoundingRect().height/this.getScaledHeight();return this.scale(n/this.height/e)}getCanvasRetinaScaling(){var n;return((n=this.canvas)==null?void 0:n.getRetinaScaling())||1}getTotalAngle(){return this.group?ma(Od(this.calcTransformMatrix())):this.angle}getViewportTransform(){var n;return((n=this.canvas)==null?void 0:n.viewportTransform)||Ne.concat()}calcACoords(){let n=Vn({angle:this.angle}),{x:e,y:a}=this.getRelativeCenterPoint(),r=$t(ir(e,a),n),o=this._getTransformedDimensions(),u=o.x/2,h=o.y/2;return{tl:we({x:-u,y:-h},r),tr:we({x:u,y:-h},r),bl:we({x:-u,y:h},r),br:we({x:u,y:h},r)}}setCoords(){this.aCoords=this.calcACoords()}transformMatrixKey(n=!1){let e=[];return!n&&this.group&&(e=this.group.transformMatrixKey(n)),e.push(this.top,this.left,this.width,this.height,this.scaleX,this.scaleY,this.angle,this.strokeWidth,this.skewX,this.skewY,+this.flipX,+this.flipY,Re(this.originX),Re(this.originY)),e}calcTransformMatrix(n=!1){let e=this.calcOwnMatrix();if(n||!this.group)return e;let a=this.transformMatrixKey(n),r=this.matrixCache;return r&&r.key.every((o,u)=>o===a[u])?r.value:(this.group&&(e=$t(this.group.calcTransformMatrix(!1),e)),this.matrixCache={key:a,value:e},e)}calcOwnMatrix(){let n=this.transformMatrixKey(!0),e=this.ownMatrixCache;if(e&&e.key.every((o,u)=>o===n[u]))return e.value;let a=this.getRelativeCenterPoint(),r=My({angle:this.angle,translateX:a.x,translateY:a.y,scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY});return this.ownMatrixCache={key:n,value:r},r}_getNonTransformedDimensions(){return new H(this.width,this.height).scalarAdd(this.strokeWidth)}_calculateCurrentDimensions(n){var e;let a=(e=this.canvas)==null?void 0:e.viewportTransform,r=this._getTransformedDimensions(n);return a?r.multiply(new H(Ed(a),Ey(a))).scalarAdd(2*this.padding):r.scalarAdd(2*this.padding)}_getTransformedDimensions(n={}){let e={scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,width:this.width,height:this.height,strokeWidth:this.strokeWidth,...n},a=e.strokeWidth,r=a,o=0;this.strokeUniform&&(r=0,o=a);let u=e.width+r,h=e.height+r,d;return d=e.skewX===0&&e.skewY===0?new H(u*e.scaleX,h*e.scaleY):Xu(u,h,Rs(e)),d.scalarAdd(o)}translateToGivenOrigin(n,e,a,r,o){let u=n.x,h=n.y,d=Re(r)-Re(e),g=Re(o)-Re(a);if(d||g){let m=this._getTransformedDimensions();u+=d*m.x,h+=g*m.y}return new H(u,h)}translateToCenterPoint(n,e,a){if(e==="center"&&a==="center")return n;let r=this.translateToGivenOrigin(n,e,a,Ft,Ft);return this.angle?r.rotate(It(this.angle),n):r}translateToOriginPoint(n,e,a){let r=this.translateToGivenOrigin(n,Ft,Ft,e,a);return this.angle?r.rotate(It(this.angle),n):r}getCenterPoint(){let n=this.getRelativeCenterPoint();return this.group?we(n,this.group.calcTransformMatrix()):n}getRelativeCenterPoint(){return this.translateToCenterPoint(new H(this.left,this.top),this.originX,this.originY)}getPointByOrigin(n,e){return this.getPositionByOrigin(n,e)}getPositionByOrigin(n,e){return this.translateToOriginPoint(this.getRelativeCenterPoint(),n,e)}setPositionByOrigin(n,e,a){let r=this.translateToCenterPoint(n,e,a),o=this.translateToOriginPoint(r,this.originX,this.originY);this.set({left:o.x,top:o.y})}_getLeftTopCoords(){return this.getPositionByOrigin(de,"top")}positionByLeftTop(n){return this.setPositionByOrigin(n,de,"top")}},fa=class Ou extends EC{static getDefaults(){return Ou.ownDefaults}get type(){let e=this.constructor.type;return e==="FabricObject"?"object":e.toLowerCase()}set type(e){tn("warn","Setting type has no effect",e)}constructor(e){super(),D(this,"_cacheContext",null),Object.assign(this,Ou.ownDefaults),this.setOptions(e)}_createCacheCanvas(){this._cacheCanvas=Wi(),this._cacheContext=this._cacheCanvas.getContext("2d"),this._updateCacheCanvas(),this.dirty=!0}_limitCacheSize(e){let a=e.width,r=e.height,o=Yt.maxCacheSideLimit,u=Yt.minCacheSideLimit;if(a<=o&&r<=o&&a*r<=Yt.perfLimitSizeTotal)return a<u&&(e.width=u),r<u&&(e.height=u),e;let h=a/r,[d,g]=_s.limitDimsByArea(h),m=Xn(u,d,o),p=Xn(u,g,o);return a>m&&(e.zoomX/=a/m,e.width=m,e.capped=!0),r>p&&(e.zoomY/=r/p,e.height=p,e.capped=!0),e}_getCacheCanvasDimensions(){let e=this.getTotalObjectScaling(),a=this._getTransformedDimensions({skewX:0,skewY:0}),r=a.x*e.x/this.scaleX,o=a.y*e.y/this.scaleY;return{width:Math.ceil(r+2),height:Math.ceil(o+2),zoomX:e.x,zoomY:e.y,x:r,y:o}}_updateCacheCanvas(){let e=this._cacheCanvas,a=this._cacheContext,{width:r,height:o,zoomX:u,zoomY:h,x:d,y:g}=this._limitCacheSize(this._getCacheCanvasDimensions()),m=r!==e.width||o!==e.height,p=this.zoomX!==u||this.zoomY!==h;if(!e||!a)return!1;if(m||p){r!==e.width||o!==e.height?(e.width=r,e.height=o):(a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,e.width,e.height));let y=d/2,b=g/2;return this.cacheTranslationX=Math.round(e.width/2-y)+y,this.cacheTranslationY=Math.round(e.height/2-b)+b,a.translate(this.cacheTranslationX,this.cacheTranslationY),a.scale(u,h),this.zoomX=u,this.zoomY=h,!0}return!1}setOptions(e={}){this._setOptions(e)}transform(e){let a=this.group&&!this.group._transformDone||this.group&&this.canvas&&e===this.canvas.contextTop,r=this.calcTransformMatrix(!a);e.transform(r[0],r[1],r[2],r[3],r[4],r[5])}getObjectScaling(){if(!this.group)return new H(Math.abs(this.scaleX),Math.abs(this.scaleY));let e=Kl(this.calcTransformMatrix());return new H(Math.abs(e.scaleX),Math.abs(e.scaleY))}getTotalObjectScaling(){let e=this.getObjectScaling();if(this.canvas){let a=this.canvas.getZoom(),r=this.getCanvasRetinaScaling();return e.scalarMultiply(a*r)}return e}getObjectOpacity(){let e=this.opacity;return this.group&&(e*=this.group.getObjectOpacity()),e}_constrainScale(e){return Math.abs(e)<this.minScaleLimit?e<0?-this.minScaleLimit:this.minScaleLimit:e===0?1e-4:e}_set(e,a){e!=="scaleX"&&e!=="scaleY"||(a=this._constrainScale(a)),e==="scaleX"&&a<0?(this.flipX=!this.flipX,a*=-1):e==="scaleY"&&a<0?(this.flipY=!this.flipY,a*=-1):e!=="shadow"||!a||a instanceof ws||(a=new ws(a));let r=this[e]!==a;return this[e]=a,r&&this.constructor.cacheProperties.includes(e)&&(this.dirty=!0),this.parent&&(this.dirty||r&&this.constructor.stateProperties.includes(e))&&this.parent._set("dirty",!0),this}isNotVisible(){return this.opacity===0||!this.width&&!this.height&&this.strokeWidth===0||!this.visible}render(e){this.isNotVisible()||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(e.save(),this._setupCompositeOperation(e),this.drawSelectionBackground(e),this.transform(e),this._setOpacity(e),this._setShadow(e),this.shouldCache()?(this.renderCache(),this.drawCacheOnCanvas(e)):(this._removeCacheCanvas(),this.drawObject(e,!1,{}),this.dirty=!1),e.restore())}drawSelectionBackground(e){}renderCache(e){if(e=e||{},this._cacheCanvas&&this._cacheContext||this._createCacheCanvas(),this.isCacheDirty()&&this._cacheContext){let{zoomX:a,zoomY:r,cacheTranslationX:o,cacheTranslationY:u}=this,{width:h,height:d}=this._cacheCanvas;this.drawObject(this._cacheContext,e.forClipping,{zoomX:a,zoomY:r,cacheTranslationX:o,cacheTranslationY:u,width:h,height:d,parentClipPaths:[]}),this.dirty=!1}}_removeCacheCanvas(){this._cacheCanvas=void 0,this._cacheContext=null}hasStroke(){return!!this.stroke&&this.stroke!=="transparent"&&this.strokeWidth!==0}hasFill(){return!!this.fill&&this.fill!=="transparent"}needsItsOwnCache(){return!!(this.paintFirst==="stroke"&&this.hasFill()&&this.hasStroke()&&this.shadow)||!!this.clipPath}shouldCache(){return this.ownCaching=this.objectCaching&&(!this.parent||!this.parent.isOnACache())||this.needsItsOwnCache(),this.ownCaching}willDrawShadow(){return!!this.shadow&&(this.shadow.offsetX!==0||this.shadow.offsetY!==0)}drawClipPathOnCache(e,a,r){e.save(),a.inverted?e.globalCompositeOperation="destination-out":e.globalCompositeOperation="destination-in",e.setTransform(1,0,0,1,0,0),e.drawImage(r,0,0),e.restore()}drawObject(e,a,r){let o=this.fill,u=this.stroke;a?(this.fill="black",this.stroke="",this._setClippingProperties(e)):this._renderBackground(e),this.fire("before:render",{ctx:e}),this._render(e),this._drawClipPath(e,this.clipPath,r),this.fill=o,this.stroke=u}createClipPathLayer(e,a){let r=ai(a),o=r.getContext("2d");if(o.translate(a.cacheTranslationX,a.cacheTranslationY),o.scale(a.zoomX,a.zoomY),e._cacheCanvas=r,a.parentClipPaths.forEach(u=>{u.transform(o)}),a.parentClipPaths.push(e),e.absolutePositioned){let u=ii(this.calcTransformMatrix());o.transform(u[0],u[1],u[2],u[3],u[4],u[5])}return e.transform(o),e.drawObject(o,!0,a),r}_drawClipPath(e,a,r){if(!a)return;a._transformDone=!0;let o=this.createClipPathLayer(a,r);this.drawClipPathOnCache(e,a,o)}drawCacheOnCanvas(e){e.scale(1/this.zoomX,1/this.zoomY),e.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)}isCacheDirty(e=!1){if(this.isNotVisible())return!1;let a=this._cacheCanvas,r=this._cacheContext;return!(!a||!r||e||!this._updateCacheCanvas())||!!(this.dirty||this.clipPath&&this.clipPath.absolutePositioned)&&(a&&r&&!e&&(r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,a.width,a.height),r.restore()),!0)}_renderBackground(e){if(!this.backgroundColor)return;let a=this._getNonTransformedDimensions();e.fillStyle=this.backgroundColor,e.fillRect(-a.x/2,-a.y/2,a.x,a.y),this._removeShadow(e)}_setOpacity(e){this.group&&!this.group._transformDone?e.globalAlpha=this.getObjectOpacity():e.globalAlpha*=this.opacity}_setStrokeStyles(e,a){let r=a.stroke;r&&(e.lineWidth=a.strokeWidth,e.lineCap=a.strokeLineCap,e.lineDashOffset=a.strokeDashOffset,e.lineJoin=a.strokeLineJoin,e.miterLimit=a.strokeMiterLimit,yi(r)?r.gradientUnits==="percentage"||r.gradientTransform||r.patternTransform?this._applyPatternForTransformedGradient(e,r):(e.strokeStyle=r.toLive(e),this._applyPatternGradientTransform(e,r)):e.strokeStyle=a.stroke)}_setFillStyles(e,{fill:a}){a&&(yi(a)?(e.fillStyle=a.toLive(e),this._applyPatternGradientTransform(e,a)):e.fillStyle=a)}_setClippingProperties(e){e.globalAlpha=1,e.strokeStyle="transparent",e.fillStyle="#000000"}_setLineDash(e,a){a&&a.length!==0&&e.setLineDash(a)}_setShadow(e){if(!this.shadow)return;let a=this.shadow,r=this.canvas,o=this.getCanvasRetinaScaling(),[u,,,h]=r?.viewportTransform||Ne,d=u*o,g=h*o,m=a.nonScaling?new H(1,1):this.getObjectScaling();e.shadowColor=a.color,e.shadowBlur=a.blur*Yt.browserShadowBlurConstant*(d+g)*(m.x+m.y)/4,e.shadowOffsetX=a.offsetX*d*m.x,e.shadowOffsetY=a.offsetY*g*m.y}_removeShadow(e){this.shadow&&(e.shadowColor="",e.shadowBlur=e.shadowOffsetX=e.shadowOffsetY=0)}_applyPatternGradientTransform(e,a){if(!yi(a))return{offsetX:0,offsetY:0};let r=a.gradientTransform||a.patternTransform,o=-this.width/2+a.offsetX||0,u=-this.height/2+a.offsetY||0;return a.gradientUnits==="percentage"?e.transform(this.width,0,0,this.height,o,u):e.transform(1,0,0,1,o,u),r&&e.transform(r[0],r[1],r[2],r[3],r[4],r[5]),{offsetX:o,offsetY:u}}_renderPaintInOrder(e){this.paintFirst==="stroke"?(this._renderStroke(e),this._renderFill(e)):(this._renderFill(e),this._renderStroke(e))}_render(e){}_renderFill(e){this.fill&&(e.save(),this._setFillStyles(e,this),this.fillRule==="evenodd"?e.fill("evenodd"):e.fill(),e.restore())}_renderStroke(e){if(this.stroke&&this.strokeWidth!==0){if(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(e),e.save(),this.strokeUniform){let a=this.getObjectScaling();e.scale(1/a.x,1/a.y)}this._setLineDash(e,this.strokeDashArray),this._setStrokeStyles(e,this),e.stroke(),e.restore()}}_applyPatternForTransformedGradient(e,a){var r;let o=this._limitCacheSize(this._getCacheCanvasDimensions()),u=this.getCanvasRetinaScaling(),h=o.x/this.scaleX/u,d=o.y/this.scaleY/u,g=ai({width:Math.ceil(h),height:Math.ceil(d)}),m=g.getContext("2d");m&&(m.beginPath(),m.moveTo(0,0),m.lineTo(h,0),m.lineTo(h,d),m.lineTo(0,d),m.closePath(),m.translate(h/2,d/2),m.scale(o.zoomX/this.scaleX/u,o.zoomY/this.scaleY/u),this._applyPatternGradientTransform(m,a),m.fillStyle=a.toLive(e),m.fill(),e.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),e.scale(u*this.scaleX/o.zoomX,u*this.scaleY/o.zoomY),e.strokeStyle=(r=m.createPattern(g,"no-repeat"))==null?"":r)}_findCenterFromElement(){return new H(this.left+this.width/2,this.top+this.height/2)}clone(e){let a=this.toObject(e);return this.constructor.fromObject(a)}cloneAsImage(e){let a=this.toCanvasElement(e);return new(nt.getClass("image"))(a)}toCanvasElement(e={}){let a=Rd(this),r=this.group,o=this.shadow,u=Math.abs,h=e.enableRetinaScaling?dy():1,d=(e.multiplier||1)*h,g=e.canvasProvider||(X=>new jd(X,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1}));delete this.group,e.withoutTransform&&Ly(this),e.withoutShadow&&(this.shadow=null),e.viewportTransform&&zd(this,this.getViewportTransform()),this.setCoords();let m=Wi(),p=this.getBoundingRect(),y=this.shadow,b=new H;if(y){let X=y.blur,q=y.nonScaling?new H(1,1):this.getObjectScaling();b.x=2*Math.round(u(y.offsetX)+X)*u(q.x),b.y=2*Math.round(u(y.offsetY)+X)*u(q.y)}let S=p.width+b.x,_=p.height+b.y;m.width=Math.ceil(S),m.height=Math.ceil(_);let w=g(m);e.format==="jpeg"&&(w.backgroundColor="#fff"),this.setPositionByOrigin(new H(w.width/2,w.height/2),Ft,Ft);let R=this.canvas;w._objects=[this],this.set("canvas",w),this.setCoords();let Y=w.toCanvasElement(d||1,e);return this.set("canvas",R),this.shadow=o,r&&(this.group=r),this.set(a),this.setCoords(),w._objects=[],w.destroy(),Y}toDataURL(e={}){return Td(this.toCanvasElement(e),e.format||"png",e.quality||1)}toBlob(e={}){return wd(this.toCanvasElement(e),e.format||"png",e.quality||1)}isType(...e){return e.includes(this.constructor.type)||e.includes(this.type)}complexity(){return 1}toJSON(){return this.toObject()}rotate(e){let{centeredRotation:a,originX:r,originY:o}=this;if(a){let{x:u,y:h}=this.getRelativeCenterPoint();this.originX=Ft,this.originY=Ft,this.left=u,this.top=h}if(this.set("angle",e),a){let{x:u,y:h}=this.getPositionByOrigin(r,o);this.left=u,this.top=h,this.originX=r,this.originY=o}}setOnGroup(){}_setupCompositeOperation(e){this.globalCompositeOperation&&(e.globalCompositeOperation=this.globalCompositeOperation)}dispose(){Au.cancelByTarget(this),this.off(),this._set("canvas",void 0),this._cacheCanvas&&Ii().dispose(this._cacheCanvas),this._cacheCanvas=void 0,this._cacheContext=null}animate(e,a){return Object.entries(e).reduce((r,[o,u])=>(r[o]=this._animate(o,u,a),r),{})}_animate(e,a,r={}){let o=e.split("."),u=this.constructor.colorProperties.includes(o[o.length-1]),{abort:h,startValue:d,onChange:g,onComplete:m}=r,p={...r,target:this,startValue:d??o.reduce((y,b)=>y[b],this),endValue:a,abort:h?.bind(this),onChange:(y,b,S)=>{o.reduce((_,w,R)=>(R===o.length-1&&(_[w]=y),_[w]),this),g&&g(y,b,S)},onComplete:(y,b,S)=>{this.setCoords(),m&&m(y,b,S)}};return u?$y(p):Fd(p)}isDescendantOf(e){let{parent:a,group:r}=this;return a===e||r===e||!!a&&a.isDescendantOf(e)||!!r&&r!==a&&r.isDescendantOf(e)}getAncestors(){let e=[],a=this;do a=a.parent,a&&e.push(a);while(a);return e}findCommonAncestors(e){if(this===e)return{fork:[],otherFork:[],common:[this,...this.getAncestors()]};let a=this.getAncestors(),r=e.getAncestors();if(a.length===0&&r.length>0&&this===r[r.length-1])return{fork:[],otherFork:[e,...r.slice(0,r.length-1)],common:[this]};for(let o,u=0;u<a.length;u++){if(o=a[u],o===e)return{fork:[this,...a.slice(0,u)],otherFork:[],common:a.slice(u)};for(let h=0;h<r.length;h++){if(this===r[h])return{fork:[],otherFork:[e,...r.slice(0,h)],common:[this,...a]};if(o===r[h])return{fork:[this,...a.slice(0,u)],otherFork:[e,...r.slice(0,h)],common:a.slice(u)}}}return{fork:[this,...a],otherFork:[e,...r],common:[]}}hasCommonAncestors(e){let a=this.findCommonAncestors(e);return a&&!!a.common.length}isInFrontOf(e){if(this===e)return;let a=this.findCommonAncestors(e);if(a.fork.includes(e))return!0;if(a.otherFork.includes(this))return!1;let r=a.common[0]||this.canvas;if(!r)return;let o=a.fork.pop(),u=a.otherFork.pop(),h=r._objects.indexOf(o),d=r._objects.indexOf(u);return h>-1&&h>d}toObject(e=[]){let a=e.concat(Ou.customProperties,this.constructor.customProperties||[]),r,o=Yt.NUM_FRACTION_DIGITS,{clipPath:u,fill:h,stroke:d,shadow:g,strokeDashArray:m,left:p,top:y,originX:b,originY:S,width:_,height:w,strokeWidth:R,strokeLineCap:Y,strokeDashOffset:X,strokeLineJoin:q,strokeUniform:I,strokeMiterLimit:W,scaleX:$,scaleY:B,angle:G,flipX:lt,flipY:ut,opacity:pt,visible:mt,backgroundColor:St,fillRule:Dt,paintFirst:yt,globalCompositeOperation:P,skewX:tt,skewY:rt}=this;u&&!u.excludeFromExport&&(r=u.toObject(a.concat("inverted","absolutePositioned")));let ct=Jt=>Vt(Jt,o),dt={...Fn(this,a),type:this.constructor.type,version:Qf,originX:b,originY:S,left:ct(p),top:ct(y),width:ct(_),height:ct(w),fill:Lv(h)?h.toObject():h,stroke:Lv(d)?d.toObject():d,strokeWidth:ct(R),strokeDashArray:m&&m.concat(),strokeLineCap:Y,strokeDashOffset:X,strokeLineJoin:q,strokeUniform:I,strokeMiterLimit:ct(W),scaleX:ct($),scaleY:ct(B),angle:ct(G),flipX:lt,flipY:ut,opacity:ct(pt),shadow:g&&g.toObject(),visible:mt,backgroundColor:St,fillRule:Dt,paintFirst:yt,globalCompositeOperation:P,skewX:ct(tt),skewY:ct(rt),...r?{clipPath:r}:null};return this.includeDefaultValues?dt:this._removeDefaultValues(dt)}toDatalessObject(e){return this.toObject(e)}_removeDefaultValues(e){let a=this.constructor.getDefaults(),r=Object.keys(a).length>0?a:Object.getPrototypeOf(this);return Ad(e,(o,u)=>{if(u==="left"||u==="top"||u==="type")return!0;let h=r[u];return o!==h&&!(Array.isArray(o)&&Array.isArray(h)&&o.length===0&&h.length===0)})}toString(){return`#<${this.constructor.type}>`}static _fromObject({type:e,...a},{extraParam:r,...o}={}){return zs(a,o).then(u=>r?(delete u[r],new this(a[r],u)):new this(u))}static fromObject(e,a){return this._fromObject(e,a)}};D(fa,"stateProperties",q_),D(fa,"cacheProperties",va),D(fa,"ownDefaults",P_),D(fa,"type","FabricObject"),D(fa,"colorProperties",[Xe,ga,"backgroundColor"]),D(fa,"customProperties",[]),nt.setClass(fa),nt.setClass(fa,"object");const Gd=(n,e)=>{var a;let{transform:{target:r}}=e;(a=r.canvas)==null||a.fire(`object:${n}`,{...e,target:r}),r.fire(n,e)},ya=(n,e,a)=>(r,o,u,h)=>{let d=e(r,o,u,h);return d&&Gd(n,{...Hd(r,o,u,h),...a}),d};function rn(n){return(e,a,r,o)=>{let{target:u,originX:h,originY:d}=a,g=u.getPositionByOrigin(h,d),m=n(e,a,r,o);return u.setPositionByOrigin(g,a.originX,a.originY),m}}const Jy=(n,e,a,r)=>(o,u,h,d)=>{let g=Fu(u,u.originX,u.originY,h,d)[a],m=Re(u[e]);if(m===0||m>0&&g<0||m<0&&g>0){let{target:p}=u,y=p.strokeWidth/(p.strokeUniform?p[r]:1),b=Xy(u)?2:1,S=p[n],_=Math.abs(g*b/p[r])-y;return p.set(n,Math.max(_,1)),S!==p[n]}return!1},tb=Jy("width","originX","x","scaleX"),eb=Jy("height","originY","y","scaleY"),Wf=ya(Es,rn(tb)),DC=ya(Es,rn(eb));function ib(n,e,a,r,o){n.save();let{stroke:u,xSize:h,ySize:d,opName:g}=this.commonRenderProps(n,e,a,o,r),m=h;h>d?n.scale(1,d/h):d>h&&(m=d,n.scale(h/d,1)),n.beginPath(),n.arc(0,0,m/2,0,Ai,!1),n[g](),u&&n.stroke(),n.restore()}function ab(n,e,a,r,o){n.save();let{stroke:u,xSize:h,ySize:d,opName:g}=this.commonRenderProps(n,e,a,o,r),m=h/2,p=d/2;n[`${g}Rect`](-m,-p,h,d),u&&n.strokeRect(-m,-p,h,d),n.restore()}var ti=class{constructor(n){D(this,"visible",!0),D(this,"actionName",xy),D(this,"angle",0),D(this,"x",0),D(this,"y",0),D(this,"offsetX",0),D(this,"offsetY",0),D(this,"sizeX",0),D(this,"sizeY",0),D(this,"touchSizeX",0),D(this,"touchSizeY",0),D(this,"cursorStyle","crosshair"),D(this,"withConnection",!1),Object.assign(this,n)}getTransformAnchorPoint(){var n;return(n=this.transformAnchorPoint)==null?new H(.5-this.x,.5-this.y):n}shouldActivate(n,e,a,{tl:r,tr:o,br:u,bl:h}){var d;return((d=e.canvas)==null?void 0:d.getActiveObject())===e&&e.isControlVisible(n)&&Os.isPointInPolygon(a,[r,o,u,h])}getActionHandler(n,e,a){return this.actionHandler}getMouseDownHandler(n,e,a){return this.mouseDownHandler}getMouseUpHandler(n,e,a){return this.mouseUpHandler}cursorStyleHandler(n,e,a,r){return e.cursorStyle}getActionName(n,e,a){return e.actionName}getVisibility(n,e){var a,r;return(a=(r=n._controlsVisibility)==null?void 0:r[e])==null?this.visible:a}setVisibility(n,e,a){this.visible=n}positionHandler(n,e,a,r){return new H(this.x*n.x+this.offsetX,this.y*n.y+this.offsetY).transform(e)}calcCornerCoords(n,e,a,r,o,u){let h=Hu([ir(a,r),Vn({angle:n}),Yu((o?this.touchSizeX:this.sizeX)||e,(o?this.touchSizeY:this.sizeY)||e)]);return{tl:new H(-.5,-.5).transform(h),tr:new H(.5,-.5).transform(h),br:new H(.5,.5).transform(h),bl:new H(-.5,.5).transform(h)}}commonRenderProps(n,e,a,r,o={}){let{cornerSize:u,cornerColor:h,transparentCorners:d,cornerStrokeColor:g}=o,m=u||r.cornerSize,p=this.sizeX||m,y=this.sizeY||m,b=d===void 0?r.transparentCorners:d,S=b?ga:Xe,_=g||r.cornerStrokeColor,w=!b&&!!_;return n.fillStyle=h||r.cornerColor||"",n.strokeStyle=_||"",n.translate(e,a),n.rotate(It(r.getTotalAngle())),{stroke:w,xSize:p,ySize:y,transparentCorners:b,opName:S}}render(n,e,a,r,o){((r=r||{}).cornerStyle||o.cornerStyle)==="circle"?ib.call(this,n,e,a,r,o):ab.call(this,n,e,a,r,o)}};const nb=(n,e,a)=>a.lockRotation?Ld:e.cursorStyle,lb=ya(py,rn((n,{target:e,ex:a,ey:r,theta:o,originX:u,originY:h},d,g)=>{let m=e.getPositionByOrigin(u,h);if(Mi(e,"lockRotation"))return!1;let p=Math.atan2(r-m.y,a-m.x),y=ma(Math.atan2(g-m.y,d-m.x)-p+o);if(e.snapAngle&&e.snapAngle>0){let S=e.snapAngle,_=e.snapThreshold||S,w=Math.ceil(y/S)*S,R=Math.floor(y/S)*S;Math.abs(y-R)<_?y=R:Math.abs(y-w)<_&&(y=w)}y<0&&(y=360+y),y%=360;let b=e.angle!==y;return e.angle=y,b}));function rb(n,e){let a=e.canvas,r=n[a.uniScaleKey];return a.uniformScaling&&!r||!a.uniformScaling&&r}function sb(n,e,a){let r=Mi(n,"lockScalingX"),o=Mi(n,"lockScalingY");if(r&&o||!e&&(r||o)&&a||r&&e==="x"||o&&e==="y")return!0;let{width:u,height:h,strokeWidth:d}=n;return u===0&&d===0&&e!=="y"||h===0&&d===0&&e!=="x"}const MC=["e","se","s","sw","w","nw","n","ne","e"],Fl=(n,e,a,r)=>{let o=rb(n,a);return sb(a,e.x!==0&&e.y===0?"x":e.x===0&&e.y!==0?"y":"",o)?Ld:`${MC[Vy(a,0,r)]}-resize`};function qd(n,e,a,r,o={}){let u=e.target,h=o.by,d=rb(n,u),g,m,p,y,b,S;if(sb(u,h,d))return!1;if(e.gestureScale)m=e.scaleX*e.gestureScale,p=e.scaleY*e.gestureScale;else{if(g=Fu(e,e.originX,e.originY,a,r),b=h==="y"?1:Math.sign(g.x||e.signX||1),S=h==="x"?1:Math.sign(g.y||e.signY||1),e.signX||(e.signX=b),e.signY||(e.signY=S),Mi(u,"lockScalingFlip")&&(e.signX!==b||e.signY!==S))return!1;if(y=u._getTransformedDimensions(),d&&!h){let R=Math.abs(g.x)+Math.abs(g.y),{original:Y}=e,X=R/(Math.abs(y.x*Y.scaleX/u.scaleX)+Math.abs(y.y*Y.scaleY/u.scaleY));m=Y.scaleX*X,p=Y.scaleY*X}else m=Math.abs(g.x*u.scaleX/y.x),p=Math.abs(g.y*u.scaleY/y.y);Xy(e)&&(m*=2,p*=2),e.signX!==b&&h!=="y"&&(e.originX=Xv(e.originX),m*=-1,e.signX=b),e.signY!==S&&h!=="x"&&(e.originY=Xv(e.originY),p*=-1,e.signY=S)}let _=u.scaleX,w=u.scaleY;return h?(h==="x"&&u.set("scaleX",m),h==="y"&&u.set("scaleY",p)):(!Mi(u,"lockScalingX")&&u.set("scaleX",m),!Mi(u,"lockScalingY")&&u.set("scaleY",p)),_!==u.scaleX||w!==u.scaleY}const is=ya(Lu,rn((n,e,a,r)=>qd(n,e,a,r))),ob=ya(Lu,rn((n,e,a,r)=>qd(n,e,a,r,{by:"x"}))),ub=ya(Lu,rn((n,e,a,r)=>qd(n,e,a,r,{by:"y"}))),Xf={x:{counterAxis:"y",scale:nn,skew:tr,lockSkewing:"lockSkewingX",origin:"originX",flip:"flipX"},y:{counterAxis:"x",scale:ln,skew:er,lockSkewing:"lockSkewingY",origin:"originY",flip:"flipY"}},AC=["ns","nesw","ew","nwse"],cb=(n,e,a,r)=>e.x!==0&&Mi(a,"lockSkewingY")||e.y!==0&&Mi(a,"lockSkewingX")?Ld:`${AC[Vy(a,0,r)%4]}-resize`;function hb(n,e,a,r,o){let{target:u}=a,{counterAxis:h,origin:d,lockSkewing:g,skew:m,flip:p}=Xf[n];if(Mi(u,g))return!1;let{origin:y,flip:b}=Xf[h],S=Re(a[y])*(u[b]?-1:1),_=-Math.sign(S)*(u[p]?-1:1),w=-(u[m]===0&&Fu(a,"center","center",r,o)[n]>0||u[m]>0?1:-1)*_*.5+.5;return ya(yy,rn((R,Y,X,q)=>(function(I,{target:W,ex:$,ey:B,skewingSide:G,...lt},ut){let{skew:pt}=Xf[I],mt=ut.subtract(new H($,B)).divide(new H(W.scaleX,W.scaleY))[I],St=W[pt],Dt=lt[pt],yt=Math.tan(It(Dt)),P=I==="y"?W._getTransformedDimensions({scaleX:1,scaleY:1,skewX:0}).x:W._getTransformedDimensions({scaleX:1,scaleY:1}).y,tt=2*mt*G/Math.max(P,1)+yt,rt=ma(Math.atan(tt));W.set(pt,rt);let ct=St!==W[pt];if(ct&&I==="y"){let{skewX:dt,scaleX:Jt}=W,se=W._getTransformedDimensions({skewY:St}),ee=W._getTransformedDimensions(),E=dt===0?1:se.x/ee.x;E!==1&&W.set("scaleX",E*Jt)}return ct})(n,Y,new H(X,q))))(e,{...a,[d]:w,skewingSide:_},r,o)}const fb=(n,e,a,r)=>hb("x",n,e,a,r),db=(n,e,a,r)=>hb("y",n,e,a,r);function Qu(n,e){return n[e.canvas.altActionKey]}const as=(n,e,a)=>{let r=Qu(n,a);return e.x===0?r?tr:ln:e.y===0?r?er:nn:""},Ln=(n,e,a,r)=>Qu(n,a)?cb(0,e,a,r):Fl(n,e,a,r),Zf=(n,e,a,r)=>Qu(n,e.target)?db(n,e,a,r):ob(n,e,a,r),$f=(n,e,a,r)=>Qu(n,e.target)?fb(n,e,a,r):ub(n,e,a,r),Pd=()=>({ml:new ti({x:-.5,y:0,cursorStyleHandler:Ln,actionHandler:Zf,getActionName:as}),mr:new ti({x:.5,y:0,cursorStyleHandler:Ln,actionHandler:Zf,getActionName:as}),mb:new ti({x:0,y:.5,cursorStyleHandler:Ln,actionHandler:$f,getActionName:as}),mt:new ti({x:0,y:-.5,cursorStyleHandler:Ln,actionHandler:$f,getActionName:as}),tl:new ti({x:-.5,y:-.5,cursorStyleHandler:Fl,actionHandler:is}),tr:new ti({x:.5,y:-.5,cursorStyleHandler:Fl,actionHandler:is}),bl:new ti({x:-.5,y:.5,cursorStyleHandler:Fl,actionHandler:is}),br:new ti({x:.5,y:.5,cursorStyleHandler:Fl,actionHandler:is}),mtr:new ti({x:0,y:-.5,actionHandler:lb,cursorStyleHandler:nb,offsetY:-40,withConnection:!0,actionName:vy})}),gb=()=>({mr:new ti({x:.5,y:0,actionHandler:Wf,cursorStyleHandler:Ln,actionName:Es}),ml:new ti({x:-.5,y:0,actionHandler:Wf,cursorStyleHandler:Ln,actionName:Es})}),mb=()=>({...Pd(),...gb()});var pb=class Jf extends fa{static getDefaults(){return{...super.getDefaults(),...Jf.ownDefaults}}constructor(e){super(),Object.assign(this,this.constructor.createControls(),Jf.ownDefaults),this.setOptions(e)}static createControls(){return{controls:Pd()}}_updateCacheCanvas(){let e=this.canvas;if(this.noScaleCache&&e&&e._currentTransform){let a=e._currentTransform,r=a.target,o=a.action;if(this===r&&o&&o.startsWith("scale"))return!1}return super._updateCacheCanvas()}getActiveControl(){let e=this.__corner;return e?{key:e,control:this.controls[e],coord:this.oCoords[e]}:void 0}findControl(e,a=!1){if(!this.hasControls||!this.canvas)return;this.__corner=void 0;let r=Object.entries(this.oCoords);for(let o=r.length-1;o>=0;o--){let[u,h]=r[o],d=this.controls[u];if(d.shouldActivate(u,this,e,a?h.touchCorner:h.corner))return this.__corner=u,{key:u,control:d,coord:this.oCoords[u]}}}calcOCoords(){let e=this.getViewportTransform(),a=Ed(e),r=Ey(e),o=this.getCenterPoint(),u=$t($t(e,$t(ir(o.x,o.y),Vn({angle:this.getTotalAngle()-(this.group&&this.flipX?180:0)}))),[1/a,0,0,1/r,0,0]),h=this.group?Kl(this.calcTransformMatrix()):void 0;h&&(h.scaleX=Math.abs(h.scaleX),h.scaleY=Math.abs(h.scaleY));let d=this._calculateCurrentDimensions(h),g={};return this.forEachControl((m,p)=>{let y=m.positionHandler(d,u,this,m);g[p]=Object.assign(y,this._calcCornerCoords(m,y))}),g}_calcCornerCoords(e,a){let r=this.getTotalAngle();return{corner:e.calcCornerCoords(r,this.cornerSize,a.x,a.y,!1,this),touchCorner:e.calcCornerCoords(r,this.touchCornerSize,a.x,a.y,!0,this)}}setCoords(){super.setCoords(),this.canvas&&(this.oCoords=this.calcOCoords())}forEachControl(e){for(let a in this.controls)e(this.controls[a],a,this)}drawSelectionBackground(e){if(!this.selectionBackgroundColor||this.canvas&&this.canvas._activeObject!==this)return;e.save();let a=this.getRelativeCenterPoint(),r=this._calculateCurrentDimensions(),o=this.getViewportTransform();e.translate(a.x,a.y),e.scale(1/o[0],1/o[3]),e.rotate(It(this.angle)),e.fillStyle=this.selectionBackgroundColor,e.fillRect(-r.x/2,-r.y/2,r.x,r.y),e.restore()}strokeBorders(e,a){e.strokeRect(-a.x/2,-a.y/2,a.x,a.y)}_drawBorders(e,a,r={}){let o={hasControls:this.hasControls,borderColor:this.borderColor,borderDashArray:this.borderDashArray,...r};e.save(),e.strokeStyle=o.borderColor,this._setLineDash(e,o.borderDashArray),this.strokeBorders(e,a),o.hasControls&&this.drawControlsConnectingLines(e,a),e.restore()}_renderControls(e,a={}){let{hasBorders:r,hasControls:o}=this,u={hasBorders:r,hasControls:o,...a},h=this.getViewportTransform(),d=u.hasBorders,g=u.hasControls,m=Kl($t(h,this.calcTransformMatrix()));e.save(),e.translate(m.translateX,m.translateY),e.lineWidth=this.borderScaleFactor,this.group===this.parent&&(e.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),this.flipX&&(m.angle-=180);let p=Od(h);e.rotate(this.group?It(m.angle):It(this.angle)+p),d&&this.drawBorders(e,m,a),g&&this.drawControls(e,a),e.restore()}drawBorders(e,a,r){let o;if(r&&r.forActiveSelection||this.group){let u=Xu(this.width,this.height,Rs(a)),h=this.isStrokeAccountedForInDimensions()?Cd:(this.strokeUniform?new H().scalarAdd(this.canvas?this.canvas.getZoom():1):new H(a.scaleX,a.scaleY)).scalarMultiply(this.strokeWidth);o=u.add(h).scalarAdd(this.borderScaleFactor).scalarAdd(2*this.padding)}else o=this._calculateCurrentDimensions().scalarAdd(this.borderScaleFactor);this._drawBorders(e,o,r)}drawControlsConnectingLines(e,a){let r=!1;e.beginPath(),this.forEachControl((o,u)=>{o.withConnection&&o.getVisibility(this,u)&&(r=!0,e.moveTo(o.x*a.x,o.y*a.y),e.lineTo(o.x*a.x+o.offsetX,o.y*a.y+o.offsetY))}),r&&e.stroke()}drawControls(e,a={}){e.save();let r=this.getCanvasRetinaScaling(),{cornerStrokeColor:o,cornerDashArray:u,cornerColor:h}=this,d={cornerStrokeColor:o,cornerDashArray:u,cornerColor:h,...a};e.setTransform(r,0,0,r,0,0),e.strokeStyle=e.fillStyle=d.cornerColor,this.transparentCorners||(e.strokeStyle=d.cornerStrokeColor),this._setLineDash(e,d.cornerDashArray),this.forEachControl((g,m)=>{if(g.getVisibility(this,m)){let p=this.oCoords[m];g.render(e,p.x,p.y,d,this)}}),e.restore()}isControlVisible(e){return this.controls[e]&&this.controls[e].getVisibility(this,e)}setControlVisible(e,a){this._controlsVisibility||(this._controlsVisibility={}),this._controlsVisibility[e]=a}setControlsVisibility(e={}){Object.entries(e).forEach(([a,r])=>this.setControlVisible(a,r))}clearContextTop(e){if(!this.canvas)return;let a=this.canvas.contextTop;if(!a)return;let r=this.canvas.viewportTransform;a.save(),a.transform(r[0],r[1],r[2],r[3],r[4],r[5]),this.transform(a);let o=this.width+4,u=this.height+4;return a.clearRect(-o/2,-u/2,o,u),e||a.restore(),a}onDeselect(e){return!1}onSelect(e){return!1}shouldStartDragging(e){return!1}onDragStart(e){return!1}canDrop(e){return!1}renderDragSourceEffect(e){}renderDropTargetEffect(e){}};function vb(n,e){return e.forEach(a=>{Object.getOwnPropertyNames(a.prototype).forEach(r=>{r!=="constructor"&&Object.defineProperty(n.prototype,r,Object.getOwnPropertyDescriptor(a.prototype,r)||Object.create(null))})}),n}D(pb,"ownDefaults",{noScaleCache:!0,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,cornerSize:13,touchCornerSize:24,transparentCorners:!0,cornerColor:"rgb(178,204,255)",cornerStrokeColor:"",cornerStyle:"rect",cornerDashArray:null,hasControls:!0,borderColor:"rgb(178,204,255)",borderDashArray:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,hasBorders:!0,selectionBackgroundColor:"",selectable:!0,evented:!0,perPixelTargetFind:!1,activeOn:"down",hoverCursor:null,moveCursor:null});var Oe=class extends pb{};vb(Oe,[Gy]),nt.setClass(Oe),nt.setClass(Oe,"object");const yb=(n,e,a,r)=>{let o=2*(r=Math.round(r))+1,{data:u}=n.getImageData(e-r,a-r,o,o);for(let h=3;h<u.length;h+=4)if(u[h]>0)return!1;return!0};var bb=class{constructor(n){this.options=n,this.strokeProjectionMagnitude=this.options.strokeWidth/2,this.scale=new H(this.options.scaleX,this.options.scaleY),this.strokeUniformScalar=this.options.strokeUniform?new H(1/this.options.scaleX,1/this.options.scaleY):new H(1,1)}createSideVector(n,e){let a=Ds(n,e);return this.options.strokeUniform?a.multiply(this.scale):a}projectOrthogonally(n,e,a){return this.applySkew(n.add(this.calcOrthogonalProjection(n,e,a)))}isSkewed(){return this.options.skewX!==0||this.options.skewY!==0}applySkew(n){let e=new H(n);return e.y+=e.x*Math.tan(It(this.options.skewY)),e.x+=e.y*Math.tan(It(this.options.skewX)),e}scaleUnitVector(n,e){return n.multiply(this.strokeUniformScalar).scalarMultiply(e)}};const jC=new H;var xb=class Eu extends bb{static getOrthogonalRotationFactor(e,a){let r=a?zu(e,a):kd(e);return Math.abs(r)<an?-1:1}constructor(e,a,r,o){super(o),D(this,"AB",void 0),D(this,"AC",void 0),D(this,"alpha",void 0),D(this,"bisector",void 0),this.A=new H(e),this.B=new H(a),this.C=new H(r),this.AB=this.createSideVector(this.A,this.B),this.AC=this.createSideVector(this.A,this.C),this.alpha=zu(this.AB,this.AC),this.bisector=Vu(Nd(this.AB.eq(jC)?this.AC:this.AB,this.alpha/2))}calcOrthogonalProjection(e,a,r=this.strokeProjectionMagnitude){let o=Bd(this.createSideVector(e,a)),u=Eu.getOrthogonalRotationFactor(o,this.bisector);return this.scaleUnitVector(o,r*u)}projectBevel(){let e=[];return(this.alpha%Ai===0?[this.B]:[this.B,this.C]).forEach(a=>{e.push(this.projectOrthogonally(this.A,a)),e.push(this.projectOrthogonally(this.A,a,-this.strokeProjectionMagnitude))}),e}projectMiter(){let e=[],a=Math.abs(this.alpha),r=1/Math.sin(a/2),o=this.scaleUnitVector(this.bisector,-this.strokeProjectionMagnitude*r),u=this.options.strokeUniform?Ru(this.scaleUnitVector(this.bisector,this.options.strokeMiterLimit)):this.options.strokeMiterLimit;return Ru(o)/this.strokeProjectionMagnitude<=u&&e.push(this.applySkew(this.A.add(o))),e.push(...this.projectBevel()),e}projectRoundNoSkew(e,a){let r=[],o=new H(Eu.getOrthogonalRotationFactor(this.bisector),Eu.getOrthogonalRotationFactor(new H(this.bisector.y,this.bisector.x)));return[new H(1,0).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar).multiply(o),new H(0,1).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar).multiply(o)].forEach(u=>{If(u,e,a)&&r.push(this.A.add(u))}),r}projectRoundWithSkew(e,a){let r=[],{skewX:o,skewY:u,scaleX:h,scaleY:d,strokeUniform:g}=this.options,m=new H(Math.tan(It(o)),Math.tan(It(u))),p=this.strokeProjectionMagnitude,y=g?p/d/Math.sqrt(1/d**2+1/h**2*m.y**2):p/Math.sqrt(1+m.y**2),b=new H(Math.sqrt(Math.max(p**2-y**2,0)),y),S=g?p/Math.sqrt(1+m.x**2*(1/d)**2/(1/h+1/h*m.x*m.y)**2):p/Math.sqrt(1+m.x**2/(1+m.x*m.y)**2),_=new H(S,Math.sqrt(Math.max(p**2-S**2,0)));return[_,_.scalarMultiply(-1),b,b.scalarMultiply(-1)].map(w=>this.applySkew(g?w.multiply(this.strokeUniformScalar):w)).forEach(w=>{If(w,e,a)&&r.push(this.applySkew(this.A).add(w))}),r}projectRound(){let e=[];e.push(...this.projectBevel());let a=this.alpha%Ai===0,r=this.applySkew(this.A),o=e[a?0:2].subtract(r),u=e[+!!a].subtract(r),h=Pl(o,a?this.applySkew(this.AB.scalarMultiply(-1)):this.applySkew(this.bisector.multiply(this.strokeUniformScalar).scalarMultiply(-1)))>0,d=h?o:u,g=h?u:o;return this.isSkewed()?e.push(...this.projectRoundWithSkew(d,g)):e.push(...this.projectRoundNoSkew(d,g)),e}projectPoints(){switch(this.options.strokeLineJoin){case"miter":return this.projectMiter();case"round":return this.projectRound();default:return this.projectBevel()}}project(){return this.projectPoints().map(e=>({originPoint:this.A,projectedPoint:e,angle:this.alpha,bisector:this.bisector}))}},Zv=class extends bb{constructor(n,e,a){super(a),this.A=new H(n),this.T=new H(e)}calcOrthogonalProjection(n,e,a=this.strokeProjectionMagnitude){let r=this.createSideVector(n,e);return this.scaleUnitVector(Bd(r),a)}projectButt(){return[this.projectOrthogonally(this.A,this.T,this.strokeProjectionMagnitude),this.projectOrthogonally(this.A,this.T,-this.strokeProjectionMagnitude)]}projectRound(){let n=[];if(!this.isSkewed()&&this.A.eq(this.T)){let e=new H(1,1).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar);n.push(this.applySkew(this.A.add(e)),this.applySkew(this.A.subtract(e)))}else n.push(...new xb(this.A,this.T,this.T,this.options).projectRound());return n}projectSquare(){let n=[];if(this.A.eq(this.T)){let e=new H(1,1).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar);n.push(this.A.add(e),this.A.subtract(e))}else{let e=this.calcOrthogonalProjection(this.A,this.T,this.strokeProjectionMagnitude),a=this.scaleUnitVector(Vu(this.createSideVector(this.A,this.T)),-this.strokeProjectionMagnitude),r=this.A.add(a);n.push(r.add(e),r.subtract(e))}return n.map(e=>this.applySkew(e))}projectPoints(){switch(this.options.strokeLineCap){case"round":return this.projectRound();case"square":return this.projectSquare();default:return this.projectButt()}}project(){return this.projectPoints().map(n=>({originPoint:this.A,projectedPoint:n}))}};const Sb=(n,e,a=!1)=>{let r=[];if(n.length===0)return r;let o=n.reduce((u,h)=>(u[u.length-1].eq(h)||u.push(new H(h)),u),[new H(n[0])]);if(o.length===1)a=!0;else if(!a){let u=o[0],h=((d,g)=>{for(let m=d.length-1;m>=0;m--)if(g(d[m],m,d))return m;return-1})(o,d=>!d.eq(u));o.splice(h+1)}return o.forEach((u,h,d)=>{let g,m;h===0?(m=d[1],g=a?u:d[d.length-1]):h===d.length-1?(g=d[h-1],m=a?u:d[0]):(g=d[h-1],m=d[h+1]),a&&d.length===1?r.push(...new Zv(u,u,e).project()):!a||h!==0&&h!==d.length-1?r.push(...new xb(u,g,m,e).project()):r.push(...new Zv(u,h===0?m:g,e).project())}),r},Qd=n=>{let e={};return Object.keys(n).forEach(a=>{e[a]={},Object.keys(n[a]).forEach(r=>{e[a][r]={...n[a][r]}})}),e},Ku=(n,e,a=!1)=>n.fill!==e.fill||n.stroke!==e.stroke||n.strokeWidth!==e.strokeWidth||n.fontSize!==e.fontSize||n.fontFamily!==e.fontFamily||n.fontWeight!==e.fontWeight||n.fontStyle!==e.fontStyle||n.textDecorationThickness!==e.textDecorationThickness||n.textDecorationColor!==e.textDecorationColor||n.textBackgroundColor!==e.textBackgroundColor||n.deltaY!==e.deltaY||a&&(n.overline!==e.overline||n.underline!==e.underline||n.linethrough!==e.linethrough),_b=(n,e)=>{let a=e.split(`
|
|
46
|
+
`),r=[],o=-1,u={};n=Qd(n);for(let h=0;h<a.length;h++){let d=Uu(a[h]);if(n[h])for(let g=0;g<d.length;g++){o++;let m=n[h][g];m&&Object.keys(m).length>0&&(Ku(u,m,!0)?r.push({start:o,end:o+1,style:m}):r[r.length-1].end++),u=m||{}}else o+=d.length,u={}}return r},Cb=(n,e)=>{if(!Array.isArray(n))return Qd(n);let a=e.split(_d),r={},o=-1,u=0;for(let h=0;h<a.length;h++){let d=Uu(a[h]);for(let g=0;g<d.length;g++)o++,n[u]&&n[u].start<=o&&o<n[u].end&&(r[h]=r[h]||{},r[h][g]={...n[u].style},o===n[u].end-1&&u++)}return r},sn=["display","transform",Xe,"fill-opacity","fill-rule","opacity",ga,"stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"];function $v(n,e){let a=n.nodeName,r=n.getAttribute("class"),o=n.getAttribute("id"),u="(?![a-zA-Z\\-]+)",h;if(h=RegExp("^"+a,"i"),e=e.replace(h,""),o&&e.length&&(h=RegExp("#"+o+u,"i"),e=e.replace(h,"")),r&&e.length){let d=r.split(" ");for(let g=d.length;g--;)h=RegExp("\\."+d[g]+u,"i"),e=e.replace(h,"")}return e.length===0}function RC(n,e){let a=!0,r=$v(n,e.pop());return r&&e.length&&(a=(function(o,u){let h,d=!0;for(;o.parentElement&&o.parentElement.nodeType===1&&u.length;)d&&(h=u.pop()),d=$v(o=o.parentElement,h);return u.length===0})(n,e)),r&&a&&e.length===0}function zC(n,e={}){let a={};for(let r in e)RC(n,r.split(" "))&&(a={...a,...e[r]});return a}const NC=n=>{var e;return(e=G_[n])==null?n:e},kC=RegExp(`(${Un})`,"gi"),ze=`(${Un})`,BC=String.raw`(skewX)\(${ze}\)`,LC=String.raw`(skewY)\(${ze}\)`,HC=String.raw`(rotate)\(${ze}(?: ${ze} ${ze})?\)`,YC=String.raw`(scale)\(${ze}(?: ${ze})?\)`,UC=String.raw`(translate)\(${ze}(?: ${ze})?\)`,Kd=`(?:${String.raw`(matrix)\(${ze} ${ze} ${ze} ${ze} ${ze} ${ze}\)`}|${UC}|${HC}|${YC}|${BC}|${LC})`,XC=`(?:${Kd}*)`,VC=String.raw`^\s*(?:${XC}?)\s*$`,FC=new RegExp(VC),GC=new RegExp(Kd),qC=new RegExp(Kd,"g");function td(n){let e=[];if(!(n=(a=>Nu(a.replace(kC," $1 ").replace(/,/gi," ")))(n).replace(/\s*([()])\s*/gi,"$1"))||n&&!FC.test(n))return[...Ne];for(let a of n.matchAll(qC)){let r=GC.exec(a[0]);if(!r)continue;let o=Ne,[,u,...h]=r.filter(S=>!!S),[d,g,m,p,y,b]=h.map(S=>parseFloat(S));switch(u){case"translate":o=ir(d,g);break;case vy:o=Vn({angle:d},{x:g,y:m});break;case xy:o=Yu(d,g);break;case tr:o=Dd(d);break;case er:o=Md(d);break;case"matrix":o=[d,g,m,p,y,b]}e.push(o)}return Hu(e)}function PC(n,e,a,r){let o=Array.isArray(e),u,h=e;if(n!=="fill"&&n!=="stroke"||e!=="none"){if(n==="strokeUniform")return e==="non-scaling-stroke";if(n==="strokeDashArray")h=e==="none"?null:e.replace(/,/g," ").split(/\s+/).map(parseFloat);else if(n==="transformMatrix")h=a&&a.transformMatrix?$t(a.transformMatrix,td(e)):td(e);else if(n==="visible")h=e!=="none"&&e!=="hidden",a&&a.visible===!1&&(h=!1);else if(n==="opacity")h=parseFloat(e),a&&a.opacity!==void 0&&(h*=a.opacity);else if(n==="textAnchor")h=e==="start"?de:e==="end"?Di:Ft;else if(n==="charSpacing"||n==="textDecorationThickness")u=Yn(e,r)/r*1e3;else if(n==="paintFirst"){let d=e.indexOf(Xe),g=e.indexOf(ga);h=Xe,(d>-1&&g>-1&&g<d||d===-1&&g>-1)&&(h=ga)}else{if(n==="href"||n==="xlink:href"||n==="font"||n==="id")return e;if(n==="imageSmoothing")return e==="optimizeQuality";u=o?e.map(Yn):Yn(e,r)}}else h="";return!o&&isNaN(u)?h:u}function QC(n,e){n.replace(/;\s*$/,"").split(";").forEach(a=>{if(!a)return;let[r,o]=a.split(":");e[r.trim().toLowerCase()]=o.trim()})}function KC(n){let e={},a=n.getAttribute("style");return a&&(typeof a=="string"?QC(a,e):(function(r,o){Object.entries(r).forEach(([u,h])=>{h!==void 0&&(o[u.toLowerCase()]=h)})})(a,e)),e}const IC={stroke:"strokeOpacity",fill:"fillOpacity"};function ba(n,e,a){if(!n)return{};let r,o={},u=16;n.parentNode&&Kv.test(n.parentNode.nodeName)&&(o=ba(n.parentElement,e,a),o.fontSize&&(r=u=Yn(o.fontSize)));let h={...e.reduce((m,p)=>{let y=n.getAttribute(p);return y&&(m[p]=y),m},{}),...zC(n,a),...KC(n)};h["clip-path"]&&n.setAttribute(Qv,h[Qv]),h["font-size"]&&(r=Yn(h[Pv],u),h[Pv]=`${r}`);let d={};for(let m in h){let p=NC(m);d[p]=PC(p,h[m],o,r)}d&&d.font&&(function(m,p){let y=m.match(F_);if(!y)return;let b=y[1],S=y[3],_=y[4],w=y[5],R=y[6];b&&(p.fontStyle=b),S&&(p.fontWeight=isNaN(parseFloat(S))?S:parseFloat(S)),_&&(p.fontSize=Yn(_)),R&&(p.fontFamily=R),w&&(p.lineHeight=w==="normal"?1:w)})(d.font,d);let g={...o,...d};return Kv.test(n.nodeName)?g:(function(m){let p=Oe.getDefaults();return Object.entries(IC).forEach(([y,b])=>{if(m[b]===void 0||m[y]==="")return;if(m[y]===void 0){if(!p[y])return;m[y]=p[y]}if(m[y].indexOf("url(")===0)return;let S=new ni(m[y]);m[y]=S.setAlpha(Vt(S.getAlpha()*m[b],2)).toRgba()}),m})(g)}const Tb=["rx","ry"];var da=class ed extends Oe{static getDefaults(){return{...super.getDefaults(),...ed.ownDefaults}}constructor(e){super(),Object.assign(this,ed.ownDefaults),this.setOptions(e),this._initRxRy()}_initRxRy(){let{rx:e,ry:a}=this;e&&!a?this.ry=e:a&&!e&&(this.rx=a)}_render(e){let{width:a,height:r}=this,o=-a/2,u=-r/2,h=this.rx?Math.min(this.rx,a/2):0,d=this.ry?Math.min(this.ry,r/2):0,g=h!==0||d!==0;e.beginPath(),e.moveTo(o+h,u),e.lineTo(o+a-h,u),g&&e.bezierCurveTo(o+a-.4477152502*h,u,o+a,u+.4477152502*d,o+a,u+d),e.lineTo(o+a,u+r-d),g&&e.bezierCurveTo(o+a,u+r-.4477152502*d,o+a-.4477152502*h,u+r,o+a-h,u+r),e.lineTo(o+h,u+r),g&&e.bezierCurveTo(o+.4477152502*h,u+r,o,u+r-.4477152502*d,o,u+r-d),e.lineTo(o,u+d),g&&e.bezierCurveTo(o,u+.4477152502*d,o+.4477152502*h,u,o+h,u),e.closePath(),this._renderPaintInOrder(e)}toObject(e=[]){return super.toObject([...Tb,...e])}_toSVG(){let{width:e,height:a,rx:r,ry:o}=this;return["<rect ","COMMON_PARTS",`x="${-e/2}" y="${-a/2}" rx="${_t(r)}" ry="${_t(o)}" width="${_t(e)}" height="${_t(a)}" />
|
|
47
|
+
`]}static async fromElement(e,a,r){let{left:o=0,top:u=0,width:h=0,height:d=0,visible:g=!0,...m}=ba(e,this.ATTRIBUTE_NAMES,r);return new this({...a,...m,left:o,top:u,width:h,height:d,visible:!!(g&&h&&d)})}};D(da,"type","Rect"),D(da,"cacheProperties",[...va,...Tb]),D(da,"ownDefaults",{rx:0,ry:0}),D(da,"ATTRIBUTE_NAMES",[...sn,"x","y","rx","ry","width","height"]),nt.setClass(da),nt.setSVGClass(da);const Jv="initialization",id="added",wb=(n,e)=>{let{strokeUniform:a,strokeWidth:r,width:o,height:u,group:h}=e,d=h&&h!==n?Ns(h.calcTransformMatrix(),n.calcTransformMatrix()):null,g=d?e.getRelativeCenterPoint().transform(d):e.getRelativeCenterPoint(),m=!e.isStrokeAccountedForInDimensions(),p=a&&m?Hy(new H(r,r),void 0,n.calcTransformMatrix()):Cd,y=!a&&m?r:0,b=Xu(o+y,u+y,Hu([d,e.calcOwnMatrix()],!0)).add(p).scalarDivide(2);return[g.subtract(b),g.add(b)]};var Iu=class{calcLayoutResult(n,e){if(this.shouldPerformLayout(n))return this.calcBoundingBox(e,n)}shouldPerformLayout({type:n,prevStrategy:e,strategy:a}){return n==="initialization"||n==="imperative"||!!e&&a!==e}shouldLayoutClipPath({type:n,target:{clipPath:e}}){return n!=="initialization"&&e&&!e.absolutePositioned}getInitialSize(n,e){return e.size}calcBoundingBox(n,e){let{type:a,target:r}=e;if(a==="imperative"&&e.overrides)return e.overrides;if(n.length===0)return;let{left:o,top:u,width:h,height:d}=Ki(n.map(p=>wb(r,p)).reduce((p,y)=>p.concat(y),[])),g=new H(h,d),m=new H(o,u).add(g.scalarDivide(2));if(a==="initialization"){let p=this.getInitialSize(e,{size:g,center:m});return{center:m,relativeCorrection:new H(0,0),size:p}}return{center:m.transform(r.calcOwnMatrix()),size:g}}};D(Iu,"type","strategy");var ad=class extends Iu{shouldPerformLayout(n){return!0}};D(ad,"type","fit-content"),nt.setClass(ad);const Ob="layoutManager";var As=class{constructor(n=new ad){D(this,"strategy",void 0),this.strategy=n,this._subscriptions=new Map}performLayout(n){let e={bubbles:!0,strategy:this.strategy,...n,prevStrategy:this._prevLayoutStrategy,stopPropagation(){this.bubbles=!1}};this.onBeforeLayout(e);let a=this.getLayoutResult(e);a&&this.commitLayout(e,a),this.onAfterLayout(e,a),this._prevLayoutStrategy=e.strategy}attachHandlers(n,e){let{target:a}=e;return[Sy,my,Es,py,Lu,yy,Mu,by,"modifyPath"].map(r=>n.on(r,o=>this.performLayout(r==="modified"?{type:"object_modified",trigger:r,e:o,target:a}:{type:"object_modifying",trigger:r,e:o,target:a})))}subscribe(n,e){this.unsubscribe(n,e);let a=this.attachHandlers(n,e);this._subscriptions.set(n,a)}unsubscribe(n,e){(this._subscriptions.get(n)||[]).forEach(a=>a()),this._subscriptions.delete(n)}unsubscribeTargets(n){n.targets.forEach(e=>this.unsubscribe(e,n))}subscribeTargets(n){n.targets.forEach(e=>this.subscribe(e,n))}onBeforeLayout(n){let{target:e,type:a}=n,{canvas:r}=e;if(a==="initialization"||a==="added"?this.subscribeTargets(n):a==="removed"&&this.unsubscribeTargets(n),e.fire("layout:before",{context:n}),r&&r.fire("object:layout:before",{target:e,context:n}),a==="imperative"&&n.deep){let{strategy:o,...u}=n;e.forEachObject(h=>h.layoutManager&&h.layoutManager.performLayout({...u,bubbles:!1,target:h}))}}getLayoutResult(n){let{target:e,strategy:a,type:r}=n,o=a.calcLayoutResult(n,e.getObjects());if(!o)return;let u=r==="initialization"?new H:e.getRelativeCenterPoint(),{center:h,correction:d=new H,relativeCorrection:g=new H}=o;return{result:o,prevCenter:u,nextCenter:h,offset:u.subtract(h).add(d).transform(r==="initialization"?Ne:ii(e.calcOwnMatrix()),!0).add(g)}}commitLayout(n,e){let{target:a}=n,{result:{size:r},nextCenter:o}=e;var u,h;a.set({width:r.x,height:r.y}),this.layoutObjects(n,e),n.type==="initialization"?a.set({left:(u=n.x)==null?o.x+r.x*Re(a.originX):u,top:(h=n.y)==null?o.y+r.y*Re(a.originY):h}):(a.setPositionByOrigin(o,Ft,Ft),a.setCoords(),a.set("dirty",!0))}layoutObjects(n,e){let{target:a}=n;a.forEachObject(r=>{r.group===a&&this.layoutObject(n,e,r)}),n.strategy.shouldLayoutClipPath(n)&&this.layoutObject(n,e,a.clipPath)}layoutObject(n,{offset:e},a){a.set({left:a.left+e.x,top:a.top+e.y})}onAfterLayout(n,e){let{target:a,strategy:r,bubbles:o,prevStrategy:u,...h}=n,{canvas:d}=a;a.fire("layout:after",{context:n,result:e}),d&&d.fire("object:layout:after",{context:n,result:e,target:a});let g=a.parent;o&&g!=null&&g.layoutManager&&((h.path||(h.path=[])).push(a),g.layoutManager.performLayout({...h,target:g})),a.set("dirty",!0)}dispose(){let{_subscriptions:n}=this;n.forEach(e=>e.forEach(a=>a())),n.clear()}toObject(){return{type:Ob,strategy:this.strategy.constructor.type}}toJSON(){return this.toObject()}};nt.setClass(As,Ob);var WC=class extends As{performLayout(){}},Ja=class nd extends _y(Oe){static getDefaults(){return{...super.getDefaults(),...nd.ownDefaults}}constructor(e=[],a={}){super(),D(this,"_activeObjects",[]),D(this,"__objectSelectionTracker",void 0),D(this,"__objectSelectionDisposer",void 0),Object.assign(this,nd.ownDefaults),this.setOptions(a),this.groupInit(e,a)}groupInit(e,a){var r;this._objects=[...e],this.__objectSelectionTracker=this.__objectSelectionMonitor.bind(this,!0),this.__objectSelectionDisposer=this.__objectSelectionMonitor.bind(this,!1),this.forEachObject(o=>{this.enterGroup(o,!1)}),this.layoutManager=(r=a.layoutManager)==null?new As:r,this.layoutManager.performLayout({type:Jv,target:this,targets:[...e],x:a.left,y:a.top})}canEnterGroup(e){return e===this||this.isDescendantOf(e)?(tn("error","Group: circular object trees are not supported, this call has no effect"),!1):this._objects.indexOf(e)===-1||(tn("error","Group: duplicate objects are not supported inside group, this call has no effect"),!1)}_filterObjectsBeforeEnteringGroup(e){return e.filter((a,r,o)=>this.canEnterGroup(a)&&o.indexOf(a)===r)}add(...e){let a=this._filterObjectsBeforeEnteringGroup(e),r=super.add(...a);return this._onAfterObjectsChange(id,a),r}insertAt(e,...a){let r=this._filterObjectsBeforeEnteringGroup(a),o=super.insertAt(e,...r);return this._onAfterObjectsChange(id,r),o}remove(...e){let a=super.remove(...e);return this._onAfterObjectsChange("removed",a),a}_onObjectAdded(e){this.enterGroup(e,!0),this.fire("object:added",{target:e}),e.fire("added",{target:this})}_onObjectRemoved(e,a){this.exitGroup(e,a),this.fire("object:removed",{target:e}),e.fire("removed",{target:this})}_onAfterObjectsChange(e,a){this.layoutManager.performLayout({type:e,targets:a,target:this})}_onStackOrderChanged(){this._set("dirty",!0)}_set(e,a){let r=this[e];return super._set(e,a),e==="canvas"&&r!==a&&(this._objects||[]).forEach(o=>{o._set(e,a)}),this}_shouldSetNestedCoords(){return this.subTargetCheck}removeAll(){return this._activeObjects=[],this.remove(...this._objects)}__objectSelectionMonitor(e,{target:a}){let r=this._activeObjects;if(e)r.push(a),this._set("dirty",!0);else if(r.length>0){let o=r.indexOf(a);o>-1&&(r.splice(o,1),this._set("dirty",!0))}}_watchObject(e,a){e&&this._watchObject(!1,a),e?(a.on("selected",this.__objectSelectionTracker),a.on("deselected",this.__objectSelectionDisposer)):(a.off("selected",this.__objectSelectionTracker),a.off("deselected",this.__objectSelectionDisposer))}enterGroup(e,a){e.group&&e.group.remove(e),e._set("parent",this),this._enterGroup(e,a)}_enterGroup(e,a){a&&Zl(e,$t(ii(this.calcTransformMatrix()),e.calcTransformMatrix())),this._shouldSetNestedCoords()&&e.setCoords(),e._set("group",this),e._set("canvas",this.canvas),this._watchObject(!0,e);let r=this.canvas&&this.canvas.getActiveObject&&this.canvas.getActiveObject();r&&(r===e||e.isDescendantOf(r))&&this._activeObjects.push(e)}exitGroup(e,a){this._exitGroup(e,a),e._set("parent",void 0),e._set("canvas",void 0)}_exitGroup(e,a){e._set("group",void 0),a||(Zl(e,$t(this.calcTransformMatrix(),e.calcTransformMatrix())),e.setCoords()),this._watchObject(!1,e);let r=this._activeObjects.length>0?this._activeObjects.indexOf(e):-1;r>-1&&this._activeObjects.splice(r,1)}shouldCache(){let e=Oe.prototype.shouldCache.call(this);if(e){for(let a=0;a<this._objects.length;a++)if(this._objects[a].willDrawShadow())return this.ownCaching=!1,!1}return e}willDrawShadow(){if(super.willDrawShadow())return!0;for(let e=0;e<this._objects.length;e++)if(this._objects[e].willDrawShadow())return!0;return!1}isOnACache(){return this.ownCaching||!!this.parent&&this.parent.isOnACache()}drawObject(e,a,r){this._renderBackground(e);for(let u=0;u<this._objects.length;u++){var o;let h=this._objects[u];(o=this.canvas)!=null&&o.preserveObjectStacking&&h.group!==this?(e.save(),e.transform(...ii(this.calcTransformMatrix())),h.render(e),e.restore()):h.group===this&&h.render(e)}this._drawClipPath(e,this.clipPath,r)}setCoords(){super.setCoords(),this._shouldSetNestedCoords()&&this.forEachObject(e=>e.setCoords())}triggerLayout(e={}){this.layoutManager.performLayout({target:this,type:"imperative",...e})}render(e){this._transformDone=!0,super.render(e),this._transformDone=!1}__serializeObjects(e,a){let r=this.includeDefaultValues;return this._objects.filter(function(o){return!o.excludeFromExport}).map(function(o){let u=o.includeDefaultValues;o.includeDefaultValues=r;let h=o[e||"toObject"](a);return o.includeDefaultValues=u,h})}toObject(e=[]){let a=this.layoutManager.toObject();return{...super.toObject(["subTargetCheck","interactive",...e]),...a.strategy!=="fit-content"||this.includeDefaultValues?{layoutManager:a}:{},objects:this.__serializeObjects("toObject",e)}}toString(){return`#<Group: (${this.complexity()})>`}dispose(){this.layoutManager.unsubscribeTargets({targets:this.getObjects(),target:this}),this._activeObjects=[],this.forEachObject(e=>{this._watchObject(!1,e),e.dispose()}),super.dispose()}_createSVGBgRect(e){if(!this.backgroundColor)return"";let a=da.prototype._toSVG.call(this),r=a.indexOf("COMMON_PARTS");a[r]='for="group" ';let o=a.join("");return e?e(o):o}_toSVG(e){let a=["<g ","COMMON_PARTS",` >
|
|
48
|
+
`],r=this._createSVGBgRect(e);r&&a.push(" ",r);for(let o=0;o<this._objects.length;o++)a.push(" ",this._objects[o].toSVG(e));return a.push(`</g>
|
|
49
|
+
`),a}getSvgStyles(){let e=this.opacity!==void 0&&this.opacity!==1?`opacity: ${_t(this.opacity)};`:"",a=this.visible?"":" visibility: hidden;";return[e,this.getSvgFilter(),a].join("")}toClipPathSVG(e){let a=[],r=this._createSVGBgRect(e);r&&a.push(" ",r);for(let o=0;o<this._objects.length;o++)a.push(" ",this._objects[o].toClipPathSVG(e));return this._createBaseClipPathSVGMarkup(a,{reviver:e})}static fromObject({type:e,objects:a=[],layoutManager:r,...o},u){return Promise.all([Il(a,u),zs(o,u)]).then(([h,d])=>{let g=new this(h,{...o,...d,layoutManager:new WC});return g.layoutManager=r?new(nt.getClass(r.type))(new(nt.getClass(r.strategy))):new As,g.layoutManager.subscribeTargets({type:Jv,target:g,targets:g.getObjects()}),g.setCoords(),g})}};D(Ja,"type","Group"),D(Ja,"ownDefaults",{strokeWidth:0,subTargetCheck:!1,interactive:!1}),nt.setClass(Ja);const ZC=(n,e)=>n&&n.length===1?n[0]:new Ja(n,e),Eb=(n,e)=>Math.min(e.width/n.width,e.height/n.height),Db=(n,e)=>Math.max(e.width/n.width,e.height/n.height),ld="\\s*,?\\s*",ts=`${ld}(${Un})`,$C=`${ts}${ts}${ts}${ld}([01])${ld}([01])${ts}${ts}`,JC={m:"l",M:"L"},t2=(n,e,a,r,o,u,h,d,g,m,p)=>{let y=ji(n),b=Ri(n),S=ji(e),_=Ri(e),w=a*o*S-r*u*_+h,R=r*o*S+a*u*_+d;return["C",m+g*(-a*o*b-r*u*y),p+g*(-r*o*b+a*u*y),w+g*(a*o*_+r*u*S),R+g*(r*o*_-a*u*S),w,R]},ty=(n,e,a,r)=>{let o=Math.atan2(e,n),u=Math.atan2(r,a);return u>=o?u-o:2*Math.PI-(o-u)};function rd(n,e,a,r,o,u,h,d){let g;if(Yt.cachesBoundsOfCurve&&(g=[...arguments].join(),_s.boundsOfCurveCache[g]))return _s.boundsOfCurveCache[g];let m=Math.sqrt,p=Math.abs,y=[],b=[[0,0],[0,0]],S=6*n-12*a+6*o,_=-3*n+9*a-9*o+3*h,w=3*a-3*n;for(let I=0;I<2;++I){if(I>0&&(S=6*e-12*r+6*u,_=-3*e+9*r-9*u+3*d,w=3*r-3*e),p(_)<1e-12){if(p(S)<1e-12)continue;let lt=-w/S;0<lt&<<1&&y.push(lt);continue}let W=S*S-4*w*_;if(W<0)continue;let $=m(W),B=(-S+$)/(2*_);0<B&&B<1&&y.push(B);let G=(-S-$)/(2*_);0<G&&G<1&&y.push(G)}let R=y.length,Y=R,X=Ab(n,e,a,r,o,u,h,d);for(;R--;){let{x:I,y:W}=X(y[R]);b[0][R]=I,b[1][R]=W}b[0][Y]=n,b[1][Y]=e,b[0][Y+1]=h,b[1][Y+1]=d;let q=[new H(Math.min(...b[0]),Math.min(...b[1])),new H(Math.max(...b[0]),Math.max(...b[1]))];return Yt.cachesBoundsOfCurve&&(_s.boundsOfCurveCache[g]=q),q}const e2=(n,e,[a,r,o,u,h,d,g,m])=>{let p=((y,b,S,_,w,R,Y)=>{if(S===0||_===0)return[];let X=0,q=0,I=0,W=Math.PI,$=Y*Sd,B=Ri($),G=ji($),lt=.5*(-G*y-B*b),ut=.5*(-G*b+B*y),pt=S**2,mt=_**2,St=ut**2,Dt=lt**2,yt=pt*mt-pt*St-mt*Dt,P=Math.abs(S),tt=Math.abs(_);if(yt<0){let Q=Math.sqrt(1-yt/(pt*mt));P*=Q,tt*=Q}else I=(w===R?-1:1)*Math.sqrt(yt/(pt*St+mt*Dt));let rt=I*P*ut/tt,ct=-I*tt*lt/P,dt=G*rt-B*ct+.5*y,Jt=B*rt+G*ct+.5*b,se=ty(1,0,(lt-rt)/P,(ut-ct)/tt),ee=ty((lt-rt)/P,(ut-ct)/tt,(-lt-rt)/P,(-ut-ct)/tt);R===0&&ee>0?ee-=2*W:R===1&&ee<0&&(ee+=2*W);let E=Math.ceil(Math.abs(ee/W*2)),F=[],st=ee/E,N=8/3*Math.sin(st/4)*Math.sin(st/4)/Math.sin(st/2),K=se+st;for(let Q=0;Q<E;Q++)F[Q]=t2(se,K,G,B,P,tt,dt,Jt,N,X,q),X=F[Q][5],q=F[Q][6],se=K,K+=st;return F})(g-n,m-e,r,o,h,d,u);for(let y=0,b=p.length;y<b;y++)p[y][1]+=n,p[y][2]+=e,p[y][3]+=n,p[y][4]+=e,p[y][5]+=n,p[y][6]+=e;return p},Mb=n=>{let e=0,a=0,r=0,o=0,u=[],h,d=0,g=0;for(let m of n){let p=[...m],y;switch(p[0]){case"l":p[1]+=e,p[2]+=a;case"L":e=p[1],a=p[2],y=["L",e,a];break;case"h":p[1]+=e;case"H":e=p[1],y=["L",e,a];break;case"v":p[1]+=a;case"V":a=p[1],y=["L",e,a];break;case"m":p[1]+=e,p[2]+=a;case"M":e=p[1],a=p[2],r=p[1],o=p[2],y=["M",e,a];break;case"c":p[1]+=e,p[2]+=a,p[3]+=e,p[4]+=a,p[5]+=e,p[6]+=a;case"C":d=p[3],g=p[4],e=p[5],a=p[6],y=["C",p[1],p[2],d,g,e,a];break;case"s":p[1]+=e,p[2]+=a,p[3]+=e,p[4]+=a;case"S":h==="C"?(d=2*e-d,g=2*a-g):(d=e,g=a),e=p[3],a=p[4],y=["C",d,g,p[1],p[2],e,a],d=y[3],g=y[4];break;case"q":p[1]+=e,p[2]+=a,p[3]+=e,p[4]+=a;case"Q":d=p[1],g=p[2],e=p[3],a=p[4],y=["Q",d,g,e,a];break;case"t":p[1]+=e,p[2]+=a;case"T":h==="Q"?(d=2*e-d,g=2*a-g):(d=e,g=a),e=p[1],a=p[2],y=["Q",d,g,e,a];break;case"a":p[6]+=e,p[7]+=a;case"A":e2(e,a,p).forEach(b=>u.push(b)),e=p[6],a=p[7];break;case"z":case"Z":e=r,a=o,y=["Z"]}y?(u.push(y),h=y[0]):h=""}return u},ku=(n,e,a,r)=>Math.sqrt((a-n)**2+(r-e)**2),Ab=(n,e,a,r,o,u,h,d)=>g=>{let m=g**3,p=(S=>3*S**2*(1-S))(g),y=(S=>3*S*(1-S)**2)(g),b=(S=>(1-S)**3)(g);return new H(h*m+o*p+a*y+n*b,d*m+u*p+r*y+e*b)},jb=n=>n**2,Rb=n=>2*n*(1-n),zb=n=>(1-n)**2,i2=(n,e,a,r,o,u,h,d)=>g=>{let m=jb(g),p=Rb(g),y=zb(g),b=3*(y*(a-n)+p*(o-a)+m*(h-o)),S=3*(y*(r-e)+p*(u-r)+m*(d-u));return Math.atan2(S,b)},a2=(n,e,a,r,o,u)=>h=>{let d=jb(h),g=Rb(h),m=zb(h);return new H(o*d+a*g+n*m,u*d+r*g+e*m)},n2=(n,e,a,r,o,u)=>h=>{let d=1-h,g=2*(d*(a-n)+h*(o-a)),m=2*(d*(r-e)+h*(u-r));return Math.atan2(m,g)},ey=(n,e,a)=>{let r=new H(e,a),o=0;for(let u=1;u<=100;u+=1){let h=n(u/100);o+=ku(r.x,r.y,h.x,h.y),r=h}return o},l2=(n,e)=>{let a,r=0,o=0,u={x:n.x,y:n.y},h={...u},d=.01,g=0,m=n.iterator,p=n.angleFinder;for(;o<e&&d>1e-4;)h=m(r),g=r,a=ku(u.x,u.y,h.x,h.y),a+o>e?(r-=d,d/=2):(u=h,r+=d,o+=a);return{...h,angle:p(g)}},Id=n=>{let e,a,r=0,o=0,u=0,h=0,d=0,g=[];for(let m of n){let p={x:o,y:u,command:m[0],length:0};switch(m[0]){case"M":a=p,a.x=h=o=m[1],a.y=d=u=m[2];break;case"L":a=p,a.length=ku(o,u,m[1],m[2]),o=m[1],u=m[2];break;case"C":e=Ab(o,u,m[1],m[2],m[3],m[4],m[5],m[6]),a=p,a.iterator=e,a.angleFinder=i2(o,u,m[1],m[2],m[3],m[4],m[5],m[6]),a.length=ey(e,o,u),o=m[5],u=m[6];break;case"Q":e=a2(o,u,m[1],m[2],m[3],m[4]),a=p,a.iterator=e,a.angleFinder=n2(o,u,m[1],m[2],m[3],m[4]),a.length=ey(e,o,u),o=m[3],u=m[4];break;case"Z":a=p,a.destX=h,a.destY=d,a.length=ku(o,u,h,d),o=h,u=d}r+=a.length,g.push(a)}return g.push({length:r,x:o,y:u}),g},Nb=(n,e,a=Id(n))=>{let r=0;for(;e-a[r].length>0&&r<a.length-2;)e-=a[r].length,r++;let o=a[r],u=e/o.length,h=n[r];switch(o.command){case"M":return{x:o.x,y:o.y,angle:0};case"Z":return{...new H(o.x,o.y).lerp(new H(o.destX,o.destY),u),angle:Math.atan2(o.destY-o.y,o.destX-o.x)};case"L":return{...new H(o.x,o.y).lerp(new H(h[1],h[2]),u),angle:Math.atan2(h[2]-o.y,h[1]-o.x)};case"C":case"Q":return l2(o,e)}},r2=RegExp("[mzlhvcsqta][^mzlhvcsqta]*","gi"),iy=new RegExp($C,"g"),s2=new RegExp(Un,"gi"),o2={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},kb=n=>{var e;let a=[],r=(e=n.match(r2))==null?[]:e;for(let o of r){let u=o[0];if(u==="z"||u==="Z"){a.push([u]);continue}let h=o2[u.toLowerCase()],d=[];if(u==="a"||u==="A"){let g;for(iy.lastIndex=0;g=iy.exec(o);)d.push(...g.slice(1))}else d=o.match(s2)||[];for(let g=0;g<d.length;g+=h){let m=Array(h),p=JC[u];m[0]=g>0&&p?p:u;for(let y=0;y<h;y++)m[y+1]=parseFloat(d[g+y]);a.push(m)}}return a},u2=(n,e=0)=>{let a=new H(n[0]),r=new H(n[1]),o=1,u=0,h=[],d=n.length,g=d>2,m;for(g&&(o=n[2].x<r.x?-1:n[2].x===r.x?0:1,u=n[2].y<r.y?-1:n[2].y===r.y?0:1),h.push(["M",a.x-o*e,a.y-u*e]),m=1;m<d;m++){if(!a.eq(r)){let p=a.midPointFrom(r);h.push(["Q",a.x,a.y,p.x,p.y])}a=n[m],m+1<n.length&&(r=n[m+1])}return g&&(o=a.x>n[m-2].x?1:a.x===n[m-2].x?0:-1,u=a.y>n[m-2].y?1:a.y===n[m-2].y?0:-1),h.push(["L",a.x+o*e,a.y+u*e]),h},c2=(n,e,a)=>(a&&(e=$t(e,[1,0,0,1,-a.x,-a.y])),n.map(r=>{let o=[...r];for(let u=1;u<r.length-1;u+=2){let{x:h,y:d}=we({x:r[u],y:r[u+1]},e);o[u]=h,o[u+1]=d}return o})),h2=(n,e)=>{let a=2*Math.PI/n,r=-an;n%2==0&&(r+=a/2);let o=Array(n+1);for(let u=0;u<n;u++){let h=u*a+r,{x:d,y:g}=new H(ji(h),Ri(h)).scalarMultiply(e);o[u]=[u===0?"M":"L",d,g]}return o[n]=["Z"],o},Bb=(n,e)=>n.map(a=>a.map((r,o)=>o===0||e===void 0?r:Vt(r,e)).join(" ")).join(" "),f2=(n,e)=>{var a;let r=n,o=e;r.inverted&&!o.inverted&&(r=e,o=n),zd(o,(a=o.group)==null?void 0:a.calcTransformMatrix(),r.calcTransformMatrix());let u=r.inverted&&o.inverted;return u&&(r.inverted=o.inverted=!1),new Ja([r],{clipPath:o,inverted:u})},d2=(n,e)=>Math.floor(Math.random()*(e-n+1))+n,g2=(n,e)=>{let a=n._findCenterFromElement();n.transformMatrix&&((r=>{if(r.transformMatrix){let{scaleX:o,scaleY:u,angle:h,skewX:d}=Kl(r.transformMatrix);r.flipX=!1,r.flipY=!1,r.set(nn,o),r.set(ln,u),r.angle=h,r.skewX=d,r.skewY=0}})(n),a=a.transform(n.transformMatrix)),delete n.transformMatrix,e&&(n.scaleX*=e.scaleX,n.scaleY*=e.scaleY,n.cropX=e.cropX,n.cropY=e.cropY,a.x+=e.offsetLeft,a.y+=e.offsetTop,n.width=e.width,n.height=e.height),n.setPositionByOrigin(a,Ft,Ft)};js({addTransformToObject:()=>By,animate:()=>Fd,animateColor:()=>$y,applyTransformToObject:()=>Zl,calcAngleBetweenVectors:()=>zu,calcDimensionsMatrix:()=>Rs,calcPlaneChangeMatrix:()=>Ns,calcVectorRotation:()=>kd,cancelAnimFrame:()=>Ty,capValue:()=>Xn,composeMatrix:()=>My,copyCanvasElement:()=>M_,cos:()=>ji,createCanvasElement:()=>Wi,createImage:()=>wy,createRotateMatrix:()=>Vn,createScaleMatrix:()=>Yu,createSkewXMatrix:()=>Dd,createSkewYMatrix:()=>Md,createTranslateMatrix:()=>ir,createVector:()=>Ds,crossProduct:()=>Pl,degreesToRadians:()=>It,dotProduct:()=>Uy,ease:()=>Q_,enlivenObjectEnlivables:()=>zs,enlivenObjects:()=>Il,findScaleToCover:()=>Db,findScaleToFit:()=>Eb,getBoundsOfCurve:()=>rd,getOrthonormalVector:()=>Bd,getPathSegmentsInfo:()=>Id,getPointOnPath:()=>Nb,getPointer:()=>ky,getRandomInt:()=>d2,getRegularPolygonPath:()=>h2,getSmoothPathFromPoints:()=>u2,getSvgAttributes:()=>U_,getUnitVector:()=>Vu,groupSVGElements:()=>ZC,hasStyleChanged:()=>Ku,invertTransform:()=>ii,isBetweenVectors:()=>If,isIdentityMatrix:()=>Oy,isTouchEvent:()=>ju,isTransparent:()=>yb,joinPath:()=>Bb,loadImage:()=>Ts,magnitude:()=>Ru,makeBoundingBoxFromPoints:()=>Ki,makePathSimpler:()=>Mb,matrixToSVG:()=>Wl,mergeClipPaths:()=>f2,multiplyTransformMatrices:()=>$t,multiplyTransformMatrixArray:()=>Hu,parsePath:()=>kb,parsePreserveAspectRatioAttribute:()=>Fy,parseUnit:()=>Yn,pick:()=>Fn,projectStrokeOnPoints:()=>Sb,qrDecompose:()=>Kl,radiansToDegrees:()=>ma,removeFromArray:()=>Rn,removeTransformFromObject:()=>B_,removeTransformMatrixForSvgParsing:()=>g2,requestAnimFrame:()=>Cs,resetObjectTransform:()=>Ly,rotateVector:()=>Nd,saveObjectTransform:()=>Rd,sendObjectToPlane:()=>zd,sendPointToPlane:()=>pa,sendVectorToPlane:()=>Hy,sin:()=>Ri,sizeAfterTransform:()=>Xu,string:()=>j_,stylesFromArray:()=>Cb,stylesToArray:()=>_b,toBlob:()=>wd,toDataURL:()=>Td,toFixed:()=>Vt,transformPath:()=>c2,transformPoint:()=>we});function sd(n,e){let a=n.style;a&&Object.entries(e).forEach(([r,o])=>a.setProperty(r,o))}var m2=class extends zy{constructor(n,{allowTouchScrolling:e=!1,containerClass:a=""}={}){super(n),D(this,"upper",void 0),D(this,"container",void 0);let{el:r}=this.lower,o=this.createUpperCanvas();this.upper={el:o,ctx:o.getContext("2d")},this.applyCanvasStyle(r,{allowTouchScrolling:e}),this.applyCanvasStyle(o,{allowTouchScrolling:e,styles:{position:"absolute",left:"0",top:"0"}});let u=this.createContainerElement();u.classList.add(a),r.parentNode&&r.parentNode.replaceChild(u,r),u.append(r,o),this.container=u}createUpperCanvas(){let{el:n}=this.lower,e=Wi();return e.className=n.className,e.classList.remove("lower-canvas"),e.classList.add("upper-canvas"),e.setAttribute("data-fabric","top"),e.style.cssText=n.style.cssText,e.setAttribute("draggable","true"),e}createContainerElement(){let n=Jl().createElement("div");return n.setAttribute("data-fabric","wrapper"),sd(n,{position:"relative"}),Yv(n),n}applyCanvasStyle(n,e){let{styles:a,allowTouchScrolling:r}=e;sd(n,{...a,"touch-action":r?"manipulation":Bu}),Yv(n)}setDimensions(n,e){super.setDimensions(n,e);let{el:a,ctx:r}=this.upper;Ry(a,r,n,e)}setCSSDimensions(n){super.setCSSDimensions(n),Kf(this.upper.el,n),Kf(this.container,n)}cleanupDOM(n){let e=this.container,{el:a}=this.lower,{el:r}=this.upper;super.cleanupDOM(n),e.removeChild(r),e.removeChild(a),e.parentNode&&e.parentNode.replaceChild(a,e)}dispose(){super.dispose(),Ii().dispose(this.upper.el),delete this.upper,delete this.container}};const Lb=(n,e,a,r)=>{let{target:o,offsetX:u,offsetY:h}=e,d=a-u,g=r-h,m=!Mi(o,"lockMovementX")&&o.left!==d,p=!Mi(o,"lockMovementY")&&o.top!==g;return m&&o.set("left",d),p&&o.set("top",g),(m||p)&&Gd(my,Hd(n,e,a,r)),m||p},Hb=by,Yb=n=>function(e,a,r){let{points:o,pathOffset:u}=r;return new H(o[n]).subtract(u).transform($t(r.getViewportTransform(),r.calcTransformMatrix()))},Ub=(n,e,a,r)=>{let{target:o,pointIndex:u}=e,h=o,d=pa(new H(a,r),void 0,h.calcOwnMatrix());return h.points[u]=d.add(h.pathOffset),h.setDimensions(),h.set("dirty",!0),!0},Xb=(n,e)=>function(a,r,o,u){let h=r.target,d=new H(h.points[(n>0?n:h.points.length)-1]),g=d.subtract(h.pathOffset).transform(h.calcOwnMatrix()),m=e(a,{...r,pointIndex:n},o,u),p=d.subtract(h.pathOffset).transform(h.calcOwnMatrix()).subtract(g);return h.left-=p.x,h.top-=p.y,m},Vb=n=>ya(Hb,Xb(n,Ub));function p2(n,e={}){let a={};for(let r=0;r<(typeof n=="number"?n:n.points.length);r++)a[`p${r}`]=new ti({actionName:Hb,positionHandler:Yb(r),actionHandler:Vb(r),...e});return a}const od=(n,e,a)=>{let{path:r,pathOffset:o}=n,u=r[e];return new H(u[a]-o.x,u[a+1]-o.y).transform($t(n.getViewportTransform(),n.calcTransformMatrix()))};function v2(n,e,a){let{commandIndex:r,pointIndex:o}=this;return od(a,r,o)}function y2(n,e,a,r){let{target:o}=e,{commandIndex:u,pointIndex:h}=this,d=((g,m,p,y,b)=>{let{path:S,pathOffset:_}=g,w=S[(y>0?y:S.length)-1],R=new H(w[b],w[b+1]),Y=R.subtract(_).transform(g.calcOwnMatrix()),X=pa(new H(m,p),void 0,g.calcOwnMatrix());S[y][b]=X.x+_.x,S[y][b+1]=X.y+_.y,g.setDimensions();let q=R.subtract(g.pathOffset).transform(g.calcOwnMatrix()).subtract(Y);return g.left-=q.x,g.top-=q.y,g.set("dirty",!0),!0})(o,a,r,u,h);return Gd(this.actionName,{...Hd(n,e,a,r),commandIndex:u,pointIndex:h}),d}var Fb=class extends ti{constructor(n){super(n)}render(n,e,a,r,o){let u={...r,cornerColor:this.controlFill,cornerStrokeColor:this.controlStroke,transparentCorners:!this.controlFill};super.render(n,e,a,u,o)}},b2=class extends Fb{constructor(n){super(n)}render(n,e,a,r,o){let{path:u}=o,{commandIndex:h,pointIndex:d,connectToCommandIndex:g,connectToPointIndex:m}=this;n.save(),n.strokeStyle=this.controlStroke,this.connectionDashArray&&n.setLineDash(this.connectionDashArray);let[p]=u[h],y=od(o,g,m);if(p==="Q"){let b=od(o,h,d+2);n.moveTo(b.x,b.y),n.lineTo(e,a)}else n.moveTo(e,a);n.lineTo(y.x,y.y),n.stroke(),n.restore(),super.render(n,e,a,r,o)}};const du=(n,e,a,r,o,u)=>new(a?b2:Fb)({commandIndex:n,pointIndex:e,actionName:"modifyPath",positionHandler:v2,actionHandler:y2,connectToCommandIndex:o,connectToPointIndex:u,...r,...a?r.controlPointStyle:r.pointStyle});function x2(n,e={}){let a={},r="M";return n.path.forEach((o,u)=>{let h=o[0];switch(h!=="Z"&&(a[`c_${u}_${h}`]=du(u,o.length-2,!1,e)),h){case"C":a[`c_${u}_C_CP_1`]=du(u,1,!0,e,u-1,(d=>d==="C"?5:d==="Q"?3:1)(r)),a[`c_${u}_C_CP_2`]=du(u,3,!0,e,u,5);break;case"Q":a[`c_${u}_Q_CP_1`]=du(u,1,!0,e,u,3)}r=h}),a}js({changeHeight:()=>DC,changeObjectHeight:()=>eb,changeObjectWidth:()=>tb,changeWidth:()=>Wf,createObjectDefaultControls:()=>Pd,createPathControls:()=>x2,createPolyActionHandler:()=>Vb,createPolyControls:()=>p2,createPolyPositionHandler:()=>Yb,createResizeControls:()=>gb,createTextboxDefaultControls:()=>mb,dragHandler:()=>Lb,factoryPolyActionHandler:()=>Xb,getLocalPoint:()=>Fu,polyActionHandler:()=>Ub,renderCircleControl:()=>ib,renderSquareControl:()=>ab,rotationStyleHandler:()=>nb,rotationWithSnapping:()=>lb,scaleCursorStyleHandler:()=>Fl,scaleOrSkewActionName:()=>as,scaleSkewCursorStyleHandler:()=>Ln,scalingEqually:()=>is,scalingX:()=>ob,scalingXOrSkewingY:()=>Zf,scalingY:()=>ub,scalingYOrSkewingX:()=>$f,skewCursorStyleHandler:()=>cb,skewHandlerX:()=>fb,skewHandlerY:()=>db,wrapWithFireEvent:()=>ya,wrapWithFixedAnchor:()=>rn});var Gb=class qb extends jd{constructor(...e){super(...e),D(this,"_hoveredTargets",[]),D(this,"_currentTransform",null),D(this,"_groupSelector",null),D(this,"contextTopDirty",!1)}static getDefaults(){return{...super.getDefaults(),...qb.ownDefaults}}get upperCanvasEl(){var e;return(e=this.elements.upper)==null?void 0:e.el}get contextTop(){var e;return(e=this.elements.upper)==null?void 0:e.ctx}get wrapperEl(){return this.elements.container}initElements(e){this.elements=new m2(e,{allowTouchScrolling:this.allowTouchScrolling,containerClass:this.containerClass}),this._createCacheCanvas()}_onObjectAdded(e){this._objectsToRender=void 0,super._onObjectAdded(e)}_onObjectRemoved(e){this._objectsToRender=void 0,e===this._activeObject&&(this.fire("before:selection:cleared",{deselected:[e]}),this._discardActiveObject(),this.fire("selection:cleared",{deselected:[e]}),e.fire("deselected",{target:e})),e===this._hoveredTarget&&(this._hoveredTarget=void 0,this._hoveredTargets=[]),super._onObjectRemoved(e)}_onStackOrderChanged(){this._objectsToRender=void 0,super._onStackOrderChanged()}_chooseObjectsToRender(){let e=this._activeObject;return!this.preserveObjectStacking&&e?this._objects.filter(a=>!a.group&&a!==e).concat(e):this._objects}renderAll(){this.cancelRequestedRender(),this.destroyed||(!this.contextTopDirty||this._groupSelector||this.isDrawingMode||(this.clearContext(this.contextTop),this.contextTopDirty=!1),this.hasLostContext&&(this.renderTopLayer(this.contextTop),this.hasLostContext=!1),!this._objectsToRender&&(this._objectsToRender=this._chooseObjectsToRender()),this.renderCanvas(this.getContext(),this._objectsToRender))}renderTopLayer(e){e.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(e),this.contextTopDirty=!0),e.restore()}renderTop(){let e=this.contextTop;this.clearContext(e),this.renderTopLayer(e),this.fire("after:render",{ctx:e})}setTargetFindTolerance(e){e=Math.round(e),this.targetFindTolerance=e;let a=this.getRetinaScaling(),r=Math.ceil((2*e+1)*a);this.pixelFindCanvasEl.width=this.pixelFindCanvasEl.height=r,this.pixelFindContext.scale(a,a)}isTargetTransparent(e,a,r){let o=this.targetFindTolerance,u=this.pixelFindContext;this.clearContext(u),u.save(),u.translate(-a+o,-r+o),u.transform(...this.viewportTransform);let h=e.selectionBackgroundColor;e.selectionBackgroundColor="",e.render(u),e.selectionBackgroundColor=h,u.restore();let d=Math.round(o*this.getRetinaScaling());return yb(u,d,d,d)}_isSelectionKeyPressed(e){let a=this.selectionKey;return!!a&&(Array.isArray(a)?!!a.find(r=>!!r&&e[r]===!0):e[a])}_shouldClearSelection(e,a){let r=this.getActiveObjects(),o=this._activeObject;return!!(!a||a&&o&&r.length>1&&r.indexOf(a)===-1&&o!==a&&!this._isSelectionKeyPressed(e)||a&&!a.evented||a&&!a.selectable&&o&&o!==a)}_shouldCenterTransform(e,a,r){if(!e)return;let o;return a==="scale"||a==="scaleX"||a==="scaleY"||a==="resizing"?o=this.centeredScaling||e.centeredScaling:a==="rotate"&&(o=this.centeredRotation||e.centeredRotation),o?!r:r}_getOriginFromCorner(e,a){let r=a?e.controls[a].getTransformAnchorPoint():{x:e.originX,y:e.originY};return a&&(["ml","tl","bl"].includes(a)?r.x=Di:["mr","tr","br"].includes(a)&&(r.x=de),["tl","mt","tr"].includes(a)?r.y=gy:["bl","mb","br"].includes(a)&&(r.y="top")),r}_setupCurrentTransform(e,a,r){var o;let u=a.group?pa(this.getScenePoint(e),void 0,a.group.calcTransformMatrix()):this.getScenePoint(e),{key:h="",control:d}=a.getActiveControl()||{},g=r&&d?(o=d.getActionHandler(e,a,d))==null?void 0:o.bind(d):Lb,m=((G,lt,ut,pt)=>{if(!lt||!G)return"drag";let mt=pt.controls[lt];return mt.getActionName(ut,mt,pt)})(r,h,e,a),p=e[this.centeredKey],y=this._shouldCenterTransform(a,m,p)?{x:Ft,y:Ft}:this._getOriginFromCorner(a,h),{scaleX:b,scaleY:S,skewX:_,skewY:w,left:R,top:Y,angle:X,width:q,height:I,cropX:W,cropY:$}=a,B={target:a,action:m,actionHandler:g,actionPerformed:!1,corner:h,scaleX:b,scaleY:S,skewX:_,skewY:w,offsetX:u.x-R,offsetY:u.y-Y,originX:y.x,originY:y.y,ex:u.x,ey:u.y,lastX:u.x,lastY:u.y,theta:It(X),width:q,height:I,shiftKey:e.shiftKey,altKey:p,original:{...Rd(a),originX:y.x,originY:y.y,cropX:W,cropY:$}};this._currentTransform=B,this.fire("before:transform",{e,transform:B})}setCursor(e){this.upperCanvasEl.style.cursor=e}_drawSelection(e){let{x:a,y:r,deltaX:o,deltaY:u}=this._groupSelector,h=new H(a,r).transform(this.viewportTransform),d=new H(a+o,r+u).transform(this.viewportTransform),g=this.selectionLineWidth/2,m=Math.min(h.x,d.x),p=Math.min(h.y,d.y),y=Math.max(h.x,d.x),b=Math.max(h.y,d.y);this.selectionColor&&(e.fillStyle=this.selectionColor,e.fillRect(m,p,y-m,b-p)),this.selectionLineWidth&&this.selectionBorderColor&&(e.lineWidth=this.selectionLineWidth,e.strokeStyle=this.selectionBorderColor,m+=g,p+=g,y-=g,b-=g,Oe.prototype._setLineDash.call(this,e,this.selectionDashArray),e.strokeRect(m,p,y-m,b-p))}findTarget(e){if(this._targetInfo)return this._targetInfo;if(this.skipTargetFind)return{subTargets:[],currentSubTargets:[]};let a=this.getScenePoint(e),r=this._activeObject,o=this.getActiveObjects(),u=this.searchPossibleTargets(this._objects,a),{subTargets:h,container:d,target:g}=u,m={...u,currentSubTargets:h,currentContainer:d,currentTarget:g};if(!r)return m;let p={...this.searchPossibleTargets([r],a),currentSubTargets:h,currentContainer:d,currentTarget:g};return r.findControl(this.getViewportPoint(e),ju(e))?{...p,target:r}:p.target&&(o.length>1||!this.preserveObjectStacking||this.preserveObjectStacking&&e[this.altSelectionKey])?p:m}_pointIsInObjectSelectionArea(e,a){let r=e.getCoords(),o=this.getZoom(),u=e.padding/o;if(u){let[h,d,g,m]=r,p=Math.atan2(d.y-h.y,d.x-h.x),y=ji(p)*u,b=Ri(p)*u,S=y+b,_=y-b;r=[new H(h.x-_,h.y-S),new H(d.x+S,d.y-_),new H(g.x+_,g.y+S),new H(m.x-S,m.y+_)]}return Os.isPointInPolygon(a,r)}_checkTarget(e,a){if(e&&e.visible&&e.evented&&this._pointIsInObjectSelectionArea(e,a)){if(!this.perPixelTargetFind&&!e.perPixelTargetFind||e.isEditing)return!0;{let r=a.transform(this.viewportTransform);if(!this.isTargetTransparent(e,r.x,r.y))return!0}}return!1}_searchPossibleTargets(e,a,r){let o=e.length;for(;o--;){let u=e[o];if(this._checkTarget(u,a)){if(Tu(u)&&u.subTargetCheck){let{target:h}=this._searchPossibleTargets(u._objects,a,r);h&&r.push(h)}return{target:u,subTargets:r}}}return{subTargets:[]}}searchPossibleTargets(e,a){let r=this._searchPossibleTargets(e,a,[]);r.container=r.target;let{container:o,subTargets:u}=r;if(o&&Tu(o)&&o.interactive&&u[0]){for(let h=u.length-1;h>0;h--){let d=u[h];if(!Tu(d)||!d.interactive)return r.target=d,r}return r.target=u[0],r}return r}getViewportPoint(e){return this._viewportPoint?this._viewportPoint:this._getPointerImpl(e,!0)}getScenePoint(e){return this._scenePoint?this._scenePoint:this._getPointerImpl(e)}_getPointerImpl(e,a=!1){let r=this.upperCanvasEl,o=r.getBoundingClientRect(),u=ky(e),h=o.width||0,d=o.height||0;h&&d||("top"in o&&"bottom"in o&&(d=Math.abs(o.top-o.bottom)),"right"in o&&"left"in o&&(h=Math.abs(o.right-o.left))),this.calcOffset(),u.x-=this._offset.left,u.y-=this._offset.top,a||(u=pa(u,void 0,this.viewportTransform));let g=this.getRetinaScaling();g!==1&&(u.x/=g,u.y/=g);let m=h===0||d===0?new H(1,1):new H(r.width/h,r.height/d);return u.multiply(m)}_setDimensionsImpl(e,a){this._resetTransformEventData(),super._setDimensionsImpl(e,a),this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(this.contextTop)}_createCacheCanvas(){this.pixelFindCanvasEl=Wi(),this.pixelFindContext=this.pixelFindCanvasEl.getContext("2d",{willReadFrequently:!0}),this.setTargetFindTolerance(this.targetFindTolerance)}getTopContext(){return this.elements.upper.ctx}getSelectionContext(){return this.elements.upper.ctx}getSelectionElement(){return this.elements.upper.el}getActiveObject(){return this._activeObject}getActiveObjects(){let e=this._activeObject;return zn(e)?e.getObjects():e?[e]:[]}_fireSelectionEvents(e,a){let r=!1,o=!1,u=this.getActiveObjects(),h=[],d=[];e.forEach(g=>{u.includes(g)||(r=!0,g.fire("deselected",{e:a,target:g}),d.push(g))}),u.forEach(g=>{e.includes(g)||(r=!0,g.fire("selected",{e:a,target:g}),h.push(g))}),e.length>0&&u.length>0?(o=!0,r&&this.fire("selection:updated",{e:a,selected:h,deselected:d})):u.length>0?(o=!0,this.fire("selection:created",{e:a,selected:h})):e.length>0&&(o=!0,this.fire("selection:cleared",{e:a,deselected:d})),o&&(this._objectsToRender=void 0)}setActiveObject(e,a){let r=this.getActiveObjects(),o=this._setActiveObject(e,a);return this._fireSelectionEvents(r,a),o}_setActiveObject(e,a){let r=this._activeObject;return r!==e&&!(!this._discardActiveObject(a,e)&&this._activeObject)&&!e.onSelect({e:a})&&(this._activeObject=e,zn(e)&&r!==e&&e.set("canvas",this),e.setCoords(),!0)}_discardActiveObject(e,a){let r=this._activeObject;return!!r&&!r.onDeselect({e,object:a})&&(this._currentTransform&&this._currentTransform.target===r&&this.endCurrentTransform(e),zn(r)&&r===this._hoveredTarget&&(this._hoveredTarget=void 0),this._activeObject=void 0,!0)}discardActiveObject(e){let a=this.getActiveObjects(),r=this.getActiveObject();a.length&&this.fire("before:selection:cleared",{e,deselected:[r]});let o=this._discardActiveObject(e);return this._fireSelectionEvents(a,e),o}endCurrentTransform(e){let a=this._currentTransform;this._finalizeCurrentTransform(e),a&&a.target&&(a.target.isMoving=!1),this._currentTransform=null}_finalizeCurrentTransform(e){let a=this._currentTransform,r=a.target,o={e,target:r,transform:a,action:a.action};r._scaling&&(r._scaling=!1),r.setCoords(),a.actionPerformed&&(this.fire("object:modified",o),r.fire(Sy,o))}setViewportTransform(e){super.setViewportTransform(e);let a=this._activeObject;a&&a.setCoords()}destroy(){let e=this._activeObject;zn(e)&&(e.removeAll(),e.dispose()),delete this._activeObject,super.destroy(),this.pixelFindContext=null,this.pixelFindCanvasEl=void 0}clear(){this.discardActiveObject(),this._activeObject=void 0,this.clearContext(this.contextTop),super.clear()}drawControls(e){let a=this._activeObject;a&&a._renderControls(e)}_toObject(e,a,r){let o=this._realizeGroupTransformOnObject(e),u=super._toObject(e,a,r);return e.set(o),u}_realizeGroupTransformOnObject(e){let{group:a}=e;if(a&&zn(a)&&this._activeObject===a){let r=Fn(e,["angle","flipX","flipY",de,nn,ln,tr,er,"top"]);return By(e,a.calcOwnMatrix()),r}return{}}_setSVGObject(e,a,r){let o=this._realizeGroupTransformOnObject(a);super._setSVGObject(e,a,r),a.set(o)}};D(Gb,"ownDefaults",{uniformScaling:!0,uniScaleKey:"shiftKey",centeredScaling:!1,centeredRotation:!1,centeredKey:"altKey",altActionKey:"shiftKey",selection:!0,selectionKey:"shiftKey",selectionColor:"rgba(100, 100, 255, 0.3)",selectionDashArray:[],selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,selectionFullyContained:!1,hoverCursor:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",notAllowedCursor:"not-allowed",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,stopContextMenu:!0,fireRightClick:!0,fireMiddleClick:!0,enablePointerEvents:!1,containerClass:"canvas-container",preserveObjectStacking:!0});var S2=class{constructor(n){D(this,"targets",[]),D(this,"__disposer",void 0);let e=()=>{let{hiddenTextarea:r}=n.getActiveObject()||{};r&&r.focus()},a=n.upperCanvasEl;a.addEventListener("click",e),this.__disposer=()=>a.removeEventListener("click",e)}exitTextEditing(){this.target=void 0,this.targets.forEach(n=>{n.isEditing&&n.exitEditing()})}add(n){this.targets.push(n)}remove(n){this.unregister(n),Rn(this.targets,n)}register(n){this.target=n}unregister(n){n===this.target&&(this.target=void 0)}onMouseMove(n){var e;(e=this.target)!=null&&e.isEditing&&this.target.updateSelectionOnMouseMove(n)}clear(){this.targets=[],this.target=void 0}dispose(){this.clear(),this.__disposer(),delete this.__disposer}};const Je={passive:!1},Bl=(n,e)=>({viewportPoint:n.getViewportPoint(e),scenePoint:n.getScenePoint(e)}),Wa=(n,...e)=>n.addEventListener(...e),pi=(n,...e)=>n.removeEventListener(...e),_2={mouse:{in:"over",out:"out",targetIn:"mouseover",targetOut:"mouseout",canvasIn:"mouse:over",canvasOut:"mouse:out"},drag:{in:"enter",out:"leave",targetIn:"dragenter",targetOut:"dragleave",canvasIn:"drag:enter",canvasOut:"drag:leave"}};var ud=class extends Gb{constructor(n,e={}){super(n,e),D(this,"_isClick",void 0),D(this,"textEditingManager",new S2(this)),["_onMouseDown","_onTouchStart","_onMouseMove","_onMouseUp","_onTouchEnd","_onResize","_onMouseWheel","_onMouseOut","_onMouseEnter","_onContextMenu","_onClick","_onDragStart","_onDragEnd","_onDragProgress","_onDragOver","_onDragEnter","_onDragLeave","_onDrop"].forEach(a=>{this[a]=this[a].bind(this)}),this.addOrRemove(Wa)}_getEventPrefix(){return this.enablePointerEvents?"pointer":"mouse"}addOrRemove(n,e=!1){let a=this.upperCanvasEl,r=this._getEventPrefix();n(jy(a),"resize",this._onResize),n(a,r+"down",this._onMouseDown),n(a,`${r}move`,this._onMouseMove,Je),n(a,`${r}out`,this._onMouseOut),n(a,`${r}enter`,this._onMouseEnter),n(a,"wheel",this._onMouseWheel,{passive:!1}),n(a,"contextmenu",this._onContextMenu),e||(n(a,"click",this._onClick),n(a,"dblclick",this._onClick)),n(a,"dragstart",this._onDragStart),n(a,"dragend",this._onDragEnd),n(a,"dragover",this._onDragOver),n(a,"dragenter",this._onDragEnter),n(a,"dragleave",this._onDragLeave),n(a,"drop",this._onDrop),this.enablePointerEvents||n(a,"touchstart",this._onTouchStart,Je)}removeListeners(){this.addOrRemove(pi);let n=this._getEventPrefix(),e=Ei(this.upperCanvasEl);pi(e,`${n}up`,this._onMouseUp),pi(e,"touchend",this._onTouchEnd,Je),pi(e,`${n}move`,this._onMouseMove,Je),pi(e,"touchmove",this._onMouseMove,Je),clearTimeout(this._willAddMouseDown)}_onMouseWheel(n){this._cacheTransformEventData(n),this._handleEvent(n,"wheel"),this._resetTransformEventData()}_onMouseOut(n){let e=this._hoveredTarget,a={e:n,...Bl(this,n)};this.fire("mouse:out",{...a,target:e}),this._hoveredTarget=void 0,e&&e.fire("mouseout",{...a}),this._hoveredTargets.forEach(r=>{this.fire("mouse:out",{...a,target:r}),r&&r.fire("mouseout",{...a})}),this._hoveredTargets=[]}_onMouseEnter(n){let{target:e}=this.findTarget(n);this._currentTransform||e||(this.fire("mouse:over",{e:n,...Bl(this,n)}),this._hoveredTarget=void 0,this._hoveredTargets=[])}_onDragStart(n){this._isClick=!1;let e=this.getActiveObject();if(e&&e.onDragStart(n)){this._dragSource=e;let a={e:n,target:e};this.fire("dragstart",a),e.fire("dragstart",a),Wa(this.upperCanvasEl,"drag",this._onDragProgress);return}Uv(n)}_renderDragEffects(n,e,a){let r=!1,o=this._dropTarget;o&&o!==e&&o!==a&&(o.clearContextTop(),r=!0),e?.clearContextTop(),a!==e&&a?.clearContextTop();let u=this.contextTop;u.save(),u.transform(...this.viewportTransform),e&&(u.save(),e.transform(u),e.renderDragSourceEffect(n),u.restore(),r=!0),a&&(u.save(),a.transform(u),a.renderDropTargetEffect(n),u.restore(),r=!0),u.restore(),r&&(this.contextTopDirty=!0)}_onDragEnd(n){let{currentSubTargets:e}=this.findTarget(n),a=!!n.dataTransfer&&n.dataTransfer.dropEffect!=="none",r=a?this._activeObject:void 0,o={e:n,target:this._dragSource,subTargets:e,dragSource:this._dragSource,didDrop:a,dropTarget:r};pi(this.upperCanvasEl,"drag",this._onDragProgress),this.fire("dragend",o),this._dragSource&&this._dragSource.fire("dragend",o),delete this._dragSource,this._onMouseUp(n)}_onDragProgress(n){let e={e:n,target:this._dragSource,dragSource:this._dragSource,dropTarget:this._draggedoverTarget};this.fire("drag",e),this._dragSource&&this._dragSource.fire("drag",e)}_onDragOver(n){let e="dragover",{currentContainer:a,currentSubTargets:r}=this.findTarget(n),o=this._dragSource,u={e:n,target:a,subTargets:r,dragSource:o,canDrop:!1,dropTarget:void 0},h;this.fire(e,u),this._fireEnterLeaveEvents(n,a,u),a&&(a.canDrop(n)&&(h=a),a.fire(e,u));for(let d=0;d<r.length;d++){let g=r[d];g.canDrop(n)&&(h=g),g.fire(e,u)}this._renderDragEffects(n,o,h),this._dropTarget=h}_onDragEnter(n){let{currentContainer:e,currentSubTargets:a}=this.findTarget(n),r={e:n,target:e,subTargets:a,dragSource:this._dragSource};this.fire("dragenter",r),this._fireEnterLeaveEvents(n,e,r)}_onDragLeave(n){let{currentSubTargets:e}=this.findTarget(n),a={e:n,target:this._draggedoverTarget,subTargets:e,dragSource:this._dragSource};this.fire("dragleave",a),this._fireEnterLeaveEvents(n,void 0,a),this._renderDragEffects(n,this._dragSource),this._dropTarget=void 0,this._hoveredTargets=[]}_onDrop(n){let{currentContainer:e,currentSubTargets:a}=this.findTarget(n),r=this._basicEventHandler("drop:before",{e:n,target:e,subTargets:a,dragSource:this._dragSource,...Bl(this,n)});r.didDrop=!1,r.dropTarget=void 0,this._basicEventHandler("drop",r),this.fire("drop:after",r)}_onContextMenu(n){let{target:e,subTargets:a}=this.findTarget(n),r=this._basicEventHandler("contextmenu:before",{e:n,target:e,subTargets:a});return this.stopContextMenu&&Uv(n),this._basicEventHandler("contextmenu",r),!1}_onClick(n){let e=n.detail;e>3||e<2||(this._cacheTransformEventData(n),e==2&&n.type==="dblclick"&&this._handleEvent(n,"dblclick"),e==3&&this._handleEvent(n,"tripleclick"),this._resetTransformEventData())}fireEventFromPointerEvent(n,e,a,r={}){this._cacheTransformEventData(n);let{target:o,subTargets:u}=this.findTarget(n),h={e:n,target:o,subTargets:u,...Bl(this,n),transform:this._currentTransform,...r};this.fire(e,h),o&&o.fire(a,h);for(let d=0;d<u.length;d++)u[d]!==o&&u[d].fire(a,h);this._resetTransformEventData()}getPointerId(n){let e=n.changedTouches;return e?e[0]&&e[0].identifier:this.enablePointerEvents?n.pointerId:-1}_isMainEvent(n){return n.isPrimary===!0||n.isPrimary!==!1&&(n.type==="touchend"&&n.touches.length===0||!n.changedTouches||n.changedTouches[0].identifier===this.mainTouchId)}_onTouchStart(n){this._cacheTransformEventData(n);let e=!this.allowTouchScrolling,a=this._activeObject;this.mainTouchId===void 0&&(this.mainTouchId=this.getPointerId(n)),this.__onMouseDown(n);let{target:r}=this.findTarget(n);(this.isDrawingMode||a&&r===a)&&(e=!0),e&&n.preventDefault();let o=this.upperCanvasEl,u=this._getEventPrefix(),h=Ei(o);Wa(h,"touchend",this._onTouchEnd,Je),e&&Wa(h,"touchmove",this._onMouseMove,Je),pi(o,`${u}down`,this._onMouseDown),this._resetTransformEventData()}_onMouseDown(n){this._cacheTransformEventData(n),this.__onMouseDown(n);let e=this.upperCanvasEl,a=this._getEventPrefix();pi(e,`${a}move`,this._onMouseMove,Je);let r=Ei(e);Wa(r,`${a}up`,this._onMouseUp),Wa(r,`${a}move`,this._onMouseMove,Je),this._resetTransformEventData()}_onTouchEnd(n){if(n.touches.length>0)return;this._cacheTransformEventData(n),this.__onMouseUp(n),this._resetTransformEventData(),delete this.mainTouchId;let e=this._getEventPrefix(),a=Ei(this.upperCanvasEl);pi(a,"touchend",this._onTouchEnd,Je),pi(a,"touchmove",this._onMouseMove,Je),this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout(()=>{Wa(this.upperCanvasEl,`${e}down`,this._onMouseDown),this._willAddMouseDown=0},400)}_onMouseUp(n){this._cacheTransformEventData(n),this.__onMouseUp(n);let e=this.upperCanvasEl,a=this._getEventPrefix();if(this._isMainEvent(n)){let r=Ei(this.upperCanvasEl);pi(r,`${a}up`,this._onMouseUp),pi(r,`${a}move`,this._onMouseMove,Je),Wa(e,`${a}move`,this._onMouseMove,Je)}this._resetTransformEventData()}_onMouseMove(n){this._cacheTransformEventData(n);let e=this.getActiveObject();!this.allowTouchScrolling&&(!e||!e.shouldStartDragging(n))&&n.preventDefault&&n.preventDefault(),this.__onMouseMove(n),this._resetTransformEventData()}_onResize(){this.calcOffset(),this._resetTransformEventData()}_shouldRender(n){let e=this.getActiveObject();return!!e!=!!n||e&&n&&e!==n}__onMouseUp(n){var e;this._handleEvent(n,"up:before");let a=this._currentTransform,r=this._isClick,{target:o}=this.findTarget(n),{button:u}=n;if(u)return void((this.fireMiddleClick&&u===1||this.fireRightClick&&u===2)&&this._handleEvent(n,"up"));if(this.isDrawingMode&&this._isCurrentlyDrawing)return void this._onMouseUpInDrawingMode(n);if(!this._isMainEvent(n))return;let h,d,g=!1;if(a&&(this._finalizeCurrentTransform(n),g=a.actionPerformed),!r){let m=o===this._activeObject;this.handleSelection(n),g||(g=this._shouldRender(o)||!m&&o===this._activeObject)}if(o){let{key:m,control:p}=o.findControl(this.getViewportPoint(n),ju(n))||{};if(d=m,o.selectable&&o!==this._activeObject&&o.activeOn==="up")this.setActiveObject(o,n),g=!0;else if(p){let y=p.getMouseUpHandler(n,o,p);y&&(h=this.getScenePoint(n),y.call(p,n,a,h.x,h.y))}o.isMoving=!1}if(a&&(a.target!==o||a.corner!==d)){let m=a.target&&a.target.controls[a.corner],p=m&&m.getMouseUpHandler(n,a.target,m);h=h||this.getScenePoint(n),p&&p.call(m,n,a,h.x,h.y)}this._setCursorFromEvent(n,o),this._handleEvent(n,"up"),this._groupSelector=null,this._currentTransform=null,o&&(o.__corner=void 0),g?this.requestRenderAll():r||(e=this._activeObject)!=null&&e.isEditing||this.renderTop()}_basicEventHandler(n,e){let{target:a,subTargets:r=[]}=e;this.fire(n,e),a&&a.fire(n,e);for(let o=0;o<r.length;o++)r[o]!==a&&r[o].fire(n,e);return e}_handleEvent(n,e,a){let{target:r,subTargets:o}=this.findTarget(n),u={e:n,target:r,subTargets:o,...Bl(this,n),transform:this._currentTransform,...e==="down:before"||e==="down"?a:{}};e!=="up:before"&&e!=="up"||(u.isClick=this._isClick),this.fire(`mouse:${e}`,u),r&&r.fire(`mouse${e}`,u);for(let h=0;h<o.length;h++)o[h]!==r&&o[h].fire(`mouse${e}`,u)}_onMouseDownInDrawingMode(n){this._isCurrentlyDrawing=!0,this.getActiveObject()&&(this.discardActiveObject(n),this.requestRenderAll());let e=this.getScenePoint(n);this.freeDrawingBrush&&this.freeDrawingBrush.onMouseDown(e,{e:n,pointer:e}),this._handleEvent(n,"down",{alreadySelected:!1})}_onMouseMoveInDrawingMode(n){if(this._isCurrentlyDrawing){let e=this.getScenePoint(n);this.freeDrawingBrush&&this.freeDrawingBrush.onMouseMove(e,{e:n,pointer:e})}this.setCursor(this.freeDrawingCursor),this._handleEvent(n,"move")}_onMouseUpInDrawingMode(n){let e=this.getScenePoint(n);this.freeDrawingBrush?this._isCurrentlyDrawing=!!this.freeDrawingBrush.onMouseUp({e:n,pointer:e}):this._isCurrentlyDrawing=!1,this._handleEvent(n,"up")}__onMouseDown(n){this._isClick=!0,this._handleEvent(n,"down:before");let{target:e}=this.findTarget(n),a=!!e&&e===this._activeObject,{button:r}=n;if(r)return void((this.fireMiddleClick&&r===1||this.fireRightClick&&r===2)&&this._handleEvent(n,"down",{alreadySelected:a}));if(this.isDrawingMode)return void this._onMouseDownInDrawingMode(n);if(!this._isMainEvent(n)||this._currentTransform)return;let o=this._shouldRender(e),u=!1;if(this.handleMultiSelection(n,e)?(e=this._activeObject,u=!0,o=!0):this._shouldClearSelection(n,e)&&this.discardActiveObject(n),this.selection&&(!e||!e.selectable&&!e.isEditing&&e!==this._activeObject)){let h=this.getScenePoint(n);this._groupSelector={x:h.x,y:h.y,deltaY:0,deltaX:0}}if(a=!!e&&e===this._activeObject,e){e.selectable&&e.activeOn==="down"&&this.setActiveObject(e,n);let h=e.findControl(this.getViewportPoint(n),ju(n));if(e===this._activeObject&&(h||!u)){this._setupCurrentTransform(n,e,a);let d=h?h.control:void 0,g=this.getScenePoint(n),m=d&&d.getMouseDownHandler(n,e,d);m&&m.call(d,n,this._currentTransform,g.x,g.y)}}o&&(this._objectsToRender=void 0),this._handleEvent(n,"down",{alreadySelected:a}),o&&this.requestRenderAll()}_resetTransformEventData(){this._targetInfo=this._viewportPoint=this._scenePoint=void 0}_cacheTransformEventData(n){this._resetTransformEventData(),this._viewportPoint=this.getViewportPoint(n),this._scenePoint=pa(this._viewportPoint,void 0,this.viewportTransform),this._targetInfo=this.findTarget(n),this._currentTransform&&(this._targetInfo.target=this._currentTransform.target)}__onMouseMove(n){if(this._isClick=!1,this._handleEvent(n,"move:before"),this.isDrawingMode)return void this._onMouseMoveInDrawingMode(n);if(!this._isMainEvent(n))return;let e=this._groupSelector;if(e){let a=this.getScenePoint(n);e.deltaX=a.x-e.x,e.deltaY=a.y-e.y,this.renderTop()}else if(this._currentTransform)this._transformObject(n);else{let{target:a}=this.findTarget(n);this._setCursorFromEvent(n,a),this._fireOverOutEvents(n,a)}this.textEditingManager.onMouseMove(n),this._handleEvent(n,"move")}_fireOverOutEvents(n,e){let{_hoveredTarget:a,_hoveredTargets:r}=this,{subTargets:o,currentTarget:u}=this.findTarget(n),h=Math.max(r.length,o.length);this.fireSyntheticInOutEvents("mouse",{e:n,target:e,oldTarget:a,actualTarget:u,oldActualTarget:this._hoveredActualTarget,fireCanvas:!0});for(let d=0;d<h;d++)o[d]===e||r[d]&&r[d]===a||this.fireSyntheticInOutEvents("mouse",{e:n,target:o[d],oldTarget:r[d]});this._hoveredActualTarget=u,this._hoveredTarget=e,this._hoveredTargets=o}_fireEnterLeaveEvents(n,e,a){let r=this._draggedoverTarget,o=this._hoveredTargets,{subTargets:u}=this.findTarget(n),h=Math.max(o.length,u.length);this.fireSyntheticInOutEvents("drag",{...a,target:e,oldTarget:r,fireCanvas:!0});for(let d=0;d<h;d++)this.fireSyntheticInOutEvents("drag",{...a,target:u[d],oldTarget:o[d]});this._draggedoverTarget=e}fireSyntheticInOutEvents(n,{target:e,oldTarget:a,actualTarget:r,oldActualTarget:o,fireCanvas:u,e:h,...d}){let{targetIn:g,targetOut:m,canvasIn:p,canvasOut:y}=_2[n],b=a!==e,S=o!==r,_=e&&b,w=r&&S,R=a&&b,Y=o&&S,X={...d,e:h,...Bl(this,h)},q={...X,target:a,nextTarget:e,actualTarget:o,nextActualTarget:r};(R||Y)&&u&&this.fire(y,q),R&&a.fire(m,q),Y&&a!==o&&o.fire(m,q);let I={...X,target:e,previousTarget:a,actualTarget:r,previousActualTarget:o};(_||w)&&u&&this.fire(p,I),_&&e.fire(g,I),w&&r!==e&&r.fire(g,I)}_transformObject(n){let e=this.getScenePoint(n),a=this._currentTransform,r=a.target,o=r.group?pa(e,void 0,r.group.calcTransformMatrix()):e;a.shiftKey=n.shiftKey,a.altKey=!!this.centeredKey&&n[this.centeredKey],this._performTransformAction(n,a,o),a.actionPerformed&&this.requestRenderAll()}_performTransformAction(n,e,a){let{action:r,actionHandler:o,target:u}=e,h=!!o&&o(n,e,a.x,a.y);h&&u.setCoords(),r==="drag"&&h&&(e.target.isMoving=!0,this.setCursor(e.target.moveCursor||this.moveCursor)),e.actionPerformed=e.actionPerformed||h}_setCursorFromEvent(n,e){if(!e)return void this.setCursor(this.defaultCursor);let a=e.hoverCursor||this.hoverCursor,r=zn(this._activeObject)?this._activeObject:null,o=(!r||e.group!==r)&&e.findControl(this.getViewportPoint(n));if(o){let{control:u,coord:h}=o;this.setCursor(u.cursorStyleHandler(n,u,e,h))}else{if(e.subTargetCheck){let{subTargets:u}=this.findTarget(n);u.concat().reverse().forEach(h=>{a=h.hoverCursor||a})}this.setCursor(a)}}handleMultiSelection(n,e){let a=this._activeObject,r=zn(a);if(a&&this._isSelectionKeyPressed(n)&&this.selection&&e&&e.selectable&&(a!==e||r)&&(r||!e.isDescendantOf(a)&&!a.isDescendantOf(e))&&!e.onSelect({e:n})&&!a.getActiveControl()){if(r){let o=a.getObjects(),u=[];if(e===a){let h=this.getScenePoint(n),d=this.searchPossibleTargets(o,h);if(d.target?(e=d.target,u=d.subTargets):(d=this.searchPossibleTargets(this._objects,h),e=d.target,u=d.subTargets),!e||!e.selectable)return!1}e.group===a?(a.remove(e),this._hoveredTarget=e,this._hoveredTargets=u,a.size()===1&&this._setActiveObject(a.item(0),n)):(a.multiSelectAdd(e),this._hoveredTarget=a,this._hoveredTargets=u),this._fireSelectionEvents(o,n)}else{a.isEditing&&a.exitEditing();let o=new(nt.getClass("ActiveSelection"))([],{canvas:this});o.multiSelectAdd(a,e),this._hoveredTarget=o,this._setActiveObject(o,n),this._fireSelectionEvents([a],n)}return!0}return!1}handleSelection(n){if(!this.selection||!this._groupSelector)return!1;let{x:e,y:a,deltaX:r,deltaY:o}=this._groupSelector,u=new H(e,a),h=u.add(new H(r,o)),d=u.min(h),g=u.max(h).subtract(d),m=this.collectObjects({left:d.x,top:d.y,width:g.x,height:g.y},{includeIntersecting:!this.selectionFullyContained}),p=u.eq(h)?m[0]?[m[0]]:[]:m.length>1?m.filter(y=>!y.onSelect({e:n})).reverse():m;if(p.length===1)this.setActiveObject(p[0],n);else if(p.length>1){let y=nt.getClass("ActiveSelection");this.setActiveObject(new y(p,{canvas:this}),n)}return this._groupSelector=null,!0}toCanvasElement(n=1,e){let{upper:a}=this.elements;a.ctx=void 0;let r=super.toCanvasElement(n,e);return a.ctx=a.el.getContext("2d"),r}clear(){this.textEditingManager.clear(),super.clear()}destroy(){this.removeListeners(),this.textEditingManager.dispose(),super.destroy()}};const Pb={x1:0,y1:0,x2:0,y2:0},C2={...Pb,r1:0,r2:0},Gl=(n,e)=>isNaN(n)&&typeof e=="number"?e:n;function Qb(n){return n&&/%$/.test(n)&&Number.isFinite(parseFloat(n))}function Kb(n,e){return Xn(0,Gl(typeof n=="number"?n:typeof n=="string"?parseFloat(n)/(Qb(n)?100:1):NaN,e),1)}const T2=/\s*;\s*/,w2=/\s*:\s*/;function O2(n,e){let a,r,o=n.getAttribute("style");if(o){let h=o.split(T2);h[h.length-1]===""&&h.pop();for(let d=h.length;d--;){let[g,m]=h[d].split(w2).map(p=>p.trim());g==="stop-color"?a=m:g==="stop-opacity"&&(r=m)}}a=a||n.getAttribute("stop-color")||"rgb(0,0,0)",r=Gl(parseFloat(r||n.getAttribute("stop-opacity")||""),1);let u=new ni(a);return u.setAlpha(u.getAlpha()*r*e),{offset:Kb(n.getAttribute("offset"),0),color:u.toRgba()}}function E2(n,e){let a=[],r=n.getElementsByTagName("stop"),o=Kb(e,1);for(let u=r.length;u--;)a.push(O2(r[u],o));return a}function Ib(n){return n.nodeName==="linearGradient"||n.nodeName==="LINEARGRADIENT"?"linear":"radial"}function Wb(n){return n.getAttribute("gradientUnits")==="userSpaceOnUse"?"pixels":"percentage"}function wi(n,e){return n.getAttribute(e)}function D2(n,e){return(function(a,{width:r,height:o,gradientUnits:u}){let h;return Object.entries(a).reduce((d,[g,m])=>{if(m==="Infinity")h=1;else if(m==="-Infinity")h=0;else{let p=typeof m=="string";h=p?parseFloat(m):m,p&&Qb(m)&&(h*=.01,u==="pixels"&&(g!=="x1"&&g!=="x2"&&g!=="r2"||(h*=r),g!=="y1"&&g!=="y2"||(h*=o)))}return d[g]=h,d},{})})(Ib(n)==="linear"?(function(a){return{x1:wi(a,"x1")||0,y1:wi(a,"y1")||0,x2:wi(a,"x2")||"100%",y2:wi(a,"y2")||0}})(n):(function(a){return{x1:wi(a,"fx")||wi(a,"cx")||"50%",y1:wi(a,"fy")||wi(a,"cy")||"50%",r1:0,x2:wi(a,"cx")||"50%",y2:wi(a,"cy")||"50%",r2:wi(a,"r")||"50%"}})(n),{...e,gradientUnits:Wb(n)})}var ns=class{constructor(n){let{type:e="linear",gradientUnits:a="pixels",coords:r={},colorStops:o=[],offsetX:u=0,offsetY:h=0,gradientTransform:d,id:g}=n||{};Object.assign(this,{type:e,gradientUnits:a,coords:{...e==="radial"?C2:Pb,...r},colorStops:o,offsetX:u,offsetY:h,gradientTransform:d,id:g?`${g}_${en()}`:en()})}addColorStop(n){for(let e in n)this.colorStops.push({offset:parseFloat(e),color:n[e]});return this}toObject(n){return{...Fn(this,n),type:this.type,coords:{...this.coords},colorStops:this.colorStops.map(e=>({...e})),offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?[...this.gradientTransform]:void 0}}toSVG(n,{additionalTransform:e}={}){let a=[],r=this.gradientTransform?this.gradientTransform.concat():Ne.concat(),o=this.gradientUnits==="pixels"?"userSpaceOnUse":"objectBoundingBox",u=this.colorStops.map(y=>({...y})).sort((y,b)=>y.offset-b.offset),h=-this.offsetX,d=-this.offsetY;var g;o==="objectBoundingBox"?(h/=n.width,d/=n.height):(h+=n.width/2,d+=n.height/2),(g=n)&&typeof g._renderPathCommands=="function"&&this.gradientUnits!=="percentage"&&(h-=n.pathOffset.x,d-=n.pathOffset.y),r[4]-=h,r[5]-=d;let m=[`id="SVGID_${_t(String(this.id))}"`,`gradientUnits="${o}"`,`gradientTransform="${e?e+" ":""}${Wl(r)}"`,""].join(" "),p=y=>parseFloat(String(y));if(this.type==="linear"){let{x1:y,y1:b,x2:S,y2:_}=this.coords,w=p(y),R=p(b),Y=p(S),X=p(_);a.push("<linearGradient ",m,' x1="',w,'" y1="',R,'" x2="',Y,'" y2="',X,`">
|
|
50
|
+
`)}else if(this.type==="radial"){let{x1:y,y1:b,x2:S,y2:_,r1:w,r2:R}=this.coords,Y=p(y),X=p(b),q=p(S),I=p(_),W=p(w),$=p(R),B=W>$;a.push("<radialGradient ",m,' cx="',B?Y:q,'" cy="',B?X:I,'" r="',B?W:$,'" fx="',B?q:Y,'" fy="',B?I:X,`">
|
|
51
|
+
`),B&&(u.reverse(),u.forEach(lt=>{lt.offset=1-lt.offset}));let G=Math.min(W,$);if(G>0){let lt=G/Math.max(W,$);u.forEach(ut=>{ut.offset+=lt*(1-ut.offset)})}}return u.forEach(({color:y,offset:b})=>{let S=String(y),_=Gu(S)?S:new ni(S).toRgba();a.push(`<stop offset="${100*b}%" style="stop-color:${_t(_)};"/>
|
|
52
|
+
`)}),a.push(this.type==="linear"?"</linearGradient>":"</radialGradient>",`
|
|
53
|
+
`),a.join("")}toLive(n){let{x1:e,y1:a,x2:r,y2:o,r1:u,r2:h}=this.coords,d=this.type==="linear"?n.createLinearGradient(e,a,r,o):n.createRadialGradient(e,a,u,r,o,h);return this.colorStops.forEach(({color:g,offset:m})=>{d.addColorStop(m,g)}),d}static async fromObject(n){let{colorStops:e,gradientTransform:a}=n;return new this({...n,colorStops:e?e.map(r=>({...r})):void 0,gradientTransform:a?[...a]:void 0})}static fromElement(n,e,a){let r=Wb(n),o=e._findCenterFromElement();return new this({id:n.getAttribute("id")||void 0,type:Ib(n),coords:D2(n,{width:a.viewBoxWidth||a.width,height:a.viewBoxHeight||a.height}),colorStops:E2(n,a.opacity),gradientUnits:r,gradientTransform:td(n.getAttribute("gradientTransform")||""),...r==="pixels"?{offsetX:e.width/2-o.x,offsetY:e.height/2-o.y}:{offsetX:0,offsetY:0}})}};D(ns,"type","Gradient"),nt.setClass(ns,"gradient"),nt.setClass(ns,"linear"),nt.setClass(ns,"radial");var Vf=class{get type(){return"pattern"}set type(n){tn("warn","Setting type has no effect",n)}constructor(n){D(this,"repeat","repeat"),D(this,"offsetX",0),D(this,"offsetY",0),D(this,"crossOrigin",""),this.id=en(),Object.assign(this,n)}isImageSource(){return!!this.source&&typeof this.source.src=="string"}isCanvasSource(){return!!this.source&&!!this.source.toDataURL}sourceToString(){return this.isImageSource()?this.source.src:this.isCanvasSource()?this.source.toDataURL():""}toLive(n){return this.source&&(!this.isImageSource()||this.source.complete&&this.source.naturalWidth!==0&&this.source.naturalHeight!==0)?n.createPattern(this.source,this.repeat):null}toObject(n=[]){let{repeat:e,crossOrigin:a}=this;return{...Fn(this,n),type:"pattern",source:this.sourceToString(),repeat:e,crossOrigin:a,offsetX:Vt(this.offsetX,Yt.NUM_FRACTION_DIGITS),offsetY:Vt(this.offsetY,Yt.NUM_FRACTION_DIGITS),patternTransform:this.patternTransform?[...this.patternTransform]:null}}toSVG({width:n,height:e}){let{source:a,repeat:r,id:o}=this,u=Gl(this.offsetX/n,0),h=Gl(this.offsetY/e,0),d=r==="repeat-y"||r==="no-repeat"?1+Math.abs(u||0):Gl(a.width/n,0),g=r==="repeat-x"||r==="no-repeat"?1+Math.abs(h||0):Gl(a.height/e,0);return[`<pattern id="SVGID_${_t(o)}" x="${u}" y="${h}" width="${d}" height="${g}">`,`<image x="0" y="0" width="${a.width}" height="${a.height}" xlink:href="${_t(this.sourceToString())}"></image>`,"</pattern>",""].join(`
|
|
54
|
+
`)}static async fromObject({type:n,source:e,patternTransform:a,...r},o){let u=await Ts(e,{...o,crossOrigin:r.crossOrigin});return new this({...r,patternTransform:a&&a.slice(0),source:u})}};D(Vf,"type","Pattern"),nt.setClass(Vf),nt.setClass(Vf,"pattern");var es=class Zb extends Oe{constructor(e,{path:a,left:r,top:o,...u}={}){super(),Object.assign(this,Zb.ownDefaults),this.setOptions(u),this._setPath(e||[],!0),typeof r=="number"&&this.set("left",r),typeof o=="number"&&this.set("top",o)}_setPath(e,a){this.path=Mb(Array.isArray(e)?e:kb(e)),this.setBoundingBox(a)}_findCenterFromElement(){let e=this._calcBoundsFromPath();return new H(e.left+e.width/2,e.top+e.height/2)}_renderPathCommands(e){let a=-this.pathOffset.x,r=-this.pathOffset.y;e.beginPath();for(let o of this.path)switch(o[0]){case"L":e.lineTo(o[1]+a,o[2]+r);break;case"M":e.moveTo(o[1]+a,o[2]+r);break;case"C":e.bezierCurveTo(o[1]+a,o[2]+r,o[3]+a,o[4]+r,o[5]+a,o[6]+r);break;case"Q":e.quadraticCurveTo(o[1]+a,o[2]+r,o[3]+a,o[4]+r);break;case"Z":e.closePath()}}_render(e){this._renderPathCommands(e),this._renderPaintInOrder(e)}toString(){return`#<Path (${this.complexity()}): { "top": ${this.top}, "left": ${this.left} }>`}toObject(e=[]){return{...super.toObject(e),path:this.path.map(a=>a.slice())}}toDatalessObject(e=[]){let a=this.toObject(e);return this.sourcePath&&(delete a.path,a.sourcePath=this.sourcePath),a}_toSVG(){return["<path ","COMMON_PARTS",`d="${Bb(this.path,Yt.NUM_FRACTION_DIGITS)}" stroke-linecap="round" />
|
|
55
|
+
`]}_getOffsetTransform(){let e=Yt.NUM_FRACTION_DIGITS;return` translate(${Vt(-this.pathOffset.x,e)}, ${Vt(-this.pathOffset.y,e)})`}toClipPathSVG(e){let a=this._getOffsetTransform();return" "+this._createBaseClipPathSVGMarkup(this._toSVG(),{reviver:e,additionalTransform:a})}toSVG(e){let a=this._getOffsetTransform();return this._createBaseSVGMarkup(this._toSVG(),{reviver:e,additionalTransform:a})}complexity(){return this.path.length}setDimensions(){this.setBoundingBox()}setBoundingBox(e){let{width:a,height:r,pathOffset:o}=this._calcDimensions();this.set({width:a,height:r,pathOffset:o}),e&&this.setPositionByOrigin(o,"center","center")}_calcBoundsFromPath(){let e=[],a=0,r=0,o=0,u=0;for(let h of this.path)switch(h[0]){case"L":o=h[1],u=h[2],e.push({x:a,y:r},{x:o,y:u});break;case"M":o=h[1],u=h[2],a=o,r=u;break;case"C":e.push(...rd(o,u,h[1],h[2],h[3],h[4],h[5],h[6])),o=h[5],u=h[6];break;case"Q":e.push(...rd(o,u,h[1],h[2],h[1],h[2],h[3],h[4])),o=h[3],u=h[4];break;case"Z":o=a,u=r}return Ki(e)}_calcDimensions(){let e=this._calcBoundsFromPath();return{...e,pathOffset:new H(e.left+e.width/2,e.top+e.height/2)}}static fromObject(e){return this._fromObject(e,{extraParam:"path"})}static async fromElement(e,a,r){let{d:o,...u}=ba(e,this.ATTRIBUTE_NAMES,r);return new this(o,{...u,...a,left:void 0,top:void 0})}};D(es,"type","Path"),D(es,"cacheProperties",[...va,"path","fillRule"]),D(es,"ATTRIBUTE_NAMES",[...sn,"d"]),nt.setClass(es),nt.setSVGClass(es);const $b=["radius","startAngle","endAngle","counterClockwise"];var Ll=class cd extends Oe{static getDefaults(){return{...super.getDefaults(),...cd.ownDefaults}}constructor(e){super(),Object.assign(this,cd.ownDefaults),this.setOptions(e)}_set(e,a){return super._set(e,a),e==="radius"&&this.setRadius(a),this}_render(e){e.beginPath(),e.arc(0,0,this.radius,It(this.startAngle),It(this.endAngle),this.counterClockwise),this._renderPaintInOrder(e)}getRadiusX(){return this.get("radius")*this.get(nn)}getRadiusY(){return this.get("radius")*this.get(ln)}setRadius(e){this.radius=e,this.set({width:2*e,height:2*e})}toObject(e=[]){return super.toObject([...$b,...e])}_toSVG(){let{radius:e,startAngle:a,endAngle:r}=this,o=(r-a)%360;if(o===0)return["<circle ","COMMON_PARTS",'cx="0" cy="0" ','r="',`${_t(e)}`,`" />
|
|
56
|
+
`];{let u=It(a),h=It(r),d=ji(u)*e,g=Ri(u)*e,m=ji(h)*e,p=Ri(h)*e;return[`<path d="M ${d} ${g} A ${e} ${e} 0 ${+(o>180)} ${+!this.counterClockwise} ${m} ${p}" `,"COMMON_PARTS",` />
|
|
57
|
+
`]}}static async fromElement(e,a,r){let{left:o=0,top:u=0,radius:h=0,...d}=ba(e,this.ATTRIBUTE_NAMES,r);return new this({...d,radius:h,left:o-h,top:u-h})}static fromObject(e){return super._fromObject(e)}};D(Ll,"type","Circle"),D(Ll,"cacheProperties",[...va,...$b]),D(Ll,"ownDefaults",{radius:0,startAngle:0,endAngle:360,counterClockwise:!1}),D(Ll,"ATTRIBUTE_NAMES",["cx","cy","r",...sn]),nt.setClass(Ll),nt.setSVGClass(Ll);const hd=["x1","x2","y1","y2"];var Nn=class Jb extends Oe{constructor([e,a,r,o]=[0,0,0,0],u={}){super(),Object.assign(this,Jb.ownDefaults),this.setOptions(u),this.x1=e,this.x2=r,this.y1=a,this.y2=o,this._setWidthHeight();let{left:h,top:d}=u;typeof h=="number"&&this.set("left",h),typeof d=="number"&&this.set("top",d)}_setWidthHeight(){let{x1:e,y1:a,x2:r,y2:o}=this;this.width=Math.abs(r-e),this.height=Math.abs(o-a);let{left:u,top:h,width:d,height:g}=Ki([{x:e,y:a},{x:r,y:o}]),m=new H(u+d/2,h+g/2);this.setPositionByOrigin(m,Ft,Ft)}_set(e,a){return super._set(e,a),hd.includes(e)&&this._setWidthHeight(),this}_render(e){e.beginPath();let a=this.calcLinePoints();e.moveTo(a.x1,a.y1),e.lineTo(a.x2,a.y2),e.lineWidth=this.strokeWidth;let r=e.strokeStyle;var o;yi(this.stroke)?e.strokeStyle=this.stroke.toLive(e):e.strokeStyle=(o=this.stroke)==null?e.fillStyle:o,this.stroke&&this._renderStroke(e),e.strokeStyle=r}_findCenterFromElement(){return new H((this.x1+this.x2)/2,(this.y1+this.y2)/2)}toObject(e=[]){return{...super.toObject(e),...this.calcLinePoints()}}_getNonTransformedDimensions(){let e=super._getNonTransformedDimensions();return this.strokeLineCap==="butt"&&(this.width===0&&(e.y-=this.strokeWidth),this.height===0&&(e.x-=this.strokeWidth)),e}calcLinePoints(){let{x1:e,x2:a,y1:r,y2:o,width:u,height:h}=this,d=e<=a?-.5:.5,g=r<=o?-.5:.5;return{x1:d*u,x2:d*-u,y1:g*h,y2:g*-h}}_toSVG(){let{x1:e,x2:a,y1:r,y2:o}=this.calcLinePoints();return["<line ","COMMON_PARTS",`x1="${e}" y1="${r}" x2="${a}" y2="${o}" />
|
|
58
|
+
`]}static async fromElement(e,a,r){let{x1:o=0,y1:u=0,x2:h=0,y2:d=0,...g}=ba(e,this.ATTRIBUTE_NAMES,r);return new this([o,u,h,d],g)}static fromObject({x1:e,y1:a,x2:r,y2:o,...u}){return this._fromObject({...u,points:[e,a,r,o]},{extraParam:"points"})}};D(Nn,"type","Line"),D(Nn,"cacheProperties",[...va,...hd]),D(Nn,"ATTRIBUTE_NAMES",sn.concat(hd)),nt.setClass(Nn),nt.setSVGClass(Nn);var gu=class fd extends Oe{static getDefaults(){return{...super.getDefaults(),...fd.ownDefaults}}constructor(e){super(),Object.assign(this,fd.ownDefaults),this.setOptions(e)}_render(e){let a=this.width/2,r=this.height/2;e.beginPath(),e.moveTo(-a,r),e.lineTo(0,-r),e.lineTo(a,r),e.closePath(),this._renderPaintInOrder(e)}_toSVG(){let e=this.width/2,a=this.height/2;return["<polygon ","COMMON_PARTS",'points="',`${-e} ${a},0 ${-a},${e} ${a}`,'" />']}};D(gu,"type","Triangle"),D(gu,"ownDefaults",{width:100,height:100}),nt.setClass(gu),nt.setSVGClass(gu);const tx=["rx","ry"];var Hl=class dd extends Oe{static getDefaults(){return{...super.getDefaults(),...dd.ownDefaults}}constructor(e){super(),Object.assign(this,dd.ownDefaults),this.setOptions(e)}_set(e,a){switch(super._set(e,a),e){case"rx":this.rx=a,this.set("width",2*a);break;case"ry":this.ry=a,this.set("height",2*a)}return this}getRx(){return this.get("rx")*this.get(nn)}getRy(){return this.get("ry")*this.get(ln)}toObject(e=[]){return super.toObject([...tx,...e])}_toSVG(){return["<ellipse ","COMMON_PARTS",`cx="0" cy="0" rx="${_t(this.rx)}" ry="${_t(this.ry)}" />
|
|
59
|
+
`]}_render(e){e.beginPath(),e.save(),e.transform(1,0,0,this.ry/this.rx,0,0),e.arc(0,0,this.rx,0,Ai,!1),e.restore(),this._renderPaintInOrder(e)}static async fromElement(e,a,r){let o=ba(e,this.ATTRIBUTE_NAMES,r);return o.left=(o.left||0)-o.rx,o.top=(o.top||0)-o.ry,new this(o)}};D(Hl,"type","Ellipse"),D(Hl,"cacheProperties",[...va,...tx]),D(Hl,"ownDefaults",{rx:0,ry:0}),D(Hl,"ATTRIBUTE_NAMES",[...sn,"cx","cy","rx","ry"]),nt.setClass(Hl),nt.setSVGClass(Hl);const ex={exactBoundingBox:!1};var Za=class gd extends Oe{static getDefaults(){return{...super.getDefaults(),...gd.ownDefaults}}constructor(e=[],a={}){super(),D(this,"strokeDiff",void 0),Object.assign(this,gd.ownDefaults),this.setOptions(a),this.points=e;let{left:r,top:o}=a;this.initialized=!0,this.setBoundingBox(!0),typeof r=="number"&&this.set("left",r),typeof o=="number"&&this.set("top",o)}isOpen(){return!0}_projectStrokeOnPoints(e){return Sb(this.points,e,this.isOpen())}_calcDimensions(e){e={scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,strokeLineCap:this.strokeLineCap,strokeLineJoin:this.strokeLineJoin,strokeMiterLimit:this.strokeMiterLimit,strokeUniform:this.strokeUniform,strokeWidth:this.strokeWidth,...e||{}};let a=this.exactBoundingBox?this._projectStrokeOnPoints(e).map(m=>m.projectedPoint):this.points;if(a.length===0)return{left:0,top:0,width:0,height:0,pathOffset:new H,strokeOffset:new H,strokeDiff:new H};let r=Ki(a),o=Rs({...e,scaleX:1,scaleY:1}),u=Ki(this.points.map(m=>we(m,o,!0))),h=new H(this.scaleX,this.scaleY),d=r.left+r.width/2,g=r.top+r.height/2;return this.exactBoundingBox&&(d-=g*Math.tan(It(this.skewX)),g-=d*Math.tan(It(this.skewY))),{...r,pathOffset:new H(d,g),strokeOffset:new H(u.left,u.top).subtract(new H(r.left,r.top)).multiply(h),strokeDiff:new H(r.width,r.height).subtract(new H(u.width,u.height)).multiply(h)}}_findCenterFromElement(){let e=Ki(this.points);return new H(e.left+e.width/2,e.top+e.height/2)}setDimensions(){this.setBoundingBox()}setBoundingBox(e){let{left:a,top:r,width:o,height:u,pathOffset:h,strokeOffset:d,strokeDiff:g}=this._calcDimensions();this.set({width:o,height:u,pathOffset:h,strokeOffset:d,strokeDiff:g}),e&&this.setPositionByOrigin(new H(a+o/2,r+u/2),"center","center")}isStrokeAccountedForInDimensions(){return this.exactBoundingBox}_getNonTransformedDimensions(){return this.exactBoundingBox?new H(this.width,this.height):super._getNonTransformedDimensions()}_getTransformedDimensions(e={}){if(this.exactBoundingBox){let h;if(Object.keys(e).some(d=>this.strokeUniform||this.constructor.layoutProperties.includes(d))){var a,r;let{width:d,height:g}=this._calcDimensions(e);h=new H((a=e.width)==null?d:a,(r=e.height)==null?g:r)}else{var o,u;h=new H((o=e.width)==null?this.width:o,(u=e.height)==null?this.height:u)}return h.multiply(new H(e.scaleX||this.scaleX,e.scaleY||this.scaleY))}return super._getTransformedDimensions(e)}_set(e,a){let r=this.initialized&&this[e]!==a,o=super._set(e,a);return this.exactBoundingBox&&r&&((e==="scaleX"||e==="scaleY")&&this.strokeUniform&&this.constructor.layoutProperties.includes("strokeUniform")||this.constructor.layoutProperties.includes(e))&&this.setDimensions(),o}toObject(e=[]){return{...super.toObject(e),points:this.points.map(({x:a,y:r})=>({x:a,y:r}))}}_toSVG(){let e=this.pathOffset.x,a=this.pathOffset.y,r=Yt.NUM_FRACTION_DIGITS,o=this.points.map(({x:u,y:h})=>`${Vt(u-e,r)},${Vt(h-a,r)}`).join(" ");return[`<${_t(this.constructor.type).toLowerCase()} `,"COMMON_PARTS",`points="${o}" />
|
|
60
|
+
`]}_render(e){let a=this.points.length,r=this.pathOffset.x,o=this.pathOffset.y;if(a&&!isNaN(this.points[a-1].y)){e.beginPath(),e.moveTo(this.points[0].x-r,this.points[0].y-o);for(let u=0;u<a;u++){let h=this.points[u];e.lineTo(h.x-r,h.y-o)}!this.isOpen()&&e.closePath(),this._renderPaintInOrder(e)}}complexity(){return this.points.length}static async fromElement(e,a,r){let o=(function(g){if(!g)return[];let m=g.replace(/,/g," ").trim().split(/\s+/),p=[];for(let y=0;y<m.length;y+=2)p.push({x:parseFloat(m[y]),y:parseFloat(m[y+1])});return p})(e.getAttribute("points")),{left:u,top:h,...d}=ba(e,this.ATTRIBUTE_NAMES,r);return new this(o,{...d,...a})}static fromObject(e){return this._fromObject(e,{extraParam:"points"})}};D(Za,"ownDefaults",ex),D(Za,"type","Polyline"),D(Za,"layoutProperties",[tr,er,"strokeLineCap","strokeLineJoin","strokeMiterLimit","strokeWidth","strokeUniform","points"]),D(Za,"cacheProperties",[...va,"points"]),D(Za,"ATTRIBUTE_NAMES",[...sn]),nt.setClass(Za),nt.setSVGClass(Za);var mu=class extends Za{isOpen(){return!1}};D(mu,"ownDefaults",ex),D(mu,"type","Polygon"),nt.setClass(mu),nt.setSVGClass(mu);var ix=class extends Oe{isEmptyStyles(n){if(!this.styles||n!==void 0&&!this.styles[n])return!0;let e=n===void 0?this.styles:{line:this.styles[n]};for(let a in e)for(let r in e[a])for(let o in e[a][r])return!1;return!0}styleHas(n,e){if(!this.styles||e!==void 0&&!this.styles[e])return!1;let a=e===void 0?this.styles:{0:this.styles[e]};for(let r in a)for(let o in a[r])if(a[r][o][n]!==void 0)return!0;return!1}cleanStyle(n){if(!this.styles)return!1;let e=this.styles,a,r,o=0,u=!0,h=0;for(let d in e){a=0;for(let g in e[d]){let m=e[d][g]||{};o++,m[n]===void 0?u=!1:(r?m[n]!==r&&(u=!1):r=m[n],m[n]===this[n]&&delete m[n]),Object.keys(m).length===0?delete e[d][g]:a++}a===0&&delete e[d]}for(let d=0;d<this._textLines.length;d++)h+=this._textLines[d].length;u&&o===h&&(this[n]=r,this.removeStyle(n))}removeStyle(n){if(!this.styles)return;let e=this.styles,a,r,o;for(r in e){for(o in a=e[r],a)delete a[o][n],Object.keys(a[o]).length===0&&delete a[o];Object.keys(a).length===0&&delete e[r]}}_extendStyles(n,e){let{lineIndex:a,charIndex:r}=this.get2DCursorLocation(n);this._getLineStyle(a)||this._setLineStyle(a);let o=Ad({...this._getStyleDeclaration(a,r),...e},u=>u!==void 0);this._setStyleDeclaration(a,r,o)}getSelectionStyles(n,e,a){let r=[];for(let o=n;o<(e||n);o++)r.push(this.getStyleAtPosition(o,a));return r}getStyleAtPosition(n,e){let{lineIndex:a,charIndex:r}=this.get2DCursorLocation(n);return e?this.getCompleteStyleDeclaration(a,r):this._getStyleDeclaration(a,r)}setSelectionStyles(n,e,a){for(let r=e;r<(a||e);r++)this._extendStyles(r,n);this._forceClearCache=!0}_getStyleDeclaration(n,e){var a;let r=this.styles&&this.styles[n];return r&&(a=r[e])!=null?a:{}}getCompleteStyleDeclaration(n,e){return{...Fn(this,this.constructor._styleProperties),...this._getStyleDeclaration(n,e)}}_setStyleDeclaration(n,e,a){this.styles[n][e]=a}_deleteStyleDeclaration(n,e){delete this.styles[n][e]}_getLineStyle(n){return!!this.styles[n]}_setLineStyle(n){this.styles[n]={}}_deleteLineStyle(n){delete this.styles[n]}};D(ix,"_styleProperties",X_);const M2=/ +/g,A2=/"/g;function Ff(n,e,a,r,o){return` ${((u,{left:h,top:d,width:g,height:m},p=Yt.NUM_FRACTION_DIGITS)=>{let y=Ms(Xe,u,!1),[b,S,_,w]=[h,d,g,m].map(R=>Vt(R,p));return`<rect ${y} x="${b}" y="${S}" width="${_}" height="${w}"></rect>`})(n,{left:e,top:a,width:r,height:o})}
|
|
61
|
+
`}let Gf;var ei=class ls extends ix{static getDefaults(){return{...super.getDefaults(),...ls.ownDefaults}}constructor(e,a){super(),D(this,"__charBounds",[]),Object.assign(this,ls.ownDefaults),this.setOptions(a),this.styles||(this.styles={}),this.text=e,this.initialized=!0,this.path&&this.setPathInfo(),this.initDimensions(),this.setCoords()}setPathInfo(){let e=this.path;e&&(e.segmentsInfo=Id(e.path))}_splitText(){let e=this._splitTextIntoLines(this.text);return this.textLines=e.lines,this._textLines=e.graphemeLines,this._unwrappedTextLines=e._unwrappedLines,this._text=e.graphemeText,e}initDimensions(){this._splitText(),this._clearCache(),this.dirty=!0,this.path?(this.width=this.path.width,this.height=this.path.height):(this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.height=this.calcTextHeight()),this.textAlign.includes("justify")&&this.enlargeSpaces()}enlargeSpaces(){let e,a,r,o,u,h,d;for(let g=0,m=this._textLines.length;g<m;g++)if((this.textAlign==="justify"||g!==m-1&&!this.isEndOfWrapping(g))&&(o=0,u=this._textLines[g],a=this.getLineWidth(g),a<this.width&&(d=this.textLines[g].match(this._reSpacesAndTabs)))){r=d.length,e=(this.width-a)/r;for(let p=0;p<=u.length;p++)h=this.__charBounds[g][p],this._reSpaceAndTab.test(u[p])?(h.width+=e,h.kernedWidth+=e,h.left+=o,o+=e):h.left+=o}}isEndOfWrapping(e){return e===this._textLines.length-1}missingNewlineOffset(e){return 1}get2DCursorLocation(e,a){let r=a?this._unwrappedTextLines:this._textLines,o;for(o=0;o<r.length;o++){if(e<=r[o].length)return{lineIndex:o,charIndex:e};e-=r[o].length+this.missingNewlineOffset(o,a)}return{lineIndex:o-1,charIndex:r[o-1].length<e?r[o-1].length:e}}toString(){return`#<Text (${this.complexity()}): { "text": "${this.text}", "fontFamily": "${this.fontFamily}" }>`}_getCacheCanvasDimensions(){let e=super._getCacheCanvasDimensions(),a=this.fontSize;return e.width+=a*e.zoomX,e.height+=a*e.zoomY,e}_render(e){let a=this.path;a&&!a.isNotVisible()&&a._render(e),this._setTextStyles(e),this._renderTextLinesBackground(e),this._renderTextDecoration(e,"underline"),this._renderText(e),this._renderTextDecoration(e,"overline"),this._renderTextDecoration(e,"linethrough")}_renderText(e){this.paintFirst==="stroke"?(this._renderTextStroke(e),this._renderTextFill(e)):(this._renderTextFill(e),this._renderTextStroke(e))}_setTextStyles(e,a,r){if(e.textBaseline="alphabetic",this.path)switch(this.pathAlign){case Ft:e.textBaseline="middle";break;case"ascender":e.textBaseline="top";break;case"descender":e.textBaseline=gy}e.font=this._getFontDeclaration(a,r)}calcTextWidth(){let e=this.getLineWidth(0);for(let a=1,r=this._textLines.length;a<r;a++){let o=this.getLineWidth(a);o>e&&(e=o)}return e}_renderTextLine(e,a,r,o,u,h){this._renderChars(e,a,r,o,u,h)}_renderTextLinesBackground(e){if(!this.textBackgroundColor&&!this.styleHas("textBackgroundColor"))return;let a=e.fillStyle,r=this._getLeftOffset(),o=this._getTopOffset();for(let u=0,h=this._textLines.length;u<h;u++){let d=this.getHeightOfLine(u);if(!this.textBackgroundColor&&!this.styleHas("textBackgroundColor",u)){o+=d;continue}let g=this._textLines[u].length,m=this._getLineLeftOffset(u),p,y,b=0,S=0,_=this.getValueOfPropertyAt(u,0,"textBackgroundColor"),w=this.getHeightOfLineImpl(u);for(let R=0;R<g;R++){let Y=this.__charBounds[u][R];y=this.getValueOfPropertyAt(u,R,"textBackgroundColor"),this.path?(e.save(),e.translate(Y.renderLeft,Y.renderTop),e.rotate(Y.angle),e.fillStyle=y,y&&e.fillRect(-Y.width/2,-w*(1-this._fontSizeFraction),Y.width,w),e.restore()):y===_?b+=Y.kernedWidth:(p=r+m+S,this.direction==="rtl"&&(p=this.width-p-b),e.fillStyle=_,_&&e.fillRect(p,o,b,w),S=Y.left,b=Y.width,_=y)}y&&!this.path&&(p=r+m+S,this.direction==="rtl"&&(p=this.width-p-b),e.fillStyle=y,e.fillRect(p,o,b,w)),o+=d}e.fillStyle=a,this._removeShadow(e)}_measureChar(e,a,r,o){let u=_s.getFontCache(a),h=this._getFontDeclaration(a),d=r?r+e:e,g=r&&h===this._getFontDeclaration(o),m=a.fontSize/this.CACHE_FONT_SIZE,p,y,b,S;if(r&&u.has(r)&&(b=u.get(r)),u.has(e)&&(S=p=u.get(e)),g&&u.has(d)&&(y=u.get(d),S=y-b),p===void 0||b===void 0||y===void 0){let _=(Gf||(Gf=ai({width:0,height:0}).getContext("2d")),Gf);this._setTextStyles(_,a,!0),p===void 0&&(S=p=_.measureText(e).width,u.set(e,p)),b===void 0&&g&&r&&(b=_.measureText(r).width,u.set(r,b)),g&&y===void 0&&(y=_.measureText(d).width,u.set(d,y),S=y-b)}return{width:p*m,kernedWidth:S*m}}getHeightOfChar(e,a){return this.getValueOfPropertyAt(e,a,"fontSize")}measureLine(e){let a=this._measureLine(e);return this.charSpacing!==0&&(a.width-=this._getWidthOfCharSpacing()),a.width<0&&(a.width=0),a}_measureLine(e){let a,r,o=0,u=this.pathSide===Di,h=this.path,d=this._textLines[e],g=d.length,m=Array(g);this.__charBounds[e]=m;for(let p=0;p<g;p++){let y=d[p];r=this._getGraphemeBox(y,e,p,a),m[p]=r,o+=r.kernedWidth,a=y}if(m[g]={left:r?r.left+r.width:0,width:0,kernedWidth:0,height:this.fontSize,deltaY:0},h&&h.segmentsInfo){let p=0,y=h.segmentsInfo[h.segmentsInfo.length-1].length;switch(this.textAlign){case de:p=u?y-o:0;break;case Ft:p=(y-o)/2;break;case Di:p=u?0:y-o}p+=this.pathStartOffset*(u?-1:1);for(let b=u?g-1:0;u?b>=0:b<g;u?b--:b++)r=m[b],p>y?p%=y:p<0&&(p+=y),this._setGraphemeOnPath(p,r),p+=r.kernedWidth}return{width:o,numOfSpaces:0}}_setGraphemeOnPath(e,a){let r=e+a.kernedWidth/2,o=this.path,u=Nb(o.path,r,o.segmentsInfo);a.renderLeft=u.x-o.pathOffset.x,a.renderTop=u.y-o.pathOffset.y,a.angle=u.angle+(this.pathSide==="right"?Math.PI:0)}_getGraphemeBox(e,a,r,o,u){let h=this.getCompleteStyleDeclaration(a,r),d=o?this.getCompleteStyleDeclaration(a,r-1):{},g=this._measureChar(e,h,o,d),m,p=g.kernedWidth,y=g.width;this.charSpacing!==0&&(m=this._getWidthOfCharSpacing(),y+=m,p+=m);let b={width:y,left:0,height:h.fontSize,kernedWidth:p,deltaY:h.deltaY};if(r>0&&!u){let S=this.__charBounds[a][r-1];b.left=S.left+S.width+g.kernedWidth-g.width}return b}getHeightOfLineImpl(e){let a=this.__lineHeights;if(a[e])return a[e];let r=this.getHeightOfChar(e,0);for(let o=1,u=this._textLines[e].length;o<u;o++)r=Math.max(this.getHeightOfChar(e,o),r);return a[e]=r*this._fontSizeMult}getHeightOfLine(e){return this.getHeightOfLineImpl(e)*this.lineHeight}calcTextHeight(){let e=0;for(let a=0,r=this._textLines.length;a<r;a++)e+=a===r-1?this.getHeightOfLineImpl(a):this.getHeightOfLine(a);return e}_getLeftOffset(){return this.direction==="ltr"?-this.width/2:this.width/2}_getTopOffset(){return-this.height/2}_renderTextCommon(e,a){e.save();let r=0,o=this._getLeftOffset(),u=this._getTopOffset();for(let h=0,d=this._textLines.length;h<d;h++)this._renderTextLine(a,e,this._textLines[h],o+this._getLineLeftOffset(h),u+r+this.getHeightOfLineImpl(h),h),r+=this.getHeightOfLine(h);e.restore()}_renderTextFill(e){(this.fill||this.styleHas("fill"))&&this._renderTextCommon(e,"fillText")}_renderTextStroke(e){(this.stroke&&this.strokeWidth!==0||!this.isEmptyStyles())&&(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(e),e.save(),this._setLineDash(e,this.strokeDashArray),e.beginPath(),this._renderTextCommon(e,"strokeText"),e.closePath(),e.restore())}_renderChars(e,a,r,o,u,h){let d=this.textAlign.includes(Yd),g=this.path,m=!d&&this.charSpacing===0&&this.isEmptyStyles(h)&&!g,p=this.direction==="ltr",y=this.direction==="ltr"?1:-1,b=a.direction,S,_,w,R,Y,X="",q=0;if(a.save(),b!==this.direction&&(a.canvas.setAttribute("dir",p?"ltr":"rtl"),a.direction=p?"ltr":"rtl",a.textAlign=p?de:Di),u-=this.getHeightOfLineImpl(h)*this._fontSizeFraction,m)return this._renderChar(e,a,h,0,r.join(""),o,u),void a.restore();for(let I=0,W=r.length-1;I<=W;I++)R=I===W||this.charSpacing||g,X+=r[I],w=this.__charBounds[h][I],q===0?(o+=y*(w.kernedWidth-w.width),q+=w.width):q+=w.kernedWidth,d&&!R&&this._reSpaceAndTab.test(r[I])&&(R=!0),R||(S=S||this.getCompleteStyleDeclaration(h,I),_=this.getCompleteStyleDeclaration(h,I+1),R=Ku(S,_,!1)),R&&(g?(a.save(),a.translate(w.renderLeft,w.renderTop),a.rotate(w.angle),this._renderChar(e,a,h,I,X,-q/2,0),a.restore()):(Y=o,this._renderChar(e,a,h,I,X,Y,u)),X="",S=_,o+=y*q,q=0);a.restore()}_applyPatternGradientTransformText(e){let a=this.width+this.strokeWidth,r=this.height+this.strokeWidth,o=ai({width:a,height:r}),u=o.getContext("2d");return o.width=a,o.height=r,u.beginPath(),u.moveTo(0,0),u.lineTo(a,0),u.lineTo(a,r),u.lineTo(0,r),u.closePath(),u.translate(a/2,r/2),u.fillStyle=e.toLive(u),this._applyPatternGradientTransform(u,e),u.fill(),u.createPattern(o,"no-repeat")}handleFiller(e,a,r){let o,u;return yi(r)?r.gradientUnits==="percentage"||r.gradientTransform||r.patternTransform?(o=-this.width/2,u=-this.height/2,e.translate(o,u),e[a]=this._applyPatternGradientTransformText(r),{offsetX:o,offsetY:u}):(e[a]=r.toLive(e),this._applyPatternGradientTransform(e,r)):(e[a]=r,{offsetX:0,offsetY:0})}_setStrokeStyles(e,{stroke:a,strokeWidth:r}){return e.lineWidth=r,e.lineCap=this.strokeLineCap,e.lineDashOffset=this.strokeDashOffset,e.lineJoin=this.strokeLineJoin,e.miterLimit=this.strokeMiterLimit,this.handleFiller(e,"strokeStyle",a)}_setFillStyles(e,{fill:a}){return this.handleFiller(e,"fillStyle",a)}_renderChar(e,a,r,o,u,h,d){let g=this._getStyleDeclaration(r,o),m=this.getCompleteStyleDeclaration(r,o),p=e==="fillText"&&m.fill,y=e==="strokeText"&&m.stroke&&m.strokeWidth;if(y||p){if(a.save(),a.font=this._getFontDeclaration(m),g.textBackgroundColor&&this._removeShadow(a),g.deltaY&&(d+=g.deltaY),p){let b=this._setFillStyles(a,m);a.fillText(u,h-b.offsetX,d-b.offsetY)}if(y){let b=this._setStrokeStyles(a,m);a.strokeText(u,h-b.offsetX,d-b.offsetY)}a.restore()}}setSuperscript(e,a){this._setScript(e,a,this.superscript)}setSubscript(e,a){this._setScript(e,a,this.subscript)}_setScript(e,a,r){let o=this.get2DCursorLocation(e,!0),u=this.getValueOfPropertyAt(o.lineIndex,o.charIndex,"fontSize"),h=this.getValueOfPropertyAt(o.lineIndex,o.charIndex,"deltaY"),d={fontSize:u*r.size,deltaY:h+u*r.baseline};this.setSelectionStyles(d,e,a)}_getLineLeftOffset(e){let a=this.getLineWidth(e),r=this.width-a,o=this.textAlign,u=this.direction,h=this.isEndOfWrapping(e),d=0;return o==="justify"||o==="justify-center"&&!h||o==="justify-right"&&!h||o==="justify-left"&&!h?0:(o==="center"&&(d=r/2),o==="right"&&(d=r),o==="justify-center"&&(d=r/2),o==="justify-right"&&(d=r),u==="rtl"&&(o==="right"||o==="justify-right"?d=0:o==="left"||o==="justify-left"?d=-r:o!=="center"&&o!=="justify-center"||(d=-r/2)),d)}_clearCache(){this._forceClearCache=!1,this.__lineWidths=[],this.__lineHeights=[],this.__charBounds=[]}getLineWidth(e){if(this.__lineWidths[e]!==void 0)return this.__lineWidths[e];let{width:a}=this.measureLine(e);return this.__lineWidths[e]=a,a}_getWidthOfCharSpacing(){return this.charSpacing===0?0:this.fontSize*this.charSpacing/1e3}getValueOfPropertyAt(e,a,r){var o;return(o=this._getStyleDeclaration(e,a)[r])==null?this[r]:o}_renderTextDecoration(e,a){if(!this[a]&&!this.styleHas(a))return;let r=this._getTopOffset(),o=this._getLeftOffset(),u=this.path,h=this._getWidthOfCharSpacing(),d=a==="linethrough"?.5:+(a==="overline"),g=this.offsets[a];for(let m=0,p=this._textLines.length;m<p;m++){let y=this.getHeightOfLine(m);if(!this[a]&&!this.styleHas(a,m)){r+=y;continue}let b=this._textLines[m],S=y/this.lineHeight,_=this._getLineLeftOffset(m),w,R=0,Y=0,X=this.getValueOfPropertyAt(m,0,a),q=this.getValueOfPropertyAt(m,0,Xe),I=this.getValueOfPropertyAt(m,0,"textDecorationColor")||q,W=this.getValueOfPropertyAt(m,0,$l),$=X,B=I,G=W,lt=r+S*(1-this._fontSizeFraction),ut=this.getHeightOfChar(m,0),pt=this.getValueOfPropertyAt(m,0,"deltaY");for(let Dt=0,yt=b.length;Dt<yt;Dt++){let P=this.__charBounds[m][Dt];$=this.getValueOfPropertyAt(m,Dt,a),w=this.getValueOfPropertyAt(m,Dt,Xe),B=this.getValueOfPropertyAt(m,Dt,"textDecorationColor")||w,G=this.getValueOfPropertyAt(m,Dt,$l);let tt=this.getHeightOfChar(m,Dt),rt=this.getValueOfPropertyAt(m,Dt,"deltaY");if(u&&$&&w){let ct=this.fontSize*G/1e3;e.save(),e.fillStyle=B,e.translate(P.renderLeft,P.renderTop),e.rotate(P.angle),e.fillRect(-P.kernedWidth/2,g*tt+rt-d*ct,P.kernedWidth,ct),e.restore()}else if(($!==X||w!==q||B!==I||tt!==ut||G!==W||rt!==pt)&&Y>0){let ct=this.fontSize*W/1e3,dt=o+_+R;this.direction==="rtl"&&(dt=this.width-dt-Y),X&&I&&W&&(e.fillStyle=I,e.fillRect(dt,lt+g*ut+pt-d*ct,Y,ct)),R=P.left,Y=P.width,X=$,I=B,W=G,q=w,ut=tt,pt=rt}else Y+=P.kernedWidth}let mt=o+_+R;this.direction==="rtl"&&(mt=this.width-mt-Y),e.fillStyle=B;let St=this.fontSize*G/1e3;$&&B&&G&&e.fillRect(mt,lt+g*ut+pt-d*St,Y-h,St),r+=y}this._removeShadow(e)}_getFontDeclaration({fontFamily:e=this.fontFamily,fontStyle:a=this.fontStyle,fontWeight:r=this.fontWeight,fontSize:o=this.fontSize}={},u){let h=e.includes("'")||e.includes('"')||e.includes(",")||ls.genericFonts.includes(e.toLowerCase())?e:`"${e}"`;return[a,r,`${u?this.CACHE_FONT_SIZE:o}px`,h].join(" ")}render(e){this.visible&&(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._forceClearCache&&this.initDimensions(),super.render(e)))}graphemeSplit(e){return Uu(e)}_splitTextIntoLines(e){let a=e.split(this._reNewline),r=Array(a.length),o=[`
|
|
62
|
+
`],u=[];for(let h=0;h<a.length;h++)r[h]=this.graphemeSplit(a[h]),u=u.concat(r[h],o);return u.pop(),{_unwrappedLines:r,lines:a,graphemeText:u,graphemeLines:r}}toObject(e=[]){return{...super.toObject([...Ky,...e]),styles:_b(this.styles,this.text),...this.path?{path:this.path.toObject()}:{}}}set(e,a){let{textLayoutProperties:r}=this.constructor;super.set(e,a);let o=!1,u=!1;if(typeof e=="object")for(let h in e)h==="path"&&this.setPathInfo(),o=o||r.includes(h),u=u||h==="path";else o=r.includes(e),u=e==="path";return u&&this.setPathInfo(),o&&this.initialized&&(this.initDimensions(),this.setCoords()),this}complexity(){return 1}static async fromElement(e,a,r){let o=ba(e,ls.ATTRIBUTE_NAMES,r),{textAnchor:u=de,textDecoration:h="",dx:d=0,dy:g=0,top:m=0,left:p=0,fontSize:y=16,strokeWidth:b=1,...S}={...a,...o},_=new this(Nu(e.textContent||"").trim(),{left:p+d,top:m+g,underline:h.includes("underline"),overline:h.includes("overline"),linethrough:h.includes("line-through"),strokeWidth:0,fontSize:y,...S}),w=_.getScaledHeight()/_.height,R=((_.height+_.strokeWidth)*_.lineHeight-_.height)*w,Y=_.getScaledHeight()+R,X=0;return u==="center"&&(X=_.getScaledWidth()/2),u==="right"&&(X=_.getScaledWidth()),_.set({left:_.left-X,top:_.top-(Y-_.fontSize*(.07+_._fontSizeFraction))/_.lineHeight,strokeWidth:b}),_}static fromObject(e){return this._fromObject({...e,styles:Cb(e.styles||{},e.text)},{extraParam:"text"})}};D(ei,"textLayoutProperties",Qy),D(ei,"cacheProperties",[...va,...Ky]),D(ei,"ownDefaults",V_),D(ei,"type","Text"),D(ei,"genericFonts",["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong"]),D(ei,"ATTRIBUTE_NAMES",sn.concat("x","y","dx","dy","font-family","font-style","font-weight","font-size","letter-spacing","text-decoration","text-decoration-thickness","text-decoration-color","text-anchor")),vb(ei,[class extends Gy{_toSVG(){let n=this._getSVGLeftTopOffsets(),e=this._getSVGTextAndBg(n.textTop,n.textLeft);return this._wrapSVGTextAndBg(e)}toSVG(n){let e=this._createBaseSVGMarkup(this._toSVG(),{reviver:n,noStyle:!0,withShadow:!0}),a=this.path;return a?e+a._createBaseSVGMarkup(a._toSVG(),{reviver:n,withShadow:!0,additionalTransform:Wl(this.calcOwnMatrix())}):e}_getSVGLeftTopOffsets(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}}_wrapSVGTextAndBg({textBgRects:n,textSpans:e}){let a=this.getSvgTextDecoration(this);return[n.join(""),' <text xml:space="preserve" ',`font-family="${_t(this.fontFamily.replace(A2,"'"))}" `,`font-size="${_t(this.fontSize)}" `,this.fontStyle?`font-style="${_t(this.fontStyle)}" `:"",this.fontWeight?`font-weight="${_t(this.fontWeight)}" `:"",a?`text-decoration="${a}" `:"",this.direction==="rtl"?'direction="rtl" ':"",'style="',this.getSvgStyles(!0),'"',this.addPaintOrder()," >",e.join(""),`</text>
|
|
63
|
+
`]}_getSVGTextAndBg(n,e){let a=[],r=[],o,u=n;this.backgroundColor&&r.push(Ff(this.backgroundColor,-this.width/2,-this.height/2,this.width,this.height));for(let h=0,d=this._textLines.length;h<d;h++)o=this._getLineLeftOffset(h),this.direction==="rtl"&&(o+=this.width),(this.textBackgroundColor||this.styleHas("textBackgroundColor",h))&&this._setSVGTextLineBg(r,h,e+o,u),this._setSVGTextLineText(a,h,e+o,u),u+=this.getHeightOfLine(h);return{textSpans:a,textBgRects:r}}_createTextCharSpan(n,e,a,r,o){let u=Yt.NUM_FRACTION_DIGITS,h=this.getSvgSpanStyles(e,n!==n.trim()||!!n.match(M2)),d=h?`style="${h}"`:"",g=e.deltaY,m=g?` dy="${Vt(g,u)}" `:"",{angle:p,renderLeft:y,renderTop:b,width:S}=o,_="";if(y!==void 0){let w=S/2;p&&(_=` rotate="${Vt(ma(p),u)}"`);let R=Vn({angle:ma(p)});R[4]=y,R[5]=b;let Y=new H(-w,0).transform(R);a=Y.x,r=Y.y}return`<tspan x="${Vt(a,u)}" y="${Vt(r,u)}" ${m}${_}${d}>${_t(n)}</tspan>`}_setSVGTextLineText(n,e,a,r){let o=this.getHeightOfLine(e),u=this.textAlign.includes(Yd),h=this._textLines[e],d,g,m,p,y,b="",S=0;r+=o*(1-this._fontSizeFraction)/this.lineHeight;for(let _=0,w=h.length-1;_<=w;_++)y=_===w||this.charSpacing||this.path,b+=h[_],m=this.__charBounds[e][_],S===0?(a+=m.kernedWidth-m.width,S+=m.width):S+=m.kernedWidth,u&&!y&&this._reSpaceAndTab.test(h[_])&&(y=!0),y||(d=d||this.getCompleteStyleDeclaration(e,_),g=this.getCompleteStyleDeclaration(e,_+1),y=Ku(d,g,!0)),y&&(p=this._getStyleDeclaration(e,_),n.push(this._createTextCharSpan(b,p,a,r,m)),b="",d=g,this.direction==="rtl"?a-=S:a+=S,S=0)}_setSVGTextLineBg(n,e,a,r){let o=this._textLines[e],u=this.getHeightOfLine(e)/this.lineHeight,h,d=0,g=0,m=this.getValueOfPropertyAt(e,0,"textBackgroundColor");for(let p=0;p<o.length;p++){let{left:y,width:b,kernedWidth:S}=this.__charBounds[e][p];h=this.getValueOfPropertyAt(e,p,"textBackgroundColor"),h===m?d+=S:(m&&n.push(Ff(m,a+g,r,d,u)),g=y,d=b,m=h)}h&&n.push(Ff(m,a+g,r,d,u))}getSvgStyles(n){let e=Gu(this.textDecorationColor)?` text-decoration-color: ${_t(this[Pu])};`:"";return`${super.getSvgStyles(n)} text-decoration-thickness: ${Vt(this.textDecorationThickness*this.getObjectScaling().y/10,Yt.NUM_FRACTION_DIGITS)}%;${e} white-space: pre;`}getSvgSpanStyles(n,e){let{fontFamily:a,strokeWidth:r,stroke:o,fill:u,fontSize:h,fontStyle:d,fontWeight:g,textDecorationThickness:m,textDecorationColor:p,linethrough:y,overline:b,underline:S}=n,_=this.getSvgTextDecoration({underline:S??this.underline,overline:b??this.overline,linethrough:y??this.linethrough}),w=m||this.textDecorationThickness,R=p||this.textDecorationColor,Y=kn(r),X=Bn(a),q=kn(h),I=Bn(d),W=kn(g)||Bn(g),$=Bn(R);return[o?Ms(ga,o):"",Y?`stroke-width: ${_t(Y)}; `:"",X?`font-family: ${X.includes("'")||X.includes('"')?_t(X):`'${_t(X)}'`}; `:"",q?`font-size: ${_t(q)}px; `:"",I?`font-style: ${_t(I)}; `:"",W?`font-weight: ${_t(W)}; `:"",_?`text-decoration: ${_}; text-decoration-thickness: ${Vt(w*this.getObjectScaling().y/10,Yt.NUM_FRACTION_DIGITS)}%;${$?` text-decoration-color: ${_t($)};`:""} `:"",u?Ms(Xe,u):"",e?"white-space: pre; ":""].join("")}getSvgTextDecoration(n){return["overline","underline","line-through"].filter(e=>n[e.replace("-","")]).join(" ")}}]),nt.setClass(ei),nt.setSVGClass(ei);var j2=class{constructor(n){D(this,"target",void 0),D(this,"__mouseDownInPlace",!1),D(this,"__dragStartFired",!1),D(this,"__isDraggingOver",!1),D(this,"__dragStartSelection",void 0),D(this,"__dragImageDisposer",void 0),D(this,"_dispose",void 0),this.target=n;let e=[this.target.on("dragenter",this.dragEnterHandler.bind(this)),this.target.on("dragover",this.dragOverHandler.bind(this)),this.target.on("dragleave",this.dragLeaveHandler.bind(this)),this.target.on("dragend",this.dragEndHandler.bind(this)),this.target.on("drop",this.dropHandler.bind(this))];this._dispose=()=>{e.forEach(a=>a()),this._dispose=void 0}}isPointerOverSelection(n){let e=this.target,a=e.getSelectionStartFromPointer(n);return e.isEditing&&a>=e.selectionStart&&a<=e.selectionEnd&&e.selectionStart<e.selectionEnd}start(n){return this.__mouseDownInPlace=this.isPointerOverSelection(n)}isActive(){return this.__mouseDownInPlace}end(n){let e=this.isActive();return e&&!this.__dragStartFired&&(this.target.setCursorByClick(n),this.target.initDelayedCursor(!0)),this.__mouseDownInPlace=!1,this.__dragStartFired=!1,this.__isDraggingOver=!1,e}getDragStartSelection(){return this.__dragStartSelection}setDragImage(n,{selectionStart:e,selectionEnd:a}){var r;let o=this.target,u=o.canvas,h=new H(o.flipX?-1:1,o.flipY?-1:1),d=o._getCursorBoundaries(e),g=new H(d.left+d.leftOffset,d.top+d.topOffset).multiply(h).transform(o.calcTransformMatrix()),m=u.getScenePoint(n).subtract(g),p=o.getCanvasRetinaScaling(),y=o.getBoundingRect(),b=g.subtract(new H(y.left,y.top)),S=u.viewportTransform,_=b.add(m).transform(S,!0),w=o.backgroundColor,R=Qd(o.styles);o.backgroundColor="";let Y={stroke:"transparent",fill:"transparent",textBackgroundColor:"transparent"};o.setSelectionStyles(Y,0,e),o.setSelectionStyles(Y,a,o.text.length),o.dirty=!0;let X=o.toCanvasElement({enableRetinaScaling:u.enableRetinaScaling,viewportTransform:!0});o.backgroundColor=w,o.styles=R,o.dirty=!0,sd(X,{position:"fixed",left:-X.width+"px",border:Bu,width:X.width/p+"px",height:X.height/p+"px"}),this.__dragImageDisposer&&this.__dragImageDisposer(),this.__dragImageDisposer=()=>{X.remove()},Ei(n.target||this.target.hiddenTextarea).body.appendChild(X),(r=n.dataTransfer)==null||r.setDragImage(X,_.x,_.y)}onDragStart(n){this.__dragStartFired=!0;let e=this.target,a=this.isActive();if(a&&n.dataTransfer){let r=this.__dragStartSelection={selectionStart:e.selectionStart,selectionEnd:e.selectionEnd},o=e._text.slice(r.selectionStart,r.selectionEnd).join(""),u={text:e.text,value:o,...r};n.dataTransfer.setData("text/plain",o),n.dataTransfer.setData("application/fabric",JSON.stringify({value:o,styles:e.getSelectionStyles(r.selectionStart,r.selectionEnd,!0)})),n.dataTransfer.effectAllowed="copyMove",this.setDragImage(n,u)}return e.abortCursorAnimation(),a}canDrop(n){if(this.target.editable&&!this.target.getActiveControl()&&!n.defaultPrevented){if(this.isActive()&&this.__dragStartSelection){let e=this.target.getSelectionStartFromPointer(n),a=this.__dragStartSelection;return e<a.selectionStart||e>a.selectionEnd}return!0}return!1}targetCanDrop(n){return this.target.canDrop(n)}dragEnterHandler({e:n}){let e=this.targetCanDrop(n);!this.__isDraggingOver&&e&&(this.__isDraggingOver=!0)}dragOverHandler(n){let{e}=n,a=this.targetCanDrop(e);!this.__isDraggingOver&&a?this.__isDraggingOver=!0:this.__isDraggingOver&&!a&&(this.__isDraggingOver=!1),this.__isDraggingOver&&(e.preventDefault(),n.canDrop=!0,n.dropTarget=this.target)}dragLeaveHandler(){(this.__isDraggingOver||this.isActive())&&(this.__isDraggingOver=!1)}dropHandler(n){var e;let{e:a}=n,r=a.defaultPrevented;this.__isDraggingOver=!1,a.preventDefault();let o=(e=a.dataTransfer)==null?void 0:e.getData("text/plain");if(o&&!r){let u=this.target,h=u.canvas,d=u.getSelectionStartFromPointer(a),{styles:g}=a.dataTransfer.types.includes("application/fabric")?JSON.parse(a.dataTransfer.getData("application/fabric")):{},m=o[Math.max(0,o.length-1)];if(this.__dragStartSelection){let p=this.__dragStartSelection.selectionStart,y=this.__dragStartSelection.selectionEnd;d>p&&d<=y?d=p:d>y&&(d-=y-p),u.removeChars(p,y),delete this.__dragStartSelection}u._reNewline.test(m)&&(u._reNewline.test(u._text[d])||d===u._text.length)&&(o=o.trimEnd()),n.didDrop=!0,n.dropTarget=u,u.insertChars(o,g,d),h.setActiveObject(u),u.enterEditing(a),u.selectionStart=Math.min(d+0,u._text.length),u.selectionEnd=Math.min(u.selectionStart+o.length,u._text.length),u.hiddenTextarea.value=u.text,u._updateTextarea(),u.hiddenTextarea.focus(),u.fire(Mu,{index:d+0,action:"drop"}),h.fire("text:changed",{target:u}),h.contextTopDirty=!0,h.requestRenderAll()}}dragEndHandler({e:n}){if(this.isActive()&&this.__dragStartFired&&this.__dragStartSelection){var e;let a=this.target,r=this.target.canvas,{selectionStart:o,selectionEnd:u}=this.__dragStartSelection,h=((e=n.dataTransfer)==null?void 0:e.dropEffect)||"none";h==="none"?(a.selectionStart=o,a.selectionEnd=u,a._updateTextarea(),a.hiddenTextarea.focus()):(a.clearContextTop(),h==="move"&&(a.removeChars(o,u),a.selectionStart=a.selectionEnd=o,a.hiddenTextarea&&(a.hiddenTextarea.value=a.text),a._updateTextarea(),a.fire(Mu,{index:o,action:"dragend"}),r.fire("text:changed",{target:a}),r.requestRenderAll()),a.exitEditing())}this.__dragImageDisposer&&this.__dragImageDisposer(),delete this.__dragImageDisposer,delete this.__dragStartSelection,this.__isDraggingOver=!1}dispose(){this._dispose&&this._dispose()}};const ay=/[ \n\.,;!\?\-]/;var R2=class extends ei{constructor(...n){super(...n),D(this,"_currentCursorOpacity",1)}initBehavior(){this._tick=this._tick.bind(this),this._onTickComplete=this._onTickComplete.bind(this),this.updateSelectionOnMouseMove=this.updateSelectionOnMouseMove.bind(this)}onDeselect(n){return this.isEditing&&this.exitEditing(),this.selected=!1,super.onDeselect(n)}_animateCursor({toValue:n,duration:e,delay:a,onComplete:r}){return Fd({startValue:this._currentCursorOpacity,endValue:n,duration:e,delay:a,onComplete:r,abort:()=>!this.canvas||this.selectionStart!==this.selectionEnd,onChange:o=>{this._currentCursorOpacity=o,this.renderCursorOrSelection()}})}_tick(n){this._currentTickState=this._animateCursor({toValue:0,duration:this.cursorDuration/2,delay:Math.max(n||0,100),onComplete:this._onTickComplete})}_onTickComplete(){var n;(n=this._currentTickCompleteState)==null||n.abort(),this._currentTickCompleteState=this._animateCursor({toValue:1,duration:this.cursorDuration,onComplete:this._tick})}initDelayedCursor(n){this.abortCursorAnimation(),this._tick(n?0:this.cursorDelay)}abortCursorAnimation(){let n=!1;[this._currentTickState,this._currentTickCompleteState].forEach(e=>{e&&!e.isDone()&&(n=!0,e.abort())}),this._currentCursorOpacity=1,n&&this.clearContextTop()}restartCursorIfNeeded(){[this._currentTickState,this._currentTickCompleteState].some(n=>!n||n.isDone())&&this.initDelayedCursor()}selectAll(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this}cmdAll(){this.selectAll(),this.renderCursorOrSelection()}getSelectedText(){return this._text.slice(this.selectionStart,this.selectionEnd).join("")}findWordBoundaryLeft(n){let e=0,a=n-1;if(this._reSpace.test(this._text[a]))for(;this._reSpace.test(this._text[a]);)e++,a--;for(;/\S/.test(this._text[a])&&a>-1;)e++,a--;return n-e}findWordBoundaryRight(n){let e=0,a=n;if(this._reSpace.test(this._text[a]))for(;this._reSpace.test(this._text[a]);)e++,a++;for(;/\S/.test(this._text[a])&&a<this._text.length;)e++,a++;return n+e}findLineBoundaryLeft(n){let e=0,a=n-1;for(;!/\n/.test(this._text[a])&&a>-1;)e++,a--;return n-e}findLineBoundaryRight(n){let e=0,a=n;for(;!/\n/.test(this._text[a])&&a<this._text.length;)e++,a++;return n+e}searchWordBoundary(n,e){let a=this._text,r=n>0&&this._reSpace.test(a[n])&&(e===-1||!_d.test(a[n-1]))?n-1:n,o=a[r];for(;r>0&&r<a.length&&!ay.test(o);)r+=e,o=a[r];return e===-1&&ay.test(o)&&r++,r}selectWord(n){var e;n=(e=n)==null?this.selectionStart:e;let a=this.searchWordBoundary(n,-1),r=Math.max(a,this.searchWordBoundary(n,1));this.selectionStart=a,this.selectionEnd=r,this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()}selectLine(n){var e;n=(e=n)==null?this.selectionStart:e;let a=this.findLineBoundaryLeft(n),r=this.findLineBoundaryRight(n);this.selectionStart=a,this.selectionEnd=r,this._fireSelectionChanged(),this._updateTextarea()}enterEditing(n){!this.isEditing&&this.editable&&(this.enterEditingImpl(),this.fire("editing:entered",n?{e:n}:void 0),this._fireSelectionChanged(),this.canvas&&(this.canvas.fire("text:editing:entered",{target:this,e:n}),this.canvas.requestRenderAll()))}enterEditingImpl(){this.canvas&&(this.canvas.calcOffset(),this.canvas.textEditingManager.exitTextEditing()),this.isEditing=!0,this.initHiddenTextarea(),this.hiddenTextarea.focus(),this.hiddenTextarea.value=this.text,this._updateTextarea(),this._saveEditingProps(),this._setEditingProps(),this._textBeforeEdit=this.text,this._tick()}updateSelectionOnMouseMove(n){if(this.getActiveControl())return;let e=this.hiddenTextarea;Ei(e).activeElement!==e&&e.focus();let a=this.getSelectionStartFromPointer(n),r=this.selectionStart,o=this.selectionEnd;(a===this.__selectionStartOnMouseDown&&r!==o||r!==a&&o!==a)&&(a>this.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=a):(this.selectionStart=a,this.selectionEnd=this.__selectionStartOnMouseDown),this.selectionStart===r&&this.selectionEnd===o||(this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()))}_setEditingProps(){this.hoverCursor="text",this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor="text"),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0}fromStringToGraphemeSelection(n,e,a){let r=a.slice(0,n),o=this.graphemeSplit(r).length;if(n===e)return{selectionStart:o,selectionEnd:o};let u=a.slice(n,e);return{selectionStart:o,selectionEnd:o+this.graphemeSplit(u).length}}fromGraphemeToStringSelection(n,e,a){let r=a.slice(0,n).join("").length;return n===e?{selectionStart:r,selectionEnd:r}:{selectionStart:r,selectionEnd:r+a.slice(n,e).join("").length}}_updateTextarea(){if(this.cursorOffsetCache={},this.hiddenTextarea){if(!this.inCompositionMode){let n=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=n.selectionStart,this.hiddenTextarea.selectionEnd=n.selectionEnd}this.updateTextareaPosition()}}updateFromTextArea(){let{hiddenTextarea:n,direction:e,textAlign:a,inCompositionMode:r}=this;if(!n)return;let o=a==="justify"?e==="ltr"?de:Di:a.replace("justify-",""),u=this.getPositionByOrigin(o,"top");this.cursorOffsetCache={},this.text=n.value,this.set("dirty",!0),this.initDimensions(),this.setPositionByOrigin(u,o,"top"),this.setCoords();let h=this.fromStringToGraphemeSelection(n.selectionStart,n.selectionEnd,n.value);this.selectionEnd=this.selectionStart=h.selectionEnd,r||(this.selectionStart=h.selectionStart),this.updateTextareaPosition()}updateTextareaPosition(){if(this.selectionStart===this.selectionEnd){let n=this._calcTextareaPosition();this.hiddenTextarea.style.left=n.left,this.hiddenTextarea.style.top=n.top}}_calcTextareaPosition(){if(!this.canvas)return{left:"1px",top:"1px"};let n=this.inCompositionMode?this.compositionStart:this.selectionStart,e=this._getCursorBoundaries(n),a=this.get2DCursorLocation(n),r=a.lineIndex,o=a.charIndex,u=this.getValueOfPropertyAt(r,o,"fontSize")*this.lineHeight,h=e.leftOffset,d=this.getCanvasRetinaScaling(),g=this.canvas.upperCanvasEl,m=g.width/d,p=g.height/d,y=m-u,b=p-u,S=new H(e.left+h,e.top+e.topOffset+u).transform(this.calcTransformMatrix()).transform(this.canvas.viewportTransform).multiply(new H(g.clientWidth/m,g.clientHeight/p));return S.x<0&&(S.x=0),S.x>y&&(S.x=y),S.y<0&&(S.y=0),S.y>b&&(S.y=b),S.x+=this.canvas._offset.left,S.y+=this.canvas._offset.top,{left:`${S.x}px`,top:`${S.y}px`,fontSize:`${u}px`,charHeight:u}}_saveEditingProps(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}}_restoreEditingProps(){this._savedProps&&(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor||this.canvas.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor||this.canvas.moveCursor),delete this._savedProps)}exitEditingImpl(){let n=this.hiddenTextarea;this.selected=!1,this.isEditing=!1,n&&(n.blur&&n.blur(),n.parentNode&&n.parentNode.removeChild(n)),this.hiddenTextarea=null,this.abortCursorAnimation(),this.selectionStart!==this.selectionEnd&&this.clearContextTop(),this.selectionEnd=this.selectionStart,this._restoreEditingProps(),this._forceClearCache&&(this.initDimensions(),this.setCoords())}exitEditing(){let n=this._textBeforeEdit!==this.text;return this.exitEditingImpl(),this.fire("editing:exited"),n&&this.fire("modified"),this.canvas&&(this.canvas.fire("text:editing:exited",{target:this}),n&&this.canvas.fire("object:modified",{target:this})),this}_removeExtraneousStyles(){for(let n in this.styles)this._textLines[n]||delete this.styles[n]}removeStyleFromTo(n,e){let{lineIndex:a,charIndex:r}=this.get2DCursorLocation(n,!0),{lineIndex:o,charIndex:u}=this.get2DCursorLocation(e,!0);if(a!==o){if(this.styles[a])for(let h=r;h<this._unwrappedTextLines[a].length;h++)delete this.styles[a][h];if(this.styles[o])for(let h=u;h<this._unwrappedTextLines[o].length;h++){let d=this.styles[o][h];d&&(this.styles[a]||(this.styles[a]={}),this.styles[a][r+h-u]=d)}for(let h=a+1;h<=o;h++)delete this.styles[h];this.shiftLineStyles(o,a-o)}else if(this.styles[a]){let h=this.styles[a],d=u-r;for(let g=r;g<u;g++)delete h[g];for(let g in this.styles[a]){let m=parseInt(g,10);m>=u&&(h[m-d]=h[g],delete h[g])}}}shiftLineStyles(n,e){let a=Object.assign({},this.styles);for(let r in this.styles){let o=parseInt(r,10);o>n&&(this.styles[o+e]=a[o],a[o-e]||delete this.styles[o])}}insertNewlineStyleObject(n,e,a,r){let o={},u=this._unwrappedTextLines[n].length,h=u===e,d=!1;a||(a=1),this.shiftLineStyles(n,a);let g=this.styles[n]?this.styles[n][e===0?e:e-1]:void 0;for(let p in this.styles[n]){let y=parseInt(p,10);y>=e&&(d=!0,o[y-e]=this.styles[n][p],h&&e===0||delete this.styles[n][p])}let m=!1;for(d&&!h&&(this.styles[n+a]=o,m=!0),(m||u>e)&&a--;a>0;)r&&r[a-1]?this.styles[n+a]={0:{...r[a-1]}}:g?this.styles[n+a]={0:{...g}}:delete this.styles[n+a],a--;this._forceClearCache=!0}insertCharStyleObject(n,e,a,r){this.styles||(this.styles={});let o=this.styles[n],u=o?{...o}:{};a||(a=1);for(let d in u){let g=parseInt(d,10);g>=e&&(o[g+a]=u[g],u[g-a]||delete o[g])}if(this._forceClearCache=!0,r){for(;a--;)Object.keys(r[a]).length&&(this.styles[n]||(this.styles[n]={}),this.styles[n][e+a]={...r[a]});return}if(!o)return;let h=o[e?e-1:1];for(;h&&a--;)this.styles[n][e+a]={...h}}insertNewStyleBlock(n,e,a){let r=this.get2DCursorLocation(e,!0),o=[0],u,h=0;for(let d=0;d<n.length;d++)n[d]===`
|
|
64
|
+
`?(h++,o[h]=0):o[h]++;for(o[0]>0&&(this.insertCharStyleObject(r.lineIndex,r.charIndex,o[0],a),a=a&&a.slice(o[0]+1)),h&&this.insertNewlineStyleObject(r.lineIndex,r.charIndex+o[0],h),u=1;u<h;u++)o[u]>0?this.insertCharStyleObject(r.lineIndex+u,0,o[u],a):a&&this.styles[r.lineIndex+u]&&a[0]&&(this.styles[r.lineIndex+u][0]=a[0]),a=a&&a.slice(o[u]+1);o[u]>0&&this.insertCharStyleObject(r.lineIndex+u,0,o[u],a)}removeChars(n,e=n+1){this.removeStyleFromTo(n,e),this._text.splice(n,e-n),this.text=this._text.join(""),this.set("dirty",!0),this.initDimensions(),this.setCoords(),this._removeExtraneousStyles()}insertChars(n,e,a,r=a){r>a&&this.removeStyleFromTo(a,r);let o=this.graphemeSplit(n);this.insertNewStyleBlock(o,a,e),this._text=[...this._text.slice(0,a),...o,...this._text.slice(r)],this.text=this._text.join(""),this.set("dirty",!0),this.initDimensions(),this.setCoords(),this._removeExtraneousStyles()}setSelectionStartEndWithShift(n,e,a){a<=n?(e===n?this._selectionDirection=de:this._selectionDirection==="right"&&(this._selectionDirection=de,this.selectionEnd=n),this.selectionStart=a):a>n&&a<e?this._selectionDirection==="right"?this.selectionEnd=a:this.selectionStart=a:(e===n?this._selectionDirection=Di:this._selectionDirection==="left"&&(this._selectionDirection=Di,this.selectionStart=e),this.selectionEnd=a)}},z2=class extends R2{initHiddenTextarea(){let n=this.canvas&&Ei(this.canvas.getElement())||Jl(),e=n.createElement("textarea");Object.entries({autocapitalize:"off",autocorrect:"off",autocomplete:"off",spellcheck:"false","data-fabric":"textarea",wrap:"off",name:"fabricTextarea"}).map(([u,h])=>e.setAttribute(u,h));let{top:a,left:r,fontSize:o}=this._calcTextareaPosition();e.style.cssText=`position: absolute; top: ${a}; left: ${r}; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding-top: ${o};`,(this.hiddenTextareaContainer||n.body).appendChild(e),Object.entries({blur:"blur",keydown:"onKeyDown",keyup:"onKeyUp",input:"onInput",copy:"copy",cut:"copy",paste:"paste",compositionstart:"onCompositionStart",compositionupdate:"onCompositionUpdate",compositionend:"onCompositionEnd"}).map(([u,h])=>e.addEventListener(u,this[h].bind(this))),this.hiddenTextarea=e}blur(){this.abortCursorAnimation()}onKeyDown(n){if(!this.isEditing)return;let e=this.direction==="rtl"?this.keysMapRtl:this.keysMap;if(n.keyCode in e)this[e[n.keyCode]](n);else{if(!(n.keyCode in this.ctrlKeysMapDown)||!n.ctrlKey&&!n.metaKey)return;this[this.ctrlKeysMapDown[n.keyCode]](n)}n.stopImmediatePropagation(),n.preventDefault(),n.keyCode>=33&&n.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}onKeyUp(n){!this.isEditing||this._copyDone||this.inCompositionMode?this._copyDone=!1:n.keyCode in this.ctrlKeysMapUp&&(n.ctrlKey||n.metaKey)&&(this[this.ctrlKeysMapUp[n.keyCode]](n),n.stopImmediatePropagation(),n.preventDefault(),this.canvas&&this.canvas.requestRenderAll())}onInput(n){let e=this.fromPaste,{value:a,selectionStart:r,selectionEnd:o}=this.hiddenTextarea;if(this.fromPaste=!1,n&&n.stopPropagation(),!this.isEditing)return;let u=()=>{this.updateFromTextArea(),this.fire(Mu),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll())};if(this.hiddenTextarea.value==="")return this.styles={},void u();let h=this._splitTextIntoLines(a).graphemeText,d=this._text.length,g=h.length,m=this.selectionStart,p=this.selectionEnd,y=m!==p,b,S,_,w,R=g-d,Y=this.fromStringToGraphemeSelection(r,o,a),X=m>Y.selectionStart;y?(S=this._text.slice(m,p),R+=p-m):g<d&&(S=X?this._text.slice(p+R,p):this._text.slice(m,m-R));let q=h.slice(Y.selectionEnd-R,Y.selectionEnd);if(S&&S.length&&(q.length&&(b=this.getSelectionStyles(m,m+1,!1),b=q.map(()=>b[0])),y?(_=m,w=p):X?(_=p-S.length,w=p):(_=p,w=p+S.length),this.removeStyleFromTo(_,w)),q.length){let{copyPasteData:I}=Ii();e&&q.join("")===I.copiedText&&!Yt.disableStyleCopyPaste&&(b=I.copiedTextStyle),this.insertNewStyleBlock(q,m,b)}u()}onCompositionStart(){this.inCompositionMode=!0}onCompositionEnd(){this.inCompositionMode=!1}onCompositionUpdate({target:n}){let{selectionStart:e,selectionEnd:a}=n;this.compositionStart=e,this.compositionEnd=a,this.updateTextareaPosition()}copy(){if(this.selectionStart===this.selectionEnd)return;let{copyPasteData:n}=Ii();n.copiedText=this.getSelectedText(),Yt.disableStyleCopyPaste?n.copiedTextStyle=void 0:n.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0}paste(){this.fromPaste=!0}_getWidthBeforeCursor(n,e){let a,r=this._getLineLeftOffset(n);return e>0&&(a=this.__charBounds[n][e-1],r+=a.left+a.width),r}getDownCursorOffset(n,e){let a=this._getSelectionForOffset(n,e),r=this.get2DCursorLocation(a),o=r.lineIndex;if(o===this._textLines.length-1||n.metaKey||n.keyCode===34)return this._text.length-a;let u=r.charIndex,h=this._getWidthBeforeCursor(o,u),d=this._getIndexOnLine(o+1,h);return this._textLines[o].slice(u).length+d+1+this.missingNewlineOffset(o)}_getSelectionForOffset(n,e){return n.shiftKey&&this.selectionStart!==this.selectionEnd&&e?this.selectionEnd:this.selectionStart}getUpCursorOffset(n,e){let a=this._getSelectionForOffset(n,e),r=this.get2DCursorLocation(a),o=r.lineIndex;if(o===0||n.metaKey||n.keyCode===33)return-a;let u=r.charIndex,h=this._getWidthBeforeCursor(o,u),d=this._getIndexOnLine(o-1,h),g=this._textLines[o].slice(0,u),m=this.missingNewlineOffset(o-1);return-this._textLines[o-1].length+d-g.length+(1-m)}_getIndexOnLine(n,e){let a=this._textLines[n],r,o,u=this._getLineLeftOffset(n),h=0;for(let d=0,g=a.length;d<g;d++)if(r=this.__charBounds[n][d].width,u+=r,u>e){o=!0;let m=u-r,p=u,y=Math.abs(m-e);h=Math.abs(p-e)<y?d:d-1;break}return o||(h=a.length-1),h}moveCursorDown(n){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",n)}moveCursorUp(n){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorUpOrDown("Up",n)}_moveCursorUpOrDown(n,e){let a=this[`get${n}CursorOffset`](e,this._selectionDirection===Di);if(e.shiftKey?this.moveCursorWithShift(a):this.moveCursorWithoutShift(a),a!==0){let r=this.text.length;this.selectionStart=Xn(0,this.selectionStart,r),this.selectionEnd=Xn(0,this.selectionEnd,r),this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea()}}moveCursorWithShift(n){let e=this._selectionDirection==="left"?this.selectionStart+n:this.selectionEnd+n;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,e),n!==0}moveCursorWithoutShift(n){return n<0?(this.selectionStart+=n,this.selectionEnd=this.selectionStart):(this.selectionEnd+=n,this.selectionStart=this.selectionEnd),n!==0}moveCursorLeft(n){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorLeftOrRight("Left",n)}_move(n,e,a){let r;if(n.altKey)r=this[`findWordBoundary${a}`](this[e]);else{if(!n.metaKey&&n.keyCode!==35&&n.keyCode!==36)return this[e]+=a==="Left"?-1:1,!0;r=this[`findLineBoundary${a}`](this[e])}return r!==void 0&&this[e]!==r&&(this[e]=r,!0)}_moveLeft(n,e){return this._move(n,e,"Left")}_moveRight(n,e){return this._move(n,e,"Right")}moveCursorLeftWithoutShift(n){let e=!0;return this._selectionDirection=de,this.selectionEnd===this.selectionStart&&this.selectionStart!==0&&(e=this._moveLeft(n,"selectionStart")),this.selectionEnd=this.selectionStart,e}moveCursorLeftWithShift(n){return this._selectionDirection==="right"&&this.selectionStart!==this.selectionEnd?this._moveLeft(n,"selectionEnd"):this.selectionStart===0?void 0:(this._selectionDirection=de,this._moveLeft(n,"selectionStart"))}moveCursorRight(n){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",n)}_moveCursorLeftOrRight(n,e){let a=`moveCursor${n}${e.shiftKey?"WithShift":"WithoutShift"}`;this._currentCursorOpacity=1,this[a](e)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())}moveCursorRightWithShift(n){return this._selectionDirection==="left"&&this.selectionStart!==this.selectionEnd?this._moveRight(n,"selectionStart"):this.selectionEnd===this._text.length?void 0:(this._selectionDirection=Di,this._moveRight(n,"selectionEnd"))}moveCursorRightWithoutShift(n){let e=!0;return this._selectionDirection=Di,this.selectionStart===this.selectionEnd?(e=this._moveRight(n,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,e}};const ny=n=>!!n.button;var N2=class extends z2{constructor(...n){super(...n),D(this,"draggableTextDelegate",void 0)}initBehavior(){this.on("mousedown",this._mouseDownHandler),this.on("mouseup",this.mouseUpHandler),this.on("mousedblclick",this.doubleClickHandler),this.on("mousetripleclick",this.tripleClickHandler),this.draggableTextDelegate=new j2(this),super.initBehavior()}shouldStartDragging(){return this.draggableTextDelegate.isActive()}onDragStart(n){return this.draggableTextDelegate.onDragStart(n)}canDrop(n){return this.draggableTextDelegate.canDrop(n)}doubleClickHandler(n){this.isEditing&&(this.selectWord(this.getSelectionStartFromPointer(n.e)),this.renderCursorOrSelection())}tripleClickHandler(n){this.isEditing&&(this.selectLine(this.getSelectionStartFromPointer(n.e)),this.renderCursorOrSelection())}_mouseDownHandler({e:n,alreadySelected:e}){this.canvas&&this.editable&&!ny(n)&&!this.getActiveControl()&&(this.draggableTextDelegate.start(n)||(this.canvas.textEditingManager.register(this),e&&(this.inCompositionMode=!1,this.setCursorByClick(n)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()),this.selected||(this.selected=e||this.isEditing)))}mouseUpHandler({e:n,transform:e}){let a=this.draggableTextDelegate.end(n);if(this.canvas){this.canvas.textEditingManager.unregister(this);let r=this.canvas._activeObject;if(r&&r!==this)return}!this.editable||this.group&&!this.group.interactive||e&&e.actionPerformed||ny(n)||a||this.selected&&!this.getActiveControl()&&(this.enterEditing(n),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection())}setCursorByClick(n){let e=this.getSelectionStartFromPointer(n),a=this.selectionStart,r=this.selectionEnd;n.shiftKey?this.setSelectionStartEndWithShift(a,r,e):(this.selectionStart=e,this.selectionEnd=e),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())}getSelectionStartFromPointer(n){let e=this.canvas.getScenePoint(n).transform(ii(this.calcTransformMatrix())).add(new H(-this._getLeftOffset(),-this._getTopOffset())),a=0,r=0,o=0;for(let g=0;g<this._textLines.length&&a<=e.y;g++)a+=this.getHeightOfLine(g),o=g,g>0&&(r+=this._textLines[g-1].length+this.missingNewlineOffset(g-1));let u=Math.abs(this._getLineLeftOffset(o)),h=this._textLines[o].length,d=this.__charBounds[o];for(let g=0;g<h;g++){let m=u+d[g].kernedWidth;if(e.x<=m){Math.abs(e.x-m)<=Math.abs(e.x-u)&&r++;break}u=m,r++}return Math.min(this.flipX?h-r:r,this._text.length)}};const pu="moveCursorUp",vu="moveCursorDown",yu="moveCursorLeft",bu="moveCursorRight",xu="exitEditing",ly=(n,e)=>{let a=e.getRetinaScaling();n.setTransform(a,0,0,a,0,0);let r=e.viewportTransform;n.transform(r[0],r[1],r[2],r[3],r[4],r[5])},k2={selectionStart:0,selectionEnd:0,selectionColor:"rgba(17,119,255,0.3)",isEditing:!1,editable:!0,editingBorderColor:"rgba(102,153,255,0.25)",cursorWidth:2,cursorColor:"",cursorDelay:1e3,cursorDuration:600,caching:!0,hiddenTextareaContainer:null,keysMap:{9:xu,27:xu,33:pu,34:vu,35:bu,36:yu,37:yu,38:pu,39:bu,40:vu},keysMapRtl:{9:xu,27:xu,33:pu,34:vu,35:yu,36:bu,37:bu,38:pu,39:yu,40:vu},ctrlKeysMapDown:{65:"cmdAll"},ctrlKeysMapUp:{67:"copy",88:"cut"},_selectionDirection:null,_reSpace:/\s|\r?\n/,inCompositionMode:!1};var ql=class md extends N2{static getDefaults(){return{...super.getDefaults(),...md.ownDefaults}}get type(){let e=super.type;return e==="itext"?"i-text":e}constructor(e,a){super(e,{...md.ownDefaults,...a}),this.initBehavior()}_set(e,a){return this.isEditing&&this._savedProps&&e in this._savedProps?(this._savedProps[e]=a,this):(e==="canvas"&&(this.canvas instanceof ud&&this.canvas.textEditingManager.remove(this),a instanceof ud&&a.textEditingManager.add(this)),super._set(e,a))}setSelectionStart(e){e=Math.max(e,0),this._updateAndFire("selectionStart",e)}setSelectionEnd(e){e=Math.min(e,this.text.length),this._updateAndFire("selectionEnd",e)}_updateAndFire(e,a){this[e]!==a&&(this._fireSelectionChanged(),this[e]=a),this._updateTextarea()}_fireSelectionChanged(){this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})}initDimensions(){this.isEditing&&this.initDelayedCursor(),super.initDimensions()}getSelectionStyles(e=this.selectionStart||0,a=this.selectionEnd,r){return super.getSelectionStyles(e,a,r)}setSelectionStyles(e,a=this.selectionStart||0,r=this.selectionEnd){return super.setSelectionStyles(e,a,r)}get2DCursorLocation(e=this.selectionStart,a){return super.get2DCursorLocation(e,a)}render(e){super.render(e),this.cursorOffsetCache={},this.renderCursorOrSelection()}toCanvasElement(e){let a=this.isEditing;this.isEditing=!1;let r=super.toCanvasElement(e);return this.isEditing=a,r}renderCursorOrSelection(){if(!this.isEditing||!this.canvas)return;let e=this.clearContextTop(!0);if(!e)return;let a=this._getCursorBoundaries(),r=this.findAncestorsWithClipPath(),o=r.length>0,u,h=e;if(o){u=ai(e.canvas),h=u.getContext("2d"),ly(h,this.canvas);let d=this.calcTransformMatrix();h.transform(d[0],d[1],d[2],d[3],d[4],d[5])}if(this.selectionStart!==this.selectionEnd||this.inCompositionMode?this.renderSelection(h,a):this.renderCursor(h,a),o)for(let d of r){let g=d.clipPath,m=ai(e.canvas),p=m.getContext("2d");if(ly(p,this.canvas),!g.absolutePositioned){let y=d.calcTransformMatrix();p.transform(y[0],y[1],y[2],y[3],y[4],y[5])}g.transform(p),g.drawObject(p,!0,{}),this.drawClipPathOnCache(h,g,m)}o&&(e.setTransform(1,0,0,1,0,0),e.drawImage(u,0,0)),this.canvas.contextTopDirty=!0,e.restore()}findAncestorsWithClipPath(){let e=[],a=this;for(;a;)a.clipPath&&e.push(a),a=a.parent;return e}_getCursorBoundaries(e=this.selectionStart,a){let r=this._getLeftOffset(),o=this._getTopOffset(),u=this._getCursorBoundariesOffsets(e,a);return{left:r,top:o,leftOffset:u.left,topOffset:u.top}}_getCursorBoundariesOffsets(e,a){return a?this.__getCursorBoundariesOffsets(e):this.cursorOffsetCache&&"top"in this.cursorOffsetCache?this.cursorOffsetCache:this.cursorOffsetCache=this.__getCursorBoundariesOffsets(e)}__getCursorBoundariesOffsets(e){let a=0,r=0,{charIndex:o,lineIndex:u}=this.get2DCursorLocation(e),{textAlign:h,direction:d}=this;for(let y=0;y<u;y++)a+=this.getHeightOfLine(y);let g=this._getLineLeftOffset(u),m=this.__charBounds[u][o];m&&(r=m.left),this.charSpacing!==0&&o===this._textLines[u].length&&(r-=this._getWidthOfCharSpacing());let p=g+(r>0?r:0);return d==="rtl"&&(h==="right"||h==="justify"||h==="justify-right"?p*=-1:h==="left"||h==="justify-left"?p=g-(r>0?r:0):h!=="center"&&h!=="justify-center"||(p=g-(r>0?r:0))),{top:a,left:p}}renderCursorAt(e){this._renderCursor(this.canvas.contextTop,this._getCursorBoundaries(e,!0),e)}renderCursor(e,a){this._renderCursor(e,a,this.selectionStart)}getCursorRenderingData(e=this.selectionStart,a=this._getCursorBoundaries(e)){let r=this.get2DCursorLocation(e),o=r.lineIndex,u=r.charIndex>0?r.charIndex-1:0,h=this.getValueOfPropertyAt(o,u,"fontSize"),d=this.getObjectScaling().x*this.canvas.getZoom(),g=this.cursorWidth/d,m=this.getValueOfPropertyAt(o,u,"deltaY"),p=a.topOffset+(1-this._fontSizeFraction)*this.getHeightOfLine(o)/this.lineHeight-h*(1-this._fontSizeFraction);return{color:this.cursorColor||this.getValueOfPropertyAt(o,u,"fill"),opacity:this._currentCursorOpacity,left:a.left+a.leftOffset-g/2,top:p+a.top+m,width:g,height:h}}_renderCursor(e,a,r){let{color:o,opacity:u,left:h,top:d,width:g,height:m}=this.getCursorRenderingData(r,a);e.fillStyle=o,e.globalAlpha=u,e.fillRect(h,d,g,m)}renderSelection(e,a){let r={selectionStart:this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,selectionEnd:this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd};this._renderSelection(e,r,a)}renderDragSourceEffect(){let e=this.draggableTextDelegate.getDragStartSelection();this._renderSelection(this.canvas.contextTop,e,this._getCursorBoundaries(e.selectionStart,!0))}renderDropTargetEffect(e){let a=this.getSelectionStartFromPointer(e);this.renderCursorAt(a)}_renderSelection(e,a,r){let{textAlign:o,direction:u}=this,h=a.selectionStart,d=a.selectionEnd,g=o.includes(Yd),m=this.get2DCursorLocation(h),p=this.get2DCursorLocation(d),y=m.lineIndex,b=p.lineIndex,S=m.charIndex<0?0:m.charIndex,_=p.charIndex<0?0:p.charIndex;for(let w=y;w<=b;w++){let R=this._getLineLeftOffset(w)||0,Y=this.getHeightOfLine(w),X=0,q=0;if(w===y&&(X=this.__charBounds[y][S].left),w>=y&&w<b)q=g&&!this.isEndOfWrapping(w)?this.width:this.getLineWidth(w)||5;else if(w===b)if(_===0)q=this.__charBounds[b][_].left;else{let lt=this._getWidthOfCharSpacing();q=this.__charBounds[b][_-1].left+this.__charBounds[b][_-1].width-lt}let I=Y;(this.lineHeight<1||w===b&&this.lineHeight>1)&&(Y/=this.lineHeight);let W=r.left+R+X,$=Y,B=0,G=q-X;this.inCompositionMode?(e.fillStyle=this.compositionColor||"black",$=1,B=Y):e.fillStyle=this.selectionColor,u==="rtl"&&(o==="right"||o==="justify"||o==="justify-right"?W=this.width-W-G:o==="left"||o==="justify-left"?W=r.left+R-q:o!=="center"&&o!=="justify-center"||(W=r.left+R-q)),e.fillRect(W,r.top+r.topOffset+B,G,$),r.topOffset+=I}}getCurrentCharFontSize(){let e=this._getCurrentCharIndex();return this.getValueOfPropertyAt(e.l,e.c,"fontSize")}getCurrentCharColor(){let e=this._getCurrentCharIndex();return this.getValueOfPropertyAt(e.l,e.c,Xe)}_getCurrentCharIndex(){let e=this.get2DCursorLocation(this.selectionStart,!0),a=e.charIndex>0?e.charIndex-1:0;return{l:e.lineIndex,c:a}}dispose(){this.exitEditingImpl(),this.draggableTextDelegate.dispose(),super.dispose()}};D(ql,"ownDefaults",k2),D(ql,"type","IText"),nt.setClass(ql),nt.setClass(ql,"i-text");var Su=class pd extends ql{static getDefaults(){return{...super.getDefaults(),...pd.ownDefaults}}constructor(e,a){super(e,{...pd.ownDefaults,...a})}static createControls(){return{controls:mb()}}initDimensions(){this.initialized&&(this.isEditing&&this.initDelayedCursor(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set("width",this.dynamicMinWidth),this.textAlign.includes("justify")&&this.enlargeSpaces(),this.height=this.calcTextHeight())}_generateStyleMap(e){let a=0,r=0,o=0,u={};for(let h=0;h<e.graphemeLines.length;h++)e.graphemeText[o]===`
|
|
65
|
+
`&&h>0?(r=0,o++,a++):!this.splitByGrapheme&&this._reSpaceAndTab.test(e.graphemeText[o])&&h>0&&(r++,o++),u[h]={line:a,offset:r},o+=e.graphemeLines[h].length,r+=e.graphemeLines[h].length;return u}styleHas(e,a){if(this._styleMap&&!this.isWrapping){let r=this._styleMap[a];r&&(a=r.line)}return super.styleHas(e,a)}isEmptyStyles(e){if(!this.styles)return!0;let a,r,o=0,u=!1,h=this._styleMap[e],d=this._styleMap[e+1];h&&(e=h.line,o=h.offset),d&&(a=d.line,u=a===e,r=d.offset);let g=e===void 0?this.styles:{line:this.styles[e]};for(let m in g)for(let p in g[m]){let y=parseInt(p,10);if(y>=o&&(!u||y<r))for(let b in g[m][p])return!1}return!0}_getStyleDeclaration(e,a){if(this._styleMap&&!this.isWrapping){let r=this._styleMap[e];if(!r)return{};e=r.line,a=r.offset+a}return super._getStyleDeclaration(e,a)}_setStyleDeclaration(e,a,r){let o=this._styleMap[e];super._setStyleDeclaration(o.line,o.offset+a,r)}_deleteStyleDeclaration(e,a){let r=this._styleMap[e];super._deleteStyleDeclaration(r.line,r.offset+a)}_getLineStyle(e){let a=this._styleMap[e];return!!this.styles[a.line]}_setLineStyle(e){let a=this._styleMap[e];super._setLineStyle(a.line)}_wrapText(e,a){this.isWrapping=!0;let r=this.getGraphemeDataForRender(e),o=[];for(let u=0;u<r.wordsData.length;u++)o.push(...this._wrapLine(u,a,r));return this.isWrapping=!1,o}getGraphemeDataForRender(e){let a=this.splitByGrapheme,r=a?"":" ",o=0;return{wordsData:e.map((u,h)=>{let d=0,g=a?this.graphemeSplit(u):this.wordSplit(u);return g.length===0?[{word:[],width:0}]:g.map(m=>{let p=a?[m]:this.graphemeSplit(m),y=this._measureWord(p,h,d);return o=Math.max(y,o),d+=p.length+r.length,{word:p,width:y}})}),largestWordWidth:o}}_measureWord(e,a,r=0){let o,u=0;for(let h=0,d=e.length;h<d;h++)u+=this._getGraphemeBox(e[h],a,h+r,o,!0).kernedWidth,o=e[h];return u}wordSplit(e){return e.split(this._wordJoiners)}_wrapLine(e,a,{largestWordWidth:r,wordsData:o},u=0){let h=this._getWidthOfCharSpacing(),d=this.splitByGrapheme,g=[],m=d?"":" ",p=0,y=[],b=0,S=0,_=!0;a-=u;let w=Math.max(a,r,this.dynamicMinWidth),R=o[e],Y;for(Y=0;Y<R.length;Y++){let{word:X,width:q}=R[Y];b+=X.length,p+=S+q-h,p>w&&!_?(g.push(y),y=[],p=q,_=!0):p+=h,_||d||y.push(m),y=y.concat(X),S=d?0:this._measureWord([m],e,b),b++,_=!1}return Y&&g.push(y),r+u>this.dynamicMinWidth&&(this.dynamicMinWidth=r-h+u),g}isEndOfWrapping(e){return!this._styleMap[e+1]||this._styleMap[e+1].line!==this._styleMap[e].line}missingNewlineOffset(e,a){return this.splitByGrapheme&&!a?+!!this.isEndOfWrapping(e):1}_splitTextIntoLines(e){let a=super._splitTextIntoLines(e),r=this._wrapText(a.lines,this.width),o=Array(r.length);for(let u=0;u<r.length;u++)o[u]=r[u].join("");return a.lines=o,a.graphemeLines=r,a}getMinWidth(){return Math.max(this.minWidth,this.dynamicMinWidth)}_removeExtraneousStyles(){let e=new Map;for(let a in this._styleMap){let r=parseInt(a,10);if(this._textLines[r]){let o=this._styleMap[a].line;e.set(`${o}`,!0)}}for(let a in this.styles)e.has(a)||delete this.styles[a]}toObject(e=[]){return super.toObject(["minWidth","splitByGrapheme",...e])}};D(Su,"type","Textbox"),D(Su,"textLayoutProperties",[...ql.textLayoutProperties,"width"]),D(Su,"ownDefaults",{minWidth:20,dynamicMinWidth:2,lockScalingFlip:!0,noScaleCache:!1,_wordJoiners:/[ \t\r]/,splitByGrapheme:!1}),nt.setClass(Su);var ry=class extends Iu{shouldPerformLayout(n){return!!n.target.clipPath&&super.shouldPerformLayout(n)}shouldLayoutClipPath(){return!1}calcLayoutResult(n,e){let{target:a}=n,{clipPath:r,group:o}=a;if(!r||!this.shouldPerformLayout(n))return;let{width:u,height:h}=Ki(wb(a,r)),d=new H(u,h);if(r.absolutePositioned)return{center:pa(r.getRelativeCenterPoint(),void 0,o?o.calcTransformMatrix():void 0),size:d};{let g=r.getRelativeCenterPoint().transform(a.calcOwnMatrix(),!0);if(this.shouldPerformLayout(n)){let{center:m=new H,correction:p=new H}=this.calcBoundingBox(e,n)||{};return{center:m.add(g),correction:p.subtract(g),size:d}}return{center:a.getRelativeCenterPoint().add(g),size:d}}}};D(ry,"type","clip-path"),nt.setClass(ry);var sy=class extends Iu{getInitialSize({target:n},{size:e}){return new H(n.width||e.x,n.height||e.y)}};D(sy,"type","fixed"),nt.setClass(sy);var B2=class extends As{subscribeTargets(n){let e=n.target;n.targets.reduce((a,r)=>(r.parent&&a.add(r.parent),a),new Set).forEach(a=>{a.layoutManager.subscribeTargets({target:a,targets:[e]})})}unsubscribeTargets(n){let e=n.target,a=e.getObjects();n.targets.reduce((r,o)=>(o.parent&&r.add(o.parent),r),new Set).forEach(r=>{!a.some(o=>o.parent===r)&&r.layoutManager.unsubscribeTargets({target:r,targets:[e]})})}},_u=class vd extends Ja{static getDefaults(){return{...super.getDefaults(),...vd.ownDefaults}}constructor(e=[],a={}){super(),Object.assign(this,vd.ownDefaults),this.setOptions(a);let{left:r,top:o,layoutManager:u}=a;this.groupInit(e,{left:r,top:o,layoutManager:u??new B2})}_shouldSetNestedCoords(){return!0}__objectSelectionMonitor(){}multiSelectAdd(...e){this.multiSelectionStacking==="selection-order"?this.add(...e):e.forEach(a=>{let r=this._objects.findIndex(u=>u.isInFrontOf(a)),o=r===-1?this.size():r;this.insertAt(o,a)})}canEnterGroup(e){return this.getObjects().some(a=>a.isDescendantOf(e)||e.isDescendantOf(a))?(tn("error","ActiveSelection: circular object trees are not supported, this call has no effect"),!1):super.canEnterGroup(e)}enterGroup(e,a){e.parent&&e.parent===e.group?e.parent._exitGroup(e):e.group&&e.parent!==e.group&&e.group.remove(e),this._enterGroup(e,a)}exitGroup(e,a){this._exitGroup(e,a),e.parent&&e.parent._enterGroup(e,!0)}_onAfterObjectsChange(e,a){super._onAfterObjectsChange(e,a);let r=new Set;a.forEach(o=>{let{parent:u}=o;u&&r.add(u)}),e==="removed"?r.forEach(o=>{o._onAfterObjectsChange(id,a)}):r.forEach(o=>{o._set("dirty",!0)})}onDeselect(){return this.removeAll(),!1}toString(){return`#<ActiveSelection: (${this.complexity()})>`}shouldCache(){return!1}isOnACache(){return!1}_renderControls(e,a,r){e.save(),e.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1;let o={hasControls:!1,...r,forActiveSelection:!0};for(let u=0;u<this._objects.length;u++)this._objects[u]._renderControls(e,o);super._renderControls(e,a),e.restore()}};D(_u,"type","ActiveSelection"),D(_u,"ownDefaults",{multiSelectionStacking:"canvas-stacking"}),nt.setClass(_u),nt.setClass(_u,"activeSelection");var L2=class{constructor(){D(this,"resources",{})}applyFilters(n,e,a,r,o){let u=o.getContext("2d",{willReadFrequently:!0,desynchronized:!0});if(!u)return;u.drawImage(e,0,0,a,r);let h={sourceWidth:a,sourceHeight:r,imageData:u.getImageData(0,0,a,r),originalEl:e,originalImageData:u.getImageData(0,0,a,r),canvasEl:o,ctx:u,filterBackend:this};n.forEach(g=>{g.applyTo(h)});let{imageData:d}=h;return d.width===a&&d.height===r||(o.width=d.width,o.height=d.height),u.putImageData(d,0,0),h}},ax=class{constructor({tileSize:n=Yt.textureSize}={}){D(this,"aPosition",new Float32Array([0,0,0,1,1,0,1,1])),D(this,"resources",{}),this.tileSize=n,this.setupGLContext(n,n),this.captureGPUInfo()}setupGLContext(n,e){this.dispose(),this.createWebGLCanvas(n,e)}createWebGLCanvas(n,e){let a=ai({width:n,height:e}),r=a.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1});r&&(r.clearColor(0,0,0,0),this.canvas=a,this.gl=r)}applyFilters(n,e,a,r,o,u){let h=this.gl,d=o.getContext("2d");if(!h||!d)return;let g;u&&(g=this.getCachedTexture(u,e));let m={originalWidth:e.width||e.naturalWidth||0,originalHeight:e.height||e.naturalHeight||0,sourceWidth:a,sourceHeight:r,destinationWidth:a,destinationHeight:r,context:h,sourceTexture:this.createTexture(h,a,r,g?void 0:e),targetTexture:this.createTexture(h,a,r),originalTexture:g||this.createTexture(h,a,r,g?void 0:e),passes:n.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:o},p=h.createFramebuffer();return h.bindFramebuffer(h.FRAMEBUFFER,p),n.forEach(y=>{y&&y.applyTo(m)}),(function(y){let b=y.targetCanvas,S=b.width,_=b.height,w=y.destinationWidth,R=y.destinationHeight;S===w&&_===R||(b.width=w,b.height=R)})(m),this.copyGLTo2D(h,m),h.bindTexture(h.TEXTURE_2D,null),h.deleteTexture(m.sourceTexture),h.deleteTexture(m.targetTexture),h.deleteFramebuffer(p),d.setTransform(1,0,0,1,0,0),m}dispose(){this.canvas&&(this.canvas=null,this.gl=null),this.clearWebGLCaches()}clearWebGLCaches(){this.programCache={},this.textureCache={}}createTexture(n,e,a,r,o){let{NEAREST:u,TEXTURE_2D:h,RGBA:d,UNSIGNED_BYTE:g,CLAMP_TO_EDGE:m,TEXTURE_MAG_FILTER:p,TEXTURE_MIN_FILTER:y,TEXTURE_WRAP_S:b,TEXTURE_WRAP_T:S}=n,_=n.createTexture();return n.bindTexture(h,_),n.texParameteri(h,p,o||u),n.texParameteri(h,y,o||u),n.texParameteri(h,b,m),n.texParameteri(h,S,m),r?n.texImage2D(h,0,d,d,g,r):n.texImage2D(h,0,d,e,a,0,d,g,null),_}getCachedTexture(n,e,a){let{textureCache:r}=this;if(r[n])return r[n];{let o=this.createTexture(this.gl,e.width,e.height,e,a);return o&&(r[n]=o),o}}evictCachesForKey(n){this.textureCache[n]&&(this.gl.deleteTexture(this.textureCache[n]),delete this.textureCache[n])}copyGLTo2D(n,e){let a=n.canvas,r=e.targetCanvas,o=r.getContext("2d");if(!o)return;o.translate(0,r.height),o.scale(1,-1);let u=a.height-r.height;o.drawImage(a,0,u,r.width,r.height,0,0,r.width,r.height)}copyGLTo2DPutImageData(n,e){let a=e.targetCanvas.getContext("2d"),r=e.destinationWidth,o=e.destinationHeight,u=r*o*4;if(!a)return;let h=new Uint8Array(this.imageBuffer,0,u),d=new Uint8ClampedArray(this.imageBuffer,0,u);n.readPixels(0,0,r,o,n.RGBA,n.UNSIGNED_BYTE,h);let g=new ImageData(d,r,o);a.putImageData(g,0,0)}captureGPUInfo(){if(this.gpuInfo)return this.gpuInfo;let n=this.gl,e={renderer:"",vendor:""};if(!n)return e;let a=n.getExtension("WEBGL_debug_renderer_info");if(a){let r=n.getParameter(a.UNMASKED_RENDERER_WEBGL),o=n.getParameter(a.UNMASKED_VENDOR_WEBGL);r&&(e.renderer=r.toLowerCase()),o&&(e.vendor=o.toLowerCase())}return this.gpuInfo=e,e}};let qf;function H2(){let{WebGLProbe:n}=Ii();return n.queryWebGL(Wi()),Yt.enableGLFiltering&&n.isSupported(Yt.textureSize)?new ax({tileSize:Yt.textureSize}):new L2}function Pf(n=!0){return!qf&&n&&(qf=H2()),qf}const nx=["cropX","cropY"];var vi=class yd extends Oe{static getDefaults(){return{...super.getDefaults(),...yd.ownDefaults}}constructor(e,a){super(),D(this,"_lastScaleX",1),D(this,"_lastScaleY",1),D(this,"_filterScalingX",1),D(this,"_filterScalingY",1),this.filters=[],Object.assign(this,yd.ownDefaults),this.setOptions(a),this.cacheKey=`texture${en()}`,this.setElement(typeof e=="string"?(this.canvas&&Ei(this.canvas.getElement())||Jl()).getElementById(e):e,a)}getElement(){return this._element}setElement(e,a={}){this.removeTexture(this.cacheKey),this.removeTexture(`${this.cacheKey}_filtered`),this._element=e,this._originalElement=e,this._setWidthHeight(a),this.filters.length!==0&&this.applyFilters(),this.resizeFilter&&this.applyResizeFilters()}removeTexture(e){let a=Pf(!1);a instanceof ax&&a.evictCachesForKey(e)}dispose(){super.dispose(),this.removeTexture(this.cacheKey),this.removeTexture(`${this.cacheKey}_filtered`),this._cacheContext=null,["_originalElement","_element","_filteredEl","_cacheCanvas"].forEach(e=>{let a=this[e];a&&Ii().dispose(a),this[e]=void 0})}getCrossOrigin(){return this._originalElement&&(this._originalElement.crossOrigin||null)}getOriginalSize(){let e=this.getElement();return e?{width:e.naturalWidth||e.width,height:e.naturalHeight||e.height}:{width:0,height:0}}_stroke(e){if(!this.stroke||this.strokeWidth===0)return;let a=this.width/2,r=this.height/2;e.beginPath(),e.moveTo(-a,-r),e.lineTo(a,-r),e.lineTo(a,r),e.lineTo(-a,r),e.lineTo(-a,-r),e.closePath()}toObject(e=[]){let a=[];return this.filters.forEach(r=>{r&&a.push(r.toObject())}),{...super.toObject([...nx,...e]),src:this.getSrc(),crossOrigin:this.getCrossOrigin(),filters:a,...this.resizeFilter?{resizeFilter:this.resizeFilter.toObject()}:{}}}hasCrop(){return!!this.cropX||!!this.cropY||this.width<this._element.width||this.height<this._element.height}_toSVG(){let e=[],a=this._element,r=-this.width/2,o=-this.height/2,u=[],h=[],d="",g="";if(!a)return[];if(this.hasCrop()){let m=en();u.push('<clipPath id="imageCrop_'+m+`">
|
|
66
|
+
`,' <rect x="'+r+'" y="'+o+'" width="'+_t(this.width)+'" height="'+_t(this.height)+`" />
|
|
67
|
+
`,`</clipPath>
|
|
68
|
+
`),d=' clip-path="url(#imageCrop_'+m+')" '}if(this.imageSmoothing||(g=' image-rendering="optimizeSpeed"'),e.push(" <image ","COMMON_PARTS",`xlink:href="${_t(this.getSrc(!0))}" x="${r-this.cropX}" y="${o-this.cropY}" width="${a.width||a.naturalWidth}" height="${a.height||a.naturalHeight}"${g}${d}></image>
|
|
69
|
+
`),this.stroke||this.strokeDashArray){let m=this.fill;this.fill=null,h=[` <rect x="${r}" y="${o}" width="${_t(this.width)}" height="${_t(this.height)}" style="${this.getSvgStyles()}" />
|
|
70
|
+
`],this.fill=m}return u=this.paintFirst==="fill"?u.concat(e,h):u.concat(h,e),u}getSrc(e){let a=e?this._element:this._originalElement;return a?a.toDataURL?a.toDataURL():this.srcFromAttribute?a.getAttribute("src")||"":a.src:this.src||""}getSvgSrc(e){return this.getSrc(e)}setSrc(e,{crossOrigin:a,signal:r}={}){return Ts(e,{crossOrigin:a,signal:r}).then(o=>{a!==void 0&&this.set({crossOrigin:a}),this.setElement(o)})}toString(){return`#<Image: { src: "${this.getSrc()}" }>`}applyResizeFilters(){let e=this.resizeFilter,a=this.minimumScaleTrigger,r=this.getTotalObjectScaling(),o=r.x,u=r.y,h=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!e||o>a&&u>a)return this._element=h,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=o,void(this._lastScaleY=u);let d=ai(h),{width:g,height:m}=h;this._element=d,this._lastScaleX=e.scaleX=o,this._lastScaleY=e.scaleY=u,Pf().applyFilters([e],h,g,m,this._element),this._filterScalingX=d.width/this._originalElement.width,this._filterScalingY=d.height/this._originalElement.height}applyFilters(e=this.filters||[]){if(e=e.filter(u=>u&&!u.isNeutralState()),this.set("dirty",!0),this.removeTexture(`${this.cacheKey}_filtered`),e.length===0)return this._element=this._originalElement,this._filteredEl=void 0,this._filterScalingX=1,void(this._filterScalingY=1);let a=this._originalElement,r=a.naturalWidth||a.width,o=a.naturalHeight||a.height;if(this._element===this._originalElement){let u=ai({width:r,height:o});this._element=u,this._filteredEl=u}else this._filteredEl&&(this._element=this._filteredEl,this._filteredEl.getContext("2d").clearRect(0,0,r,o),this._lastScaleX=1,this._lastScaleY=1);Pf().applyFilters(e,this._originalElement,r,o,this._element,this.cacheKey),this._originalElement.width===this._element.width&&this._originalElement.height===this._element.height||(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height)}_render(e){e.imageSmoothingEnabled=this.imageSmoothing,this.isMoving!==!0&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(e),this._renderPaintInOrder(e)}drawCacheOnCanvas(e){e.imageSmoothingEnabled=this.imageSmoothing,super.drawCacheOnCanvas(e)}shouldCache(){return this.needsItsOwnCache()}_renderFill(e){let a=this._element;if(!a)return;let r=this._filterScalingX,o=this._filterScalingY,u=this.width,h=this.height,d=Math.max(this.cropX,0),g=Math.max(this.cropY,0),m=a.naturalWidth||a.width,p=a.naturalHeight||a.height,y=d*r,b=g*o,S=Math.min(u*r,m-y),_=Math.min(h*o,p-b),w=-u/2,R=-h/2,Y=Math.min(u,m/r-d),X=Math.min(h,p/o-g);a&&e.drawImage(a,y,b,S,_,w,R,Y,X)}_needsResize(){let e=this.getTotalObjectScaling();return e.x!==this._lastScaleX||e.y!==this._lastScaleY}_resetWidthHeight(){this.set(this.getOriginalSize())}_setWidthHeight({width:e,height:a}={}){let r=this.getOriginalSize();this.width=e||r.width,this.height=a||r.height}parsePreserveAspectRatioAttribute(){let e=Fy(this.preserveAspectRatio||""),a=this.width,r=this.height,o={width:a,height:r},u,h=this._element.width,d=this._element.height,g=1,m=1,p=0,y=0,b=0,S=0;return!e||e.alignX==="none"&&e.alignY==="none"?(g=a/h,m=r/d):(e.meetOrSlice==="meet"&&(g=m=Eb(this._element,o),u=(a-h*g)/2,e.alignX==="Min"&&(p=-u),e.alignX==="Max"&&(p=u),u=(r-d*m)/2,e.alignY==="Min"&&(y=-u),e.alignY==="Max"&&(y=u)),e.meetOrSlice==="slice"&&(g=m=Db(this._element,o),u=h-a/g,e.alignX==="Mid"&&(b=u/2),e.alignX==="Max"&&(b=u),u=d-r/m,e.alignY==="Mid"&&(S=u/2),e.alignY==="Max"&&(S=u),h=a/g,d=r/m)),{width:h,height:d,scaleX:g,scaleY:m,offsetLeft:p,offsetTop:y,cropX:b,cropY:S}}static fromObject({filters:e,resizeFilter:a,src:r,crossOrigin:o,type:u,...h},d){return Promise.all([Ts(r,{...d,crossOrigin:o}),e&&Il(e,d),a?Il([a],d):[],zs(h,d)]).then(([g,m=[],[p],y={}])=>new this(g,{...h,src:r,filters:m,resizeFilter:p,...y}))}static fromURL(e,{crossOrigin:a=null,signal:r}={},o){return Ts(e,{crossOrigin:a,signal:r}).then(u=>new this(u,o))}static async fromElement(e,a={},r){let o=ba(e,this.ATTRIBUTE_NAMES,r);return this.fromURL(o["xlink:href"]||o.href,a,o).catch(u=>(tn("log","Unable to parse Image",u),null))}};D(vi,"type","Image"),D(vi,"cacheProperties",[...va,...nx]),D(vi,"ownDefaults",{strokeWidth:0,srcFromAttribute:!1,minimumScaleTrigger:.5,cropX:0,cropY:0,imageSmoothing:!0}),D(vi,"ATTRIBUTE_NAMES",[...sn,"x","y","width","height","preserveAspectRatio","xlink:href","href","crossOrigin","image-rendering"]),nt.setClass(vi),nt.setSVGClass(vi);qu(["pattern","defs","symbol","metadata","clipPath","mask","desc"]);const Wu=n=>n.webgl!==void 0,Wd="precision highp float",Y2=`
|
|
71
|
+
${Wd};
|
|
72
|
+
varying vec2 vTexCoord;
|
|
73
|
+
uniform sampler2D uTexture;
|
|
74
|
+
void main() {
|
|
75
|
+
gl_FragColor = texture2D(uTexture, vTexCoord);
|
|
76
|
+
}`,U2=new RegExp(Wd,"g");var re=class{get type(){return this.constructor.type}constructor({type:n,...e}={}){Object.assign(this,this.constructor.defaults,e)}getFragmentSource(){return Y2}getVertexSource(){return`
|
|
77
|
+
attribute vec2 aPosition;
|
|
78
|
+
varying vec2 vTexCoord;
|
|
79
|
+
void main() {
|
|
80
|
+
vTexCoord = aPosition;
|
|
81
|
+
gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);
|
|
82
|
+
}`}createProgram(n,e=this.getFragmentSource(),a=this.getVertexSource()){let{WebGLProbe:{GLPrecision:r="highp"}}=Ii();r!=="highp"&&(e=e.replace(U2,Wd.replace("highp",r)));let o=n.createShader(n.VERTEX_SHADER),u=n.createShader(n.FRAGMENT_SHADER),h=n.createProgram();if(!o||!u||!h)throw new Qi("Vertex, fragment shader or program creation error");if(n.shaderSource(o,a),n.compileShader(o),!n.getShaderParameter(o,n.COMPILE_STATUS))throw new Qi(`Vertex shader compile error for ${this.type}: ${n.getShaderInfoLog(o)}`);if(n.shaderSource(u,e),n.compileShader(u),!n.getShaderParameter(u,n.COMPILE_STATUS))throw new Qi(`Fragment shader compile error for ${this.type}: ${n.getShaderInfoLog(u)}`);if(n.attachShader(h,o),n.attachShader(h,u),n.linkProgram(h),!n.getProgramParameter(h,n.LINK_STATUS))throw new Qi(`Shader link error for "${this.type}" ${n.getProgramInfoLog(h)}`);let d=this.getUniformLocations(n,h)||{};return d.uStepW=n.getUniformLocation(h,"uStepW"),d.uStepH=n.getUniformLocation(h,"uStepH"),{program:h,attributeLocations:this.getAttributeLocations(n,h),uniformLocations:d}}getAttributeLocations(n,e){return{aPosition:n.getAttribLocation(e,"aPosition")}}getUniformLocations(n,e){let a=this.constructor.uniformLocations,r={};for(let o=0;o<a.length;o++)r[a[o]]=n.getUniformLocation(e,a[o]);return r}sendAttributeData(n,e,a){let r=e.aPosition,o=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,o),n.enableVertexAttribArray(r),n.vertexAttribPointer(r,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,a,n.STATIC_DRAW)}_setupFrameBuffer(n){let e=n.context;if(n.passes>1){let a=n.destinationWidth,r=n.destinationHeight;n.sourceWidth===a&&n.sourceHeight===r||(e.deleteTexture(n.targetTexture),n.targetTexture=n.filterBackend.createTexture(e,a,r)),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.targetTexture,0)}else e.bindFramebuffer(e.FRAMEBUFFER,null),e.finish()}_swapTextures(n){n.passes--,n.pass++;let e=n.targetTexture;n.targetTexture=n.sourceTexture,n.sourceTexture=e}isNeutralState(n){return!1}applyTo(n){Wu(n)?(this._setupFrameBuffer(n),this.applyToWebGL(n),this._swapTextures(n)):this.applyTo2d(n)}applyTo2d(n){}getCacheKey(){return this.type}retrieveShader(n){let e=this.getCacheKey();return n.programCache[e]||(n.programCache[e]=this.createProgram(n.context)),n.programCache[e]}applyToWebGL(n){let e=n.context,a=this.retrieveShader(n);n.pass===0&&n.originalTexture?e.bindTexture(e.TEXTURE_2D,n.originalTexture):e.bindTexture(e.TEXTURE_2D,n.sourceTexture),e.useProgram(a.program),this.sendAttributeData(e,a.attributeLocations,n.aPosition),e.uniform1f(a.uniformLocations.uStepW,1/n.sourceWidth),e.uniform1f(a.uniformLocations.uStepH,1/n.sourceHeight),this.sendUniformData(e,a.uniformLocations),e.viewport(0,0,n.destinationWidth,n.destinationHeight),e.drawArrays(e.TRIANGLE_STRIP,0,4)}bindAdditionalTexture(n,e,a){n.activeTexture(a),n.bindTexture(n.TEXTURE_2D,e),n.activeTexture(n.TEXTURE0)}unbindAdditionalTexture(n,e){n.activeTexture(e),n.bindTexture(n.TEXTURE_2D,null),n.activeTexture(n.TEXTURE0)}sendUniformData(n,e){}createHelpLayer(n){if(!n.helpLayer){let{sourceWidth:e,sourceHeight:a}=n;n.helpLayer=ai({width:e,height:a})}}toObject(){let n=Object.keys(this.constructor.defaults||{});return{type:this.type,...n.reduce((e,a)=>(e[a]=this[a],e),{})}}toJSON(){return this.toObject()}static async fromObject({type:n,...e},a){return new this(e)}};D(re,"type","BaseFilter"),D(re,"uniformLocations",[]);const X2={multiply:`gl_FragColor.rgb *= uColor.rgb;
|
|
83
|
+
`,screen:`gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);
|
|
84
|
+
`,add:`gl_FragColor.rgb += uColor.rgb;
|
|
85
|
+
`,difference:`gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);
|
|
86
|
+
`,subtract:`gl_FragColor.rgb -= uColor.rgb;
|
|
87
|
+
`,lighten:`gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);
|
|
88
|
+
`,darken:`gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);
|
|
89
|
+
`,exclusion:`gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);
|
|
90
|
+
`,overlay:`
|
|
91
|
+
if (uColor.r < 0.5) {
|
|
92
|
+
gl_FragColor.r *= 2.0 * uColor.r;
|
|
93
|
+
} else {
|
|
94
|
+
gl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);
|
|
95
|
+
}
|
|
96
|
+
if (uColor.g < 0.5) {
|
|
97
|
+
gl_FragColor.g *= 2.0 * uColor.g;
|
|
98
|
+
} else {
|
|
99
|
+
gl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);
|
|
100
|
+
}
|
|
101
|
+
if (uColor.b < 0.5) {
|
|
102
|
+
gl_FragColor.b *= 2.0 * uColor.b;
|
|
103
|
+
} else {
|
|
104
|
+
gl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);
|
|
105
|
+
}
|
|
106
|
+
`,tint:`
|
|
107
|
+
gl_FragColor.rgb *= (1.0 - uColor.a);
|
|
108
|
+
gl_FragColor.rgb += uColor.rgb;
|
|
109
|
+
`};var rs=class extends re{getCacheKey(){return`${this.type}_${this.mode}`}getFragmentSource(){return`
|
|
110
|
+
precision highp float;
|
|
111
|
+
uniform sampler2D uTexture;
|
|
112
|
+
uniform vec4 uColor;
|
|
113
|
+
varying vec2 vTexCoord;
|
|
114
|
+
void main() {
|
|
115
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
116
|
+
gl_FragColor = color;
|
|
117
|
+
if (color.a > 0.0) {
|
|
118
|
+
${X2[this.mode]}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
`}applyTo2d({imageData:{data:n}}){let e=new ni(this.color).getSource(),a=this.alpha,r=e[0]*a,o=e[1]*a,u=e[2]*a,h=1-a;for(let d=0;d<n.length;d+=4){let g=n[d],m=n[d+1],p=n[d+2],y,b,S;switch(this.mode){case"multiply":y=g*r/255,b=m*o/255,S=p*u/255;break;case"screen":y=255-(255-g)*(255-r)/255,b=255-(255-m)*(255-o)/255,S=255-(255-p)*(255-u)/255;break;case"add":y=g+r,b=m+o,S=p+u;break;case"difference":y=Math.abs(g-r),b=Math.abs(m-o),S=Math.abs(p-u);break;case"subtract":y=g-r,b=m-o,S=p-u;break;case"darken":y=Math.min(g,r),b=Math.min(m,o),S=Math.min(p,u);break;case"lighten":y=Math.max(g,r),b=Math.max(m,o),S=Math.max(p,u);break;case"overlay":y=r<128?2*g*r/255:255-2*(255-g)*(255-r)/255,b=o<128?2*m*o/255:255-2*(255-m)*(255-o)/255,S=u<128?2*p*u/255:255-2*(255-p)*(255-u)/255;break;case"exclusion":y=r+g-2*r*g/255,b=o+m-2*o*m/255,S=u+p-2*u*p/255;break;case"tint":y=r+g*h,b=o+m*h,S=u+p*h}n[d]=y,n[d+1]=b,n[d+2]=S}}sendUniformData(n,e){let a=new ni(this.color).getSource();a[0]=this.alpha*a[0]/255,a[1]=this.alpha*a[1]/255,a[2]=this.alpha*a[2]/255,a[3]=this.alpha,n.uniform4fv(e.uColor,a)}};D(rs,"defaults",{color:"#F95C63",mode:"multiply",alpha:1}),D(rs,"type","BlendColor"),D(rs,"uniformLocations",["uColor"]),nt.setClass(rs);const V2={multiply:`
|
|
122
|
+
precision highp float;
|
|
123
|
+
uniform sampler2D uTexture;
|
|
124
|
+
uniform sampler2D uImage;
|
|
125
|
+
uniform vec4 uColor;
|
|
126
|
+
varying vec2 vTexCoord;
|
|
127
|
+
varying vec2 vTexCoord2;
|
|
128
|
+
void main() {
|
|
129
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
130
|
+
vec4 color2 = texture2D(uImage, vTexCoord2);
|
|
131
|
+
color.rgba *= color2.rgba;
|
|
132
|
+
gl_FragColor = color;
|
|
133
|
+
}
|
|
134
|
+
`,mask:`
|
|
135
|
+
precision highp float;
|
|
136
|
+
uniform sampler2D uTexture;
|
|
137
|
+
uniform sampler2D uImage;
|
|
138
|
+
uniform vec4 uColor;
|
|
139
|
+
varying vec2 vTexCoord;
|
|
140
|
+
varying vec2 vTexCoord2;
|
|
141
|
+
void main() {
|
|
142
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
143
|
+
vec4 color2 = texture2D(uImage, vTexCoord2);
|
|
144
|
+
color.a = color2.a;
|
|
145
|
+
gl_FragColor = color;
|
|
146
|
+
}
|
|
147
|
+
`};var ss=class extends re{getCacheKey(){return`${this.type}_${this.mode}`}getFragmentSource(){return V2[this.mode]}getVertexSource(){return`
|
|
148
|
+
attribute vec2 aPosition;
|
|
149
|
+
varying vec2 vTexCoord;
|
|
150
|
+
varying vec2 vTexCoord2;
|
|
151
|
+
uniform mat3 uTransformMatrix;
|
|
152
|
+
void main() {
|
|
153
|
+
vTexCoord = aPosition;
|
|
154
|
+
vTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;
|
|
155
|
+
gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);
|
|
156
|
+
}
|
|
157
|
+
`}applyToWebGL(n){let e=n.context,a=this.createTexture(n.filterBackend,this.image);this.bindAdditionalTexture(e,a,e.TEXTURE1),super.applyToWebGL(n),this.unbindAdditionalTexture(e,e.TEXTURE1)}createTexture(n,e){return n.getCachedTexture(e.cacheKey,e.getElement())}calculateMatrix(){let n=this.image,{width:e,height:a}=n.getElement();return[1/n.scaleX,0,0,0,1/n.scaleY,0,-n.left/e,-n.top/a,1]}applyTo2d({imageData:{data:n,width:e,height:a},filterBackend:{resources:r}}){let o=this.image;r.blendImage||(r.blendImage=Wi());let u=r.blendImage,h=u.getContext("2d");u.width!==e||u.height!==a?(u.width=e,u.height=a):h.clearRect(0,0,e,a),h.setTransform(o.scaleX,0,0,o.scaleY,o.left,o.top),h.drawImage(o.getElement(),0,0,e,a);let d=h.getImageData(0,0,e,a).data;for(let g=0;g<n.length;g+=4){let m=n[g],p=n[g+1],y=n[g+2],b=n[g+3],S=d[g],_=d[g+1],w=d[g+2],R=d[g+3];switch(this.mode){case"multiply":n[g]=m*S/255,n[g+1]=p*_/255,n[g+2]=y*w/255,n[g+3]=b*R/255;break;case"mask":n[g+3]=R}}}sendUniformData(n,e){let a=this.calculateMatrix();n.uniform1i(e.uImage,1),n.uniformMatrix3fv(e.uTransformMatrix,!1,a)}toObject(){return{...super.toObject(),image:this.image&&this.image.toObject()}}static async fromObject({type:n,image:e,...a},r){return vi.fromObject(e,r).then(o=>new this({...a,image:o}))}};D(ss,"type","BlendImage"),D(ss,"defaults",{mode:"multiply",alpha:1}),D(ss,"uniformLocations",["uTransformMatrix","uImage"]),nt.setClass(ss);var os=class extends re{getFragmentSource(){return`
|
|
158
|
+
precision highp float;
|
|
159
|
+
uniform sampler2D uTexture;
|
|
160
|
+
uniform vec2 uDelta;
|
|
161
|
+
varying vec2 vTexCoord;
|
|
162
|
+
const float nSamples = 15.0;
|
|
163
|
+
vec3 v3offset = vec3(12.9898, 78.233, 151.7182);
|
|
164
|
+
float random(vec3 scale) {
|
|
165
|
+
/* use the fragment position for a different seed per-pixel */
|
|
166
|
+
return fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);
|
|
167
|
+
}
|
|
168
|
+
void main() {
|
|
169
|
+
vec4 color = vec4(0.0);
|
|
170
|
+
float totalC = 0.0;
|
|
171
|
+
float totalA = 0.0;
|
|
172
|
+
float offset = random(v3offset);
|
|
173
|
+
for (float t = -nSamples; t <= nSamples; t++) {
|
|
174
|
+
float percent = (t + offset - 0.5) / nSamples;
|
|
175
|
+
vec4 sample = texture2D(uTexture, vTexCoord + uDelta * percent);
|
|
176
|
+
float weight = 1.0 - abs(percent);
|
|
177
|
+
float alpha = weight * sample.a;
|
|
178
|
+
color.rgb += sample.rgb * alpha;
|
|
179
|
+
color.a += alpha;
|
|
180
|
+
totalA += weight;
|
|
181
|
+
totalC += alpha;
|
|
182
|
+
}
|
|
183
|
+
gl_FragColor.rgb = color.rgb / totalC;
|
|
184
|
+
gl_FragColor.a = color.a / totalA;
|
|
185
|
+
}
|
|
186
|
+
`}applyTo(n){Wu(n)?(this.aspectRatio=n.sourceWidth/n.sourceHeight,n.passes++,this._setupFrameBuffer(n),this.horizontal=!0,this.applyToWebGL(n),this._swapTextures(n),this._setupFrameBuffer(n),this.horizontal=!1,this.applyToWebGL(n),this._swapTextures(n)):this.applyTo2d(n)}applyTo2d({imageData:{data:n,width:e,height:a}}){this.aspectRatio=e/a,this.horizontal=!0;let r=this.getBlurValue()*e,o=new Uint8ClampedArray(n),u=4*e;for(let h=0;h<n.length;h+=4){let d=0,g=0,m=0,p=0,y=0,b=h-h%u,S=b+u;for(let _=-14;_<15;_++){let w=_/15,R=4*Math.floor(r*w),Y=1-Math.abs(w),X=h+R;X<b?X=b:X>S&&(X=S);let q=n[X+3]*Y;d+=n[X]*q,g+=n[X+1]*q,m+=n[X+2]*q,p+=q,y+=Y}o[h]=d/p,o[h+1]=g/p,o[h+2]=m/p,o[h+3]=p/y}this.horizontal=!1,r=this.getBlurValue()*a;for(let h=0;h<o.length;h+=4){let d=0,g=0,m=0,p=0,y=0,b=h%u,S=o.length-u+b;for(let _=-14;_<15;_++){let w=_/15,R=Math.floor(r*w)*u,Y=1-Math.abs(w),X=h+R;X<b?X=b:X>S&&(X=S);let q=o[X+3]*Y;d+=o[X]*q,g+=o[X+1]*q,m+=o[X+2]*q,p+=q,y+=Y}n[h]=d/p,n[h+1]=g/p,n[h+2]=m/p,n[h+3]=p/y}}sendUniformData(n,e){let a=this.chooseRightDelta();n.uniform2fv(e.uDelta,a)}isNeutralState(){return this.blur===0}getBlurValue(){let n=1,{horizontal:e,aspectRatio:a}=this;return e?a>1&&(n=1/a):a<1&&(n=a),n*this.blur*.12}chooseRightDelta(){let n=this.getBlurValue();return this.horizontal?[n,0]:[0,n]}};D(os,"type","Blur"),D(os,"defaults",{blur:0}),D(os,"uniformLocations",["uDelta"]),nt.setClass(os);var us=class extends re{getFragmentSource(){return`
|
|
187
|
+
precision highp float;
|
|
188
|
+
uniform sampler2D uTexture;
|
|
189
|
+
uniform float uBrightness;
|
|
190
|
+
varying vec2 vTexCoord;
|
|
191
|
+
void main() {
|
|
192
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
193
|
+
color.rgb += uBrightness;
|
|
194
|
+
gl_FragColor = color;
|
|
195
|
+
}
|
|
196
|
+
`}applyTo2d({imageData:{data:n}}){let e=Math.round(255*this.brightness);for(let a=0;a<n.length;a+=4)n[a]+=e,n[a+1]+=e,n[a+2]+=e}isNeutralState(){return this.brightness===0}sendUniformData(n,e){n.uniform1f(e.uBrightness,this.brightness)}};D(us,"type","Brightness"),D(us,"defaults",{brightness:0}),D(us,"uniformLocations",["uBrightness"]),nt.setClass(us);const lx={matrix:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],colorsOnly:!0};var Hn=class extends re{getFragmentSource(){return`
|
|
197
|
+
precision highp float;
|
|
198
|
+
uniform sampler2D uTexture;
|
|
199
|
+
varying vec2 vTexCoord;
|
|
200
|
+
uniform mat4 uColorMatrix;
|
|
201
|
+
uniform vec4 uConstants;
|
|
202
|
+
void main() {
|
|
203
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
204
|
+
color *= uColorMatrix;
|
|
205
|
+
color += uConstants;
|
|
206
|
+
gl_FragColor = color;
|
|
207
|
+
}`}applyTo2d(n){let e=n.imageData.data,a=this.matrix,r=this.colorsOnly;for(let o=0;o<e.length;o+=4){let u=e[o],h=e[o+1],d=e[o+2];if(e[o]=u*a[0]+h*a[1]+d*a[2]+255*a[4],e[o+1]=u*a[5]+h*a[6]+d*a[7]+255*a[9],e[o+2]=u*a[10]+h*a[11]+d*a[12]+255*a[14],!r){let g=e[o+3];e[o]+=g*a[3],e[o+1]+=g*a[8],e[o+2]+=g*a[13],e[o+3]=u*a[15]+h*a[16]+d*a[17]+g*a[18]+255*a[19]}}}sendUniformData(n,e){let a=this.matrix,r=[a[0],a[1],a[2],a[3],a[5],a[6],a[7],a[8],a[10],a[11],a[12],a[13],a[15],a[16],a[17],a[18]],o=[a[4],a[9],a[14],a[19]];n.uniformMatrix4fv(e.uColorMatrix,!1,r),n.uniform4fv(e.uConstants,o)}toObject(){return{...super.toObject(),matrix:[...this.matrix]}}};function Gn(n,e){var a;let r=(D(a=class extends Hn{toObject(){return{type:this.type,colorsOnly:this.colorsOnly}}},"type",n),D(a,"defaults",{colorsOnly:!1,matrix:e}),a);return nt.setClass(r,n),r}D(Hn,"type","ColorMatrix"),D(Hn,"defaults",lx),D(Hn,"uniformLocations",["uColorMatrix","uConstants"]),nt.setClass(Hn);const F2=Gn("Brownie",[.5997,.34553,-.27082,0,.186,-.0377,.86095,.15059,0,-.1449,.24113,-.07441,.44972,0,-.02965,0,0,0,1,0]),G2=Gn("Vintage",[.62793,.32021,-.03965,0,.03784,.02578,.64411,.03259,0,.02926,.0466,-.08512,.52416,0,.02023,0,0,0,1,0]),q2=Gn("Kodachrome",[1.12855,-.39673,-.03992,0,.24991,-.16404,1.08352,-.05498,0,.09698,-.16786,-.56034,1.60148,0,.13972,0,0,0,1,0]),P2=Gn("Technicolor",[1.91252,-.85453,-.09155,0,.04624,-.30878,1.76589,-.10601,0,-.27589,-.2311,-.75018,1.84759,0,.12137,0,0,0,1,0]),Q2=Gn("Polaroid",[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0]),K2=Gn("Sepia",[.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0]),I2=Gn("BlackWhite",[1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,0,0,0,1,0]);var bd=class extends re{constructor(n={}){super(n),this.subFilters=n.subFilters||[]}applyTo(n){Wu(n)&&(n.passes+=this.subFilters.length-1),this.subFilters.forEach(e=>{e.applyTo(n)})}toObject(){return{type:this.type,subFilters:this.subFilters.map(n=>n.toObject())}}isNeutralState(){return!this.subFilters.some(n=>!n.isNeutralState())}static fromObject(n,e){return Promise.all((n.subFilters||[]).map(a=>nt.getClass(a.type).fromObject(a,e))).then(a=>new this({subFilters:a}))}};D(bd,"type","Composed"),nt.setClass(bd);var cs=class extends re{getFragmentSource(){return`
|
|
208
|
+
precision highp float;
|
|
209
|
+
uniform sampler2D uTexture;
|
|
210
|
+
uniform float uContrast;
|
|
211
|
+
varying vec2 vTexCoord;
|
|
212
|
+
void main() {
|
|
213
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
214
|
+
float contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));
|
|
215
|
+
color.rgb = contrastF * (color.rgb - 0.5) + 0.5;
|
|
216
|
+
gl_FragColor = color;
|
|
217
|
+
}`}isNeutralState(){return this.contrast===0}applyTo2d({imageData:{data:n}}){let e=Math.floor(255*this.contrast),a=259*(e+255)/(255*(259-e));for(let r=0;r<n.length;r+=4)n[r]=a*(n[r]-128)+128,n[r+1]=a*(n[r+1]-128)+128,n[r+2]=a*(n[r+2]-128)+128}sendUniformData(n,e){n.uniform1f(e.uContrast,this.contrast)}};D(cs,"type","Contrast"),D(cs,"defaults",{contrast:0}),D(cs,"uniformLocations",["uContrast"]),nt.setClass(cs);const W2={Convolute_3_1:`
|
|
218
|
+
precision highp float;
|
|
219
|
+
uniform sampler2D uTexture;
|
|
220
|
+
uniform float uMatrix[9];
|
|
221
|
+
uniform float uStepW;
|
|
222
|
+
uniform float uStepH;
|
|
223
|
+
varying vec2 vTexCoord;
|
|
224
|
+
void main() {
|
|
225
|
+
vec4 color = vec4(0, 0, 0, 0);
|
|
226
|
+
for (float h = 0.0; h < 3.0; h+=1.0) {
|
|
227
|
+
for (float w = 0.0; w < 3.0; w+=1.0) {
|
|
228
|
+
vec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));
|
|
229
|
+
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
gl_FragColor = color;
|
|
233
|
+
}
|
|
234
|
+
`,Convolute_3_0:`
|
|
235
|
+
precision highp float;
|
|
236
|
+
uniform sampler2D uTexture;
|
|
237
|
+
uniform float uMatrix[9];
|
|
238
|
+
uniform float uStepW;
|
|
239
|
+
uniform float uStepH;
|
|
240
|
+
varying vec2 vTexCoord;
|
|
241
|
+
void main() {
|
|
242
|
+
vec4 color = vec4(0, 0, 0, 1);
|
|
243
|
+
for (float h = 0.0; h < 3.0; h+=1.0) {
|
|
244
|
+
for (float w = 0.0; w < 3.0; w+=1.0) {
|
|
245
|
+
vec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));
|
|
246
|
+
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
float alpha = texture2D(uTexture, vTexCoord).a;
|
|
250
|
+
gl_FragColor = color;
|
|
251
|
+
gl_FragColor.a = alpha;
|
|
252
|
+
}
|
|
253
|
+
`,Convolute_5_1:`
|
|
254
|
+
precision highp float;
|
|
255
|
+
uniform sampler2D uTexture;
|
|
256
|
+
uniform float uMatrix[25];
|
|
257
|
+
uniform float uStepW;
|
|
258
|
+
uniform float uStepH;
|
|
259
|
+
varying vec2 vTexCoord;
|
|
260
|
+
void main() {
|
|
261
|
+
vec4 color = vec4(0, 0, 0, 0);
|
|
262
|
+
for (float h = 0.0; h < 5.0; h+=1.0) {
|
|
263
|
+
for (float w = 0.0; w < 5.0; w+=1.0) {
|
|
264
|
+
vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));
|
|
265
|
+
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
gl_FragColor = color;
|
|
269
|
+
}
|
|
270
|
+
`,Convolute_5_0:`
|
|
271
|
+
precision highp float;
|
|
272
|
+
uniform sampler2D uTexture;
|
|
273
|
+
uniform float uMatrix[25];
|
|
274
|
+
uniform float uStepW;
|
|
275
|
+
uniform float uStepH;
|
|
276
|
+
varying vec2 vTexCoord;
|
|
277
|
+
void main() {
|
|
278
|
+
vec4 color = vec4(0, 0, 0, 1);
|
|
279
|
+
for (float h = 0.0; h < 5.0; h+=1.0) {
|
|
280
|
+
for (float w = 0.0; w < 5.0; w+=1.0) {
|
|
281
|
+
vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));
|
|
282
|
+
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
float alpha = texture2D(uTexture, vTexCoord).a;
|
|
286
|
+
gl_FragColor = color;
|
|
287
|
+
gl_FragColor.a = alpha;
|
|
288
|
+
}
|
|
289
|
+
`,Convolute_7_1:`
|
|
290
|
+
precision highp float;
|
|
291
|
+
uniform sampler2D uTexture;
|
|
292
|
+
uniform float uMatrix[49];
|
|
293
|
+
uniform float uStepW;
|
|
294
|
+
uniform float uStepH;
|
|
295
|
+
varying vec2 vTexCoord;
|
|
296
|
+
void main() {
|
|
297
|
+
vec4 color = vec4(0, 0, 0, 0);
|
|
298
|
+
for (float h = 0.0; h < 7.0; h+=1.0) {
|
|
299
|
+
for (float w = 0.0; w < 7.0; w+=1.0) {
|
|
300
|
+
vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));
|
|
301
|
+
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
gl_FragColor = color;
|
|
305
|
+
}
|
|
306
|
+
`,Convolute_7_0:`
|
|
307
|
+
precision highp float;
|
|
308
|
+
uniform sampler2D uTexture;
|
|
309
|
+
uniform float uMatrix[49];
|
|
310
|
+
uniform float uStepW;
|
|
311
|
+
uniform float uStepH;
|
|
312
|
+
varying vec2 vTexCoord;
|
|
313
|
+
void main() {
|
|
314
|
+
vec4 color = vec4(0, 0, 0, 1);
|
|
315
|
+
for (float h = 0.0; h < 7.0; h+=1.0) {
|
|
316
|
+
for (float w = 0.0; w < 7.0; w+=1.0) {
|
|
317
|
+
vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));
|
|
318
|
+
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
float alpha = texture2D(uTexture, vTexCoord).a;
|
|
322
|
+
gl_FragColor = color;
|
|
323
|
+
gl_FragColor.a = alpha;
|
|
324
|
+
}
|
|
325
|
+
`,Convolute_9_1:`
|
|
326
|
+
precision highp float;
|
|
327
|
+
uniform sampler2D uTexture;
|
|
328
|
+
uniform float uMatrix[81];
|
|
329
|
+
uniform float uStepW;
|
|
330
|
+
uniform float uStepH;
|
|
331
|
+
varying vec2 vTexCoord;
|
|
332
|
+
void main() {
|
|
333
|
+
vec4 color = vec4(0, 0, 0, 0);
|
|
334
|
+
for (float h = 0.0; h < 9.0; h+=1.0) {
|
|
335
|
+
for (float w = 0.0; w < 9.0; w+=1.0) {
|
|
336
|
+
vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));
|
|
337
|
+
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
gl_FragColor = color;
|
|
341
|
+
}
|
|
342
|
+
`,Convolute_9_0:`
|
|
343
|
+
precision highp float;
|
|
344
|
+
uniform sampler2D uTexture;
|
|
345
|
+
uniform float uMatrix[81];
|
|
346
|
+
uniform float uStepW;
|
|
347
|
+
uniform float uStepH;
|
|
348
|
+
varying vec2 vTexCoord;
|
|
349
|
+
void main() {
|
|
350
|
+
vec4 color = vec4(0, 0, 0, 1);
|
|
351
|
+
for (float h = 0.0; h < 9.0; h+=1.0) {
|
|
352
|
+
for (float w = 0.0; w < 9.0; w+=1.0) {
|
|
353
|
+
vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));
|
|
354
|
+
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
float alpha = texture2D(uTexture, vTexCoord).a;
|
|
358
|
+
gl_FragColor = color;
|
|
359
|
+
gl_FragColor.a = alpha;
|
|
360
|
+
}
|
|
361
|
+
`};var hs=class extends re{getCacheKey(){return`${this.type}_${Math.sqrt(this.matrix.length)}_${+!!this.opaque}`}getFragmentSource(){return W2[this.getCacheKey()]}applyTo2d(n){let e=n.imageData,a=e.data,r=this.matrix,o=Math.round(Math.sqrt(r.length)),u=Math.floor(o/2),h=e.width,d=e.height,g=n.ctx.createImageData(h,d),m=g.data,p=+!!this.opaque,y,b,S,_,w,R,Y,X,q,I,W,$,B;for(W=0;W<d;W++)for(I=0;I<h;I++){for(w=4*(W*h+I),y=0,b=0,S=0,_=0,B=0;B<o;B++)for($=0;$<o;$++)Y=W+B-u,R=I+$-u,Y<0||Y>=d||R<0||R>=h||(X=4*(Y*h+R),q=r[B*o+$],y+=a[X]*q,b+=a[X+1]*q,S+=a[X+2]*q,p||(_+=a[X+3]*q));m[w]=y,m[w+1]=b,m[w+2]=S,m[w+3]=p?a[w+3]:_}n.imageData=g}sendUniformData(n,e){n.uniform1fv(e.uMatrix,this.matrix)}toObject(){return{...super.toObject(),opaque:this.opaque,matrix:[...this.matrix]}}};D(hs,"type","Convolute"),D(hs,"defaults",{opaque:!1,matrix:[0,0,0,0,1,0,0,0,0]}),D(hs,"uniformLocations",["uMatrix","uOpaque","uHalfSize","uSize"]),nt.setClass(hs);const rx="Gamma";var fs=class extends re{getFragmentSource(){return`
|
|
362
|
+
precision highp float;
|
|
363
|
+
uniform sampler2D uTexture;
|
|
364
|
+
uniform vec3 uGamma;
|
|
365
|
+
varying vec2 vTexCoord;
|
|
366
|
+
void main() {
|
|
367
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
368
|
+
vec3 correction = (1.0 / uGamma);
|
|
369
|
+
color.r = pow(color.r, correction.r);
|
|
370
|
+
color.g = pow(color.g, correction.g);
|
|
371
|
+
color.b = pow(color.b, correction.b);
|
|
372
|
+
gl_FragColor = color;
|
|
373
|
+
gl_FragColor.rgb *= color.a;
|
|
374
|
+
}
|
|
375
|
+
`}constructor(n={}){super(n),this.gamma=n.gamma||this.constructor.defaults.gamma.concat()}applyTo2d({imageData:{data:n}}){let e=this.gamma,a=1/e[0],r=1/e[1],o=1/e[2];this.rgbValues||(this.rgbValues={r:new Uint8Array(256),g:new Uint8Array(256),b:new Uint8Array(256)});let u=this.rgbValues;for(let h=0;h<256;h++)u.r[h]=255*(h/255)**a,u.g[h]=255*(h/255)**r,u.b[h]=255*(h/255)**o;for(let h=0;h<n.length;h+=4)n[h]=u.r[n[h]],n[h+1]=u.g[n[h+1]],n[h+2]=u.b[n[h+2]]}sendUniformData(n,e){n.uniform3fv(e.uGamma,this.gamma)}isNeutralState(){let{gamma:n}=this;return n[0]===1&&n[1]===1&&n[2]===1}toObject(){return{type:rx,gamma:this.gamma.concat()}}};D(fs,"type",rx),D(fs,"defaults",{gamma:[1,1,1]}),D(fs,"uniformLocations",["uGamma"]),nt.setClass(fs);const Z2={average:`
|
|
376
|
+
precision highp float;
|
|
377
|
+
uniform sampler2D uTexture;
|
|
378
|
+
varying vec2 vTexCoord;
|
|
379
|
+
void main() {
|
|
380
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
381
|
+
float average = (color.r + color.b + color.g) / 3.0;
|
|
382
|
+
gl_FragColor = vec4(average, average, average, color.a);
|
|
383
|
+
}
|
|
384
|
+
`,lightness:`
|
|
385
|
+
precision highp float;
|
|
386
|
+
uniform sampler2D uTexture;
|
|
387
|
+
uniform int uMode;
|
|
388
|
+
varying vec2 vTexCoord;
|
|
389
|
+
void main() {
|
|
390
|
+
vec4 col = texture2D(uTexture, vTexCoord);
|
|
391
|
+
float average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;
|
|
392
|
+
gl_FragColor = vec4(average, average, average, col.a);
|
|
393
|
+
}
|
|
394
|
+
`,luminosity:`
|
|
395
|
+
precision highp float;
|
|
396
|
+
uniform sampler2D uTexture;
|
|
397
|
+
uniform int uMode;
|
|
398
|
+
varying vec2 vTexCoord;
|
|
399
|
+
void main() {
|
|
400
|
+
vec4 col = texture2D(uTexture, vTexCoord);
|
|
401
|
+
float average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;
|
|
402
|
+
gl_FragColor = vec4(average, average, average, col.a);
|
|
403
|
+
}
|
|
404
|
+
`};var ds=class extends re{applyTo2d({imageData:{data:n}}){for(let e,a=0;a<n.length;a+=4){let r=n[a],o=n[a+1],u=n[a+2];switch(this.mode){case"average":e=(r+o+u)/3;break;case"lightness":e=(Math.min(r,o,u)+Math.max(r,o,u))/2;break;case"luminosity":e=.21*r+.72*o+.07*u}n[a+2]=n[a+1]=n[a]=e}}getCacheKey(){return`${this.type}_${this.mode}`}getFragmentSource(){return Z2[this.mode]}sendUniformData(n,e){n.uniform1i(e.uMode,1)}isNeutralState(){return!1}};D(ds,"type","Grayscale"),D(ds,"defaults",{mode:"average"}),D(ds,"uniformLocations",["uMode"]),nt.setClass(ds);const $2={...lx,rotation:0};var Du=class extends Hn{calculateMatrix(){let n=this.rotation*Math.PI,e=ji(n),a=Ri(n),r=1/3,o=Math.sqrt(r)*a,u=1-e;this.matrix=[e+u/3,r*u-o,r*u+o,0,0,r*u+o,e+r*u,r*u-o,0,0,r*u-o,r*u+o,e+r*u,0,0,0,0,0,1,0]}isNeutralState(){return this.rotation===0}applyTo(n){this.calculateMatrix(),super.applyTo(n)}toObject(){return{type:this.type,rotation:this.rotation}}};D(Du,"type","HueRotation"),D(Du,"defaults",$2),nt.setClass(Du);var gs=class extends re{applyTo2d({imageData:{data:n}}){for(let e=0;e<n.length;e+=4)n[e]=255-n[e],n[e+1]=255-n[e+1],n[e+2]=255-n[e+2],this.alpha&&(n[e+3]=255-n[e+3])}getFragmentSource(){return`
|
|
405
|
+
precision highp float;
|
|
406
|
+
uniform sampler2D uTexture;
|
|
407
|
+
uniform int uInvert;
|
|
408
|
+
uniform int uAlpha;
|
|
409
|
+
varying vec2 vTexCoord;
|
|
410
|
+
void main() {
|
|
411
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
412
|
+
if (uInvert == 1) {
|
|
413
|
+
if (uAlpha == 1) {
|
|
414
|
+
gl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,1.0 -color.a);
|
|
415
|
+
} else {
|
|
416
|
+
gl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a);
|
|
417
|
+
}
|
|
418
|
+
} else {
|
|
419
|
+
gl_FragColor = color;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
`}isNeutralState(){return!this.invert}sendUniformData(n,e){n.uniform1i(e.uInvert,Number(this.invert)),n.uniform1i(e.uAlpha,Number(this.alpha))}};D(gs,"type","Invert"),D(gs,"defaults",{alpha:!1,invert:!0}),D(gs,"uniformLocations",["uInvert","uAlpha"]),nt.setClass(gs);var ms=class extends re{getFragmentSource(){return`
|
|
423
|
+
precision highp float;
|
|
424
|
+
uniform sampler2D uTexture;
|
|
425
|
+
uniform float uStepH;
|
|
426
|
+
uniform float uNoise;
|
|
427
|
+
uniform float uSeed;
|
|
428
|
+
varying vec2 vTexCoord;
|
|
429
|
+
float rand(vec2 co, float seed, float vScale) {
|
|
430
|
+
return fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0);
|
|
431
|
+
}
|
|
432
|
+
void main() {
|
|
433
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
434
|
+
color.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise;
|
|
435
|
+
gl_FragColor = color;
|
|
436
|
+
}
|
|
437
|
+
`}applyTo2d({imageData:{data:n}}){let e=this.noise;for(let a=0;a<n.length;a+=4){let r=(.5-Math.random())*e;n[a]+=r,n[a+1]+=r,n[a+2]+=r}}sendUniformData(n,e){n.uniform1f(e.uNoise,this.noise/255),n.uniform1f(e.uSeed,Math.random())}isNeutralState(){return this.noise===0}};D(ms,"type","Noise"),D(ms,"defaults",{noise:0}),D(ms,"uniformLocations",["uNoise","uSeed"]),nt.setClass(ms);var ps=class extends re{applyTo2d({imageData:{data:n,width:e,height:a}}){for(let r=0;r<a;r+=this.blocksize)for(let o=0;o<e;o+=this.blocksize){let u=4*r*e+4*o,h=n[u],d=n[u+1],g=n[u+2],m=n[u+3];for(let p=r;p<Math.min(r+this.blocksize,a);p++)for(let y=o;y<Math.min(o+this.blocksize,e);y++){let b=4*p*e+4*y;n[b]=h,n[b+1]=d,n[b+2]=g,n[b+3]=m}}}isNeutralState(){return this.blocksize===1}getFragmentSource(){return`
|
|
438
|
+
precision highp float;
|
|
439
|
+
uniform sampler2D uTexture;
|
|
440
|
+
uniform float uBlocksize;
|
|
441
|
+
uniform float uStepW;
|
|
442
|
+
uniform float uStepH;
|
|
443
|
+
varying vec2 vTexCoord;
|
|
444
|
+
void main() {
|
|
445
|
+
float blockW = uBlocksize * uStepW;
|
|
446
|
+
float blockH = uBlocksize * uStepH;
|
|
447
|
+
int posX = int(vTexCoord.x / blockW);
|
|
448
|
+
int posY = int(vTexCoord.y / blockH);
|
|
449
|
+
float fposX = float(posX);
|
|
450
|
+
float fposY = float(posY);
|
|
451
|
+
vec2 squareCoords = vec2(fposX * blockW, fposY * blockH);
|
|
452
|
+
vec4 color = texture2D(uTexture, squareCoords);
|
|
453
|
+
gl_FragColor = color;
|
|
454
|
+
}
|
|
455
|
+
`}sendUniformData(n,e){n.uniform1f(e.uBlocksize,this.blocksize)}};D(ps,"type","Pixelate"),D(ps,"defaults",{blocksize:4}),D(ps,"uniformLocations",["uBlocksize"]),nt.setClass(ps);var vs=class extends re{getFragmentSource(){return`
|
|
456
|
+
precision highp float;
|
|
457
|
+
uniform sampler2D uTexture;
|
|
458
|
+
uniform vec4 uLow;
|
|
459
|
+
uniform vec4 uHigh;
|
|
460
|
+
varying vec2 vTexCoord;
|
|
461
|
+
void main() {
|
|
462
|
+
gl_FragColor = texture2D(uTexture, vTexCoord);
|
|
463
|
+
if(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {
|
|
464
|
+
gl_FragColor.a = 0.0;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
`}applyTo2d({imageData:{data:n}}){let e=255*this.distance,a=new ni(this.color).getSource(),r=[a[0]-e,a[1]-e,a[2]-e],o=[a[0]+e,a[1]+e,a[2]+e];for(let u=0;u<n.length;u+=4){let h=n[u],d=n[u+1],g=n[u+2];h>r[0]&&d>r[1]&&g>r[2]&&h<o[0]&&d<o[1]&&g<o[2]&&(n[u+3]=0)}}sendUniformData(n,e){let a=new ni(this.color).getSource(),r=this.distance,o=[0+a[0]/255-r,0+a[1]/255-r,0+a[2]/255-r,1],u=[a[0]/255+r,a[1]/255+r,a[2]/255+r,1];n.uniform4fv(e.uLow,o),n.uniform4fv(e.uHigh,u)}};D(vs,"type","RemoveColor"),D(vs,"defaults",{color:"#FFFFFF",distance:.02,useAlpha:!1}),D(vs,"uniformLocations",["uLow","uHigh"]),nt.setClass(vs);var ys=class extends re{sendUniformData(n,e){n.uniform2fv(e.uDelta,this.horizontal?[1/this.width,0]:[0,1/this.height]),n.uniform1fv(e.uTaps,this.taps)}getFilterWindow(){let n=this.tempScale;return Math.ceil(this.lanczosLobes/n)}getCacheKey(){let n=this.getFilterWindow();return`${this.type}_${n}`}getFragmentSource(){let n=this.getFilterWindow();return this.generateShader(n)}getTaps(){let n=this.lanczosCreate(this.lanczosLobes),e=this.tempScale,a=this.getFilterWindow(),r=Array(a);for(let o=1;o<=a;o++)r[o-1]=n(o*e);return r}generateShader(n){let e=Array(n);for(let a=1;a<=n;a++)e[a-1]=`${a}.0 * uDelta`;return`
|
|
468
|
+
precision highp float;
|
|
469
|
+
uniform sampler2D uTexture;
|
|
470
|
+
uniform vec2 uDelta;
|
|
471
|
+
varying vec2 vTexCoord;
|
|
472
|
+
uniform float uTaps[${n}];
|
|
473
|
+
void main() {
|
|
474
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
475
|
+
float sum = 1.0;
|
|
476
|
+
${e.map((a,r)=>`
|
|
477
|
+
color += texture2D(uTexture, vTexCoord + ${a}) * uTaps[${r}] + texture2D(uTexture, vTexCoord - ${a}) * uTaps[${r}];
|
|
478
|
+
sum += 2.0 * uTaps[${r}];
|
|
479
|
+
`).join(`
|
|
480
|
+
`)}
|
|
481
|
+
gl_FragColor = color / sum;
|
|
482
|
+
}
|
|
483
|
+
`}applyToForWebgl(n){n.passes++,this.width=n.sourceWidth,this.horizontal=!0,this.dW=Math.round(this.width*this.scaleX),this.dH=n.sourceHeight,this.tempScale=this.dW/this.width,this.taps=this.getTaps(),n.destinationWidth=this.dW,super.applyTo(n),n.sourceWidth=n.destinationWidth,this.height=n.sourceHeight,this.horizontal=!1,this.dH=Math.round(this.height*this.scaleY),this.tempScale=this.dH/this.height,this.taps=this.getTaps(),n.destinationHeight=this.dH,super.applyTo(n),n.sourceHeight=n.destinationHeight}applyTo(n){Wu(n)?this.applyToForWebgl(n):this.applyTo2d(n)}isNeutralState(){return this.scaleX===1&&this.scaleY===1}lanczosCreate(n){return e=>{if(e>=n||e<=-n)return 0;if(e<11920929e-14&&e>-11920929e-14)return 1;let a=(e*=Math.PI)/n;return Math.sin(e)/e*Math.sin(a)/a}}applyTo2d(n){let e=n.imageData,a=this.scaleX,r=this.scaleY;this.rcpScaleX=1/a,this.rcpScaleY=1/r;let o=e.width,u=e.height,h=Math.round(o*a),d=Math.round(u*r),g;g=this.resizeType==="sliceHack"?this.sliceByTwo(n,o,u,h,d):this.resizeType==="hermite"?this.hermiteFastResize(n,o,u,h,d):this.resizeType==="bilinear"?this.bilinearFiltering(n,o,u,h,d):this.resizeType==="lanczos"?this.lanczosResize(n,o,u,h,d):new ImageData(h,d),n.imageData=g}sliceByTwo(n,e,a,r,o){let u=n.imageData,h=.5,d=!1,g=!1,m=e*h,p=a*h,y=n.filterBackend.resources,b=0,S=0,_=e,w=0;y.sliceByTwo||(y.sliceByTwo=Wi());let R=y.sliceByTwo;(R.width<1.5*e||R.height<a)&&(R.width=1.5*e,R.height=a);let Y=R.getContext("2d");for(Y.clearRect(0,0,1.5*e,a),Y.putImageData(u,0,0),r=Math.floor(r),o=Math.floor(o);!d||!g;)e=m,a=p,r<Math.floor(m*h)?m=Math.floor(m*h):(m=r,d=!0),o<Math.floor(p*h)?p=Math.floor(p*h):(p=o,g=!0),Y.drawImage(R,b,S,e,a,_,w,m,p),b=_,S=w,w+=p;return Y.getImageData(b,S,r,o)}lanczosResize(n,e,a,r,o){let u=n.imageData.data,h=n.ctx.createImageData(r,o),d=h.data,g=this.lanczosCreate(this.lanczosLobes),m=this.rcpScaleX,p=this.rcpScaleY,y=2/this.rcpScaleX,b=2/this.rcpScaleY,S=Math.ceil(m*this.lanczosLobes/2),_=Math.ceil(p*this.lanczosLobes/2),w={},R={x:0,y:0},Y={x:0,y:0};return(function X(q){let I,W,$,B,G,lt,ut,pt,mt,St,Dt;for(R.x=(q+.5)*m,Y.x=Math.floor(R.x),I=0;I<o;I++){for(R.y=(I+.5)*p,Y.y=Math.floor(R.y),G=0,lt=0,ut=0,pt=0,mt=0,W=Y.x-S;W<=Y.x+S;W++)if(!(W<0||W>=e)){St=Math.floor(1e3*Math.abs(W-R.x)),w[St]||(w[St]={});for(let yt=Y.y-_;yt<=Y.y+_;yt++)yt<0||yt>=a||(Dt=Math.floor(1e3*Math.abs(yt-R.y)),w[St][Dt]||(w[St][Dt]=g(Math.sqrt((St*y)**2+(Dt*b)**2)/1e3)),$=w[St][Dt],$>0&&(B=4*(yt*e+W),G+=$,lt+=$*u[B],ut+=$*u[B+1],pt+=$*u[B+2],mt+=$*u[B+3]))}B=4*(I*r+q),d[B]=lt/G,d[B+1]=ut/G,d[B+2]=pt/G,d[B+3]=mt/G}return++q<r?X(q):h})(0)}bilinearFiltering(n,e,a,r,o){let u,h,d,g,m,p,y,b,S,_,w,R,Y,X=0,q=this.rcpScaleX,I=this.rcpScaleY,W=4*(e-1),$=n.imageData.data,B=n.ctx.createImageData(r,o),G=B.data;for(y=0;y<o;y++)for(b=0;b<r;b++)for(m=Math.floor(q*b),p=Math.floor(I*y),S=q*b-m,_=I*y-p,Y=4*(p*e+m),w=0;w<4;w++)u=$[Y+w],h=$[Y+4+w],d=$[Y+W+w],g=$[Y+W+4+w],R=u*(1-S)*(1-_)+h*S*(1-_)+d*_*(1-S)+g*S*_,G[X++]=R;return B}hermiteFastResize(n,e,a,r,o){let u=this.rcpScaleX,h=this.rcpScaleY,d=Math.ceil(u/2),g=Math.ceil(h/2),m=n.imageData.data,p=n.ctx.createImageData(r,o),y=p.data;for(let b=0;b<o;b++)for(let S=0;S<r;S++){let _=4*(S+b*r),w,R=0,Y=0,X=0,q=0,I=0,W=0,$=(b+.5)*h;for(let B=Math.floor(b*h);B<(b+1)*h;B++){let G=Math.abs($-(B+.5))/g,lt=(S+.5)*u,ut=G*G;for(let pt=Math.floor(S*u);pt<(S+1)*u;pt++){let mt=Math.abs(lt-(pt+.5))/d,St=Math.sqrt(ut+mt*mt);St>1&&St<-1||(w=2*St*St*St-3*St*St+1,w>0&&(mt=4*(pt+B*e),W+=w*m[mt+3],Y+=w,m[mt+3]<255&&(w=w*m[mt+3]/250),X+=w*m[mt],q+=w*m[mt+1],I+=w*m[mt+2],R+=w))}}y[_]=X/R,y[_+1]=q/R,y[_+2]=I/R,y[_+3]=W/Y}return p}};D(ys,"type","Resize"),D(ys,"defaults",{resizeType:"hermite",scaleX:1,scaleY:1,lanczosLobes:3}),D(ys,"uniformLocations",["uDelta","uTaps"]),nt.setClass(ys);var bs=class extends re{getFragmentSource(){return`
|
|
484
|
+
precision highp float;
|
|
485
|
+
uniform sampler2D uTexture;
|
|
486
|
+
uniform float uSaturation;
|
|
487
|
+
varying vec2 vTexCoord;
|
|
488
|
+
void main() {
|
|
489
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
490
|
+
float rgMax = max(color.r, color.g);
|
|
491
|
+
float rgbMax = max(rgMax, color.b);
|
|
492
|
+
color.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;
|
|
493
|
+
color.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;
|
|
494
|
+
color.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;
|
|
495
|
+
gl_FragColor = color;
|
|
496
|
+
}
|
|
497
|
+
`}applyTo2d({imageData:{data:n}}){let e=-this.saturation;for(let a=0;a<n.length;a+=4){let r=n[a],o=n[a+1],u=n[a+2],h=Math.max(r,o,u);n[a]+=h===r?0:(h-r)*e,n[a+1]+=h===o?0:(h-o)*e,n[a+2]+=h===u?0:(h-u)*e}}sendUniformData(n,e){n.uniform1f(e.uSaturation,-this.saturation)}isNeutralState(){return this.saturation===0}};D(bs,"type","Saturation"),D(bs,"defaults",{saturation:0}),D(bs,"uniformLocations",["uSaturation"]),nt.setClass(bs);var xs=class extends re{getFragmentSource(){return`
|
|
498
|
+
precision highp float;
|
|
499
|
+
uniform sampler2D uTexture;
|
|
500
|
+
uniform float uVibrance;
|
|
501
|
+
varying vec2 vTexCoord;
|
|
502
|
+
void main() {
|
|
503
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
504
|
+
float max = max(color.r, max(color.g, color.b));
|
|
505
|
+
float avg = (color.r + color.g + color.b) / 3.0;
|
|
506
|
+
float amt = (abs(max - avg) * 2.0) * uVibrance;
|
|
507
|
+
color.r += max != color.r ? (max - color.r) * amt : 0.00;
|
|
508
|
+
color.g += max != color.g ? (max - color.g) * amt : 0.00;
|
|
509
|
+
color.b += max != color.b ? (max - color.b) * amt : 0.00;
|
|
510
|
+
gl_FragColor = color;
|
|
511
|
+
}
|
|
512
|
+
`}applyTo2d({imageData:{data:n}}){let e=-this.vibrance;for(let a=0;a<n.length;a+=4){let r=n[a],o=n[a+1],u=n[a+2],h=Math.max(r,o,u),d=(r+o+u)/3,g=2*Math.abs(h-d)/255*e;n[a]+=h===r?0:(h-r)*g,n[a+1]+=h===o?0:(h-o)*g,n[a+2]+=h===u?0:(h-u)*g}}sendUniformData(n,e){n.uniform1f(e.uVibrance,-this.vibrance)}isNeutralState(){return this.vibrance===0}};D(xs,"type","Vibrance"),D(xs,"defaults",{vibrance:0}),D(xs,"uniformLocations",["uVibrance"]),nt.setClass(xs);js({BaseFilter:()=>re,BlackWhite:()=>I2,BlendColor:()=>rs,BlendImage:()=>ss,Blur:()=>os,Brightness:()=>us,Brownie:()=>F2,ColorMatrix:()=>Hn,Composed:()=>bd,Contrast:()=>cs,Convolute:()=>hs,Gamma:()=>fs,Grayscale:()=>ds,HueRotation:()=>Du,Invert:()=>gs,Kodachrome:()=>q2,Noise:()=>ms,Pixelate:()=>ps,Polaroid:()=>Q2,RemoveColor:()=>vs,Resize:()=>ys,Saturation:()=>bs,Sepia:()=>K2,Technicolor:()=>P2,Vibrance:()=>xs,Vintage:()=>G2});const Nt={canvas:{defaultWidth:600,defaultBgColor:"#ffffff",presets:[{label:"2:3 (标准电子书)",ratio:2/3},{label:"1:1.414 (A4/A5 纸张)",ratio:1/Math.sqrt(2)},{label:"3:4 (iPad 比例)",ratio:3/4},{label:"1:1 (正方形/专辑)",ratio:1},{label:"9:16 (手机海报)",ratio:9/16}],resolutions:{mobile:[{name:"iPhone 13 Pro",value:"1170x2532"},{name:"iPhone 13 Pro Max",value:"1284x2778"},{name:"Mi 10 Pro",value:"1080x2340"}],pc:[{name:"MacBook Pro 16 (2021)",value:"3456x2234"},{name:"MacBook Pro 14 (2023)",value:"3024x1964"}]},presetColors:[{name:"纯白",value:"#ffffff"},{name:"深灰",value:"#3b3737"},{name:"绿豆沙",value:"#C7EDCC"},{name:"电脑管家",value:"#CCE8CF"},{name:"杏仁黄",value:"#FAF9DE"},{name:"秋叶褐",value:"#FFF2E2"},{name:"胭脂红",value:"#FDE6E0"},{name:"海天蓝",value:"#DCE2F1"},{name:"葛巾紫",value:"#E9EBFE"},{name:"极光灰",value:"#EAEAEF"},{name:"青草绿",value:"#E3EDCD"},{name:"WPS",value:"#6E7B6C"}],presetGradients:[{name:"Sunset",css:"linear-gradient(to right, #ef4444, #f97316, #eab308)"},{name:"Ocean Depth",css:"linear-gradient(to right, #0e7490, #3b82f6, #4f46e5)"},{name:"Unicorn",css:"linear-gradient(to right, #6366f1, #a855f7, #ec4899)"},{name:"Passion",css:"linear-gradient(to right, #ec4899, #ef4444, #f97316)"},{name:"Cool Breeze",css:"linear-gradient(to right, #22d3ee, #60a5fa, #818cf8)"},{name:"Heatwave",css:"linear-gradient(to right, #eab308, #f97316, #ef4444)"},{name:"Forest",css:"linear-gradient(to right, #22c55e, #10b981, #14b8a6)"},{name:"Autumn",css:"linear-gradient(to right, #f59e0b, #f97316, #ef4444)"},{name:"Aqua",css:"linear-gradient(to right, #3b82f6, #06b6d4, #14b8a6)"},{name:"Deep Space",css:"linear-gradient(to right, #a855f7, #6366f1, #3b82f6)"},{name:"Rainbow",css:"linear-gradient(60deg, #F79533, #F37055, #EF4E7B, #A166AB, #5073B8, #1098AD, #07B39B, #6FBA82)"},{name:"Rose",css:"linear-gradient(to right, #f43f5e, #ec4899, #ef4444)"},{name:"Sky",css:"linear-gradient(to right, #6366f1, #3b82f6, #06b6d4)"},{name:"Fresh",css:"linear-gradient(to right, #84cc16, #22c55e, #10b981)"},{name:"Dusk",css:"linear-gradient(to right, #374151, #f43f5e, #fb923c)"}]},fonts:[{name:"Roboto (标准)",value:"Roboto",type:"system"},{name:"Arial (通用)",value:"Arial",type:"system"},{name:"Times New Roman (衬线)",value:"Times New Roman",type:"system"},{name:"微软雅黑",value:"Microsoft YaHei",type:"system"},{name:"抖音Sans 标准体",value:"DouyinSansBold",type:"custom",path:"/fonts/DouyinSansBold.otf"}],colors:{textPresets:[{name:"纯黑",value:"#000000"},{name:"深灰",value:"#374151"},{name:"纯白",value:"#ffffff"},{name:"浅灰",value:"#e5e7eb"},{name:"藏青",value:"#1e3a8a"},{name:"深红",value:"#991b1b"},{name:"金色",value:"#fbbf24"}],badgeBgPresets:[{name:"经典蓝",value:"#1d4ed8"},{name:"活力红",value:"#ef4444"},{name:"翡翠绿",value:"#10b981"},{name:"沉稳黑",value:"#111827"},{name:"高贵紫",value:"#7c3aed"},{name:"落日橙",value:"#f97316"},{name:"天空蓝",value:"#0ea5e9"},{name:"玫瑰粉",value:"#ec4899"}],badgeBorderPresets:[{name:"纯白",value:"#ffffff"},{name:"纯黑",value:"#000000"},{name:"深灰",value:"#374151"},{name:"浅灰",value:"#e5e7eb"},{name:"金色",value:"#fbbf24"},{name:"经典蓝",value:"#1d4ed8"}],rectPresets:[{name:"半透黑",value:"rgba(0,0,0,0.5)"},{name:"半透白",value:"rgba(255,255,255,0.5)"},{name:"品牌蓝",value:"#3b82f6"},{name:"活力橙",value:"#f97316"},{name:"高级灰",value:"#4b5563"},{name:"纯黑",value:"#000000"},{name:"纯白",value:"#ffffff"}]},stickers:{defaultWidthRatio:1/6,items:[{name:"18",path:"/icons/18.svg"},{name:"18a",path:"/icons/18a.svg"},{name:"18c",path:"/icons/18c.svg"},{name:"18d",path:"/icons/18d.svg"}]},elements:{title:{text:"输入标题",fontFamily:"Roboto",fontSize:60,fontWeight:"bold",color:"#1f2937",topRatio:.2},author:{text:"作者名称",fontFamily:"Roboto",fontSize:24,color:"#4b5563",topRatio:.55},badge:{text:"徽章文字",fontFamily:"Roboto",fontSize:24,color:"#ffffff",bgColor:"#1d4ed8",padding:20,radius:10,borderColor:"#ffffff",borderWidth:0},rectangle:{width:200,height:200,fill:"#3b82f6",opacity:1}}},Xl=()=>{const n=Nt.canvas.presets[0].ratio;return Math.round(Nt.canvas.defaultWidth/n)},J2=(n,e)=>({canvas:null,activeObject:null,bgImageObject:null,canvasWidth:Nt.canvas.defaultWidth,canvasHeight:Xl(),isCropping:!1,cropImgSrc:null,initCanvas:a=>{const r=e().canvas;r&&r.dispose();const o=Nt.canvas.defaultWidth,u=Xl(),h=new ud(a,{width:o,height:u,backgroundColor:Nt.canvas.defaultBgColor,preserveObjectStacking:!0}),d=()=>{const y=h.getActiveObject();n({activeObject:y??null})};h.on("selection:created",d),h.on("selection:updated",d),h.on("selection:cleared",()=>n({activeObject:null})),h.on("object:added",y=>{const b=y.target;b&&b.setControlsVisibility({mt:!1,mb:!1,ml:!1,mr:!1})}),h.on("mouse:dblclick",y=>{const b=y.target,{bgImageObject:S}=e();if(b&&b===S&&S instanceof vi){const _=S.getSrc();e().startCropping(_)}});const g=10,m=new Nn([0,0,0,0],{stroke:"#ff0077",strokeWidth:1,strokeDashArray:[5,5],selectable:!1,evented:!1,visible:!1,excludeFromExport:!0}),p=new Nn([0,0,0,0],{stroke:"#ff0077",strokeWidth:1,strokeDashArray:[5,5],selectable:!1,evented:!1,visible:!1,excludeFromExport:!0});h.add(m),h.add(p),h.on("object:moving",y=>{const b=y.target;if(!b)return;const S=h.width||600,_=h.height||800,w=b.getBoundingRect(),R=w.width,Y=w.height,X=b.getCenterPoint(),q=X.x,I=X.y;let W=!1,$=!1,B=q,G=I;if(Math.abs(q-S/2)<g?(B=S/2,W=!0):Math.abs(q-R/2-0)<g?(B=R/2,W=!0):Math.abs(q+R/2-S)<g&&(B=S-R/2,W=!0),Math.abs(I-_/2)<g?(G=_/2,$=!0):Math.abs(I-Y/2-0)<g?(G=Y/2,$=!0):Math.abs(I+Y/2-_)<g&&(G=_-Y/2,$=!0),h.getObjects().forEach(lt=>{if(lt===b||lt.type==="line"||lt.type!=="rect")return;const ut=lt.getCenterPoint();Math.abs(q-ut.x)<g&&(B=ut.x,W=!0),Math.abs(I-ut.y)<g&&(G=ut.y,$=!0)}),(W||$)&&b.setPositionByOrigin(new H(B,G),"center","center"),W){const lt=B;m.set({x1:lt,y1:0,x2:lt,y2:_,visible:!0}),h.bringObjectToFront(m)}else m.set({visible:!1});if($){const lt=G;p.set({x1:0,y1:lt,x2:S,y2:lt,visible:!0}),h.bringObjectToFront(p)}else p.set({visible:!1})}),h.on("mouse:up",()=>{m.set({visible:!1}),p.set({visible:!1}),h.requestRenderAll()}),n({canvas:h,canvasWidth:o,canvasHeight:u})},disposeCanvas:()=>{const{canvas:a}=e();a&&(a.dispose(),n({canvas:null,activeObject:null,bgImageObject:null}))},resizeCanvas:(a,r)=>{const{canvas:o,bgImageObject:u}=e();if(!o)return;const h=o.getWidth(),d=h>0?a/h:1;o.setDimensions({width:a,height:r}),o.getObjects().forEach(g=>{if(g===u||g.type==="line")return;const m=g.left??0,p=g.top??0,y=g.scaleX??1,b=g.scaleY??1;g.set({left:m*d,top:p*d,scaleX:y*d,scaleY:b*d}),g.setCoords()}),u&&e()._scaleBgImage(u),o.requestRenderAll(),e().fitView(),n({canvasWidth:a,canvasHeight:r})},fitView:()=>{const{canvas:a}=e();if(!a)return;const r=document.getElementById("workspace"),o=document.getElementById("scaleContainer"),u=document.getElementById("zoomLabel");if(!r||!o||!u)return;const h=60,d=r.clientWidth-h,g=r.clientHeight-h,m=a.width??Nt.canvas.defaultWidth,p=a.height??Xl();if(m===0||p===0)return;const y=Math.min(d/m,g/p),b=Math.min(y,1);o.style.transform=`scale(${b})`,u.textContent=`${Math.round(b*100)}%`},setBackgroundColor:a=>{const{canvas:r}=e();r&&(r.backgroundColor=a,r.requestRenderAll())},setGradientBackground:a=>{const{canvas:r}=e();if(!r)return;const o=r.width??Nt.canvas.defaultWidth,u=r.height??Xl(),h=a.css.match(/linear-gradient\((.*)\)/);if(!h)return;const g=h[1].split(",").map(_=>_.trim());let m="135deg",p=[];g[0].includes("deg")||g[0].includes("to ")?(m=g[0],p=g.slice(1)):p=g;let y={x1:0,y1:0,x2:o,y2:u};m==="to right"?y={x1:0,y1:0,x2:o,y2:0}:m==="to bottom"?y={x1:0,y1:0,x2:0,y2:u}:m==="to right bottom"||m==="to bottom right"?y={x1:0,y1:0,x2:o,y2:u}:m.includes("deg")&&(y={x1:0,y1:u,x2:o,y2:0});const b=p.map((_,w)=>{const R=_.split(" ")[0];return{offset:w/(p.length-1),color:R}}),S=new ns({type:"linear",coords:y,colorStops:b});r.backgroundColor=S,r.requestRenderAll()},_scaleBgImage:a=>{const{canvas:r}=e();if(!r)return;const o=r.width??Nt.canvas.defaultWidth,u=r.height??Xl(),h=a.width??1,d=a.height??1,g=Math.max(o/h,u/d);a.set({scaleX:g,scaleY:g,left:o/2,top:u/2,originX:"center",originY:"center"}),a.setCoords()},startCropping:a=>{n({isCropping:!0,cropImgSrc:a})},closeCropping:()=>{n({isCropping:!1,cropImgSrc:null})},replaceBackgroundImage:a=>{const{canvas:r,bgImageObject:o}=e();r&&vi.fromURL(a).then(u=>{u.set({selectable:!0,evented:!0,hasControls:!1,lockMovementX:!0,lockMovementY:!0,lockRotation:!0,lockScalingX:!0,lockScalingY:!0}),e()._scaleBgImage(u),o&&r.remove(o),r.add(u),r.sendObjectToBack(u),r.requestRenderAll(),n({bgImageObject:u,isCropping:!1,cropImgSrc:null})})}}),tT=(n,e)=>({addTitle:()=>{const{canvas:a,canvasHeight:r}=e();if(!a)return;const o=Nt.elements.title,u=r*o.topRatio,h=new ei(o.text,{left:(a.width??600)/2,top:u,fontFamily:o.fontFamily,fill:o.color,fontSize:o.fontSize,fontWeight:o.fontWeight,originX:"center",originY:"center",lockEditing:!0,stroke:null,strokeWidth:0,paintFirst:"stroke"});a.add(h),a.setActiveObject(h),a.requestRenderAll()},addAuthor:()=>{const{canvas:a,canvasHeight:r}=e();if(!a)return;const o=Nt.elements.author,u=r*o.topRatio,h=new ei(o.text,{left:(a.width??600)/2,top:u,fontFamily:o.fontFamily,fill:o.color,fontSize:o.fontSize,originX:"center",originY:"center",lockEditing:!0,stroke:null,strokeWidth:0,paintFirst:"stroke"});a.add(h),a.setActiveObject(h),a.requestRenderAll()},addRectangle:()=>{const{canvas:a}=e();if(!a)return;const r=Nt.elements.rectangle,o=a.width??600,u=a.height??800,h=new da({left:o/2,top:u/2,originX:"center",originY:"center",width:r.width,height:r.height,fill:r.fill,opacity:r.opacity,uniformScaling:!1});a.add(h),h.setControlsVisibility({mt:!0,mb:!0,ml:!0,mr:!0,bl:!0,br:!0,tl:!0,tr:!0,mtr:!0}),a.setActiveObject(h),a.requestRenderAll()},addImage:a=>{const{canvas:r}=e();if(!r)return;const o=new FileReader;o.onload=u=>{const h=u.target?.result;typeof h=="string"&&vi.fromURL(h).then(d=>{const g=r.width??600,m=r.height??800,y=g*.5/(d.width??1);d.set({left:g/2,top:m/2,originX:"center",originY:"center",scaleX:y,scaleY:y}),r.add(d),r.setActiveObject(d),r.requestRenderAll()})},o.readAsDataURL(a)},addSticker:a=>{const{canvas:r}=e();if(!r)return;const o=Nt.stickers,u=r.width??600,h=r.height??800,d=u*o.defaultWidthRatio;vi.fromURL(a).then(g=>{if(!g){console.error("Failed to load sticker:",a);return}const m=g.width??1,p=d/m,y=u/2,b=h/2;g.set({left:y,top:b,originX:"center",originY:"center",scaleX:p,scaleY:p,lockUniScaling:!0}),r.add(g),r.setActiveObject(g),r.requestRenderAll()}).catch(g=>{console.error("Error loading sticker SVG:",g)})},addSmartBadge:()=>{const{canvas:a}=e();if(!a)return;const r=Nt.elements.badge,o=r.padding,u=new ei(r.text,{fontFamily:r.fontFamily,fill:r.color,fontSize:r.fontSize,originX:"center",originY:"center",left:0,top:0,lockEditing:!0,stroke:null,strokeWidth:0,paintFirst:"stroke"}),h=new da({fill:r.bgColor,rx:r.radius,ry:r.radius,width:(u.width??0)+o*2,height:(u.height??0)+o*2,stroke:r.borderColor,strokeWidth:r.borderWidth,originX:"center",originY:"center",left:0,top:0}),d={left:(a.width??600)/2,top:(a.height??900)/2,originX:"center",originY:"center",isBadge:!0,badgePadding:o},g=new Ja([h,u],d);a.add(g),e().updateBadgeSize(g),a.setActiveObject(g),a.requestRenderAll()},updateBadgeSize:a=>{const{canvas:r}=e();if(!r||!a.isBadge)return;const o=a.getObjects(),u=o[0],h=o[1],d=a.badgePadding??Nt.elements.badge.padding,g=u.strokeWidth??0,m=h.width??0,p=h.height??0;u.set({width:m+d*2,height:p+d*2}),h.set({left:0,top:0,originX:"center",originY:"center"}),u.set({left:0,top:0,originX:"center",originY:"center"});const y=(u.width??100)+g,b=(u.height??50)+g;a.set({width:y,height:b}),a.setCoords(),r.requestRenderAll()},updateBadgePadding:(a,r)=>{a.badgePadding=r,e().updateBadgeSize(a)},loadBackgroundImage:a=>{const{canvas:r}=e();if(!r)return;const o=new FileReader;o.onload=u=>{const h=u.target?.result;typeof h=="string"&&vi.fromURL(h).then(d=>{d.set({selectable:!0,evented:!0}),e()._scaleBgImage(d);const g=e().bgImageObject;g&&r.remove(g),r.add(d),r.sendObjectToBack(d),r.setActiveObject(d),r.requestRenderAll(),n({bgImageObject:d,activeObject:d})})},o.readAsDataURL(a)}}),eT=(n,e)=>({deleteSelected:()=>{const{canvas:a,bgImageObject:r}=e();if(!a)return;const o=a.getActiveObjects();o.length&&(a.remove(...o),a.discardActiveObject(),a.requestRenderAll(),n({activeObject:null,...r&&o.includes(r)?{bgImageObject:null}:{}}))},bringToFront:()=>{const{canvas:a,activeObject:r}=e();!a||!r||(a.bringObjectToFront(r),a.requestRenderAll())},sendToBack:()=>{const{canvas:a,activeObject:r}=e();if(!a||!r)return;a.sendObjectToBack(r);const{bgImageObject:o}=e();o&&a.sendObjectToBack(o),a.requestRenderAll()},toggleLock:()=>{const{canvas:a,activeObject:r}=e();if(!a||!r)return;const o=!r.lockMovementX;r.set({lockMovementX:o,lockMovementY:o,lockRotation:o,lockScalingX:o,lockScalingY:o,selectable:!0,hasControls:!o,hoverCursor:o?"default":"move"}),a.requestRenderAll(),a.fire("object:modified",{target:r}),n({activeObject:r})},downloadCover:()=>{const{canvas:a}=e();if(!a)return;a.discardActiveObject(),a.requestRenderAll();const r=a.toDataURL({format:"png",quality:1,multiplier:2}),o=document.createElement("a");o.download=`ebook-cover-${Date.now()}.png`,o.href=r,o.click()}}),At=x_()((...n)=>({...J2(...n),...tT(...n),...eT(...n)}));function Zu({id:n,title:e,children:a,defaultOpen:r=!1}){const[o,u]=at.useState(r);return T.jsxs("div",{className:"border-b border-gray-200",children:[T.jsxs("button",{type:"button","aria-expanded":o,"aria-controls":`content-${n}`,onClick:()=>{u(!o)},className:"group flex w-full cursor-pointer select-none items-center justify-between px-5 py-3 text-left transition-colors hover:bg-gray-50",children:[T.jsx("h2",{className:"text-sm font-medium text-gray-800",children:e}),T.jsx("svg",{id:`arrow-${n}`,className:`h-5 w-5 transform text-gray-400 transition-transform duration-200 ${o?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:T.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),o&&T.jsx("div",{id:`content-${n}`,className:"px-5 pb-4",children:a})]})}function Vl({value:n,onChange:e,label:a}){return T.jsxs("div",{className:"mb-3",children:[T.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-500",children:a}),T.jsx("div",{className:"flex h-10 w-full items-center overflow-hidden rounded-md border border-gray-300 bg-white p-1",children:T.jsx("input",{type:"color",value:n,onChange:r=>{e(r.target.value)},className:"h-full w-full cursor-pointer border-none bg-none p-0"})})]})}function iT(){const n=At(B=>B.resizeCanvas),e=At(B=>B.setBackgroundColor),a=At(B=>B.setGradientBackground),r=At(B=>B.loadBackgroundImage),o=At(B=>B.fitView),u=Nt.canvas.presets[0],[h,d]=at.useState(u.ratio.toString()),[g,m]=at.useState(""),[p,y]=at.useState(Nt.canvas.defaultWidth),[b,S]=at.useState(Xl()),[_,w]=at.useState(Nt.canvas.defaultBgColor),R=at.useCallback(B=>{const G=B.target.value;if(d(G),m(""),G==="custom")return;const lt=parseFloat(G),ut=Math.round(p/lt);S(ut),n(p,ut)},[p,n]),Y=at.useCallback(B=>{const G=B.target.value;if(m(G),!G)return;const[lt,ut]=G.split("x").map(pt=>parseInt(pt));lt&&ut&&(y(lt),S(ut),d("custom"),n(lt,ut))},[n]),X=at.useCallback(B=>{const G=parseInt(B.target.value)||100;if(y(G),m(""),h!=="custom"){const lt=parseFloat(h),ut=Math.round(G/lt);S(ut),n(G,ut)}else n(G,b)},[h,b,n]),q=at.useCallback(B=>{const G=parseInt(B.target.value)||100;if(S(G),m(""),h!=="custom"){const lt=parseFloat(h),ut=Math.round(G*lt);y(ut),n(ut,G)}else n(p,G)},[h,p,n]),I=at.useCallback(B=>{w(B),e(B)},[e]),W=at.useCallback(B=>{const G=B.css.match(/#(?:[0-9a-fA-F]{3}){1,2}/);G&&w(G[0]),a(B)},[a]),$=at.useCallback(B=>{const G=B.target.files?.[0];G&&(r(G),B.target.value="")},[r]);return T.jsxs(Zu,{id:"sec1",title:"画布与背景",defaultOpen:!0,children:[T.jsxs("div",{className:"mb-4 rounded border border-gray-200 bg-gray-50 p-3",children:[T.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[T.jsx("div",{className:"text-xs font-medium text-gray-600",children:"画布尺寸 (像素)"}),T.jsx("button",{type:"button",onClick:o,className:"cursor-pointer text-[10px] text-blue-500 hover:underline",children:"重置视图"})]}),T.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-500",children:"常用比例"}),T.jsxs("select",{value:h,onChange:R,className:"mb-3 w-full rounded border border-gray-300 bg-white p-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",children:[Nt.canvas.presets.map(B=>T.jsx("option",{value:B.ratio.toString(),children:B.label},B.label)),T.jsx("option",{value:"custom",children:"自定义 (或下方选择设备)"})]}),T.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-500",children:"设备分辨率预设"}),T.jsxs("select",{value:g,onChange:Y,className:"mb-3 w-full rounded border border-gray-300 bg-white p-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",children:[T.jsx("option",{value:"",children:"-- 选择设备型号 --"}),T.jsx("optgroup",{label:"Mobile (手机)",children:Nt.canvas.resolutions.mobile.map(B=>T.jsxs("option",{value:B.value,children:[B.name," (",B.value,")"]},B.name))}),T.jsx("optgroup",{label:"PC (电脑)",children:Nt.canvas.resolutions.pc.map(B=>T.jsxs("option",{value:B.value,children:[B.name," (",B.value,")"]},B.name))})]}),T.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[T.jsxs("div",{children:[T.jsx("label",{className:"mb-1 block text-xs text-gray-400",children:"宽度 (W)"}),T.jsx("input",{type:"number",value:p,onChange:X,className:"w-full rounded border border-gray-300 p-2 text-center text-sm focus:ring-2 focus:ring-blue-500"})]}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1 block text-xs text-gray-400",children:"高度 (H)"}),T.jsx("input",{type:"number",value:b,onChange:q,className:"w-full rounded border border-gray-300 p-2 text-center text-sm focus:ring-2 focus:ring-blue-500"})]})]}),T.jsx("p",{className:"mt-2 text-[11px] text-gray-500",children:"调整尺寸时,画布内容会按比例缩放"})]}),T.jsx("div",{className:"my-3 border-t border-gray-200"}),T.jsxs("div",{className:"mb-3",children:[T.jsx("label",{className:"mb-2 block text-xs font-medium text-gray-500",children:"背景颜色预设 (纯色)"}),T.jsx("div",{className:"flex flex-wrap gap-2",children:Nt.canvas.presetColors.map(B=>T.jsx("button",{type:"button",onClick:()=>I(B.value),className:`h-6 w-6 rounded border border-gray-200 transition-colors ${_===B.value?"ring-2 ring-blue-700 ring-offset-1":""}`,style:{backgroundColor:B.value},title:B.name},B.name))})]}),T.jsxs("div",{className:"mb-3",children:[T.jsx("label",{className:"mb-2 block text-xs font-medium text-gray-500",children:"推荐渐变背景"}),T.jsx("div",{className:"grid grid-cols-5 gap-2",children:Nt.canvas.presetGradients.map(B=>T.jsx("button",{type:"button",onClick:()=>W(B),className:"h-8 w-full rounded border border-gray-200 transition-colors hover:border-gray-400",style:{background:B.css},title:B.name},B.name))})]}),T.jsx(Vl,{label:"自定义纯色",value:_,onChange:I}),T.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-500",children:"上传背景图 (自动填充)"}),T.jsx("input",{type:"file",accept:"image/*",onChange:$,className:"mb-1 block w-full text-sm text-gray-500 file:mr-4 file:rounded file:border-0 file:bg-blue-50 file:px-4 file:py-2 file:text-xs file:font-semibold file:text-blue-700 hover:file:bg-blue-100"})]})}const aT=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nT=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,a,r)=>r?r.toUpperCase():a.toLowerCase()),oy=n=>{const e=nT(n);return e.charAt(0).toUpperCase()+e.slice(1)},sx=(...n)=>n.filter((e,a,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===a).join(" ").trim(),lT=n=>{for(const e in n)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var rT={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const sT=at.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:a=2,absoluteStrokeWidth:r,className:o="",children:u,iconNode:h,...d},g)=>at.createElement("svg",{ref:g,...rT,width:e,height:e,stroke:n,strokeWidth:r?Number(a)*24/Number(e):a,className:sx("lucide",o),...!u&&!lT(d)&&{"aria-hidden":"true"},...d},[...h.map(([m,p])=>at.createElement(m,p)),...Array.isArray(u)?u:[u]]));const li=(n,e)=>{const a=at.forwardRef(({className:r,...o},u)=>at.createElement(sT,{ref:u,iconNode:e,className:sx(`lucide-${aT(oy(n))}`,`lucide-${n}`,r),...o}));return a.displayName=oy(n),a};const oT=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"16",key:"10p56q"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],uT=li("badge-plus",oT);const cT=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],hT=li("book-open",cT);const fT=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],dT=li("download",fT);const gT=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],mT=li("image-plus",gT);const pT=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}],["path",{d:"M7 10V7a5 5 0 0 1 9.33-2.5",key:"car5b7"}]],vT=li("lock-keyhole-open",pT);const yT=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],bT=li("lock-keyhole",yT);const xT=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]],ST=li("rectangle-horizontal",xT);const _T=[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]],CT=li("ruler",_T);const TT=[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M10 16s.8 1 2 1c1.3 0 2-1 2-1",key:"1vvgv3"}]],wT=li("sticker",TT);const OT=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ET=li("trash-2",OT);const DT=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],MT=li("type",DT);const AT=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],jT=li("user-round",AT);const RT=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],zT=li("zoom-in",RT);function NT({onClose:n}){const e=At(o=>o.addSticker),a=Nt.stickers.items;at.useEffect(()=>{const o=u=>{u.key==="Escape"&&n()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]);const r=o=>{e(o),n()};return T.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 animate-in fade-in duration-200",children:T.jsxs("div",{className:"relative flex w-full max-w-md flex-col rounded-xl bg-white shadow-2xl overflow-hidden",children:[T.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 px-5 py-4 bg-gray-50/50",children:[T.jsx("h3",{className:"text-lg font-bold text-gray-800 flex items-center gap-2",children:"选择贴图"}),T.jsx("button",{onClick:n,className:"rounded-full p-1.5 text-gray-400 hover:bg-gray-100 hover:text-gray-600 transition",children:T.jsx("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:T.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),T.jsxs("div",{className:"p-6 max-h-[60vh] overflow-y-auto custom-scroll",children:[T.jsx("div",{className:"grid grid-cols-3 gap-4",children:a.map(o=>T.jsxs("button",{onClick:()=>r(o.path),className:"group flex aspect-square flex-col items-center justify-center rounded-lg border border-gray-200 bg-white p-3 transition-colors hover:border-blue-300 hover:bg-blue-50 active:scale-[0.98]",children:[T.jsx("img",{src:o.path,alt:o.name,className:"mb-2 h-10 w-10 object-contain"}),T.jsx("span",{className:"text-xs font-medium text-gray-500 group-hover:text-blue-600",children:o.name})]},o.name))}),a.length===0&&T.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[T.jsx("span",{className:"text-2xl mb-2",children:"📂"}),T.jsx("p",{className:"text-sm text-gray-500",children:"暂无贴图配置"}),T.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"请在 config.ts 中添加贴图路径"})]})]}),T.jsx("div",{className:"bg-gray-50 px-6 py-3 border-t border-gray-100 text-right",children:T.jsx("button",{onClick:n,className:"text-xs text-gray-500 hover:text-gray-800 transition",children:"取消"})})]})})}function kT(){const n=At(p=>p.addTitle),e=At(p=>p.addAuthor),a=At(p=>p.addSmartBadge),r=At(p=>p.addRectangle),o=At(p=>p.addImage),[u,h]=at.useState(!1),d=at.useRef(null),g=at.useCallback(()=>{d.current?.click()},[]),m=at.useCallback(p=>{const y=p.target.files?.[0];y&&o(y),p.target.value=""},[o]);return T.jsxs(T.Fragment,{children:[T.jsxs(Zu,{id:"sec2",title:"添加元素",defaultOpen:!0,children:[T.jsxs("div",{className:"mb-2 grid grid-cols-2 gap-2",children:[T.jsxs("button",{type:"button",onClick:n,className:"element-button rounded border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50",children:[T.jsx(MT,{size:16,strokeWidth:1.6}),"普通标题"]}),T.jsxs("button",{type:"button",onClick:e,className:"element-button rounded border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50",children:[T.jsx(jT,{size:16,strokeWidth:1.6}),"作者名"]})]}),T.jsxs("button",{type:"button",onClick:r,className:"element-button mb-2 w-full rounded border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50",children:[T.jsx(ST,{size:16,strokeWidth:1.6})," 添加矩形(背景块或遮罩)"]}),T.jsxs("button",{type:"button",onClick:()=>h(!0),className:"element-button mb-2 w-full rounded border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50",children:[T.jsx(wT,{size:16,strokeWidth:1.6})," 添加贴图"]}),T.jsxs("div",{className:"mb-2",children:[T.jsx("input",{type:"file",accept:"image/*",ref:d,onChange:m,className:"hidden"}),T.jsxs("button",{type:"button",onClick:g,className:"element-button w-full rounded border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50",children:[T.jsx(mT,{size:16,strokeWidth:1.6})," 导入图片"]})]}),T.jsxs("button",{type:"button",onClick:a,className:"element-button element-button-primary flex w-full items-center justify-center gap-2 rounded bg-blue-700 px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-800",children:[T.jsx(uT,{size:16,strokeWidth:1.6})," 添加智能徽章"]}),T.jsx("p",{className:"mt-2 text-[11px] text-gray-500",children:"选中元素后,可在属性面板中调整"})]}),u&&T.jsx(NT,{onClose:()=>h(!1)})]})}function BT(){const n=At(d=>d.canvas),e=At(d=>d.activeObject),a=At(d=>d.toggleLock),r=At(d=>d.deleteSelected),[,o]=at.useState(0),u=at.useCallback(d=>{if(d.key!=="Delete"&&d.key!=="Backspace")return;const g=d.target;g.isContentEditable||g.closest("input, textarea, select, button")||r()},[r]);at.useEffect(()=>(document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)),[u]),at.useEffect(()=>{if(!n)return;const d=()=>o(g=>g+1);return n.on("object:modified",d),n.on("selection:updated",d),n.on("selection:created",d),n.on("selection:cleared",d),()=>{n.off("object:modified",d),n.off("selection:updated",d),n.off("selection:created",d),n.off("selection:cleared",d)}},[n]);const h=e?e.lockMovementX??!1:!1;return T.jsxs(Zu,{id:"sec3",title:"常用操作",defaultOpen:!0,children:[T.jsx("button",{type:"button",onClick:a,disabled:!e,className:`element-button mb-2 w-full rounded px-4 py-2 text-sm font-medium text-white transition-colors ${e?h?"bg-blue-700 hover:bg-blue-800":"bg-gray-700 hover:bg-gray-800":"cursor-not-allowed bg-gray-300"}`,children:e?h?T.jsxs(T.Fragment,{children:[T.jsx(vT,{size:16,strokeWidth:1.7})," 已锁定,点击解锁"]}):T.jsxs(T.Fragment,{children:[T.jsx(bT,{size:16,strokeWidth:1.7})," 锁定选中元素"]}):"请选择元素"}),T.jsxs("div",{className:"flex items-center justify-between rounded border border-gray-100 bg-gray-50 p-2 text-xs text-gray-500",children:[T.jsx("span",{children:"当前状态:"}),T.jsx("span",{className:`font-bold ${e?h?"text-blue-700":"text-gray-700":"text-gray-400"}`,children:e?h?"已锁定":"可编辑":"无选中"})]}),T.jsxs("button",{type:"button",onClick:r,disabled:!e,className:"element-button mt-3 w-full rounded border border-gray-200 bg-white px-4 py-2 text-sm font-medium text-gray-600 transition-colors hover:border-red-200 hover:bg-red-50 hover:text-red-700 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-gray-200 disabled:hover:bg-white disabled:hover:text-gray-600",children:[T.jsx(ET,{size:15,strokeWidth:1.6}),"删除选中元素",T.jsx("kbd",{className:"ml-auto rounded border border-gray-200 bg-gray-50 px-1.5 py-0.5 text-[10px] font-normal text-gray-500",children:"Del"})]}),h&&T.jsx("p",{className:"mt-2 text-center text-[10px] text-gray-400",children:"提示:锁定后仍可选中,但无法移动或缩放"})]})}function LT(){const n=At(N=>N.canvas),e=At(N=>N.activeObject),a=At(N=>N.updateBadgeSize),r=At(N=>N.updateBadgePadding),o=At(N=>N.bringToFront),u=At(N=>N.sendToBack),[,h]=at.useState(0),d=at.useMemo(()=>{const N=Nt.fonts.filter(Q=>Q.type==="system"),K=Nt.fonts.filter(Q=>Q.type==="custom");return{systemFonts:N,customFonts:K}},[]);at.useEffect(()=>{if(!n)return;const N=()=>h(K=>K+1);return n.on("object:modified",N),n.on("selection:updated",N),n.on("selection:created",N),()=>{n.off("object:modified",N),n.off("selection:updated",N),n.off("selection:created",N)}},[n]);const g=e instanceof Ja&&e.isBadge===!0,m=e&&(e.type==="i-text"||e.type==="text"),p=e&&e.type==="rect"&&!g,y=at.useCallback(N=>{if(!e||!n)return;let K=null,Q=null;if(g?(Q=e,K=Q.getObjects()[1]):m&&(K=e),!K)return;const J=(K.text||"").replace(/\n/g,""),ft=1,ri=K.isVertical?Math.round(((K.lineHeight??ft)-ft)*1e3):K.charSpacing??0;if(N==="vertical"){const on=J.split("").join(`
|
|
513
|
+
`),xa=ft+ri/1e3;K.set({text:on,isVertical:!0,textAlign:"center",charSpacing:0,lineHeight:xa})}else K.set({text:J,isVertical:!1,textAlign:"center",charSpacing:ri,lineHeight:1.16});Q&&a(Q),n.requestRenderAll(),h(on=>on+1)},[e,n,g,m,a]),b=at.useCallback(N=>{if(!n||!e)return;const K=N.target.value;let Q=K;if(g){const it=e,J=it.getObjects()[1];J.isVertical&&(Q=K.replace(/\n/g,"").split("").join(`
|
|
514
|
+
`)),J.set({text:Q}),a(it)}else if(m){const it=e;it.isVertical&&(Q=K.replace(/\n/g,"").split("").join(`
|
|
515
|
+
`)),it.set({text:Q}),n.requestRenderAll()}h(it=>it+1)},[g,m,e,n,a]),S=at.useCallback(N=>{!e||!n||(g?(e.getObjects()[1].set({fill:N}),n.requestRenderAll()):m&&(e.set({fill:N}),n.requestRenderAll()),h(K=>K+1))},[e,n,g,m]),_=at.useCallback(N=>{if(!(!e||!n)){if(g){const Q=e.getObjects()[1];Q.set({stroke:N,paintFirst:"stroke"}),(Q.strokeWidth||0)===0&&Q.set({strokeWidth:2}),n.requestRenderAll()}else m&&(e.set({stroke:N,paintFirst:"stroke"}),(e.strokeWidth||0)===0&&e.set({strokeWidth:2}),n.requestRenderAll());h(K=>K+1)}},[e,n,g,m]),w=at.useCallback(N=>{const K=parseInt(N.target.value);if(!(!e||!n)){if(g){const Q=e;Q.getObjects()[1].set({strokeWidth:K,paintFirst:"stroke"}),a(Q)}else m&&(e.set({strokeWidth:K,paintFirst:"stroke"}),n.requestRenderAll());h(Q=>Q+1)}},[e,n,g,m,a]),R=at.useCallback(N=>{const K=parseInt(N.target.value);if(!(!e||!n)){if(g){const Q=e;Q.getObjects()[1].set({fontSize:K}),a(Q)}else m&&(e.set({fontSize:K}),n.requestRenderAll());h(Q=>Q+1)}},[e,n,g,m,a]),Y=at.useCallback(N=>{const K=parseInt(N.target.value);if(!e||!n)return;let Q=null,it=null;if(g?(it=e,Q=it.getObjects()[1]):m&&(Q=e),!!Q){if(Q.isVertical){const ft=1+K/1e3;Q.set({lineHeight:ft})}else Q.set({charSpacing:K});it&&a(it),n.requestRenderAll(),h(J=>J+1)}},[e,n,g,m,a]),X=at.useCallback(N=>{const K=N.target.value;if(!(!e||!n)){if(g){const Q=e;Q.getObjects()[1].set({fontFamily:K}),setTimeout(()=>a(Q),50)}else m&&(e.set({fontFamily:K}),n.requestRenderAll());h(Q=>Q+1)}},[e,n,g,m,a]),q=at.useCallback(N=>{if(!g||!n||!e)return;e.getObjects()[0].set({fill:N}),n.requestRenderAll(),h(it=>it+1)},[g,e,n]),I=at.useCallback(N=>{const K=parseInt(N.target.value);if(!g||!n||!e)return;r(e,K),h(it=>it+1)},[g,e,n,r]),W=at.useCallback(N=>{const K=parseInt(N.target.value);if(!g||!n||!e)return;e.getObjects()[0].set({rx:K,ry:K}),n.requestRenderAll(),h(J=>J+1)},[g,e,n]),$=at.useCallback(N=>{if(!g||!n||!e)return;e.getObjects()[0].set({stroke:N}),n.requestRenderAll(),h(it=>it+1)},[g,e,n]),B=at.useCallback(N=>{const K=parseInt(N.target.value);if(!g||!n||!e)return;const Q=e;Q.getObjects()[0].set({strokeWidth:K}),a(Q),h(J=>J+1)},[g,e,n,a]),G=at.useCallback(N=>{!n||!e||(e.set({fill:N}),n.requestRenderAll(),h(K=>K+1))},[e,n]),lt=at.useCallback(N=>{const K=parseInt(N.target.value)/100;!n||!e||(e.set({opacity:K}),n.requestRenderAll(),h(Q=>Q+1))},[e,n]);let ut=24,pt="Roboto",mt="#000000",St="",Dt=0,yt=0,P="#1e40af",tt=20,rt=10,ct="",dt=!1,Jt="#ffffff",se=0,ee="#3b82f6",E=100;const F=1;if(e)if(g){const N=e,K=N.getObjects();if(K.length>=2){const Q=K[0],it=K[1];if(ut=it.fontSize??24,pt=it.fontFamily??"Roboto",mt=it.fill??"#ffffff",St=it.stroke||"",Dt=it.strokeWidth??0,dt=it.isVertical??!1,dt){const J=it.lineHeight??F;yt=Math.round((J-F)*1e3)}else yt=it.charSpacing??0;P=Q.fill??"#1e40af",tt=N.badgePadding??20,rt=Q.rx??10,ct=dt?(it.text??"").replace(/\n/g,""):it.text??"",Jt=Q.stroke??"#ffffff",se=Q.strokeWidth??0}}else if(m){const N=e;if(ut=N.fontSize??24,pt=N.fontFamily??"Roboto",mt=N.fill??"#000000",St=N.stroke||"",Dt=N.strokeWidth??0,dt=N.isVertical??!1,dt){const K=N.lineHeight??F;yt=Math.round((K-F)*1e3)}else yt=N.charSpacing??0;ct=dt?(N.text??"").replace(/\n/g,""):N.text??""}else p&&(ee=e.fill??"#3b82f6",E=(e.opacity??1)*100);const st=St&&St!=="transparent"?St:"#000000";return T.jsx(Zu,{id:"sec4",title:"属性编辑",defaultOpen:!0,children:e?T.jsxs("div",{className:"mt-2 space-y-4",children:[p&&T.jsxs("div",{className:"space-y-3",children:[T.jsx("div",{className:"mb-2 text-xs font-medium text-gray-600",children:"矩形设置"}),T.jsxs("div",{className:"mb-3",children:[T.jsx("label",{className:"mb-2 block text-xs font-medium text-gray-500",children:"推荐颜色"}),T.jsx("div",{className:"flex flex-wrap gap-2",children:Nt.colors.rectPresets.map(N=>T.jsx("button",{type:"button",onClick:()=>G(N.value),className:`h-6 w-6 rounded border border-gray-200 transition-colors ${ee===N.value?"ring-2 ring-blue-700 ring-offset-1":""}`,style:{backgroundColor:N.value},title:N.name},N.name))})]}),T.jsx(Vl,{label:"填充颜色",value:ee,onChange:G}),T.jsxs("div",{children:[T.jsxs("label",{className:"mb-1 block text-xs font-medium text-gray-500",children:["透明度: ",T.jsxs("span",{className:"font-bold",children:[Math.round(E),"%"]})]}),T.jsx("input",{type:"range",min:"0",max:"100",value:E,onChange:lt,className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-200 accent-blue-600"})]})]}),(g||m)&&T.jsxs("div",{className:"space-y-3",children:[T.jsx("div",{className:"mb-2 text-xs font-medium text-gray-600",children:"文字设置"}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1 block text-xs font-medium text-blue-600",children:"文字内容"}),T.jsx("textarea",{rows:2,value:ct,onChange:b,className:"mb-2 w-full rounded border border-gray-300 p-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"输入文字..."})]}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-500",children:"文字排列"}),T.jsxs("div",{className:"flex w-full rounded border border-gray-300 bg-gray-50 p-1",children:[T.jsx("button",{type:"button",onClick:()=>y("horizontal"),className:`flex-1 rounded py-1.5 text-xs font-medium transition ${dt?"text-gray-500 hover:bg-gray-200":"bg-white text-blue-600 shadow-sm"}`,children:"⬅➡ 横向"}),T.jsx("button",{type:"button",onClick:()=>y("vertical"),className:`flex-1 rounded py-1.5 text-xs font-medium transition ${dt?"bg-white text-blue-600 shadow-sm":"text-gray-500 hover:bg-gray-200"}`,children:"⬇ 纵向"})]})]}),T.jsxs("div",{className:"mb-3",children:[T.jsx("label",{className:"mb-2 block text-xs font-medium text-gray-500",children:"推荐颜色"}),T.jsx("div",{className:"flex flex-wrap gap-2",children:Nt.colors.textPresets.map(N=>T.jsx("button",{type:"button",onClick:()=>S(N.value),className:`h-6 w-6 rounded border border-gray-200 transition-colors ${mt.toLowerCase()===N.value.toLowerCase()?"ring-2 ring-blue-700 ring-offset-1":""}`,style:{backgroundColor:N.value},title:N.name},N.name))})]}),T.jsx(Vl,{label:"自定义文字颜色",value:mt,onChange:S}),T.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[T.jsxs("div",{children:[T.jsxs("label",{className:"mb-1 block text-xs font-medium text-gray-500",children:["字体大小: ",T.jsx("span",{className:"font-bold text-gray-800",children:ut})]}),T.jsx("input",{type:"range",min:"10",max:"200",value:ut,onChange:R,className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-200 accent-gray-600"})]}),T.jsxs("div",{children:[T.jsxs("label",{className:"mb-1 block text-xs font-medium text-gray-500",children:["字间距: ",T.jsx("span",{className:"font-bold text-gray-800",children:yt})]}),T.jsx("input",{type:"range",min:"-50",max:"800",step:"10",value:yt,onChange:Y,className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-200 accent-gray-600"}),T.jsx("p",{className:"mt-1 text-[10px] text-gray-400",children:dt?"当前调整纵向行高":"当前调整横向字符间距"})]})]}),T.jsxs("div",{className:"border-t border-gray-100 pt-3",children:[T.jsx("label",{className:"mb-2 block text-xs font-bold text-gray-500",children:"文字描边 (Stroke)"}),T.jsxs("div",{className:"mb-3",children:[T.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-400",children:"推荐描边色"}),T.jsx("div",{className:"flex flex-wrap gap-2",children:Nt.colors.badgeBorderPresets.map(N=>T.jsx("button",{type:"button",onClick:()=>_(N.value),className:`h-6 w-6 rounded border border-gray-200 transition-colors ${st.toLowerCase()===N.value.toLowerCase()?"ring-2 ring-blue-700 ring-offset-1":""}`,style:{backgroundColor:N.value},title:N.name},N.name))})]}),T.jsx("div",{className:"mb-2",children:T.jsx(Vl,{label:"自定义描边色",value:st,onChange:_})}),T.jsxs("div",{children:[T.jsxs("label",{className:"mb-1 block text-xs font-medium text-gray-500",children:["描边粗细: ",T.jsxs("span",{className:"font-bold text-gray-800",children:[Dt,"px"]})]}),T.jsx("input",{type:"range",min:"0",max:"20",step:"0.5",value:Dt,onChange:w,className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-200 accent-blue-600"})]})]}),T.jsxs("div",{className:"border-t border-gray-100 pt-3",children:[T.jsx("label",{className:"mb-1 block text-xs font-medium text-gray-500",children:"字体风格"}),T.jsxs("select",{value:pt,onChange:X,className:"w-full rounded border border-gray-300 bg-white p-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",children:[T.jsx("optgroup",{label:"系统/标准字体",children:d.systemFonts.map(N=>T.jsx("option",{value:N.value,children:N.name},N.value))}),d.customFonts.length>0&&T.jsx("optgroup",{label:"自定义/本地字体",children:d.customFonts.map(N=>T.jsx("option",{value:N.value,children:N.name},N.value))})]}),d.customFonts.length===0&&T.jsx("p",{className:"mt-1 text-[10px] text-gray-400",children:"提示: 在 public/fonts 放入 .ttf 并配置 config.ts 可添加自定义字体"})]})]}),g&&T.jsxs("div",{className:"rounded border border-blue-100 bg-blue-50 p-3 shadow-sm",children:[T.jsx("label",{className:"mb-3 flex items-center justify-between border-b border-blue-200 pb-1 text-xs font-bold text-blue-800",children:T.jsx("span",{children:"徽章背景设置"})}),T.jsxs("div",{className:"mb-3",children:[T.jsx("label",{className:"mb-2 block text-xs font-medium text-blue-600",children:"推荐背景色"}),T.jsx("div",{className:"flex flex-wrap gap-2",children:Nt.colors.badgeBgPresets.map(N=>T.jsx("button",{type:"button",onClick:()=>q(N.value),className:`h-6 w-6 rounded border border-gray-200 transition-colors ${P.toLowerCase()===N.value.toLowerCase()?"ring-2 ring-blue-700 ring-offset-1":""}`,style:{backgroundColor:N.value},title:N.name},N.name))})]}),T.jsx("div",{className:"mb-3",children:T.jsx(Vl,{label:"自定义填充颜色",value:P,onChange:q})}),T.jsxs("div",{className:"mb-3 border-t border-blue-200 pt-2",children:[T.jsx("label",{className:"mb-2 block text-xs font-medium text-gray-700",children:"边框样式"}),T.jsxs("div",{className:"mb-3",children:[T.jsxs("label",{className:"mb-1 block text-xs text-blue-600",children:["边框宽度: ",T.jsxs("span",{className:"font-bold",children:[se,"px"]})]}),T.jsx("input",{type:"range",min:"0",max:"20",step:"1",value:se,onChange:B,className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-blue-200 accent-blue-600"})]}),T.jsxs("div",{className:"mb-2",children:[T.jsx("label",{className:"mb-1 block text-xs text-blue-600",children:"推荐边框色"}),T.jsx("div",{className:"flex flex-wrap gap-2",children:Nt.colors.badgeBorderPresets.map(N=>T.jsx("button",{type:"button",onClick:()=>$(N.value),className:`h-6 w-6 rounded border border-gray-200 transition-colors ${Jt.toLowerCase()===N.value.toLowerCase()?"ring-2 ring-blue-700 ring-offset-1":""}`,style:{backgroundColor:N.value},title:N.name},N.name))})]}),T.jsx("div",{children:T.jsx(Vl,{label:"自定义边框色",value:Jt,onChange:$})})]}),T.jsxs("div",{className:"mb-3 border-t border-blue-200 pt-2",children:[T.jsx("label",{className:"mb-2 block text-xs font-medium text-gray-700",children:"尺寸与间距"}),T.jsxs("label",{className:"mb-1 block text-xs text-blue-600",children:["内边距 (Padding): ",T.jsx("span",{className:"font-bold",children:tt})]}),T.jsx("input",{type:"range",min:"5",max:"80",value:tt,onChange:I,className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-blue-200 accent-blue-600"})]}),T.jsxs("div",{children:[T.jsxs("label",{className:"mb-1 block text-xs text-blue-600",children:["圆角半径: ",T.jsx("span",{className:"font-bold",children:rt})]}),T.jsx("input",{type:"range",min:"0",max:"100",value:rt,onChange:W,className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-blue-200 accent-blue-600"})]})]}),T.jsxs("div",{className:"border-t border-gray-100 pt-2",children:[T.jsx("label",{className:"mb-2 block text-xs font-medium text-gray-500",children:"图层层级"}),T.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[T.jsx("button",{type:"button",onClick:o,className:"rounded border border-gray-300 bg-gray-100 py-1.5 text-xs text-gray-700 hover:bg-gray-200",children:"置顶"}),T.jsx("button",{type:"button",onClick:u,className:"rounded border border-gray-300 bg-gray-100 py-1.5 text-xs text-gray-700 hover:bg-gray-200",children:"置底"})]})]})]}):T.jsx("div",{className:"rounded border border-dashed border-gray-300 bg-gray-50 py-4 text-center text-sm text-gray-400",children:"请先在画布中选中元素"})})}function HT(){const n=At(e=>e.downloadCover);return T.jsx("div",{className:"z-20 shrink-0 border-t border-gray-200 bg-white p-4",children:T.jsx("div",{className:"flex flex-col gap-2",children:T.jsxs("button",{type:"button",onClick:n,className:"element-button element-button-primary w-full rounded bg-blue-700 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-blue-800",children:[T.jsx(dT,{size:16,strokeWidth:1.7}),"下载封面"]})})})}function YT(){const[n,e]=at.useState(320),a=at.useRef(null),r=at.useCallback(d=>{d.preventDefault(),a.current=d.pointerId,d.currentTarget.setPointerCapture(d.pointerId)},[]),o=at.useCallback(d=>{a.current===d.pointerId&&e(Math.min(520,Math.max(280,d.clientX)))},[]),u=at.useCallback(d=>{a.current===d.pointerId&&(a.current=null,d.currentTarget.releasePointerCapture(d.pointerId))},[]),h=at.useCallback(d=>{if(d.key!=="ArrowLeft"&&d.key!=="ArrowRight")return;d.preventDefault();const g=d.key==="ArrowRight"?16:-16;e(m=>Math.min(520,Math.max(280,m+g)))},[]);return T.jsxs("aside",{style:{width:n},className:"sidebar-panel relative z-20 flex h-full shrink-0 flex-col border-r border-gray-200 bg-white",children:[T.jsxs("header",{className:"flex items-center gap-3 border-b border-gray-200 px-5 py-4",children:[T.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-blue-700 text-white",children:T.jsx(hT,{size:18,strokeWidth:1.7})}),T.jsxs("div",{children:[T.jsx("div",{className:"text-sm font-semibold tracking-tight text-gray-900",children:"Cover Editor"}),T.jsx("div",{className:"text-xs text-gray-500",children:"电子书封面编辑器"})]}),T.jsx("span",{className:"ml-auto text-[11px] text-gray-400",children:"本地工作区"})]}),T.jsxs("div",{className:"custom-scroll flex-1 overflow-y-auto",children:[T.jsx(iT,{}),T.jsx(kT,{}),T.jsx(BT,{}),T.jsx(LT,{})]}),T.jsx(HT,{}),T.jsx("div",{role:"separator","aria-label":"调整编辑栏宽度","aria-orientation":"vertical","aria-valuemin":280,"aria-valuemax":520,"aria-valuenow":n,tabIndex:0,onPointerDown:r,onPointerMove:o,onPointerUp:u,onPointerCancel:u,onKeyDown:h,className:"sidebar-resize-handle"})]})}function UT({canvasRef:n}){const e=At(r=>r.canvasWidth),a=At(r=>r.canvasHeight);return T.jsxs("main",{id:"workspace",className:"relative flex flex-1 flex-col items-center justify-center overflow-hidden bg-gray-100 p-10",children:[T.jsxs("div",{className:"absolute left-6 top-6 z-20 flex items-center gap-2 border-l-2 border-blue-600 pl-3 text-xs text-gray-500",children:[T.jsx(CT,{size:15,strokeWidth:1.6,className:"text-gray-400"}),T.jsx("span",{className:"font-medium text-gray-800",children:"画布"}),T.jsxs("span",{className:"tabular-nums",children:[e," × ",a," px"]})]}),T.jsx("div",{id:"scaleContainer",className:"relative z-10 origin-center",children:T.jsx("div",{className:"canvas-wrapper overflow-hidden rounded-md border border-gray-300 bg-white",children:T.jsx("canvas",{ref:n,id:"c"})})}),T.jsxs("div",{className:"absolute bottom-5 z-20 flex items-center gap-2 border border-gray-200 bg-white px-3 py-2 text-xs text-gray-500",children:[T.jsx(zT,{size:14,strokeWidth:1.6}),T.jsx("span",{children:"缩放"}),T.jsx("span",{id:"zoomLabel",className:"font-medium tabular-nums text-gray-800",children:"100%"})]})]})}var Zd={x:0,y:0,width:0,height:0,unit:"px"},Yl=(n,e,a)=>Math.min(Math.max(n,e),a),XT=(...n)=>n.filter(e=>e&&typeof e=="string").join(" "),uy=(n,e)=>n===e||n.width===e.width&&n.height===e.height&&n.x===e.x&&n.y===e.y&&n.unit===e.unit;function cy(n,e,a,r){let o=Pi(n,a,r);return n.width&&(o.height=o.width/e),n.height&&(o.width=o.height*e),o.y+o.height>r&&(o.height=r-o.y,o.width=o.height*e),o.x+o.width>a&&(o.width=a-o.x,o.height=o.width/e),n.unit==="%"?$a(o,a,r):o}function VT(n,e,a){let r=Pi(n,e,a);return r.x=(e-r.width)/2,r.y=(a-r.height)/2,n.unit==="%"?$a(r,e,a):r}function $a(n,e,a){return n.unit==="%"?{...Zd,...n,unit:"%"}:{unit:"%",x:n.x?n.x/e*100:0,y:n.y?n.y/a*100:0,width:n.width?n.width/e*100:0,height:n.height?n.height/a*100:0}}function Pi(n,e,a){return!n.unit||n.unit==="px"?{...Zd,...n,unit:"px"}:{unit:"px",x:n.x?n.x*e/100:0,y:n.y?n.y*a/100:0,width:n.width?n.width*e/100:0,height:n.height?n.height*a/100:0}}function hy(n,e,a,r,o,u=0,h=0,d=r,g=o){let m={...n},p=Math.min(u,r),y=Math.min(h,o),b=Math.min(d,r),S=Math.min(g,o);e&&(e>1?(p=h?h*e:p,y=p/e,b=d*e):(y=u?u/e:y,p=y*e,S=g/e)),m.y<0&&(m.height=Math.max(m.height+m.y,y),m.y=0),m.x<0&&(m.width=Math.max(m.width+m.x,p),m.x=0);let _=r-(m.x+m.width);_<0&&(m.x=Math.min(m.x,r-p),m.width+=_);let w=o-(m.y+m.height);if(w<0&&(m.y=Math.min(m.y,o-y),m.height+=w),m.width<p&&((a==="sw"||a=="nw")&&(m.x-=p-m.width),m.width=p),m.height<y&&((a==="nw"||a=="ne")&&(m.y-=y-m.height),m.height=y),m.width>b&&((a==="sw"||a=="nw")&&(m.x-=b-m.width),m.width=b),m.height>S&&((a==="nw"||a=="ne")&&(m.y-=S-m.height),m.height=S),e){let R=m.width/m.height;if(R<e){let Y=Math.max(m.width/e,y);(a==="nw"||a=="ne")&&(m.y-=Y-m.height),m.height=Y}else if(R>e){let Y=Math.max(m.height*e,p);(a==="sw"||a=="nw")&&(m.x-=Y-m.width),m.width=Y}}return m}function FT(n,e,a,r){let o={...n};return e==="ArrowLeft"?r==="nw"?(o.x-=a,o.y-=a,o.width+=a,o.height+=a):r==="w"?(o.x-=a,o.width+=a):r==="sw"?(o.x-=a,o.width+=a,o.height+=a):r==="ne"?(o.y+=a,o.width-=a,o.height-=a):r==="e"?o.width-=a:r==="se"&&(o.width-=a,o.height-=a):e==="ArrowRight"&&(r==="nw"?(o.x+=a,o.y+=a,o.width-=a,o.height-=a):r==="w"?(o.x+=a,o.width-=a):r==="sw"?(o.x+=a,o.width-=a,o.height-=a):r==="ne"?(o.y-=a,o.width+=a,o.height+=a):r==="e"?o.width+=a:r==="se"&&(o.width+=a,o.height+=a)),e==="ArrowUp"?r==="nw"?(o.x-=a,o.y-=a,o.width+=a,o.height+=a):r==="n"?(o.y-=a,o.height+=a):r==="ne"?(o.y-=a,o.width+=a,o.height+=a):r==="sw"?(o.x+=a,o.width-=a,o.height-=a):r==="s"?o.height-=a:r==="se"&&(o.width-=a,o.height-=a):e==="ArrowDown"&&(r==="nw"?(o.x+=a,o.y+=a,o.width-=a,o.height-=a):r==="n"?(o.y+=a,o.height-=a):r==="ne"?(o.y+=a,o.width-=a,o.height-=a):r==="sw"?(o.x-=a,o.width+=a,o.height+=a):r==="s"?o.height+=a:r==="se"&&(o.width+=a,o.height+=a)),o}var Ul={capture:!0,passive:!1},GT=0,qT=class Oi extends at.PureComponent{static xOrds=["e","w"];static yOrds=["n","s"];static xyOrds=["nw","ne","se","sw"];static nudgeStep=1;static nudgeStepMedium=10;static nudgeStepLarge=100;static defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};get document(){return document}docMoveBound=!1;mouseDownOnCrop=!1;dragStarted=!1;evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0};componentRef=at.createRef();mediaRef=at.createRef();resizeObserver;initChangeCalled=!1;instanceId=`rc-${GT++}`;state={cropIsActive:!1,newCropIsBeingDrawn:!1};getBox(){let e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};let{x:a,y:r,width:o,height:u}=e.getBoundingClientRect();return{x:a,y:r,width:o,height:u}}componentDidUpdate(e){let{crop:a,onComplete:r}=this.props;if(r&&!e.crop&&a){let{width:o,height:u}=this.getBox();o&&u&&r(Pi(a,o,u),$a(a,o,u))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||=(this.document.addEventListener("pointermove",this.onDocPointerMove,Ul),this.document.addEventListener("pointerup",this.onDocPointerDone,Ul),this.document.addEventListener("pointercancel",this.onDocPointerDone,Ul),!0)}unbindDocMove(){this.docMoveBound&&=(this.document.removeEventListener("pointermove",this.onDocPointerMove,Ul),this.document.removeEventListener("pointerup",this.onDocPointerDone,Ul),this.document.removeEventListener("pointercancel",this.onDocPointerDone,Ul),!1)}onCropPointerDown=e=>{let{crop:a,disabled:r}=this.props,o=this.getBox();if(!a)return;let u=Pi(a,o.width,o.height);if(r)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let h=e.target.dataset.ord,d=!!h,g=e.clientX,m=e.clientY,p=u.x,y=u.y;if(h){let b=e.clientX-o.x,S=e.clientY-o.y,_=0,w=0;h==="ne"||h=="e"?(_=b-(u.x+u.width),w=S-u.y,p=u.x,y=u.y+u.height):h==="se"||h==="s"?(_=b-(u.x+u.width),w=S-(u.y+u.height),p=u.x,y=u.y):h==="sw"||h=="w"?(_=b-u.x,w=S-(u.y+u.height),p=u.x+u.width,y=u.y):(h==="nw"||h=="n")&&(_=b-u.x,w=S-u.y,p=u.x+u.width,y=u.y+u.height),g=p+o.x+_,m=y+o.y+w}this.evData={startClientX:g,startClientY:m,startCropX:p,startCropY:y,clientX:e.clientX,clientY:e.clientY,isResize:d,ord:h},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})};onComponentPointerDown=e=>{let{crop:a,disabled:r,locked:o,keepSelection:u,onChange:h}=this.props,d=this.getBox();if(r||o||u&&a)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let g=e.clientX-d.x,m=e.clientY-d.y,p={unit:"px",x:g,y:m,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:g,startCropY:m,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,h(Pi(p,d.width,d.height),$a(p,d.width,d.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})};onDocPointerMove=e=>{let{crop:a,disabled:r,onChange:o,onDragStart:u}=this.props,h=this.getBox();if(r||!a||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,u&&u(e));let{evData:d}=this;d.clientX=e.clientX,d.clientY=e.clientY;let g;g=d.isResize?this.resizeCrop():this.dragCrop(),uy(a,g)||o(Pi(g,h.width,h.height),$a(g,h.width,h.height))};onComponentKeyDown=e=>{let{crop:a,disabled:r,onChange:o,onComplete:u}=this.props;if(r)return;let h=e.key,d=!1;if(!a)return;let g=this.getBox(),m=this.makePixelCrop(g),p=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?Oi.nudgeStepLarge:e.shiftKey?Oi.nudgeStepMedium:Oi.nudgeStep;if(h==="ArrowLeft"?(m.x-=p,d=!0):h==="ArrowRight"?(m.x+=p,d=!0):h==="ArrowUp"?(m.y-=p,d=!0):h==="ArrowDown"&&(m.y+=p,d=!0),d){e.cancelable&&e.preventDefault(),m.x=Yl(m.x,0,g.width-m.width),m.y=Yl(m.y,0,g.height-m.height);let y=Pi(m,g.width,g.height),b=$a(m,g.width,g.height);o(y,b),u&&u(y,b)}};onHandlerKeyDown=(e,a)=>{let{aspect:r=0,crop:o,disabled:u,minWidth:h=0,minHeight:d=0,maxWidth:g,maxHeight:m,onChange:p,onComplete:y}=this.props,b=this.getBox();if(u||!o)return;if(e.key==="ArrowUp"||e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight")e.stopPropagation(),e.preventDefault();else return;let S=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?Oi.nudgeStepLarge:e.shiftKey?Oi.nudgeStepMedium:Oi.nudgeStep,_=hy(FT(Pi(o,b.width,b.height),e.key,S,a),r,a,b.width,b.height,h,d,g,m);if(!uy(o,_)){let w=$a(_,b.width,b.height);p(_,w),y&&y(_,w)}};onDocPointerDone=e=>{let{crop:a,disabled:r,onComplete:o,onDragEnd:u}=this.props,h=this.getBox();this.unbindDocMove(),!(r||!a)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,u&&u(e),o&&o(Pi(a,h.width,h.height),$a(a,h.width,h.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))};onDragFocus=()=>{this.componentRef.current?.scrollTo(0,0)};getCropStyle(){let{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){let{evData:e}=this,a=this.getBox(),r=this.makePixelCrop(a),o=e.clientX-e.startClientX,u=e.clientY-e.startClientY;return r.x=Yl(e.startCropX+o,0,a.width-r.width),r.y=Yl(e.startCropY+u,0,a.height-r.height),r}getPointRegion(e,a,r,o){let{evData:u}=this,h=u.clientX-e.x,d=u.clientY-e.y,g;g=o&&a?a==="nw"||a==="n"||a==="ne":d<u.startCropY;let m;return m=r&&a?a==="nw"||a==="w"||a==="sw":h<u.startCropX,m?g?"nw":"sw":g?"ne":"se"}resolveMinDimensions(e,a,r=0,o=0){let u=Math.min(r,e.width),h=Math.min(o,e.height);return!a||!u&&!h?[u,h]:a>1?u?[u,u/a]:[h*a,h]:h?[h*a,h]:[u,u/a]}resizeCrop(){let{evData:e}=this,{aspect:a=0,maxWidth:r,maxHeight:o}=this.props,u=this.getBox(),[h,d]=this.resolveMinDimensions(u,a,this.props.minWidth,this.props.minHeight),g=this.makePixelCrop(u),m=this.getPointRegion(u,e.ord,h,d),p=e.ord||m,y=e.clientX-e.startClientX,b=e.clientY-e.startClientY;(h&&p==="nw"||p==="w"||p==="sw")&&(y=Math.min(y,-h)),(d&&p==="nw"||p==="n"||p==="ne")&&(b=Math.min(b,-d));let S={unit:"px",x:0,y:0,width:0,height:0};m==="ne"?(S.x=e.startCropX,S.width=y,a?(S.height=S.width/a,S.y=e.startCropY-S.height):(S.height=Math.abs(b),S.y=e.startCropY-S.height)):m==="se"?(S.x=e.startCropX,S.y=e.startCropY,S.width=y,a?S.height=S.width/a:S.height=b):m==="sw"?(S.x=e.startCropX+y,S.y=e.startCropY,S.width=Math.abs(y),a?S.height=S.width/a:S.height=b):m==="nw"&&(S.x=e.startCropX+y,S.width=Math.abs(y),a?(S.height=S.width/a,S.y=e.startCropY-S.height):(S.height=Math.abs(b),S.y=e.startCropY+b));let _=hy(S,a,m,u.width,u.height,h,d,r,o);return a||Oi.xyOrds.indexOf(p)>-1?g=_:Oi.xOrds.indexOf(p)>-1?(g.x=_.x,g.width=_.width):Oi.yOrds.indexOf(p)>-1&&(g.y=_.y,g.height=_.height),g.x=Yl(g.x,0,u.width-g.width),g.y=Yl(g.y,0,u.height-g.height),g}renderCropSelection(){let{ariaLabels:e=Oi.defaultProps.ariaLabels,disabled:a,locked:r,renderSelectionAddon:o,ruleOfThirds:u,crop:h}=this.props,d=this.getCropStyle();if(h)return jt.createElement("div",{style:d,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":e.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!a&&!r&&jt.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},jt.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),jt.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),jt.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),jt.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),jt.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":e.nwDragHandle,onKeyDown:g=>this.onHandlerKeyDown(g,"nw"),role:"button"}),jt.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":e.nDragHandle,onKeyDown:g=>this.onHandlerKeyDown(g,"n"),role:"button"}),jt.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":e.neDragHandle,onKeyDown:g=>this.onHandlerKeyDown(g,"ne"),role:"button"}),jt.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":e.eDragHandle,onKeyDown:g=>this.onHandlerKeyDown(g,"e"),role:"button"}),jt.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":e.seDragHandle,onKeyDown:g=>this.onHandlerKeyDown(g,"se"),role:"button"}),jt.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":e.sDragHandle,onKeyDown:g=>this.onHandlerKeyDown(g,"s"),role:"button"}),jt.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":e.swDragHandle,onKeyDown:g=>this.onHandlerKeyDown(g,"sw"),role:"button"}),jt.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":e.wDragHandle,onKeyDown:g=>this.onHandlerKeyDown(g,"w"),role:"button"})),o&&jt.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:g=>g.stopPropagation()},o(this.state)),u&&jt.createElement(jt.Fragment,null,jt.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),jt.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){return Pi({...Zd,...this.props.crop||{}},e.width,e.height)}render(){let{aspect:e,children:a,circularCrop:r,className:o,crop:u,disabled:h,locked:d,style:g,ruleOfThirds:m}=this.props,{cropIsActive:p,newCropIsBeingDrawn:y}=this.state,b=u?this.renderCropSelection():null,S=XT("ReactCrop",o,p&&"ReactCrop--active",h&&"ReactCrop--disabled",d&&"ReactCrop--locked",y&&"ReactCrop--new-crop",u&&e&&"ReactCrop--fixed-aspect",u&&r&&"ReactCrop--circular-crop",u&&m&&"ReactCrop--rule-of-thirds",!this.dragStarted&&u&&!u.width&&!u.height&&"ReactCrop--invisible-crop",r&&"ReactCrop--no-animate");return jt.createElement("div",{ref:this.componentRef,className:S,style:g},jt.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},a),u?jt.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},jt.createElement("defs",null,jt.createElement("mask",{id:`hole-${this.instanceId}`},jt.createElement("rect",{width:"100%",height:"100%",fill:"white"}),r?jt.createElement("ellipse",{cx:`${u.x+u.width/2}${u.unit}`,cy:`${u.y+u.height/2}${u.unit}`,rx:`${u.width/2}${u.unit}`,ry:`${u.height/2}${u.unit}`,fill:"black"}):jt.createElement("rect",{x:`${u.x}${u.unit}`,y:`${u.y}${u.unit}`,width:`${u.width}${u.unit}`,height:`${u.height}${u.unit}`,fill:"black"}))),jt.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,b)}};function PT(n,e,a){let r=cy({unit:"%",width:100},a,n,e);return r.height>100&&(r=cy({unit:"%",height:100},a,n,e)),VT(r,n,e)}function QT(n,e){const a=document.createElement("canvas"),r=n.naturalWidth/n.width,o=n.naturalHeight/n.height,u=a.getContext("2d");if(!u)throw new Error("No 2d context");const h=window.devicePixelRatio;a.width=Math.floor(e.width*r*h),a.height=Math.floor(e.height*o*h),u.scale(h,h),u.imageSmoothingQuality="high";const d=e.x*r,g=e.y*o,m=n.naturalWidth/2,p=n.naturalHeight/2;return u.save(),u.translate(-d,-g),u.translate(m,p),u.translate(-m,-p),u.drawImage(n,0,0,n.naturalWidth,n.naturalHeight,0,0,n.naturalWidth,n.naturalHeight),u.restore(),new Promise(y=>{y(a.toDataURL("image/png"))})}function KT(){const n=At(_=>_.canvasWidth),e=At(_=>_.canvasHeight),a=At(_=>_.cropImgSrc),r=At(_=>_.closeCropping),o=At(_=>_.replaceBackgroundImage),u=at.useRef(null),[h,d]=at.useState(),[g,m]=at.useState(),p=n/e,y=at.useCallback((_,w)=>{const R=PT(_,w,p);d(R)},[p]),b=at.useCallback(_=>{const{width:w,height:R}=_.currentTarget;y(w,R)},[y]);at.useEffect(()=>{if(u.current&&u.current.complete){const{width:_,height:w}=u.current;_&&w&&y(_,w)}},[a,y]);const S=at.useCallback(async()=>{if(g&&u.current)try{const _=await QT(u.current,g);o(_)}catch(_){console.error("Crop error:",_)}},[g,o]);return at.useEffect(()=>{const _=w=>{w.key==="Escape"&&r()};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[r]),a?T.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/90 backdrop-blur-sm p-10",children:T.jsxs("div",{className:"relative flex h-full w-full max-w-5xl flex-col overflow-hidden rounded-lg bg-gray-900 shadow-2xl border border-gray-700",children:[T.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-gray-700 bg-gray-800 px-4 py-3",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("h3",{className:"text-lg font-bold text-white",children:"剪裁图片"}),T.jsxs("span",{className:"text-xs text-gray-400 bg-gray-700 px-2 py-0.5 rounded",children:["比例锁定 ",Math.round(n),":",Math.round(e)]})]}),T.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white transition",children:"✕"})]}),T.jsx("div",{className:"flex-1 flex items-center justify-center overflow-auto p-8 bg-[url('https://transparenttextures.com/patterns/stardust.png')]",children:T.jsx(qT,{crop:h,onChange:(_,w)=>d(w),onComplete:_=>m(_),aspect:p,className:"max-h-[70vh]",children:T.jsx("img",{ref:u,alt:"Crop me",src:a,onLoad:b,className:"max-h-[70vh] w-auto object-contain shadow-2xl",style:{userSelect:"none"}})})}),T.jsxs("div",{className:"shrink-0 flex items-center justify-end border-t border-gray-700 bg-gray-800 px-6 py-4 gap-3",children:[T.jsx("button",{onClick:r,className:"rounded-md border border-gray-600 bg-transparent px-4 py-2 text-sm font-medium text-gray-300 hover:bg-gray-700 transition",children:"取消 (Esc)"}),T.jsx("button",{onClick:S,className:"rounded-md bg-blue-600 px-6 py-2 text-sm font-bold text-white shadow-md transition hover:bg-blue-700 ring-offset-2 ring-offset-gray-800 focus:ring-2",children:"✓ 完成并填充"})]})]})}):T.jsx(T.Fragment,{})}function IT(){const n=At(h=>h.initCanvas),e=At(h=>h.disposeCanvas),a=At(h=>h.fitView),r=At(h=>h.isCropping),o=At(h=>h.canvas),u=at.useRef(null);return at.useEffect(()=>(u.current&&(n(u.current),setTimeout(()=>{a()},100)),()=>{e()}),[n,a,e]),at.useEffect(()=>{const h=()=>{a()};return window.addEventListener("resize",h),()=>{window.removeEventListener("resize",h)}},[a]),at.useEffect(()=>{(async()=>{const d=Nt.fonts.filter(m=>m.type==="custom"&&m.path);if(d.length===0)return;const g=d.map(m=>new FontFace(m.value,`url(${m.path})`).load().then(y=>(document.fonts.add(y),console.log(`Font loaded: ${m.name}`),m.value)).catch(y=>(console.error(`Failed to load font: ${m.name}`,y),null)));await Promise.all(g),o&&o.requestRenderAll()})()},[o]),T.jsxs("div",{className:"flex h-screen overflow-hidden bg-gray-100 font-sans text-gray-700",children:[T.jsx(YT,{}),T.jsx(UT,{canvasRef:u}),r&&T.jsx(KT,{})]})}const ox=document.getElementById("root");if(!ox)throw new Error("Root element not found");m_.createRoot(ox).render(T.jsx(jt.StrictMode,{children:T.jsx(IT,{})}));
|