@devtable/dashboard 13.28.2 → 13.28.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dashboard.es.js +3 -3
- package/dist/dashboard.umd.js +2 -2
- package/dist/stats.html +1 -1
- package/dist/version.json +2 -2
- package/package.json +1 -1
package/dist/dashboard.es.js
CHANGED
|
@@ -832,7 +832,7 @@ function Qv({
|
|
|
832
832
|
sql: e
|
|
833
833
|
}, gn);
|
|
834
834
|
} catch (n) {
|
|
835
|
-
|
|
835
|
+
throw console.error(n), n;
|
|
836
836
|
}
|
|
837
837
|
}
|
|
838
838
|
function Uv(e, t, n) {
|
|
@@ -841,7 +841,7 @@ function Uv(e, t, n) {
|
|
|
841
841
|
try {
|
|
842
842
|
return new Function(`return ${e}`)()(t, gn, n);
|
|
843
843
|
} catch (i) {
|
|
844
|
-
|
|
844
|
+
throw console.error(i), i;
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
847
|
function Yv(e) {
|
|
@@ -9630,7 +9630,7 @@ class oc {
|
|
|
9630
9630
|
}), this.instanceRegistry.clear(), this.factoryRegistry.clear();
|
|
9631
9631
|
}
|
|
9632
9632
|
}
|
|
9633
|
-
const gf = "13.28.
|
|
9633
|
+
const gf = "13.28.3", l1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9634
9634
|
__proto__: null,
|
|
9635
9635
|
version: gf
|
|
9636
9636
|
}, Symbol.toStringTag, { value: "Module" }));
|
package/dist/dashboard.umd.js
CHANGED
|
@@ -51,7 +51,7 @@ Check the top-level render call using <`+q+">.")}return A}}function $g(C,A){{if(
|
|
|
51
51
|
${$m.map(Fm).join("")}
|
|
52
52
|
</tbody>
|
|
53
53
|
</table>
|
|
54
|
-
`;function Di(e,t){const n=Object.keys(t),s=Object.values(t);try{return new Function(...n,`return \`${e}\`;`)(...s)}catch(i){throw n.length===0&&e.includes("$")?new Error("[formatSQL] insufficient payload"):i}}function Mi(e,t){try{return Di(e,t)}catch(n){return console.error(n),n.message}}function Wm({sql:e,pre_process:t}){if(!t.trim())return e;try{return new Function(`return ${t}`)()({sql:e},At)}catch(n){
|
|
54
|
+
`;function Di(e,t){const n=Object.keys(t),s=Object.values(t);try{return new Function(...n,`return \`${e}\`;`)(...s)}catch(i){throw n.length===0&&e.includes("$")?new Error("[formatSQL] insufficient payload"):i}}function Mi(e,t){try{return Di(e,t)}catch(n){return console.error(n),n.message}}function Wm({sql:e,pre_process:t}){if(!t.trim())return e;try{return new Function(`return ${t}`)()({sql:e},At)}catch(n){throw console.error(n),n}}function Rm(e,t,n){if(!e.trim())return t;try{return new Function(`return ${e}`)()(t,At,n)}catch(s){throw console.error(s),s}}function Qm(e){e=e||{};const t=Object.keys(e).sort(),n=[];for(let s=0;s<t.length;s++){const i=t[s];if(i!="authentication"&&e[i])n.push(t[s]+"="+(typeof e[i]=="object"?JSON.stringify(e[i]):e[i]));else{const a=Object.keys(e[i]).sort();for(let l=0;l<a.length;l++){const c=a[l];c!="sign"&&e[i][c]&&n.push(a[l]+"="+(typeof e[i][c]=="object"?JSON.stringify(e[i][c]):e[i][c]))}}}return n.sort().join("&")}function Um(e,t){let n=Qm(e);return n+="&key="+t,Lm.MD5(n).toString().toUpperCase()}class kc{constructor(){this.type="default_api_client",this.baseURL="http://localhost:31200",this.app_id="",this.app_secret=""}getAuthentication(t){if(!this.app_id||!this.app_secret)return;const n=new Date().getTime().toString();return{app_id:this.app_id,nonce_str:n,sign:Um({app_id:this.app_id,nonce_str:n,...t},this.app_secret)}}getRequest(t,n){return(s,i,a,l)=>{const c=this.buildHeader(a),u=this.buildAxiosConfig(t,s,i,a,c,n);return Rt(u).then(d=>l?d:d.data).catch(d=>{if(Rt.isCancel(d))return Promise.reject(d);const h=v.get(d,"response.data.detail.message",d.message);return Promise.reject(new Error(h))})}}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}buildAxiosConfig(t,n,s,i,a,l){const c={baseURL:this.baseURL,method:t,url:n,params:t==="GET"?s:i.params,headers:a,signal:l};return["POST","PUT"].includes(t)&&(c.data=i.string?JSON.stringify(s):s,c.data.authentication=this.getAuthentication(c.data)),c}buildHeader(t){const n=window.localStorage.getItem("token");return{"X-Requested-With":"XMLHttpRequest","Content-Type":t.string?"application/x-www-form-urlencoded":"application/json",authorization:n?`bearer ${n}`:"",...t.headers}}}class Ym{constructor(t){this.implementation=t}getRequest(t,n){return this.implementation.getRequest(t,n)}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}}class Tc extends kc{constructor(){super(...arguments);N(this,"makeQueryENV",null)}query(n){return async(s,i={})=>{var a;return s.env||(s.env=((a=this.makeQueryENV)==null?void 0:a.call(this))??{error:"failed to run makeQueryENV"}),this.post(n)("/query",s,i)}}httpDataSourceQuery(n){return async(s,i={})=>{var a;return s.env||(s.env=((a=this.makeQueryENV)==null?void 0:a.call(this))??{error:"failed to run makeQueryENV"}),this.getRequest("POST",n)("/query",s,i,!0)}}structure(n){return async(s,i={})=>this.post(n)("/query/structure",s,i)}}class Dc{constructor(t){this.implementation=t}query(t){return this.implementation.query(t)}httpDataSourceQuery(t){return this.implementation.httpDataSourceQuery(t)}structure(t){return this.implementation.structure(t)}getRequest(t,n){return this.implementation.getRequest(t,n)}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}}const Qn=new Tc;function Ii(e){Qn.baseURL!==e.apiBaseURL&&(Qn.baseURL=e.apiBaseURL),e.app_id&&(Qn.app_id=e.app_id),e.app_secret&&(Qn.app_secret=e.app_secret),e.makeQueryENV&&(Qn.makeQueryENV=e.makeQueryENV)}const Mc=new Dc(Qn),Kt=Mc,ls=g.forwardRef(function({value:t,onChange:n,...s},i){return r.jsx(o.TextInput,{ref:i,value:t,onChange:n,...s})});function L(e){const[t,n]=e.split(".");return{queryID:t,columnKey:n}}function Km(e){return e.includes(".")?L(e):{queryID:"",columnKey:e}}function Pt(e,t){var i;const{queryID:n,columnKey:s}=L(t);return n?s?((i=e[n])==null?void 0:i.map(a=>a[s]))??[]:e[n]:[]}function cs(e,t){const{queryID:n}=L(t);return n?e[n]:[]}function Xm(e){return Object.values(e)[0]}function us(e,t){const{queryID:n,columnKey:s}=L(t);return e[s]}const Ic=["function aggregation({ queryData }, utils) {",' return "Aggregation Result";',"}"].join(`
|
|
55
55
|
`),Un={type:"none",config:{},fallback:"0"};function Jm(e){const t=Array.from(e).sort((s,i)=>s-i),n=Math.floor(t.length/2);return t.length%2===0?(t[n-1]+t[n])/2:t[n]}function Zm(e,t){switch(t.type){case"sum":return v.sum(e);case"mean":return v.mean(e);case"median":return Jm(e);case"max":return v.max(e);case"min":return v.min(e);case"quantile":return yr.quantile(e,t.config.p);case"CV":const n=Rn.std(...e),s=Rn.mean(...e);return s?n/s:Number.NaN;case"std":return Rn.std(...e);default:return e}}function zi(e,t){const n=e.map(Number),s=Zm(n,t);return typeof s=="number"?Number.isFinite(s)?s:t.fallback:s??t.fallback}function Hm(e,t,n){try{const s=cs(e,t);return new Function(`return ${n.config.func}`)()({queryData:s},At)}catch(s){return console.error(s),s.message}}function ex(e,t,n){try{const s=Pt(e,t),{method:i}=n.config;return v[i](s)}catch(s){return console.error(s),n.fallback}}function ds(e,t,n){try{return n.type==="custom"?Hm(e,t,n):n.type==="pick_record"?ex(e,t,n):zi(Pt(e,t),n)}catch(s){return console.error(s),null}}class tx{constructor({valueRange:t,colorRange:n}){N(this,"mapper");this.mapper=xn.interpolate(t,n)}getColor(t){return this.mapper(t)}}const Ei={fontSize:"14px",lineHeight:"32px",color:"#3D3E45",ul:{paddingLeft:"2em",margin:"6px 0 0"},p:{margin:"0 !important"},a:{WebkitTapHighlightColor:"transparent",color:"rgb(34, 139, 230)",textDecoration:"none","&:hover":{textDecoration:"underline"},"&:active, &:hover":{outlineWidth:0}},table:{tr:{"th, td":{padding:"0 .5em"}}},"table.rich-text-table-render, div.tableWrapper table":{"th, td":{border:"1px solid #eaeaea"},"tr:last-of-type td":{borderBottom:"1px solid #eaeaea"}},".resize-cursor":{cursor:"col-resize"},details:{summary:{listStyle:"none",cursor:"pointer",transition:"color 300ms ease",userSelect:"none"},"summary::-webkit-details-marker":{display:"none"},"summary:hover":{color:"black","&::before":{opacity:1}},"summary::before":{content:'"►"',fontSize:"10px",margin:"0px 5px",opacity:.5,display:"inline-block",transition:"opacity 300ms ease, transform 300ms ease"}},"details[open] summary::before":{transform:"rotate(90deg)"},"details + details":{marginTop:"10px"},blockquote:{fontSize:"14px",lineHeight:"32px",color:"#3D3E45",margin:"0 0 14px"}};function zc(e,t,n){for(let s=0;;s++){if(s==e.childCount||s==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(s),a=t.child(s);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let l=0;i.text[l]==a.text[l];l++)n++;return n}if(i.content.size||a.content.size){let l=zc(i.content,a.content,n+1);if(l!=null)return l}n+=i.nodeSize}}function Ec(e,t,n,s){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:s};let l=e.child(--i),c=t.child(--a),u=l.nodeSize;if(l==c){n-=u,s-=u;continue}if(!l.sameMarkup(c))return{a:n,b:s};if(l.isText&&l.text!=c.text){let d=0,h=Math.min(l.text.length,c.text.length);for(;d<h&&l.text[l.text.length-d-1]==c.text[c.text.length-d-1];)d++,n--,s--;return{a:n,b:s}}if(l.content.size||c.content.size){let d=Ec(l.content,c.content,n-1,s-1);if(d)return d}n-=u,s-=u}}class pe{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let s=0;s<t.length;s++)this.size+=t[s].nodeSize}nodesBetween(t,n,s,i=0,a){for(let l=0,c=0;c<n;l++){let u=this.content[l],d=c+u.nodeSize;if(d>t&&s(u,i+c,a||null,l)!==!1&&u.content.size){let h=c+1;u.nodesBetween(Math.max(0,t-h),Math.min(u.content.size,n-h),s,i+h)}c=d}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,s,i){let a="",l=!0;return this.nodesBetween(t,n,(c,u)=>{c.isText?(a+=c.text.slice(Math.max(t,u)-u,n-u),l=!s):c.isLeaf?(i?a+=typeof i=="function"?i(c):i:c.type.spec.leafText&&(a+=c.type.spec.leafText(c)),l=!s):!l&&c.isBlock&&(a+=s,l=!0)},0),a}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,s=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(s)&&(i[i.length-1]=n.withText(n.text+s.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new pe(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let s=[],i=0;if(n>t)for(let a=0,l=0;l<n;a++){let c=this.content[a],u=l+c.nodeSize;u>t&&((l<t||u>n)&&(c.isText?c=c.cut(Math.max(0,t-l),Math.min(c.text.length,n-l)):c=c.cut(Math.max(0,t-l-1),Math.min(c.content.size,n-l-1))),s.push(c),i+=c.nodeSize),l=u}return new pe(s,i)}cutByIndex(t,n){return t==n?pe.empty:t==0&&n==this.content.length?this:new pe(this.content.slice(t,n))}replaceChild(t,n){let s=this.content[t];if(s==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-s.nodeSize;return i[t]=n,new pe(i,a)}addToStart(t){return new pe([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new pe(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,s=0;n<this.content.length;n++){let i=this.content[n];t(i,s,n),s+=i.nodeSize}}findDiffStart(t,n=0){return zc(this,t,n)}findDiffEnd(t,n=this.size,s=t.size){return Ec(this,t,n,s)}findIndex(t,n=-1){if(t==0)return ps(0,t);if(t==this.size)return ps(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let s=0,i=0;;s++){let a=this.child(s),l=i+a.nodeSize;if(l>=t)return l==t||n>0?ps(s+1,l):ps(s,i);i=l}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return pe.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new pe(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return pe.empty;let n,s=0;for(let i=0;i<t.length;i++){let a=t[i];s+=a.nodeSize,i&&a.isText&&t[i-1].sameMarkup(a)?(n||(n=t.slice(0,i)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new pe(n||t,s)}static from(t){if(!t)return pe.empty;if(t instanceof pe)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new pe([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}pe.empty=new pe([],0);const Ai={index:0,offset:0};function ps(e,t){return Ai.index=e,Ai.offset=t,Ai}function Pi(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let s=0;s<e.length;s++)if(!Pi(e[s],t[s]))return!1}else{for(let s in e)if(!(s in t)||!Pi(e[s],t[s]))return!1;for(let s in t)if(!(s in e))return!1}return!0}let Xt=class Jl{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,s=!1;for(let i=0;i<t.length;i++){let a=t[i];if(this.eq(a))return t;if(this.type.excludes(a.type))n||(n=t.slice(0,i));else{if(a.type.excludes(this.type))return t;!s&&a.type.rank>this.type.rank&&(n||(n=t.slice(0,i)),n.push(this),s=!0),n&&n.push(a)}}return n||(n=t.slice()),s||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Pi(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let s=t.marks[n.type];if(!s)throw new RangeError(`There is no mark type ${n.type} in this schema`);return s.create(n.attrs)}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let s=0;s<t.length;s++)if(!t[s].eq(n[s]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return Jl.none;if(t instanceof Jl)return[t];let n=t.slice();return n.sort((s,i)=>s.type.rank-i.type.rank),n}};Xt.none=[];class nx extends Error{}class ve{constructor(t,n,s){this.content=t,this.openStart=n,this.openEnd=s}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let s=Pc(this.content,t+this.openStart,n);return s&&new ve(s,this.openStart,this.openEnd)}removeBetween(t,n){return new ve(Ac(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return ve.empty;let s=n.openStart||0,i=n.openEnd||0;if(typeof s!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ve(pe.fromJSON(t,n.content),s,i)}static maxOpen(t,n=!0){let s=0,i=0;for(let a=t.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)s++;for(let a=t.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new ve(t,s,i)}}ve.empty=new ve(pe.empty,0,0);function Ac(e,t,n){let{index:s,offset:i}=e.findIndex(t),a=e.maybeChild(s),{index:l,offset:c}=e.findIndex(n);if(i==t||a.isText){if(c!=n&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(s!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(s,a.copy(Ac(a.content,t-i-1,n-i-1)))}function Pc(e,t,n,s){let{index:i,offset:a}=e.findIndex(t),l=e.maybeChild(i);if(a==t||l.isText)return s&&!s.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let c=Pc(l.content,t-a-1,n);return c&&e.replaceChild(i,l.copy(c))}let rx=class Zl{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[],n.forEach(s=>{s.tag?this.tags.push(s):s.style&&this.styles.push(s)}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=t.nodes[s.node];return i.contentMatch.matchType(i)})}parse(t,n={}){let s=new Bc(this,n,!1);return s.addAll(t,n.from,n.to),s.finish()}parseSlice(t,n={}){let s=new Bc(this,n,!0);return s.addAll(t,n.from,n.to),ve.maxOpen(s.finish())}matchTag(t,n,s){for(let i=s?this.tags.indexOf(s)+1:0;i<this.tags.length;i++){let a=this.tags[i];if(ax(t,a.tag)&&(a.namespace===void 0||t.namespaceURI==a.namespace)&&(!a.context||n.matchesContext(a.context))){if(a.getAttrs){let l=a.getAttrs(t);if(l===!1)continue;a.attrs=l||void 0}return a}}}matchStyle(t,n,s,i){for(let a=i?this.styles.indexOf(i)+1:0;a<this.styles.length;a++){let l=this.styles[a],c=l.style;if(!(c.indexOf(t)!=0||l.context&&!s.matchesContext(l.context)||c.length>t.length&&(c.charCodeAt(t.length)!=61||c.slice(t.length+1)!=n))){if(l.getAttrs){let u=l.getAttrs(n);if(u===!1)continue;l.attrs=u||void 0}return l}}}static schemaRules(t){let n=[];function s(i){let a=i.priority==null?50:i.priority,l=0;for(;l<n.length;l++){let c=n[l];if((c.priority==null?50:c.priority)<a)break}n.splice(l,0,i)}for(let i in t.marks){let a=t.marks[i].spec.parseDOM;a&&a.forEach(l=>{s(l=qc(l)),l.mark||l.ignore||l.clearMark||(l.mark=i)})}for(let i in t.nodes){let a=t.nodes[i].spec.parseDOM;a&&a.forEach(l=>{s(l=qc(l)),l.node||l.ignore||l.mark||(l.node=i)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Zl(t,Zl.schemaRules(t)))}};const Oc={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},sx={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Lc={ol:!0,ul:!0},hs=1,fs=2,_r=4;function Vc(e,t,n){return t!=null?(t?hs:0)|(t==="full"?fs:0):e&&e.whitespace=="pre"?hs|fs:n&~_r}class gs{constructor(t,n,s,i,a,l,c){this.type=t,this.attrs=n,this.marks=s,this.pendingMarks=i,this.solid=a,this.options=c,this.content=[],this.activeMarks=Xt.none,this.stashMarks=[],this.match=l||(c&_r?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(pe.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let s=this.type.contentMatch,i;return(i=s.findWrapping(t.type))?(this.match=s,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&hs)){let s=this.content[this.content.length-1],i;if(s&&s.isText&&(i=/[ \t\r\n\u000c]+$/.exec(s.text))){let a=s;s.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let n=pe.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(pe.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}popFromStashMark(t){for(let n=this.stashMarks.length-1;n>=0;n--)if(t.eq(this.stashMarks[n]))return this.stashMarks.splice(n,1)[0]}applyPending(t){for(let n=0,s=this.pendingMarks;n<s.length;n++){let i=s[n];(this.type?this.type.allowsMarkType(i.type):lx(i.type,t))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!Oc.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class Bc{constructor(t,n,s){this.parser=t,this.options=n,this.isOpen=s,this.open=0;let i=n.topNode,a,l=Vc(null,n.preserveWhitespace,0)|(s?_r:0);i?a=new gs(i.type,i.attrs,Xt.none,Xt.none,!0,n.topMatch||i.type.contentMatch,l):s?a=new gs(null,null,Xt.none,Xt.none,!0,null,l):a=new gs(t.schema.topNodeType,null,Xt.none,Xt.none,!0,null,l),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t){if(t.nodeType==3)this.addTextNode(t);else if(t.nodeType==1){let n=t.getAttribute("style");if(!n)this.addElement(t);else{let s=this.readStyles(ox(n));if(!s)return;let[i,a]=s,l=this.top;for(let c=0;c<a.length;c++)this.removePendingMark(a[c],l);for(let c=0;c<i.length;c++)this.addPendingMark(i[c]);this.addElement(t);for(let c=0;c<i.length;c++)this.removePendingMark(i[c],l);for(let c=0;c<a.length;c++)this.addPendingMark(a[c])}}}addTextNode(t){let n=t.nodeValue,s=this.top;if(s.options&fs||s.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(s.options&hs)s.options&fs?n=n.replace(/\r\n?/g,`
|
|
56
56
|
`):n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let i=s.content[s.content.length-1],a=t.previousSibling;(!i||a&&a.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n)),this.findInText(t)}else this.findInside(t)}addElement(t,n){let s=t.nodeName.toLowerCase(),i;Lc.hasOwnProperty(s)&&this.parser.normalizeLists&&ix(t);let a=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(i=this.parser.matchTag(t,this,n));if(a?a.ignore:sx.hasOwnProperty(s))this.findInside(t),this.ignoreFallback(t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(t=a.skip);let l,c=this.top,u=this.needsBlock;if(Oc.hasOwnProperty(s))c.content.length&&c.content[0].isInline&&this.open&&(this.open--,c=this.top),l=!0,c.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t);return}this.addAll(t),l&&this.sync(c),this.needsBlock=u}else this.addElementByRule(t,a,a.consuming===!1?i:void 0)}leafFallback(t){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
|
|
57
57
|
`))}ignoreFallback(t){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(t){let n=Xt.none,s=Xt.none;for(let i=0;i<t.length;i+=2)for(let a=void 0;;){let l=this.parser.matchStyle(t[i],t[i+1],this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(c=>{l.clearMark(c)&&(s=c.addToSet(s))}):n=this.parser.schema.marks[l.mark].create(l.attrs).addToSet(n),l.consuming===!1)a=l;else break}return[n,s]}addElementByRule(t,n,s){let i,a,l;n.node?(a=this.parser.schema.nodes[n.node],a.isLeaf?this.insertNode(a.create(n.attrs))||this.leafFallback(t):i=this.enter(a,n.attrs||null,n.preserveWhitespace)):(l=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(l));let c=this.top;if(a&&a.isLeaf)this.findInside(t);else if(s)this.addElement(t,s);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(u=>this.insertNode(u));else{let u=t;typeof n.contentElement=="string"?u=t.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(t):n.contentElement&&(u=n.contentElement),this.findAround(t,u,!0),this.addAll(u)}i&&this.sync(c)&&this.open--,l&&this.removePendingMark(l,c)}addAll(t,n,s){let i=n||0;for(let a=n?t.childNodes[n]:t.firstChild,l=s==null?null:t.childNodes[s];a!=l;a=a.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(a);this.findAtPoint(t,i)}findPlace(t){let n,s;for(let i=this.open;i>=0;i--){let a=this.nodes[i],l=a.findWrapping(t);if(l&&(!n||n.length>l.length)&&(n=l,s=a,!l.length)||a.solid)break}if(!n)return!1;this.sync(s);for(let i=0;i<n.length;i++)this.enterInner(n[i],null,!1);return!0}insertNode(t){if(t.isInline&&this.needsBlock&&!this.top.type){let n=this.textblockFromContext();n&&this.enterInner(n)}if(this.findPlace(t)){this.closeExtra();let n=this.top;n.applyPending(t.type),n.match&&(n.match=n.match.matchType(t.type));let s=n.activeMarks;for(let i=0;i<t.marks.length;i++)(!n.type||n.type.allowsMarkType(t.marks[i].type))&&(s=t.marks[i].addToSet(s));return n.content.push(t.mark(s)),!0}return!1}enter(t,n,s){let i=this.findPlace(t.create(n));return i&&this.enterInner(t,n,!0,s),i}enterInner(t,n=null,s=!1,i){this.closeExtra();let a=this.top;a.applyPending(t),a.match=a.match&&a.match.matchType(t);let l=Vc(t,i,a.options);a.options&_r&&a.content.length==0&&(l|=_r),this.nodes.push(new gs(t,n,a.activeMarks,a.pendingMarks,s,null,l)),this.open++}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(t){for(let n=this.open;n>=0;n--)if(this.nodes[n]==t)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let s=this.nodes[n].content;for(let i=s.length-1;i>=0;i--)t+=s[i].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let s=0;s<this.find.length;s++)this.find[s].node==t&&this.find[s].offset==n&&(this.find[s].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,s){if(t!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&t.nodeType==1&&t.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(s?2:4)&&(this.find[i].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),s=this.options.context,i=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),a=-(s?s.depth+1:0)+(i?0:1),l=(c,u)=>{for(;c>=0;c--){let d=n[c];if(d==""){if(c==n.length-1||c==0)continue;for(;u>=a;u--)if(l(c-1,u))return!0;return!1}else{let h=u>0||u==0&&i?this.nodes[u].type:s&&u>=a?s.node(u-a).type:null;if(!h||h.name!=d&&h.groups.indexOf(d)==-1)return!1;u--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let s=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(s&&s.isTextblock&&s.defaultAttrs)return s}for(let n in this.parser.schema.nodes){let s=this.parser.schema.nodes[n];if(s.isTextblock&&s.defaultAttrs)return s}}addPendingMark(t){let n=cx(t,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)}removePendingMark(t,n){for(let s=this.open;s>=0;s--){let i=this.nodes[s];if(i.pendingMarks.lastIndexOf(t)>-1)i.pendingMarks=t.removeFromSet(i.pendingMarks);else{i.activeMarks=t.removeFromSet(i.activeMarks);let l=i.popFromStashMark(t);l&&i.type&&i.type.allowsMarkType(l.type)&&(i.activeMarks=l.addToSet(i.activeMarks))}if(i==n)break}}}function ix(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let s=t.nodeType==1?t.nodeName.toLowerCase():null;s&&Lc.hasOwnProperty(s)&&n?(n.appendChild(t),t=n):s=="li"?n=t:s&&(n=null)}}function ax(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ox(e){let t=/\s*([\w-]+)\s*:\s*([^;]+)/g,n,s=[];for(;n=t.exec(e);)s.push(n[1],n[2].trim());return s}function qc(e){let t={};for(let n in e)t[n]=e[n];return t}function lx(e,t){let n=t.schema.nodes;for(let s in n){let i=n[s];if(!i.allowsMarkType(e))continue;let a=[],l=c=>{a.push(c);for(let u=0;u<c.edgeCount;u++){let{type:d,next:h}=c.edge(u);if(d==t||a.indexOf(h)<0&&l(h))return!0}};if(l(i.contentMatch))return!0}}function cx(e,t){for(let n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}const Nc=65535,$c=Math.pow(2,16);function ux(e,t){return e+t*$c}function Fc(e){return e&Nc}function dx(e){return(e-(e&Nc))/$c}const Gc=1,Wc=2,ms=4,Rc=8;class Qc{constructor(t,n,s){this.pos=t,this.delInfo=n,this.recover=s}get deleted(){return(this.delInfo&Rc)>0}get deletedBefore(){return(this.delInfo&(Gc|ms))>0}get deletedAfter(){return(this.delInfo&(Wc|ms))>0}get deletedAcross(){return(this.delInfo&ms)>0}}class Ct{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Ct.empty)return Ct.empty}recover(t){let n=0,s=Fc(t);if(!this.inverted)for(let i=0;i<s;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[s*3]+n+dx(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,s){let i=0,a=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?i:0);if(u>t)break;let d=this.ranges[c+a],h=this.ranges[c+l],p=u+d;if(t<=p){let f=d?t==u?-1:t==p?1:n:n,m=u+i+(f<0?0:h);if(s)return m;let y=t==(n<0?u:p)?null:ux(c/3,t-u),_=t==u?Wc:t==p?Gc:ms;return(n<0?t!=u:t!=p)&&(_|=Rc),new Qc(m,_,y)}i+=h-d}return s?t+i:new Qc(t+i,0,null)}touches(t,n){let s=0,i=Fc(n),a=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?s:0);if(u>t)break;let d=this.ranges[c+a],h=u+d;if(t<=h&&c==i*3)return!0;s+=this.ranges[c+l]-d}return!1}forEach(t){let n=this.inverted?2:1,s=this.inverted?1:2;for(let i=0,a=0;i<this.ranges.length;i+=3){let l=this.ranges[i],c=l-(this.inverted?a:0),u=l+(this.inverted?0:a),d=this.ranges[i+n],h=this.ranges[i+s];t(c,c+d,u,u+h),a+=h-d}}invert(){return new Ct(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Ct.empty:new Ct(t<0?[0,-t,0]:[0,0,t])}}Ct.empty=new Ct([]);const Oi=Object.create(null);class it{getMap(){return Ct.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let s=Oi[n.stepType];if(!s)throw new RangeError(`No step type ${n.stepType} defined`);return s.fromJSON(t,n)}static jsonID(t,n){if(t in Oi)throw new RangeError("Duplicate use of step JSON ID "+t);return Oi[t]=n,n.prototype.jsonID=t,n}}class Ve{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Ve(t,null)}static fail(t){return new Ve(null,t)}static fromReplace(t,n,s,i){try{return Ve.ok(t.replace(n,s,i))}catch(a){if(a instanceof nx)return Ve.fail(a.message);throw a}}}function Li(e,t,n){let s=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(Li(a.content,t,a))),a.isInline&&(a=t(a,n,i)),s.push(a)}return pe.fromArray(s)}class Pn extends it{constructor(t,n,s){super(),this.from=t,this.to=n,this.mark=s}apply(t){let n=t.slice(this.from,this.to),s=t.resolve(this.from),i=s.node(s.sharedDepth(this.to)),a=new ve(Li(n.content,(l,c)=>!l.isAtom||!c.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),n.openStart,n.openEnd);return Ve.fromReplace(t,this.from,this.to,a)}invert(){return new On(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),s=t.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new Pn(n.pos,s.pos,this.mark)}merge(t){return t instanceof Pn&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Pn(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Pn(n.from,n.to,t.markFromJSON(n.mark))}}it.jsonID("addMark",Pn);class On extends it{constructor(t,n,s){super(),this.from=t,this.to=n,this.mark=s}apply(t){let n=t.slice(this.from,this.to),s=new ve(Li(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return Ve.fromReplace(t,this.from,this.to,s)}invert(){return new Pn(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),s=t.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new On(n.pos,s.pos,this.mark)}merge(t){return t instanceof On&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new On(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new On(n.from,n.to,t.markFromJSON(n.mark))}}it.jsonID("removeMark",On);class Ln extends it{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Ve.fail("No node at mark step's position");let s=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ve.fromReplace(t,this.pos,this.pos+1,new ve(pe.from(s),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let s=this.mark.addToSet(n.marks);if(s.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(s))return new Ln(this.pos,n.marks[i]);return new Ln(this.pos,this.mark)}}return new jr(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Ln(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ln(n.pos,t.markFromJSON(n.mark))}}it.jsonID("addNodeMark",Ln);class jr extends it{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Ve.fail("No node at mark step's position");let s=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Ve.fromReplace(t,this.pos,this.pos+1,new ve(pe.from(s),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ln(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new jr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new jr(n.pos,t.markFromJSON(n.mark))}}it.jsonID("removeNodeMark",jr);class Jt extends it{constructor(t,n,s,i=!1){super(),this.from=t,this.to=n,this.slice=s,this.structure=i}apply(t){return this.structure&&Vi(t,this.from,this.to)?Ve.fail("Structure replace would overwrite content"):Ve.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Ct([this.from,this.to-this.from,this.slice.size])}invert(t){return new Jt(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),s=t.mapResult(this.to,-1);return n.deletedAcross&&s.deletedAcross?null:new Jt(n.pos,Math.max(n.pos,s.pos),this.slice)}merge(t){if(!(t instanceof Jt)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?ve.empty:new ve(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Jt(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?ve.empty:new ve(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Jt(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Jt(n.from,n.to,ve.fromJSON(t,n.slice),!!n.structure)}}it.jsonID("replace",Jt);class Vn extends it{constructor(t,n,s,i,a,l,c=!1){super(),this.from=t,this.to=n,this.gapFrom=s,this.gapTo=i,this.slice=a,this.insert=l,this.structure=c}apply(t){if(this.structure&&(Vi(t,this.from,this.gapFrom)||Vi(t,this.gapTo,this.to)))return Ve.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Ve.fail("Gap is not a flat range");let s=this.slice.insertAt(this.insert,n.content);return s?Ve.fromReplace(t,this.from,this.to,s):Ve.fail("Content does not fit in gap")}getMap(){return new Ct([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new Vn(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),s=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),a=t.map(this.gapTo,1);return n.deletedAcross&&s.deletedAcross||i<n.pos||a>s.pos?null:new Vn(n.pos,s.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Vn(n.from,n.to,n.gapFrom,n.gapTo,ve.fromJSON(t,n.slice),n.insert,!!n.structure)}}it.jsonID("replaceAround",Vn);function Vi(e,t,n){let s=e.resolve(t),i=n-t,a=s.depth;for(;i>0&&a>0&&s.indexAfter(a)==s.node(a).childCount;)a--,i--;if(i>0){let l=s.node(a).maybeChild(s.indexAfter(a));for(;i>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,i--}}return!1}function px(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function hx(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let s=e.depth;;--s){let i=e.$from.node(s),a=e.$from.index(s),l=e.$to.indexAfter(s);if(s<e.depth&&i.canReplace(a,l,n))return s;if(s==0||i.type.spec.isolating||!px(i,a,l))break}return null}function xs(e,t,n=1,s){let i=e.resolve(t),a=i.depth-n,l=s&&s[s.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!l.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let d=i.depth-1,h=n-2;d>a;d--,h--){let p=i.node(d),f=i.index(d);if(p.type.spec.isolating)return!1;let m=p.content.cutByIndex(f,p.childCount),y=s&&s[h+1];y&&(m=m.replaceChild(0,y.type.create(y.attrs)));let _=s&&s[h]||p;if(!p.canReplace(f+1,p.childCount)||!_.type.validContent(m))return!1}let c=i.indexAfter(a),u=s&&s[0];return i.node(a).canReplaceWith(c,c,u?u.type:i.node(a+1).type)}function Uc(e,t){let n=e.resolve(t),s=n.index();return fx(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(s,s+1)}function fx(e,t){return!!(e&&t&&!e.isLeaf&&e.canAppend(t))}class wr extends it{constructor(t,n,s){super(),this.pos=t,this.attr=n,this.value=s}apply(t){let n=t.nodeAt(this.pos);if(!n)return Ve.fail("No node at attribute step's position");let s=Object.create(null);for(let a in n.attrs)s[a]=n.attrs[a];s[this.attr]=this.value;let i=n.type.create(s,null,n.marks);return Ve.fromReplace(t,this.pos,this.pos+1,new ve(pe.from(i),0,n.isLeaf?0:1))}getMap(){return Ct.empty}invert(t){return new wr(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new wr(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new wr(n.pos,n.attr,n.value)}}it.jsonID("attr",wr);let Cr=class extends Error{};Cr=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},Cr.prototype=Object.create(Error.prototype),Cr.prototype.constructor=Cr,Cr.prototype.name="TransformError";const Bi=Object.create(null);class De{constructor(t,n,s){this.$anchor=t,this.$head=n,this.ranges=s||[new gx(t.min(n),t.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=ve.empty){let s=n.content.lastChild,i=null;for(let c=0;c<n.openEnd;c++)i=s,s=s.lastChild;let a=t.steps.length,l=this.ranges;for(let c=0;c<l.length;c++){let{$from:u,$to:d}=l[c],h=t.mapping.slice(a);t.replaceRange(h.map(u.pos),h.map(d.pos),c?ve.empty:n),c==0&&Xc(t,a,(s?s.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(t,n){let s=t.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){let{$from:l,$to:c}=i[a],u=t.mapping.slice(s),d=u.map(l.pos),h=u.map(c.pos);a?t.deleteRange(d,h):(t.replaceRangeWith(d,h,n),Xc(t,s,n.isInline?-1:1))}}static findFrom(t,n,s=!1){let i=t.parent.inlineContent?new Be(t):Yn(t.node(0),t.parent,t.pos,t.index(),n,s);if(i)return i;for(let a=t.depth-1;a>=0;a--){let l=n<0?Yn(t.node(0),t.node(a),t.before(a+1),t.index(a),n,s):Yn(t.node(0),t.node(a),t.after(a+1),t.index(a)+1,n,s);if(l)return l}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new ln(t.node(0))}static atStart(t){return Yn(t,t,0,0,1)||new ln(t)}static atEnd(t){return Yn(t,t,t.content.size,t.childCount,-1)||new ln(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=Bi[n.type];if(!s)throw new RangeError(`No selection type ${n.type} defined`);return s.fromJSON(t,n)}static jsonID(t,n){if(t in Bi)throw new RangeError("Duplicate use of selection JSON ID "+t);return Bi[t]=n,n.prototype.jsonID=t,n}getBookmark(){return Be.between(this.$anchor,this.$head).getBookmark()}}De.prototype.visible=!0;class gx{constructor(t,n){this.$from=t,this.$to=n}}let Yc=!1;function Kc(e){!Yc&&!e.parent.inlineContent&&(Yc=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Be extends De{constructor(t,n=t){Kc(t),Kc(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let s=t.resolve(n.map(this.head));if(!s.parent.inlineContent)return De.near(s);let i=t.resolve(n.map(this.anchor));return new Be(i.parent.inlineContent?i:s,s)}replace(t,n=ve.empty){if(super.replace(t,n),n==ve.empty){let s=this.$from.marksAcross(this.$to);s&&t.ensureMarks(s)}}eq(t){return t instanceof Be&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new ys(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Be(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,s=n){let i=t.resolve(n);return new this(i,s==n?i:t.resolve(s))}static between(t,n,s){let i=t.pos-n.pos;if((!s||i)&&(s=i>=0?1:-1),!n.parent.inlineContent){let a=De.findFrom(n,s,!0)||De.findFrom(n,-s,!0);if(a)n=a.$head;else return De.near(n,s)}return t.parent.inlineContent||(i==0?t=n:(t=(De.findFrom(t,-s,!0)||De.findFrom(t,s,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new Be(t,n)}}De.jsonID("text",Be);class ys{constructor(t,n){this.anchor=t,this.head=n}map(t){return new ys(t.map(this.anchor),t.map(this.head))}resolve(t){return Be.between(t.resolve(this.anchor),t.resolve(this.head))}}class mt extends De{constructor(t){let n=t.nodeAfter,s=t.node(0).resolve(t.pos+n.nodeSize);super(t,s),this.node=n}map(t,n){let{deleted:s,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return s?De.near(a):new mt(a)}content(){return new ve(pe.from(this.node),0,0)}eq(t){return t instanceof mt&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new qi(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new mt(t.resolve(n.anchor))}static create(t,n){return new mt(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}mt.prototype.visible=!1,De.jsonID("node",mt);class qi{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:s}=t.mapResult(this.anchor);return n?new ys(s,s):new qi(s)}resolve(t){let n=t.resolve(this.anchor),s=n.nodeAfter;return s&&mt.isSelectable(s)?new mt(n):De.near(n)}}class ln extends De{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=ve.empty){if(n==ve.empty){t.delete(0,t.doc.content.size);let s=De.atStart(t.doc);s.eq(t.selection)||t.setSelection(s)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new ln(t)}map(t){return new ln(t)}eq(t){return t instanceof ln}getBookmark(){return mx}}De.jsonID("all",ln);const mx={map(){return this},resolve(e){return new ln(e)}};function Yn(e,t,n,s,i,a=!1){if(t.inlineContent)return Be.create(e,n);for(let l=s-(i>0?0:1);i>0?l<t.childCount:l>=0;l+=i){let c=t.child(l);if(c.isAtom){if(!a&&mt.isSelectable(c))return mt.create(e,n-(i<0?c.nodeSize:0))}else{let u=Yn(e,c,n+i,i<0?c.childCount:0,i,a);if(u)return u}n+=c.nodeSize*i}return null}function Xc(e,t,n){let s=e.steps.length-1;if(s<t)return;let i=e.steps[s];if(!(i instanceof Jt||i instanceof Vn))return;let a=e.mapping.maps[s],l;a.forEach((c,u,d,h)=>{l==null&&(l=h)}),e.setSelection(De.near(e.doc.resolve(l),n))}function Jc(e,t){return!t||!e?e:e.bind(t)}class bs{constructor(t,n,s){this.name=t,this.init=Jc(n.init,s),this.apply=Jc(n.apply,s)}}new bs("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new bs("selection",{init(e,t){return e.selection||De.atStart(t.doc)},apply(e){return e.selection}}),new bs("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,s){return s.selection.$cursor?e.storedMarks:null}}),new bs("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}});function Zc(e,t,n){for(let s in e){let i=e[s];i instanceof Function?i=i.bind(t):s=="handleDOMEvents"&&(i=Zc(i,t,{})),n[s]=i}return n}let Sr=class{constructor(t){this.spec=t,this.props={},t.props&&Zc(t.props,this,this.props),this.key=t.key?t.key.key:Hc("plugin")}getState(t){return t[this.key]}};const Ni=Object.create(null);function Hc(e){return e in Ni?e+"$"+ ++Ni[e]:(Ni[e]=0,e+"$")}class kr{constructor(t="key"){this.key=Hc(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}function eu(e){const{state:t,transaction:n}=e;let{selection:s}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),filterTransaction:t.filterTransaction,plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return s},get doc(){return i},get tr(){return s=n.selection,i=n.doc,a=n.storedMarks,n}}}class xx{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:n,state:s}=this,{view:i}=n,{tr:a}=s,l=this.buildProps(a);return Object.fromEntries(Object.entries(t).map(([c,u])=>[c,(...h)=>{const p=u(...h)(l);return!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,n=!0){const{rawCommands:s,editor:i,state:a}=this,{view:l}=i,c=[],u=!!t,d=t||a.tr,h=()=>(!u&&n&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(d),c.every(f=>f===!0)),p={...Object.fromEntries(Object.entries(s).map(([f,m])=>[f,(..._)=>{const k=this.buildProps(d,n),S=m(..._)(k);return c.push(S),p}])),run:h};return p}createCan(t){const{rawCommands:n,state:s}=this,i=!1,a=t||s.tr,l=this.buildProps(a,i);return{...Object.fromEntries(Object.entries(n).map(([u,d])=>[u,(...h)=>d(...h)({...l,dispatch:void 0})])),chain:()=>this.createChain(a,i)}}buildProps(t,n=!0){const{rawCommands:s,editor:i,state:a}=this,{view:l}=i;a.storedMarks&&t.setStoredMarks(a.storedMarks);const c={tr:t,editor:i,view:l,state:eu({state:a,transaction:t}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(t),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(s).map(([u,d])=>[u,(...h)=>d(...h)(c)]))}};return c}}function xt(e,t,n){return e.config[t]===void 0&&e.parent?xt(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?xt(e.parent,t,n):null}):e.config[t]}function yx(e){const t=e.filter(i=>i.type==="extension"),n=e.filter(i=>i.type==="node"),s=e.filter(i=>i.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:s}}function Xe(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function bx(e){return typeof e=="function"}function Ot(e,t=void 0,...n){return bx(e)?t?e.bind(t)(...n):e(...n):e}function vx(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function _x(e){return Object.prototype.toString.call(e).slice(8,-1)}function $i(e){return _x(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Fi(e,t){const n={...e};return $i(e)&&$i(t)&&Object.keys(t).forEach(s=>{$i(t[s])?s in e?n[s]=Fi(e[s],t[s]):Object.assign(n,{[s]:t[s]}):Object.assign(n,{[s]:t[s]})}),n}class Zt{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ot(xt(this,"addOptions",{name:this.name}))),this.storage=Ot(xt(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Zt(t)}configure(t={}){const n=this.extend();return n.options=Fi(this.options,t),n.storage=Ot(xt(n,"addStorage",{name:n.name,options:n.options})),n}extend(t={}){const n=new Zt(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Ot(xt(n,"addOptions",{name:n.name})),n.storage=Ot(xt(n,"addStorage",{name:n.name,options:n.options})),n}}function jx(e,t,n){const{from:s,to:i}=t,{blockSeparator:a=`
|
|
@@ -89,7 +89,7 @@ Check the top-level render call using <`+q+">.")}return A}}function $g(C,A){{if(
|
|
|
89
89
|
${Object.entries(t).map(([s,i])=>`const ${s} = '${i}';`).join(`
|
|
90
90
|
`)}
|
|
91
91
|
return ${e};
|
|
92
|
-
`)(n)}catch(s){return console.error(s),console.log(e),e}}function Np(e,t,n,s){const i=w_(t,s);return e.replaceAll(/(\{\{([^{\}]+(?=}))\}\})/g,(...l)=>{const c=l[2];if(!c)return c;const u=i[c];if(u)return u;const d=C_(c);return S_(d,i,n)})}function k_(e,t){const n=xc.decode(t);n!==e&&(console.error("Inconsistent sql"),console.groupCollapsed("Inconsistent sql"),console.table({before:e,after:t,v:n}),console.groupEnd())}async function T_({query:e,name:t,payload:n,additionals:s},i){if(!e.sql)return[];const{type:a,key:l,sql:c,pre_process:u,post_process:d}=e,h=Di(c,n),p=Wm({sql:h,pre_process:u}),f=xc.encode(p);k_(p,f);let m=await Kt.query(i)({type:a,key:l,query:f,...s},{params:{name:t}});return m=Rm(d,m,po(n)),m}async function D_({type:e,key:t,configString:n,name:s,additionals:i},a){try{return await Kt.httpDataSourceQuery(a)({type:e,key:t,query:n,...i},{params:{name:s}})}catch(l){if(Rt.isCancel(l))throw l;return console.error(l),l}}async function ho(){try{return(await Kt.post()("/datasource/list",{filter:{},sort:[{field:"create_time",order:"ASC"}],pagination:{page:1,pagesize:100}},{})).data}catch(e){return console.error(e),[]}}async function $p(){try{return(await Kt.post()("/sql_snippet/list",{filter:{},sort:[{field:"id",order:"ASC"}],pagination:{page:1,pagesize:1e3}},{})).data}catch(e){return console.error(e),[]}}class Fp{constructor(t){N(this,"rootRef");this.rootRef=ae.observable({current:t})}async deleteItem(t){ae.runInAction(()=>{v.unset(this.rootRef.current,[t])})}getItem(t){const n=this.getValueFromRoot(t);return Promise.resolve(n)}getValueFromRoot(t){return t===null?ae.toJS(this.rootRef.current):v.get(this.rootRef.current,[t])}setItem(t,n){if(t===null)if(v.isObject(n))ae.runInAction(()=>{this.rootRef.current=n});else throw new Error("Cannot set root value to non-object");else ae.runInAction(()=>{v.set(this.rootRef.current,[t],n)});return Promise.resolve(this.getItem(t))}watchItem(t,n,s){return ae.reaction(()=>this.getValueFromRoot(t),(i,a)=>{n(i,a)},{requiresObservable:!0,fireImmediately:v.get(s,"fireImmediately",!1)})}}class M_{constructor(){N(this,"channels",new Map);N(this,"globalChannel",new yc)}getChannel(t){const n=this.channels.get(t);if(n)return n;const s=new yc;return this.channels.set(t,s),s}}class I_{constructor(t){N(this,"instances",new Map);this.pluginManager=t}get availableVizList(){return this.pluginManager.installedPlugins.flatMap(t=>t.manifest.viz)}resolveComponent(t){return this.pluginManager.factory.viz(t)}getOrCreateInstance(t){const n=this.instances.get(t.id);if(n)return n;const s={id:t.id,name:t.viz.type,type:t.viz.type,messageChannels:new M_,instanceData:new Fp(t.viz.conf)};return this.instances.set(t.id,s),s}}function Gp(e,t,n,s){return{vizManager:n,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new Fp({}),colorPalette:{getColor(){return()=>""}},data:t,variables:s}}const z_=e=>{const{panel:t,measure:n,vizManager:s,data:i,variables:a}=e,l=s.resolveComponent(t.viz.type),c=s.getOrCreateInstance(t),u={...Gp(c,i,s,a),viewport:{width:n.w,height:n.h}},d=l.viewRender;return r.jsx(d,{context:u,instance:c,...v.omit(e,["panel","vizManager","data"])})},E_=e=>{const{vizManager:t,panel:n,data:s,variables:i}=e,a=t.resolveComponent(n.viz.type),l=t.getOrCreateInstance(n),c={...Gp(l,s,t,i)},u=a.configRender;return r.jsx(u,{context:c,instance:l,...v.omit(e,["panel","vizManager","data"])})},Wp=(e,t)=>{const n=Ut.bezier(e),s=Ut.bezier(t);return function(i){return i<50?n(i*2/100).hex():s((i-50)*2/100).hex()}},Js=e=>{const t=Ut.bezier(e);return function(n){return t(n/100).hex()}},A_={type:"interpolation",displayName:"style.color.interpolation.palette.red_green",getColor:Wp(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},P_={type:"interpolation",displayName:"style.color.interpolation.palette.yellow_blue",getColor:Wp(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},O_={type:"interpolation",displayName:"style.color.interpolation.palette.red",getColor:Js(["#fff7f1","darkred"]),name:"red",category:"sequential"},L_={type:"interpolation",displayName:"style.color.interpolation.palette.green",getColor:Js(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},V_={type:"interpolation",displayName:"style.color.interpolation.palette.blue",getColor:Js(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},B_={type:"interpolation",displayName:"style.color.interpolation.palette.orange",getColor:Js(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class q_{constructor(t){N(this,"symbol");this.symbol=Symbol(t)}}function hn(e){return new q_(e)}class fo{constructor(){N(this,"parent");N(this,"factoryRegistry",new Map);N(this,"instanceRegistry",new Map)}createScoped(){const t=new fo;return t.parent=this,t}getRequired(t){return this.get(t)}get(t){if(this.instanceRegistry.has(t.symbol))return this.instanceRegistry.get(t.symbol);const n=this.factoryRegistry.get(t.symbol);if(n){const s=n(this);return this.instanceRegistry.set(t.symbol,s),s}if(this.parent)return this.parent.get(t)}provideFactory(t,n){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,n),this}provideValue(t,n){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,()=>n),this}dispose(){this.instanceRegistry.forEach(t=>{const n=v.get(t,"dispose");v.isFunction(n)&&n.bind(t)()}),this.instanceRegistry.clear(),this.factoryRegistry.clear()}}const Rp="13.28.2",N_=Object.freeze(Object.defineProperty({__proto__:null,version:Rp},Symbol.toStringTag,{value:"Module"}));class $_{constructor(t){N(this,"staticColors",new Map);N(this,"interpolations",new Map);t.installedPlugins.forEach(n=>{n.manifest.color.forEach(s=>{this.register(s)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(t){const n=this.encodeColor(t);t.type==="single"?(this.staticColors.has(n)&&console.warn(`the color '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.staticColors.set(n,t)):t.type==="interpolation"&&(this.interpolations.has(n)&&console.warn(`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`,`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.interpolations.set(n,t))}decodeStaticColor(t){return this.staticColors.get(t)}encodeColor(t){return`\${${t.category}}.{${t.name}}`}decodeInterpolation(t){return this.interpolations.get(t)}getColorInterpolations(){return Array.from(this.interpolations.values())}}class F_{constructor(){N(this,"plugins",new Map);N(this,"vizComponents",new Map);N(this,"factory",{viz:t=>{const n=this.vizComponents.get(t);if(n)return n;throw new Error(`Viz Component (${t}) not found`)}})}install(t){if(this.plugins.has(t.id))throw new Error(`Plugin (${t.id}) has been installed before`);this.plugins.set(t.id,t);for(const n of t.manifest.viz){if(this.vizComponents.has(n.name))throw new Error(`Viz Component (${n.name}) has been installed before`);this.vizComponents.set(n.name,n)}}get installedPlugins(){return Array.from(this.plugins.values())}}class G_{constructor(){N(this,"migrations",[])}version(t,n){return this.migrations.push({version:t,handler:n}),this}run(t,n,s){var l;if(t.from===t.to)return n;if(t.from>t.to)throw new Error(`Can not downgrade from version '${t.from}' to (${t.to})`);const i=this.migrations.filter(c=>c.version>t.from&&c.version<=t.to),a=v.orderBy(i,"version","asc");if(((l=v.last(a))==null?void 0:l.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return a.reduce((c,u)=>u.handler(c,s),n)}}class Me extends G_{constructor(){super(),this.configVersions()}version(t,n){return super.version(t,(s,i)=>({version:t,...n(s,i)}))}async migrate({configData:t,panelModel:n}){const s=await t.getItem(null),i=v.get(s,"version",0),a=this.run({from:i,to:this.VERSION},s,{panelModel:n});await t.setItem(null,a)}async needMigration({configData:t}){const n=await t.getItem(null);return v.get(n,"version",0)<this.VERSION}}const Q=(e,t)=>{const[n,{setFalse:s}]=J.useBoolean(!0),[i,a]=g.useState();g.useEffect(()=>(e.getItem(t).then(c=>{a(c),s()}),e.watchItem(t,c=>{a(c)})));const l=g.useCallback(async c=>{await e.setItem(t,c),a(c)},[e,t]);return{loading:n,value:i,set:l}},ut={top:16,right:16,bottom:16,left:16},Bt=e=>Math.max(0,e-ut.left-ut.right),qt=e=>Math.max(0,e-ut.top-ut.bottom),Jr=(e,t)=>({width:Bt(e),height:qt(t)}),dt=({width:e,height:t,children:n})=>r.jsx(o.Box,{pt:ut.top,pr:ut.right,pb:ut.bottom,pl:ut.left,sx:{width:e,height:t,overflow:"hidden",position:"relative"},children:n}),go={x_axis_data_key:"",y_axis_data_key:"",z_axis_data_key:"",xAxis3D:{type:"value",name:"X Axis Name"},yAxis3D:{type:"value",name:"Y Axis Name"},zAxis3D:{type:"value",name:"Z Axis Name"}};function W_({context:e}){const{value:t}=Q(e.instanceData,"config"),n=e.data,{width:s,height:i}=e.viewport,{x_axis_data_key:a,y_axis_data_key:l,z_axis_data_key:c,xAxis3D:u,yAxis3D:d,zAxis3D:h}=v.defaults({},t,go),p=g.useMemo(()=>cs(n,a),[n,a]),{x:f,y:m,z:y}=g.useMemo(()=>({x:L(a),y:L(l),z:L(c)}),[a,l,c]),{min:_,max:k}=g.useMemo(()=>{const T=v.minBy(p,z=>z[y.columnKey]),I=v.maxBy(p,z=>z[y.columnKey]);return{min:v.get(T,y.columnKey),max:v.get(I,y.columnKey)}},[p,y]),S={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:_,max:k,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:u,yAxis3D:d,zAxis3D:h,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:p.map(T=>[T[f.columnKey],T[m.columnKey],T[y.columnKey]])}]};return t?r.jsx(dt,{width:s,height:i,children:r.jsx(Ke,{echarts:Ye,option:S,style:Jr(s,i),notMerge:!0,theme:"merico-light"})}):null}const U=D.observer(g.forwardRef(({label:e,required:t,description:n,value:s,onChange:i,queryID:a,clearable:l=!1,sx:c,...u},d)=>{const{panel:h}=Je(),p=g.useMemo(()=>h.dataFieldOptions(s,l,a),[s,l,a]);if(p.length===0){const f=h.explainDataKey(s);return r.jsxs(o.HoverCard,{shadow:"md",position:"bottom-start",withinPortal:!0,zIndex:320,children:[r.jsx(o.HoverCard.Target,{children:r.jsx(o.Box,{children:r.jsx(o.TextInput,{label:e,required:t,defaultValue:f.columnKey,readOnly:!0,disabled:!0})})}),r.jsx(o.HoverCard.Dropdown,{children:r.jsxs(o.Group,{position:"left",spacing:0,children:[r.jsx(o.Text,{size:"xs",color:f.queryName?"black":"red",sx:{fontFamily:"monospace"},children:f.queryName??f.queryID}),r.jsx(o.Text,{size:"xs",color:"black",sx:{fontFamily:"monospace"},children:"."}),r.jsx(o.Text,{size:"xs",color:"red",sx:{fontFamily:"monospace"},children:f.columnKey})]})})]})}return r.jsx(o.Select,{ref:d,label:e,description:n,data:p,value:s,onChange:i,required:t,sx:c,maxDropdownHeight:500,...u})}));function R_({context:e}){const{value:t,set:n}=Q(e.instanceData,"config"),s=v.defaults({},t,go),{control:i,handleSubmit:a,reset:l}=b.useForm({defaultValues:s});return g.useEffect(()=>{l(s)},[t]),t?r.jsx(o.Stack,{spacing:"xs",children:r.jsxs("form",{onSubmit:a(n),children:[r.jsx(o.Text,{children:"X Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(b.Controller,{name:"x_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"xAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Text,{mt:"lg",children:"Y Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(b.Controller,{name:"y_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"yAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Text,{mt:"lg",children:"Z Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(b.Controller,{name:"z_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"zAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Group,{position:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:r.jsxs(o.Button,{color:"blue",type:"submit",children:[r.jsx(W.DeviceFloppy,{size:20}),r.jsx(o.Text,{ml:"md",children:"Save"})]})})]})}):null}const Q_=[{lang:"en",resources:{bar_chart_3d:{viz_name:"Bar Chart(3D)"}}},{lang:"zh",resources:{bar_chart_3d:{viz_name:"柱图(3D)"}}}];function U_(e,{panelModel:t}){try{const n=t.queryIDs[0];if(!n)throw new Error("cannot migrate when queryID is empty");const s=u=>u&&`${n}.${u}`,{x_axis_data_key:i,y_axis_data_key:a,z_axis_data_key:l,...c}=e;return{...c,x_axis_data_key:s(i),y_axis_data_key:s(a),z_axis_data_key:s(l)}}catch(n){throw console.error("[Migration failed]",n),n}}class Y_ extends Me{constructor(){super(...arguments);N(this,"VERSION",2)}configVersions(){this.version(1,n=>({version:1,config:n})),this.version(2,(n,s)=>{const{config:i}=n;return{...n,version:2,config:U_(i,s)}})}}const K_={displayName:"viz.bar_chart_3d.viz_name",displayGroup:"chart.groups.echarts_based_charts",migrator:new Y_,name:"bar-3d",viewRender:W_,configRender:R_,createConfig(){return{version:2,config:v.cloneDeep(go)}},translation:Q_},X_=({disabled:e,value:t,onChange:n})=>{const s=i=>{i&&n(i)};return r.jsxs(o.Box,{sx:{position:"relative"},children:[e&&r.jsx(o.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),r.jsx(gt,{height:"500px",defaultLanguage:"javascript",value:t,onChange:s,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:e}})]})};function pt({enabled:e,func_content:t}){return(n,s)=>{if(!e)return n;try{return new Function(`return ${t}`)()(n,s)}catch(i){return console.error(`[getEchartsXAxisLabel] failed parsing custom function, error: ${i.message}`),n}}}function nt(){return{enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
|
|
92
|
+
`)(n)}catch(s){return console.error(s),console.log(e),e}}function Np(e,t,n,s){const i=w_(t,s);return e.replaceAll(/(\{\{([^{\}]+(?=}))\}\})/g,(...l)=>{const c=l[2];if(!c)return c;const u=i[c];if(u)return u;const d=C_(c);return S_(d,i,n)})}function k_(e,t){const n=xc.decode(t);n!==e&&(console.error("Inconsistent sql"),console.groupCollapsed("Inconsistent sql"),console.table({before:e,after:t,v:n}),console.groupEnd())}async function T_({query:e,name:t,payload:n,additionals:s},i){if(!e.sql)return[];const{type:a,key:l,sql:c,pre_process:u,post_process:d}=e,h=Di(c,n),p=Wm({sql:h,pre_process:u}),f=xc.encode(p);k_(p,f);let m=await Kt.query(i)({type:a,key:l,query:f,...s},{params:{name:t}});return m=Rm(d,m,po(n)),m}async function D_({type:e,key:t,configString:n,name:s,additionals:i},a){try{return await Kt.httpDataSourceQuery(a)({type:e,key:t,query:n,...i},{params:{name:s}})}catch(l){if(Rt.isCancel(l))throw l;return console.error(l),l}}async function ho(){try{return(await Kt.post()("/datasource/list",{filter:{},sort:[{field:"create_time",order:"ASC"}],pagination:{page:1,pagesize:100}},{})).data}catch(e){return console.error(e),[]}}async function $p(){try{return(await Kt.post()("/sql_snippet/list",{filter:{},sort:[{field:"id",order:"ASC"}],pagination:{page:1,pagesize:1e3}},{})).data}catch(e){return console.error(e),[]}}class Fp{constructor(t){N(this,"rootRef");this.rootRef=ae.observable({current:t})}async deleteItem(t){ae.runInAction(()=>{v.unset(this.rootRef.current,[t])})}getItem(t){const n=this.getValueFromRoot(t);return Promise.resolve(n)}getValueFromRoot(t){return t===null?ae.toJS(this.rootRef.current):v.get(this.rootRef.current,[t])}setItem(t,n){if(t===null)if(v.isObject(n))ae.runInAction(()=>{this.rootRef.current=n});else throw new Error("Cannot set root value to non-object");else ae.runInAction(()=>{v.set(this.rootRef.current,[t],n)});return Promise.resolve(this.getItem(t))}watchItem(t,n,s){return ae.reaction(()=>this.getValueFromRoot(t),(i,a)=>{n(i,a)},{requiresObservable:!0,fireImmediately:v.get(s,"fireImmediately",!1)})}}class M_{constructor(){N(this,"channels",new Map);N(this,"globalChannel",new yc)}getChannel(t){const n=this.channels.get(t);if(n)return n;const s=new yc;return this.channels.set(t,s),s}}class I_{constructor(t){N(this,"instances",new Map);this.pluginManager=t}get availableVizList(){return this.pluginManager.installedPlugins.flatMap(t=>t.manifest.viz)}resolveComponent(t){return this.pluginManager.factory.viz(t)}getOrCreateInstance(t){const n=this.instances.get(t.id);if(n)return n;const s={id:t.id,name:t.viz.type,type:t.viz.type,messageChannels:new M_,instanceData:new Fp(t.viz.conf)};return this.instances.set(t.id,s),s}}function Gp(e,t,n,s){return{vizManager:n,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new Fp({}),colorPalette:{getColor(){return()=>""}},data:t,variables:s}}const z_=e=>{const{panel:t,measure:n,vizManager:s,data:i,variables:a}=e,l=s.resolveComponent(t.viz.type),c=s.getOrCreateInstance(t),u={...Gp(c,i,s,a),viewport:{width:n.w,height:n.h}},d=l.viewRender;return r.jsx(d,{context:u,instance:c,...v.omit(e,["panel","vizManager","data"])})},E_=e=>{const{vizManager:t,panel:n,data:s,variables:i}=e,a=t.resolveComponent(n.viz.type),l=t.getOrCreateInstance(n),c={...Gp(l,s,t,i)},u=a.configRender;return r.jsx(u,{context:c,instance:l,...v.omit(e,["panel","vizManager","data"])})},Wp=(e,t)=>{const n=Ut.bezier(e),s=Ut.bezier(t);return function(i){return i<50?n(i*2/100).hex():s((i-50)*2/100).hex()}},Js=e=>{const t=Ut.bezier(e);return function(n){return t(n/100).hex()}},A_={type:"interpolation",displayName:"style.color.interpolation.palette.red_green",getColor:Wp(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},P_={type:"interpolation",displayName:"style.color.interpolation.palette.yellow_blue",getColor:Wp(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},O_={type:"interpolation",displayName:"style.color.interpolation.palette.red",getColor:Js(["#fff7f1","darkred"]),name:"red",category:"sequential"},L_={type:"interpolation",displayName:"style.color.interpolation.palette.green",getColor:Js(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},V_={type:"interpolation",displayName:"style.color.interpolation.palette.blue",getColor:Js(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},B_={type:"interpolation",displayName:"style.color.interpolation.palette.orange",getColor:Js(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class q_{constructor(t){N(this,"symbol");this.symbol=Symbol(t)}}function hn(e){return new q_(e)}class fo{constructor(){N(this,"parent");N(this,"factoryRegistry",new Map);N(this,"instanceRegistry",new Map)}createScoped(){const t=new fo;return t.parent=this,t}getRequired(t){return this.get(t)}get(t){if(this.instanceRegistry.has(t.symbol))return this.instanceRegistry.get(t.symbol);const n=this.factoryRegistry.get(t.symbol);if(n){const s=n(this);return this.instanceRegistry.set(t.symbol,s),s}if(this.parent)return this.parent.get(t)}provideFactory(t,n){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,n),this}provideValue(t,n){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,()=>n),this}dispose(){this.instanceRegistry.forEach(t=>{const n=v.get(t,"dispose");v.isFunction(n)&&n.bind(t)()}),this.instanceRegistry.clear(),this.factoryRegistry.clear()}}const Rp="13.28.3",N_=Object.freeze(Object.defineProperty({__proto__:null,version:Rp},Symbol.toStringTag,{value:"Module"}));class $_{constructor(t){N(this,"staticColors",new Map);N(this,"interpolations",new Map);t.installedPlugins.forEach(n=>{n.manifest.color.forEach(s=>{this.register(s)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(t){const n=this.encodeColor(t);t.type==="single"?(this.staticColors.has(n)&&console.warn(`the color '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.staticColors.set(n,t)):t.type==="interpolation"&&(this.interpolations.has(n)&&console.warn(`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`,`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.interpolations.set(n,t))}decodeStaticColor(t){return this.staticColors.get(t)}encodeColor(t){return`\${${t.category}}.{${t.name}}`}decodeInterpolation(t){return this.interpolations.get(t)}getColorInterpolations(){return Array.from(this.interpolations.values())}}class F_{constructor(){N(this,"plugins",new Map);N(this,"vizComponents",new Map);N(this,"factory",{viz:t=>{const n=this.vizComponents.get(t);if(n)return n;throw new Error(`Viz Component (${t}) not found`)}})}install(t){if(this.plugins.has(t.id))throw new Error(`Plugin (${t.id}) has been installed before`);this.plugins.set(t.id,t);for(const n of t.manifest.viz){if(this.vizComponents.has(n.name))throw new Error(`Viz Component (${n.name}) has been installed before`);this.vizComponents.set(n.name,n)}}get installedPlugins(){return Array.from(this.plugins.values())}}class G_{constructor(){N(this,"migrations",[])}version(t,n){return this.migrations.push({version:t,handler:n}),this}run(t,n,s){var l;if(t.from===t.to)return n;if(t.from>t.to)throw new Error(`Can not downgrade from version '${t.from}' to (${t.to})`);const i=this.migrations.filter(c=>c.version>t.from&&c.version<=t.to),a=v.orderBy(i,"version","asc");if(((l=v.last(a))==null?void 0:l.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return a.reduce((c,u)=>u.handler(c,s),n)}}class Me extends G_{constructor(){super(),this.configVersions()}version(t,n){return super.version(t,(s,i)=>({version:t,...n(s,i)}))}async migrate({configData:t,panelModel:n}){const s=await t.getItem(null),i=v.get(s,"version",0),a=this.run({from:i,to:this.VERSION},s,{panelModel:n});await t.setItem(null,a)}async needMigration({configData:t}){const n=await t.getItem(null);return v.get(n,"version",0)<this.VERSION}}const Q=(e,t)=>{const[n,{setFalse:s}]=J.useBoolean(!0),[i,a]=g.useState();g.useEffect(()=>(e.getItem(t).then(c=>{a(c),s()}),e.watchItem(t,c=>{a(c)})));const l=g.useCallback(async c=>{await e.setItem(t,c),a(c)},[e,t]);return{loading:n,value:i,set:l}},ut={top:16,right:16,bottom:16,left:16},Bt=e=>Math.max(0,e-ut.left-ut.right),qt=e=>Math.max(0,e-ut.top-ut.bottom),Jr=(e,t)=>({width:Bt(e),height:qt(t)}),dt=({width:e,height:t,children:n})=>r.jsx(o.Box,{pt:ut.top,pr:ut.right,pb:ut.bottom,pl:ut.left,sx:{width:e,height:t,overflow:"hidden",position:"relative"},children:n}),go={x_axis_data_key:"",y_axis_data_key:"",z_axis_data_key:"",xAxis3D:{type:"value",name:"X Axis Name"},yAxis3D:{type:"value",name:"Y Axis Name"},zAxis3D:{type:"value",name:"Z Axis Name"}};function W_({context:e}){const{value:t}=Q(e.instanceData,"config"),n=e.data,{width:s,height:i}=e.viewport,{x_axis_data_key:a,y_axis_data_key:l,z_axis_data_key:c,xAxis3D:u,yAxis3D:d,zAxis3D:h}=v.defaults({},t,go),p=g.useMemo(()=>cs(n,a),[n,a]),{x:f,y:m,z:y}=g.useMemo(()=>({x:L(a),y:L(l),z:L(c)}),[a,l,c]),{min:_,max:k}=g.useMemo(()=>{const T=v.minBy(p,z=>z[y.columnKey]),I=v.maxBy(p,z=>z[y.columnKey]);return{min:v.get(T,y.columnKey),max:v.get(I,y.columnKey)}},[p,y]),S={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:_,max:k,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:u,yAxis3D:d,zAxis3D:h,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:p.map(T=>[T[f.columnKey],T[m.columnKey],T[y.columnKey]])}]};return t?r.jsx(dt,{width:s,height:i,children:r.jsx(Ke,{echarts:Ye,option:S,style:Jr(s,i),notMerge:!0,theme:"merico-light"})}):null}const U=D.observer(g.forwardRef(({label:e,required:t,description:n,value:s,onChange:i,queryID:a,clearable:l=!1,sx:c,...u},d)=>{const{panel:h}=Je(),p=g.useMemo(()=>h.dataFieldOptions(s,l,a),[s,l,a]);if(p.length===0){const f=h.explainDataKey(s);return r.jsxs(o.HoverCard,{shadow:"md",position:"bottom-start",withinPortal:!0,zIndex:320,children:[r.jsx(o.HoverCard.Target,{children:r.jsx(o.Box,{children:r.jsx(o.TextInput,{label:e,required:t,defaultValue:f.columnKey,readOnly:!0,disabled:!0})})}),r.jsx(o.HoverCard.Dropdown,{children:r.jsxs(o.Group,{position:"left",spacing:0,children:[r.jsx(o.Text,{size:"xs",color:f.queryName?"black":"red",sx:{fontFamily:"monospace"},children:f.queryName??f.queryID}),r.jsx(o.Text,{size:"xs",color:"black",sx:{fontFamily:"monospace"},children:"."}),r.jsx(o.Text,{size:"xs",color:"red",sx:{fontFamily:"monospace"},children:f.columnKey})]})})]})}return r.jsx(o.Select,{ref:d,label:e,description:n,data:p,value:s,onChange:i,required:t,sx:c,maxDropdownHeight:500,...u})}));function R_({context:e}){const{value:t,set:n}=Q(e.instanceData,"config"),s=v.defaults({},t,go),{control:i,handleSubmit:a,reset:l}=b.useForm({defaultValues:s});return g.useEffect(()=>{l(s)},[t]),t?r.jsx(o.Stack,{spacing:"xs",children:r.jsxs("form",{onSubmit:a(n),children:[r.jsx(o.Text,{children:"X Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(b.Controller,{name:"x_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"xAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Text,{mt:"lg",children:"Y Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(b.Controller,{name:"y_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"yAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Text,{mt:"lg",children:"Z Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(b.Controller,{name:"z_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"zAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Group,{position:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:r.jsxs(o.Button,{color:"blue",type:"submit",children:[r.jsx(W.DeviceFloppy,{size:20}),r.jsx(o.Text,{ml:"md",children:"Save"})]})})]})}):null}const Q_=[{lang:"en",resources:{bar_chart_3d:{viz_name:"Bar Chart(3D)"}}},{lang:"zh",resources:{bar_chart_3d:{viz_name:"柱图(3D)"}}}];function U_(e,{panelModel:t}){try{const n=t.queryIDs[0];if(!n)throw new Error("cannot migrate when queryID is empty");const s=u=>u&&`${n}.${u}`,{x_axis_data_key:i,y_axis_data_key:a,z_axis_data_key:l,...c}=e;return{...c,x_axis_data_key:s(i),y_axis_data_key:s(a),z_axis_data_key:s(l)}}catch(n){throw console.error("[Migration failed]",n),n}}class Y_ extends Me{constructor(){super(...arguments);N(this,"VERSION",2)}configVersions(){this.version(1,n=>({version:1,config:n})),this.version(2,(n,s)=>{const{config:i}=n;return{...n,version:2,config:U_(i,s)}})}}const K_={displayName:"viz.bar_chart_3d.viz_name",displayGroup:"chart.groups.echarts_based_charts",migrator:new Y_,name:"bar-3d",viewRender:W_,configRender:R_,createConfig(){return{version:2,config:v.cloneDeep(go)}},translation:Q_},X_=({disabled:e,value:t,onChange:n})=>{const s=i=>{i&&n(i)};return r.jsxs(o.Box,{sx:{position:"relative"},children:[e&&r.jsx(o.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),r.jsx(gt,{height:"500px",defaultLanguage:"javascript",value:t,onChange:s,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:e}})]})};function pt({enabled:e,func_content:t}){return(n,s)=>{if(!e)return n;try{return new Function(`return ${t}`)()(n,s)}catch(i){return console.error(`[getEchartsXAxisLabel] failed parsing custom function, error: ${i.message}`),n}}}function nt(){return{enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
|
|
93
93
|
`)}}const Nt=g.forwardRef(({value:e,onChange:t,triggerButtonText:n},s)=>{const{t:i}=j.useTranslation(),[a,{setTrue:l,setFalse:c}]=J.useBoolean(),[u,d]=g.useState(e);g.useEffect(()=>{d(e)},[e]);const h=k=>{d({...u,enabled:k})},p=()=>{c();const{enabled:k,func_content:S}=u,T={enabled:k,func_content:S};d(T),t(T)},f=()=>{c(),d(e)},m=k=>{d(S=>({...S,func_content:k}))},y=()=>{m(nt().func_content)},_=n??i("chart.axis.customize_label");return r.jsxs(r.Fragment,{children:[r.jsx(o.Button,{variant:"filled",color:"grape",leftIcon:r.jsx(M.IconMathFunction,{size:16}),mt:24,onClick:l,sx:{flexGrow:0},children:_}),r.jsx(o.Modal,{size:800,title:_,opened:a,onClose:c,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:a&&r.jsxs(o.Stack,{children:[r.jsx(o.Checkbox,{mt:10,label:i("common.enabled"),checked:u.enabled,onChange:k=>h(k.currentTarget.checked)}),r.jsx(X_,{value:u.func_content,onChange:m,disabled:!u.enabled}),r.jsxs(o.Group,{position:"apart",children:[r.jsx(o.Button,{onClick:y,color:"red",leftIcon:r.jsx(W.Recycle,{size:20}),children:i("common.actions.reset_to_default")}),r.jsxs(o.Group,{position:"right",children:[r.jsx(o.Button,{onClick:f,variant:"subtle",children:i("common.actions.cancel")}),r.jsx(o.Button,{color:"green",leftIcon:r.jsx(M.IconDeviceFloppy,{size:16}),onClick:p,children:i("common.actions.save")})]})]})]})})]})}),$n={x_axis_scroll:!1,y_axis_scroll:!1,x_axis_slider:!1,y_axis_slider:!1};function Qp(){return v.cloneDeep($n)}const J_=[{lang:"en",resources:{boxplot:{viz_name:"Boxplot Chart",box:"Box",outlier:"Outlier",scatter:"Scatter",click_series:{label:"Click box, scatter or outlier"}}}},{lang:"zh",resources:{boxplot:{viz_name:"箱线图",box:"箱体",outlier:"异常点",scatter:"散点",click_series:{label:"点击箱体、散点或异常点"}}}}],Up={id:"builtin:echarts:click-echart:series",displayName:"viz.boxplot.click_series.label",nameRender:H_,configRender:Z_,payload:[{name:"type",description:"Always 'click'",valueType:"string"},{name:"seriesType",description:"'boxplot'",valueType:"string"},{name:"name",description:"Name of the series clicked",valueType:"string"},{name:"color",description:"Color",valueType:"string"},{name:"value",description:"Record of 'name', 'min', 'q1', 'median', 'q3', 'max'",valueType:"object"},{name:"rowData",description:"Data of the row",valueType:"object"}]};function Z_(e){return r.jsx(r.Fragment,{})}function H_(e){const{t}=j.useTranslation();return r.jsx(o.Text,{children:t("viz.boxplot.click_series.label")})}const Zs=g.forwardRef(({sectionTitle:e,value:t,onChange:n},s)=>{const{t:i,i18n:a}=j.useTranslation(),l=u=>d=>{const h=v.cloneDeep(t);v.set(h,u,d),n(h)},c=g.useMemo(()=>[{label:i("chart.axis.overflow.truncate"),value:"truncate"},{label:i("chart.axis.overflow.break_line"),value:"break"},{label:i("chart.axis.overflow.break_word"),value:"breakAll"}],[a.language]);return r.jsxs(o.Stack,{spacing:0,children:[e&&r.jsx(o.Divider,{mb:-5,mt:5,variant:"dotted",label:e,labelPosition:"right",labelProps:{color:"dimmed"}}),r.jsxs(o.Group,{grow:!0,noWrap:!0,children:[r.jsx(o.NumberInput,{label:i("chart.axis.overflow.max_width"),hideControls:!0,value:t.width,onChange:l("width")}),r.jsx(o.Select,{label:i("chart.axis.overflow.label"),data:c,value:t.overflow,onChange:l("overflow")}),r.jsx(o.TextInput,{label:i("chart.axis.overflow.ellipsis"),value:t.ellipsis,disabled:!0})]})]})}),$t=g.forwardRef(({value:e,onChange:t},n)=>{const{t:s}=j.useTranslation(),i=l=>{t({...e,on_axis:l})},a=l=>{t({...e,in_tooltip:l})};return r.jsxs(o.Stack,{ref:n,spacing:0,children:[r.jsx(Zs,{sectionTitle:s("chart.axis.overflow.section_title.on_axis"),value:e.on_axis,onChange:i}),r.jsx(Zs,{sectionTitle:s("chart.axis.overflow.section_title.in_tooltip"),value:e.in_tooltip,onChange:a})]})});function ht(){return{on_axis:{width:80,overflow:"truncate",ellipsis:"..."},in_tooltip:{width:200,overflow:"break",ellipsis:"..."}}}function Dt({overflow:e,width:t}){const n={truncate:"initial",break:"break-all",breakAll:"break-word"}[e],s=e==="truncate"?"nowrap":"initial",i={truncate:"ellipsis",break:"clip",breakAll:"clip"}[e];return`
|
|
94
94
|
max-width: ${t}px;
|
|
95
95
|
word-break: ${n};
|