supython 0.1.0__py3-none-any.whl

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.
Files changed (200) hide show
  1. supython/__init__.py +24 -0
  2. supython/admin/__init__.py +3 -0
  3. supython/admin/api/__init__.py +24 -0
  4. supython/admin/api/auth.py +118 -0
  5. supython/admin/api/auth_templates.py +67 -0
  6. supython/admin/api/auth_users.py +225 -0
  7. supython/admin/api/db.py +174 -0
  8. supython/admin/api/functions.py +92 -0
  9. supython/admin/api/jobs.py +192 -0
  10. supython/admin/api/ops.py +224 -0
  11. supython/admin/api/realtime.py +281 -0
  12. supython/admin/api/service_auth.py +49 -0
  13. supython/admin/api/service_auth_templates.py +83 -0
  14. supython/admin/api/service_auth_users.py +346 -0
  15. supython/admin/api/service_db.py +214 -0
  16. supython/admin/api/service_functions.py +287 -0
  17. supython/admin/api/service_jobs.py +282 -0
  18. supython/admin/api/service_ops.py +213 -0
  19. supython/admin/api/service_realtime.py +30 -0
  20. supython/admin/api/service_storage.py +220 -0
  21. supython/admin/api/storage.py +117 -0
  22. supython/admin/api/system.py +37 -0
  23. supython/admin/audit.py +29 -0
  24. supython/admin/deps.py +22 -0
  25. supython/admin/errors.py +16 -0
  26. supython/admin/schemas.py +310 -0
  27. supython/admin/session.py +52 -0
  28. supython/admin/spa.py +38 -0
  29. supython/admin/static/assets/Alert-dluGVkos.js +49 -0
  30. supython/admin/static/assets/Audit-Njung3HI.js +2 -0
  31. supython/admin/static/assets/Backups-DzPlFgrm.js +2 -0
  32. supython/admin/static/assets/Buckets-ByacGkU1.js +2 -0
  33. supython/admin/static/assets/Channels-BoIuTtam.js +353 -0
  34. supython/admin/static/assets/ChevronRight-CtQH1EQ1.js +2 -0
  35. supython/admin/static/assets/CodeViewer-Bqy7-wvH.js +2 -0
  36. supython/admin/static/assets/Crons-B67vc39F.js +2 -0
  37. supython/admin/static/assets/DashboardView-CUTFVL6k.js +2 -0
  38. supython/admin/static/assets/DataTable-COAAWEft.js +747 -0
  39. supython/admin/static/assets/DescriptionsItem-P8JUDaBs.js +75 -0
  40. supython/admin/static/assets/DrawerContent-TpYTFgF1.js +139 -0
  41. supython/admin/static/assets/Empty-cr2r7e2u.js +25 -0
  42. supython/admin/static/assets/EmptyState-DeDck-OL.js +2 -0
  43. supython/admin/static/assets/Grid-hFkp9F4P.js +2 -0
  44. supython/admin/static/assets/Input-DppYTq9C.js +259 -0
  45. supython/admin/static/assets/Invoke-DW3Nveeh.js +2 -0
  46. supython/admin/static/assets/JsonField-DibyJgun.js +2 -0
  47. supython/admin/static/assets/LoginView-BjLyE3Ds.css +1 -0
  48. supython/admin/static/assets/LoginView-CoOjECT_.js +111 -0
  49. supython/admin/static/assets/Logs-D9WYrnIT.js +2 -0
  50. supython/admin/static/assets/Logs-DS1XPa0h.css +1 -0
  51. supython/admin/static/assets/Migrations-DOSC2ddQ.js +2 -0
  52. supython/admin/static/assets/ObjectBrowser-_5w8vOX8.js +2 -0
  53. supython/admin/static/assets/Queue-CywZs6vI.js +2 -0
  54. supython/admin/static/assets/RefreshTokens-Ccjr53jg.js +2 -0
  55. supython/admin/static/assets/RlsEditor-BSlH9vSc.js +2 -0
  56. supython/admin/static/assets/Routes-BiLXE49D.js +2 -0
  57. supython/admin/static/assets/Routes-C-ianIGD.css +1 -0
  58. supython/admin/static/assets/SchemaBrowser-DKy2_KQi.css +1 -0
  59. supython/admin/static/assets/SchemaBrowser-XFvFbtDB.js +2 -0
  60. supython/admin/static/assets/Select-DIzZyRZb.js +434 -0
  61. supython/admin/static/assets/Space-n5-XcguU.js +400 -0
  62. supython/admin/static/assets/SqlEditor-b8pTsILY.js +3 -0
  63. supython/admin/static/assets/SqlWorkspace-BUS7IntH.js +104 -0
  64. supython/admin/static/assets/TableData-CQIagLKn.js +2 -0
  65. supython/admin/static/assets/Tag-D1fOKpTH.js +72 -0
  66. supython/admin/static/assets/Templates-BS-ugkdq.js +2 -0
  67. supython/admin/static/assets/Thing-CEAniuMg.js +107 -0
  68. supython/admin/static/assets/Users-wzwajhlh.js +2 -0
  69. supython/admin/static/assets/_plugin-vue_export-helper-DGA9ry_j.js +1 -0
  70. supython/admin/static/assets/dist-VXIJLCYq.js +13 -0
  71. supython/admin/static/assets/format-length-CGCY1rMh.js +2 -0
  72. supython/admin/static/assets/get-Ca6unauB.js +2 -0
  73. supython/admin/static/assets/index-CeE6v959.js +951 -0
  74. supython/admin/static/assets/pinia-COXwfrOX.js +2 -0
  75. supython/admin/static/assets/resources-Bt6thQCD.js +44 -0
  76. supython/admin/static/assets/use-locale-mtgM0a3a.js +2 -0
  77. supython/admin/static/assets/use-merged-state-BvhkaHNX.js +2 -0
  78. supython/admin/static/assets/useConfirm-tMjvBFXR.js +2 -0
  79. supython/admin/static/assets/useResource-C_rJCY8C.js +2 -0
  80. supython/admin/static/assets/useTable-CnZc5zhi.js +363 -0
  81. supython/admin/static/assets/useTable-Dg0XlRlq.css +1 -0
  82. supython/admin/static/assets/useToast-DsZKx0IX.js +2 -0
  83. supython/admin/static/assets/utils-sbXoq7Ir.js +2 -0
  84. supython/admin/static/favicon.svg +1 -0
  85. supython/admin/static/icons.svg +24 -0
  86. supython/admin/static/index.html +24 -0
  87. supython/app.py +162 -0
  88. supython/auth/__init__.py +3 -0
  89. supython/auth/_email_job.py +11 -0
  90. supython/auth/providers/__init__.py +34 -0
  91. supython/auth/providers/github.py +22 -0
  92. supython/auth/providers/google.py +19 -0
  93. supython/auth/providers/oauth.py +56 -0
  94. supython/auth/providers/registry.py +16 -0
  95. supython/auth/ratelimit.py +39 -0
  96. supython/auth/router.py +282 -0
  97. supython/auth/schemas.py +79 -0
  98. supython/auth/service.py +587 -0
  99. supython/backups/__init__.py +24 -0
  100. supython/backups/_backup_job.py +170 -0
  101. supython/backups/schemas.py +18 -0
  102. supython/backups/service.py +217 -0
  103. supython/body_size.py +184 -0
  104. supython/cli.py +1663 -0
  105. supython/client/__init__.py +67 -0
  106. supython/client/_auth.py +249 -0
  107. supython/client/_client.py +145 -0
  108. supython/client/_config.py +92 -0
  109. supython/client/_functions.py +69 -0
  110. supython/client/_storage.py +255 -0
  111. supython/client/py.typed +0 -0
  112. supython/db.py +151 -0
  113. supython/db_admin.py +8 -0
  114. supython/extensions.py +36 -0
  115. supython/functions/__init__.py +19 -0
  116. supython/functions/context.py +262 -0
  117. supython/functions/loader.py +307 -0
  118. supython/functions/router.py +228 -0
  119. supython/functions/schemas.py +50 -0
  120. supython/gen/__init__.py +5 -0
  121. supython/gen/_introspect.py +137 -0
  122. supython/gen/types_py.py +270 -0
  123. supython/gen/types_ts.py +365 -0
  124. supython/health.py +229 -0
  125. supython/hooks.py +117 -0
  126. supython/jobs/__init__.py +31 -0
  127. supython/jobs/backends.py +97 -0
  128. supython/jobs/context.py +58 -0
  129. supython/jobs/cron.py +152 -0
  130. supython/jobs/cron_inproc.py +119 -0
  131. supython/jobs/decorators.py +76 -0
  132. supython/jobs/registry.py +79 -0
  133. supython/jobs/router.py +136 -0
  134. supython/jobs/schemas.py +92 -0
  135. supython/jobs/service.py +311 -0
  136. supython/jobs/worker.py +219 -0
  137. supython/jwks.py +257 -0
  138. supython/keyset.py +279 -0
  139. supython/logging_config.py +291 -0
  140. supython/mail.py +33 -0
  141. supython/mailer.py +65 -0
  142. supython/migrate.py +81 -0
  143. supython/migrations/0001_extensions_and_roles.sql +46 -0
  144. supython/migrations/0002_auth_schema.sql +66 -0
  145. supython/migrations/0003_demo_todos.sql +42 -0
  146. supython/migrations/0004_auth_v0_2.sql +47 -0
  147. supython/migrations/0005_storage_schema.sql +117 -0
  148. supython/migrations/0006_realtime_schema.sql +206 -0
  149. supython/migrations/0007_jobs_schema.sql +254 -0
  150. supython/migrations/0008_jobs_last_error.sql +56 -0
  151. supython/migrations/0009_auth_rate_limits.sql +33 -0
  152. supython/migrations/0010_worker_heartbeat.sql +14 -0
  153. supython/migrations/0011_admin_schema.sql +45 -0
  154. supython/migrations/0012_auth_banned_until.sql +10 -0
  155. supython/migrations/0013_email_templates.sql +19 -0
  156. supython/migrations/0014_realtime_payload_warning.sql +96 -0
  157. supython/migrations/0015_backups_schema.sql +14 -0
  158. supython/passwords.py +15 -0
  159. supython/realtime/__init__.py +6 -0
  160. supython/realtime/broker.py +814 -0
  161. supython/realtime/protocol.py +234 -0
  162. supython/realtime/router.py +184 -0
  163. supython/realtime/schemas.py +207 -0
  164. supython/realtime/service.py +261 -0
  165. supython/realtime/topics.py +175 -0
  166. supython/realtime/websocket.py +586 -0
  167. supython/scaffold/__init__.py +5 -0
  168. supython/scaffold/init_project.py +144 -0
  169. supython/scaffold/templates/Caddyfile.tmpl +4 -0
  170. supython/scaffold/templates/README.md.tmpl +22 -0
  171. supython/scaffold/templates/apps_hooks.py.tmpl +11 -0
  172. supython/scaffold/templates/apps_jobs.py.tmpl +8 -0
  173. supython/scaffold/templates/asgi.py.tmpl +14 -0
  174. supython/scaffold/templates/docker-compose.prod.yml.tmpl +84 -0
  175. supython/scaffold/templates/docker-compose.yml.tmpl +45 -0
  176. supython/scaffold/templates/docker_postgres_Dockerfile.tmpl +9 -0
  177. supython/scaffold/templates/docker_postgres_postgresql.conf.tmpl +3 -0
  178. supython/scaffold/templates/env.example.tmpl +168 -0
  179. supython/scaffold/templates/functions_README.md.tmpl +21 -0
  180. supython/scaffold/templates/gitignore.tmpl +14 -0
  181. supython/scaffold/templates/manage.py.tmpl +11 -0
  182. supython/scaffold/templates/migrations/.gitkeep +0 -0
  183. supython/scaffold/templates/package_init.py.tmpl +1 -0
  184. supython/scaffold/templates/settings.py.tmpl +31 -0
  185. supython/secretset.py +347 -0
  186. supython/security_headers.py +78 -0
  187. supython/settings.py +244 -0
  188. supython/settings_module.py +117 -0
  189. supython/storage/__init__.py +5 -0
  190. supython/storage/backends.py +392 -0
  191. supython/storage/router.py +341 -0
  192. supython/storage/schemas.py +50 -0
  193. supython/storage/service.py +445 -0
  194. supython/storage/signing.py +119 -0
  195. supython/tokens.py +85 -0
  196. supython-0.1.0.dist-info/METADATA +756 -0
  197. supython-0.1.0.dist-info/RECORD +200 -0
  198. supython-0.1.0.dist-info/WHEEL +4 -0
  199. supython-0.1.0.dist-info/entry_points.txt +2 -0
  200. supython-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,3 @@
1
+ import{In as e,Mn as t,Pn as n,Sn as r,Un as i,lr as a,tr as o,vn as s}from"./Space-n5-XcguU.js";import{C as c,S as l,_ as u,a as d,b as f,c as p,d as m,f as h,g as ee,h as g,i as te,l as ne,m as re,n as ie,o as ae,p as oe,r as se,s as ce,t as le,u as ue,v as de,x as fe,y as _}from"./dist-VXIJLCYq.js";var pe=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new v(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){n<r.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from;n<r.minRepeatTerm&&s==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this.buffer.length;if(e>0&&this.buffer[e-4]==0&&this.buffer[e-1]>-1){if(t==n)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new me(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216))if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new v(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},v=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},me=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},he=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function y(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r<e.length;){let a=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(t==126){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var b=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},ge=new b,_e=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=ge,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=ge,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk=``,this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},x=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;S(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};x.prototype.contextual=x.prototype.fallback=x.prototype.extend=!1;var ve=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?y(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(S(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};ve.prototype.contextual=x.prototype.fallback=x.prototype.extend=!1;var ye=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function S(e,t,n,r,i,a){let o=0,s=1<<r,{dialect:c}=n.p.parser;scan:for(;(s&e[o])!=0;){let n=e[o+1];for(let r=o+3;r<n;r+=2)if((e[r+1]&s)>0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||be(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l<u;){let i=l+u>>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r<s)u=i;else if(r>=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function C(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function be(e,t,n,r){let i=C(n,r,t);return i<0||C(n,r,e)<i}var w=typeof process<`u`&&/\bparse\b/.test({}.LOG),T=null;function E(e,t,n){let r=e.cursor(re.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var xe=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?E(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?E(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],r=this.index[t];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=n.children[r],a=this.start[t]+n.positions[r];if(a>e)return this.nextStart=a,null;if(i instanceof _){if(a==e){if(a<this.safeFrom)return null;let e=a+i.length;if(e<=this.safeTo){let t=i.prop(g.lookAhead);if(!t||e+t<this.fragment.to)return i}}this.index[t]++,a+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+i.length}}},Se=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new b)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;r<i.length;r++){if(!(1<<r&a))continue;let c=i[r],l=this.tokens[r];if(!(n&&!c.fallback)&&((c.contextual||l.start!=e.pos||l.mask!=a||l.context!=o)&&(this.updateCachedToken(l,c,e),l.mask=a,l.context=o),l.lookAhead>l.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new b,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new b,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(o[s]==65535)if(o[s+1]==1)s=O(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(O(o,s+2),t,n,r));break}o[s]==t&&(r=this.putAction(O(o,s+1),t,n,r))}return r}},Ce=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new _e(t,r),this.tokens=new Se(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[pe.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new xe(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&Ee(r);if(e)return w&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw w&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return w&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500)if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}advanceStack(e,t,n){let r=e.pos,{parser:i}=this,a=w?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let o=this.fragments.nodeAt(r);o;){let r=this.parser.nodeSet.types[o.type.id]==o.type?i.getGoto(e.state,o.type.id):-1;if(r>-1&&o.length&&(!t||(o.prop(g.contextHash)||0)==n))return e.useNode(o,r),w&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(o.type.id)})`),!0;if(!(o instanceof _)||o.children.length==0||o.positions[0]>0)break;let s=o.children[0];if(s instanceof _&&o.positions[0]==0)o=s;else break}}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),w&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let o=0;o<s.length;){let c=s[o++],l=s[o++],u=s[o++],d=o==s.length||!n,f=d?e:e.split(),p=this.tokens.mainToken;if(f.apply(c,l,p?p.start:f.pos,u),w&&console.log(a+this.stackID(f)+` (via ${c&65536?`reduce of ${i.getName(c&65535)}`:`shift`} for ${i.getName(l)} @ ${r}${f==e?``:`, split`})`),d)return!0;f.pos>r?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return D(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],c=t[(a<<1)+1],l=w?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),w&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(w&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)w&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))w&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),w&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),D(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),_.build({buffer:he.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(T||=new WeakMap).get(e);return t||T.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function D(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var we=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},Te=class e extends de{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(` `);this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push(``);let n=Object.keys(e.topRules).map(t=>e.topRules[t][1]),r=[];for(let e=0;e<t.length;e++)r.push([]);function i(e,t,n){r[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];typeof e==`string`&&(e=g[e]);for(let n=1;n<t.length;){let r=t[n++];if(r>=0)i(r,e,t[n++]);else{let a=t[n+-r];for(let o=-r;o>0;o--)i(t[n++],e,a);n++}}}this.nodeSet=new ee(t.map((t,i)=>u.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:r[i],top:n.indexOf(i)>-1,error:i==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=oe;let a=y(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(De),this.states=y(e.states,Uint32Array),this.data=y(e.stateData),this.goto=y(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>typeof e==`number`?new x(a,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new Ce(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return o;if(a)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),a;;i+=3){if((a=n[i])==65535)if(n[i+1]==1)a=n[i=O(n,i+2)];else if(n[i+1]==2)return O(n,i+2);else break;if(a==t||a==0)return O(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=O(this.data,n+2);else break;r=t(O(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=O(this.data,n+2);else break;if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(t){let n=Object.assign(Object.create(e.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let e=this.topRules[t.top];if(!e)throw RangeError(`Invalid top rule name ${t.top}`);n.top=e}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(e=>{let n=t.tokenizers.find(t=>t.from==e);return n?n.to:e})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((e,r)=>{let i=t.specializers.find(t=>t.from==e.external);if(!i)return e;let a=Object.assign(Object.assign({},e),{external:i.to});return n.specializers[r]=De(a),a})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;(i=this.data[n++])!=65535;)(r||=new Uint8Array(this.maxTerm+1))[i]=1;return new we(e,n,r)}static deserialize(t){return new e(t)}};function O(e,t){return e[t]|e[t+1]<<16}function Ee(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||e!=null&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function De(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}var Oe=36,k=1,ke=2,A=3,j=4,Ae=5,je=6,Me=7,Ne=8,Pe=9,Fe=10,Ie=11,Le=12,Re=13,ze=14,Be=15,Ve=16,He=17,M=18,Ue=19,N=20,P=21,F=22,We=23,Ge=24;function I(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function Ke(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function L(e,t,n){for(let r=!1;;){if(e.next<0)return;if(e.next==t&&!r){e.advance();return}r=n&&!r&&e.next==92,e.advance()}}function qe(e,t){scan:for(;;){if(e.next<0)return;if(e.next==36){e.advance();for(let n=0;n<t.length;n++){if(e.next!=t.charCodeAt(n))continue scan;e.advance()}if(e.next==36){e.advance();return}}else e.advance()}}function Je(e,t){let n=`[{<(`.indexOf(String.fromCharCode(t)),r=n<0?t:`]}>)`.charCodeAt(n);for(;;){if(e.next<0)return;if(e.next==r&&e.peek(1)==39){e.advance(2);return}e.advance()}}function R(e,t){for(;!(e.next!=95&&!I(e.next));)t!=null&&(t+=String.fromCharCode(e.next)),e.advance();return t}function Ye(e){if(e.next==39||e.next==34||e.next==96){let t=e.next;e.advance(),L(e,t,!1)}else R(e)}function z(e,t){for(;e.next==48||e.next==49;)e.advance();t&&e.next==t&&e.advance()}function B(e,t){for(;;){if(e.next==46){if(t)break;t=!0}else if(e.next<48||e.next>57)break;e.advance()}if(e.next==69||e.next==101)for(e.advance(),(e.next==43||e.next==45)&&e.advance();e.next>=48&&e.next<=57;)e.advance()}function V(e){for(;!(e.next<0||e.next==10);)e.advance()}function H(e,t){for(let n=0;n<t.length;n++)if(t.charCodeAt(n)==e)return!0;return!1}var U=` \r
2
+ `;function W(e,t,n){let r=Object.create(null);r.true=r.false=Ae,r.null=r.unknown=je;for(let t of e.split(` `))t&&(r[t]=N);for(let e of t.split(` `))e&&(r[e]=P);for(let e of(n||``).split(` `))e&&(r[e]=Ge);return r}var G=`array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying `,K=`absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone `,q={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:`*+-%<>!=&|~^/`,specialVar:`?`,identifierQuotes:`"`,caseInsensitiveIdentifiers:!1,words:W(K,G)};function Xe(e,t,n,r){let i={};for(let t in q)i[t]=(e.hasOwnProperty(t)?e:q)[t];return t&&(i.words=W(t,n||``,r)),i}function J(e){return new ye(t=>{let{next:n}=t;if(t.advance(),H(n,U)){for(;H(t.next,U);)t.advance();t.acceptToken(Oe)}else if(n==36&&e.doubleDollarQuotedStrings){let e=R(t,``);t.next==36&&(t.advance(),qe(t,e),t.acceptToken(A))}else if(n==39||n==34&&e.doubleQuotedStrings)L(t,n,e.backslashEscapes),t.acceptToken(A);else if(n==35&&e.hashComments||n==47&&t.next==47&&e.slashComments)V(t),t.acceptToken(k);else if(n==45&&t.next==45&&(!e.spaceAfterDashes||t.peek(1)==32))V(t),t.acceptToken(k);else if(n==47&&t.next==42){t.advance();for(let e=1;;){let n=t.next;if(t.next<0)break;if(t.advance(),n==42&&t.next==47){if(e--,t.advance(),!e)break}else n==47&&t.next==42&&(e++,t.advance())}t.acceptToken(ke)}else if((n==101||n==69)&&t.next==39)t.advance(),L(t,39,!0),t.acceptToken(A);else if((n==110||n==78)&&t.next==39&&e.charSetCasts)t.advance(),L(t,39,e.backslashEscapes),t.acceptToken(A);else if(n==95&&e.charSetCasts)for(let n=0;;n++){if(t.next==39&&n>1){t.advance(),L(t,39,e.backslashEscapes),t.acceptToken(A);break}if(!I(t.next))break;t.advance()}else if(e.plsqlQuotingMechanism&&(n==113||n==81)&&t.next==39&&t.peek(1)>0&&!H(t.peek(1),U)){let e=t.peek(1);t.advance(2),Je(t,e),t.acceptToken(A)}else if(H(n,e.identifierQuotes))L(t,n==91?93:n,!1),t.acceptToken(Ue);else if(n==40)t.acceptToken(Me);else if(n==41)t.acceptToken(Ne);else if(n==123)t.acceptToken(Pe);else if(n==125)t.acceptToken(Fe);else if(n==91)t.acceptToken(Ie);else if(n==93)t.acceptToken(Le);else if(n==59)t.acceptToken(Re);else if(e.unquotedBitLiterals&&n==48&&t.next==98)t.advance(),z(t),t.acceptToken(F);else if((n==98||n==66)&&(t.next==39||t.next==34)){let n=t.next;t.advance(),e.treatBitsAsBytes?(L(t,n,e.backslashEscapes),t.acceptToken(We)):(z(t,n),t.acceptToken(F))}else if(n==48&&(t.next==120||t.next==88)||(n==120||n==88)&&t.next==39){let e=t.next==39;for(t.advance();Ke(t.next);)t.advance();e&&t.next==39&&t.advance(),t.acceptToken(j)}else if(n==46&&t.next>=48&&t.next<=57)B(t,!0),t.acceptToken(j);else if(n==46)t.acceptToken(ze);else if(n>=48&&n<=57)B(t,!1),t.acceptToken(j);else if(H(n,e.operatorChars)){for(;H(t.next,e.operatorChars);)t.advance();t.acceptToken(Be)}else if(H(n,e.specialVar))t.next==n&&t.advance(),Ye(t),t.acceptToken(He);else if(n==58||n==44)t.acceptToken(Ve);else if(I(n)){let r=R(t,String.fromCharCode(n));t.acceptToken(t.next==46||t.peek(-r.length-1)==46?M:e.words[r.toLowerCase()]??M)}})}var Y=J(q),Ze=Te.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:`⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement`,maxTerm:38,nodeProps:[[`isolate`,-4,1,2,3,19,``]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:`RORO`,tokenizers:[0,Y],topRules:{Script:[0,25]},tokenPrec:0});function X(e){let t=e.cursor().moveTo(e.from,-1);for(;/Comment/.test(t.name);)t.moveTo(t.from,-1);return t.node}function Z(e,t){let n=e.sliceString(t.from,t.to),r=/^([`'"\[])(.*)([`'"\]])$/.exec(n);return r?r[2]:n}function Q(e){return e&&(e.name==`Identifier`||e.name==`QuotedIdentifier`)}function Qe(e,t){if(t.name==`CompositeIdentifier`){let n=[];for(let r=t.firstChild;r;r=r.nextSibling)Q(r)&&n.push(Z(e,r));return n}return[Z(e,t)]}function $e(e,t){for(let n=[];;){if(!t||t.name!=`.`)return n;let r=X(t);if(!Q(r))return n;n.unshift(Z(e,r)),t=X(r)}}function et(e,t){let n=ue(e).resolveInner(t,-1),r=nt(e.doc,n);return n.name==`Identifier`||n.name==`QuotedIdentifier`||n.name==`Keyword`?{from:n.from,quoted:n.name==`QuotedIdentifier`?e.doc.sliceString(n.from,n.from+1):null,parents:$e(e.doc,X(n)),aliases:r}:n.name==`.`?{from:t,quoted:null,parents:$e(e.doc,n),aliases:r}:{from:t,quoted:null,parents:[],empty:!0,aliases:r}}var tt=new Set(`where group having order union intersect except all distinct limit offset fetch for`.split(` `));function nt(e,t){let n;for(let e=t;!n;e=e.parent){if(!e)return null;e.name==`Statement`&&(n=e)}let r=null;for(let t=n.firstChild,i=!1,a=null;t;t=t.nextSibling){let n=t.name==`Keyword`?e.sliceString(t.from,t.to).toLowerCase():null,o=null;if(!i)i=n==`from`;else if(n==`as`&&a&&Q(t.nextSibling))o=Z(e,t.nextSibling);else if(n&&tt.has(n))break;else a&&Q(t)&&(o=Z(e,t));o&&(r||=Object.create(null),r[o]=Qe(e,a)),a=/Identifier$/.test(t.name)?t:null}return r}function rt(e,t,n){return n.map(n=>({...n,label:n.label[0]==e?n.label:e+n.label+t,apply:void 0}))}var it=/^\w*$/,at=/^[`'"\[]?\w*[`'"\]]?$/;function ot(e){return e.self&&typeof e.self.label==`string`}var st=class e{constructor(e,t){this.idQuote=e,this.idCaseInsensitive=t,this.list=[],this.children=void 0}child(t){let n=this.children||=Object.create(null);return n[t]||(t&&!this.list.some(e=>e.label==t)&&this.list.push(ct(t,`type`,this.idQuote,this.idCaseInsensitive)),n[t]=new e(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex(t=>t.label==e.label);t>-1?this.list[t]=e:this.list.push(e)}addCompletions(e){for(let t of e)this.addCompletion(typeof t==`string`?ct(t,`property`,this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):ot(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let n=e[t],r=null,i=t.replace(/\\?\./g,e=>e==`.`?`\0`:e).split(`\0`),a=this;ot(n)&&(r=n.self,n=n.children);for(let e=0;e<i.length;e++)r&&e==i.length-1&&a.addCompletion(r),a=a.child(i[e].replace(/\\\./g,`.`));a.addNamespace(n)}}};function ct(e,t,n,r){return RegExp(`^[a-z_][a-z_\\d]*$`,r?`i`:``).test(e)?{label:e,type:t}:{label:e,type:t,apply:n+e+lt(n)}}function lt(e){return e===`[`?`]`:e}function ut(e,t,n,r,i,a){let o=new st(a?.spec.identifierQuotes?.[0]||`"`,!!a?.spec.caseInsensitiveIdentifiers),s=i?o.child(i):null;return o.addNamespace(e),t&&(s||o).addCompletions(t),n&&o.addCompletions(n),s&&o.addCompletions(s.list),r&&o.addCompletions((s||o).child(r).list),e=>{let{parents:t,from:n,quoted:i,empty:a,aliases:c}=et(e.state,e.pos);if(a&&!e.explicit)return null;c&&t.length==1&&(t=c[t[0]]||t);let l=o;for(let e of t){for(;!l.children||!l.children[e];)if(l==o&&s)l=s;else if(l==s&&r)l=l.child(r);else return null;let t=l.maybeChild(e);if(!t)return null;l=t}let u=l.list;if(l==o&&c&&(u=u.concat(Object.keys(c).map(e=>({label:e,type:`constant`})))),i){let t=i[0],r=lt(t);return{from:n,to:e.state.sliceDoc(e.pos,e.pos+1)==r?e.pos+1:void 0,options:rt(t,r,u),validFor:at}}else return{from:n,options:u,validFor:it}}}function dt(e){return e==P?`type`:e==N?`keyword`:`variable`}function ft(e,t,n){return te([`QuotedIdentifier`,`String`,`LineComment`,`BlockComment`,`.`],se(Object.keys(e).map(r=>n(t?r.toUpperCase():r,dt(e[r])))))}var pt=Ze.configure({props:[ne.add({Statement:ce()}),p.add({Statement(e,t){return{from:Math.min(e.from+100,t.doc.lineAt(e.from).to),to:e.to}},BlockComment(e){return{from:e.from+2,to:e.to-2}}}),m({Keyword:h.keyword,Type:h.typeName,Builtin:h.standard(h.name),Bits:h.number,Bytes:h.string,Bool:h.bool,Null:h.null,Number:h.number,String:h.string,Identifier:h.name,QuotedIdentifier:h.special(h.string),SpecialVar:h.special(h.name),LineComment:h.lineComment,BlockComment:h.blockComment,Operator:h.operator,"Semi Punctuation":h.punctuation,"( )":h.paren,"{ }":h.brace,"[ ]":h.squareBracket})]}),mt=class e{constructor(e,t,n){this.dialect=e,this.language=t,this.spec=n}get extension(){return this.language.extension}configureLanguage(t,n){return new e(this.dialect,this.language.configure(t,n),this.spec)}static define(t){let n=Xe(t,t.keywords,t.types,t.builtin);return new e(n,d.define({name:`sql`,parser:pt.configure({tokenizers:[{from:Y,to:J(n)}]}),languageData:{commentTokens:{line:`--`,block:{open:`/*`,close:`*/`}},closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]}}}),t)}};function ht(e,t){return{label:e,type:t,boost:-1}}function gt(e,t=!1,n){return ft(e.dialect.words,t,n||ht)}function _t(e){return e.schema?ut(e.schema,e.tables,e.schemas,e.defaultTable,e.defaultSchema,e.dialect||$):()=>null}function vt(e){return e.schema?(e.dialect||$).language.data.of({autocomplete:_t(e)}):[]}function yt(e={}){let t=e.dialect||$;return new ae(t.language,[vt(e),t.language.data.of({autocomplete:gt(t,e.upperCaseKeywords,e.keywordCompletion)})])}var $=mt.define({});K+``,G+``,G+``,K+``,K+``,K+``,G+``,K+``,G+``,G+``,K+``,G+``;var bt=r({__name:`SqlEditor`,props:{modelValue:{},readOnly:{type:Boolean},height:{},onRun:{type:Function}},emits:[`update:modelValue`],setup(r,{emit:u}){let d=r,p=u,m=o(),h;return n(()=>{let e=[ie,yt(),le,f.updateListener.of(e=>{e.docChanged&&p(`update:modelValue`,e.state.doc.toString())}),l.readOnly.of(d.readOnly??!1),f.theme({"&":{height:`100%`},".cm-scroller":{overflow:`auto`}})];d.onRun&&e.push(c.highest(fe.of([{key:`Mod-Enter`,run:()=>(d.onRun(),!0)}]))),h=new f({doc:d.modelValue,extensions:e,parent:m.value})}),t(()=>h?.destroy()),i(()=>d.modelValue,e=>{h&&e!==h.state.doc.toString()&&h.dispatch({changes:{from:0,to:h.state.doc.length,insert:e}})}),(t,n)=>(e(),s(`div`,{ref_key:`host`,ref:m,style:a({height:r.height??`320px`,border:`1px solid var(--n-border-color)`})},null,4))}});export{bt as t};
3
+ //# sourceMappingURL=SqlEditor-b8pTsILY.js.map
@@ -0,0 +1,104 @@
1
+ import{C as e,Ft as t,Gn as n,Gt as r,In as i,Jt as a,Kt as o,O as s,Sn as c,T as l,Vt as u,Xt as d,Yt as f,Zt as p,_ as m,_t as h,ar as g,bn as _,c as v,ct as y,gn as b,hn as x,lr as S,lt as C,mn as w,mt as T,r as E,sr as D,t as O,tr as k,ur as A,ut as j,vn as M,wn as N,xn as P,xt as F,y as I,zt as L}from"./Space-n5-XcguU.js";import{t as R}from"./Select-DIzZyRZb.js";import{t as z}from"./use-merged-state-BvhkaHNX.js";import{t as B}from"./Tag-D1fOKpTH.js";import{t as V}from"./DataTable-COAAWEft.js";import{l as H,n as U}from"./resources-Bt6thQCD.js";import{c as W,m as G}from"./index-CeE6v959.js";import{n as K,t as q}from"./EmptyState-DeDck-OL.js";import{t as J}from"./useToast-DsZKx0IX.js";import{t as Y}from"./useConfirm-tMjvBFXR.js";import{t as X}from"./SqlEditor-b8pTsILY.js";function Z(e){let{primaryColor:n,opacityDisabled:r,borderRadius:i,textColor3:a}=e;return Object.assign(Object.assign({},G),{iconColor:a,textColor:`white`,loadingColor:n,opacityDisabled:r,railColor:`rgba(0, 0, 0, .14)`,railColorActive:n,buttonBoxShadow:`0 1px 4px 0 rgba(0, 0, 0, 0.3), inset 0 0 1px 0 rgba(0, 0, 0, 0.05)`,buttonColor:`#FFF`,railBorderRadiusSmall:i,railBorderRadiusMedium:i,railBorderRadiusLarge:i,buttonBorderRadiusSmall:i,buttonBorderRadiusMedium:i,buttonBorderRadiusLarge:i,boxShadowFocus:`0 0 0 2px ${t(n,{alpha:.2})}`})}var Q={name:`Switch`,common:m,self:Z},ee=o(`switch`,`
2
+ height: var(--n-height);
3
+ min-width: var(--n-width);
4
+ vertical-align: middle;
5
+ user-select: none;
6
+ -webkit-user-select: none;
7
+ display: inline-flex;
8
+ outline: none;
9
+ justify-content: center;
10
+ align-items: center;
11
+ `,[a(`children-placeholder`,`
12
+ height: var(--n-rail-height);
13
+ display: flex;
14
+ flex-direction: column;
15
+ overflow: hidden;
16
+ pointer-events: none;
17
+ visibility: hidden;
18
+ `),a(`rail-placeholder`,`
19
+ display: flex;
20
+ flex-wrap: none;
21
+ `),a(`button-placeholder`,`
22
+ width: calc(1.75 * var(--n-rail-height));
23
+ height: var(--n-rail-height);
24
+ `),o(`base-loading`,`
25
+ position: absolute;
26
+ top: 50%;
27
+ left: 50%;
28
+ transform: translateX(-50%) translateY(-50%);
29
+ font-size: calc(var(--n-button-width) - 4px);
30
+ color: var(--n-loading-color);
31
+ transition: color .3s var(--n-bezier);
32
+ `,[e({left:`50%`,top:`50%`,originalTransform:`translateX(-50%) translateY(-50%)`})]),a(`checked, unchecked`,`
33
+ transition: color .3s var(--n-bezier);
34
+ color: var(--n-text-color);
35
+ box-sizing: border-box;
36
+ position: absolute;
37
+ white-space: nowrap;
38
+ top: 0;
39
+ bottom: 0;
40
+ display: flex;
41
+ align-items: center;
42
+ line-height: 1;
43
+ `),a(`checked`,`
44
+ right: 0;
45
+ padding-right: calc(1.25 * var(--n-rail-height) - var(--n-offset));
46
+ `),a(`unchecked`,`
47
+ left: 0;
48
+ justify-content: flex-end;
49
+ padding-left: calc(1.25 * var(--n-rail-height) - var(--n-offset));
50
+ `),r(`&:focus`,[a(`rail`,`
51
+ box-shadow: var(--n-box-shadow-focus);
52
+ `)]),f(`round`,[a(`rail`,`border-radius: calc(var(--n-rail-height) / 2);`,[a(`button`,`border-radius: calc(var(--n-button-height) / 2);`)])]),d(`disabled`,[d(`icon`,[f(`rubber-band`,[f(`pressed`,[a(`rail`,[a(`button`,`max-width: var(--n-button-width-pressed);`)])]),a(`rail`,[r(`&:active`,[a(`button`,`max-width: var(--n-button-width-pressed);`)])]),f(`active`,[f(`pressed`,[a(`rail`,[a(`button`,`left: calc(100% - var(--n-offset) - var(--n-button-width-pressed));`)])]),a(`rail`,[r(`&:active`,[a(`button`,`left: calc(100% - var(--n-offset) - var(--n-button-width-pressed));`)])])])])])]),f(`active`,[a(`rail`,[a(`button`,`left: calc(100% - var(--n-button-width) - var(--n-offset))`)])]),a(`rail`,`
53
+ overflow: hidden;
54
+ height: var(--n-rail-height);
55
+ min-width: var(--n-rail-width);
56
+ border-radius: var(--n-rail-border-radius);
57
+ cursor: pointer;
58
+ position: relative;
59
+ transition:
60
+ opacity .3s var(--n-bezier),
61
+ background .3s var(--n-bezier),
62
+ box-shadow .3s var(--n-bezier);
63
+ background-color: var(--n-rail-color);
64
+ `,[a(`button-icon`,`
65
+ color: var(--n-icon-color);
66
+ transition: color .3s var(--n-bezier);
67
+ font-size: calc(var(--n-button-height) - 4px);
68
+ position: absolute;
69
+ left: 0;
70
+ right: 0;
71
+ top: 0;
72
+ bottom: 0;
73
+ display: flex;
74
+ justify-content: center;
75
+ align-items: center;
76
+ line-height: 1;
77
+ `,[e()]),a(`button`,`
78
+ align-items: center;
79
+ top: var(--n-offset);
80
+ left: var(--n-offset);
81
+ height: var(--n-button-height);
82
+ width: var(--n-button-width-pressed);
83
+ max-width: var(--n-button-width);
84
+ border-radius: var(--n-button-border-radius);
85
+ background-color: var(--n-button-color);
86
+ box-shadow: var(--n-button-box-shadow);
87
+ box-sizing: border-box;
88
+ cursor: inherit;
89
+ content: "";
90
+ position: absolute;
91
+ transition:
92
+ background-color .3s var(--n-bezier),
93
+ left .3s var(--n-bezier),
94
+ opacity .3s var(--n-bezier),
95
+ max-width .3s var(--n-bezier),
96
+ box-shadow .3s var(--n-bezier);
97
+ `)]),f(`active`,[a(`rail`,`background-color: var(--n-rail-color-active);`)]),f(`loading`,[a(`rail`,`
98
+ cursor: wait;
99
+ `)]),f(`disabled`,[a(`rail`,`
100
+ cursor: not-allowed;
101
+ opacity: .5;
102
+ `)])]),te=Object.assign(Object.assign({},s.props),{size:String,value:{type:[String,Number,Boolean],default:void 0},loading:Boolean,defaultValue:{type:[String,Number,Boolean],default:!1},disabled:{type:Boolean,default:void 0},round:{type:Boolean,default:!0},"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],checkedValue:{type:[String,Number,Boolean],default:!0},uncheckedValue:{type:[String,Number,Boolean],default:!1},railStyle:Function,rubberBand:{type:Boolean,default:!0},spinProps:Object,onChange:[Function,Array]}),$,ne=c({name:`Switch`,props:te,slots:Object,setup(e){$===void 0&&($=typeof CSS<`u`?CSS.supports===void 0?!1:CSS.supports(`width`,`max(1px)`):!0);let{mergedClsPrefixRef:t,inlineThemeDisabled:n,mergedComponentPropsRef:r}=j(e),i=s(`Switch`,`-switch`,ee,Q,e,t),a=y(e,{mergedSize(t){return e.size===void 0?t?t.mergedSize.value:r?.value?.Switch?.size||`medium`:e.size}}),{mergedSizeRef:o,mergedDisabledRef:c}=a,l=k(e.defaultValue),d=z(g(e,`value`),l),f=w(()=>d.value===e.checkedValue),m=k(!1),h=k(!1),_=w(()=>{let{railStyle:t}=e;if(t)return t({focused:h.value,checked:f.value})});function v(t){let{"onUpdate:value":n,onChange:r,onUpdateValue:i}=e,{nTriggerFormInput:o,nTriggerFormChange:s}=a;n&&F(n,t),i&&F(i,t),r&&F(r,t),l.value=t,o(),s()}function b(){let{nTriggerFormFocus:e}=a;e()}function x(){let{nTriggerFormBlur:e}=a;e()}function S(){e.loading||c.value||(d.value===e.checkedValue?v(e.uncheckedValue):v(e.checkedValue))}function T(){h.value=!0,b()}function E(){h.value=!1,x(),m.value=!1}function D(t){e.loading||c.value||t.key===` `&&(d.value===e.checkedValue?v(e.uncheckedValue):v(e.checkedValue),m.value=!1)}function O(t){e.loading||c.value||t.key===` `&&(t.preventDefault(),m.value=!0)}let A=w(()=>{let{value:e}=o,{self:{opacityDisabled:t,railColor:n,railColorActive:r,buttonBoxShadow:a,buttonColor:s,boxShadowFocus:c,loadingColor:l,textColor:d,iconColor:f,[p(`buttonHeight`,e)]:m,[p(`buttonWidth`,e)]:h,[p(`buttonWidthPressed`,e)]:g,[p(`railHeight`,e)]:_,[p(`railWidth`,e)]:v,[p(`railBorderRadius`,e)]:y,[p(`buttonBorderRadius`,e)]:b},common:{cubicBezierEaseInOut:x}}=i.value,S,C,w;return $?(S=`calc((${_} - ${m}) / 2)`,C=`max(${_}, ${m})`,w=`max(${v}, calc(${v} + ${m} - ${_}))`):(S=u((L(_)-L(m))/2),C=u(Math.max(L(_),L(m))),w=L(_)>L(m)?v:u(L(v)+L(m)-L(_))),{"--n-bezier":x,"--n-button-border-radius":b,"--n-button-box-shadow":a,"--n-button-color":s,"--n-button-width":h,"--n-button-width-pressed":g,"--n-button-height":m,"--n-height":C,"--n-offset":S,"--n-opacity-disabled":t,"--n-rail-border-radius":y,"--n-rail-color":n,"--n-rail-color-active":r,"--n-rail-height":_,"--n-rail-width":v,"--n-width":w,"--n-box-shadow-focus":c,"--n-loading-color":l,"--n-text-color":d,"--n-icon-color":f}}),M=n?C(`switch`,w(()=>o.value[0]),A,e):void 0;return{handleClick:S,handleBlur:E,handleFocus:T,handleKeyup:D,handleKeydown:O,mergedRailStyle:_,pressed:m,mergedClsPrefix:t,mergedValue:d,checked:f,mergedDisabled:c,cssVars:n?void 0:A,themeClass:M?.themeClass,onRender:M?.onRender}},render(){let{mergedClsPrefix:e,mergedDisabled:t,checked:n,mergedRailStyle:r,onRender:i,$slots:a}=this;i?.();let{checked:o,unchecked:s,icon:c,"checked-icon":u,"unchecked-icon":d}=a,f=!(T(c)&&T(u)&&T(d));return N(`div`,{role:`switch`,"aria-checked":n,class:[`${e}-switch`,this.themeClass,f&&`${e}-switch--icon`,n&&`${e}-switch--active`,t&&`${e}-switch--disabled`,this.round&&`${e}-switch--round`,this.loading&&`${e}-switch--loading`,this.pressed&&`${e}-switch--pressed`,this.rubberBand&&`${e}-switch--rubber-band`],tabindex:this.mergedDisabled?void 0:0,style:this.cssVars,onClick:this.handleClick,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyup:this.handleKeyup,onKeydown:this.handleKeydown},N(`div`,{class:`${e}-switch__rail`,"aria-hidden":`true`,style:r},h(o,t=>h(s,n=>t||n?N(`div`,{"aria-hidden":!0,class:`${e}-switch__children-placeholder`},N(`div`,{class:`${e}-switch__rail-placeholder`},N(`div`,{class:`${e}-switch__button-placeholder`}),t),N(`div`,{class:`${e}-switch__rail-placeholder`},N(`div`,{class:`${e}-switch__button-placeholder`}),n)):null)),N(`div`,{class:`${e}-switch__button`},h(c,t=>h(u,n=>h(d,r=>N(l,null,{default:()=>this.loading?N(I,Object.assign({key:`loading`,clsPrefix:e,strokeWidth:20},this.spinProps)):this.checked&&(n||t)?N(`div`,{class:`${e}-switch__button-icon`,key:n?`checked-icon`:`icon`},n||t):!this.checked&&(r||t)?N(`div`,{class:`${e}-switch__button-icon`,key:r?`unchecked-icon`:`icon`},r||t):null})))),h(o,t=>t&&N(`div`,{key:`checked`,class:`${e}-switch__checked`},t)),h(s,t=>t&&N(`div`,{key:`unchecked`,class:`${e}-switch__unchecked`},t)))))}}),re={key:1},ie=c({__name:`SqlWorkspace`,setup(e){let t=Y(),r=J(),a=k(``),o=k(!0),s=k(!1),c=k(null),l=k(null),u=k([]),d=k(null),f=w(()=>u.value.map((e,t)=>({label:`${e.label} \u2014 ${new Date(e.at).toLocaleTimeString()}`,value:String(t)})));function p(e){let t=e.trim();if(!t||u.value[0]?.value===t)return;let n=t.split(`
103
+ `)[0].slice(0,60)||t.slice(0,60);u.value.unshift({label:n,value:t,at:Date.now()}),u.value.length>20&&u.value.pop()}function m(e){let t=parseInt(e,10),n=u.value[t];n&&(a.value=n.value)}async function h(e){if(!e&&!await t(`Enable write mode?`,`You are about to allow INSERT, UPDATE, DELETE and DDL. Changes commit immediately. Continue?`)){o.value=!0;return}o.value=e}async function g(){let e=a.value.trim();if(!e){r.warning(`Enter a SQL statement`);return}s.value=!0,c.value=null,l.value=null;try{let t=await U.runSql(e,o.value);c.value=t,p(e),r.success(`${t.row_count} row${t.row_count===1?``:`s`}`)}catch(e){l.value=e.message??`Query failed`,r.error(l.value)}finally{s.value=!1}}let y=w(()=>c.value?c.value.columns.map(e=>({title:e,key:e})):[]),C=w(()=>c.value?c.value.rows.map(e=>Object.fromEntries(c.value.columns.map((t,n)=>{let r=e[n],i;return i=r===null?`null`:typeof r==`object`?JSON.stringify(r):String(r),[t,i]}))):[]);return(e,t)=>(i(),b(D(E),{title:`SQL Workspace`},{default:n(()=>[P(D(O),{vertical:``,size:16},{default:n(()=>[P(D(O),{align:`center`,justify:`space-between`},{default:n(()=>[P(D(O),{align:`center`,size:12},{default:n(()=>[P(D(R),{value:d.value,"onUpdate:value":[t[0]||=e=>d.value=e,m],options:f.value,placeholder:`History`,clearable:``,style:{width:`260px`}},null,8,[`value`,`options`]),P(D(v),{type:`primary`,loading:s.value,onClick:g},{default:n(()=>[...t[2]||=[_(` Run `,-1)]]),_:1},8,[`loading`]),o.value?(i(),b(D(B),{key:0,type:`default`,size:`small`},{default:n(()=>[...t[3]||=[_(`Read-only`,-1)]]),_:1})):(i(),b(D(B),{key:1,type:`warning`,size:`small`},{default:n(()=>[...t[4]||=[_(`Write enabled`,-1)]]),_:1}))]),_:1}),P(D(O),{align:`center`,size:8},{default:n(()=>[P(D(W),{depth:`3`,style:{"font-size":`12px`}},{default:n(()=>[...t[5]||=[_(`Read-only`,-1)]]),_:1}),P(D(ne),{value:o.value,round:!1,"onUpdate:value":h},{"checked-icon":n(()=>[...t[6]||=[x(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`},[x(`rect`,{x:`3`,y:`11`,width:`18`,height:`11`,rx:`2`}),x(`path`,{d:`M7 11V7a5 5 0 0110 0v4`})],-1)]]),"unchecked-icon":n(()=>[...t[7]||=[x(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`},[x(`path`,{d:`M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z`}),x(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),x(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})],-1)]]),_:1},8,[`value`])]),_:1})]),_:1}),P(X,{modelValue:a.value,"onUpdate:modelValue":t[1]||=e=>a.value=e,height:`280px`,"on-run":g,style:S(o.value?{}:{border:`1px solid var(--n-warning-color)`})},null,8,[`modelValue`,`style`]),P(D(H),{show:s.value},{default:n(()=>[l.value?(i(),b(K,{key:0,error:{message:l.value},retry:g},null,8,[`error`])):c.value?(i(),M(`div`,re,[P(D(O),{align:`center`,size:8,style:{"margin-bottom":`8px`}},{default:n(()=>[P(D(W),{depth:`3`,style:{"font-size":`12px`}},{default:n(()=>[_(A(c.value.row_count)+` row`+A(c.value.row_count===1?``:`s`),1)]),_:1})]),_:1}),C.value.length?(i(),b(D(V),{key:0,columns:y.value,data:C.value,bordered:!1,size:`small`,"scroll-x":600},null,8,[`columns`,`data`])):(i(),b(q,{key:1,description:`Query executed successfully. No rows returned.`}))])):(i(),b(q,{key:2,description:`Write a SQL query and press Run (Ctrl+Enter) to see results.`}))]),_:1},8,[`show`])]),_:1})]),_:1}))}});export{ie as default};
104
+ //# sourceMappingURL=SqlWorkspace-BUS7IntH.js.map
@@ -0,0 +1,2 @@
1
+ import{Gn as e,In as t,Sn as n,Un as r,_n as i,gn as a,lr as o,mn as s,r as c,sr as l,t as u,wn as d,xn as f}from"./Space-n5-XcguU.js";import{n as p,t as m}from"./useTable-CnZc5zhi.js";import{t as h}from"./Alert-dluGVkos.js";import{n as g}from"./resources-Bt6thQCD.js";import{n as _,o as v,t as y}from"./index-CeE6v959.js";import{t as b}from"./JsonField-DibyJgun.js";function x(){let e=_(),t=s(()=>({role:e.rolePreview.role,impersonate_sub:e.rolePreview.sub??``}));return{rolePreview:e.rolePreview,params:t}}var S=n({__name:`TableData`,setup(n){let _=v(),{rolePreview:S,params:C}=x(),w=s(()=>_.params.schema),T=s(()=>_.params.table),E=s(()=>S.role!==`service_role`),D=s(()=>S.role===`authenticated`&&!S.sub),{q:O,data:k,loading:A,error:j,refresh:M}=m(async e=>{if(D.value)return{rows:[],total:0};let t=await g.rows(w.value,T.value,{limit:e.limit,offset:e.offset,order:e.order??``,role:C.value.role,impersonate_sub:C.value.impersonate_sub});return{rows:t.rows.map(e=>Object.fromEntries(t.columns.map((t,n)=>[t,e[n]]))),total:t.total}});r(()=>({role:S.role,sub:S.sub}),M,{deep:!0});let N=s(()=>k.value?.rows??[]),P=s(()=>k.value?.total??0),F=s(()=>(N.value[0]?Object.keys(N.value[0]):[]).map(e=>({title:e,key:e,render:t=>d(b,{value:t[e]})})));return(n,r)=>(t(),a(l(c),{title:`${w.value}.${T.value}`,style:o(E.value?{borderTop:`4px solid var(--n-warning-color)`}:void 0)},{default:e(()=>[f(l(u),{vertical:``,size:16},{default:e(()=>[f(y),D.value?(t(),a(l(h),{key:0,type:`warning`,title:`Provide an impersonation UUID to preview as a specific user.`})):i(``,!0),f(p,{q:l(O),rows:N.value,total:P.value,loading:l(A),error:l(j),columns:F.value,"search-placeholder":`Filter…`,onRefresh:l(M)},null,8,[`q`,`rows`,`total`,`loading`,`error`,`columns`,`onRefresh`])]),_:1})]),_:1},8,[`title`,`style`]))}});export{S as default};
2
+ //# sourceMappingURL=TableData-CQIagLKn.js.map
@@ -0,0 +1,72 @@
1
+ import{At as e,Bt as t,Ft as n,Gt as r,Jt as i,Kt as a,Ln as o,O as s,S as c,Sn as l,Xt as u,Yt as d,Zt as f,_ as p,_t as m,ar as h,j as g,lt as _,mn as v,tr as y,ut as b,wn as x,wt as S,xt as C}from"./Space-n5-XcguU.js";function w(e,t){return v(()=>{for(let n of t)if(e[n]!==void 0)return e[n];return e[t[t.length-1]]})}var T={closeIconSizeTiny:`12px`,closeIconSizeSmall:`12px`,closeIconSizeMedium:`14px`,closeIconSizeLarge:`14px`,closeSizeTiny:`16px`,closeSizeSmall:`16px`,closeSizeMedium:`18px`,closeSizeLarge:`18px`,padding:`0 7px`,closeMargin:`0 0 0 4px`};function E(e){let{textColor2:t,primaryColorHover:r,primaryColorPressed:i,primaryColor:a,infoColor:o,successColor:s,warningColor:c,errorColor:l,baseColor:u,borderColor:d,opacityDisabled:f,tagColor:p,closeIconColor:m,closeIconColorHover:h,closeIconColorPressed:g,borderRadiusSmall:_,fontSizeMini:v,fontSizeTiny:y,fontSizeSmall:b,fontSizeMedium:x,heightMini:S,heightTiny:C,heightSmall:w,heightMedium:E,closeColorHover:D,closeColorPressed:O,buttonColor2Hover:k,buttonColor2Pressed:A,fontWeightStrong:j}=e;return Object.assign(Object.assign({},T),{closeBorderRadius:_,heightTiny:S,heightSmall:C,heightMedium:w,heightLarge:E,borderRadius:_,opacityDisabled:f,fontSizeTiny:v,fontSizeSmall:y,fontSizeMedium:b,fontSizeLarge:x,fontWeightStrong:j,textColorCheckable:t,textColorHoverCheckable:t,textColorPressedCheckable:t,textColorChecked:u,colorCheckable:`#0000`,colorHoverCheckable:k,colorPressedCheckable:A,colorChecked:a,colorCheckedHover:r,colorCheckedPressed:i,border:`1px solid ${d}`,textColor:t,color:p,colorBordered:`rgb(250, 250, 252)`,closeIconColor:m,closeIconColorHover:h,closeIconColorPressed:g,closeColorHover:D,closeColorPressed:O,borderPrimary:`1px solid ${n(a,{alpha:.3})}`,textColorPrimary:a,colorPrimary:n(a,{alpha:.12}),colorBorderedPrimary:n(a,{alpha:.1}),closeIconColorPrimary:a,closeIconColorHoverPrimary:a,closeIconColorPressedPrimary:a,closeColorHoverPrimary:n(a,{alpha:.12}),closeColorPressedPrimary:n(a,{alpha:.18}),borderInfo:`1px solid ${n(o,{alpha:.3})}`,textColorInfo:o,colorInfo:n(o,{alpha:.12}),colorBorderedInfo:n(o,{alpha:.1}),closeIconColorInfo:o,closeIconColorHoverInfo:o,closeIconColorPressedInfo:o,closeColorHoverInfo:n(o,{alpha:.12}),closeColorPressedInfo:n(o,{alpha:.18}),borderSuccess:`1px solid ${n(s,{alpha:.3})}`,textColorSuccess:s,colorSuccess:n(s,{alpha:.12}),colorBorderedSuccess:n(s,{alpha:.1}),closeIconColorSuccess:s,closeIconColorHoverSuccess:s,closeIconColorPressedSuccess:s,closeColorHoverSuccess:n(s,{alpha:.12}),closeColorPressedSuccess:n(s,{alpha:.18}),borderWarning:`1px solid ${n(c,{alpha:.35})}`,textColorWarning:c,colorWarning:n(c,{alpha:.15}),colorBorderedWarning:n(c,{alpha:.12}),closeIconColorWarning:c,closeIconColorHoverWarning:c,closeIconColorPressedWarning:c,closeColorHoverWarning:n(c,{alpha:.12}),closeColorPressedWarning:n(c,{alpha:.18}),borderError:`1px solid ${n(l,{alpha:.23})}`,textColorError:l,colorError:n(l,{alpha:.1}),colorBorderedError:n(l,{alpha:.08}),closeIconColorError:l,closeIconColorHoverError:l,closeIconColorPressedError:l,closeColorHoverError:n(l,{alpha:.12}),closeColorPressedError:n(l,{alpha:.18})})}var D={name:`Tag`,common:p,self:E},O={color:Object,type:{type:String,default:`default`},round:Boolean,size:String,closable:Boolean,disabled:{type:Boolean,default:void 0}},k=a(`tag`,`
2
+ --n-close-margin: var(--n-close-margin-top) var(--n-close-margin-right) var(--n-close-margin-bottom) var(--n-close-margin-left);
3
+ white-space: nowrap;
4
+ position: relative;
5
+ box-sizing: border-box;
6
+ cursor: default;
7
+ display: inline-flex;
8
+ align-items: center;
9
+ flex-wrap: nowrap;
10
+ padding: var(--n-padding);
11
+ border-radius: var(--n-border-radius);
12
+ color: var(--n-text-color);
13
+ background-color: var(--n-color);
14
+ transition:
15
+ border-color .3s var(--n-bezier),
16
+ background-color .3s var(--n-bezier),
17
+ color .3s var(--n-bezier),
18
+ box-shadow .3s var(--n-bezier),
19
+ opacity .3s var(--n-bezier);
20
+ line-height: 1;
21
+ height: var(--n-height);
22
+ font-size: var(--n-font-size);
23
+ `,[d(`strong`,`
24
+ font-weight: var(--n-font-weight-strong);
25
+ `),i(`border`,`
26
+ pointer-events: none;
27
+ position: absolute;
28
+ left: 0;
29
+ right: 0;
30
+ top: 0;
31
+ bottom: 0;
32
+ border-radius: inherit;
33
+ border: var(--n-border);
34
+ transition: border-color .3s var(--n-bezier);
35
+ `),i(`icon`,`
36
+ display: flex;
37
+ margin: 0 4px 0 0;
38
+ color: var(--n-text-color);
39
+ transition: color .3s var(--n-bezier);
40
+ font-size: var(--n-avatar-size-override);
41
+ `),i(`avatar`,`
42
+ display: flex;
43
+ margin: 0 6px 0 0;
44
+ `),i(`close`,`
45
+ margin: var(--n-close-margin);
46
+ transition:
47
+ background-color .3s var(--n-bezier),
48
+ color .3s var(--n-bezier);
49
+ `),d(`round`,`
50
+ padding: 0 calc(var(--n-height) / 3);
51
+ border-radius: calc(var(--n-height) / 2);
52
+ `,[i(`icon`,`
53
+ margin: 0 4px 0 calc((var(--n-height) - 8px) / -2);
54
+ `),i(`avatar`,`
55
+ margin: 0 6px 0 calc((var(--n-height) - 8px) / -2);
56
+ `),d(`closable`,`
57
+ padding: 0 calc(var(--n-height) / 4) 0 calc(var(--n-height) / 3);
58
+ `)]),d(`icon, avatar`,[d(`round`,`
59
+ padding: 0 calc(var(--n-height) / 3) 0 calc(var(--n-height) / 2);
60
+ `)]),d(`disabled`,`
61
+ cursor: not-allowed !important;
62
+ opacity: var(--n-opacity-disabled);
63
+ `),d(`checkable`,`
64
+ cursor: pointer;
65
+ box-shadow: none;
66
+ color: var(--n-text-color-checkable);
67
+ background-color: var(--n-color-checkable);
68
+ `,[u(`disabled`,[r(`&:hover`,`background-color: var(--n-color-hover-checkable);`,[u(`checked`,`color: var(--n-text-color-hover-checkable);`)]),r(`&:active`,`background-color: var(--n-color-pressed-checkable);`,[u(`checked`,`color: var(--n-text-color-pressed-checkable);`)])]),d(`checked`,`
69
+ color: var(--n-text-color-checked);
70
+ background-color: var(--n-color-checked);
71
+ `,[u(`disabled`,[r(`&:hover`,`background-color: var(--n-color-checked-hover);`),r(`&:active`,`background-color: var(--n-color-checked-pressed);`)])])])]),A=Object.assign(Object.assign(Object.assign({},s.props),O),{bordered:{type:Boolean,default:void 0},checked:Boolean,checkable:Boolean,strong:Boolean,triggerClickOnClose:Boolean,onClose:[Array,Function],onMouseenter:Function,onMouseleave:Function,"onUpdate:checked":Function,onUpdateChecked:Function,internalCloseFocusable:{type:Boolean,default:!0},internalCloseIsButtonTag:{type:Boolean,default:!0},onCheckedChange:Function}),j=e(`n-tag`),M=l({name:`Tag`,props:A,slots:Object,setup(e){let n=y(null),{mergedBorderedRef:r,mergedClsPrefixRef:i,inlineThemeDisabled:a,mergedRtlRef:c,mergedComponentPropsRef:l}=b(e),u=v(()=>e.size||l?.value?.Tag?.size||`medium`),d=s(`Tag`,`-tag`,k,D,e,i);o(j,{roundRef:h(e,`round`)});function p(){if(!e.disabled&&e.checkable){let{checked:t,onCheckedChange:n,onUpdateChecked:r,"onUpdate:checked":i}=e;r&&r(!t),i&&i(!t),n&&n(!t)}}function m(t){if(e.triggerClickOnClose||t.stopPropagation(),!e.disabled){let{onClose:n}=e;n&&C(n,t)}}let x={setTextContent(e){let{value:t}=n;t&&(t.textContent=e)}},w=g(`Tag`,c,i),T=v(()=>{let{type:n,color:{color:i,textColor:a}={}}=e,o=u.value,{common:{cubicBezierEaseInOut:s},self:{padding:c,closeMargin:l,borderRadius:p,opacityDisabled:m,textColorCheckable:h,textColorHoverCheckable:g,textColorPressedCheckable:_,textColorChecked:v,colorCheckable:y,colorHoverCheckable:b,colorPressedCheckable:x,colorChecked:S,colorCheckedHover:C,colorCheckedPressed:w,closeBorderRadius:T,fontWeightStrong:E,[f(`colorBordered`,n)]:D,[f(`closeSize`,o)]:O,[f(`closeIconSize`,o)]:k,[f(`fontSize`,o)]:A,[f(`height`,o)]:j,[f(`color`,n)]:M,[f(`textColor`,n)]:N,[f(`border`,n)]:P,[f(`closeIconColor`,n)]:F,[f(`closeIconColorHover`,n)]:I,[f(`closeIconColorPressed`,n)]:L,[f(`closeColorHover`,n)]:R,[f(`closeColorPressed`,n)]:z}}=d.value,B=t(l);return{"--n-font-weight-strong":E,"--n-avatar-size-override":`calc(${j} - 8px)`,"--n-bezier":s,"--n-border-radius":p,"--n-border":P,"--n-close-icon-size":k,"--n-close-color-pressed":z,"--n-close-color-hover":R,"--n-close-border-radius":T,"--n-close-icon-color":F,"--n-close-icon-color-hover":I,"--n-close-icon-color-pressed":L,"--n-close-icon-color-disabled":F,"--n-close-margin-top":B.top,"--n-close-margin-right":B.right,"--n-close-margin-bottom":B.bottom,"--n-close-margin-left":B.left,"--n-close-size":O,"--n-color":i||(r.value?D:M),"--n-color-checkable":y,"--n-color-checked":S,"--n-color-checked-hover":C,"--n-color-checked-pressed":w,"--n-color-hover-checkable":b,"--n-color-pressed-checkable":x,"--n-font-size":A,"--n-height":j,"--n-opacity-disabled":m,"--n-padding":c,"--n-text-color":a||N,"--n-text-color-checkable":h,"--n-text-color-checked":v,"--n-text-color-hover-checkable":g,"--n-text-color-pressed-checkable":_}}),E=a?_(`tag`,v(()=>{let t=``,{type:n,color:{color:i,textColor:a}={}}=e;return t+=n[0],t+=u.value[0],i&&(t+=`a${S(i)}`),a&&(t+=`b${S(a)}`),r.value&&(t+=`c`),t}),T,e):void 0;return Object.assign(Object.assign({},x),{rtlEnabled:w,mergedClsPrefix:i,contentRef:n,mergedBordered:r,handleClick:p,handleCloseClick:m,cssVars:a?void 0:T,themeClass:E?.themeClass,onRender:E?.onRender})},render(){var e;let{mergedClsPrefix:t,rtlEnabled:n,closable:r,color:{borderColor:i}={},round:a,onRender:o,$slots:s}=this;o?.();let l=m(s.avatar,e=>e&&x(`div`,{class:`${t}-tag__avatar`},e)),u=m(s.icon,e=>e&&x(`div`,{class:`${t}-tag__icon`},e));return x(`div`,{class:[`${t}-tag`,this.themeClass,{[`${t}-tag--rtl`]:n,[`${t}-tag--strong`]:this.strong,[`${t}-tag--disabled`]:this.disabled,[`${t}-tag--checkable`]:this.checkable,[`${t}-tag--checked`]:this.checkable&&this.checked,[`${t}-tag--round`]:a,[`${t}-tag--avatar`]:l,[`${t}-tag--icon`]:u,[`${t}-tag--closable`]:r}],style:this.cssVars,onClick:this.handleClick,onMouseenter:this.onMouseenter,onMouseleave:this.onMouseleave},u||l,x(`span`,{class:`${t}-tag__content`,ref:`contentRef`},(e=this.$slots).default?.call(e)),!this.checkable&&r?x(c,{clsPrefix:t,class:`${t}-tag__close`,disabled:this.disabled,onClick:this.handleCloseClick,focusable:this.internalCloseFocusable,round:a,isButtonTag:this.internalCloseIsButtonTag,absolute:!0}):null,!this.checkable&&this.mergedBordered?x(`div`,{class:`${t}-tag__border`,style:{borderColor:i}}):null)}});export{T as n,w as r,M as t};
72
+ //# sourceMappingURL=Tag-D1fOKpTH.js.map
@@ -0,0 +1,2 @@
1
+ import{Gn as e,In as t,Kn as n,Rn as r,Sn as i,an as a,bn as o,c as s,gn as c,hn as l,lr as u,mn as d,r as f,sr as p,t as m,tr as h,un as g,ur as _,vn as v,xn as y}from"./Space-n5-XcguU.js";import{t as b}from"./Input-DppYTq9C.js";import{t as x}from"./Tag-D1fOKpTH.js";import{n as S,t as C}from"./DescriptionsItem-P8JUDaBs.js";import{l as w,t as T}from"./resources-Bt6thQCD.js";import{c as E,y as D}from"./index-CeE6v959.js";import{t as O}from"./useResource-C_rJCY8C.js";import{t as k}from"./useToast-DsZKx0IX.js";var A={key:1,style:{display:`flex`,gap:`24px`}},j={style:{width:`220px`,"flex-shrink":`0`}},M=[`onClick`],N={key:0,style:{flex:`1`,"min-width":`0`}},P={style:{"margin-bottom":`12px`}},F={style:{"margin-bottom":`12px`}},I={style:{padding:`12px`,"border-radius":`4px`,border:`1px solid rgba(255,255,255,0.08)`,background:`rgba(255,255,255,0.03)`}},L={key:1,style:{flex:`1`,display:`flex`,"align-items":`center`,"justify-content":`center`,"min-height":`200px`}},R=i({__name:`Templates`,setup(i){let R=k(),{data:z,loading:B,error:V,refresh:H}=O(()=>T.templates()),U=h(null),W=h(``),G=h(``),K=h(!1);function q(e){U.value=e,W.value=e.subject,G.value=e.text_body}function J(){U.value=null}async function Y(){if(U.value){K.value=!0;try{let e=await T.updateTemplate(U.value.name,{subject:W.value,text_body:G.value});R.success(`Template "${e.name}" saved.`),U.value=e,await H()}catch(e){R.error(e.message??`Save failed`)}finally{K.value=!1}}}let X=d(()=>U.value?W.value.replaceAll(`{{ token }}`,`ABC123XYZ`).replaceAll(`{{ url }}`,`http://localhost:8000/auth/v1/magiclink/verify?token=ABC123XYZ`):``),Z=d(()=>U.value?G.value.replaceAll(`{{ token }}`,`ABC123XYZ`).replaceAll(`{{ url }}`,`http://localhost:8000/auth/v1/magiclink/verify?token=ABC123XYZ`):``),Q=d(()=>U.value?W.value!==U.value.subject||G.value!==U.value.text_body:!1);return(i,d)=>(t(),c(p(f),{title:`Email Templates`,size:`small`},{default:e(()=>[y(p(w),{show:p(B)},{default:e(()=>[p(V)?(t(),v(g,{key:0},[y(p(E),{type:`error`},{default:e(()=>[o(_(p(V).message),1)]),_:1}),y(p(s),{size:`small`,onClick:p(H),style:{"margin-top":`8px`}},{default:e(()=>[...d[2]||=[o(`Retry`,-1)]]),_:1},8,[`onClick`])],64)):p(z)&&p(z).length?(t(),v(`div`,A,[l(`div`,j,[y(p(E),{strong:``,style:{display:`block`,"margin-bottom":`8px`}},{default:e(()=>[...d[3]||=[o(` Templates `,-1)]]),_:1}),(t(!0),v(g,null,r(p(z),n=>(t(),v(`div`,{key:n.name,style:u({padding:`8px 12px`,cursor:`pointer`,borderRadius:`4px`,background:U.value?.name===n.name?`rgba(16, 185, 129, 0.15)`:`transparent`,border:U.value?.name===n.name?`1px solid rgba(16, 185, 129, 0.4)`:`1px solid transparent`,marginBottom:`4px`}),onClick:e=>q(n)},[l(`div`,null,[y(p(x),{type:U.value?.name===n.name?`success`:`default`,size:`small`},{default:e(()=>[o(_(n.name),1)]),_:2},1032,[`type`])]),y(p(E),{depth:`3`,style:{"font-size":`11px`,display:`block`,"margin-top":`2px`}},{default:e(()=>[o(_(n.subject.slice(0,30))+_(n.subject.length>30?`…`:``),1)]),_:2},1024)],12,M))),128))]),U.value?(t(),v(`div`,N,[y(p(m),{style:{"margin-bottom":`12px`}},{default:e(()=>[y(p(s),{type:`primary`,size:`small`,disabled:!Q.value,loading:K.value,onClick:Y},{default:e(()=>[...d[4]||=[o(` Save `,-1)]]),_:1},8,[`disabled`,`loading`]),y(p(s),{size:`small`,secondary:``,onClick:J},{default:e(()=>[...d[5]||=[o(` Close `,-1)]]),_:1})]),_:1}),y(p(S),{bordered:``,"label-placement":`top`,column:1,size:`small`,style:{"margin-bottom":`16px`}},{default:e(()=>[y(p(C),{label:`Name`},{default:e(()=>[y(p(x),{type:`info`,size:`small`},{default:e(()=>[o(_(U.value.name),1)]),_:1})]),_:1}),y(p(C),{label:`Last updated`},{default:e(()=>[o(_(new Date(U.value.updated_at).toLocaleString()),1)]),_:1})]),_:1}),l(`div`,P,[y(p(E),{strong:``,style:{display:`block`,"margin-bottom":`4px`,"font-size":`13px`}},{default:e(()=>[...d[6]||=[o(` Subject `,-1)]]),_:1}),y(p(b),{value:W.value,"onUpdate:value":d[0]||=e=>W.value=e,placeholder:`Email subject line`},null,8,[`value`])]),l(`div`,F,[y(p(E),{strong:``,style:{display:`block`,"margin-bottom":`4px`,"font-size":`13px`}},{default:e(()=>[...d[7]||=[o(` Body `,-1)]]),_:1}),n(l(`textarea`,{"onUpdate:modelValue":d[1]||=e=>G.value=e,rows:`8`,placeholder:`Plain text body. Use {{ token }} and {{ url }} as placeholders.`,style:{width:`100%`,padding:`8px 10px`,"border-radius":`4px`,border:`1px solid rgba(255,255,255,0.12)`,background:`rgba(255,255,255,0.05)`,color:`inherit`,"font-family":`monospace`,"font-size":`13px`,resize:`vertical`,outline:`none`,"box-sizing":`border-box`}},null,512),[[a,G.value]])]),y(p(D)),y(p(E),{strong:``,style:{display:`block`,"margin-bottom":`8px`,"font-size":`13px`}},{default:e(()=>[...d[8]||=[o(` Sample Preview `,-1)]]),_:1}),l(`div`,I,[y(p(E),{strong:``,style:{display:`block`,"margin-bottom":`4px`}},{default:e(()=>[o(_(X.value||`(no subject)`),1)]),_:1}),y(p(E),{depth:`2`,style:{"white-space":`pre-wrap`,"font-size":`13px`}},{default:e(()=>[o(_(Z.value||`(no body)`),1)]),_:1})])])):(t(),v(`div`,L,[y(p(E),{depth:`3`},{default:e(()=>[...d[9]||=[o(`Select a template to edit.`,-1)]]),_:1})]))])):(t(),c(p(E),{key:2,depth:`3`},{default:e(()=>[...d[10]||=[o(`No templates found.`,-1)]]),_:1}))]),_:1},8,[`show`])]),_:1}))}});export{R as default};
2
+ //# sourceMappingURL=Templates-BS-ugkdq.js.map
@@ -0,0 +1,107 @@
1
+ import{$t as e,At as t,En as n,Gt as r,Jt as i,Kt as a,Ln as o,O as s,Qt as c,Sn as l,St as u,Yt as d,ar as f,j as p,lt as m,mn as h,un as g,ut as _,wn as v}from"./Space-n5-XcguU.js";import{f as y,g as b}from"./index-CeE6v959.js";var x=r([a(`list`,`
2
+ --n-merged-border-color: var(--n-border-color);
3
+ --n-merged-color: var(--n-color);
4
+ --n-merged-color-hover: var(--n-color-hover);
5
+ margin: 0;
6
+ font-size: var(--n-font-size);
7
+ transition:
8
+ background-color .3s var(--n-bezier),
9
+ color .3s var(--n-bezier),
10
+ border-color .3s var(--n-bezier);
11
+ padding: 0;
12
+ list-style-type: none;
13
+ color: var(--n-text-color);
14
+ background-color: var(--n-merged-color);
15
+ `,[d(`show-divider`,[a(`list-item`,[r(`&:not(:last-child)`,[i(`divider`,`
16
+ background-color: var(--n-merged-border-color);
17
+ `)])])]),d(`clickable`,[a(`list-item`,`
18
+ cursor: pointer;
19
+ `)]),d(`bordered`,`
20
+ border: 1px solid var(--n-merged-border-color);
21
+ border-radius: var(--n-border-radius);
22
+ `),d(`hoverable`,[a(`list-item`,`
23
+ border-radius: var(--n-border-radius);
24
+ `,[r(`&:hover`,`
25
+ background-color: var(--n-merged-color-hover);
26
+ `,[i(`divider`,`
27
+ background-color: transparent;
28
+ `)])])]),d(`bordered, hoverable`,[a(`list-item`,`
29
+ padding: 12px 20px;
30
+ `),i(`header, footer`,`
31
+ padding: 12px 20px;
32
+ `)]),i(`header, footer`,`
33
+ padding: 12px 0;
34
+ box-sizing: border-box;
35
+ transition: border-color .3s var(--n-bezier);
36
+ `,[r(`&:not(:last-child)`,`
37
+ border-bottom: 1px solid var(--n-merged-border-color);
38
+ `)]),a(`list-item`,`
39
+ position: relative;
40
+ padding: 12px 0;
41
+ box-sizing: border-box;
42
+ display: flex;
43
+ flex-wrap: nowrap;
44
+ align-items: center;
45
+ transition:
46
+ background-color .3s var(--n-bezier),
47
+ border-color .3s var(--n-bezier);
48
+ `,[i(`prefix`,`
49
+ margin-right: 20px;
50
+ flex: 0;
51
+ `),i(`suffix`,`
52
+ margin-left: 20px;
53
+ flex: 0;
54
+ `),i(`main`,`
55
+ flex: 1;
56
+ `),i(`divider`,`
57
+ height: 1px;
58
+ position: absolute;
59
+ bottom: 0;
60
+ left: 0;
61
+ right: 0;
62
+ background-color: transparent;
63
+ transition: background-color .3s var(--n-bezier);
64
+ pointer-events: none;
65
+ `)])]),c(a(`list`,`
66
+ --n-merged-color-hover: var(--n-color-hover-modal);
67
+ --n-merged-color: var(--n-color-modal);
68
+ --n-merged-border-color: var(--n-border-color-modal);
69
+ `)),e(a(`list`,`
70
+ --n-merged-color-hover: var(--n-color-hover-popover);
71
+ --n-merged-color: var(--n-color-popover);
72
+ --n-merged-border-color: var(--n-border-color-popover);
73
+ `))]),S=Object.assign(Object.assign({},s.props),{size:{type:String,default:`medium`},bordered:Boolean,clickable:Boolean,hoverable:Boolean,showDivider:{type:Boolean,default:!0}}),C=t(`n-list`),w=l({name:`List`,props:S,slots:Object,setup(e){let{mergedClsPrefixRef:t,inlineThemeDisabled:n,mergedRtlRef:r}=_(e),i=p(`List`,r,t),a=s(`List`,`-list`,x,b,e,t);o(C,{showDividerRef:f(e,`showDivider`),mergedClsPrefixRef:t});let c=h(()=>{let{common:{cubicBezierEaseInOut:e},self:{fontSize:t,textColor:n,color:r,colorModal:i,colorPopover:o,borderColor:s,borderColorModal:c,borderColorPopover:l,borderRadius:u,colorHover:d,colorHoverModal:f,colorHoverPopover:p}}=a.value;return{"--n-font-size":t,"--n-bezier":e,"--n-text-color":n,"--n-color":r,"--n-border-radius":u,"--n-border-color":s,"--n-border-color-modal":c,"--n-border-color-popover":l,"--n-color-modal":i,"--n-color-popover":o,"--n-color-hover":d,"--n-color-hover-modal":f,"--n-color-hover-popover":p}}),l=n?m(`list`,void 0,c,e):void 0;return{mergedClsPrefix:t,rtlEnabled:i,cssVars:n?void 0:c,themeClass:l?.themeClass,onRender:l?.onRender}},render(){let{$slots:e,mergedClsPrefix:t,onRender:n}=this;return n?.(),v(`ul`,{class:[`${t}-list`,this.rtlEnabled&&`${t}-list--rtl`,this.bordered&&`${t}-list--bordered`,this.showDivider&&`${t}-list--show-divider`,this.hoverable&&`${t}-list--hoverable`,this.clickable&&`${t}-list--clickable`,this.themeClass],style:this.cssVars},e.header?v(`div`,{class:`${t}-list__header`},e.header()):null,e.default?.call(e),e.footer?v(`div`,{class:`${t}-list__footer`},e.footer()):null)}}),T=l({name:`ListItem`,slots:Object,setup(){let e=n(C,null);return e||u(`list-item`,"`n-list-item` must be placed in `n-list`."),{showDivider:e.showDividerRef,mergedClsPrefix:e.mergedClsPrefixRef}},render(){let{$slots:e,mergedClsPrefix:t}=this;return v(`li`,{class:`${t}-list-item`},e.prefix?v(`div`,{class:`${t}-list-item__prefix`},e.prefix()):null,e.default?v(`div`,{class:`${t}-list-item__main`},e):null,e.suffix?v(`div`,{class:`${t}-list-item__suffix`},e.suffix()):null,this.showDivider&&v(`div`,{class:`${t}-list-item__divider`}))}}),E=a(`thing`,`
74
+ display: flex;
75
+ transition: color .3s var(--n-bezier);
76
+ font-size: var(--n-font-size);
77
+ color: var(--n-text-color);
78
+ `,[a(`thing-avatar`,`
79
+ margin-right: 12px;
80
+ margin-top: 2px;
81
+ `),a(`thing-avatar-header-wrapper`,`
82
+ display: flex;
83
+ flex-wrap: nowrap;
84
+ `,[a(`thing-header-wrapper`,`
85
+ flex: 1;
86
+ `)]),a(`thing-main`,`
87
+ flex-grow: 1;
88
+ `,[a(`thing-header`,`
89
+ display: flex;
90
+ margin-bottom: 4px;
91
+ justify-content: space-between;
92
+ align-items: center;
93
+ `,[i(`title`,`
94
+ font-size: 16px;
95
+ font-weight: var(--n-title-font-weight);
96
+ transition: color .3s var(--n-bezier);
97
+ color: var(--n-title-text-color);
98
+ `)]),i(`description`,[r(`&:not(:last-child)`,`
99
+ margin-bottom: 4px;
100
+ `)]),i(`content`,[r(`&:not(:first-child)`,`
101
+ margin-top: 12px;
102
+ `)]),i(`footer`,[r(`&:not(:first-child)`,`
103
+ margin-top: 12px;
104
+ `)]),i(`action`,[r(`&:not(:first-child)`,`
105
+ margin-top: 12px;
106
+ `)])])]),D=l({name:`Thing`,props:Object.assign(Object.assign({},s.props),{title:String,titleExtra:String,description:String,descriptionClass:String,descriptionStyle:[String,Object],content:String,contentClass:String,contentStyle:[String,Object],contentIndented:Boolean}),slots:Object,setup(e,{slots:t}){let{mergedClsPrefixRef:n,inlineThemeDisabled:r,mergedRtlRef:i}=_(e),a=s(`Thing`,`-thing`,E,y,e,n),o=p(`Thing`,i,n),c=h(()=>{let{self:{titleTextColor:e,textColor:t,titleFontWeight:n,fontSize:r},common:{cubicBezierEaseInOut:i}}=a.value;return{"--n-bezier":i,"--n-font-size":r,"--n-text-color":t,"--n-title-font-weight":n,"--n-title-text-color":e}}),l=r?m(`thing`,void 0,c,e):void 0;return()=>{var i;let{value:a}=n,s=o?o.value:!1;return(i=l?.onRender)==null||i.call(l),v(`div`,{class:[`${a}-thing`,l?.themeClass,s&&`${a}-thing--rtl`],style:r?void 0:c.value},t.avatar&&e.contentIndented?v(`div`,{class:`${a}-thing-avatar`},t.avatar()):null,v(`div`,{class:`${a}-thing-main`},!e.contentIndented&&(t.header||e.title||t[`header-extra`]||e.titleExtra||t.avatar)?v(`div`,{class:`${a}-thing-avatar-header-wrapper`},t.avatar?v(`div`,{class:`${a}-thing-avatar`},t.avatar()):null,t.header||e.title||t[`header-extra`]||e.titleExtra?v(`div`,{class:`${a}-thing-header-wrapper`},v(`div`,{class:`${a}-thing-header`},t.header||e.title?v(`div`,{class:`${a}-thing-header__title`},t.header?t.header():e.title):null,t[`header-extra`]||e.titleExtra?v(`div`,{class:`${a}-thing-header__extra`},t[`header-extra`]?t[`header-extra`]():e.titleExtra):null),t.description||e.description?v(`div`,{class:[`${a}-thing-main__description`,e.descriptionClass],style:e.descriptionStyle},t.description?t.description():e.description):null):null):v(g,null,t.header||e.title||t[`header-extra`]||e.titleExtra?v(`div`,{class:`${a}-thing-header`},t.header||e.title?v(`div`,{class:`${a}-thing-header__title`},t.header?t.header():e.title):null,t[`header-extra`]||e.titleExtra?v(`div`,{class:`${a}-thing-header__extra`},t[`header-extra`]?t[`header-extra`]():e.titleExtra):null):null,t.description||e.description?v(`div`,{class:[`${a}-thing-main__description`,e.descriptionClass],style:e.descriptionStyle},t.description?t.description():e.description):null),t.default||e.content?v(`div`,{class:[`${a}-thing-main__content`,e.contentClass],style:e.contentStyle},t.default?t.default():e.content):null,t.footer?v(`div`,{class:`${a}-thing-main__footer`},t.footer()):null,t.action?v(`div`,{class:`${a}-thing-main__action`},t.action()):null))}}});export{T as n,w as r,D as t};
107
+ //# sourceMappingURL=Thing-CEAniuMg.js.map
@@ -0,0 +1,2 @@
1
+ import{Gn as e,In as t,Rn as n,Sn as r,_n as ee,bn as i,c as a,gn as o,mn as s,r as c,sr as l,t as u,tr as d,un as f,ur as p,vn as m,wn as h,xn as g}from"./Space-n5-XcguU.js";import{t as _}from"./Tag-D1fOKpTH.js";import{n as v,t as y}from"./DataTable-COAAWEft.js";import{n as b,t as x}from"./DescriptionsItem-P8JUDaBs.js";import{n as te,t as ne}from"./useTable-CnZc5zhi.js";import{n as S,t as C}from"./DrawerContent-TpYTFgF1.js";import{n as w,r as T,t as E}from"./Thing-CEAniuMg.js";import{l as re,t as D}from"./resources-Bt6thQCD.js";import{c as O,y as k}from"./index-CeE6v959.js";import{t as A}from"./EmptyState-DeDck-OL.js";import{t as j}from"./JsonField-DibyJgun.js";import{t as M}from"./useToast-DsZKx0IX.js";import{t as N}from"./useConfirm-tMjvBFXR.js";var P=r({__name:`Users`,setup(r){let P=M(),F=N(),I=[{type:`boolean`,key:`confirmed`,label:`Confirmed`,trueLabel:`Confirmed`,falseLabel:`Unconfirmed`,anyLabel:`Any`},{type:`boolean`,key:`banned`,label:`Banned`,trueLabel:`Banned`,falseLabel:`Active`,anyLabel:`Any`}],{q:L,data:R,loading:z,error:B,refresh:V}=ne(e=>D.users({search:e.search||void 0,confirmed:e.filters.confirmed,banned:e.filters.banned,limit:e.limit,offset:e.offset}),{confirmed:null,banned:null}),H=s(()=>R.value?.rows??[]),U=s(()=>R.value?.total??0),W=[{title:`Email`,key:`email`},{title:`Created`,key:`created_at`,width:120,render:e=>new Date(e.created_at).toLocaleDateString()},{title:`Last Sign-in`,key:`last_sign_in_at`,width:130,render:e=>e.last_sign_in_at?new Date(e.last_sign_in_at).toLocaleDateString():`—`},{title:`Banned`,key:`banned_until`,width:110,render:e=>{if(!e.banned_until)return`No`;let t=new Date(e.banned_until);return t<=new Date?`No`:h(_,{type:`error`,size:`small`},{default:()=>`Until ${t.toLocaleDateString()}`})}},{title:`Confirmed`,key:`email_confirmed_at`,width:100,render:e=>e.email_confirmed_at?h(_,{type:`success`,size:`small`},{default:()=>`Yes`}):h(_,{type:`default`,size:`small`},{default:()=>`No`})}],G=d(!1),K=d(null),q=d(null),J=d(!1),Y=d(null);function ie(e){K.value=e.id,G.value=!0,q.value=null,Y.value=null,Z(e.id)}function X(){G.value=!1,K.value=null,q.value=null,Y.value=null}async function Z(e){J.value=!0,Y.value=null;try{q.value=await D.getUser(e)}catch(e){Y.value=e.message??`Failed to load user detail`}finally{J.value=!1}}let Q=s(()=>q.value),$=s(()=>Q.value?.user.banned_until?new Date(Q.value.user.banned_until)>new Date:!1);async function ae(){if(!K.value||!Q.value)return;let e=Q.value.user.email;if(await F(`Ban user "${e}" for 24h?`,`They cannot sign in until unbanned.`))try{await D.banUser(K.value),P.success(`Banned.`),await Z(K.value),await V()}catch(e){P.error(e.message??`Ban failed`)}}async function oe(){if(!K.value||!Q.value)return;let e=Q.value.user.email;if(await F(`Unban user "${e}"?`,`They will be able to sign in again.`))try{await D.unbanUser(K.value),P.success(`Unbanned.`),await Z(K.value),await V()}catch(e){P.error(e.message??`Unban failed`)}}async function se(){if(!K.value||!Q.value)return;let e=Q.value.user.email;if(await F(`Force logout user "${e}"?`,`All their refresh tokens will be revoked immediately.`))try{let e=await D.forceLogout(K.value);P.success(`Force logout — ${e.revoked} token(s) revoked.`),await Z(K.value),await V()}catch(e){P.error(e.message??`Force logout failed`)}}return(r,s)=>(t(),o(l(c),{title:`Users`,size:`small`},{default:e(()=>[g(te,{q:l(L),rows:H.value,total:U.value,loading:l(z),error:l(B),columns:W,filters:I,"search-placeholder":`Search by email…`,onRefresh:l(V)},{default:e(()=>[g(l(y),{columns:W,data:H.value,bordered:!1,"row-props":e=>({style:`cursor: pointer`,onClick:()=>ie(e)})},null,8,[`data`,`row-props`]),g(l(v),{page:Math.floor(l(L).offset/l(L).limit)+1,"page-count":Math.max(1,Math.ceil(U.value/l(L).limit)),style:{"margin-top":`12px`},"onUpdate:page":s[0]||=e=>l(L).offset=(e-1)*l(L).limit},null,8,[`page`,`page-count`])]),_:1},8,[`q`,`rows`,`total`,`loading`,`error`,`onRefresh`]),g(l(S),{show:G.value,width:520,placement:`right`,"mask-closable":!0,"onUpdate:show":s[2]||=e=>{e||X()}},{default:e(()=>[g(l(C),{title:`User detail`,closable:``,onClose:X},{default:e(()=>[J.value?(t(),o(l(u),{key:0,vertical:``,align:`center`,style:{padding:`48px 0`}},{default:e(()=>[g(l(re)),g(l(O),{depth:`3`},{default:e(()=>[...s[3]||=[i(`Loading…`,-1)]]),_:1})]),_:1})):Y.value?(t(),o(l(u),{key:1,vertical:``,align:`center`,style:{padding:`32px 0`}},{default:e(()=>[g(l(O),{type:`error`},{default:e(()=>[i(p(Y.value),1)]),_:1}),g(l(a),{size:`small`,onClick:s[1]||=e=>K.value&&Z(K.value)},{default:e(()=>[...s[4]||=[i(`Retry`,-1)]]),_:1})]),_:1})):Q.value?(t(),m(f,{key:2},[g(l(u),{style:{"margin-bottom":`20px`}},{default:e(()=>[$.value?(t(),o(l(a),{key:1,type:`success`,size:`small`,onClick:oe},{default:e(()=>[...s[6]||=[i(` Unban `,-1)]]),_:1})):(t(),o(l(a),{key:0,type:`warning`,size:`small`,onClick:ae},{default:e(()=>[...s[5]||=[i(` Ban 24h `,-1)]]),_:1})),g(l(a),{type:`error`,size:`small`,secondary:``,onClick:se},{default:e(()=>[...s[7]||=[i(` Force Logout `,-1)]]),_:1})]),_:1}),g(l(b),{bordered:``,"label-placement":`top`,column:1,size:`small`},{default:e(()=>[g(l(x),{label:`id`},{default:e(()=>[g(l(O),{code:``},{default:e(()=>[i(p(Q.value.user.id),1)]),_:1})]),_:1}),g(l(x),{label:`email`},{default:e(()=>[i(p(Q.value.user.email),1)]),_:1}),g(l(x),{label:`created_at`},{default:e(()=>[i(p(new Date(Q.value.user.created_at).toLocaleString()),1)]),_:1}),g(l(x),{label:`last_sign_in_at`},{default:e(()=>[i(p(Q.value.user.last_sign_in_at?new Date(Q.value.user.last_sign_in_at).toLocaleString():`—`),1)]),_:1}),g(l(x),{label:`email_confirmed_at`},{default:e(()=>[i(p(Q.value.user.email_confirmed_at?new Date(Q.value.user.email_confirmed_at).toLocaleString():`—`),1)]),_:1}),g(l(x),{label:`banned_until`},{default:e(()=>[i(p($.value?new Date(Q.value.user.banned_until).toLocaleString():`Not banned`),1)]),_:1})]),_:1}),g(l(k)),g(l(O),{strong:``,style:{display:`block`,"margin-bottom":`8px`}},{default:e(()=>[i(` Identities (`+p(Q.value.identities.length)+`) `,1)]),_:1}),Q.value.identities.length?(t(),o(l(y),{key:0,columns:[{title:`Provider`,key:`provider`},{title:`Provider User ID`,key:`provider_user_id`},{title:`Data`,key:`identity_data`,render:e=>h(j,{value:e.identity_data})}],data:Q.value.identities,bordered:!1,size:`small`,style:{"margin-bottom":`16px`}},null,8,[`columns`,`data`])):(t(),o(A,{key:1,description:`No linked identities.`})),g(l(k)),g(l(O),{strong:``,style:{display:`block`,"margin-bottom":`8px`}},{default:e(()=>[i(` Recent audit events (`+p(Q.value.recent_audit.length)+`) `,1)]),_:1}),Q.value.recent_audit.length?(t(),o(l(T),{key:2,hoverable:``},{default:e(()=>[(t(!0),m(f,null,n(Q.value.recent_audit,n=>(t(),o(l(w),{key:n.id},{default:e(()=>[g(l(E),{title:n.event,description:new Date(n.created_at).toLocaleString()},{default:e(()=>[n.ip?(t(),o(l(O),{key:0,depth:`3`,style:{"font-size":`12px`}},{default:e(()=>[i(`IP: `+p(n.ip),1)]),_:2},1024)):ee(``,!0)]),_:2},1032,[`title`,`description`])]),_:2},1024))),128))]),_:1})):(t(),o(A,{key:3,description:`No recent audit events.`}))],64)):(t(),o(l(O),{key:3,depth:`3`},{default:e(()=>[...s[8]||=[i(`Select a user row to see details.`,-1)]]),_:1}))]),_:1})]),_:1},8,[`show`])]),_:1}))}});export{P as default};
2
+ //# sourceMappingURL=Users-wzwajhlh.js.map
@@ -0,0 +1 @@
1
+ var e=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n};export{e as t};