@senyao-design-system/editor 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +17 -17
- package/dist/index.mjs +791 -785
- package/package.json +46 -47
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react"),Dr=require("@codemirror/lang-sql"),qt=require("@codemirror/lang-json"),y=require("@codemirror/view"),ye=require("@codemirror/commands"),Yt=require("@codemirror/autocomplete"),yr=require("@codemirror/lint"),ne=require("@codemirror/language"),q=require("@lezer/highlight"),R=require("@codemirror/state");function Hn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const be=Hn(k);var Mt={exports:{}},Ye={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var vr;function Bn(){if(vr)return Ye;vr=1;var e=
|
|
9
|
+
*/var vr;function Bn(){if(vr)return Ye;vr=1;var e=k,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(c,l,d){var f,g={},M=null,v=null;d!==void 0&&(M=""+d),l.key!==void 0&&(M=""+l.key),l.ref!==void 0&&(v=l.ref);for(f in l)n.call(l,f)&&!i.hasOwnProperty(f)&&(g[f]=l[f]);if(c&&c.defaultProps)for(f in l=c.defaultProps,l)g[f]===void 0&&(g[f]=l[f]);return{$$typeof:t,type:c,key:M,ref:v,props:g,_owner:o.current}}return Ye.Fragment=r,Ye.jsx=s,Ye.jsxs=s,Ye}var ze={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,38 +14,38 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var br;function Jn(){return br||(br=1,process.env.NODE_ENV!=="production"&&function(){var e=
|
|
18
|
-
`+We+a}}var je=!1,Te;{var Et=typeof WeakMap=="function"?WeakMap:Map;Te=new Et}function
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var br;function Jn(){return br||(br=1,process.env.NODE_ENV!=="production"&&function(){var e=k,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),w=Symbol.iterator,b="@@iterator";function x(a){if(a===null||typeof a!="object")return null;var u=w&&a[w]||a[b];return typeof u=="function"?u:null}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(a){{for(var u=arguments.length,p=new Array(u>1?u-1:0),P=1;P<u;P++)p[P-1]=arguments[P];_("error",a,p)}}function _(a,u,p){{var P=T.ReactDebugCurrentFrame,W=P.getStackAddendum();W!==""&&(u+="%s",p=p.concat([W]));var Y=p.map(function(N){return String(N)});Y.unshift("Warning: "+u),Function.prototype.apply.call(console[a],console,Y)}}var L=!1,h=!1,z=!1,m=!1,H=!1,B;B=Symbol.for("react.module.reference");function Q(a){return!!(typeof a=="string"||typeof a=="function"||a===n||a===i||H||a===o||a===d||a===f||m||a===v||L||h||z||typeof a=="object"&&a!==null&&(a.$$typeof===M||a.$$typeof===g||a.$$typeof===s||a.$$typeof===c||a.$$typeof===l||a.$$typeof===B||a.getModuleId!==void 0))}function we(a,u,p){var P=a.displayName;if(P)return P;var W=u.displayName||u.name||"";return W!==""?p+"("+W+")":p}function Ee(a){return a.displayName||"Context"}function oe(a){if(a==null)return null;if(typeof a.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case n:return"Fragment";case r:return"Portal";case i:return"Profiler";case o:return"StrictMode";case d:return"Suspense";case f:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case c:var u=a;return Ee(u)+".Consumer";case s:var p=a;return Ee(p._context)+".Provider";case l:return we(a,a.render,"ForwardRef");case g:var P=a.displayName||null;return P!==null?P:oe(a.type)||"Memo";case M:{var W=a,Y=W._payload,N=W._init;try{return oe(N(Y))}catch{return null}}}return null}var fe=Object.assign,pe=0,S,O,A,D,J,X,le;function me(){}me.__reactDisabledLog=!0;function bt(){{if(pe===0){S=console.log,O=console.info,A=console.warn,D=console.error,J=console.group,X=console.groupCollapsed,le=console.groupEnd;var a={configurable:!0,enumerable:!0,value:me,writable:!0};Object.defineProperties(console,{info:a,log:a,warn:a,error:a,group:a,groupCollapsed:a,groupEnd:a})}pe++}}function xt(){{if(pe--,pe===0){var a={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:fe({},a,{value:S}),info:fe({},a,{value:O}),warn:fe({},a,{value:A}),error:fe({},a,{value:D}),group:fe({},a,{value:J}),groupCollapsed:fe({},a,{value:X}),groupEnd:fe({},a,{value:le})})}pe<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ie=T.ReactCurrentDispatcher,We;function ke(a,u,p){{if(We===void 0)try{throw Error()}catch(W){var P=W.stack.trim().match(/\n( *(at )?)/);We=P&&P[1]||""}return`
|
|
18
|
+
`+We+a}}var je=!1,Te;{var Et=typeof WeakMap=="function"?WeakMap:Map;Te=new Et}function C(a,u){if(!a||je)return"";{var p=Te.get(a);if(p!==void 0)return p}var P;je=!0;var W=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Y;Y=Ie.current,Ie.current=null,bt();try{if(u){var N=function(){throw Error()};if(Object.defineProperty(N.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(N,[])}catch(ie){P=ie}Reflect.construct(a,[],N)}else{try{N.call()}catch(ie){P=ie}a.call(N.prototype)}}else{try{throw Error()}catch(ie){P=ie}a()}}catch(ie){if(ie&&P&&typeof ie.stack=="string"){for(var F=ie.stack.split(`
|
|
19
|
+
`),re=P.stack.split(`
|
|
20
|
+
`),K=F.length-1,U=re.length-1;K>=1&&U>=0&&F[K]!==re[U];)U--;for(;K>=1&&U>=0;K--,U--)if(F[K]!==re[U]){if(K!==1||U!==1)do if(K--,U--,U<0||F[K]!==re[U]){var ue=`
|
|
21
|
+
`+F[K].replace(" at new "," at ");return a.displayName&&ue.includes("<anonymous>")&&(ue=ue.replace("<anonymous>",a.displayName)),typeof a=="function"&&Te.set(a,ue),ue}while(K>=1&&U>=0);break}}}finally{je=!1,Ie.current=Y,xt(),Error.prepareStackTrace=W}var Me=a?a.displayName||a.name:"",Ce=Me?ke(Me):"";return typeof a=="function"&&Te.set(a,Ce),Ce}function Ve(a,u,p){return C(a,!1)}function _e(a){var u=a.prototype;return!!(u&&u.isReactComponent)}function Se(a,u,p){if(a==null)return"";if(typeof a=="function")return C(a,_e(a));if(typeof a=="string")return ke(a);switch(a){case d:return ke("Suspense");case f:return ke("SuspenseList")}if(typeof a=="object")switch(a.$$typeof){case l:return Ve(a.render);case g:return Se(a.type,u,p);case M:{var P=a,W=P._payload,Y=P._init;try{return Se(Y(W),u,p)}catch{}}}return""}var qe=Object.prototype.hasOwnProperty,nr={},or=T.ReactDebugCurrentFrame;function Ze(a){if(a){var u=a._owner,p=Se(a.type,a._source,u?u.type:null);or.setExtraStackFrame(p)}else or.setExtraStackFrame(null)}function Cn(a,u,p,P,W){{var Y=Function.call.bind(qe);for(var N in a)if(Y(a,N)){var F=void 0;try{if(typeof a[N]!="function"){var re=Error((P||"React class")+": "+p+" type `"+N+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[N]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw re.name="Invariant Violation",re}F=a[N](u,N,P,p,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(K){F=K}F&&!(F instanceof Error)&&(Ze(W),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",P||"React class",p,N,typeof F),Ze(null)),F instanceof Error&&!(F.message in nr)&&(nr[F.message]=!0,Ze(W),E("Failed %s type: %s",p,F.message),Ze(null))}}}var Rn=Array.isArray;function St(a){return Rn(a)}function wn(a){{var u=typeof Symbol=="function"&&Symbol.toStringTag,p=u&&a[Symbol.toStringTag]||a.constructor.name||"Object";return p}}function kn(a){try{return ir(a),!1}catch{return!0}}function ir(a){return""+a}function ar(a){if(kn(a))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",wn(a)),ir(a)}var sr=T.ReactCurrentOwner,Tn={key:!0,ref:!0,__self:!0,__source:!0},cr,lr;function _n(a){if(qe.call(a,"ref")){var u=Object.getOwnPropertyDescriptor(a,"ref").get;if(u&&u.isReactWarning)return!1}return a.ref!==void 0}function Pn(a){if(qe.call(a,"key")){var u=Object.getOwnPropertyDescriptor(a,"key").get;if(u&&u.isReactWarning)return!1}return a.key!==void 0}function Mn(a,u){typeof a.ref=="string"&&sr.current}function On(a,u){{var p=function(){cr||(cr=!0,E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",u))};p.isReactWarning=!0,Object.defineProperty(a,"key",{get:p,configurable:!0})}}function An(a,u){{var p=function(){lr||(lr=!0,E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",u))};p.isReactWarning=!0,Object.defineProperty(a,"ref",{get:p,configurable:!0})}}var Fn=function(a,u,p,P,W,Y,N){var F={$$typeof:t,type:a,key:u,ref:p,props:N,_owner:Y};return F._store={},Object.defineProperty(F._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(F,"_self",{configurable:!1,enumerable:!1,writable:!1,value:P}),Object.defineProperty(F,"_source",{configurable:!1,enumerable:!1,writable:!1,value:W}),Object.freeze&&(Object.freeze(F.props),Object.freeze(F)),F};function Nn(a,u,p,P,W){{var Y,N={},F=null,re=null;p!==void 0&&(ar(p),F=""+p),Pn(u)&&(ar(u.key),F=""+u.key),_n(u)&&(re=u.ref,Mn(u,W));for(Y in u)qe.call(u,Y)&&!Tn.hasOwnProperty(Y)&&(N[Y]=u[Y]);if(a&&a.defaultProps){var K=a.defaultProps;for(Y in K)N[Y]===void 0&&(N[Y]=K[Y])}if(F||re){var U=typeof a=="function"?a.displayName||a.name||"Unknown":a;F&&On(N,U),re&&An(N,U)}return Fn(a,F,re,W,P,sr.current,N)}}var Ct=T.ReactCurrentOwner,ur=T.ReactDebugCurrentFrame;function Pe(a){if(a){var u=a._owner,p=Se(a.type,a._source,u?u.type:null);ur.setExtraStackFrame(p)}else ur.setExtraStackFrame(null)}var Rt;Rt=!1;function wt(a){return typeof a=="object"&&a!==null&&a.$$typeof===t}function fr(){{if(Ct.current){var a=oe(Ct.current.type);if(a)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+a+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+a+"`."}return""}}function Ln(a){return""}var hr={};function Dn(a){{var u=fr();if(!u){var p=typeof a=="string"?a:a.displayName||a.name;p&&(u=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+p+">.")}return u}}function dr(a,u){{if(!a._store||a._store.validated||a.key!=null)return;a._store.validated=!0;var p=
|
|
25
|
+
Check the top-level render call using <`+p+">.")}return u}}function dr(a,u){{if(!a._store||a._store.validated||a.key!=null)return;a._store.validated=!0;var p=Dn(u);if(hr[p])return;hr[p]=!0;var P="";a&&a._owner&&a._owner!==Ct.current&&(P=" It was passed a child from "+oe(a._owner.type)+"."),Pe(a),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',p,P),Pe(null)}}function gr(a,u){{if(typeof a!="object")return;if(St(a))for(var p=0;p<a.length;p++){var P=a[p];wt(P)&&dr(P,u)}else if(wt(a))a._store&&(a._store.validated=!0);else if(a){var W=x(a);if(typeof W=="function"&&W!==a.entries)for(var Y=W.call(a),N;!(N=Y.next()).done;)wt(N.value)&&dr(N.value,u)}}}function $n(a){{var u=a.type;if(u==null||typeof u=="string")return;var p;if(typeof u=="function")p=u.propTypes;else if(typeof u=="object"&&(u.$$typeof===l||u.$$typeof===g))p=u.propTypes;else return;if(p){var P=oe(u);Cn(p,a.props,"prop",P,a)}else if(u.PropTypes!==void 0&&!Rt){Rt=!0;var W=oe(u);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",W||"Unknown")}typeof u.getDefaultProps=="function"&&!u.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function In(a){{for(var u=Object.keys(a.props),p=0;p<u.length;p++){var P=u[p];if(P!=="children"&&P!=="key"){Pe(a),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",P),Pe(null);break}}a.ref!==null&&(Pe(a),E("Invalid attribute `ref` supplied to `React.Fragment`."),Pe(null))}}var pr={};function mr(a,u,p,P,W,Y){{var N=Q(a);if(!N){var F="";(a===void 0||typeof a=="object"&&a!==null&&Object.keys(a).length===0)&&(F+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var re=Ln();re?F+=re:F+=fr();var K;a===null?K="null":St(a)?K="array":a!==void 0&&a.$$typeof===t?(K="<"+(oe(a.type)||"Unknown")+" />",F=" Did you accidentally export a JSX literal instead of a component?"):K=typeof a,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",K,F)}var U=Nn(a,u,p,W,Y);if(U==null)return U;if(N){var ue=u.children;if(ue!==void 0)if(P)if(St(ue)){for(var Me=0;Me<ue.length;Me++)gr(ue[Me],a);Object.freeze&&Object.freeze(ue)}else E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else gr(ue,a)}if(qe.call(u,"key")){var Ce=oe(a),ie=Object.keys(u).filter(function(zn){return zn!=="key"}),kt=ie.length>0?"{key: someKey, "+ie.join(": ..., ")+": ...}":"{key: someKey}";if(!pr[Ce+kt]){var Yn=ie.length>0?"{"+ie.join(": ..., ")+": ...}":"{}";E(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,kt,Se,Yn,Se),pr[Se+kt]=!0}}return a===n?In(K):$n(K),K}}function Wn(a,u,p){return mr(a,u,p,!0)}function jn(a,u,p){return mr(a,u,p,!1)}var Vn=jn,qn=Wn;ze.Fragment=n,ze.jsx=Vn,ze.jsxs=qn}()),ze}process.env.NODE_ENV==="production"?Mt.exports=Bn():Mt.exports=Jn();var xr=Mt.exports;function Kn(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function Un(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var Gn=function(){function e(r){var n=this;this._insertTag=function(o){var i;n.tags.length===0?n.insertionPoint?i=n.insertionPoint.nextSibling:n.prepend?i=n.container.firstChild:i=n.before:i=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(o,i),n.tags.push(o)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(n){n.forEach(this._insertTag)},t.insert=function(n){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(Un(this));var o=this.tags[this.tags.length-1];if(this.isSpeedy){var i=Kn(o);try{i.insertRule(n,i.cssRules.length)}catch{}}else o.appendChild(document.createTextNode(n));this.ctr++},t.flush=function(){this.tags.forEach(function(n){var o;return(o=n.parentNode)==null?void 0:o.removeChild(n)}),this.tags=[],this.ctr=0},e}(),ee="-ms-",at="-moz-",I="-webkit-",$r="comm",zt="rule",Ht="decl",Qn="@import",Ir="@keyframes",Xn="@layer",Zn=Math.abs,dt=String.fromCharCode,eo=Object.assign;function to(e,t){return Z(e,0)^45?(((t<<2^Z(e,0))<<2^Z(e,1))<<2^Z(e,2))<<2^Z(e,3):0}function Wr(e){return e.trim()}function ro(e,t){return(e=t.exec(e))?e[0]:e}function W(e,t,r){return e.replace(t,r)}function Ot(e,t){return e.indexOf(t)}function Z(e,t){return e.charCodeAt(t)|0}function Je(e,t,r){return e.slice(t,r)}function fe(e){return e.length}function Bt(e){return e.length}function et(e,t){return t.push(e),e}function no(e,t){return e.map(t).join("")}var gt=1,De=1,jr=0,ie=0,U=0,$e="";function pt(e,t,r,n,o,i,s){return{value:e,root:t,parent:r,type:n,props:o,children:i,line:gt,column:De,length:s,return:""}}function He(e,t){return eo(pt("",null,null,"",null,null,0),e,{length:-e.length},t)}function oo(){return U}function io(){return U=ie>0?Z($e,--ie):0,De--,U===10&&(De=1,gt--),U}function se(){return U=ie<jr?Z($e,ie++):0,De++,U===10&&(De=1,gt++),U}function de(){return Z($e,ie)}function nt(){return ie}function Qe(e,t){return Je($e,e,t)}function Ke(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Vr(e){return gt=De=1,jr=fe($e=e),ie=0,[]}function qr(e){return $e="",e}function ot(e){return Wr(Qe(ie-1,At(e===91?e+2:e===40?e+1:e)))}function ao(e){for(;(U=de())&&U<33;)se();return Ke(e)>2||Ke(U)>3?"":" "}function so(e,t){for(;--t&&se()&&!(U<48||U>102||U>57&&U<65||U>70&&U<97););return Qe(e,nt()+(t<6&&de()==32&&se()==32))}function At(e){for(;se();)switch(U){case e:return ie;case 34:case 39:e!==34&&e!==39&&At(U);break;case 40:e===41&&At(e);break;case 92:se();break}return ie}function co(e,t){for(;se()&&e+U!==57;)if(e+U===84&&de()===47)break;return"/*"+Qe(t,ie-1)+"*"+dt(e===47?e:se())}function lo(e){for(;!Ke(de());)se();return Qe(e,ie)}function uo(e){return qr(it("",null,null,null,[""],e=Vr(e),0,[0],e))}function it(e,t,r,n,o,i,s,c,l){for(var d=0,f=0,g=s,M=0,y=0,w=0,b=1,v=1,k=1,E=0,_="",L=o,h=i,R=n,O=_;v;)switch(w=E,E=se()){case 40:if(w!=108&&Z(O,g-1)==58){Ot(O+=W(ot(E),"&","&\f"),"&\f")!=-1&&(k=-1);break}case 34:case 39:case 91:O+=ot(E);break;case 9:case 10:case 13:case 32:O+=ao(w);break;case 92:O+=so(nt()-1,7);continue;case 47:switch(de()){case 42:case 47:et(fo(co(se(),nt()),t,r),l);break;default:O+="/"}break;case 123*b:c[d++]=fe(O)*k;case 125*b:case 59:case 0:switch(E){case 0:case 125:v=0;case 59+f:k==-1&&(O=W(O,/\f/g,"")),y>0&&fe(O)-g&&et(y>32?Sr(O+";",n,r,g-1):Sr(W(O," ","")+";",n,r,g-2),l);break;case 59:O+=";";default:if(et(R=Er(O,t,r,d,f,o,c,_,L=[],h=[],g),i),E===123)if(f===0)it(O,t,R,R,L,i,g,c,h);else switch(M===99&&Z(O,3)===110?100:M){case 100:case 108:case 109:case 115:it(e,R,R,n&&et(Er(e,R,R,0,0,o,c,_,o,L=[],g),h),o,h,g,c,n?L:h);break;default:it(O,R,R,R,[""],h,0,c,h)}}d=f=y=0,b=k=1,_=O="",g=s;break;case 58:g=1+fe(O),y=w;default:if(b<1){if(E==123)--b;else if(E==125&&b++==0&&io()==125)continue}switch(O+=dt(E),E*b){case 38:k=f>0?1:(O+="\f",-1);break;case 44:c[d++]=(fe(O)-1)*k,k=1;break;case 64:de()===45&&(O+=ot(se())),M=de(),f=g=fe(_=O+=lo(nt())),E++;break;case 45:w===45&&fe(O)==2&&(b=0)}}return i}function Er(e,t,r,n,o,i,s,c,l,d,f){for(var g=o-1,M=o===0?i:[""],y=Bt(M),w=0,b=0,v=0;w<n;++w)for(var k=0,E=Je(e,g+1,g=Zn(b=s[w])),_=e;k<y;++k)(_=Wr(b>0?M[k]+" "+E:W(E,/&\f/g,M[k])))&&(l[v++]=_);return pt(e,t,r,o===0?zt:c,l,d,f)}function fo(e,t,r){return pt(e,t,r,$r,dt(oo()),Je(e,2,-2),0)}function Sr(e,t,r,n){return pt(e,t,r,Ht,Je(e,0,n),Je(e,n+1,-1),n)}function Fe(e,t){for(var r="",n=Bt(e),o=0;o<n;o++)r+=t(e[o],o,e,t)||"";return r}function ho(e,t,r,n){switch(e.type){case Xn:if(e.children.length)break;case Qn:case Ht:return e.return=e.return||e.value;case $r:return"";case Ir:return e.return=e.value+"{"+Fe(e.children,n)+"}";case zt:e.value=e.props.join(",")}return fe(r=Fe(e.children,n))?e.return=e.value+"{"+r+"}":""}function go(e){var t=Bt(e);return function(r,n,o,i){for(var s="",c=0;c<t;c++)s+=e[c](r,n,o,i)||"";return s}}function po(e){return function(t){t.root||(t=t.return)&&e(t)}}function mo(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var yo=function(t,r,n){for(var o=0,i=0;o=i,i=de(),o===38&&i===12&&(r[n]=1),!Ke(i);)se();return Qe(t,ie)},vo=function(t,r){var n=-1,o=44;do switch(Ke(o)){case 0:o===38&&de()===12&&(r[n]=1),t[n]+=yo(ie-1,r,n);break;case 2:t[n]+=ot(o);break;case 4:if(o===44){t[++n]=de()===58?"&\f":"",r[n]=t[n].length;break}default:t[n]+=dt(o)}while(o=se());return t},bo=function(t,r){return qr(vo(Vr(t),r))},Cr=new WeakMap,xo=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var r=t.value,n=t.parent,o=t.column===n.column&&t.line===n.line;n.type!=="rule";)if(n=n.parent,!n)return;if(!(t.props.length===1&&r.charCodeAt(0)!==58&&!Cr.get(n))&&!o){Cr.set(t,!0);for(var i=[],s=bo(r,i),c=n.props,l=0,d=0;l<s.length;l++)for(var f=0;f<c.length;f++,d++)t.props[d]=i[l]?s[l].replace(/&\f/g,c[f]):c[f]+" "+s[l]}}},Eo=function(t){if(t.type==="decl"){var r=t.value;r.charCodeAt(0)===108&&r.charCodeAt(2)===98&&(t.return="",t.value="")}};function Yr(e,t){switch(to(e,t)){case 5103:return I+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return I+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return I+e+at+e+ee+e+e;case 6828:case 4268:return I+e+ee+e+e;case 6165:return I+e+ee+"flex-"+e+e;case 5187:return I+e+W(e,/(\w+).+(:[^]+)/,I+"box-$1$2"+ee+"flex-$1$2")+e;case 5443:return I+e+ee+"flex-item-"+W(e,/flex-|-self/,"")+e;case 4675:return I+e+ee+"flex-line-pack"+W(e,/align-content|flex-|-self/,"")+e;case 5548:return I+e+ee+W(e,"shrink","negative")+e;case 5292:return I+e+ee+W(e,"basis","preferred-size")+e;case 6060:return I+"box-"+W(e,"-grow","")+I+e+ee+W(e,"grow","positive")+e;case 4554:return I+W(e,/([^-])(transform)/g,"$1"+I+"$2")+e;case 6187:return W(W(W(e,/(zoom-|grab)/,I+"$1"),/(image-set)/,I+"$1"),e,"")+e;case 5495:case 3959:return W(e,/(image-set\([^]*)/,I+"$1$`$1");case 4968:return W(W(e,/(.+:)(flex-)?(.*)/,I+"box-pack:$3"+ee+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+I+e+e;case 4095:case 3583:case 4068:case 2532:return W(e,/(.+)-inline(.+)/,I+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(fe(e)-1-t>6)switch(Z(e,t+1)){case 109:if(Z(e,t+4)!==45)break;case 102:return W(e,/(.+:)(.+)-([^]+)/,"$1"+I+"$2-$3$1"+at+(Z(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Ot(e,"stretch")?Yr(W(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Z(e,t+1)!==115)break;case 6444:switch(Z(e,fe(e)-3-(~Ot(e,"!important")&&10))){case 107:return W(e,":",":"+I)+e;case 101:return W(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+I+(Z(e,14)===45?"inline-":"")+"box$3$1"+I+"$2$3$1"+ee+"$2box$3")+e}break;case 5936:switch(Z(e,t+11)){case 114:return I+e+ee+W(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return I+e+ee+W(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return I+e+ee+W(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return I+e+ee+e+e}return e}var So=function(t,r,n,o){if(t.length>-1&&!t.return)switch(t.type){case Ht:t.return=Yr(t.value,t.length);break;case Ir:return Fe([He(t,{value:W(t.value,"@","@"+I)})],o);case zt:if(t.length)return no(t.props,function(i){switch(ro(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Fe([He(t,{props:[W(i,/:(read-\w+)/,":"+at+"$1")]})],o);case"::placeholder":return Fe([He(t,{props:[W(i,/:(plac\w+)/,":"+I+"input-$1")]}),He(t,{props:[W(i,/:(plac\w+)/,":"+at+"$1")]}),He(t,{props:[W(i,/:(plac\w+)/,ee+"input-$1")]})],o)}return""})}},Co=[So],Ro=function(t){var r=t.key;if(r==="css"){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(b){var v=b.getAttribute("data-emotion");v.indexOf(" ")!==-1&&(document.head.appendChild(b),b.setAttribute("data-s",""))})}var o=t.stylisPlugins||Co,i={},s,c=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+r+' "]'),function(b){for(var v=b.getAttribute("data-emotion").split(" "),k=1;k<v.length;k++)i[v[k]]=!0;c.push(b)});var l,d=[xo,Eo];{var f,g=[ho,po(function(b){f.insert(b)})],M=go(d.concat(o,g)),y=function(v){return Fe(uo(v),M)};l=function(v,k,E,_){f=E,y(v?v+"{"+k.styles+"}":k.styles),_&&(w.inserted[k.name]=!0)}}var w={key:r,sheet:new Gn({key:r,container:s,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:i,registered:{},insert:l};return w.sheet.hydrate(c),w},Ft={exports:{}},V={};/** @license React v16.13.1
|
|
30
|
+
<%s key={someKey} {...props} />`,kt,Ce,Yn,Ce),pr[Ce+kt]=!0}}return a===n?In(U):$n(U),U}}function Wn(a,u,p){return mr(a,u,p,!0)}function jn(a,u,p){return mr(a,u,p,!1)}var Vn=jn,qn=Wn;ze.Fragment=n,ze.jsx=Vn,ze.jsxs=qn}()),ze}process.env.NODE_ENV==="production"?Mt.exports=Bn():Mt.exports=Jn();var xr=Mt.exports;function Kn(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function Un(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var Gn=function(){function e(r){var n=this;this._insertTag=function(o){var i;n.tags.length===0?n.insertionPoint?i=n.insertionPoint.nextSibling:n.prepend?i=n.container.firstChild:i=n.before:i=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(o,i),n.tags.push(o)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(n){n.forEach(this._insertTag)},t.insert=function(n){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(Un(this));var o=this.tags[this.tags.length-1];if(this.isSpeedy){var i=Kn(o);try{i.insertRule(n,i.cssRules.length)}catch{}}else o.appendChild(document.createTextNode(n));this.ctr++},t.flush=function(){this.tags.forEach(function(n){var o;return(o=n.parentNode)==null?void 0:o.removeChild(n)}),this.tags=[],this.ctr=0},e}(),te="-ms-",at="-moz-",$="-webkit-",$r="comm",zt="rule",Ht="decl",Qn="@import",Ir="@keyframes",Xn="@layer",Zn=Math.abs,dt=String.fromCharCode,eo=Object.assign;function to(e,t){return ee(e,0)^45?(((t<<2^ee(e,0))<<2^ee(e,1))<<2^ee(e,2))<<2^ee(e,3):0}function Wr(e){return e.trim()}function ro(e,t){return(e=t.exec(e))?e[0]:e}function I(e,t,r){return e.replace(t,r)}function Ot(e,t){return e.indexOf(t)}function ee(e,t){return e.charCodeAt(t)|0}function Je(e,t,r){return e.slice(t,r)}function he(e){return e.length}function Bt(e){return e.length}function et(e,t){return t.push(e),e}function no(e,t){return e.map(t).join("")}var gt=1,Le=1,jr=0,ae=0,G=0,$e="";function pt(e,t,r,n,o,i,s){return{value:e,root:t,parent:r,type:n,props:o,children:i,line:gt,column:Le,length:s,return:""}}function He(e,t){return eo(pt("",null,null,"",null,null,0),e,{length:-e.length},t)}function oo(){return G}function io(){return G=ae>0?ee($e,--ae):0,Le--,G===10&&(Le=1,gt--),G}function ce(){return G=ae<jr?ee($e,ae++):0,Le++,G===10&&(Le=1,gt++),G}function ge(){return ee($e,ae)}function nt(){return ae}function Qe(e,t){return Je($e,e,t)}function Ke(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Vr(e){return gt=Le=1,jr=he($e=e),ae=0,[]}function qr(e){return $e="",e}function ot(e){return Wr(Qe(ae-1,At(e===91?e+2:e===40?e+1:e)))}function ao(e){for(;(G=ge())&&G<33;)ce();return Ke(e)>2||Ke(G)>3?"":" "}function so(e,t){for(;--t&&ce()&&!(G<48||G>102||G>57&&G<65||G>70&&G<97););return Qe(e,nt()+(t<6&&ge()==32&&ce()==32))}function At(e){for(;ce();)switch(G){case e:return ae;case 34:case 39:e!==34&&e!==39&&At(G);break;case 40:e===41&&At(e);break;case 92:ce();break}return ae}function co(e,t){for(;ce()&&e+G!==57;)if(e+G===84&&ge()===47)break;return"/*"+Qe(t,ae-1)+"*"+dt(e===47?e:ce())}function lo(e){for(;!Ke(ge());)ce();return Qe(e,ae)}function uo(e){return qr(it("",null,null,null,[""],e=Vr(e),0,[0],e))}function it(e,t,r,n,o,i,s,c,l){for(var d=0,f=0,g=s,M=0,v=0,w=0,b=1,x=1,T=1,E=0,_="",L=o,h=i,z=n,m=_;x;)switch(w=E,E=ce()){case 40:if(w!=108&&ee(m,g-1)==58){Ot(m+=I(ot(E),"&","&\f"),"&\f")!=-1&&(T=-1);break}case 34:case 39:case 91:m+=ot(E);break;case 9:case 10:case 13:case 32:m+=ao(w);break;case 92:m+=so(nt()-1,7);continue;case 47:switch(ge()){case 42:case 47:et(fo(co(ce(),nt()),t,r),l);break;default:m+="/"}break;case 123*b:c[d++]=he(m)*T;case 125*b:case 59:case 0:switch(E){case 0:case 125:x=0;case 59+f:T==-1&&(m=I(m,/\f/g,"")),v>0&&he(m)-g&&et(v>32?Sr(m+";",n,r,g-1):Sr(I(m," ","")+";",n,r,g-2),l);break;case 59:m+=";";default:if(et(z=Er(m,t,r,d,f,o,c,_,L=[],h=[],g),i),E===123)if(f===0)it(m,t,z,z,L,i,g,c,h);else switch(M===99&&ee(m,3)===110?100:M){case 100:case 108:case 109:case 115:it(e,z,z,n&&et(Er(e,z,z,0,0,o,c,_,o,L=[],g),h),o,h,g,c,n?L:h);break;default:it(m,z,z,z,[""],h,0,c,h)}}d=f=v=0,b=T=1,_=m="",g=s;break;case 58:g=1+he(m),v=w;default:if(b<1){if(E==123)--b;else if(E==125&&b++==0&&io()==125)continue}switch(m+=dt(E),E*b){case 38:T=f>0?1:(m+="\f",-1);break;case 44:c[d++]=(he(m)-1)*T,T=1;break;case 64:ge()===45&&(m+=ot(ce())),M=ge(),f=g=he(_=m+=lo(nt())),E++;break;case 45:w===45&&he(m)==2&&(b=0)}}return i}function Er(e,t,r,n,o,i,s,c,l,d,f){for(var g=o-1,M=o===0?i:[""],v=Bt(M),w=0,b=0,x=0;w<n;++w)for(var T=0,E=Je(e,g+1,g=Zn(b=s[w])),_=e;T<v;++T)(_=Wr(b>0?M[T]+" "+E:I(E,/&\f/g,M[T])))&&(l[x++]=_);return pt(e,t,r,o===0?zt:c,l,d,f)}function fo(e,t,r){return pt(e,t,r,$r,dt(oo()),Je(e,2,-2),0)}function Sr(e,t,r,n){return pt(e,t,r,Ht,Je(e,0,n),Je(e,n+1,-1),n)}function Fe(e,t){for(var r="",n=Bt(e),o=0;o<n;o++)r+=t(e[o],o,e,t)||"";return r}function ho(e,t,r,n){switch(e.type){case Xn:if(e.children.length)break;case Qn:case Ht:return e.return=e.return||e.value;case $r:return"";case Ir:return e.return=e.value+"{"+Fe(e.children,n)+"}";case zt:e.value=e.props.join(",")}return he(r=Fe(e.children,n))?e.return=e.value+"{"+r+"}":""}function go(e){var t=Bt(e);return function(r,n,o,i){for(var s="",c=0;c<t;c++)s+=e[c](r,n,o,i)||"";return s}}function po(e){return function(t){t.root||(t=t.return)&&e(t)}}function mo(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var yo=function(t,r,n){for(var o=0,i=0;o=i,i=ge(),o===38&&i===12&&(r[n]=1),!Ke(i);)ce();return Qe(t,ae)},vo=function(t,r){var n=-1,o=44;do switch(Ke(o)){case 0:o===38&&ge()===12&&(r[n]=1),t[n]+=yo(ae-1,r,n);break;case 2:t[n]+=ot(o);break;case 4:if(o===44){t[++n]=ge()===58?"&\f":"",r[n]=t[n].length;break}default:t[n]+=dt(o)}while(o=ce());return t},bo=function(t,r){return qr(vo(Vr(t),r))},Cr=new WeakMap,xo=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var r=t.value,n=t.parent,o=t.column===n.column&&t.line===n.line;n.type!=="rule";)if(n=n.parent,!n)return;if(!(t.props.length===1&&r.charCodeAt(0)!==58&&!Cr.get(n))&&!o){Cr.set(t,!0);for(var i=[],s=bo(r,i),c=n.props,l=0,d=0;l<s.length;l++)for(var f=0;f<c.length;f++,d++)t.props[d]=i[l]?s[l].replace(/&\f/g,c[f]):c[f]+" "+s[l]}}},Eo=function(t){if(t.type==="decl"){var r=t.value;r.charCodeAt(0)===108&&r.charCodeAt(2)===98&&(t.return="",t.value="")}};function Yr(e,t){switch(to(e,t)){case 5103:return $+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return $+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return $+e+at+e+te+e+e;case 6828:case 4268:return $+e+te+e+e;case 6165:return $+e+te+"flex-"+e+e;case 5187:return $+e+I(e,/(\w+).+(:[^]+)/,$+"box-$1$2"+te+"flex-$1$2")+e;case 5443:return $+e+te+"flex-item-"+I(e,/flex-|-self/,"")+e;case 4675:return $+e+te+"flex-line-pack"+I(e,/align-content|flex-|-self/,"")+e;case 5548:return $+e+te+I(e,"shrink","negative")+e;case 5292:return $+e+te+I(e,"basis","preferred-size")+e;case 6060:return $+"box-"+I(e,"-grow","")+$+e+te+I(e,"grow","positive")+e;case 4554:return $+I(e,/([^-])(transform)/g,"$1"+$+"$2")+e;case 6187:return I(I(I(e,/(zoom-|grab)/,$+"$1"),/(image-set)/,$+"$1"),e,"")+e;case 5495:case 3959:return I(e,/(image-set\([^]*)/,$+"$1$`$1");case 4968:return I(I(e,/(.+:)(flex-)?(.*)/,$+"box-pack:$3"+te+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+$+e+e;case 4095:case 3583:case 4068:case 2532:return I(e,/(.+)-inline(.+)/,$+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(he(e)-1-t>6)switch(ee(e,t+1)){case 109:if(ee(e,t+4)!==45)break;case 102:return I(e,/(.+:)(.+)-([^]+)/,"$1"+$+"$2-$3$1"+at+(ee(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Ot(e,"stretch")?Yr(I(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(ee(e,t+1)!==115)break;case 6444:switch(ee(e,he(e)-3-(~Ot(e,"!important")&&10))){case 107:return I(e,":",":"+$)+e;case 101:return I(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+$+(ee(e,14)===45?"inline-":"")+"box$3$1"+$+"$2$3$1"+te+"$2box$3")+e}break;case 5936:switch(ee(e,t+11)){case 114:return $+e+te+I(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return $+e+te+I(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return $+e+te+I(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return $+e+te+e+e}return e}var So=function(t,r,n,o){if(t.length>-1&&!t.return)switch(t.type){case Ht:t.return=Yr(t.value,t.length);break;case Ir:return Fe([He(t,{value:I(t.value,"@","@"+$)})],o);case zt:if(t.length)return no(t.props,function(i){switch(ro(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Fe([He(t,{props:[I(i,/:(read-\w+)/,":"+at+"$1")]})],o);case"::placeholder":return Fe([He(t,{props:[I(i,/:(plac\w+)/,":"+$+"input-$1")]}),He(t,{props:[I(i,/:(plac\w+)/,":"+at+"$1")]}),He(t,{props:[I(i,/:(plac\w+)/,te+"input-$1")]})],o)}return""})}},Co=[So],Ro=function(t){var r=t.key;if(r==="css"){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(b){var x=b.getAttribute("data-emotion");x.indexOf(" ")!==-1&&(document.head.appendChild(b),b.setAttribute("data-s",""))})}var o=t.stylisPlugins||Co,i={},s,c=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+r+' "]'),function(b){for(var x=b.getAttribute("data-emotion").split(" "),T=1;T<x.length;T++)i[x[T]]=!0;c.push(b)});var l,d=[xo,Eo];{var f,g=[ho,po(function(b){f.insert(b)})],M=go(d.concat(o,g)),v=function(x){return Fe(uo(x),M)};l=function(x,T,E,_){f=E,v(x?x+"{"+T.styles+"}":T.styles),_&&(w.inserted[T.name]=!0)}}var w={key:r,sheet:new Gn({key:r,container:s,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:i,registered:{},insert:l};return w.sheet.hydrate(c),w},Ft={exports:{}},j={};/** @license React v16.13.1
|
|
31
31
|
* react-is.production.min.js
|
|
32
32
|
*
|
|
33
33
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
34
34
|
*
|
|
35
35
|
* This source code is licensed under the MIT license found in the
|
|
36
36
|
* LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/var Rr;function wo(){if(Rr)return
|
|
37
|
+
*/var Rr;function wo(){if(Rr)return j;Rr=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,g=e?Symbol.for("react.suspense"):60113,M=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,w=e?Symbol.for("react.lazy"):60116,b=e?Symbol.for("react.block"):60121,x=e?Symbol.for("react.fundamental"):60117,T=e?Symbol.for("react.responder"):60118,E=e?Symbol.for("react.scope"):60119;function _(h){if(typeof h=="object"&&h!==null){var z=h.$$typeof;switch(z){case t:switch(h=h.type,h){case l:case d:case n:case i:case o:case g:return h;default:switch(h=h&&h.$$typeof,h){case c:case f:case w:case v:case s:return h;default:return z}}case r:return z}}}function L(h){return _(h)===d}return j.AsyncMode=l,j.ConcurrentMode=d,j.ContextConsumer=c,j.ContextProvider=s,j.Element=t,j.ForwardRef=f,j.Fragment=n,j.Lazy=w,j.Memo=v,j.Portal=r,j.Profiler=i,j.StrictMode=o,j.Suspense=g,j.isAsyncMode=function(h){return L(h)||_(h)===l},j.isConcurrentMode=L,j.isContextConsumer=function(h){return _(h)===c},j.isContextProvider=function(h){return _(h)===s},j.isElement=function(h){return typeof h=="object"&&h!==null&&h.$$typeof===t},j.isForwardRef=function(h){return _(h)===f},j.isFragment=function(h){return _(h)===n},j.isLazy=function(h){return _(h)===w},j.isMemo=function(h){return _(h)===v},j.isPortal=function(h){return _(h)===r},j.isProfiler=function(h){return _(h)===i},j.isStrictMode=function(h){return _(h)===o},j.isSuspense=function(h){return _(h)===g},j.isValidElementType=function(h){return typeof h=="string"||typeof h=="function"||h===n||h===d||h===i||h===o||h===g||h===M||typeof h=="object"&&h!==null&&(h.$$typeof===w||h.$$typeof===v||h.$$typeof===s||h.$$typeof===c||h.$$typeof===f||h.$$typeof===x||h.$$typeof===T||h.$$typeof===E||h.$$typeof===b)},j.typeOf=_,j}var V={};/** @license React v16.13.1
|
|
38
38
|
* react-is.development.js
|
|
39
39
|
*
|
|
40
40
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
41
41
|
*
|
|
42
42
|
* This source code is licensed under the MIT license found in the
|
|
43
43
|
* LICENSE file in the root directory of this source tree.
|
|
44
|
-
*/var wr;function ko(){return wr||(wr=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,g=e?Symbol.for("react.suspense"):60113,M=e?Symbol.for("react.suspense_list"):60120,y=e?Symbol.for("react.memo"):60115,w=e?Symbol.for("react.lazy"):60116,b=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,k=e?Symbol.for("react.responder"):60118,E=e?Symbol.for("react.scope"):60119;function _(S){return typeof S=="string"||typeof S=="function"||S===n||S===d||S===i||S===o||S===g||S===M||typeof S=="object"&&S!==null&&(S.$$typeof===w||S.$$typeof===y||S.$$typeof===s||S.$$typeof===c||S.$$typeof===f||S.$$typeof===v||S.$$typeof===k||S.$$typeof===E||S.$$typeof===b)}function L(S){if(typeof S=="object"&&S!==null){var Ve=S.$$typeof;switch(Ve){case t:var _e=S.type;switch(_e){case l:case d:case n:case i:case o:case g:return _e;default:var Ee=_e&&_e.$$typeof;switch(Ee){case c:case f:case w:case y:case s:return Ee;default:return Ve}}case r:return Ve}}}var h=l,R=d,O=c,Q=s,J=t,Re=f,we=n,xe=w,ne=y,ue=r,ge=i,x=o,A=g,F=!1;function $(S){return F||(F=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),H(S)||L(S)===l}function H(S){return L(S)===d}function G(S){return L(S)===c}function ce(S){return L(S)===s}function pe(S){return typeof S=="object"&&S!==null&&S.$$typeof===t}function bt(S){return L(S)===f}function xt(S){return L(S)===n}function Ie(S){return L(S)===w}function We(S){return L(S)===y}function ke(S){return L(S)===r}function je(S){return L(S)===i}function Te(S){return L(S)===o}function Et(S){return L(S)===g}q.AsyncMode=h,q.ConcurrentMode=R,q.ContextConsumer=O,q.ContextProvider=Q,q.Element=J,q.ForwardRef=Re,q.Fragment=we,q.Lazy=xe,q.Memo=ne,q.Portal=ue,q.Profiler=ge,q.StrictMode=x,q.Suspense=A,q.isAsyncMode=$,q.isConcurrentMode=H,q.isContextConsumer=G,q.isContextProvider=ce,q.isElement=pe,q.isForwardRef=bt,q.isFragment=xt,q.isLazy=Ie,q.isMemo=We,q.isPortal=ke,q.isProfiler=je,q.isStrictMode=Te,q.isSuspense=Et,q.isValidElementType=_,q.typeOf=L}()),q}process.env.NODE_ENV==="production"?Ft.exports=wo():Ft.exports=ko();var To=Ft.exports,zr=To,_o={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Po={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Hr={};Hr[zr.ForwardRef]=_o;Hr[zr.Memo]=Po;var Mo=!0;function Oo(e,t,r){var n="";return r.split(" ").forEach(function(o){e[o]!==void 0?t.push(e[o]+";"):o&&(n+=o+" ")}),n}var Br=function(t,r,n){var o=t.key+"-"+r.name;(n===!1||Mo===!1)&&t.registered[o]===void 0&&(t.registered[o]=r.styles)},Ao=function(t,r,n){Br(t,r,n);var o=t.key+"-"+r.name;if(t.inserted[r.name]===void 0){var i=r;do t.insert(r===i?"."+o:"",i,t.sheet,!0),i=i.next;while(i!==void 0)}};function Fo(e){for(var t=0,r,n=0,o=e.length;o>=4;++n,o-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var No={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Do=/[A-Z]|^ms/g,Lo=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Jr=function(t){return t.charCodeAt(1)===45},kr=function(t){return t!=null&&typeof t!="boolean"},Tt=mo(function(e){return Jr(e)?e:e.replace(Do,"-$&").toLowerCase()}),Tr=function(t,r){switch(t){case"animation":case"animationName":if(typeof r=="string")return r.replace(Lo,function(n,o,i){return he={name:o,styles:i,next:he},o})}return No[t]!==1&&!Jr(t)&&typeof r=="number"&&r!==0?r+"px":r};function Ue(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var o=r;if(o.anim===1)return he={name:o.name,styles:o.styles,next:he},o.name;var i=r;if(i.styles!==void 0){var s=i.next;if(s!==void 0)for(;s!==void 0;)he={name:s.name,styles:s.styles,next:he},s=s.next;var c=i.styles+";";return c}return $o(e,t,r)}case"function":{if(e!==void 0){var l=he,d=r(e);return he=l,Ue(e,t,d)}break}}var f=r;return f}function $o(e,t,r){var n="";if(Array.isArray(r))for(var o=0;o<r.length;o++)n+=Ue(e,t,r[o])+";";else for(var i in r){var s=r[i];if(typeof s!="object"){var c=s;kr(c)&&(n+=Tt(i)+":"+Tr(i,c)+";")}else if(Array.isArray(s)&&typeof s[0]=="string"&&t==null)for(var l=0;l<s.length;l++)kr(s[l])&&(n+=Tt(i)+":"+Tr(i,s[l])+";");else{var d=Ue(e,t,s);switch(i){case"animation":case"animationName":{n+=Tt(i)+":"+d+";";break}default:n+=i+"{"+d+"}"}}}return n}var _r=/label:\s*([^\s;{]+)\s*(;|$)/g,he;function Io(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,o="";he=void 0;var i=e[0];if(i==null||i.raw===void 0)n=!1,o+=Ue(r,t,i);else{var s=i;o+=s[0]}for(var c=1;c<e.length;c++)if(o+=Ue(r,t,e[c]),n){var l=i;o+=l[c]}_r.lastIndex=0;for(var d="",f;(f=_r.exec(o))!==null;)d+="-"+f[1];var g=Fo(o)+d;return{name:g,styles:o,next:he}}var Wo=function(t){return t()},jo=ve.useInsertionEffect?ve.useInsertionEffect:!1,Vo=jo||Wo,Kr=ve.createContext(typeof HTMLElement<"u"?Ro({key:"css"}):null);Kr.Provider;var qo=function(t){return T.forwardRef(function(r,n){var o=T.useContext(Kr);return t(r,o,n)})},Yo=ve.createContext({}),Jt={}.hasOwnProperty,Nt="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",zo=function(t,r){var n={};for(var o in r)Jt.call(r,o)&&(n[o]=r[o]);return n[Nt]=t,n},Ho=function(t){var r=t.cache,n=t.serialized,o=t.isStringTag;return Br(r,n,o),Vo(function(){return Ao(r,n,o)}),null},Bo=qo(function(e,t,r){var n=e.css;typeof n=="string"&&t.registered[n]!==void 0&&(n=t.registered[n]);var o=e[Nt],i=[n],s="";typeof e.className=="string"?s=Oo(t.registered,i,e.className):e.className!=null&&(s=e.className+" ");var c=Io(i,void 0,ve.useContext(Yo));s+=t.key+"-"+c.name;var l={};for(var d in e)Jt.call(e,d)&&d!=="css"&&d!==Nt&&(l[d]=e[d]);return l.className=s,r&&(l.ref=r),ve.createElement(ve.Fragment,null,ve.createElement(Ho,{cache:t,serialized:c,isStringTag:typeof o=="string"}),ve.createElement(o,l))}),Jo=Bo,mt=function(t,r,n){return Jt.call(r,"css")?xr.jsx(Jo,zo(t,r),n):xr.jsx(t,r,n)};function Ur(e){switch(e.toLowerCase()){case"sql":return Lr.sql();case"json":return qt.json();default:return[]}}function Gr(e){return["sql","json"].includes(e.toLowerCase())}function Qr(e={}){return Yt.autocompletion(e)}function Ko(e){return[yr.lintGutter(),yr.linter(e)]}function Xr(){return m.keymap.of([me.indentWithTab])}const Uo=[Xr(),Qr()],Go=re.HighlightStyle.define([{tag:Y.tags.keyword,color:"#1a1aa6",fontWeight:"bold"},{tag:Y.tags.comment,color:"#008000",fontStyle:"italic"},{tag:Y.tags.string,color:"#a31515"},{tag:Y.tags.number,color:"#098658"},{tag:Y.tags.operator,color:"#777777"},{tag:Y.tags.propertyName,color:"#0451a5"},{tag:Y.tags.variableName,color:"#001080"},{tag:Y.tags.definition(Y.tags.variableName),color:"#1a1aa6"},{tag:Y.tags.typeName,color:"#267f99"},{tag:Y.tags.className,color:"#267f99"},{tag:Y.tags.meta,color:"#5c5c5c"},{tag:Y.tags.regexp,color:"#811f3f"},{tag:Y.tags.link,color:"#0563c1",textDecoration:"underline"}]),Dt=[m.EditorView.theme({"&":{backgroundColor:"#ffffff",color:"#333333",fontSize:"14px",height:"100%"},".cm-scroller":{fontFamily:'"Menlo", "Monaco", "Courier New", monospace',overflow:"auto"},".cm-content":{padding:"8px 0",caretColor:"#333",textAlign:"left"},".cm-gutters":{backgroundColor:"#f8f9fa",color:"#6e7781",borderRight:"1px solid #ddd"},".cm-lineNumbers":{minWidth:"40px"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 4px",textAlign:"right",fontSize:"12px"},".cm-activeLine":{backgroundColor:"rgba(0, 0, 0, 0.04)"},".cm-activeLineGutter":{backgroundColor:"rgba(0, 0, 0, 0.04)"},".cm-selectionMatch":{backgroundColor:"rgba(181, 213, 255, 0.3)"},"&.cm-focused .cm-cursor":{borderLeftColor:"#333333"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"rgba(181, 213, 255, 0.5)"}}),re.syntaxHighlighting(Go)],Qo=re.HighlightStyle.define([{tag:Y.tags.keyword,color:"#569cd6",fontWeight:"bold"},{tag:Y.tags.comment,color:"#6A9955",fontStyle:"italic"},{tag:Y.tags.string,color:"#ce9178"},{tag:Y.tags.number,color:"#b5cea8"},{tag:Y.tags.operator,color:"#d4d4d4"},{tag:Y.tags.propertyName,color:"#9cdcfe"},{tag:Y.tags.variableName,color:"#9cdcfe"},{tag:Y.tags.definition(Y.tags.variableName),color:"#4fc1ff"},{tag:Y.tags.typeName,color:"#4ec9b0"},{tag:Y.tags.className,color:"#4ec9b0"},{tag:Y.tags.meta,color:"#d4d4d4"},{tag:Y.tags.regexp,color:"#d16969"},{tag:Y.tags.link,color:"#4e94ce",textDecoration:"underline"}]),Zr=[m.EditorView.theme({"&":{backgroundColor:"#1e1e1e",color:"#d4d4d4",fontSize:"14px",height:"100%"},".cm-scroller":{fontFamily:'"Menlo", "Monaco", "Courier New", monospace',overflow:"auto"},".cm-content":{padding:"8px 0",caretColor:"#d4d4d4",textAlign:"left"},".cm-gutters":{backgroundColor:"#252526",color:"#858585",borderRight:"1px solid #404040"},".cm-lineNumbers":{minWidth:"40px"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 4px",textAlign:"right",fontSize:"12px"},".cm-activeLine":{backgroundColor:"rgba(255, 255, 255, 0.07)"},".cm-activeLineGutter":{backgroundColor:"rgba(255, 255, 255, 0.07)"},".cm-selectionMatch":{backgroundColor:"rgba(255, 255, 255, 0.1)"},"&.cm-focused .cm-cursor":{borderLeftColor:"#d4d4d4"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}),re.syntaxHighlighting(Qo)];function en(e){switch(e){case"light":return Dt;case"dark":return Zr;default:return Dt}}const Lt=e=>{const t={value:"",readOnlyRanges:[]};let r=0;return e.forEach(n=>{const{content:o,editable:i}=n,s=o.replace(/\r\n/g,`
|
|
45
|
-
`),c=r,l=c+s.length;t.value+=o,i||t.readOnlyRanges.push({start:c,end:l}),r=l}),t},Xo='{"name":"Alice","age":25,"profile":{"city":"NY"}}';function Zo(e,t){const r=[],n=
|
|
46
|
-
`},selection:{anchor:o+1}}),!0)}}]),
|
|
47
|
-
`&&o===i)){for(const f of t)if(o===i){if(o>f.start&&o<f.end){n=!0;break}}else if(o<f.end&&i>f.start||o===f.start&&i>o||i===f.end&&o<i){n=!0;break}}}),n?[]:r}),m.EditorView.updateListener.of(r=>{if(r.docChanged){const n=ti(t,r);!ei(t,n)?(t=n,Kt.set(r.view,n),r.view.dispatch({effects:st.of(n)})):r.view.dispatch({effects:st.of(n)})}}),m.EditorView.updateListener.of(r=>{r.docChanged&&setTimeout(()=>{r.view.state.field(Pr,!1)&&r.view.dispatch({})},10)})]}function ei(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r].start!==t[r].start||e[r].end!==t[r].end)return!1;return!0}function ti(e,t){var o;if(!t.docChanged)return e;let r=!1;const n=e.map(i=>{const s={...i};return t.changes.iterChanges((c,l,d,f)=>{const g=f-d,M=l-c,y=g-M;if(c===0&&(r=!0),c===0&&g>0&&i.start===0){s.start=g,s.end+=y;return}if(l<=i.start)s.start+=y,s.end+=y;else if(c>=i.start&&c<i.end&&l>=i.end)s.end=c;else if(!(c>=i.start&&l<=i.end)){if(c<i.end&&l>i.end){const w=i.end-c;s.end=c+Math.min(w,g)}}}),s});if(r&&n.length>0){const i=((o=t.changes.newDoc)==null?void 0:o.toString())||"";let s=0;for(let c=0;c<i.length&&/\s/.test(i[c]);c++)s++;n[0].start===0&&s>0&&(n[0].start=s)}return n.filter(i=>i.start<i.end)}function nn(e){return Kt.get(e)||[]}function ye(e,t){const r=t.map(n=>({...n}));Kt.set(e,r),e.dispatch({effects:st.of(r)}),setTimeout(()=>{e.dom&&document.contains(e.dom)&&e.dispatch({})},10)}function X(){var e=arguments[0];typeof e=="string"&&(e=document.createElement(e));var t=1,r=arguments[1];if(r&&typeof r=="object"&&r.nodeType==null&&!Array.isArray(r)){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){var o=r[n];typeof o=="string"?e.setAttribute(n,o):o!=null&&(e[n]=o)}t++}for(;t<arguments.length;t++)on(e,arguments[t]);return e}function on(e,t){if(typeof t=="string")e.appendChild(document.createTextNode(t));else if(t!=null)if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var r=0;r<t.length;r++)on(e,t[r]);else throw new RangeError("Unsupported child node: "+t)}const Mr=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class Le{constructor(t,r,n=0,o=t.length,i,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(n,o),this.bufferStart=n,this.normalize=i?c=>i(Mr(c)):Mr,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return C.codePointAt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let r=C.fromCodePoint(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=C.codePointSize(t);let o=this.normalize(r);if(o.length)for(let i=0,s=n;;i++){let c=o.charCodeAt(i),l=this.match(c,s,this.bufferPos+this.bufferStart);if(i==o.length-1){if(l)return this.value=l,this;break}s==n&&i<r.length&&r.charCodeAt(i)==c&&s++}}}match(t,r,n){let o=null;for(let i=0;i<this.matches.length;i+=2){let s=this.matches[i],c=!1;this.query.charCodeAt(s)==t&&(s==this.query.length-1?o={from:this.matches[i+1],to:n}:(this.matches[i]++,c=!0)),c||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?o={from:r,to:n}:this.matches.push(1,r)),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(Le.prototype[Symbol.iterator]=function(){return this});const an={from:-1,to:-1,match:/.*/.exec("")},Ut="gm"+(/x/.unicode==null?"":"u");class sn{constructor(t,r,n,o=0,i=t.length){if(this.text=t,this.to=i,this.curLine="",this.done=!1,this.value=an,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new cn(t,r,n,o,i);this.re=new RegExp(r,Ut+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.iter=t.iter();let s=t.lineAt(o);this.curLineStart=s.from,this.matchPos=ct(t,o),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,o=n+r[0].length;if(this.matchPos=ct(this.text,o+(n==o?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<o||n>this.value.to)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,match:r},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const _t=new WeakMap;class Ne{constructor(t,r){this.from=t,this.text=r}get to(){return this.from+this.text.length}static get(t,r,n){let o=_t.get(t);if(!o||o.from>=n||o.to<=r){let c=new Ne(r,t.sliceString(r,n));return _t.set(t,c),c}if(o.from==r&&o.to==n)return o;let{text:i,from:s}=o;return s>r&&(i=t.sliceString(r,s)+i,s=r),o.to<n&&(i+=t.sliceString(o.to,n)),_t.set(t,new Ne(s,i)),new Ne(r,i.slice(r-s,n-s))}}class cn{constructor(t,r,n,o,i){this.text=t,this.to=i,this.done=!1,this.value=an,this.matchPos=ct(t,o),this.re=new RegExp(r,Ut+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=Ne.get(t,o,this.chunkEnd(o+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==t&&(this.re.lastIndex=t+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,o=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,match:r},this.matchPos=ct(this.text,o+(n==o?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ne.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(sn.prototype[Symbol.iterator]=cn.prototype[Symbol.iterator]=function(){return this});function ri(e){try{return new RegExp(e,Ut),!0}catch{return!1}}function ct(e,t){if(t>=e.length)return t;let r=e.lineAt(t),n;for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}function $t(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),r=X("input",{class:"cm-textfield",name:"line",value:t}),n=X("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),e.dispatch({effects:Be.of(!1)}),e.focus()):i.keyCode==13&&(i.preventDefault(),o())},onsubmit:i=>{i.preventDefault(),o()}},X("label",e.state.phrase("Go to line"),": ",r)," ",X("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),X("button",{name:"close",onclick:()=>{e.dispatch({effects:Be.of(!1)}),e.focus()},"aria-label":e.state.phrase("close"),type:"button"},["×"]));function o(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.value);if(!i)return;let{state:s}=e,c=s.doc.lineAt(s.selection.main.head),[,l,d,f,g]=i,M=f?+f.slice(1):0,y=d?+d:c.number;if(d&&g){let v=y/100;l&&(v=v*(l=="-"?-1:1)+c.number/s.doc.lines),y=Math.round(s.doc.lines*v)}else d&&l&&(y=y*(l=="-"?-1:1)+c.number);let w=s.doc.line(Math.max(1,Math.min(s.doc.lines,y))),b=C.EditorSelection.cursor(w.from+Math.max(0,Math.min(M,w.length)));e.dispatch({effects:[Be.of(!1),m.EditorView.scrollIntoView(b.from,{y:"center"})],selection:b}),e.focus()}return{dom:n}}const Be=C.StateEffect.define(),Or=C.StateField.define({create(){return!0},update(e,t){for(let r of t.effects)r.is(Be)&&(e=r.value);return e},provide:e=>m.showPanel.from(e,t=>t?$t:null)}),ni=e=>{let t=m.getPanel(e,$t);if(!t){let r=[Be.of(!0)];e.state.field(Or,!1)==null&&r.push(C.StateEffect.appendConfig.of([Or,oi])),e.dispatch({effects:r}),t=m.getPanel(e,$t)}return t&&t.dom.querySelector("input").select(),!0},oi=m.EditorView.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),ii={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ln=C.Facet.define({combine(e){return C.combineConfig(e,ii,{highlightWordAroundCursor:(t,r)=>t||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function yt(e){let t=[ui,li];return e&&t.push(ln.of(e)),t}const ai=m.Decoration.mark({class:"cm-selectionMatch"}),si=m.Decoration.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ar(e,t,r,n){return(r==0||e(t.sliceDoc(r-1,r))!=C.CharCategory.Word)&&(n==t.doc.length||e(t.sliceDoc(n,n+1))!=C.CharCategory.Word)}function ci(e,t,r,n){return e(t.sliceDoc(r,r+1))==C.CharCategory.Word&&e(t.sliceDoc(n-1,n))==C.CharCategory.Word}const li=m.ViewPlugin.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(ln),{state:r}=e,n=r.selection;if(n.ranges.length>1)return m.Decoration.none;let o=n.main,i,s=null;if(o.empty){if(!t.highlightWordAroundCursor)return m.Decoration.none;let l=r.wordAt(o.head);if(!l)return m.Decoration.none;s=r.charCategorizer(o.head),i=r.sliceDoc(l.from,l.to)}else{let l=o.to-o.from;if(l<t.minSelectionLength||l>200)return m.Decoration.none;if(t.wholeWords){if(i=r.sliceDoc(o.from,o.to),s=r.charCategorizer(o.head),!(Ar(s,r,o.from,o.to)&&ci(s,r,o.from,o.to)))return m.Decoration.none}else if(i=r.sliceDoc(o.from,o.to),!i)return m.Decoration.none}let c=[];for(let l of e.visibleRanges){let d=new Le(r.doc,i,l.from,l.to);for(;!d.next().done;){let{from:f,to:g}=d.value;if((!s||Ar(s,r,f,g))&&(o.empty&&f<=o.from&&g>=o.to?c.push(si.range(f,g)):(f>=o.to||g<=o.from)&&c.push(ai.range(f,g)),c.length>t.maxMatches))return m.Decoration.none}}return m.Decoration.set(c)}},{decorations:e=>e.decorations}),ui=m.EditorView.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),fi=({state:e,dispatch:t})=>{let{selection:r}=e,n=C.EditorSelection.create(r.ranges.map(o=>e.wordAt(o.head)||C.EditorSelection.cursor(o.head)),r.mainIndex);return n.eq(r)?!1:(t(e.update({selection:n})),!0)};function hi(e,t){let{main:r,ranges:n}=e.selection,o=e.wordAt(r.head),i=o&&o.from==r.from&&o.to==r.to;for(let s=!1,c=new Le(e.doc,t,n[n.length-1].to);;)if(c.next(),c.done){if(s)return null;c=new Le(e.doc,t,0,Math.max(0,n[n.length-1].from-1)),s=!0}else{if(s&&n.some(l=>l.from==c.value.from))continue;if(i){let l=e.wordAt(c.value.from);if(!l||l.from!=c.value.from||l.to!=c.value.to)continue}return c.value}}const di=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(i=>i.from===i.to))return fi({state:e,dispatch:t});let n=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(i=>e.sliceDoc(i.from,i.to)!=n))return!1;let o=hi(e,n);return o?(t(e.update({selection:e.selection.addRange(C.EditorSelection.range(o.from,o.to),!1),effects:m.EditorView.scrollIntoView(o.to)})),!0):!1},Ce=C.Facet.define({combine(e){return C.combineConfig(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new Ri(t),scrollToMatch:t=>m.EditorView.scrollIntoView(t)})}});function Gt(e){return e?[Ce.of(e),Wt]:Wt}class un{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||ri(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
|
|
48
|
-
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new yi(this):new pi(this)}getCursor(t,r=0,n){let o=t.doc?t:C.EditorState.create({doc:t});return n==null&&(n=o.doc.length),this.regexp?Ae(this,o,r,n):Oe(this,o,r,n)}}class fn{constructor(t){this.spec=t}}function Oe(e,t,r,n){return new Le(t.doc,e.unquoted,r,n,e.caseSensitive?void 0:o=>o.toLowerCase(),e.wholeWord?gi(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function gi(e,t){return(r,n,o,i)=>((i>r||i+o.length<n)&&(i=Math.max(0,r-2),o=e.sliceString(i,Math.min(e.length,n+2))),(t(lt(o,r-i))!=C.CharCategory.Word||t(ut(o,r-i))!=C.CharCategory.Word)&&(t(ut(o,n-i))!=C.CharCategory.Word||t(lt(o,n-i))!=C.CharCategory.Word))}class pi extends fn{constructor(t){super(t)}nextMatch(t,r,n){let o=Oe(this.spec,t,n,t.doc.length).nextOverlapping();if(o.done){let i=Math.min(t.doc.length,r+this.spec.unquoted.length);o=Oe(this.spec,t,0,i).nextOverlapping()}return o.done||o.value.from==r&&o.value.to==n?null:o.value}prevMatchInRange(t,r,n){for(let o=n;;){let i=Math.max(r,o-1e4-this.spec.unquoted.length),s=Oe(this.spec,t,i,o),c=null;for(;!s.nextOverlapping().done;)c=s.value;if(c)return c;if(i==r)return null;o-=1e4}}prevMatch(t,r,n){let o=this.prevMatchInRange(t,0,r);return o||(o=this.prevMatchInRange(t,Math.max(0,n-this.spec.unquoted.length),t.doc.length)),o&&(o.from!=r||o.to!=n)?o:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,r){let n=Oe(this.spec,t,0,t.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(t,r,n,o){let i=Oe(this.spec,t,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,t.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}}function Ae(e,t,r,n){return new sn(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?mi(t.charCategorizer(t.selection.main.head)):void 0},r,n)}function lt(e,t){return e.slice(C.findClusterBreak(e,t,!1),t)}function ut(e,t){return e.slice(t,C.findClusterBreak(e,t))}function mi(e){return(t,r,n)=>!n[0].length||(e(lt(n.input,n.index))!=C.CharCategory.Word||e(ut(n.input,n.index))!=C.CharCategory.Word)&&(e(ut(n.input,n.index+n[0].length))!=C.CharCategory.Word||e(lt(n.input,n.index+n[0].length))!=C.CharCategory.Word)}class yi extends fn{nextMatch(t,r,n){let o=Ae(this.spec,t,n,t.doc.length).next();return o.done&&(o=Ae(this.spec,t,0,r).next()),o.done?null:o.value}prevMatchInRange(t,r,n){for(let o=1;;o++){let i=Math.max(r,n-o*1e4),s=Ae(this.spec,t,i,n),c=null;for(;!s.next().done;)c=s.value;if(c&&(i==r||c.from>i+10))return c;if(i==r)return null}}prevMatch(t,r,n){return this.prevMatchInRange(t,0,r)||this.prevMatchInRange(t,n,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return t.match[0];if(n=="$")return"$";for(let o=n.length;o>0;o--){let i=+n.slice(0,o);if(i>0&&i<t.match.length)return t.match[i]+n.slice(o)}return r})}matchAll(t,r){let n=Ae(this.spec,t,0,t.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(t,r,n,o){let i=Ae(this.spec,t,Math.max(0,r-250),Math.min(n+250,t.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}}const Ge=C.StateEffect.define(),Qt=C.StateEffect.define(),be=C.StateField.define({create(e){return new Pt(It(e).create(),null)},update(e,t){for(let r of t.effects)r.is(Ge)?e=new Pt(r.value.create(),e.panel):r.is(Qt)&&(e=new Pt(e.query,r.value?Xt:null));return e},provide:e=>m.showPanel.from(e,t=>t.panel)});class Pt{constructor(t,r){this.query=t,this.panel=r}}const vi=m.Decoration.mark({class:"cm-searchMatch"}),bi=m.Decoration.mark({class:"cm-searchMatch cm-searchMatch-selected"}),xi=m.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(be))}update(e){let t=e.state.field(be);(t!=e.startState.field(be)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return m.Decoration.none;let{view:r}=this,n=new C.RangeSetBuilder;for(let o=0,i=r.visibleRanges,s=i.length;o<s;o++){let{from:c,to:l}=i[o];for(;o<s-1&&l>i[o+1].from-2*250;)l=i[++o].to;e.highlight(r.state,c,l,(d,f)=>{let g=r.state.selection.ranges.some(M=>M.from==d&&M.to==f);n.add(d,f,g?bi:vi)})}return n.finish()}},{decorations:e=>e.decorations});function Xe(e){return t=>{let r=t.state.field(be,!1);return r&&r.query.spec.valid?e(t,r):Zt(t)}}const ft=Xe((e,{query:t})=>{let{to:r}=e.state.selection.main,n=t.nextMatch(e.state,r,r);if(!n)return!1;let o=C.EditorSelection.single(n.from,n.to),i=e.state.facet(Ce);return e.dispatch({selection:o,effects:[rr(e,n),i.scrollToMatch(o.main,e)],userEvent:"select.search"}),dn(e),!0}),ht=Xe((e,{query:t})=>{let{state:r}=e,{from:n}=r.selection.main,o=t.prevMatch(r,n,n);if(!o)return!1;let i=C.EditorSelection.single(o.from,o.to),s=e.state.facet(Ce);return e.dispatch({selection:i,effects:[rr(e,o),s.scrollToMatch(i.main,e)],userEvent:"select.search"}),dn(e),!0}),Ei=Xe((e,{query:t})=>{let r=t.matchAll(e.state,1e3);return!r||!r.length?!1:(e.dispatch({selection:C.EditorSelection.create(r.map(n=>C.EditorSelection.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),Si=({state:e,dispatch:t})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:o}=r.main,i=[],s=0;for(let c=new Le(e.doc,e.sliceDoc(n,o));!c.next().done;){if(i.length>1e3)return!1;c.value.from==n&&(s=i.length),i.push(C.EditorSelection.range(c.value.from,c.value.to))}return t(e.update({selection:C.EditorSelection.create(i,s),userEvent:"select.search.matches"})),!0},Fr=Xe((e,{query:t})=>{let{state:r}=e,{from:n,to:o}=r.selection.main;if(r.readOnly)return!1;let i=t.nextMatch(r,n,n);if(!i)return!1;let s=i,c=[],l,d,f=[];s.from==n&&s.to==o&&(d=r.toText(t.getReplacement(s)),c.push({from:s.from,to:s.to,insert:d}),s=t.nextMatch(r,s.from,s.to),f.push(m.EditorView.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+".")));let g=e.state.changes(c);return s&&(l=C.EditorSelection.single(s.from,s.to).map(g),f.push(rr(e,s)),f.push(r.facet(Ce).scrollToMatch(l.main,e))),e.dispatch({changes:g,selection:l,effects:f,userEvent:"input.replace"}),!0}),Ci=Xe((e,{query:t})=>{if(e.state.readOnly)return!1;let r=t.matchAll(e.state,1e9).map(o=>{let{from:i,to:s}=o;return{from:i,to:s,insert:t.getReplacement(o)}});if(!r.length)return!1;let n=e.state.phrase("replaced $ matches",r.length)+".";return e.dispatch({changes:r,effects:m.EditorView.announce.of(n),userEvent:"input.replace.all"}),!0});function Xt(e){return e.state.facet(Ce).createPanel(e)}function It(e,t){var r,n,o,i,s;let c=e.selection.main,l=c.empty||c.to>c.from+100?"":e.sliceDoc(c.from,c.to);if(t&&!l)return t;let d=e.facet(Ce);return new un({search:((r=t==null?void 0:t.literal)!==null&&r!==void 0?r:d.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=t==null?void 0:t.caseSensitive)!==null&&n!==void 0?n:d.caseSensitive,literal:(o=t==null?void 0:t.literal)!==null&&o!==void 0?o:d.literal,regexp:(i=t==null?void 0:t.regexp)!==null&&i!==void 0?i:d.regexp,wholeWord:(s=t==null?void 0:t.wholeWord)!==null&&s!==void 0?s:d.wholeWord})}function hn(e){let t=m.getPanel(e,Xt);return t&&t.dom.querySelector("[main-field]")}function dn(e){let t=hn(e);t&&t==e.root.activeElement&&t.select()}const Zt=e=>{let t=e.state.field(be,!1);if(t&&t.panel){let r=hn(e);if(r&&r!=e.root.activeElement){let n=It(e.state,t.query.spec);n.valid&&e.dispatch({effects:Ge.of(n)}),r.focus(),r.select()}}else e.dispatch({effects:[Qt.of(!0),t?Ge.of(It(e.state,t.query.spec)):C.StateEffect.appendConfig.of(Wt)]});return!0},er=e=>{let t=e.state.field(be,!1);if(!t||!t.panel)return!1;let r=m.getPanel(e,Xt);return r&&r.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Qt.of(!1)}),!0},tr=[{key:"Mod-f",run:Zt,scope:"editor search-panel"},{key:"F3",run:ft,shift:ht,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ft,shift:ht,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:er,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Si},{key:"Mod-Alt-g",run:ni},{key:"Mod-d",run:di,preventDefault:!0}];class Ri{constructor(t){this.view=t;let r=this.query=t.state.field(be).query.spec;this.commit=this.commit.bind(this),this.searchField=X("input",{value:r.search,placeholder:ae(t,"Find"),"aria-label":ae(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=X("input",{value:r.replace,placeholder:ae(t,"Replace"),"aria-label":ae(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=X("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=X("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=X("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(o,i,s){return X("button",{class:"cm-button",name:o,onclick:i,type:"button"},s)}this.dom=X("div",{onkeydown:o=>this.keydown(o),class:"cm-search"},[this.searchField,n("next",()=>ft(t),[ae(t,"next")]),n("prev",()=>ht(t),[ae(t,"previous")]),n("select",()=>Ei(t),[ae(t,"all")]),X("label",null,[this.caseField,ae(t,"match case")]),X("label",null,[this.reField,ae(t,"regexp")]),X("label",null,[this.wordField,ae(t,"by word")]),...t.state.readOnly?[]:[X("br"),this.replaceField,n("replace",()=>Fr(t),[ae(t,"replace")]),n("replaceAll",()=>Ci(t),[ae(t,"replace all")])],X("button",{name:"close",onclick:()=>er(t),"aria-label":ae(t,"close"),type:"button"},["×"])])}commit(){let t=new un({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:Ge.of(t)}))}keydown(t){m.runScopeHandlers(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ht:ft)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),Fr(this.view))}update(t){for(let r of t.transactions)for(let n of r.effects)n.is(Ge)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ce).top}}function ae(e,t){return e.state.phrase(t)}const tt=30,rt=/[\s\.,:;?!]/;function rr(e,{from:t,to:r}){let n=e.state.doc.lineAt(t),o=e.state.doc.lineAt(r).to,i=Math.max(n.from,t-tt),s=Math.min(o,r+tt),c=e.state.sliceDoc(i,s);if(i!=n.from){for(let l=0;l<tt;l++)if(!rt.test(c[l+1])&&rt.test(c[l])){c=c.slice(l);break}}if(s!=o){for(let l=c.length-1;l>c.length-tt;l--)if(!rt.test(c[l-1])&&rt.test(c[l])){c=c.slice(0,l);break}}return m.EditorView.announce.of(`${e.state.phrase("current match")}. ${c} ${e.state.phrase("on line")} ${n.number}.`)}const wi=m.EditorView.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Wt=[be,C.Prec.low(xi),wi],ki={Search:"搜索",Replace:"替换",Find:"查找","Replace all":"全部替换",Next:"下一个",Previous:"上一个",All:"全部",Close:"关闭",done:"完成","Match case":"区分大小写","Match whole word":"全字匹配","Use regular expression":"使用正则表达式","by word":"按单词",replace:"替换","Search for":"搜索内容","Replace with":"替换为","No matches":"无匹配结果","replaced $ matches":"已替换 $ 个匹配项","replaced match on line $":"已替换第 $ 行的匹配项","on line":"在第",line:"行","$ of $ matches":"第 $ 个,共 $ 个匹配","Invalid regular expression":"无效的正则表达式","Query too long":"查询内容过长","Search string too long":"搜索字符串过长"};function gn(){return m.EditorView.theme({".cm-panel.cm-search":{fontSize:"14px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},".cm-search label":{fontSize:"13px"},".cm-search input":{fontSize:"13px",fontFamily:"inherit"},".cm-search button":{fontSize:"12px",fontFamily:"inherit"}})}function pn(e){setTimeout(()=>{const t=e.dom.querySelector(".cm-panel.cm-search");if(!t)return;t.querySelectorAll("label").forEach(i=>{var c;switch((c=i.textContent)==null?void 0:c.trim()){case"Match case":i.textContent="区分大小写";break;case"Match whole word":i.textContent="全字匹配";break;case"Use regular expression":i.textContent="使用正则表达式";break}}),t.querySelectorAll("button").forEach(i=>{var c;switch((c=i.textContent)==null?void 0:c.trim()){case"Next":i.textContent="下一个";break;case"Previous":i.textContent="上一个";break;case"All":i.textContent="全部";break;case"Replace all":i.textContent="全部替换";break;case"Close":i.textContent="关闭";break;case"done":i.textContent="完成";break}}),t.querySelectorAll('input[type="text"]').forEach((i,s)=>{const c=i;s===0?c.placeholder="搜索内容":s===1&&(c.placeholder="替换为")})},100)}function jt(){return[gn(),Gt({top:!0}),yt(),m.keymap.of(tr),m.EditorView.updateListener.of(e=>{e.view.dom.querySelector(".cm-panel.cm-search")&&pn(e.view)})]}function Ti(){return[yt()]}function Vt(){return[Gt({top:!0}),yt(),m.keymap.of(tr)]}const _i=[{key:"Ctrl-f",mac:"Cmd-f",run:()=>!0},{key:"F3",run:()=>!0},{key:"Shift-F3",run:()=>!0}],Pi=({value:e,onChange:t,extensions:r=[],height:n="300px",disabled:o=!1,readOnly:i=!1,className:s="",style:c={},placeholder:l="",showLineNumbers:d=!0,onEditorViewCreated:f,locale:g="zh-CN"},M)=>{const y=T.useRef(null),w=T.useRef();return T.useEffect(()=>{if(!y.current)return;const b=[me.history(),m.keymap.of([...me.historyKeymap,me.indentWithTab,{key:"Enter",run:me.insertNewlineAndIndent}]),m.EditorView.lineWrapping,re.syntaxHighlighting(re.defaultHighlightStyle),C.EditorState.allowMultipleSelections.of(!0),g==="zh-CN"?jt():Vt(),l?m.placeholder(l):[],d?m.lineNumbers():[],m.EditorView.updateListener.of(E=>{if(E.docChanged&&t){const _={value:E.state.doc.toString(),readOnlyRanges:[]};t(_)}})];(o||i)&&b.push(C.EditorState.readOnly.of(!0));const v=C.EditorState.create({doc:e,extensions:[...b,...r]}),k=new m.EditorView({state:v,parent:y.current});return w.current=k,f&&f(k),()=>{var E;(E=w.current)==null||E.destroy()}},[]),T.useEffect(()=>{w.current&&e!==w.current.state.doc.toString()&&w.current.dispatch({changes:{from:0,to:w.current.state.doc.length,insert:e}})},[e]),T.useEffect(()=>{if(!w.current||!y.current)return;const b=w.current.state.doc.toString();w.current.destroy();const v=[me.history(),m.keymap.of([...me.historyKeymap,me.indentWithTab,{key:"Enter",run:me.insertNewlineAndIndent}]),m.EditorView.lineWrapping,re.syntaxHighlighting(re.defaultHighlightStyle),C.EditorState.allowMultipleSelections.of(!0),g==="zh-CN"?jt():Vt(),l?m.placeholder(l):[],d?m.lineNumbers():[],m.EditorView.updateListener.of(_=>{if(_.docChanged&&t){const L={value:_.state.doc.toString(),readOnlyRanges:[]};t(L)}})];(o||i)&&v.push(C.EditorState.readOnly.of(!0));const k=C.EditorState.create({doc:b,extensions:[...v,...r]}),E=new m.EditorView({state:k,parent:y.current});w.current=E,f&&f(E)},[o,i,d]),T.useImperativeHandle(M,()=>({insertTextAtCursor:b=>{const v=w.current;v&&(v.dispatch(v.state.replaceSelection(b)),v.focus())},goToPosition:b=>{const v=w.current;if(v){const k=v.state.doc.length,E=Math.max(0,Math.min(b,k));v.dispatch({selection:{anchor:E,head:E},scrollIntoView:!0}),v.focus()}},goToLine:(b,v=0)=>{const k=w.current;if(k){const E=k.state.doc,_=Math.max(1,Math.min(b,E.lines)),L=E.line(_),h=Math.max(0,Math.min(v,L.length))+L.from;k.dispatch({selection:{anchor:h,head:h},scrollIntoView:!0}),k.focus()}},getEditorView:()=>w.current})),mt("div",{ref:y,className:`senyao-editor ${o?"disabled":""} ${i?"readonly":""} ${s}`,style:{height:n,...c}})},vt=T.forwardRef(Pi),Mi=({value:e,onChange:t,language:r="json",extensions:n=[],theme:o="light",showLineNumbers:i=!0,...s},c)=>{const l=T.useMemo(()=>{const d=Gr(r)?Ur(r):[],f=en(o);return[d,f,...n]},[r,n,o]);return mt(vt,{ref:c,value:e,onChange:t,extensions:l,showLineNumbers:i,...s})},Oi=T.forwardRef(Mi),Ai=({value:e,onChange:t,extensions:r=[],readOnlyRanges:n,manageReadOnlyRanges:o=!0,showLineNumbers:i=!0,...s},c)=>{const l=T.useRef(null),f=(x=>x!=null&&typeof x=="object"&&"value"in x)(e),g=f?e.value:e,M=(f&&"readOnlyRanges"in e?e.readOnlyRanges:n)??[],[y,w]=T.useState(g??""),b=T.useRef(null),[v,k]=T.useState(M),E=T.useRef(y),[_,L]=T.useState(null),h=T.useRef(!1),R=T.useRef(new Map),O=T.useRef(!1);T.useEffect(()=>{if(o&&M.length>0&&!_){const x=[];let A=0;for(let F=0;F<M.length;F++){const $=M[F];$.start>A&&x.push({content:y.substring(A,$.start),editable:!0}),x.push({content:y.substring($.start,$.end),editable:!1}),A=$.end}A<y.length&&x.push({content:y.substring(A),editable:!0}),L(x)}},[o,M,y,_]),T.useEffect(()=>{if(y){const x=["SELECT","FROM","WHERE","GROUP","ORDER","HAVING","JOIN"],A=new Map;x.forEach(F=>{const $=y.indexOf(F);$>=0&&A.set(F,$)}),R.current=A}},[]);const Q=T.useMemo(()=>{const x=[Lr.sql(),Yt.autocompletion()];return v.length>0&&x.push(rn(v)),[...x,...r]},[r,v]),J=T.useCallback((x,A,F=0)=>{const $=x.indexOf(A,F);return $>=0?$:null},[]),Re=T.useCallback((x,A)=>{if(!o||!x||x.length===0)return x;const F=[...x];let $=0;for(let G=0;G<x.length;G++){const ce=x[G];if(!ce.editable){const pe=J(A,ce.content,$);pe!==null&&(G>0&&x[G-1].editable&&pe>$&&(F[G-1]={...F[G-1],content:A.substring($,pe)}),$=pe+ce.content.length)}}const H=x[x.length-1];return H.editable&&$<A.length&&(F[x.length-1]={...H,content:A.substring($)}),F},[o,J]),we=T.useCallback(x=>{let A=!1;return R.current.forEach((F,$)=>{const H=x.indexOf($);H>=0&&Math.abs(H-F)>0&&(R.current.set($,H),H>F&&(F===0||F<15)&&(A=!0))}),A},[]),xe=T.useCallback(()=>{if(!b.current)return;const x=b.current,A=x.state.doc.toString(),F=["SELECT","FROM","WHERE","GROUP","ORDER","HAVING","JOIN"],$=x.state.selection;let H=!1;for(const G of F){const ce=A.indexOf(G);if(ce>=0){x.dispatch({selection:{anchor:ce,head:ce+G.length},scrollIntoView:!1}),H=!0;break}}H&&setTimeout(()=>{x.dom&&document.contains(x.dom)&&x.dispatch({selection:$,scrollIntoView:!1})},10)},[]),ne=T.useCallback(()=>{if(!b.current)return;const x=b.current;v.length>0&&(ye(x,[]),setTimeout(()=>{x.dom&&document.contains(x.dom)&&(ye(x,v),setTimeout(()=>{x.dom&&document.contains(x.dom)&&x.dispatch({})},10))},10))},[v]),ue=T.useCallback(x=>{const A=x.value,F=E.current;w(A),F!==A&&(!F||A.length>(F==null?void 0:F.length)&&!F.startsWith(A.substring(0,5))&&A.includes(F.substring(0,10)))&&(h.current=!0,we(A)&&setTimeout(()=>{xe()},10)),E.current=A;const $=b.current?nn(b.current):v;if(o&&_){const H=Re(_,A);L(H);const{readOnlyRanges:G}=Lt(H);k(G),b.current&&ye(b.current,G),t&&t({value:A,readOnlyRanges:G})}else t&&t({value:A,readOnlyRanges:$})},[t,o,_,v,Re,we,xe]);T.useEffect(()=>{!o&&JSON.stringify(M)!==JSON.stringify(v)&&(k(M),b.current&&ye(b.current,M))},[M,v,o]),T.useEffect(()=>{if(o&&_){const{readOnlyRanges:x}=Lt(_);JSON.stringify(x)!==JSON.stringify(v)&&(k(x),b.current&&ye(b.current,x))}},[_,v,o]),T.useEffect(()=>{b.current&&h.current&&(h.current=!1,b.current.dispatch({}))},[y]),T.useEffect(()=>{b.current&&v.length>0&&!O.current&&(O.current=!0,setTimeout(()=>{ne()},50),setTimeout(()=>{ne()},200))},[ne,v]);const ge=T.useCallback(x=>{if(b.current=x,v.length>0&&(ye(x,v),setTimeout(()=>{ye(x,[]),setTimeout(()=>{ye(x,v)},10)},50)),y){const A=["SELECT","FROM","WHERE","GROUP","ORDER","HAVING","JOIN"],F=new Map;A.forEach($=>{const H=y.indexOf($);H>=0&&F.set($,H)}),R.current=F}},[v,y]);return mt(vt,{ref:l,value:y,onChange:ue,extensions:Q,showLineNumbers:i,onEditorViewCreated:ge,...s})},Fi=T.forwardRef(Ai);function mn(e){return e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function Ni(e,t){switch(t){case"String":return mn(e);case"Number":return Number(e);case"True":return!0;case"False":return!1;case"Null":return null;default:try{return JSON.parse(e)}catch{return e}}}function yn(e,t){if(typeof e!="object"||e===null)return e===t;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function vn(e,t){const r=e.firstChild;if(!r)return"";const n=t.doc.sliceString(r.from,r.to);return mn(n)}function bn(e,t){const r=e.lastChild;if(!r)return"";const n=t.doc.sliceString(r.from,r.to);return Ni(n,r.type.name)}function xn(e){let t=e.parent;for(;t;){if(t.type.name==="Object"||t.type.name==="Array")return t;t=t.parent}return null}function En(e){const t=new Map;for(const r of e){const n=t.get(r.key)||[];n.push(r),t.set(r.key,n)}return t}function Di(e,t,r){const n=r.get(e);return n?n.some(o=>yn(t,o.value)):!1}function Li(e,t,r){const n=r.get(e);return n&&n.find(o=>yn(t,o.value))||null}function Sn(e,t){if(!t||t.length===0)return[];const r=re.syntaxTree(e),n=[],o=new Set,i=En(t);return r.iterate({enter(s){const c=s.node;if(s.type.name!=="Property")return;const l=vn(c,e),d=bn(c,e);if(Di(l,d,i)){const f=xn(c);if(f){const g=`${f.from}-${f.to}`;o.has(g)||(o.add(g),n.push({from:f.from,to:f.to}))}}}}),n}function $i(e,t){if(!t||t.length===0)return[];const r=re.syntaxTree(e),n=[],o=new Set,i=En(t);return r.iterate({enter(s){const c=s.node;if(s.type.name!=="Property")return;const l=vn(c,e),d=bn(c,e),f=Li(l,d,i);if(f){const g=xn(c);if(g){const M=`${g.from}-${g.to}`;o.has(M)||(o.add(M),n.push({from:g.from,to:g.to,match:f}))}}}}),n}function Ii(e,t){if(e)return m.EditorView.baseTheme({".cm-scroller":{scrollBehavior:"smooth"}});const r={backgroundColor:"rgba(255, 237, 0, 0.3)",borderRadius:"3px",outline:"1px solid rgba(255, 193, 7, 0.5)"};let n={...r};return t&&(n={...r,...t}),m.EditorView.baseTheme({".cm-json-highlight":n,".cm-scroller":{scrollBehavior:"smooth"}})}function Wi(e,t="cm-json-highlight"){return C.StateField.define({create(n){return Nr(n,e,t)},update(n,o){return o.docChanged?Nr(o.state,e,t):n.map(o.changes)},provide:n=>m.EditorView.decorations.from(n)})}function Nr(e,t,r){if(!t||t.length===0)return m.Decoration.none;const n=new C.RangeSetBuilder,o=Sn(e,t);for(const i of o)n.add(i.from,i.to,m.Decoration.mark({class:r}));return n.finish()}function Dr(e,t,r){return[Wi(e,t||"cm-json-highlight"),Ii(t,r)]}function ji(e,t){if(typeof e!="object"||e===null)return e===t;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}const Vi=(e,t)=>{const{value:r,onChange:n,extensions:o=[],showLineNumbers:i=!0,enableFormatting:s=!1,enableCodeFolding:c=!0,highlightMatches:l,highlightClassName:d,highlightStyle:f,...g}=e,M=T.useRef(!0),y=T.useRef(null),w=T.useRef(new C.Compartment).current,b=T.useCallback(R=>{try{return R===""||JSON.parse(R),!0}catch{return!1}},[]),v=T.useCallback(R=>{try{if(!R.trim())return"";const O=JSON.parse(R);return JSON.stringify(O,null,2)}catch{return R}},[]),k=T.useCallback(()=>{if(!y.current)return!1;const R=y.current,O=R.state.doc.toString(),Q=v(O);if(Q===O)return!1;const J=R.state.update({changes:{from:0,to:R.state.doc.length,insert:Q}});return R.dispatch(J),!0},[v]),E=T.useMemo(()=>m.keymap.of([{key:"Alt-f",mac:"Mod-Alt-f",run:()=>k()}]),[k]),_=T.useCallback(R=>{if(n){const O=b(R.value);M.current=O,n(R)}},[n,b]),L=T.useMemo(()=>{const R=[qt.json(),re.bracketMatching(),Yt.closeBrackets(),C.Prec.highest(E),...o],O=l&&l.length>0?Dr(l,d,f):[];return R.push(w.of(O)),c&&R.push(re.codeFolding(),re.foldGutter({markerDOM:Q=>{const J=document.createElement("span");return J.style.cssText=`
|
|
44
|
+
*/var wr;function ko(){return wr||(wr=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,g=e?Symbol.for("react.suspense"):60113,M=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,w=e?Symbol.for("react.lazy"):60116,b=e?Symbol.for("react.block"):60121,x=e?Symbol.for("react.fundamental"):60117,T=e?Symbol.for("react.responder"):60118,E=e?Symbol.for("react.scope"):60119;function _(C){return typeof C=="string"||typeof C=="function"||C===n||C===d||C===i||C===o||C===g||C===M||typeof C=="object"&&C!==null&&(C.$$typeof===w||C.$$typeof===v||C.$$typeof===s||C.$$typeof===c||C.$$typeof===f||C.$$typeof===x||C.$$typeof===T||C.$$typeof===E||C.$$typeof===b)}function L(C){if(typeof C=="object"&&C!==null){var Ve=C.$$typeof;switch(Ve){case t:var _e=C.type;switch(_e){case l:case d:case n:case i:case o:case g:return _e;default:var Se=_e&&_e.$$typeof;switch(Se){case c:case f:case w:case v:case s:return Se;default:return Ve}}case r:return Ve}}}var h=l,z=d,m=c,H=s,B=t,Q=f,we=n,Ee=w,oe=v,fe=r,pe=i,S=o,O=g,A=!1;function D(C){return A||(A=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),J(C)||L(C)===l}function J(C){return L(C)===d}function X(C){return L(C)===c}function le(C){return L(C)===s}function me(C){return typeof C=="object"&&C!==null&&C.$$typeof===t}function bt(C){return L(C)===f}function xt(C){return L(C)===n}function Ie(C){return L(C)===w}function We(C){return L(C)===v}function ke(C){return L(C)===r}function je(C){return L(C)===i}function Te(C){return L(C)===o}function Et(C){return L(C)===g}V.AsyncMode=h,V.ConcurrentMode=z,V.ContextConsumer=m,V.ContextProvider=H,V.Element=B,V.ForwardRef=Q,V.Fragment=we,V.Lazy=Ee,V.Memo=oe,V.Portal=fe,V.Profiler=pe,V.StrictMode=S,V.Suspense=O,V.isAsyncMode=D,V.isConcurrentMode=J,V.isContextConsumer=X,V.isContextProvider=le,V.isElement=me,V.isForwardRef=bt,V.isFragment=xt,V.isLazy=Ie,V.isMemo=We,V.isPortal=ke,V.isProfiler=je,V.isStrictMode=Te,V.isSuspense=Et,V.isValidElementType=_,V.typeOf=L}()),V}process.env.NODE_ENV==="production"?Ft.exports=wo():Ft.exports=ko();var To=Ft.exports,zr=To,_o={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Po={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Hr={};Hr[zr.ForwardRef]=_o;Hr[zr.Memo]=Po;var Mo=!0;function Oo(e,t,r){var n="";return r.split(" ").forEach(function(o){e[o]!==void 0?t.push(e[o]+";"):o&&(n+=o+" ")}),n}var Br=function(t,r,n){var o=t.key+"-"+r.name;(n===!1||Mo===!1)&&t.registered[o]===void 0&&(t.registered[o]=r.styles)},Ao=function(t,r,n){Br(t,r,n);var o=t.key+"-"+r.name;if(t.inserted[r.name]===void 0){var i=r;do t.insert(r===i?"."+o:"",i,t.sheet,!0),i=i.next;while(i!==void 0)}};function Fo(e){for(var t=0,r,n=0,o=e.length;o>=4;++n,o-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var No={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Lo=/[A-Z]|^ms/g,Do=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Jr=function(t){return t.charCodeAt(1)===45},kr=function(t){return t!=null&&typeof t!="boolean"},Tt=mo(function(e){return Jr(e)?e:e.replace(Lo,"-$&").toLowerCase()}),Tr=function(t,r){switch(t){case"animation":case"animationName":if(typeof r=="string")return r.replace(Do,function(n,o,i){return de={name:o,styles:i,next:de},o})}return No[t]!==1&&!Jr(t)&&typeof r=="number"&&r!==0?r+"px":r};function Ue(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var o=r;if(o.anim===1)return de={name:o.name,styles:o.styles,next:de},o.name;var i=r;if(i.styles!==void 0){var s=i.next;if(s!==void 0)for(;s!==void 0;)de={name:s.name,styles:s.styles,next:de},s=s.next;var c=i.styles+";";return c}return $o(e,t,r)}case"function":{if(e!==void 0){var l=de,d=r(e);return de=l,Ue(e,t,d)}break}}var f=r;return f}function $o(e,t,r){var n="";if(Array.isArray(r))for(var o=0;o<r.length;o++)n+=Ue(e,t,r[o])+";";else for(var i in r){var s=r[i];if(typeof s!="object"){var c=s;kr(c)&&(n+=Tt(i)+":"+Tr(i,c)+";")}else if(Array.isArray(s)&&typeof s[0]=="string"&&t==null)for(var l=0;l<s.length;l++)kr(s[l])&&(n+=Tt(i)+":"+Tr(i,s[l])+";");else{var d=Ue(e,t,s);switch(i){case"animation":case"animationName":{n+=Tt(i)+":"+d+";";break}default:n+=i+"{"+d+"}"}}}return n}var _r=/label:\s*([^\s;{]+)\s*(;|$)/g,de;function Io(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,o="";de=void 0;var i=e[0];if(i==null||i.raw===void 0)n=!1,o+=Ue(r,t,i);else{var s=i;o+=s[0]}for(var c=1;c<e.length;c++)if(o+=Ue(r,t,e[c]),n){var l=i;o+=l[c]}_r.lastIndex=0;for(var d="",f;(f=_r.exec(o))!==null;)d+="-"+f[1];var g=Fo(o)+d;return{name:g,styles:o,next:de}}var Wo=function(t){return t()},jo=be.useInsertionEffect?be.useInsertionEffect:!1,Vo=jo||Wo,Kr=be.createContext(typeof HTMLElement<"u"?Ro({key:"css"}):null);Kr.Provider;var qo=function(t){return k.forwardRef(function(r,n){var o=k.useContext(Kr);return t(r,o,n)})},Yo=be.createContext({}),Jt={}.hasOwnProperty,Nt="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",zo=function(t,r){var n={};for(var o in r)Jt.call(r,o)&&(n[o]=r[o]);return n[Nt]=t,n},Ho=function(t){var r=t.cache,n=t.serialized,o=t.isStringTag;return Br(r,n,o),Vo(function(){return Ao(r,n,o)}),null},Bo=qo(function(e,t,r){var n=e.css;typeof n=="string"&&t.registered[n]!==void 0&&(n=t.registered[n]);var o=e[Nt],i=[n],s="";typeof e.className=="string"?s=Oo(t.registered,i,e.className):e.className!=null&&(s=e.className+" ");var c=Io(i,void 0,be.useContext(Yo));s+=t.key+"-"+c.name;var l={};for(var d in e)Jt.call(e,d)&&d!=="css"&&d!==Nt&&(l[d]=e[d]);return l.className=s,r&&(l.ref=r),be.createElement(be.Fragment,null,be.createElement(Ho,{cache:t,serialized:c,isStringTag:typeof o=="string"}),be.createElement(o,l))}),Jo=Bo,mt=function(t,r,n){return Jt.call(r,"css")?xr.jsx(Jo,zo(t,r),n):xr.jsx(t,r,n)};function Ur(e){switch(e.toLowerCase()){case"sql":return Dr.sql();case"json":return qt.json();default:return[]}}function Gr(e){return["sql","json"].includes(e.toLowerCase())}function Qr(e={}){return Yt.autocompletion(e)}function Ko(e){return[yr.lintGutter(),yr.linter(e)]}function Xr(){return y.keymap.of([ye.indentWithTab])}const Uo=[Xr(),Qr()],Go=ne.HighlightStyle.define([{tag:q.tags.keyword,color:"#1a1aa6",fontWeight:"bold"},{tag:q.tags.comment,color:"#008000",fontStyle:"italic"},{tag:q.tags.string,color:"#a31515"},{tag:q.tags.number,color:"#098658"},{tag:q.tags.operator,color:"#777777"},{tag:q.tags.propertyName,color:"#0451a5"},{tag:q.tags.variableName,color:"#001080"},{tag:q.tags.definition(q.tags.variableName),color:"#1a1aa6"},{tag:q.tags.typeName,color:"#267f99"},{tag:q.tags.className,color:"#267f99"},{tag:q.tags.meta,color:"#5c5c5c"},{tag:q.tags.regexp,color:"#811f3f"},{tag:q.tags.link,color:"#0563c1",textDecoration:"underline"}]),Lt=[y.EditorView.theme({"&":{backgroundColor:"#ffffff",color:"#333333",fontSize:"14px",height:"100%"},".cm-scroller":{fontFamily:'"Menlo", "Monaco", "Courier New", monospace',overflow:"auto"},".cm-content":{padding:"8px 0",caretColor:"#333",textAlign:"left"},".cm-gutters":{backgroundColor:"#f8f9fa",color:"#6e7781",borderRight:"1px solid #ddd"},".cm-lineNumbers":{minWidth:"40px"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 4px",textAlign:"right",fontSize:"12px"},".cm-activeLine":{backgroundColor:"rgba(0, 0, 0, 0.04)"},".cm-activeLineGutter":{backgroundColor:"rgba(0, 0, 0, 0.04)"},".cm-selectionMatch":{backgroundColor:"rgba(181, 213, 255, 0.3)"},"&.cm-focused .cm-cursor":{borderLeftColor:"#333333"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"rgba(181, 213, 255, 0.5)"}}),ne.syntaxHighlighting(Go)],Qo=ne.HighlightStyle.define([{tag:q.tags.keyword,color:"#569cd6",fontWeight:"bold"},{tag:q.tags.comment,color:"#6A9955",fontStyle:"italic"},{tag:q.tags.string,color:"#ce9178"},{tag:q.tags.number,color:"#b5cea8"},{tag:q.tags.operator,color:"#d4d4d4"},{tag:q.tags.propertyName,color:"#9cdcfe"},{tag:q.tags.variableName,color:"#9cdcfe"},{tag:q.tags.definition(q.tags.variableName),color:"#4fc1ff"},{tag:q.tags.typeName,color:"#4ec9b0"},{tag:q.tags.className,color:"#4ec9b0"},{tag:q.tags.meta,color:"#d4d4d4"},{tag:q.tags.regexp,color:"#d16969"},{tag:q.tags.link,color:"#4e94ce",textDecoration:"underline"}]),Zr=[y.EditorView.theme({"&":{backgroundColor:"#1e1e1e",color:"#d4d4d4",fontSize:"14px",height:"100%"},".cm-scroller":{fontFamily:'"Menlo", "Monaco", "Courier New", monospace',overflow:"auto"},".cm-content":{padding:"8px 0",caretColor:"#d4d4d4",textAlign:"left"},".cm-gutters":{backgroundColor:"#252526",color:"#858585",borderRight:"1px solid #404040"},".cm-lineNumbers":{minWidth:"40px"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 4px",textAlign:"right",fontSize:"12px"},".cm-activeLine":{backgroundColor:"rgba(255, 255, 255, 0.07)"},".cm-activeLineGutter":{backgroundColor:"rgba(255, 255, 255, 0.07)"},".cm-selectionMatch":{backgroundColor:"rgba(255, 255, 255, 0.1)"},"&.cm-focused .cm-cursor":{borderLeftColor:"#d4d4d4"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}),ne.syntaxHighlighting(Qo)];function en(e){switch(e){case"light":return Lt;case"dark":return Zr;default:return Lt}}const Dt=e=>{const t={value:"",readOnlyRanges:[]};let r=0;return e.forEach(n=>{const{content:o,editable:i}=n,s=o.replace(/\r\n/g,`
|
|
45
|
+
`),c=r,l=c+s.length;t.value+=o,i||t.readOnlyRanges.push({start:c,end:l}),r=l}),t},Xo='{"name":"Alice","age":25,"profile":{"city":"NY"}}';function Zo(e,t){const r=[],n=R.EditorState.create({doc:Xo,extensions:[qt.json()]});return ne.syntaxTree(n).iterate({enter:i=>{const s=n.doc.sliceString(i.from,i.to);console.log(`999,${i.type.name} [${i.from}-${i.to}]: ${s} }`),i.type.name==="Property"&&console.log(n.doc.sliceString(i.node.firstChild.from,i.node.firstChild.to),n.doc.sliceString(i.node.lastChild.from,i.node.lastChild.to),3333)}}),r}const st=R.StateEffect.define(),Pr=R.StateField.define({create(){return y.Decoration.none},update(e,t){e=e.map(t.changes);for(const r of t.effects)if(r.is(st))return tn(r.value);return t.docChanged,e},provide(e){return y.EditorView.decorations.from(e)}});function tn(e){const t=[];return console.log(e,9999299),e.forEach(r=>{r.start<r.end&&t.push(y.Decoration.mark({inclusive:!0,attributes:{class:"cm-readOnly",style:"background-color: rgba(0, 0, 0, 0.05);"},priority:-100}).range(r.start,r.end))}),y.Decoration.set(t)}const Kt=new WeakMap;function rn(e){let t=e.map(r=>({...r}));return[Pr.init(()=>tn(t)),y.keymap.of([{key:"Enter",run:r=>{const n=r.state.selection.main,{from:o,to:i}=n;if(o!==i){for(const c of t)if(o<c.end&&i>c.start)return!1}let s=!1;for(const c of t)if(o>c.start&&o<c.end){s=!0;break}return s?!1:(r.dispatch({changes:{from:o,to:i,insert:`
|
|
46
|
+
`},selection:{anchor:o+1}}),!0)}}]),R.EditorState.transactionFilter.of(r=>{if(!r.docChanged||r.isUserEvent("input.type.Enter")||r.isUserEvent("input.enter"))return r;let n=!1;return r.changes.iterChanges((o,i,s,c)=>{if(!(r.newDoc.sliceString(s,c)===`
|
|
47
|
+
`&&o===i)){for(const f of t)if(o===i){if(o>f.start&&o<f.end){n=!0;break}}else if(o<f.end&&i>f.start||o===f.start&&i>o||i===f.end&&o<i){n=!0;break}}}),n?[]:r}),y.EditorView.updateListener.of(r=>{if(r.docChanged){const n=ti(t,r);!ei(t,n)?(t=n,Kt.set(r.view,n),r.view.dispatch({effects:st.of(n)})):r.view.dispatch({effects:st.of(n)})}}),y.EditorView.updateListener.of(r=>{r.docChanged&&setTimeout(()=>{r.view.state.field(Pr,!1)&&r.view.dispatch({})},10)})]}function ei(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r].start!==t[r].start||e[r].end!==t[r].end)return!1;return!0}function ti(e,t){var o;if(!t.docChanged)return e;let r=!1;const n=e.map(i=>{const s={...i};return t.changes.iterChanges((c,l,d,f)=>{const g=f-d,M=l-c,v=g-M;if(c===0&&(r=!0),c===0&&g>0&&i.start===0){s.start=g,s.end+=v;return}if(l<=i.start)s.start+=v,s.end+=v;else if(c>=i.start&&c<i.end&&l>=i.end)s.end=c;else if(!(c>=i.start&&l<=i.end)){if(c<i.end&&l>i.end){const w=i.end-c;s.end=c+Math.min(w,g)}}}),s});if(r&&n.length>0){const i=((o=t.changes.newDoc)==null?void 0:o.toString())||"";let s=0;for(let c=0;c<i.length&&/\s/.test(i[c]);c++)s++;n[0].start===0&&s>0&&(n[0].start=s)}return n.filter(i=>i.start<i.end)}function nn(e){return Kt.get(e)||[]}function ve(e,t){const r=t.map(n=>({...n}));Kt.set(e,r),e.dispatch({effects:st.of(r)}),setTimeout(()=>{e.dom&&document.contains(e.dom)&&e.dispatch({})},10)}function Z(){var e=arguments[0];typeof e=="string"&&(e=document.createElement(e));var t=1,r=arguments[1];if(r&&typeof r=="object"&&r.nodeType==null&&!Array.isArray(r)){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){var o=r[n];typeof o=="string"?e.setAttribute(n,o):o!=null&&(e[n]=o)}t++}for(;t<arguments.length;t++)on(e,arguments[t]);return e}function on(e,t){if(typeof t=="string")e.appendChild(document.createTextNode(t));else if(t!=null)if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var r=0;r<t.length;r++)on(e,t[r]);else throw new RangeError("Unsupported child node: "+t)}const Mr=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class De{constructor(t,r,n=0,o=t.length,i,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(n,o),this.bufferStart=n,this.normalize=i?c=>i(Mr(c)):Mr,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return R.codePointAt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let r=R.fromCodePoint(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=R.codePointSize(t);let o=this.normalize(r);if(o.length)for(let i=0,s=n;;i++){let c=o.charCodeAt(i),l=this.match(c,s,this.bufferPos+this.bufferStart);if(i==o.length-1){if(l)return this.value=l,this;break}s==n&&i<r.length&&r.charCodeAt(i)==c&&s++}}}match(t,r,n){let o=null;for(let i=0;i<this.matches.length;i+=2){let s=this.matches[i],c=!1;this.query.charCodeAt(s)==t&&(s==this.query.length-1?o={from:this.matches[i+1],to:n}:(this.matches[i]++,c=!0)),c||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?o={from:r,to:n}:this.matches.push(1,r)),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(De.prototype[Symbol.iterator]=function(){return this});const an={from:-1,to:-1,match:/.*/.exec("")},Ut="gm"+(/x/.unicode==null?"":"u");class sn{constructor(t,r,n,o=0,i=t.length){if(this.text=t,this.to=i,this.curLine="",this.done=!1,this.value=an,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new cn(t,r,n,o,i);this.re=new RegExp(r,Ut+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.iter=t.iter();let s=t.lineAt(o);this.curLineStart=s.from,this.matchPos=ct(t,o),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,o=n+r[0].length;if(this.matchPos=ct(this.text,o+(n==o?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<o||n>this.value.to)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,match:r},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const _t=new WeakMap;class Ne{constructor(t,r){this.from=t,this.text=r}get to(){return this.from+this.text.length}static get(t,r,n){let o=_t.get(t);if(!o||o.from>=n||o.to<=r){let c=new Ne(r,t.sliceString(r,n));return _t.set(t,c),c}if(o.from==r&&o.to==n)return o;let{text:i,from:s}=o;return s>r&&(i=t.sliceString(r,s)+i,s=r),o.to<n&&(i+=t.sliceString(o.to,n)),_t.set(t,new Ne(s,i)),new Ne(r,i.slice(r-s,n-s))}}class cn{constructor(t,r,n,o,i){this.text=t,this.to=i,this.done=!1,this.value=an,this.matchPos=ct(t,o),this.re=new RegExp(r,Ut+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=Ne.get(t,o,this.chunkEnd(o+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==t&&(this.re.lastIndex=t+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,o=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,match:r},this.matchPos=ct(this.text,o+(n==o?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ne.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(sn.prototype[Symbol.iterator]=cn.prototype[Symbol.iterator]=function(){return this});function ri(e){try{return new RegExp(e,Ut),!0}catch{return!1}}function ct(e,t){if(t>=e.length)return t;let r=e.lineAt(t),n;for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}function $t(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),r=Z("input",{class:"cm-textfield",name:"line",value:t}),n=Z("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),e.dispatch({effects:Be.of(!1)}),e.focus()):i.keyCode==13&&(i.preventDefault(),o())},onsubmit:i=>{i.preventDefault(),o()}},Z("label",e.state.phrase("Go to line"),": ",r)," ",Z("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),Z("button",{name:"close",onclick:()=>{e.dispatch({effects:Be.of(!1)}),e.focus()},"aria-label":e.state.phrase("close"),type:"button"},["×"]));function o(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.value);if(!i)return;let{state:s}=e,c=s.doc.lineAt(s.selection.main.head),[,l,d,f,g]=i,M=f?+f.slice(1):0,v=d?+d:c.number;if(d&&g){let x=v/100;l&&(x=x*(l=="-"?-1:1)+c.number/s.doc.lines),v=Math.round(s.doc.lines*x)}else d&&l&&(v=v*(l=="-"?-1:1)+c.number);let w=s.doc.line(Math.max(1,Math.min(s.doc.lines,v))),b=R.EditorSelection.cursor(w.from+Math.max(0,Math.min(M,w.length)));e.dispatch({effects:[Be.of(!1),y.EditorView.scrollIntoView(b.from,{y:"center"})],selection:b}),e.focus()}return{dom:n}}const Be=R.StateEffect.define(),Or=R.StateField.define({create(){return!0},update(e,t){for(let r of t.effects)r.is(Be)&&(e=r.value);return e},provide:e=>y.showPanel.from(e,t=>t?$t:null)}),ni=e=>{let t=y.getPanel(e,$t);if(!t){let r=[Be.of(!0)];e.state.field(Or,!1)==null&&r.push(R.StateEffect.appendConfig.of([Or,oi])),e.dispatch({effects:r}),t=y.getPanel(e,$t)}return t&&t.dom.querySelector("input").select(),!0},oi=y.EditorView.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),ii={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ln=R.Facet.define({combine(e){return R.combineConfig(e,ii,{highlightWordAroundCursor:(t,r)=>t||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function yt(e){let t=[ui,li];return e&&t.push(ln.of(e)),t}const ai=y.Decoration.mark({class:"cm-selectionMatch"}),si=y.Decoration.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ar(e,t,r,n){return(r==0||e(t.sliceDoc(r-1,r))!=R.CharCategory.Word)&&(n==t.doc.length||e(t.sliceDoc(n,n+1))!=R.CharCategory.Word)}function ci(e,t,r,n){return e(t.sliceDoc(r,r+1))==R.CharCategory.Word&&e(t.sliceDoc(n-1,n))==R.CharCategory.Word}const li=y.ViewPlugin.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(ln),{state:r}=e,n=r.selection;if(n.ranges.length>1)return y.Decoration.none;let o=n.main,i,s=null;if(o.empty){if(!t.highlightWordAroundCursor)return y.Decoration.none;let l=r.wordAt(o.head);if(!l)return y.Decoration.none;s=r.charCategorizer(o.head),i=r.sliceDoc(l.from,l.to)}else{let l=o.to-o.from;if(l<t.minSelectionLength||l>200)return y.Decoration.none;if(t.wholeWords){if(i=r.sliceDoc(o.from,o.to),s=r.charCategorizer(o.head),!(Ar(s,r,o.from,o.to)&&ci(s,r,o.from,o.to)))return y.Decoration.none}else if(i=r.sliceDoc(o.from,o.to),!i)return y.Decoration.none}let c=[];for(let l of e.visibleRanges){let d=new De(r.doc,i,l.from,l.to);for(;!d.next().done;){let{from:f,to:g}=d.value;if((!s||Ar(s,r,f,g))&&(o.empty&&f<=o.from&&g>=o.to?c.push(si.range(f,g)):(f>=o.to||g<=o.from)&&c.push(ai.range(f,g)),c.length>t.maxMatches))return y.Decoration.none}}return y.Decoration.set(c)}},{decorations:e=>e.decorations}),ui=y.EditorView.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),fi=({state:e,dispatch:t})=>{let{selection:r}=e,n=R.EditorSelection.create(r.ranges.map(o=>e.wordAt(o.head)||R.EditorSelection.cursor(o.head)),r.mainIndex);return n.eq(r)?!1:(t(e.update({selection:n})),!0)};function hi(e,t){let{main:r,ranges:n}=e.selection,o=e.wordAt(r.head),i=o&&o.from==r.from&&o.to==r.to;for(let s=!1,c=new De(e.doc,t,n[n.length-1].to);;)if(c.next(),c.done){if(s)return null;c=new De(e.doc,t,0,Math.max(0,n[n.length-1].from-1)),s=!0}else{if(s&&n.some(l=>l.from==c.value.from))continue;if(i){let l=e.wordAt(c.value.from);if(!l||l.from!=c.value.from||l.to!=c.value.to)continue}return c.value}}const di=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(i=>i.from===i.to))return fi({state:e,dispatch:t});let n=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(i=>e.sliceDoc(i.from,i.to)!=n))return!1;let o=hi(e,n);return o?(t(e.update({selection:e.selection.addRange(R.EditorSelection.range(o.from,o.to),!1),effects:y.EditorView.scrollIntoView(o.to)})),!0):!1},Re=R.Facet.define({combine(e){return R.combineConfig(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new Ri(t),scrollToMatch:t=>y.EditorView.scrollIntoView(t)})}});function Gt(e){return e?[Re.of(e),Wt]:Wt}class un{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||ri(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
|
|
48
|
+
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new yi(this):new pi(this)}getCursor(t,r=0,n){let o=t.doc?t:R.EditorState.create({doc:t});return n==null&&(n=o.doc.length),this.regexp?Ae(this,o,r,n):Oe(this,o,r,n)}}class fn{constructor(t){this.spec=t}}function Oe(e,t,r,n){return new De(t.doc,e.unquoted,r,n,e.caseSensitive?void 0:o=>o.toLowerCase(),e.wholeWord?gi(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function gi(e,t){return(r,n,o,i)=>((i>r||i+o.length<n)&&(i=Math.max(0,r-2),o=e.sliceString(i,Math.min(e.length,n+2))),(t(lt(o,r-i))!=R.CharCategory.Word||t(ut(o,r-i))!=R.CharCategory.Word)&&(t(ut(o,n-i))!=R.CharCategory.Word||t(lt(o,n-i))!=R.CharCategory.Word))}class pi extends fn{constructor(t){super(t)}nextMatch(t,r,n){let o=Oe(this.spec,t,n,t.doc.length).nextOverlapping();if(o.done){let i=Math.min(t.doc.length,r+this.spec.unquoted.length);o=Oe(this.spec,t,0,i).nextOverlapping()}return o.done||o.value.from==r&&o.value.to==n?null:o.value}prevMatchInRange(t,r,n){for(let o=n;;){let i=Math.max(r,o-1e4-this.spec.unquoted.length),s=Oe(this.spec,t,i,o),c=null;for(;!s.nextOverlapping().done;)c=s.value;if(c)return c;if(i==r)return null;o-=1e4}}prevMatch(t,r,n){let o=this.prevMatchInRange(t,0,r);return o||(o=this.prevMatchInRange(t,Math.max(0,n-this.spec.unquoted.length),t.doc.length)),o&&(o.from!=r||o.to!=n)?o:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,r){let n=Oe(this.spec,t,0,t.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(t,r,n,o){let i=Oe(this.spec,t,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,t.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}}function Ae(e,t,r,n){return new sn(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?mi(t.charCategorizer(t.selection.main.head)):void 0},r,n)}function lt(e,t){return e.slice(R.findClusterBreak(e,t,!1),t)}function ut(e,t){return e.slice(t,R.findClusterBreak(e,t))}function mi(e){return(t,r,n)=>!n[0].length||(e(lt(n.input,n.index))!=R.CharCategory.Word||e(ut(n.input,n.index))!=R.CharCategory.Word)&&(e(ut(n.input,n.index+n[0].length))!=R.CharCategory.Word||e(lt(n.input,n.index+n[0].length))!=R.CharCategory.Word)}class yi extends fn{nextMatch(t,r,n){let o=Ae(this.spec,t,n,t.doc.length).next();return o.done&&(o=Ae(this.spec,t,0,r).next()),o.done?null:o.value}prevMatchInRange(t,r,n){for(let o=1;;o++){let i=Math.max(r,n-o*1e4),s=Ae(this.spec,t,i,n),c=null;for(;!s.next().done;)c=s.value;if(c&&(i==r||c.from>i+10))return c;if(i==r)return null}}prevMatch(t,r,n){return this.prevMatchInRange(t,0,r)||this.prevMatchInRange(t,n,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return t.match[0];if(n=="$")return"$";for(let o=n.length;o>0;o--){let i=+n.slice(0,o);if(i>0&&i<t.match.length)return t.match[i]+n.slice(o)}return r})}matchAll(t,r){let n=Ae(this.spec,t,0,t.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(t,r,n,o){let i=Ae(this.spec,t,Math.max(0,r-250),Math.min(n+250,t.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}}const Ge=R.StateEffect.define(),Qt=R.StateEffect.define(),xe=R.StateField.define({create(e){return new Pt(It(e).create(),null)},update(e,t){for(let r of t.effects)r.is(Ge)?e=new Pt(r.value.create(),e.panel):r.is(Qt)&&(e=new Pt(e.query,r.value?Xt:null));return e},provide:e=>y.showPanel.from(e,t=>t.panel)});class Pt{constructor(t,r){this.query=t,this.panel=r}}const vi=y.Decoration.mark({class:"cm-searchMatch"}),bi=y.Decoration.mark({class:"cm-searchMatch cm-searchMatch-selected"}),xi=y.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(xe))}update(e){let t=e.state.field(xe);(t!=e.startState.field(xe)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return y.Decoration.none;let{view:r}=this,n=new R.RangeSetBuilder;for(let o=0,i=r.visibleRanges,s=i.length;o<s;o++){let{from:c,to:l}=i[o];for(;o<s-1&&l>i[o+1].from-2*250;)l=i[++o].to;e.highlight(r.state,c,l,(d,f)=>{let g=r.state.selection.ranges.some(M=>M.from==d&&M.to==f);n.add(d,f,g?bi:vi)})}return n.finish()}},{decorations:e=>e.decorations});function Xe(e){return t=>{let r=t.state.field(xe,!1);return r&&r.query.spec.valid?e(t,r):Zt(t)}}const ft=Xe((e,{query:t})=>{let{to:r}=e.state.selection.main,n=t.nextMatch(e.state,r,r);if(!n)return!1;let o=R.EditorSelection.single(n.from,n.to),i=e.state.facet(Re);return e.dispatch({selection:o,effects:[rr(e,n),i.scrollToMatch(o.main,e)],userEvent:"select.search"}),dn(e),!0}),ht=Xe((e,{query:t})=>{let{state:r}=e,{from:n}=r.selection.main,o=t.prevMatch(r,n,n);if(!o)return!1;let i=R.EditorSelection.single(o.from,o.to),s=e.state.facet(Re);return e.dispatch({selection:i,effects:[rr(e,o),s.scrollToMatch(i.main,e)],userEvent:"select.search"}),dn(e),!0}),Ei=Xe((e,{query:t})=>{let r=t.matchAll(e.state,1e3);return!r||!r.length?!1:(e.dispatch({selection:R.EditorSelection.create(r.map(n=>R.EditorSelection.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),Si=({state:e,dispatch:t})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:o}=r.main,i=[],s=0;for(let c=new De(e.doc,e.sliceDoc(n,o));!c.next().done;){if(i.length>1e3)return!1;c.value.from==n&&(s=i.length),i.push(R.EditorSelection.range(c.value.from,c.value.to))}return t(e.update({selection:R.EditorSelection.create(i,s),userEvent:"select.search.matches"})),!0},Fr=Xe((e,{query:t})=>{let{state:r}=e,{from:n,to:o}=r.selection.main;if(r.readOnly)return!1;let i=t.nextMatch(r,n,n);if(!i)return!1;let s=i,c=[],l,d,f=[];s.from==n&&s.to==o&&(d=r.toText(t.getReplacement(s)),c.push({from:s.from,to:s.to,insert:d}),s=t.nextMatch(r,s.from,s.to),f.push(y.EditorView.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+".")));let g=e.state.changes(c);return s&&(l=R.EditorSelection.single(s.from,s.to).map(g),f.push(rr(e,s)),f.push(r.facet(Re).scrollToMatch(l.main,e))),e.dispatch({changes:g,selection:l,effects:f,userEvent:"input.replace"}),!0}),Ci=Xe((e,{query:t})=>{if(e.state.readOnly)return!1;let r=t.matchAll(e.state,1e9).map(o=>{let{from:i,to:s}=o;return{from:i,to:s,insert:t.getReplacement(o)}});if(!r.length)return!1;let n=e.state.phrase("replaced $ matches",r.length)+".";return e.dispatch({changes:r,effects:y.EditorView.announce.of(n),userEvent:"input.replace.all"}),!0});function Xt(e){return e.state.facet(Re).createPanel(e)}function It(e,t){var r,n,o,i,s;let c=e.selection.main,l=c.empty||c.to>c.from+100?"":e.sliceDoc(c.from,c.to);if(t&&!l)return t;let d=e.facet(Re);return new un({search:((r=t==null?void 0:t.literal)!==null&&r!==void 0?r:d.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=t==null?void 0:t.caseSensitive)!==null&&n!==void 0?n:d.caseSensitive,literal:(o=t==null?void 0:t.literal)!==null&&o!==void 0?o:d.literal,regexp:(i=t==null?void 0:t.regexp)!==null&&i!==void 0?i:d.regexp,wholeWord:(s=t==null?void 0:t.wholeWord)!==null&&s!==void 0?s:d.wholeWord})}function hn(e){let t=y.getPanel(e,Xt);return t&&t.dom.querySelector("[main-field]")}function dn(e){let t=hn(e);t&&t==e.root.activeElement&&t.select()}const Zt=e=>{let t=e.state.field(xe,!1);if(t&&t.panel){let r=hn(e);if(r&&r!=e.root.activeElement){let n=It(e.state,t.query.spec);n.valid&&e.dispatch({effects:Ge.of(n)}),r.focus(),r.select()}}else e.dispatch({effects:[Qt.of(!0),t?Ge.of(It(e.state,t.query.spec)):R.StateEffect.appendConfig.of(Wt)]});return!0},er=e=>{let t=e.state.field(xe,!1);if(!t||!t.panel)return!1;let r=y.getPanel(e,Xt);return r&&r.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Qt.of(!1)}),!0},tr=[{key:"Mod-f",run:Zt,scope:"editor search-panel"},{key:"F3",run:ft,shift:ht,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ft,shift:ht,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:er,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Si},{key:"Mod-Alt-g",run:ni},{key:"Mod-d",run:di,preventDefault:!0}];class Ri{constructor(t){this.view=t;let r=this.query=t.state.field(xe).query.spec;this.commit=this.commit.bind(this),this.searchField=Z("input",{value:r.search,placeholder:se(t,"Find"),"aria-label":se(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Z("input",{value:r.replace,placeholder:se(t,"Replace"),"aria-label":se(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Z("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=Z("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=Z("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(o,i,s){return Z("button",{class:"cm-button",name:o,onclick:i,type:"button"},s)}this.dom=Z("div",{onkeydown:o=>this.keydown(o),class:"cm-search"},[this.searchField,n("next",()=>ft(t),[se(t,"next")]),n("prev",()=>ht(t),[se(t,"previous")]),n("select",()=>Ei(t),[se(t,"all")]),Z("label",null,[this.caseField,se(t,"match case")]),Z("label",null,[this.reField,se(t,"regexp")]),Z("label",null,[this.wordField,se(t,"by word")]),...t.state.readOnly?[]:[Z("br"),this.replaceField,n("replace",()=>Fr(t),[se(t,"replace")]),n("replaceAll",()=>Ci(t),[se(t,"replace all")])],Z("button",{name:"close",onclick:()=>er(t),"aria-label":se(t,"close"),type:"button"},["×"])])}commit(){let t=new un({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:Ge.of(t)}))}keydown(t){y.runScopeHandlers(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ht:ft)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),Fr(this.view))}update(t){for(let r of t.transactions)for(let n of r.effects)n.is(Ge)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Re).top}}function se(e,t){return e.state.phrase(t)}const tt=30,rt=/[\s\.,:;?!]/;function rr(e,{from:t,to:r}){let n=e.state.doc.lineAt(t),o=e.state.doc.lineAt(r).to,i=Math.max(n.from,t-tt),s=Math.min(o,r+tt),c=e.state.sliceDoc(i,s);if(i!=n.from){for(let l=0;l<tt;l++)if(!rt.test(c[l+1])&&rt.test(c[l])){c=c.slice(l);break}}if(s!=o){for(let l=c.length-1;l>c.length-tt;l--)if(!rt.test(c[l-1])&&rt.test(c[l])){c=c.slice(0,l);break}}return y.EditorView.announce.of(`${e.state.phrase("current match")}. ${c} ${e.state.phrase("on line")} ${n.number}.`)}const wi=y.EditorView.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Wt=[xe,R.Prec.low(xi),wi],ki={Search:"搜索",Replace:"替换",Find:"查找","Replace all":"全部替换",Next:"下一个",Previous:"上一个",All:"全部",Close:"关闭",done:"完成","Match case":"区分大小写","Match whole word":"全字匹配","Use regular expression":"使用正则表达式","by word":"按单词",replace:"替换","Search for":"搜索内容","Replace with":"替换为","No matches":"无匹配结果","replaced $ matches":"已替换 $ 个匹配项","replaced match on line $":"已替换第 $ 行的匹配项","on line":"在第",line:"行","$ of $ matches":"第 $ 个,共 $ 个匹配","Invalid regular expression":"无效的正则表达式","Query too long":"查询内容过长","Search string too long":"搜索字符串过长"};function gn(){return y.EditorView.theme({".cm-panel.cm-search":{fontSize:"14px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},".cm-search label":{fontSize:"13px"},".cm-search input":{fontSize:"13px",fontFamily:"inherit"},".cm-search button":{fontSize:"12px",fontFamily:"inherit"}})}function pn(e){setTimeout(()=>{const t=e.dom.querySelector(".cm-panel.cm-search");if(!t)return;t.querySelectorAll("label").forEach(i=>{var c;switch((c=i.textContent)==null?void 0:c.trim()){case"Match case":i.textContent="区分大小写";break;case"Match whole word":i.textContent="全字匹配";break;case"Use regular expression":i.textContent="使用正则表达式";break}}),t.querySelectorAll("button").forEach(i=>{var c;switch((c=i.textContent)==null?void 0:c.trim()){case"Next":i.textContent="下一个";break;case"Previous":i.textContent="上一个";break;case"All":i.textContent="全部";break;case"Replace all":i.textContent="全部替换";break;case"Close":i.textContent="关闭";break;case"done":i.textContent="完成";break}}),t.querySelectorAll('input[type="text"]').forEach((i,s)=>{const c=i;s===0?c.placeholder="搜索内容":s===1&&(c.placeholder="替换为")})},100)}function jt(){return[gn(),Gt({top:!0}),yt(),y.keymap.of(tr),y.EditorView.updateListener.of(e=>{e.view.dom.querySelector(".cm-panel.cm-search")&&pn(e.view)})]}function Ti(){return[yt()]}function Vt(){return[Gt({top:!0}),yt(),y.keymap.of(tr)]}const _i=[{key:"Ctrl-f",mac:"Cmd-f",run:()=>!0},{key:"F3",run:()=>!0},{key:"Shift-F3",run:()=>!0}],Pi=({value:e,onChange:t,extensions:r=[],height:n="300px",disabled:o=!1,readOnly:i=!1,className:s="",style:c={},placeholder:l="",showLineNumbers:d=!0,onEditorViewCreated:f,locale:g="zh-CN"},M)=>{const v=k.useRef(null),w=k.useRef();return k.useEffect(()=>{if(!v.current)return;const b=[ye.history(),y.keymap.of([...ye.historyKeymap,ye.indentWithTab,{key:"Enter",run:ye.insertNewlineAndIndent}]),y.EditorView.lineWrapping,ne.syntaxHighlighting(ne.defaultHighlightStyle),R.EditorState.allowMultipleSelections.of(!0),g==="zh-CN"?jt():Vt(),l?y.placeholder(l):[],d?y.lineNumbers():[],y.EditorView.updateListener.of(E=>{if(E.docChanged&&t){const _={value:E.state.doc.toString(),readOnlyRanges:[]};t(_)}})];(o||i)&&b.push(R.EditorState.readOnly.of(!0));const x=R.EditorState.create({doc:e,extensions:[...b,...r]}),T=new y.EditorView({state:x,parent:v.current});return w.current=T,f&&f(T),()=>{var E;(E=w.current)==null||E.destroy()}},[]),k.useEffect(()=>{w.current&&e!==w.current.state.doc.toString()&&w.current.dispatch({changes:{from:0,to:w.current.state.doc.length,insert:e}})},[e]),k.useEffect(()=>{if(!w.current||!v.current)return;const b=w.current.state.doc.toString();w.current.destroy();const x=[ye.history(),y.keymap.of([...ye.historyKeymap,ye.indentWithTab,{key:"Enter",run:ye.insertNewlineAndIndent}]),y.EditorView.lineWrapping,ne.syntaxHighlighting(ne.defaultHighlightStyle),R.EditorState.allowMultipleSelections.of(!0),g==="zh-CN"?jt():Vt(),l?y.placeholder(l):[],d?y.lineNumbers():[],y.EditorView.updateListener.of(_=>{if(_.docChanged&&t){const L={value:_.state.doc.toString(),readOnlyRanges:[]};t(L)}})];(o||i)&&x.push(R.EditorState.readOnly.of(!0));const T=R.EditorState.create({doc:b,extensions:[...x,...r]}),E=new y.EditorView({state:T,parent:v.current});w.current=E,f&&f(E)},[o,i,d]),k.useImperativeHandle(M,()=>({insertTextAtCursor:b=>{const x=w.current;x&&(x.dispatch(x.state.replaceSelection(b)),x.focus())},goToPosition:b=>{const x=w.current;if(x){const T=x.state.doc.length,E=Math.max(0,Math.min(b,T));x.dispatch({selection:{anchor:E,head:E},scrollIntoView:!0}),x.focus()}},goToLine:(b,x=0)=>{const T=w.current;if(T){const E=T.state.doc,_=Math.max(1,Math.min(b,E.lines)),L=E.line(_),h=Math.max(0,Math.min(x,L.length))+L.from;T.dispatch({selection:{anchor:h,head:h},scrollIntoView:!0}),T.focus()}},getEditorView:()=>w.current})),mt("div",{ref:v,className:`senyao-editor ${o?"disabled":""} ${i?"readonly":""} ${s}`,style:{height:n,...c}})},vt=k.forwardRef(Pi),Mi=({value:e,onChange:t,language:r="json",extensions:n=[],theme:o="light",showLineNumbers:i=!0,...s},c)=>{const l=k.useMemo(()=>{const d=Gr(r)?Ur(r):[],f=en(o);return[d,f,...n]},[r,n,o]);return mt(vt,{ref:c,value:e,onChange:t,extensions:l,showLineNumbers:i,...s})},Oi=k.forwardRef(Mi),Ai=({value:e,onChange:t,extensions:r=[],readOnlyRanges:n,manageReadOnlyRanges:o=!0,showLineNumbers:i=!0,...s},c)=>{const l=k.useRef(null),f=(S=>S!=null&&typeof S=="object"&&"value"in S)(e),g=f?e.value:e,M=(f&&"readOnlyRanges"in e?e.readOnlyRanges:n)??[],[v,w]=k.useState(g??""),b=k.useRef(null),[x,T]=k.useState(M),E=k.useRef(v),[_,L]=k.useState(null),h=k.useRef(!1),z=k.useRef(new Map),m=k.useRef(!1);k.useEffect(()=>{if(o&&M.length>0&&!_){const S=[];let O=0;for(let A=0;A<M.length;A++){const D=M[A];D.start>O&&S.push({content:v.substring(O,D.start),editable:!0}),S.push({content:v.substring(D.start,D.end),editable:!1}),O=D.end}O<v.length&&S.push({content:v.substring(O),editable:!0}),L(S)}},[o,M,v,_]),k.useEffect(()=>{if(v){const S=["SELECT","FROM","WHERE","GROUP","ORDER","HAVING","JOIN"],O=new Map;S.forEach(A=>{const D=v.indexOf(A);D>=0&&O.set(A,D)}),z.current=O}},[]);const H=k.useMemo(()=>{const S=[Dr.sql(),Yt.autocompletion()];return x.length>0&&S.push(rn(x)),[...S,...r]},[r,x]),B=k.useCallback((S,O,A=0)=>{const D=S.indexOf(O,A);return D>=0?D:null},[]),Q=k.useCallback((S,O)=>{if(!o||!S||S.length===0)return S;const A=[...S];let D=0;for(let X=0;X<S.length;X++){const le=S[X];if(!le.editable){const me=B(O,le.content,D);me!==null&&(X>0&&S[X-1].editable&&me>D&&(A[X-1]={...A[X-1],content:O.substring(D,me)}),D=me+le.content.length)}}const J=S[S.length-1];return J.editable&&D<O.length&&(A[S.length-1]={...J,content:O.substring(D)}),A},[o,B]),we=k.useCallback(S=>{let O=!1;return z.current.forEach((A,D)=>{const J=S.indexOf(D);J>=0&&Math.abs(J-A)>0&&(z.current.set(D,J),J>A&&(A===0||A<15)&&(O=!0))}),O},[]),Ee=k.useCallback(()=>{if(!b.current)return;const S=b.current,O=S.state.doc.toString(),A=["SELECT","FROM","WHERE","GROUP","ORDER","HAVING","JOIN"],D=S.state.selection;let J=!1;for(const X of A){const le=O.indexOf(X);if(le>=0){S.dispatch({selection:{anchor:le,head:le+X.length},scrollIntoView:!1}),J=!0;break}}J&&setTimeout(()=>{S.dom&&document.contains(S.dom)&&S.dispatch({selection:D,scrollIntoView:!1})},10)},[]),oe=k.useCallback(()=>{if(!b.current)return;const S=b.current;x.length>0&&(ve(S,[]),setTimeout(()=>{S.dom&&document.contains(S.dom)&&(ve(S,x),setTimeout(()=>{S.dom&&document.contains(S.dom)&&S.dispatch({})},10))},10))},[x]),fe=k.useCallback(S=>{const O=S.value,A=E.current;w(O),A!==O&&(!A||O.length>(A==null?void 0:A.length)&&!A.startsWith(O.substring(0,5))&&O.includes(A.substring(0,10)))&&(h.current=!0,we(O)&&setTimeout(()=>{Ee()},10)),E.current=O;const D=b.current?nn(b.current):x;if(o&&_){const J=Q(_,O);L(J);const{readOnlyRanges:X}=Dt(J);T(X),b.current&&ve(b.current,X),t&&t({value:O,readOnlyRanges:X})}else t&&t({value:O,readOnlyRanges:D})},[t,o,_,x,Q,we,Ee]);k.useEffect(()=>{!o&&JSON.stringify(M)!==JSON.stringify(x)&&(T(M),b.current&&ve(b.current,M))},[M,x,o]),k.useEffect(()=>{if(o&&_){const{readOnlyRanges:S}=Dt(_);JSON.stringify(S)!==JSON.stringify(x)&&(T(S),b.current&&ve(b.current,S))}},[_,x,o]),k.useEffect(()=>{b.current&&h.current&&(h.current=!1,b.current.dispatch({}))},[v]),k.useEffect(()=>{b.current&&x.length>0&&!m.current&&(m.current=!0,setTimeout(()=>{oe()},50),setTimeout(()=>{oe()},200))},[oe,x]);const pe=k.useCallback(S=>{if(b.current=S,x.length>0&&(ve(S,x),setTimeout(()=>{ve(S,[]),setTimeout(()=>{ve(S,x)},10)},50)),v){const O=["SELECT","FROM","WHERE","GROUP","ORDER","HAVING","JOIN"],A=new Map;O.forEach(D=>{const J=v.indexOf(D);J>=0&&A.set(D,J)}),z.current=A}},[x,v]);return mt(vt,{ref:l,value:v,onChange:fe,extensions:H,showLineNumbers:i,onEditorViewCreated:pe,...s})},Fi=k.forwardRef(Ai);function mn(e){return e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function Ni(e,t){switch(t){case"String":return mn(e);case"Number":return Number(e);case"True":return!0;case"False":return!1;case"Null":return null;default:try{return JSON.parse(e)}catch{return e}}}function yn(e,t){if(typeof e!="object"||e===null)return e===t;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function vn(e,t){const r=e.firstChild;if(!r)return"";const n=t.doc.sliceString(r.from,r.to);return mn(n)}function bn(e,t){const r=e.lastChild;if(!r)return"";const n=t.doc.sliceString(r.from,r.to);return Ni(n,r.type.name)}function xn(e){let t=e.parent;for(;t;){if(t.type.name==="Object"||t.type.name==="Array")return t;t=t.parent}return null}function En(e){const t=new Map;for(const r of e){const n=t.get(r.key)||[];n.push(r),t.set(r.key,n)}return t}function Li(e,t,r){const n=r.get(e);return n?n.some(o=>yn(t,o.value)):!1}function Di(e,t,r){const n=r.get(e);return n&&n.find(o=>yn(t,o.value))||null}function Sn(e,t){if(!t||t.length===0)return[];const r=ne.syntaxTree(e),n=[],o=new Set,i=En(t);return r.iterate({enter(s){const c=s.node;if(s.type.name!=="Property")return;const l=vn(c,e),d=bn(c,e);if(Li(l,d,i)){const f=xn(c);if(f){const g=`${f.from}-${f.to}`;o.has(g)||(o.add(g),n.push({from:f.from,to:f.to}))}}}}),n}function $i(e,t){if(!t||t.length===0)return[];const r=ne.syntaxTree(e),n=[],o=new Set,i=En(t);return r.iterate({enter(s){const c=s.node;if(s.type.name!=="Property")return;const l=vn(c,e),d=bn(c,e),f=Di(l,d,i);if(f){const g=xn(c);if(g){const M=`${g.from}-${g.to}`;o.has(M)||(o.add(M),n.push({from:g.from,to:g.to,match:f}))}}}}),n}function Ii(e,t){if(e)return y.EditorView.baseTheme({".cm-scroller":{scrollBehavior:"smooth"}});const r={backgroundColor:"rgba(255, 237, 0, 0.3)",borderRadius:"3px",outline:"1px solid rgba(255, 193, 7, 0.5)"};let n={...r};return t&&(n={...r,...t}),y.EditorView.baseTheme({".cm-json-highlight":n,".cm-scroller":{scrollBehavior:"smooth"}})}function Wi(e,t="cm-json-highlight"){return R.StateField.define({create(n){return Nr(n,e,t)},update(n,o){return o.docChanged?Nr(o.state,e,t):n.map(o.changes)},provide:n=>y.EditorView.decorations.from(n)})}function Nr(e,t,r){if(!t||t.length===0)return y.Decoration.none;const n=new R.RangeSetBuilder,o=Sn(e,t);for(const i of o)n.add(i.from,i.to,y.Decoration.mark({class:r}));return n.finish()}function Lr(e,t,r){return[Wi(e,t||"cm-json-highlight"),Ii(t,r)]}function ji(e,t){if(typeof e!="object"||e===null)return e===t;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}const Vi=(e,t)=>{const{value:r,onChange:n,extensions:o=[],showLineNumbers:i=!0,enableFormatting:s=!1,enableCodeFolding:c=!0,highlightMatches:l,highlightClassName:d,highlightStyle:f,...g}=e,M=k.useRef(!0),v=k.useRef(null),w=k.useRef(null),b=k.useRef(new R.Compartment).current,x=k.useCallback(m=>{try{return m===""||JSON.parse(m),!0}catch{return!1}},[]),T=k.useCallback(m=>{try{if(!m.trim())return"";const H=JSON.parse(m);return JSON.stringify(H,null,2)}catch{return m}},[]),E=k.useCallback(()=>{if(!v.current)return!1;const m=v.current,H=m.state.doc.toString(),B=T(H);if(B===H)return!1;const Q=m.state.update({changes:{from:0,to:m.state.doc.length,insert:B}});return m.dispatch(Q),!0},[T]),_=k.useMemo(()=>y.keymap.of([{key:"Alt-f",mac:"Mod-Alt-f",run:()=>E()}]),[E]),L=k.useCallback(m=>{if(n){const H=x(m.value);M.current=H,n(m)}},[n,x]),h=k.useMemo(()=>{const m=[qt.json(),ne.bracketMatching(),Yt.closeBrackets(),R.Prec.highest(_),...o],H=l&&l.length>0?Lr(l,d,f):[];return m.push(b.of(H)),c&&m.push(ne.codeFolding(),ne.foldGutter({markerDOM:B=>{const Q=document.createElement("span");return Q.style.cssText=`
|
|
49
49
|
display: inline-flex;
|
|
50
50
|
align-items: center;
|
|
51
51
|
justify-content: center;
|
|
@@ -57,4 +57,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
57
57
|
transition: all 0.2s ease;
|
|
58
58
|
user-select: none;
|
|
59
59
|
border-radius: 2px;
|
|
60
|
-
`,
|
|
60
|
+
`,Q.textContent=B?"▾":"▸",Q.onmouseenter=()=>{Q.style.backgroundColor="rgba(24, 144, 255, 0.08)"},Q.onmouseleave=()=>{Q.style.backgroundColor="transparent"},Q}}),y.keymap.of(ne.foldKeymap)),m},[_,o,c,b]);k.useEffect(()=>{if(!v.current)return;const m=v.current,H=l&&l.length>0?Lr(l,d,f):[];m.dispatch({effects:b.reconfigure(H)}),l&&l.length>0&&setTimeout(()=>{if(!v.current)return;const B=Sn(m.state,l);B.length>0&&m.dispatch({selection:{anchor:B[0].from},effects:y.EditorView.scrollIntoView(B[0].from,{y:"start",yMargin:30})})},0)},[l,d,f,b]),k.useImperativeHandle(t,()=>({insertTextAtCursor:m=>{var H;return(H=w.current)==null?void 0:H.insertTextAtCursor(m)},goToPosition:m=>{var H;return(H=w.current)==null?void 0:H.goToPosition(m)},goToLine:(m,H)=>{var B;return(B=w.current)==null?void 0:B.goToLine(m,H)},getEditorView:()=>v.current,scrollToMatch:m=>{if(!v.current||!(l!=null&&l.length))return;const B=$i(v.current.state,l).find(Q=>Q.match.key===m.key&&ji(Q.match.value,m.value));B&&v.current.dispatch({selection:{anchor:B.from},effects:y.EditorView.scrollIntoView(B.from,{y:"start",yMargin:30})})},handleFormat:E}),[E,l]);const z=k.useCallback(m=>{v.current=m,s&&r&&setTimeout(()=>{E()},0)},[s,r,E]);return mt(vt,{ref:w,value:r,showLineNumbers:i,onChange:L,extensions:h,onEditorViewCreated:z,...g})},qi=k.forwardRef(Vi);exports.Editor=Oi;exports.GenericEditor=vt;exports.JSONEditor=qi;exports.SQLEditor=Fi;exports.applyChinese=pn;exports.blocksToEditorData=Dt;exports.chineseLanguageExtension=gn;exports.closeSearchPanel=er;exports.commonExtensions=Uo;exports.createAutocompletionExtension=Qr;exports.createEnglishSearchExtension=Vt;exports.createHighlightOnlyExtension=Ti;exports.createKeymapExtension=Xr;exports.createLintExtension=Ko;exports.createSearchExtension=jt;exports.customSearchKeymap=_i;exports.darkTheme=Zr;exports.findMatchingRanges=Zo;exports.getCurrentReadOnlyRanges=nn;exports.getLanguageExtension=Ur;exports.getThemeExtension=en;exports.highlightSelectionMatches=yt;exports.isSupportedLanguage=Gr;exports.lightTheme=Lt;exports.openSearchPanel=Zt;exports.readOnlyRanges=rn;exports.search=Gt;exports.searchKeymap=tr;exports.searchTranslationsZhCN=ki;exports.updateReadOnlyRanges=ve;
|