p3x-redis-ui-material
Version:
💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity
11 lines (10 loc) • 12.5 kB
JavaScript
import{a as Ce,b as ve,c as be}from"./chunk-2H2JFAKN.js";import"./chunk-KLZILXP3.js";import"./chunk-IDORGLM3.js";import"./chunk-ICUC3WIE.js";import{a as he}from"./chunk-R73GSFUT.js";import{b as ce,c as pe,d as xe,e as _e}from"./chunk-VMTBY4VN.js";import{b as me,c as ue}from"./chunk-HFDIHHHN.js";import{a as re,b as ae,d as le,e as de,f as fe,g as se}from"./chunk-7JNYLOAK.js";import{$a as k,Bb as m,Cb as h,Da as L,Db as S,Eb as O,Ia as Q,Jc as te,Ld as ie,Nd as ne,Pd as oe,Rd as ge,Tb as W,Xa as T,Ya as w,Za as D,ab as y,ba as F,bb as H,ca as V,cb as f,db as d,eb as Z,jb as A,lb as C,na as q,nb as s,oc as ee,xa as l,zb as $}from"./chunk-KQUCMSSK.js";import"./chunk-FCVD6SGJ.js";import{a as K}from"./chunk-O7S4L63H.js";var j=class{diff(i,e,t={}){let n;typeof t=="function"?(n=t,t={}):"callback"in t&&(n=t.callback);let r=this.castInput(i,t),a=this.castInput(e,t),g=this.removeEmpty(this.tokenize(r,t)),u=this.removeEmpty(this.tokenize(a,t));return this.diffWithOptionsObj(g,u,t,n)}diffWithOptionsObj(i,e,t,n){var r;let a=p=>{if(p=this.postProcess(p,t),n){setTimeout(function(){n(p)},0);return}else return p},g=e.length,u=i.length,x=1,c=g+u;t.maxEditLength!=null&&(c=Math.min(c,t.maxEditLength));let I=(r=t.timeout)!==null&&r!==void 0?r:1/0,E=Date.now()+I,_=[{oldPos:-1,lastComponent:void 0}],v=this.extractCommon(_[0],e,i,0,t);if(_[0].oldPos+1>=u&&v+1>=g)return a(this.buildValues(_[0].lastComponent,e,i));let N=-1/0,R=1/0,J=()=>{for(let p=Math.max(N,-x);p<=Math.min(R,x);p+=2){let b,P=_[p-1],M=_[p+1];P&&(_[p-1]=void 0);let z=!1;if(M){let Y=M.oldPos-p;z=M&&0<=Y&&Y<g}let U=P&&P.oldPos+1<u;if(!z&&!U){_[p]=void 0;continue}if(!U||z&&P.oldPos<M.oldPos?b=this.addToPath(M,!0,!1,0,t):b=this.addToPath(P,!1,!0,1,t),v=this.extractCommon(b,e,i,p,t),b.oldPos+1>=u&&v+1>=g)return a(this.buildValues(b.lastComponent,e,i))||!0;_[p]=b,b.oldPos+1>=u&&(R=Math.min(R,p-1)),v+1>=g&&(N=Math.max(N,p+1))}x++};if(n)(function p(){setTimeout(function(){if(x>c||Date.now()>E)return n(void 0);J()||p()},0)})();else for(;x<=c&&Date.now()<=E;){let p=J();if(p)return p}}addToPath(i,e,t,n,r){let a=i.lastComponent;return a&&!r.oneChangePerToken&&a.added===e&&a.removed===t?{oldPos:i.oldPos+n,lastComponent:{count:a.count+1,added:e,removed:t,previousComponent:a.previousComponent}}:{oldPos:i.oldPos+n,lastComponent:{count:1,added:e,removed:t,previousComponent:a}}}extractCommon(i,e,t,n,r){let a=e.length,g=t.length,u=i.oldPos,x=u-n,c=0;for(;x+1<a&&u+1<g&&this.equals(t[u+1],e[x+1],r);)x++,u++,c++,r.oneChangePerToken&&(i.lastComponent={count:1,previousComponent:i.lastComponent,added:!1,removed:!1});return c&&!r.oneChangePerToken&&(i.lastComponent={count:c,previousComponent:i.lastComponent,added:!1,removed:!1}),i.oldPos=u,x}equals(i,e,t){return t.comparator?t.comparator(i,e):i===e||!!t.ignoreCase&&i.toLowerCase()===e.toLowerCase()}removeEmpty(i){let e=[];for(let t=0;t<i.length;t++)i[t]&&e.push(i[t]);return e}castInput(i,e){return i}tokenize(i,e){return Array.from(i)}join(i){return i.join("")}postProcess(i,e){return i}get useLongestToken(){return!1}buildValues(i,e,t){let n=[],r;for(;i;)n.push(i),r=i.previousComponent,delete i.previousComponent,i=r;n.reverse();let a=n.length,g=0,u=0,x=0;for(;g<a;g++){let c=n[g];if(c.removed)c.value=this.join(t.slice(x,x+c.count)),x+=c.count;else{if(!c.added&&this.useLongestToken){let I=e.slice(u,u+c.count);I=I.map(function(E,_){let v=t[x+_];return v.length>E.length?v:E}),c.value=this.join(I)}else c.value=this.join(e.slice(u,u+c.count));u+=c.count,c.added||(x+=c.count)}}return n}};var G=class extends j{constructor(){super(...arguments),this.tokenize=ke}equals(i,e,t){return t.ignoreWhitespace?((!t.newlineIsToken||!i.includes(`
`))&&(i=i.trim()),(!t.newlineIsToken||!e.includes(`
`))&&(e=e.trim())):t.ignoreNewlineAtEof&&!t.newlineIsToken&&(i.endsWith(`
`)&&(i=i.slice(0,-1)),e.endsWith(`
`)&&(e=e.slice(0,-1))),super.equals(i,e,t)}},De=new G;function X(o,i,e){return De.diff(o,i,e)}function ke(o,i){i.stripTrailingCr&&(o=o.replace(/\r\n/g,`
`));let e=[],t=o.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(let n=0;n<t.length;n++){let r=t[n];n%2&&!i.newlineIsToken?e[e.length-1]+=r:e.push(r)}return e}function ye(o,i){if(o&1){let e=A();f(0,"div",15),C("click",function(){F(e);let n=s().$index,r=s(2);return V(r.expandBlock(n))}),m(1),d()}if(o&2){let e=s().$implicit,t=s(2);l(),O("... ",e.collapsedCount," ",t.diffStrings().unchangedLines," ...")}}function Te(o,i){if(o&1&&(f(0,"div",17)(1,"span",18),m(2),d(),m(3),d()),o&2){let e=i.$implicit,t=s(2).$implicit;$("p3xr-diff-added",t.type==="added")("p3xr-diff-removed",t.type==="removed")("p3xr-diff-unchanged",t.type==="unchanged"||t.type==="collapse"),l(2),h(t.type==="added"?"+":t.type==="removed"?"-":" "),l(),S("",e," ")}}function we(o,i){if(o&1&&k(0,Te,4,8,"div",16,D),o&2){let e=s().$implicit;y(e.lines)}}function Se(o,i){if(o&1&&T(0,ye,2,2,"div",14)(1,we,2,0),o&2){let e=i.$implicit;w(e.type==="collapse"&&!e.expanded?0:1)}}function Ie(o,i){if(o&1&&k(0,Se,2,1,null,null,D),o&2){let e=s();y(e.blocks())}}function Ee(o,i){if(o&1){let e=A();f(0,"div",15),C("click",function(){F(e);let n=s().$index,r=s(2);return V(r.expandBlock(n))}),m(1),d()}if(o&2){let e=s().$implicit,t=s(2);l(),O("... ",e.collapsedCount," ",t.diffStrings().unchangedLines," ...")}}function Pe(o,i){if(o&1&&(f(0,"div",17),m(1),d()),o&2){let e=i.$implicit,t=s(2).$implicit;$("p3xr-diff-removed",t.type==="removed")("p3xr-diff-unchanged",t.type==="unchanged"||t.type==="collapse"),l(),h(e)}}function Me(o,i){if(o&1&&k(0,Pe,2,5,"div",21,D),o&2){let e=s().$implicit;y(e.lines)}}function Le(o,i){if(o&1&&T(0,Ee,2,2,"div",14)(1,Me,2,0),o&2){let e=i.$implicit;w(e.type==="collapse"&&!e.expanded?0:e.type!=="added"?1:-1)}}function $e(o,i){if(o&1){let e=A();f(0,"div",15),C("click",function(){F(e);let n=s().$index,r=s(2);return V(r.expandBlock(n))}),m(1),d()}if(o&2){let e=s().$implicit,t=s(2);l(),O("... ",e.collapsedCount," ",t.diffStrings().unchangedLines," ...")}}function Be(o,i){if(o&1&&(f(0,"div",17),m(1),d()),o&2){let e=i.$implicit,t=s(2).$implicit;$("p3xr-diff-added",t.type==="added")("p3xr-diff-unchanged",t.type==="unchanged"||t.type==="collapse"),l(),h(e)}}function Fe(o,i){if(o&1&&k(0,Be,2,5,"div",22,D),o&2){let e=s().$implicit;y(e.lines)}}function Ve(o,i){if(o&1&&T(0,$e,2,2,"div",14)(1,Fe,2,0),o&2){let e=i.$implicit;w(e.type==="collapse"&&!e.expanded?0:e.type!=="removed"?1:-1)}}function Ae(o,i){if(o&1&&(f(0,"div",19)(1,"div",20),m(2),d(),k(3,Le,2,1,null,null,D),d(),f(5,"div",19)(6,"div",20),m(7),d(),k(8,Ve,2,1,null,null,D),d()),o&2){let e=s();l(2),h(e.diffStrings().before),l(),y(e.blocks()),l(4),h(e.diffStrings().after),l(),y(e.blocks())}}function Oe(o,i){if(o&1&&(f(0,"span"),m(1),d()),o&2){let e,t=s();l(),h((e=t.strings().intention)==null?null:e.save)}}var B=3,ut=(()=>{class o{data;dialogRef;i18n;breakpointObserver;strings;diffStrings;mode=q("inline");blocks=q([]);isWide=!0;rawChanges;additions;deletions;constructor(e,t,n,r){this.data=e,this.dialogRef=t,this.i18n=n,this.breakpointObserver=r,this.strings=this.i18n.strings,this.diffStrings=W(()=>this.strings()?.diff||{}),this.rawChanges=X(e.oldValue,e.newValue),this.additions=W(()=>this.rawChanges.filter(a=>a.added).reduce((a,g)=>a+(g.value.split(`
`).length-1||1),0)),this.deletions=W(()=>this.rawChanges.filter(a=>a.removed).reduce((a,g)=>a+(g.value.split(`
`).length-1||1),0))}ngOnInit(){this.blocks.set(this.buildBlocks()),this.breakpointObserver.observe("(min-width: 600px)").subscribe(e=>{this.isWide=e.matches})}expandBlock(e){let t=[...this.blocks()],n=K({},t[e]);n.expanded=!0,n.type="unchanged",t[e]=n,this.blocks.set(t)}buildBlocks(){let e=[];for(let t of this.rawChanges){let n=t.value.replace(/\n$/,"").split(`
`);if(t.added)e.push({type:"added",lines:n});else if(t.removed)e.push({type:"removed",lines:n});else if(n.length<=B*2+1)e.push({type:"unchanged",lines:n});else{e.push({type:"unchanged",lines:n.slice(0,B)});let r=n.slice(B,-B);e.push({type:"collapse",lines:r,collapsedCount:r.length}),e.push({type:"unchanged",lines:n.slice(-B)})}}return e}static \u0275fac=function(t){return new(t||o)(L(ae),L(re),L(ge),L(te))};static \u0275cmp=Q({type:o,selectors:[["p3xr-diff-dialog"]],decls:31,vars:15,consts:[[1,"p3xr-dialog-toolbar","p3xr-mat-layout-strong"],["mat-dialog-title","",1,"p3xr-dialog-title","p3xr-dialog-title-with-icon",2,"overflow","hidden","text-overflow","ellipsis","white-space","nowrap"],[2,"flex","1"],[1,"p3xr-diff-toggle",3,"change","value","hideSingleSelectionIndicator"],["value","inline"],["value","side-by-side"],[1,"p3xr-diff-summary-header"],[1,"p3xr-diff-count-add"],[1,"p3xr-diff-count-del"],["mat-icon-button","",3,"click"],[1,"p3xr-dialog-content","p3xr-diff-content"],[1,"p3xr-dialog-actions"],[3,"cancel"],["mat-raised-button","",1,"btn-primary",3,"click","matTooltip","matTooltipDisabled"],[1,"p3xr-diff-collapse"],[1,"p3xr-diff-collapse",3,"click"],[1,"p3xr-diff-line",3,"p3xr-diff-added","p3xr-diff-removed","p3xr-diff-unchanged"],[1,"p3xr-diff-line"],[1,"p3xr-diff-prefix"],[1,"p3xr-diff-side"],[1,"p3xr-diff-side-header"],[1,"p3xr-diff-line",3,"p3xr-diff-removed","p3xr-diff-unchanged"],[1,"p3xr-diff-line",3,"p3xr-diff-added","p3xr-diff-unchanged"]],template:function(t,n){if(t&1&&(f(0,"mat-toolbar",0)(1,"span",1)(2,"mat-icon"),m(3,"difference"),d(),f(4,"span"),m(5),d()(),Z(6,"span",2),f(7,"mat-button-toggle-group",3),C("change",function(a){return n.mode.set(a.value)}),f(8,"mat-button-toggle",4),m(9),d(),f(10,"mat-button-toggle",5),m(11),d()(),f(12,"span",6)(13,"span",7),m(14),d(),m(15),f(16,"span",8),m(17),d(),m(18),d(),f(19,"button",9),C("click",function(){return n.dialogRef.close(!1)}),f(20,"mat-icon"),m(21,"close"),d()()(),f(22,"mat-dialog-content",10),T(23,Ie,2,0)(24,Ae,10,2),d(),f(25,"mat-dialog-actions",11)(26,"p3xr-dialog-cancel",12),C("cancel",function(){return n.dialogRef.close(!1)}),d(),f(27,"button",13),C("click",function(){return n.dialogRef.close(!0)}),f(28,"mat-icon"),m(29,"save"),d(),T(30,Oe,2,1,"span"),d()()),t&2){let r;l(5),h(n.diffStrings().reviewChanges),l(2),H("value",n.mode())("hideSingleSelectionIndicator",!0),l(2),h(n.diffStrings().inline),l(2),h(n.diffStrings().sideBySide),l(3),S("+",n.additions()),l(),S(" ",n.diffStrings().additions,", "),l(2),S("-",n.deletions()),l(),S(" ",n.diffStrings().deletions," "),l(4),$("p3xr-diff-sbs",n.mode()==="side-by-side"),l(),w(n.mode()==="inline"?23:24),l(4),H("matTooltip",(r=n.strings().intention)==null?null:r.save)("matTooltipDisabled",n.isWide),l(3),w(n.isWide?30:-1)}},dependencies:[ee,se,le,fe,de,oe,ne,ie,ue,me,_e,xe,pe,ce,be,Ce,ve,he],styles:[`.p3xr-diff-content{font-family:Roboto Mono,monospace;font-size:13px;padding:0!important;min-height:200px;max-height:60vh;overflow:auto}.p3xr-diff-sbs{display:grid;grid-template-columns:1fr 1fr}.p3xr-diff-side{overflow:auto}.p3xr-diff-side:first-child{border-right:1px solid rgba(128,128,128,.2)}.p3xr-diff-side-header{padding:4px 8px;font-weight:500;position:sticky;top:0;z-index:1;border-bottom:1px solid rgba(128,128,128,.2);background:var(--p3xr-content-bg, inherit)}.p3xr-diff-line{padding:1px 8px;white-space:pre-wrap;word-break:break-all}.p3xr-diff-prefix{display:inline-block;width:16px;font-weight:700;-webkit-user-select:none;user-select:none}.p3xr-diff-added{background:#4caf501f}.p3xr-diff-removed{background:#f443361f}.p3xr-diff-unchanged{opacity:.6}.p3xr-diff-collapse{padding:4px 8px;opacity:.4;font-style:italic;cursor:pointer}.p3xr-diff-collapse:hover{opacity:.7}.p3xr-diff-toggle{height:28px;margin-right:4px;border-radius:4px!important;overflow:hidden;border:1px solid rgba(255,255,255,.3)!important}.p3xr-diff-toggle .mat-button-toggle{height:28px;font-size:12px;border:none!important;border-left:1px solid rgba(255,255,255,.3)!important;border-radius:0!important;background:transparent;color:#ffffffb3}.p3xr-diff-toggle .mat-button-toggle:first-child{border-left:none!important}.p3xr-diff-toggle .mat-button-toggle-checked{background:#ffffff26!important;color:#fffffff2!important}.p3xr-diff-toggle .mat-button-toggle-button{height:28px}.p3xr-diff-toggle .mat-button-toggle-label-content{line-height:28px!important;padding:0 10px!important}.p3xr-diff-toggle .mat-pseudo-checkbox,.p3xr-diff-toggle .mdc-button__icon{display:none!important}.p3xr-diff-toggle .mat-button-toggle-button{padding:0!important}.p3xr-diff-summary-header{font-size:12px;opacity:.8;white-space:nowrap;margin-left:8px;margin-right:4px}.p3xr-diff-count-add{color:#81c784;font-weight:700}.p3xr-diff-count-del{color:#ef9a9a;font-weight:700}
`],encapsulation:2,changeDetection:0})}return o})();export{ut as DiffDialogComponent};