dsql-admin/dsql-app/.local_dist/static/chunks/8311-87e8d6ec01c2e05f.js
Benjamin Toby 885c11f674 Updates
2025-01-14 07:42:13 +01:00

1 line
39 KiB
JavaScript

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8311],{8034:(e,l,a)=>{a.d(l,{A:()=>o});var t=a(4848),i=a(6540),n=a(809),s=a(1765),d=a(2543),r=a.n(d);function o(e){var l,d,o;let{targetField:c,fieldIndex:u,tableFields:m,setTableFields:x,refreshFieldsListRef:p,setActiveEdit:h,database:f,currentTable:v,user:g}=e,y=(null==c?void 0:c.dataType)?c.dataType.replace(/\d|\(|\)/g,""):null,j=(null==c?void 0:c.dataType)?c.dataType.replace(/[^\d]/g,""):"200",N=a(4327),b=i.useRef(r().cloneDeep(c)),w=i.useRef(),[T,_]=i.useState(c),[F,C]=i.useState(null==c?void 0:c.fieldName),[A,S]=i.useState(y),[k,D]=i.useState(j),[V,I]=i.useState("Varchar is simply letters and numbers within the range 0 - 255"),[E,K]=i.useState((null==c?void 0:c.richText)&&!(null==c?void 0:c.encrypted)?"Yes":"No"),R=!!(null==A?void 0:A.match(/uuid/i));return(0,t.jsx)("div",{className:"w-full -mt-3 bg-white dark:bg-slate-800 flex-wrap",ref:w,children:(0,t.jsxs)("form",{className:"flex flex-col xl:flex-row items-start gap-4 w-full justify-between border border-solid p-4 border-slate-200 dark:border-slate-600 rounded rounded-t-none focus:shadow-lg shadow-slate-700 dark:shadow-black relative flex-wrap",onSubmit:e=>{var l,a;e.preventDefault(),x(e=>(e[u]=T,e)),p.current(e=>e+1),null===(a=e.target.closest(".table-field-wrapper"))||void 0===a||null===(l=a.querySelector(".edit-table-field-section"))||void 0===l||l.classList.toggle("hidden")},children:[(0,t.jsxs)("div",{className:"gap-4 flex-wrap w-full md:w-auto flex-col xl:flex-row items-stretch",children:[(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,t.jsx)("label",{htmlFor:"new_field_name",children:"Field Name"}),(0,t.jsx)("input",{type:"text",name:"new_field_name",id:"new_field_name",placeholder:"Eg. post_title",onInput:async e=>{let l=e.target;l.value=l.value.toLowerCase().replace(/ /g,"_"),_(e=>(e.fieldName=l.value,e.updatedField=!0,e.originName||(e.originName=F),e))},required:!0,defaultValue:F})]}),(0,t.jsxs)("div",{className:"flex flex-col items-start gap-4 xl:gap-0.5",children:[(0,t.jsxs)("div",{className:"flex-wrap xl:flex-nowrap w-full md:w-auto",children:[(0,t.jsx)("label",{htmlFor:"new_field_data_type",children:"Data Type"}),(0,t.jsxs)("div",{className:"dropdown-wrapper reversed text-sm items-start",children:[(0,t.jsx)("span",{className:"px-2 bg-slate-200 dark:bg-slate-700 rounded-full hover:bg-slate-100 dark:hover:bg-slate-600 hidden xl:flex",children:"Info"}),(0,t.jsx)("div",{className:"dropdown mt-0 xl:-mt-2",children:(0,t.jsx)("span",{children:V})})]})]}),(0,t.jsxs)("div",{className:"w-auto",children:[(0,t.jsx)("select",{name:"new_field_data_type",id:"new_field_data_type",className:"w-full xl-w-auto",onChange:e=>{let l=e.target;S(l.value),l.childNodes.forEach(e=>{e.value===l.value&&e.dataset.desc&&I(e.dataset.desc),e.value===l.value&&e.dataset.literal?(T.defaultValueLiteral=e.dataset.literal,T.nullValue=!1):delete T.defaultValueLiteral}),c.dataType=l.value+(l.value.match(/VARCHAR/)?"(".concat(k||200,")"):"")},defaultValue:A||void 0,children:N.map((e,l)=>e.name.match(/VARCHAR/)?(0,t.jsx)("option",{value:e.name,"data-desc":e.description,children:e.title+"("+(k||200)+")"},l+1):(0,t.jsx)("option",{value:e.name,"data-desc":e.description,"data-literal":e.valueLiteral||void 0,children:e.title},l+1))}),(null==A?void 0:A.match(/VARCHAR/))&&(0,t.jsx)("input",{type:"number",defaultValue:k||200,className:"px-2",style:{maxWidth:"60px"},max:255,min:5,onChange:e=>{D(e.target.value),c.dataType=A+"(".concat(e.target.value,")")}})]})]}),(null==A?void 0:A.match(/text/i))&&(0,t.jsx)(i.Fragment,{children:(0,t.jsx)(s.A,{targetField:c})}),!(null===(l=c.dataType)||void 0===l?void 0:l.match(/text/i))&&!R&&(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5",style:{minWidth:"70px"},children:[(0,t.jsx)("label",{htmlFor:"new_field_required",children:"Required?"}),(0,t.jsxs)("select",{name:"new_field_required",id:"new_field_required",className:"px-2",defaultValue:(null==c?void 0:c.notNullValue)?"Yes":"No",onChange:e=>{console.log(c),"Yes"===e.target.value?c.notNullValue=!0:(c.notNullValue=!1,delete c.notNullValue)},children:[(0,t.jsx)("option",{value:"No",children:"No"}),(0,t.jsx)("option",{value:"Yes",children:"Yes"})]})]}),!R&&(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,t.jsx)("label",{htmlFor:"new_field_default_value",children:(null==T?void 0:null===(d=T.dataType)||void 0===d?void 0:d.match(/text$/i))?"Can't Set Default for text values":"Default Value (optional)"}),(0,t.jsx)("input",{type:"text",name:"new_field_default_value",id:"new_field_default_value",className:(null==T?void 0:null===(o=T.dataType)||void 0===o?void 0:o.match(/text$/i))?"pointer-events-none opacity-50":"",placeholder:"Default Value",defaultValue:(null==T?void 0:T.defaultValue)?T.defaultValue:(null==T?void 0:T.nullValue)?"NULL":"",onInput:e=>{var l;let a=e.target;null!==(l=T.dataType)&&void 0!==l&&l.match(/text$/i)||_(e=>(a.value.match(/./)?delete e.notNullValue:(delete e.defaultValue,delete e.nullValue),a.value.match(/^null$/i)?(delete e.defaultValue,e.nullValue=!0):a.value.match(/./)&&(delete e.nullValue,e.defaultValue=a.value),e))}})]}),!R&&(0,t.jsx)(n.A,{database:f,setFieldData:_,setTableFields:x,tableFields:m,targetField:c,user:g,currentTable:v,fieldIndex:u})]}),(0,t.jsxs)("div",{className:"secondary mt-auto flex-wrap w-full xl:w-auto",children:[(0,t.jsx)("button",{type:"submit",className:"secondary mt-auto py-3 w-full md:w-auto grow",children:"Save Updates"}),(0,t.jsx)("div",{className:"button outlined gray mt-auto py-2.5 w-full md:w-auto justify-center grow",onClick:e=>{b.current&&(c=r().cloneDeep(b.current)),x(e=>{let l=r().cloneDeep(e);return u&&b.current&&(l[u]=r().cloneDeep(b.current)),l}),h&&h(!1)},children:"Cancel"})]})]})})}},809:(e,l,a)=>{a.d(l,{A:()=>f});var t=a(4848),i=a(6540),n=a(9268),s=a(6897);function d(e){let{targetField:l}=e;if(!(null==l?void 0:l.richText))return null;let[a,d]=i.useState(l.cssFiles||[]),r=i.useRef(null);return i.useEffect(()=>{l.cssFiles=a},[a]),(0,t.jsxs)("div",{className:"flex flex-col items-start gap-2 w-full my-4",style:{minWidth:"70px"},children:[(0,t.jsx)("span",{className:"label text-xs text-slate-500",children:"Add CSS"}),a.map((e,l)=>(0,t.jsxs)("div",{className:"relative border border-solid border-slate-300 text-xs px-2 py-1 rounded-full",children:[(0,t.jsx)("span",{children:e}),(0,t.jsx)(s.A,{size:20,onClick:()=>{d(l=>l.filter(l=>l!==e))},className:"cursor-pointer hover:opacity-60 "})]},l+1)),(0,t.jsxs)("div",{className:"row w-full",children:[(0,t.jsx)(n.A,{name:"css-file",placeholder:"CSS file URL",elementRef:r}),(0,t.jsx)("button",{className:"secondary outlined",onClick:()=>{var e;let l=null===(e=r.current)||void 0===e?void 0:e.value;(null==l?void 0:l.match(/./))&&d(e=>[...new Set([...e,l])])},children:"Add"})]}),(0,t.jsx)("span",{className:"text-sm text-slate-600",children:"Add CSS files to your Rich Text field"})]})}function r(e){let{targetField:l,setFieldData:a}=e;return(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5 w-full",style:{minWidth:"70px"},children:[(0,t.jsx)("label",{htmlFor:"encryption_field",children:"Encrypt?"}),(0,t.jsxs)("select",{name:"encryption_field",id:"encryption_field",className:"px-2",defaultValue:(null==l?void 0:l.encrypted)?"Yes":"No",onChange:e=>{a&&a(l=>(e.target.value.match(/yes/i)?l.encrypted=!0:(l.encrypted=!1,delete l.encrypted),l))},children:[(0,t.jsx)("option",{value:"No",children:"No"}),(0,t.jsx)("option",{value:"Yes",children:"Yes"})]})]})}var o=a(2086);function c(e){let{targetField:l,setFieldData:a}=e;return null}function u(e){let{targetField:l}=e;return(0,t.jsxs)("div",{className:"flex flex-col items-start gap-2 w-full",style:{minWidth:"70px"},children:[(0,t.jsx)("label",{htmlFor:"encryption_field",children:"Pattern"}),(0,t.jsx)("span",{className:"text-sm text-slate-500",children:'This describes a pattern that must be matched for this field to be valid. If you add a pattern and make a db entry that doesn\'t match, the entry will be "NULL" or an empty string or the default value.'}),(0,t.jsx)("input",{type:"text",placeholder:"Regex Pattern. Eg: '\\\\.[a-z]+'",onInput:e=>{var a;let t=e.target;(null==t?void 0:null===(a=t.value)||void 0===a?void 0:a.length)>0?l.pattern=t.value:delete l.pattern},defaultValue:null==l?void 0:l.pattern}),(0,t.jsx)("input",{type:"text",placeholder:"Regex Pattern Flags. Eg: igm",onInput:e=>{var a;let t=e.target;(null==t?void 0:null===(a=t.value)||void 0===a?void 0:a.length)>0?l.patternFlags=t.value:delete l.patternFlags},defaultValue:null==l?void 0:l.patternFlags})]})}var m=a(2543),x=a.n(m),p=a(9878);function h(e){let{targetField:l,setFieldData:a}=e;return(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5 w-full",style:{minWidth:"70px"},children:[(0,t.jsx)("label",{htmlFor:"unique_field",children:"Unique Field?"}),(0,t.jsxs)("select",{name:"unique_field",id:"unique_field",className:"px-2",defaultValue:(null==l?void 0:l.unique)?"Yes":"No",onChange:e=>{a&&a(l=>(e.target.value.match(/yes/i)?l.unique=!0:(l.unique=!1,delete l.unique),l))},children:[(0,t.jsx)("option",{value:"No",children:"No"}),(0,t.jsx)("option",{value:"Yes",children:"Yes"})]})]})}function f(e){let{targetField:l,currentTable:a,database:n,tableFields:s,setTableFields:m,setFieldData:f,user:v,fieldIndex:g}=e,[y,j]=i.useState(!1),N=i.useRef(x().cloneDeep(l));return i.useEffect(()=>{},[]),(0,t.jsxs)(i.Fragment,{children:[(0,t.jsx)("span",{className:"button outlined gray mt-5 w-full xl:w-auto",onClick:()=>{j(!0)},children:"More"}),(0,t.jsx)(p.A,{open:y,onClose:()=>{N.current&&(l=x().cloneDeep(N.current)),j(!1)},maxWidth:"600px",children:(0,t.jsxs)("div",{className:"m-auto flex flex-col max-w-xl w-full max-h-[90vh] overflow-y-auto",children:[(0,t.jsx)("div",{className:"w-full justify-between",children:(0,t.jsx)("span",{className:"text-xl",children:"More Options"})}),(0,t.jsx)(d,{targetField:l}),(0,t.jsx)(h,{targetField:l,setFieldData:f}),(0,t.jsx)(r,{targetField:l,setFieldData:f}),a&&(0,t.jsx)(o.A,{targetField:l,setFieldData:f,database:n,tableFields:s,setTableFields:m,currentTable:a,user:v}),(0,t.jsx)(c,{targetField:l,setFieldData:f}),(0,t.jsx)(u,{targetField:l}),(0,t.jsx)("button",{className:"w-full outlined more-padding",onClick:()=>{j(!1)},children:"Done"})]})})]})}},8311:(e,l,a)=>{a.d(l,{A:()=>F});var t=a(4848),i=a(6540),n=a(6517);function s(e){let{tableFields:l,setTableFields:a,setRefresh:t,setPageRefresh:i,refreshFieldsListRef:n}=e,s=l.findIndex(e=>"date_created"===e.fieldName);l.splice(s,0,{newTempField:!0}),a(l),(null==n?void 0:n.current)&&n.current(e=>e+1)}var d=a(1342),r=a(1710),o=a(2675),c=a(2086),u=a(9020);function m(e){var l,a,n,s,d,r,m,x,p,h,f;let{field:v,setTargetField:g,fieldIndex:y,tableFields:j,setTableFields:N,refreshFieldsListRef:b,database:w,currentTable:T,user:_,isDelegated:F,setLoading:C}=e,[A,S]=i.useState(v),[k,D]=i.useState(!1);return(0,t.jsxs)("div",{className:"flex-col w-full table-field-wrapper"+(k?" shadow-2xl shadow-slate-700/40 relative z-50":""),children:[(0,t.jsxs)("div",{className:"card no-hover items-center w-full py-4"+(k?" rounded-t":" rounded")+((null===(l=A.fieldName)||void 0===l?void 0:l.match(o.A))?" text-slate-400 pointer-events-none border-slate-200 border":" light-gray"),children:[(0,t.jsx)("span",{className:"font-bold"+((null===(a=A.fieldName)||void 0===a?void 0:a.match(o.A))?" dark:text-slate-500":" dark:text-white"),children:A.fieldName}),(0,t.jsx)("span",{className:"text-xs py-1 px-2 bg-slate-100 dark:bg-slate-700 dark:text-slate-200 rounded ",children:A.dataType}),(null==A?void 0:A.foreignKey)&&(0,t.jsxs)("div",{className:"text-xs bg-primary text-white px-2 py-0.5 rounded-full",children:[(0,t.jsx)("span",{children:"Foreign Key: "}),(0,t.jsxs)("span",{children:[A.foreignKey.destinationTableName," ("," ",(0,t.jsx)("b",{children:A.foreignKey.destinationTableColumnName})," ",")"]})]}),(null===(n=A.fieldName)||void 0===n?void 0:n.match(o.A))&&(0,t.jsx)("span",{className:"text-slate-300 text-sm font-semibold ml-0 md:ml-auto",children:"Default Field"}),!(!F&&!(null===(s=A.fieldName)||void 0===s?void 0:s.match(o.A))&&(null===(d=A.dataType)||void 0===d?void 0:d.match(/INT/)))||A.foreignKey||(null==w?void 0:null===(m=w.active_clone)||void 0===m?void 0:null===(r=m.toString())||void 0===r?void 0:r.match(/1/))?!(!F&&!(null===(x=A.fieldName)||void 0===x?void 0:x.match(o.A))&&(null===(p=A.dataType)||void 0===p?void 0:p.match(/INT/)))||(null==w?void 0:null===(f=w.active_clone)||void 0===f?void 0:null===(h=f.toString())||void 0===h?void 0:h.match(/1/))?(0,t.jsx)(i.Fragment,{}):(0,t.jsx)("div",{className:"ml-0 md:ml-auto flex-wrap",children:(0,t.jsx)("div",{className:"button py-1 text-xs light-gray",onClick:e=>{if(window.confirm("Delete this foreign Key?")){var l,a;delete v.foreignKey,C(!0),(0,u.A)("/api/updateClonedTableForeignKeys",{method:"post",body:{tableData:T,database:w.db_full_name,dbSlug:w.db_slug,delegated:null!==(a=window.location)&&void 0!==a&&null!==(l=a.search)&&void 0!==l&&!!l.match(/delegated=true/i)}},!0).then(e=>{e.success?window.location.reload():window.alert("Update Failed, Please Try again.")})}},style:{color:"var(--slate-500)"},children:"Delete Foreign Key"})}):(0,t.jsx)("div",{className:"ml-0 md:ml-auto flex-wrap",children:(0,t.jsx)("div",{className:"button outlined py-1 text-xs gray",onClick:e=>{k?D(!1):D(!0)},style:{color:"var(--slate-500)"},children:"Add Foreign Key"})})]}),k&&!F&&(0,t.jsx)("div",{className:"card col w-full -mt-5 pt-0 no-hover",children:(0,t.jsx)(c.A,{targetField:v,setFieldData:S,tableFields:j,setTableFields:N,database:w,currentTable:T,user:_,setActiveEdit:D,activeClonedTable:!0})})]})}var x=a(809),p=a(1765);function h(e){let{fieldIndex:l,setTableFields:n,database:s,user:d,isNewField:r,setLiteralValue:o,tempFieldData:c,setTempFieldData:u,dataTypeValue:m,setDataTypeValue:h,dataType:f,setDataType:v,dataTypeDesc:g,setDataTypeDesc:y}=e,j=a(4327),N=i.useRef();i.useEffect(()=>{var e;N.current&&(N.current.scrollIntoView({block:"center",behavior:"smooth"}),null===(e=N.current.querySelector("input"))||void 0===e||e.focus())},[]);let b=!!f.match(/uuid/i);return(0,t.jsxs)(i.Fragment,{children:[r&&(0,t.jsx)("span",{className:"absolute -top-4 text-sm bg-fuchsia-600 dark:bg-white text-white dark:text-fuchsia-800 px-3 py-1 rounded-full",children:"New Field"}),(0,t.jsxs)("div",{className:"gap-4 flex-wrap xl:flex-nowrap flex-col xl:flex-row items-stretch w-full xl:w-auto",children:[(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,t.jsx)("label",{htmlFor:"new_field_name",children:"Field Name"}),(0,t.jsx)("input",{type:"text",name:"new_field_name",id:"new_field_name",placeholder:"Eg. post_title",onInput:async e=>{let l=e.target,a=l.value.toLowerCase().replace(/ /g,"_");l.value=a},required:!0})]}),(0,t.jsxs)("div",{className:"flex flex-col items-start gap-4 xl:gap-0.5",children:[(0,t.jsxs)("div",{className:"items-start flex-wrap xl:flex-nowrap",children:[(0,t.jsx)("label",{htmlFor:"new_field_data_type",children:"Data Type"}),(0,t.jsxs)("div",{className:"dropdown-wrapper reversed text-sm w-full items-start gap-2",children:[(0,t.jsx)("span",{className:"px-2 bg-slate-200 dark:bg-slate-700 rounded-full hover:bg-slate-100 dark:hover:bg-slate-600 hidden xl:flex",children:"Info"}),(0,t.jsx)("div",{className:"dropdown mt-0 xl:-mt-2",children:(0,t.jsx)("span",{children:g})})]})]}),(0,t.jsxs)("div",{className:"w-full xl:w-auto",children:[(0,t.jsx)("select",{name:"new_field_data_type",id:"new_field_data_type",className:"w-full xl:w-auto",onChange:e=>{let l=e.target;v(l.value),l.childNodes.forEach(e=>{e.value===l.value&&y(e.dataset.desc),e.value===l.value&&e.dataset.literal&&o(e.dataset.literal)})},children:j.map((e,l)=>e.name.match(/VARCHAR/)?(0,t.jsx)("option",{value:e.name,"data-desc":e.description,children:e.title+"("+(m||200)+")"},l+1):(0,t.jsx)("option",{value:e.name,"data-desc":e.description,"data-literal":e.valueLiteral||void 0,children:e.title},l+1))}),f.match(/VARCHAR/)&&(0,t.jsx)("input",{type:"number",defaultValue:m,className:"px-2",style:{maxWidth:"60px"},max:255,min:5,onChange:e=>{h(e.target.value)}})]})]}),(null==f?void 0:f.match(/text/i))&&(0,t.jsx)(i.Fragment,{children:(0,t.jsx)(p.A,{targetField:c})}),!b&&(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5",style:{minWidth:"70px"},children:[(0,t.jsx)("label",{htmlFor:"new_field_required",children:"Required?"}),(0,t.jsxs)("select",{name:"new_field_required",id:"new_field_required",className:"px-2",children:[(0,t.jsx)("option",{value:"No",children:"No"}),(0,t.jsx)("option",{value:"Yes",children:"Yes"})]})]}),!b&&(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,t.jsx)("label",{htmlFor:"new_field_default_value",children:"Default Value (optional)"}),(0,t.jsx)("input",{type:"text",name:"new_field_default_value",id:"new_field_default_value",placeholder:"Default Value"})]}),!b&&(0,t.jsx)(x.A,{database:s,setFieldData:u,targetField:c,user:d,fieldIndex:l})]}),(0,t.jsxs)("div",{className:"secondary mt-auto flex-wrap xl:flex-nowrap w-full xl:w-auto",children:[(0,t.jsx)("button",{type:"submit",className:"secondary mt-auto py-3 w-full sm:w-auto justify-center grow",children:"Add Field"}),(0,t.jsx)("div",{className:"button outlined-gray mt-auto py-2.5 w-full sm:w-auto justify-center grow",onClick:e=>{n(e=>e.filter((e,a)=>a!=l))},children:"Cancel"})]})]})}function f(e){let{fieldIndex:l,tableFields:a,setTableFields:n,refreshFieldsListRef:s,database:d,currentTable:r,user:o}=e,[c,u]=i.useState("VARCHAR"),[m,x]=i.useState("200"),[p,f]=i.useState("Varchar is simply letters and numbers within the range 0 - 255"),[v,g]=i.useState({}),y=i.useRef(),[j,N]=i.useState("");i.useEffect(()=>{var e;y.current&&(y.current.scrollIntoView({block:"center",behavior:"smooth"}),null===(e=y.current.querySelector("input"))||void 0===e||e.focus())},[]);let b=!!c.match(/uuid/i);return(0,t.jsx)("div",{className:"w-full mt-1 flex-wrap relative z-0 hover:z-20",ref:y,children:(0,t.jsx)("form",{className:"flex flex-row items-start gap-4 w-full justify-between border border-solid p-4 pt-6 border-slate-400 rounded focus:shadow-lg shadow-slate-400/40 dark:shadow-black/30 relative flex-wrap xl:flex-nowrap shadow-xl",onSubmit:e=>{var a,t,i,d,r,o;e.preventDefault();let c=v.foreignKey;c&&!c.destinationTableName&&delete v.foreignKey;let u=e.target,x=u.new_field_name.value,p=u.new_field_data_type.value,h=null===(a=u.new_field_required)||void 0===a?void 0:a.value,f=null===(t=u.new_field_default_value)||void 0===t?void 0:t.value,g=null===(i=u.encryption_field)||void 0===i?void 0:i.value,y=null===(d=u.rich_text_option)||void 0===d?void 0:d.value,N=u.foreign_key_field,w=u.foreign_key_destination_table_name,T=u.foreign_key_destination_table_column_name;null==N||N.value;let _={...v,fieldName:x,dataType:(null==v?void 0:v.dataType)&&(null==v?void 0:v.foreignKey)?v.dataType:(null==p?void 0:p.match(/VARCHAR/))?"".concat(p,"(").concat(m,")"):p};(null==h?void 0:h.match(/yes/i))?_.notNullValue=!0:(null==f?void 0:f.match(/./))||(_.nullValue=!0),(null==f?void 0:f.match(/./))&&(_.defaultValue=f),(null==g?void 0:g.match(/yes/i))&&(_.encrypted=!0),(null==T?void 0:null===(r=T.value)||void 0===r?void 0:r.match(/./i))&&!(null==T?void 0:null===(o=T.value)||void 0===o?void 0:o.match(/^--$/i))&&(_.dataType=T.dataset.dataType,_.foreignKey={foreignKeyName:T.dataset.foreignKeyName,destinationTableName:w.dataset.destinationTableName,destinationTableColumnName:T.dataset.destinationTableColumnName,cascadeDelete:!0}),(null==y?void 0:y.match(/yes/i))&&(_.richText=!0),b?(_.defaultValueLiteral=j,_.nullValue=!1):delete _.defaultValueLiteral,console.log("newFieldObject",_),function(e){let{fieldIndex:l,setTableFields:a,refreshFieldsListRef:t,payload:i}=e;a(e=>(e.splice(l,1,i),e)),(null==t?void 0:t.current)&&t.current(e=>e+1)}({fieldIndex:l,setTableFields:n,refreshFieldsListRef:s,payload:_})},children:(0,t.jsx)(h,{database:d,fieldIndex:l,isNewField:!0,literalValue:j,refreshFieldsListRef:s,setLiteralValue:N,setTableFields:n,user:o,currentTable:r,tableFields:a,tempFieldData:v,setTempFieldData:g,dataTypeValue:m,setDataTypeValue:x,dataType:c,setDataType:u,dataTypeDesc:p,setDataTypeDesc:f})})})}var v=a(2543),g=a.n(v);function y(e){let{tableFields:l,setTableFields:a,refreshFieldsListRef:t,order:i,field:n,e:s}=e,d=g().cloneDeep(l),r=d.findIndex(e=>e.fieldName===n.fieldName);if(r<0)return;let o=d[r];if("up"===i&&r&&r<=1){console.log("Min Reached =>",r);return}if("down"===i&&r&&r>=d.length-7){console.log("Max Reached =>",r);return}try{var c,u;let e;let l=s.target.closest(".table-field-wrapper"),a=l.previousElementSibling,t=l.nextElementSibling,n=window.DSQL.Flip,d=n.getState(l);"up"===i?(e=n.getState(a),null===(c=l.parentNode)||void 0===c||c.insertBefore(l,a)):(null==t?void 0:t.nextElementSibling)&&(e=n.getState(t),null===(u=l.parentNode)||void 0===u||u.insertBefore(l,t.nextElementSibling)),n.from(d,{duration:.3,ease:"power1.inOut"}),n.from(e,{duration:.3,ease:"power1.inOut"})}catch(e){console.log("Error =>",e.message)}if(!r){console.log("No target Field Index =>",r);return}d.splice(r,1),"up"===i?d.splice(r-1,0,o):d.splice(r+1,0,o),setTimeout(()=>{a([...d]),t.current&&t.current(e=>e+1)},500)}var j=a(8034),N=a(900),b=a(2027);function w(e){var l,a,n,s,d,r,c;let{field:u,setTargetField:m,fieldIndex:x,tableFields:p,setTableFields:h,refreshFieldsListRef:f,database:v,currentTable:g,confirmedDelegetedUser:w,user:T}=e,_=null==w?void 0:w.delegated,F=null==w?void 0:null===(l=w.priviledges)||void 0===l?void 0:l.match(/Edit Tables/i);null==w||null===(a=w.priviledges)||void 0===a||a.match(/Delete Tables/i),null==w||null===(n=w.priviledges)||void 0===n||n.match(/Create Tables/i);let{active_clone:C,active_clone_parent_db:A,remote_connected:S}=v,[k,D]=i.useState(u),[V,I]=i.useState(!1);return(0,t.jsxs)("div",{className:"flex-col w-full table-field-wrapper"+(V?" shadow-2xl shadow-slate-300/40 dark:shadow-black/30 relative z-50":""),children:[(0,t.jsxs)("div",{className:"card no-hover items-center w-full py-4"+(V?" rounded-t":" rounded")+((null===(s=k.fieldName)||void 0===s?void 0:s.match(o.A))?" text-slate-400 pointer-events-none border-slate-200 border":" light-gray"),children:[(0,t.jsx)("span",{className:"font-bold"+((null===(d=k.fieldName)||void 0===d?void 0:d.match(o.A))?" dark:text-slate-500":" dark:text-white"),children:k.fieldName}),(0,t.jsx)("span",{className:"text-xs py-1 px-2 bg-slate-100 dark:bg-slate-700 dark:text-slate-200 rounded ",children:k.dataType}),(null==k?void 0:k.foreignKey)&&(0,t.jsxs)("div",{className:"text-xs bg-primary text-white px-2 py-0.5 rounded-full",children:[(0,t.jsx)("span",{children:"Foreign Key: "}),(0,t.jsxs)("span",{children:[k.foreignKey.destinationTableName," ("," ",(0,t.jsx)("b",{children:k.foreignKey.destinationTableColumnName})," ",")"]})]}),(null===(r=k.fieldName)||void 0===r?void 0:r.match(o.A))&&(0,t.jsx)("span",{className:"text-slate-300 text-sm font-semibold ml-0 md:ml-auto",children:"Default Field"}),!(null===(c=k.fieldName)||void 0===c?void 0:c.match(o.A))&&!A&&!S&&(0,t.jsx)("div",{className:"ml-0 md:ml-auto flex-wrap",children:(!_||_&&F)&&(0,t.jsxs)(i.Fragment,{children:[(0,t.jsxs)(N.A,{children:[(0,t.jsx)("div",{className:"button outlined py-1 text-xs gray",onClick:e=>{V?I(!1):I(!0)},style:{color:"var(--slate-500)"},children:"Edit"}),!A&&!S&&(0,t.jsx)("div",{className:"button outlined py-1 text-xs gray",onClick:e=>{window.confirm('Delete "'.concat(u.fieldName,'"?'))&&h(e=>e.filter((e,l)=>l!=x))},style:{color:"var(--slate-500)"},children:"Delete"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"button outlined gray p-2 w-8 h-8 rounded-full rotate-180",onClick:e=>{y({tableFields:p,setTableFields:h,refreshFieldsListRef:f,order:"up",field:u,e})},children:(0,t.jsx)(b.A,{size:20})}),(0,t.jsx)("div",{className:"button outlined gray p-2 w-8 h-8 rounded-full",onClick:e=>{y({tableFields:p,setTableFields:h,refreshFieldsListRef:f,order:"down",field:u,e})},children:(0,t.jsx)(b.A,{size:20})})]})]})})]}),V&&(0,t.jsx)("div",{className:"w-full",children:(0,t.jsx)(j.A,{fieldIndex:x,tableFields:p,setTableFields:h,refreshFieldsListRef:f,targetField:u,setActiveEdit:I,database:v,currentTable:g,user:T})})]})}var T=a(8845);let _=1;function F(e){var l,o,c,u;let{user:x,tableFields:p,setTableFields:h,setTargetField:v,refreshFieldsListRef:g,updateTable:y,updateTableAfterFieldsUpdateFunction:j,collapsed:N,database:b,table:F,confirmedDelegetedUser:C,query:A}=e;(null==F?void 0:F.childTable)&&(null===(l=F.childTableDbFullName)||void 0===l||l.replace(new RegExp(/datasquirel_user_\d+_/),""));let S=null==C?void 0:C.delegated,k=null==C?void 0:null===(o=C.priviledges)||void 0===o?void 0:o.match(/Edit Tables/i);null==C||null===(c=C.priviledges)||void 0===c||c.match(/Delete Tables/i),null==C||null===(u=C.priviledges)||void 0===u||u.match(/Create Tables/i);let{active_clone:D,active_clone_parent_db:V,remote_connected:I}=b,[E,K]=i.useState(0);g.current=K;let[R,L]=i.useState(!1),[U,q]=i.useState(N||!1);return(i.useEffect(()=>{let{Flip:e}=a(8383);n.Ay.registerPlugin(e);let l=window.DSQL;l&&(l.Flip=e)},[]),S&&!k)?(0,t.jsx)(t.Fragment,{}):(0,t.jsxs)("section",{className:"paper green",children:[R&&(0,t.jsx)(r.A,{}),(null==F?void 0:F.childTable)?(0,t.jsxs)(i.Fragment,{children:[(0,t.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,t.jsx)("h2",{className:"text-xl m-0 text-left title",children:"Fields"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"button outlined light-gray",onClick:e=>{let l=(0,T.A)({paradigm:"JavaScript",table:F,query:A,user:x});l&&navigator.clipboard.writeText(l).then(()=>{window.alert("JavaScript Type Definition Copied")})},children:(0,t.jsx)("span",{children:"Copy TypeDef (JS)"})}),(0,t.jsx)("div",{className:"button outlined light-gray",onClick:e=>{let l=(0,T.A)({paradigm:"TypeScript",table:F,query:A,user:x});l&&navigator.clipboard.writeText(l).then(()=>{window.alert("TypeScript Type Definition Copied")})},children:(0,t.jsx)("span",{children:"Copy TypeDef (TS)"})})]})]}),(0,t.jsx)("div",{className:"flex-col w-full",style:U?{maxHeight:"200px"}:{},children:p&&p[0]&&p.map((e,l)=>(_++,(0,t.jsx)(m,{field:e,fieldIndex:l,setTargetField:v,setTableFields:h,refreshFieldsListRef:g,tableFields:p,database:b,setLoading:L,currentTable:F,user:x,isDelegated:S},_)))}),N&&(0,t.jsx)(d.A,{collapse:U||!1,setCollapse:q})]}):(0,t.jsxs)(i.Fragment,{children:[(0,t.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,t.jsx)("h2",{className:"text-xl m-0 text-left title",children:"Fields"}),(0,t.jsxs)("div",{children:[(!S||S&&k)&&!V&&!I&&(0,t.jsxs)("div",{className:"button secondary outlined",onClick:e=>{U&&q(!1),s({setTableFields:h,tableFields:p,setRefresh:K,refreshFieldsListRef:g})},children:[(0,t.jsx)("span",{className:"symbol",children:"+"}),(0,t.jsx)("span",{children:"Add New Field"})]}),(0,t.jsx)("div",{className:"button outlined light-gray",onClick:e=>{if(!F)return;let l=(0,T.A)({paradigm:"JavaScript",table:F,query:A,user:x});l&&navigator.clipboard.writeText(l).then(()=>{window.alert("JavaScript Type Definition Copied")})},children:(0,t.jsx)("span",{children:"Copy TypeDef (JS)"})}),(0,t.jsx)("div",{className:"button outlined light-gray",onClick:e=>{if(!F)return;let l=(0,T.A)({paradigm:"TypeScript",table:F,query:A,user:x});l&&navigator.clipboard.writeText(l).then(()=>{window.alert("TypeScript Type Definition Copied")})},children:(0,t.jsx)("span",{children:"Copy TypeDef (TS)"})})]})]}),(0,t.jsxs)("div",{className:"flex-col w-full",style:U?{maxHeight:"200px"}:{},children:[p&&p[0]&&p.map((e,l)=>(_++,e.newTempField)?(0,t.jsx)(f,{fieldIndex:l,tableFields:p,setTableFields:h,refreshFieldsListRef:g,database:b,currentTable:F,user:x},_):(0,t.jsx)(w,{field:e,fieldIndex:l,setTargetField:v,setTableFields:h,refreshFieldsListRef:g,tableFields:p,database:b,currentTable:F,confirmedDelegetedUser:C,user:x},_)),(!S||S&&k)&&!V&&!I&&(0,t.jsxs)(i.Fragment,{children:[(0,t.jsxs)("div",{className:"button outlined gray w-full more-padding",style:{borderStyle:"dashed"},onClick:e=>{U&&q(!1),s({setTableFields:h,tableFields:p,setRefresh:K,refreshFieldsListRef:g})},children:[(0,t.jsx)("span",{className:"symbol",children:"+"}),(0,t.jsx)("span",{children:"Add New Field"})]}),y&&(0,t.jsx)("button",{className:"secondary w-full py-3",onClick:e=>{window.confirm("Update Table Fields?")&&(L(!0),j&&j(L))},children:"Update Table Fields"})]})]}),N&&(0,t.jsx)(d.A,{collapse:U,setCollapse:q})]})]})}},2086:(e,l,a)=>{a.d(l,{A:()=>r});var t=a(4848),i=a(6540),n=a(9020),s=a(1710),d=a(2408);function r(e){var l,a,r,o;let{targetField:c,setFieldData:u,tableFields:m,setTableFields:x,database:p,currentTable:h,user:f,setActiveEdit:v,activeClonedTable:g}=e,[y,j]=i.useState(null!=c&&!!c.foreignKey),[N,b]=i.useState(null),[w,T]=i.useState(null),[_,F]=i.useState(null),[C,A]=i.useState(null),[S,k]=i.useState(!1),[D,V]=i.useState("boolean"!=typeof(null===(l=c.foreignKey)||void 0===l?void 0:l.cascadeDelete)||c.foreignKey.cascadeDelete),[I,E]=i.useState("boolean"==typeof(null===(a=c.foreignKey)||void 0===a?void 0:a.cascadeUpdate)&&c.foreignKey.cascadeUpdate);return i.useEffect(()=>{c.foreignKey={...c.foreignKey,cascadeDelete:D,cascadeUpdate:I}},[D,I]),i.useEffect(()=>{if(!y&&!(null==c?void 0:c.foreignKey)){b(null),T(null),F(null),A(null);return}(0,n.A)("/api/getUserSchemaData").then(e=>{if(e.success)try{let a=e.schemaData.filter(e=>e.dbFullName===p.db_full_name),t=h?a[0].tables.filter(e=>e.tableName!==h.tableName):a[0].tables;if(b(t),null==c?void 0:c.foreignKey){var l;let e=t.filter(e=>{var l;return e.tableName===(null==c?void 0:null===(l=c.foreignKey)||void 0===l?void 0:l.destinationTableName)});T(e[0]),(null===(l=e[0])||void 0===l?void 0:l.fields)&&F(e[0].fields)}}catch(e){(0,n.A)("/api/admin/clientError",{method:"post",body:{component:"ForeignKey/fetch-error-getUserSchemaData/lines-65-77",message:e.message,user:f}})}})},[y]),(0,t.jsxs)("div",{className:"flex flex-col items-start gap-2 w-full mt-2 relative",style:{minWidth:"70px"},children:[S&&(0,t.jsx)(s.A,{}),(0,t.jsxs)("label",{htmlFor:"foreign_key_field",className:"flex flex-wrap items-center gap-2 mt-2",children:[(0,t.jsx)("span",{children:"Foreign Key?"}),(0,t.jsxs)("div",{className:"dropdown-wrapper reversed text-sm items-start",children:[(0,t.jsx)("span",{className:"px-2 bg-slate-200 rounded-full hover:bg-slate-100 hidden xl:flex text-slate-600",children:"Info"}),(0,t.jsx)("div",{className:"dropdown mt-0 xl:-mt-2",children:(0,t.jsx)("span",{children:"Foriegn key links the current table to another table"})})]})]}),(0,t.jsxs)("select",{name:"foreign_key_field",id:"foreign_key_field",className:"px-2",defaultValue:(null==c?void 0:c.foreignKey)?"Yes":"No",onChange:e=>{e.target.value.match(/yes/i)?(j(!0),u&&u(e=>(e.foreignKey={foreignKeyName:void 0,destinationTableName:void 0,destinationTableColumnName:void 0,cascadeDelete:!0},e))):(j(!1),u&&u(e=>(delete e.foreignKey,e)))},children:[(0,t.jsx)("option",{value:"No",children:"No"}),(0,t.jsx)("option",{value:"Yes",children:"Yes"})]}),y&&N&&(0,t.jsx)(i.Fragment,{children:(0,t.jsxs)("select",{name:"foreign_key_destination_table_name",id:"foreign_key_destination_table_name",className:"px-2",defaultValue:(null==c?void 0:null===(r=c.foreignKey)||void 0===r?void 0:r.destinationTableName)?c.foreignKey.destinationTableName:void 0,onChange:e=>{var l;let a=e.target;if(null===(l=e.target.value)||void 0===l?void 0:l.match(/--/)){u?u(e=>{let l=e.foreignKey;return l&&(l.destinationTableName=void 0),e}):a.dataset.destinationTableName=void 0;return}let t=N.filter(l=>l.tableName===e.target.value)[0];T(t),(null==t?void 0:t.fields)&&F(t.fields),u?u(l=>{let a=l.foreignKey;return a&&(a.destinationTableName=e.target.value),l}):e.target.dataset.destinationTableName=e.target.value},children:[(0,t.jsx)("option",{value:"--",children:"--Select Table--"}),N.map((e,l)=>(0,t.jsx)("option",{value:e.tableName,children:e.tableFullName},l+1))]})}),w&&_&&(0,t.jsxs)(i.Fragment,{children:[(0,t.jsxs)("select",{name:"foreign_key_destination_table_column_name",id:"foreign_key_destination_table_column_name",className:"px-2",defaultValue:(null==c?void 0:null===(o=c.foreignKey)||void 0===o?void 0:o.destinationTableColumnName)?c.foreignKey.destinationTableColumnName:void 0,onChange:e=>{try{var l;let a=_.filter(l=>l.fieldName===e.target.value)[0];if(A(a),null===(l=e.target.value)||void 0===l?void 0:l.match(/--/)){u&&u(e=>{let l=e.foreignKey;return l&&(l.destinationTableColumnName=void 0),e});return}let t="dsql_".concat(p.user_id,"_").concat(p.db_slug,"_").concat(Date.now());u?u(e=>{e.dataType=a.dataType;let l=e.foreignKey;return l&&(l.destinationTableColumnName=a.fieldName,l.destinationTableColumnType=a.dataType,l.foreignKeyName=t),e}):(e.target.dataset.dataType=a.dataType,e.target.dataset.destinationTableColumnName=a.fieldName,e.target.dataset.foreignKeyName=t)}catch(e){(0,n.A)("/api/admin/clientError",{method:"post",body:{component:"ForeignKey/lines-232-264",message:e.message,user:f}})}},children:[(0,t.jsx)("option",{value:"--",children:"--Select Column--"}),_.map((e,l)=>(0,t.jsx)("option",{value:e.fieldName,children:e.fieldName},l+1))]}),g&&C&&(0,t.jsx)("button",{className:"secondary w-full",onClick:e=>{var l,a;k(!0),(0,n.A)("/api/updateClonedTableForeignKeys",{method:"post",body:{tableData:h,database:p.db_full_name,dbSlug:p.db_slug,delegated:null!==(a=window.location)&&void 0!==a&&null!==(l=a.search)&&void 0!==l&&!!l.match(/delegated=true/i)}},!0).then(e=>{e.success?window.alert("Foreign Key Added Successfully!"):window.alert("Update Failed, Please Try again."),setTimeout(()=>{v&&v(!1)},1e3)})},children:"Add Foreign Key"}),(0,t.jsx)(d.A,{checkBoxValues:[{title:"Cascade Delete",default:D,name:"cascade-delete",onChangeHandler:e=>{V(e.target.checked)}},{title:"Cascade Update",name:"cascade-update",default:I,onChangeHandler:e=>{E(e.target.checked)}}],smallText:!0})]}),g&&(0,t.jsx)("button",{className:"light-gray w-full",onClick:e=>{delete c.foreignKey,v&&v(!1)},children:"Cancel"})]})}},1765:(e,l,a)=>{a.d(l,{A:()=>i});var t=a(4848);function i(e){let{targetField:l}=e;return(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5",style:{minWidth:"70px"},children:[(0,t.jsx)("label",{htmlFor:"rich_text_option",children:"Text Type"}),(0,t.jsxs)("select",{name:"rich_text_option",id:"rich_text_option",className:"px-2",onChange:e=>{switch(delete l.json,delete l.richText,delete l.yaml,delete l.html,delete l.javascript,delete l.shell,e.target.value){case"plain":break;case"rte":l.richText=!0;break;case"json":l.json=!0;break;case"yaml":l.yaml=!0;break;case"html":l.html=!0;break;case"css":l.css=!0;break;case"javascript":l.javascript=!0;break;case"shell":l.shell=!0}},defaultValue:l.richText?"rte":l.json?"json":l.yaml?"yaml":l.html?"html":l.javascript?"javascript":l.shell?"shell":l.css?"css":"plain",children:[(0,t.jsx)("option",{value:"plain",children:"Plain Text"}),(0,t.jsx)("option",{value:"rte",children:"Rich Text"}),(0,t.jsx)("option",{value:"json",children:"JSON"}),(0,t.jsx)("option",{value:"yaml",children:"YAML"}),(0,t.jsx)("option",{value:"html",children:"HTML"}),(0,t.jsx)("option",{value:"css",children:"CSS"}),(0,t.jsx)("option",{value:"javascript",children:"Javascript"}),(0,t.jsx)("option",{value:"shell",children:"Shell"})]})]})}a(6540)},8845:(e,l,a)=>{a.d(l,{A:()=>i});var t=a(2675);function i(e){let{paradigm:l,table:a,query:i,user:n}=e,s="";try{let e="DSQL_".concat(i.single,"_").concat(i.single_table).toUpperCase(),n=a.fields;function d(e){return(null==e?void 0:e.match(/int/i))?"number":(null==e||e.match(/text|varchar|timestamp/i),"string")}let r=[],o=[];r.push("type ".concat(e," = {")),o.push("/**\n * @typedef {object} ".concat(e)),n.forEach(e=>{var l;let a=e.nullValue?"?":(null===(l=e.fieldName)||void 0===l?void 0:l.match(t.A))?"?":"";r.push(" ".concat(e.fieldName).concat(a,": ").concat(d(e.dataType||""),";")),o.push(" * @property {".concat(d(e.dataType||"")).concat(a,"} ").concat(e.fieldName))}),r.push("}"),o.push(" */"),(null==l?void 0:l.match(/javascript/i))&&(s=o.join("\n")),(null==l?void 0:l.match(/typescript/i))&&(s=r.join("\n"))}catch(e){console.log(e.message),s=null}return s}},2408:(e,l,a)=>{a.d(l,{A:()=>i});var t=a(4848);function i(e){let{name:l,checkBoxValues:a,setAlert:i,labelColor:n,flexRow:s,baseText:d,smallText:r,className:o}=e;return(0,t.jsx)("div",{className:"flex items-start gap-x-4"+(s?" flex-row flex-wrap gap-y-2 ":" flex-col gap-y-4 ")+(o||""),children:a.map((e,a)=>{let{payload:s,title:o,onChangeHandler:c,fixed:u,jsx:m}=e,x=e.name?"".concat(l,"-").concat(e.name):s?l+"-"+s:l;return(0,t.jsxs)("div",{className:"flex items-center"+(e.default&&u?" pointer-events-none":"")+(r?" gap-1 ":" gap-2 ")+((null==e?void 0:e.className)?e.className:""),children:[(0,t.jsx)("input",{className:"m-0"+(r?" w-4 h-4":" w-5 h-5"),type:"checkbox",defaultChecked:!!e.default,name:x,id:x,onChange:l=>{i&&i(null),c&&c(l,e)},value:s,style:{minWidth:"20px"},...e.props}),m||(0,t.jsx)("label",{htmlFor:x,className:"m-0 "+(n||"text-slate-800 dark:text-white/80")+(d||r?" text-base":" text-lg"),children:o})]},a+1)})})}a(6540)},1342:(e,l,a)=>{a.d(l,{A:()=>i});var t=a(4848);function i(e){let{collapse:l,setCollapse:a}=e;return(0,t.jsxs)("div",{className:"collapse-block"+(l?" -mt-16 -mb-6 pt-10":" mt-0 mb-0 p-0"),onClick:e=>{l?a(!1):a(!0)},children:[(0,t.jsx)("span",{children:l?"Expand":"Collapse"}),(0,t.jsx)("img",{src:"/images/down-arrow-dark.svg",alt:"Down Arrow",width:16,className:"dark:hidden opacity-30 "+(l?"":"rotate-180")}),(0,t.jsx)("img",{src:"/images/down-arrow-white.svg",alt:"Down Arrow",width:16,className:"opacity-30 hidden dark:flex "+(l?"":"rotate-180")})]})}a(6540)},9878:(e,l,a)=>{a.d(l,{A:()=>d});var t=a(4848),i=a(6540),n=a(5338),s=a(6897);function d(e){let{children:l,open:a,setOpen:s,onClose:d,maxWidth:o}=e;return i.useEffect(()=>{if(a){let e=document.createElement("div");e.className="modal-wrapper",(0,n.createRoot)(e).render((0,t.jsx)(r,{onClose:d,maxWidth:o,children:l})),document.body.appendChild(e)}else document.querySelectorAll(".modal-wrapper").forEach(e=>{var l;null===(l=e.parentElement)||void 0===l||l.removeChild(e)})},[a]),(0,t.jsx)(t.Fragment,{})}function r(e){let{children:l,onClose:a,maxWidth:n,open:d}=e,r=i.useRef();return(0,t.jsxs)(i.Fragment,{children:[(0,t.jsx)("div",{className:"modal-cancel",onClick:e=>{o({modalEl:e.target.closest(".modal-wrapper"),closeFn:a})}}),(0,t.jsxs)("div",{className:"modal-content",style:{maxWidth:n||void 0},ref:r,children:[l," ",(0,t.jsx)("button",{className:"ghost modal-cancel-button",onClick:e=>{o({modalEl:e.target.closest(".modal-wrapper"),closeFn:a})},children:(0,t.jsx)(s.A,{})})]})]})}function o(e){var l;let{modalEl:a,closeFn:t}=e;t&&t(),null===(l=a.parentElement)||void 0===l||l.removeChild(a)}},2675:(e,l,a)=>{a.d(l,{A:()=>t});let t=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/},4327:e=>{e.exports=JSON.parse('[{"title":"VARCHAR","name":"VARCHAR","value":"0-255","argument":true,"description":"Varchar is simply letters and numbers within the range 0 - 255","maxValue":255},{"title":"TINYINT","name":"TINYINT","value":"0-100","description":"TINYINT means Integers: 0 to 100","maxValue":127},{"title":"SMALLINT","name":"SMALLINT","value":"0-255","description":"SMALLINT means Integers: 0 to 240933","maxValue":32767},{"title":"MEDIUMINT","name":"MEDIUMINT","value":"0-255","description":"MEDIUMINT means Integers: 0 to 1245568545560","maxValue":8388607},{"title":"INT","name":"INT","value":"0-255","description":"INT means Integers: 0 to 12560","maxValue":2147483647},{"title":"BIGINT","name":"BIGINT","value":"0-255","description":"BIGINT means Integers: 0 to 1245569056767568545560","maxValue":2e+63},{"title":"TINYTEXT","name":"TINYTEXT","value":"0-255","description":"Text with 255 max characters","maxValue":127},{"title":"TEXT","name":"TEXT","value":"0-100","description":"MEDIUMTEXT is just text with max length 16,777,215","maxValue":127},{"title":"MEDIUMTEXT","name":"MEDIUMTEXT","value":"0-255","description":"MEDIUMTEXT is just text with max length 16,777,215","maxValue":127},{"title":"LONGTEXT","name":"LONGTEXT","value":"0-255","description":"LONGTEXT is just text with max length 4,294,967,295","maxValue":127},{"title":"UUID","name":"UUID","valueLiteral":"UUID()","description":"A Unique ID"}]')}}]);