@hsupu/copilot-api 0.8.1-beta.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.example.yaml +25 -0
- package/dist/{dist-8vhX0s4a.mjs → dist-B3gFwWti.mjs} +2 -3
- package/dist/{dist-8vhX0s4a.mjs.map → dist-B3gFwWti.mjs.map} +1 -1
- package/dist/main.mjs +7006 -5185
- package/dist/main.mjs.map +1 -1
- package/package.json +53 -23
- package/ui/history-v3/dist/assets/LogsPage-CkzMEjbU.css +1 -0
- package/ui/history-v3/dist/assets/LogsPage-CyM6vZyg.js +1 -0
- package/ui/history-v3/dist/assets/VActivityPage-DGZYvP1d.css +1 -0
- package/ui/history-v3/dist/assets/VActivityPage-qSJRqJGU.js +3 -0
- package/ui/history-v3/dist/assets/VCard-B2q0rBgl.js +1 -0
- package/ui/history-v3/dist/assets/VCard-v_d_q0Rh.css +1 -0
- package/ui/history-v3/dist/assets/VConfigPage-DisddwD3.css +1 -0
- package/ui/history-v3/dist/assets/VConfigPage-zQu5b6tC.js +1 -0
- package/ui/history-v3/dist/assets/VDashboardPage-CsNfE_go.js +1 -0
- package/ui/history-v3/dist/assets/VDashboardPage-oAbMfN9y.css +1 -0
- package/ui/history-v3/dist/assets/VDialog-B5tAv-4d.js +1 -0
- package/ui/history-v3/dist/assets/VDialog-CFhCWS_I.css +1 -0
- package/ui/history-v3/dist/assets/VModelsPage-C1y0gG_S.js +1 -0
- package/ui/history-v3/dist/assets/VModelsPage-DMPq4SEZ.css +1 -0
- package/ui/history-v3/dist/assets/VSelect-CahLC2X3.js +1 -0
- package/ui/history-v3/dist/assets/VSelect-CiSADOyl.css +1 -0
- package/ui/history-v3/dist/assets/VSheet-BhXOOy9y.js +1 -0
- package/ui/history-v3/dist/assets/VSheet-DI_DMcjz.css +1 -0
- package/ui/history-v3/dist/assets/index-Cxye_z0t.js +18 -0
- package/ui/history-v3/dist/assets/index-sVLYkWM6.css +1 -0
- package/ui/history-v3/dist/assets/materialdesignicons-webfont-B7mPwVP_.ttf +0 -0
- package/ui/history-v3/dist/assets/materialdesignicons-webfont-CSr8KVlo.eot +0 -0
- package/ui/history-v3/dist/assets/materialdesignicons-webfont-Dp5v-WZN.woff2 +0 -0
- package/ui/history-v3/dist/assets/materialdesignicons-webfont-PXm3-2wK.woff +0 -0
- package/ui/history-v3/dist/assets/useLogs-C_hg5wZk.js +1 -0
- package/ui/history-v3/dist/assets/{vendor-BJ2Uq5vY.js → vendor-tLv7SZ-i.js} +15 -15
- package/ui/history-v3/dist/assets/vue-McY99x0M.js +1 -0
- package/ui/history-v3/dist/assets/ws-status-BJ5xglsi.js +1 -0
- package/ui/history-v3/dist/index.html +3 -3
- package/ui/history-v3/dist/assets/DashboardPage-B1uByGH4.js +0 -1
- package/ui/history-v3/dist/assets/DashboardPage-CabImjCg.css +0 -1
- package/ui/history-v3/dist/assets/HistoryPage-CcuFI_7q.js +0 -3
- package/ui/history-v3/dist/assets/HistoryPage-MBmz_wrp.css +0 -1
- package/ui/history-v3/dist/assets/LogsPage-CTboGme2.js +0 -1
- package/ui/history-v3/dist/assets/LogsPage-DnfMvMyI.css +0 -1
- package/ui/history-v3/dist/assets/ModelsPage-BCijEIH1.css +0 -1
- package/ui/history-v3/dist/assets/ModelsPage-B_sjc_hg.js +0 -1
- package/ui/history-v3/dist/assets/ProgressBar-BQxTnwIj.js +0 -1
- package/ui/history-v3/dist/assets/ProgressBar-B_0VSeE9.css +0 -1
- package/ui/history-v3/dist/assets/UsagePage-Nx_clyfV.css +0 -1
- package/ui/history-v3/dist/assets/UsagePage-Nxy64EGo.js +0 -1
- package/ui/history-v3/dist/assets/index-D5HcAJB-.css +0 -1
- package/ui/history-v3/dist/assets/index-DOp9l2lW.js +0 -2
- package/ui/history-v3/dist/assets/vue-CYcm9SLm.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r,W as c}from"./index-Cxye_z0t.js";import{P as f,a2 as v,r as o}from"./vue-McY99x0M.js";const p=200;function h(){const t=o([]),a=o(!0),l=o(!1);let e=null;function s(n){t.value=[n,...t.value].slice(0,p)}function u(n){t.value=t.value.map(i=>i.id===n.id?n:i)}async function d(){a.value=!0;try{const n=await r.fetchEntries({limit:100});t.value=n.entries}catch{}finally{a.value=!1}}return f(()=>{d(),e=new c({topics:["history"],onEntryAdded:s,onEntryUpdated:u,onHistoryCleared:()=>{t.value=[]},onStatusChange:n=>{l.value=n}}),e.connect()}),v(()=>{e?.disconnect(),e=null}),{entries:t,loading:a,wsConnected:l}}export{h as u};
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import{w as ot,a as at,r as st,b as lt,n as ct,d as ut,c as dt,e as ft,f as ht,F as pt}from"./vue-
|
|
1
|
+
import{w as ot,a as at,r as st,b as lt,n as ct,d as ut,c as dt,e as ft,f as ht,F as pt}from"./vue-McY99x0M.js";var mt={207:(r,n,t)=>{r.exports=t(452)},452:r=>{var n=(function(t){var e,i=Object.prototype,c=i.hasOwnProperty,a=typeof Symbol=="function"?Symbol:{},s=a.iterator||"@@iterator",p=a.asyncIterator||"@@asyncIterator",h=a.toStringTag||"@@toStringTag";function v(d,f,x){return Object.defineProperty(d,f,{value:x,enumerable:!0,configurable:!0,writable:!0}),d[f]}try{v({},"")}catch{v=function(f,x,D){return f[x]=D}}function j(d,f,x,D){var l=f&&f.prototype instanceof E?f:E,O=Object.create(l.prototype),y=new L(D||[]);return O._invoke=(function(_,G,V){var z=u;return function($,X){if(z===N)throw new Error("Generator is already running");if(z===g){if($==="throw")throw X;return R()}for(V.method=$,V.arg=X;;){var Y=V.delegate;if(Y){var J=F(Y,V);if(J){if(J===C)continue;return J}}if(V.method==="next")V.sent=V._sent=V.arg;else if(V.method==="throw"){if(z===u)throw z=g,V.arg;V.dispatchException(V.arg)}else V.method==="return"&&V.abrupt("return",V.arg);z=N;var ee=H(_,G,V);if(ee.type==="normal"){if(z=V.done?g:m,ee.arg===C)continue;return{value:ee.arg,done:V.done}}ee.type==="throw"&&(z=g,V.method="throw",V.arg=ee.arg)}}})(d,x,y),O}function H(d,f,x){try{return{type:"normal",arg:d.call(f,x)}}catch(D){return{type:"throw",arg:D}}}t.wrap=j;var u="suspendedStart",m="suspendedYield",N="executing",g="completed",C={};function E(){}function S(){}function M(){}var A={};v(A,s,(function(){return this}));var I=Object.getPrototypeOf,B=I&&I(I(k([])));B&&B!==i&&c.call(B,s)&&(A=B);var o=M.prototype=E.prototype=Object.create(A);function b(d){["next","throw","return"].forEach((function(f){v(d,f,(function(x){return this._invoke(f,x)}))}))}function w(d,f){function x(l,O,y,_){var G=H(d[l],d,O);if(G.type!=="throw"){var V=G.arg,z=V.value;return z&&typeof z=="object"&&c.call(z,"__await")?f.resolve(z.__await).then((function($){x("next",$,y,_)}),(function($){x("throw",$,y,_)})):f.resolve(z).then((function($){V.value=$,y(V)}),(function($){return x("throw",$,y,_)}))}_(G.arg)}var D;this._invoke=function(l,O){function y(){return new f((function(_,G){x(l,O,_,G)}))}return D=D?D.then(y,y):y()}}function F(d,f){var x=d.iterator[f.method];if(x===e){if(f.delegate=null,f.method==="throw"){if(d.iterator.return&&(f.method="return",f.arg=e,F(d,f),f.method==="throw"))return C;f.method="throw",f.arg=new TypeError("The iterator does not provide a 'throw' method")}return C}var D=H(x,d.iterator,f.arg);if(D.type==="throw")return f.method="throw",f.arg=D.arg,f.delegate=null,C;var l=D.arg;return l?l.done?(f[d.resultName]=l.value,f.next=d.nextLoc,f.method!=="return"&&(f.method="next",f.arg=e),f.delegate=null,C):l:(f.method="throw",f.arg=new TypeError("iterator result is not an object"),f.delegate=null,C)}function W(d){var f={tryLoc:d[0]};1 in d&&(f.catchLoc=d[1]),2 in d&&(f.finallyLoc=d[2],f.afterLoc=d[3]),this.tryEntries.push(f)}function T(d){var f=d.completion||{};f.type="normal",delete f.arg,d.completion=f}function L(d){this.tryEntries=[{tryLoc:"root"}],d.forEach(W,this),this.reset(!0)}function k(d){if(d){var f=d[s];if(f)return f.call(d);if(typeof d.next=="function")return d;if(!isNaN(d.length)){var x=-1,D=function l(){for(;++x<d.length;)if(c.call(d,x))return l.value=d[x],l.done=!1,l;return l.value=e,l.done=!0,l};return D.next=D}}return{next:R}}function R(){return{value:e,done:!0}}return S.prototype=M,v(o,"constructor",M),v(M,"constructor",S),S.displayName=v(M,h,"GeneratorFunction"),t.isGeneratorFunction=function(d){var f=typeof d=="function"&&d.constructor;return!!f&&(f===S||(f.displayName||f.name)==="GeneratorFunction")},t.mark=function(d){return Object.setPrototypeOf?Object.setPrototypeOf(d,M):(d.__proto__=M,v(d,h,"GeneratorFunction")),d.prototype=Object.create(o),d},t.awrap=function(d){return{__await:d}},b(w.prototype),v(w.prototype,p,(function(){return this})),t.AsyncIterator=w,t.async=function(d,f,x,D,l){l===void 0&&(l=Promise);var O=new w(j(d,f,x,D),l);return t.isGeneratorFunction(f)?O:O.next().then((function(y){return y.done?y.value:O.next()}))},b(o),v(o,h,"Generator"),v(o,s,(function(){return this})),v(o,"toString",(function(){return"[object Generator]"})),t.keys=function(d){var f=[];for(var x in d)f.push(x);return f.reverse(),function D(){for(;f.length;){var l=f.pop();if(l in d)return D.value=l,D.done=!1,D}return D.done=!0,D}},t.values=k,L.prototype={constructor:L,reset:function(d){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!d)for(var f in this)f.charAt(0)==="t"&&c.call(this,f)&&!isNaN(+f.slice(1))&&(this[f]=e)},stop:function(){this.done=!0;var d=this.tryEntries[0].completion;if(d.type==="throw")throw d.arg;return this.rval},dispatchException:function(d){if(this.done)throw d;var f=this;function x(G,V){return O.type="throw",O.arg=d,f.next=G,V&&(f.method="next",f.arg=e),!!V}for(var D=this.tryEntries.length-1;D>=0;--D){var l=this.tryEntries[D],O=l.completion;if(l.tryLoc==="root")return x("end");if(l.tryLoc<=this.prev){var y=c.call(l,"catchLoc"),_=c.call(l,"finallyLoc");if(y&&_){if(this.prev<l.catchLoc)return x(l.catchLoc,!0);if(this.prev<l.finallyLoc)return x(l.finallyLoc)}else if(y){if(this.prev<l.catchLoc)return x(l.catchLoc,!0)}else{if(!_)throw new Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return x(l.finallyLoc)}}}},abrupt:function(d,f){for(var x=this.tryEntries.length-1;x>=0;--x){var D=this.tryEntries[x];if(D.tryLoc<=this.prev&&c.call(D,"finallyLoc")&&this.prev<D.finallyLoc){var l=D;break}}l&&(d==="break"||d==="continue")&&l.tryLoc<=f&&f<=l.finallyLoc&&(l=null);var O=l?l.completion:{};return O.type=d,O.arg=f,l?(this.method="next",this.next=l.finallyLoc,C):this.complete(O)},complete:function(d,f){if(d.type==="throw")throw d.arg;return d.type==="break"||d.type==="continue"?this.next=d.arg:d.type==="return"?(this.rval=this.arg=d.arg,this.method="return",this.next="end"):d.type==="normal"&&f&&(this.next=f),C},finish:function(d){for(var f=this.tryEntries.length-1;f>=0;--f){var x=this.tryEntries[f];if(x.finallyLoc===d)return this.complete(x.completion,x.afterLoc),T(x),C}},catch:function(d){for(var f=this.tryEntries.length-1;f>=0;--f){var x=this.tryEntries[f];if(x.tryLoc===d){var D=x.completion;if(D.type==="throw"){var l=D.arg;T(x)}return l}}throw new Error("illegal catch attempt")},delegateYield:function(d,f,x){return this.delegate={iterator:k(d),resultName:f,nextLoc:x},this.method==="next"&&(this.arg=e),C}},t})(r.exports);try{regeneratorRuntime=n}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},je={};function te(r){var n=je[r];if(n!==void 0)return n.exports;var t=je[r]={exports:{}};return mt[r](t,t.exports,te),t.exports}te.n=r=>{var n=r&&r.__esModule?()=>r.default:()=>r;return te.d(n,{a:n}),n},te.d=(r,n)=>{for(var t in n)te.o(n,t)&&!te.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:n[t]})},te.o=(r,n)=>Object.prototype.hasOwnProperty.call(r,n);var Xe={};function Ne(r,n){(n==null||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t<n;t++)e[t]=r[t];return e}function Ye(r,n){if(r){if(typeof r=="string")return Ne(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ne(r,n):void 0}}function de(r){return(function(n){if(Array.isArray(n))return Ne(n)})(r)||(function(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)})(r)||Ye(r)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function ue(r,n,t){return n in r?Object.defineProperty(r,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[n]=t,r}te.d(Xe,{A:()=>Nt});const P=(Pe={Fragment:()=>pt,computed:()=>ht,createTextVNode:()=>ft,createVNode:()=>dt,defineComponent:()=>ut,nextTick:()=>ct,reactive:()=>lt,ref:()=>st,watch:()=>at,watchEffect:()=>ot},ge={},te.d(ge,Pe),ge),gt=(0,P.defineComponent)({props:{data:{required:!0,type:String},onClick:Function},render:function(){var r=this.data,n=this.onClick;return(0,P.createVNode)("span",{class:"vjs-tree-brackets",onClick:n},[r])}}),bt=(0,P.defineComponent)({emits:["change","update:modelValue"],props:{checked:{type:Boolean,default:!1},isMultiple:Boolean,onChange:Function},setup:function(r,n){var t=n.emit;return{uiType:(0,P.computed)((function(){return r.isMultiple?"checkbox":"radio"})),model:(0,P.computed)({get:function(){return r.checked},set:function(e){return t("update:modelValue",e)}})}},render:function(){var r=this.uiType,n=this.model,t=this.$emit;return(0,P.createVNode)("label",{class:["vjs-check-controller",n?"is-checked":""],onClick:function(e){return e.stopPropagation()}},[(0,P.createVNode)("span",{class:"vjs-check-controller-inner is-".concat(r)},null),(0,P.createVNode)("input",{checked:n,class:"vjs-check-controller-original is-".concat(r),type:r,onChange:function(){return t("change",n)}},null)])}}),vt=(0,P.defineComponent)({props:{nodeType:{required:!0,type:String},onClick:Function},render:function(){var r=this.nodeType,n=this.onClick,t=r==="objectStart"||r==="arrayStart";return t||r==="objectCollapsed"||r==="arrayCollapsed"?(0,P.createVNode)("span",{class:"vjs-carets vjs-carets-".concat(t?"open":"close"),onClick:n},[(0,P.createVNode)("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},[(0,P.createVNode)("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"},null)])]):null}});var Pe,ge;function xe(r){return xe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},xe(r)}function Qe(r){return Object.prototype.toString.call(r).slice(8,-1).toLowerCase()}function oe(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"root",t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,e=(arguments.length>3?arguments[3]:void 0)||{},i=e.key,c=e.index,a=e.type,s=a===void 0?"content":a,p=e.showComma,h=p!==void 0&&p,v=e.length,j=v===void 0?1:v,H=Qe(r);if(H==="array"){var u=Ie(r.map((function(g,C,E){return oe(g,"".concat(n,"[").concat(C,"]"),t+1,{index:C,showComma:C!==E.length-1,length:j,type:s})})));return[oe("[",n,t,{showComma:!1,key:i,length:r.length,type:"arrayStart"})[0]].concat(u,oe("]",n,t,{showComma:h,length:r.length,type:"arrayEnd"})[0])}if(H==="object"){var m=Object.keys(r),N=Ie(m.map((function(g,C,E){return oe(r[g],/^[a-zA-Z_]\w*$/.test(g)?"".concat(n,".").concat(g):"".concat(n,'["').concat(g,'"]'),t+1,{key:g,showComma:C!==E.length-1,length:j,type:s})})));return[oe("{",n,t,{showComma:!1,key:i,index:c,length:m.length,type:"objectStart"})[0]].concat(N,oe("}",n,t,{showComma:h,length:m.length,type:"objectEnd"})[0])}return[{content:r,level:t,key:i,index:c,path:n,showComma:h,length:j,type:s}]}function Ie(r){if(typeof Array.prototype.flat=="function")return r.flat();for(var n=de(r),t=[];n.length;){var e=n.shift();Array.isArray(e)?n.unshift.apply(n,de(e)):t.push(e)}return t}function Ce(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:new WeakMap;if(r==null)return r;if(r instanceof Date)return new Date(r);if(r instanceof RegExp)return new RegExp(r);if(xe(r)!=="object")return r;if(n.get(r))return n.get(r);if(Array.isArray(r)){var t=r.map((function(c){return Ce(c,n)}));return n.set(r,t),t}var e={};for(var i in r)e[i]=Ce(r[i],n);return n.set(r,e),e}function Fe(r,n,t,e,i,c,a){try{var s=r[c](a),p=s.value}catch(h){return void t(h)}s.done?n(p):Promise.resolve(p).then(e,i)}var yt=te(207),Ae=te.n(yt);function De(r,n){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(r);n&&(e=e.filter((function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),t.push.apply(t,e)}return t}function He(r){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?De(Object(t),!0).forEach((function(e){ue(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):De(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}var Je={data:{type:[String,Number,Boolean,Array,Object],default:null},rootPath:{type:String,default:"root"},indent:{type:Number,default:2},showLength:{type:Boolean,default:!1},showDoubleQuotes:{type:Boolean,default:!0},renderNodeKey:Function,renderNodeValue:Function,renderNodeActions:{type:[Boolean,Function],default:void 0},selectableType:String,showSelectController:{type:Boolean,default:!1},showLine:{type:Boolean,default:!0},showLineNumber:{type:Boolean,default:!1},selectOnClickNode:{type:Boolean,default:!0},nodeSelectable:{type:Function,default:function(){return!0}},highlightSelectedNode:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!1},theme:{type:String,default:"light"},showKeyValueSpace:{type:Boolean,default:!0},editable:{type:Boolean,default:!1},editableTrigger:{type:String,default:"click"},onNodeClick:{type:Function},onNodeMouseover:{type:Function},onBracketsClick:{type:Function},onIconClick:{type:Function},onValueChange:{type:Function}};const wt=(0,P.defineComponent)({name:"TreeNode",props:He(He({},Je),{},{node:{type:Object,required:!0},collapsed:Boolean,checked:Boolean,style:Object,onSelectedChange:{type:Function}}),emits:["nodeClick","nodeMouseover","bracketsClick","iconClick","selectedChange","valueChange"],setup:function(r,n){var t=n.emit,e=(0,P.computed)((function(){return Qe(r.node.content)})),i=(0,P.computed)((function(){return"vjs-value vjs-value-".concat(e.value)})),c=(0,P.computed)((function(){return r.showDoubleQuotes?'"'.concat(r.node.key,'"'):r.node.key})),a=(0,P.computed)((function(){return r.selectableType==="multiple"})),s=(0,P.computed)((function(){return r.selectableType==="single"})),p=(0,P.computed)((function(){return r.nodeSelectable(r.node)&&(a.value||s.value)})),h=(0,P.reactive)({editing:!1}),v=function(I){var B,o,b=(o=(B=I.target)===null||B===void 0?void 0:B.value)==="null"?null:o==="undefined"?void 0:o==="true"||o!=="false"&&(o[0]+o[o.length-1]==='""'||o[0]+o[o.length-1]==="''"?o.slice(1,-1):typeof Number(o)=="number"&&!isNaN(Number(o))||o==="NaN"?Number(o):o);t("valueChange",b,r.node.path)},j=(0,P.computed)((function(){var I,B=(I=r.node)===null||I===void 0?void 0:I.content;return B===null?B="null":B===void 0&&(B="undefined"),e.value==="string"?'"'.concat(B,'"'):B+""})),H=function(){var I=r.renderNodeValue;return I?I({node:r.node,defaultValue:j.value}):j.value},u=function(){t("bracketsClick",!r.collapsed,r.node)},m=function(){t("iconClick",!r.collapsed,r.node)},N=function(){t("selectedChange",r.node)},g=function(){t("nodeClick",r.node),p.value&&r.selectOnClickNode&&t("selectedChange",r.node)},C=function(){t("nodeMouseover",r.node)},E=function(I){if(r.editable&&!h.editing){h.editing=!0;var B=function o(b){var w;b.target!==I.target&&((w=b.target)===null||w===void 0?void 0:w.parentElement)!==I.target&&(h.editing=!1,document.removeEventListener("click",o))};document.removeEventListener("click",B),document.addEventListener("click",B)}},S=(function(){var I=(0,P.ref)(!1),B=(function(){var o,b=(o=Ae().mark((function w(F){return Ae().wrap((function(W){for(;;)switch(W.prev=W.next){case 0:return W.prev=0,W.next=3,navigator.clipboard.writeText(F);case 3:I.value=!0,setTimeout((function(){I.value=!1}),300),W.next=10;break;case 7:W.prev=7,W.t0=W.catch(0),console.error("[vue-json-pretty] Copy failed: ",W.t0);case 10:case"end":return W.stop()}}),w,null,[[0,7]])})),function(){var w=this,F=arguments;return new Promise((function(W,T){var L=o.apply(w,F);function k(d){Fe(L,W,T,k,R,"next",d)}function R(d){Fe(L,W,T,k,R,"throw",d)}k(void 0)}))});return function(w){return b.apply(this,arguments)}})();return{copy:B}})().copy,M=function(){var I=r.node,B=I.key,o=I.path,b=r.rootPath,w=new Function("data","return data".concat(o.slice(b.length)))(r.data),F=JSON.stringify(B?ue({},B,w):w,null,2);S(F)},A=function(){var I=r.renderNodeActions;if(!I)return null;var B={copy:M};return typeof I=="function"?I({node:r.node,defaultActions:B}):(0,P.createVNode)("span",{onClick:M,class:"vjs-tree-node-actions-item"},[(0,P.createTextVNode)("copy")])};return function(){var I,B=r.node;return(0,P.createVNode)("div",{class:{"vjs-tree-node":!0,"has-selector":r.showSelectController,"has-carets":r.showIcon,"is-highlight":r.highlightSelectedNode&&r.checked,dark:r.theme==="dark"},onClick:g,onMouseover:C,style:r.style},[r.showLineNumber&&(0,P.createVNode)("span",{class:"vjs-node-index"},[B.id+1]),r.showSelectController&&p.value&&B.type!=="objectEnd"&&B.type!=="arrayEnd"&&(0,P.createVNode)(bt,{isMultiple:a.value,checked:r.checked,onChange:N},null),(0,P.createVNode)("div",{class:"vjs-indent"},[Array.from(Array(B.level)).map((function(o,b){return(0,P.createVNode)("div",{key:b,class:{"vjs-indent-unit":!0,"has-line":r.showLine}},[Array.from(Array(r.indent)).map((function(){return(0,P.createVNode)(P.Fragment,null,[(0,P.createTextVNode)(" ")])}))])})),r.showIcon&&(0,P.createVNode)(vt,{nodeType:B.type,onClick:m},null)]),B.key&&(0,P.createVNode)("span",{class:"vjs-key"},[(I=r.renderNodeKey,I?I({node:r.node,defaultKey:c.value||""}):c.value),(0,P.createVNode)("span",{class:"vjs-colon"},[":".concat(r.showKeyValueSpace?" ":"")])]),(0,P.createVNode)("span",null,[B.type!=="content"&&B.content?(0,P.createVNode)(gt,{data:B.content.toString(),onClick:u},null):(0,P.createVNode)("span",{class:i.value,onClick:!r.editable||r.editableTrigger&&r.editableTrigger!=="click"?void 0:E,onDblclick:r.editable&&r.editableTrigger==="dblclick"?E:void 0},[r.editable&&h.editing?(0,P.createVNode)("input",{value:j.value,onChange:v,style:{padding:"3px 8px",border:"1px solid #eee",boxShadow:"none",boxSizing:"border-box",borderRadius:5,fontFamily:"inherit"}},null):H()]),B.showComma&&(0,P.createVNode)("span",null,[","]),r.showLength&&r.collapsed&&(0,P.createVNode)("span",{class:"vjs-comment"},[(0,P.createTextVNode)(" // "),B.length,(0,P.createTextVNode)(" items ")])]),r.renderNodeActions&&(0,P.createVNode)("span",{class:"vjs-tree-node-actions"},[A()])])}}});function Me(r,n){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(r);n&&(e=e.filter((function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),t.push.apply(t,e)}return t}function Z(r){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?Me(Object(t),!0).forEach((function(e){ue(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Me(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}const Nt=(0,P.defineComponent)({name:"Tree",props:Z(Z({},Je),{},{collapsedNodeLength:{type:Number,default:1/0},deep:{type:Number,default:1/0},pathCollapsible:{type:Function,default:function(){return!1}},virtual:{type:Boolean,default:!1},height:{type:Number,default:400},itemHeight:{type:Number,default:20},dynamicHeight:{type:Boolean,default:!0},selectedValue:{type:[String,Array],default:function(){return""}},collapsedOnClickBrackets:{type:Boolean,default:!0},style:Object,onSelectedChange:{type:Function},theme:{type:String,default:"light"}}),slots:["renderNodeKey","renderNodeValue","renderNodeActions"],emits:["nodeClick","nodeMouseover","bracketsClick","iconClick","selectedChange","update:selectedValue","update:data"],setup:function(r,n){var t=n.emit,e=n.slots,i=(0,P.ref)(),c=(0,P.computed)((function(){return oe(r.data,r.rootPath)})),a=function(T,L){return c.value.reduce((function(k,R){var d,f=R.level>=T||R.length>=L,x=(d=r.pathCollapsible)===null||d===void 0?void 0:d.call(r,R);return R.type!=="objectStart"&&R.type!=="arrayStart"||!f&&!x?k:Z(Z({},k),{},ue({},R.path,1))}),{})},s=(0,P.reactive)({translateY:0,visibleData:null,hiddenPaths:a(r.deep,r.collapsedNodeLength),startIndex:0,endIndex:0}),p=[],h=[],v=0,j={},H=function(T){p=Array(T).fill(0).map((function(){return r.itemHeight||20})),(h=new Array(T+1))[0]=0;for(var L=0;L<T;L++)h[L+1]=h[L]+p[L];v=h[T]||0},u=function(T){var L=p.length;T<0&&(T=0),T>L&&(T=L);for(var k=T;k<L;k++)h[k+1]=h[k]+p[k];v=h[L]||0},m=function(T,L){for(var k=0,R=T.length-1;k<R;){var d=k+R>>>1;T[d]<L?k=d+1:R=d}return k},N=(0,P.computed)((function(){for(var T=null,L=[],k=c.value.length,R=0;R<k;R++){var d=Z(Z({},c.value[R]),{},{id:R}),f=s.hiddenPaths[d.path];if(T&&T.path===d.path){var x=T.type==="objectStart",D=Z(Z(Z({},d),T),{},{showComma:d.showComma,content:x?"{...}":"[...]",type:x?"objectCollapsed":"arrayCollapsed"});T=null,L.push(D)}else{if(f&&!T){T=d;continue}if(T)continue;L.push(d)}}return L})),g=(0,P.computed)((function(){var T=r.selectedValue;return T&&r.selectableType==="multiple"&&Array.isArray(T)?T:[T]})),C=(0,P.computed)((function(){return!r.selectableType||r.selectOnClickNode||r.showSelectController?"":"When selectableType is not null, selectOnClickNode and showSelectController cannot be false at the same time, because this will cause the selection to fail."})),E=(0,P.computed)((function(){return r.dynamicHeight?v||0:N.value.length*r.itemHeight})),S=function T(){var L=N.value;if(L)if(r.virtual){var k,R=((k=i.value)===null||k===void 0?void 0:k.scrollTop)||0;if(r.dynamicHeight){p.length!==L.length&&H(L.length);var d=(function(G){var V=m(h,G+1e-4);return Math.max(0,Math.min(V-1,p.length-1))})(R),f=(function(G,V){var z=m(h,G+V);return Math.max(0,Math.min(z+1,p.length))})(R,r.height),x=Math.max(0,d-5),D=Math.min(L.length,f+5);s.startIndex=x,s.endIndex=D,s.translateY=h[x]||0,s.visibleData=L.slice(x,D),(0,P.nextTick)().then((function(){for(var G=!1,V=s.startIndex;V<s.endIndex;V++){var z=j[V];if(z){var $=z.offsetHeight;$&&p[V]!==$&&(p[V]=$,h[V+1]=h[V]+p[V],u(V+1),G=!0)}}G&&T()}))}else{var l=r.height/r.itemHeight,O=Math.floor(R/r.itemHeight),y=O<0?0:O+l>L.length?L.length-l:O;y<0&&(y=0);var _=y+l;s.translateY=y*r.itemHeight,s.startIndex=y,s.endIndex=_,s.visibleData=L.slice(y,_)}}else s.translateY=0,s.startIndex=0,s.endIndex=L.length,s.visibleData=L},M=null,A=function(){M&&cancelAnimationFrame(M),M=requestAnimationFrame((function(){S()}))},I=function(T){var L,k,R=T.path,d=r.selectableType;if(d==="multiple"){var f=g.value.findIndex((function(O){return O===R})),x=de(g.value);f!==-1?x.splice(f,1):x.push(R),t("update:selectedValue",x),t("selectedChange",x,de(g.value))}else if(d==="single"&&g.value[0]!==R){var D=(L=g.value,k=1,(function(O){if(Array.isArray(O))return O})(L)||(function(O,y){var _=O==null?null:typeof Symbol<"u"&&O[Symbol.iterator]||O["@@iterator"];if(_!=null){var G,V,z=[],$=!0,X=!1;try{for(_=_.call(O);!($=(G=_.next()).done)&&(z.push(G.value),!y||z.length!==y);$=!0);}catch(Y){X=!0,V=Y}finally{try{$||_.return==null||_.return()}finally{if(X)throw V}}return z}})(L,k)||Ye(L,k)||(function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})())[0],l=R;t("update:selectedValue",l),t("selectedChange",l,D)}},B=function(T){t("nodeClick",T)},o=function(T){t("nodeMouseover",T)},b=function(T,L){if(T)s.hiddenPaths=Z(Z({},s.hiddenPaths),{},ue({},L,1));else{var k=Z({},s.hiddenPaths);delete k[L],s.hiddenPaths=k}},w=function(T,L){r.collapsedOnClickBrackets&&b(T,L.path),t("bracketsClick",T,L)},F=function(T,L){b(T,L.path),t("iconClick",T,L)},W=function(T,L){var k=Ce(r.data),R=r.rootPath;new Function("data","val","data".concat(L.slice(R.length),"=val"))(k,T),t("update:data",k)};return(0,P.watchEffect)((function(){C.value&&(function(T){throw new Error("[VueJSONPretty] ".concat(T))})(C.value)})),(0,P.watchEffect)((function(){N.value&&(r.virtual&&r.dynamicHeight&&p.length!==N.value.length&&H(N.value.length),S())})),(0,P.watch)((function(){return[r.dynamicHeight,r.itemHeight,c.value.length]}),(function(){r.virtual&&r.dynamicHeight&&(H(N.value.length),(0,P.nextTick)(S))})),(0,P.watch)((function(){return r.deep}),(function(T){T&&(s.hiddenPaths=a(T,r.collapsedNodeLength))})),(0,P.watch)((function(){return r.collapsedNodeLength}),(function(T){T&&(s.hiddenPaths=a(r.deep,T))})),function(){var T,L,k,R,d,f=(T=r.renderNodeKey)!==null&&T!==void 0?T:e.renderNodeKey,x=(L=r.renderNodeValue)!==null&&L!==void 0?L:e.renderNodeValue,D=(k=(R=r.renderNodeActions)!==null&&R!==void 0?R:e.renderNodeActions)!==null&&k!==void 0&&k,l=(d=s.visibleData)===null||d===void 0?void 0:d.map((function(O,y){var _=s.startIndex+y;return(0,P.createVNode)("div",{key:O.id,ref:function(G){return(function(V,z){z?j[V]=z:delete j[V]})(_,G||null)}},[(0,P.createVNode)(wt,{data:r.data,rootPath:r.rootPath,indent:r.indent,node:O,collapsed:!!s.hiddenPaths[O.path],theme:r.theme,showDoubleQuotes:r.showDoubleQuotes,showLength:r.showLength,checked:g.value.includes(O.path),selectableType:r.selectableType,showLine:r.showLine,showLineNumber:r.showLineNumber,showSelectController:r.showSelectController,selectOnClickNode:r.selectOnClickNode,nodeSelectable:r.nodeSelectable,highlightSelectedNode:r.highlightSelectedNode,editable:r.editable,editableTrigger:r.editableTrigger,showIcon:r.showIcon,showKeyValueSpace:r.showKeyValueSpace,renderNodeKey:f,renderNodeValue:x,renderNodeActions:D,onNodeClick:B,onNodeMouseover:o,onBracketsClick:w,onIconClick:F,onSelectedChange:I,onValueChange:W,class:r.dynamicHeight?"dynamic-height":void 0,style:r.dynamicHeight?{}:r.itemHeight&&r.itemHeight!==20?{lineHeight:"".concat(r.itemHeight,"px")}:{}},null)])}));return(0,P.createVNode)("div",{ref:i,class:{"vjs-tree":!0,"is-virtual":r.virtual,dark:r.theme==="dark"},onScroll:r.virtual?A:void 0,style:r.showLineNumber?Z({paddingLeft:"".concat(12*Number(c.value.length.toString().length),"px")},r.style):r.style},[r.virtual?(0,P.createVNode)("div",{class:"vjs-tree-list",style:{height:"".concat(r.height,"px")}},[(0,P.createVNode)("div",{class:"vjs-tree-list-holder",style:{height:"".concat(E.value,"px")}},[(0,P.createVNode)("div",{class:"vjs-tree-list-holder-inner",style:{transform:"translateY(".concat(s.translateY,"px)")}},[l])])]):l])}}});var fn=Xe.A;class Te{diff(n,t,e={}){let i;typeof e=="function"?(i=e,e={}):"callback"in e&&(i=e.callback);const c=this.castInput(n,e),a=this.castInput(t,e),s=this.removeEmpty(this.tokenize(c,e)),p=this.removeEmpty(this.tokenize(a,e));return this.diffWithOptionsObj(s,p,e,i)}diffWithOptionsObj(n,t,e,i){var c;const a=E=>{if(E=this.postProcess(E,e),i){setTimeout(function(){i(E)},0);return}else return E},s=t.length,p=n.length;let h=1,v=s+p;e.maxEditLength!=null&&(v=Math.min(v,e.maxEditLength));const j=(c=e.timeout)!==null&&c!==void 0?c:1/0,H=Date.now()+j,u=[{oldPos:-1,lastComponent:void 0}];let m=this.extractCommon(u[0],t,n,0,e);if(u[0].oldPos+1>=p&&m+1>=s)return a(this.buildValues(u[0].lastComponent,t,n));let N=-1/0,g=1/0;const C=()=>{for(let E=Math.max(N,-h);E<=Math.min(g,h);E+=2){let S;const M=u[E-1],A=u[E+1];M&&(u[E-1]=void 0);let I=!1;if(A){const o=A.oldPos-E;I=A&&0<=o&&o<s}const B=M&&M.oldPos+1<p;if(!I&&!B){u[E]=void 0;continue}if(!B||I&&M.oldPos<A.oldPos?S=this.addToPath(A,!0,!1,0,e):S=this.addToPath(M,!1,!0,1,e),m=this.extractCommon(S,t,n,E,e),S.oldPos+1>=p&&m+1>=s)return a(this.buildValues(S.lastComponent,t,n))||!0;u[E]=S,S.oldPos+1>=p&&(g=Math.min(g,E-1)),m+1>=s&&(N=Math.max(N,E+1))}h++};if(i)(function E(){setTimeout(function(){if(h>v||Date.now()>H)return i(void 0);C()||E()},0)})();else for(;h<=v&&Date.now()<=H;){const E=C();if(E)return E}}addToPath(n,t,e,i,c){const a=n.lastComponent;return a&&!c.oneChangePerToken&&a.added===t&&a.removed===e?{oldPos:n.oldPos+i,lastComponent:{count:a.count+1,added:t,removed:e,previousComponent:a.previousComponent}}:{oldPos:n.oldPos+i,lastComponent:{count:1,added:t,removed:e,previousComponent:a}}}extractCommon(n,t,e,i,c){const a=t.length,s=e.length;let p=n.oldPos,h=p-i,v=0;for(;h+1<a&&p+1<s&&this.equals(e[p+1],t[h+1],c);)h++,p++,v++,c.oneChangePerToken&&(n.lastComponent={count:1,previousComponent:n.lastComponent,added:!1,removed:!1});return v&&!c.oneChangePerToken&&(n.lastComponent={count:v,previousComponent:n.lastComponent,added:!1,removed:!1}),n.oldPos=p,h}equals(n,t,e){return e.comparator?e.comparator(n,t):n===t||!!e.ignoreCase&&n.toLowerCase()===t.toLowerCase()}removeEmpty(n){const t=[];for(let e=0;e<n.length;e++)n[e]&&t.push(n[e]);return t}castInput(n,t){return n}tokenize(n,t){return Array.from(n)}join(n){return n.join("")}postProcess(n,t){return n}get useLongestToken(){return!1}buildValues(n,t,e){const i=[];let c;for(;n;)i.push(n),c=n.previousComponent,delete n.previousComponent,n=c;i.reverse();const a=i.length;let s=0,p=0,h=0;for(;s<a;s++){const v=i[s];if(v.removed)v.value=this.join(e.slice(h,h+v.count)),h+=v.count;else{if(!v.added&&this.useLongestToken){let j=t.slice(p,p+v.count);j=j.map(function(H,u){const m=e[h+u];return m.length>H.length?m:H}),v.value=this.join(j)}else v.value=this.join(t.slice(p,p+v.count));p+=v.count,v.added||(h+=v.count)}}return i}}class xt extends Te{}const Ct=new xt;function Tt(r,n,t){return Ct.diff(r,n,t)}const Ve="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class St extends Te{tokenize(n){const t=new RegExp(`(\\r?\\n)|[${Ve}]+|[^\\S\\n\\r]+|[^${Ve}]`,"ug");return n.match(t)||[]}}const Lt=new St;function Et(r,n,t){return Lt.diff(r,n,t)}class kt extends Te{constructor(){super(...arguments),this.tokenize=jt}equals(n,t,e){return e.ignoreWhitespace?((!e.newlineIsToken||!n.includes(`
|
|
2
4
|
`))&&(n=n.trim()),(!e.newlineIsToken||!t.includes(`
|
|
3
5
|
`))&&(t=t.trim())):e.ignoreNewlineAtEof&&!e.newlineIsToken&&(n.endsWith(`
|
|
4
6
|
`)&&(n=n.slice(0,-1)),t.endsWith(`
|
|
5
|
-
`)&&(t=t.slice(0,-1))),super.equals(n,t,e)}}const
|
|
6
|
-
`));const t=[],e=r.split(/(\n|\r\n)/);e[e.length-1]||e.pop();for(let i=0;i<e.length;i++){const c=e[i];i%2&&!n.newlineIsToken?t[t.length-1]+=c:t.push(c)}return t}const
|
|
7
|
-
`)?E.lines[S]=E.lines[S].slice(0,-1):(E.lines.splice(S+1,0,"\"),S++);return{oldFileName:r,newFileName:n,oldHeader:i,newHeader:c,hunks:H}}}function
|
|
7
|
+
`)&&(t=t.slice(0,-1))),super.equals(n,t,e)}}const Ot=new kt;function Be(r,n,t){return Ot.diff(r,n,t)}function jt(r,n){n.stripTrailingCr&&(r=r.replace(/\r\n/g,`
|
|
8
|
+
`));const t=[],e=r.split(/(\n|\r\n)/);e[e.length-1]||e.pop();for(let i=0;i<e.length;i++){const c=e[i];i%2&&!n.newlineIsToken?t[t.length-1]+=c:t.push(c)}return t}const Pt={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function It(r,n,t,e,i,c,a){let s;s={},typeof s.context>"u"&&(s.context=4);const p=s.context;if(s.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(s.callback){const{callback:v}=s;Be(t,e,Object.assign(Object.assign({},s),{callback:j=>{const H=h(j);v(H)}}))}else return h(Be(t,e,s));function h(v){if(!v)return;v.push({value:"",lines:[]});function j(E){return E.map(function(S){return" "+S})}const H=[];let u=0,m=0,N=[],g=1,C=1;for(let E=0;E<v.length;E++){const S=v[E],M=S.lines||Ft(S.value);if(S.lines=M,S.added||S.removed){if(!u){const A=v[E-1];u=g,m=C,A&&(N=p>0?j(A.lines.slice(-p)):[],u-=N.length,m-=N.length)}for(const A of M)N.push((S.added?"+":"-")+A);S.added?C+=M.length:g+=M.length}else{if(u)if(M.length<=p*2&&E<v.length-2)for(const A of j(M))N.push(A);else{const A=Math.min(M.length,p);for(const B of j(M.slice(0,A)))N.push(B);const I={oldStart:u,oldLines:g-u+A,newStart:m,newLines:C-m+A,lines:N};H.push(I),u=0,m=0,N=[]}g+=M.length,C+=M.length}}for(const E of H)for(let S=0;S<E.lines.length;S++)E.lines[S].endsWith(`
|
|
9
|
+
`)?E.lines[S]=E.lines[S].slice(0,-1):(E.lines.splice(S+1,0,"\"),S++);return{oldFileName:r,newFileName:n,oldHeader:i,newHeader:c,hunks:H}}}function Ze(r,n){if(n||(n=Pt),Array.isArray(r)){if(r.length>1&&!n.includeFileHeaders)throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return r.map(e=>Ze(e,n)).join(`
|
|
8
10
|
`)}const t=[];n.includeIndex&&r.oldFileName==r.newFileName&&t.push("Index: "+r.oldFileName),n.includeUnderline&&t.push("==================================================================="),n.includeFileHeaders&&(t.push("--- "+r.oldFileName+(typeof r.oldHeader>"u"?"":" "+r.oldHeader)),t.push("+++ "+r.newFileName+(typeof r.newHeader>"u"?"":" "+r.newHeader)));for(let e=0;e<r.hunks.length;e++){const i=r.hunks[e];i.oldLines===0&&(i.oldStart-=1),i.newLines===0&&(i.newStart-=1),t.push("@@ -"+i.oldStart+","+i.oldLines+" +"+i.newStart+","+i.newLines+" @@");for(const c of i.lines)t.push(c)}return t.join(`
|
|
9
11
|
`)+`
|
|
10
|
-
`}function
|
|
12
|
+
`}function hn(r,n,t,e,i,c,a){{const s=It(r,n,t,e,i,c);return s?Ze(s,void 0):void 0}}function Ft(r){const n=r.endsWith(`
|
|
11
13
|
`),t=r.split(`
|
|
12
14
|
`).map(e=>e+`
|
|
13
|
-
`);return n?t.pop():t.push(t.pop().slice(0,-1)),t}var K;(function(r){r.INSERT="insert",r.DELETE="delete",r.CONTEXT="context"})(K||(K={}));const
|
|
15
|
+
`);return n?t.pop():t.push(t.pop().slice(0,-1)),t}var K;(function(r){r.INSERT="insert",r.DELETE="delete",r.CONTEXT="context"})(K||(K={}));const At={LINE_BY_LINE:"line-by-line"},Dt={NONE:"none"},Ht={WORD:"word"};var ae;(function(r){r.AUTO="auto",r.DARK="dark",r.LIGHT="light"})(ae||(ae={}));const Mt=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],Vt=RegExp("["+Mt.join("\\")+"]","g");function Bt(r){return r.replace(Vt,"\\$&")}function Re(r){return r&&r.replace(/\\/g,"/")}function Rt(r){let n,t,e,i=0;for(n=0,e=r.length;n<e;n++)t=r.charCodeAt(n),i=(i<<5)-i+t,i|=0;return i}function et(r){const n=r.length;let t=-1/0;for(let e=0;e<n;e++)t=Math.max(t,r[e]);return t}function We(r,n){const t=r.split(".");return t.length>1?t[t.length-1]:n}function _e(r,n){return n.reduce((t,e)=>t||r.startsWith(e),!1)}const ze=["a/","b/","i/","w/","c/","o/"];function ie(r,n,t){const e=t!==void 0?[...ze,t]:ze,i=n?new RegExp(`^${Bt(n)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,c=""]=i.exec(r)||[],a=e.find(p=>c.indexOf(p)===0);return(a?c.slice(a.length):c).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function Wt(r,n){return ie(r,"---",n)}function _t(r,n){return ie(r,"+++",n)}function zt(r,n={}){const t=[];let e=null,i=null,c=null,a=null,s=null,p=null,h=null;const v="--- ",j="+++ ",H="@@",u=/^old mode (\d{6})/,m=/^new mode (\d{6})/,N=/^deleted file mode (\d{6})/,g=/^new file mode (\d{6})/,C=/^copy from "?(.+)"?/,E=/^copy to "?(.+)"?/,S=/^rename from "?(.+)"?/,M=/^rename to "?(.+)"?/,A=/^similarity index (\d+)%/,I=/^dissimilarity index (\d+)%/,B=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,o=/^Binary files (.*) and (.*) differ/,b=/^GIT binary patch/,w=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,F=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,W=/^new file mode (\d{6})/,T=/^deleted file mode (\d{6}),(\d{6})/,L=r.replace(/\/g,"").replace(/\r\n?/g,`
|
|
14
16
|
`).split(`
|
|
15
|
-
`);function k(){i!==null&&e!==null&&(e.blocks.push(i),i=null)}function R(){e!==null&&(!e.oldName&&p!==null&&(e.oldName=p),!e.newName&&h!==null&&(e.newName=h),e.newName&&(t.push(e),e=null)),p=null,h=null}function d(){k(),R(),e={blocks:[],deletedLines:0,addedLines:0}}function f(l){k();let O;e!==null&&((O=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(l))?(e.isCombined=!1,c=parseInt(O[1],10),s=parseInt(O[2],10)):(O=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(l))?(e.isCombined=!0,c=parseInt(O[1],10),a=parseInt(O[2],10),s=parseInt(O[3],10)):(l.startsWith(H)&&console.error("Failed to parse lines, starting in 0!"),c=0,s=0,e.isCombined=!1)),i={lines:[],oldStartLine:c,oldStartLine2:a,newStartLine:s,header:l}}function x(l){if(e===null||i===null||c===null||s===null)return;const O={content:l},y=e.isCombined?["+ "," +","++"]:["+"],_=e.isCombined?["- "," -","--"]:["-"];
|
|
16
|
-
`);return this.hoganUtils.render(
|
|
17
|
-
`);return this.hoganUtils.render(le,"wrapper",{colorScheme:Ee(this.config.colorScheme),content:t})}makeFileDiffHtml(n,t){if(this.config.renderNothingWhenEmpty&&Array.isArray(n.blocks)&&n.blocks.length===0)return"";const e=this.hoganUtils.template(
|
|
18
|
-
`)}applyLineGroupping(n){const t=[];let e=[],i=[];for(let c=0;c<n.lines.length;c++){const a=n.lines[c];(a.type!==K.INSERT&&i.length||a.type===K.CONTEXT&&e.length>0)&&(t.push([[],e,i]),e=[],i=[]),a.type===K.CONTEXT?t.push([[a],[],[]]):a.type===K.INSERT&&e.length===0?t.push([[],[],[a]]):a.type===K.INSERT&&e.length>0?i.push(a):a.type===K.DELETE&&e.push(a)}return(e.length||i.length)&&(t.push([[],e,i]),e=[],i=[]),t}applyRematchMatching(n,t,e){const i=n.length*t.length,c=
|
|
19
|
-
`);return this.hoganUtils.render(ce,"wrapper",{colorScheme:Ee(this.config.colorScheme),content:t})}makeFileDiffHtml(n,t){if(this.config.renderNothingWhenEmpty&&Array.isArray(n.blocks)&&n.blocks.length===0)return"";const e=this.hoganUtils.template(
|
|
17
|
+
`);function k(){i!==null&&e!==null&&(e.blocks.push(i),i=null)}function R(){e!==null&&(!e.oldName&&p!==null&&(e.oldName=p),!e.newName&&h!==null&&(e.newName=h),e.newName&&(t.push(e),e=null)),p=null,h=null}function d(){k(),R(),e={blocks:[],deletedLines:0,addedLines:0}}function f(l){k();let O;e!==null&&((O=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(l))?(e.isCombined=!1,c=parseInt(O[1],10),s=parseInt(O[2],10)):(O=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(l))?(e.isCombined=!0,c=parseInt(O[1],10),a=parseInt(O[2],10),s=parseInt(O[3],10)):(l.startsWith(H)&&console.error("Failed to parse lines, starting in 0!"),c=0,s=0,e.isCombined=!1)),i={lines:[],oldStartLine:c,oldStartLine2:a,newStartLine:s,header:l}}function x(l){if(e===null||i===null||c===null||s===null)return;const O={content:l},y=e.isCombined?["+ "," +","++"]:["+"],_=e.isCombined?["- "," -","--"]:["-"];_e(l,y)?(e.addedLines++,O.type=K.INSERT,O.oldNumber=void 0,O.newNumber=s++):_e(l,_)?(e.deletedLines++,O.type=K.DELETE,O.oldNumber=c++,O.newNumber=void 0):(O.type=K.CONTEXT,O.oldNumber=c++,O.newNumber=s++),i.lines.push(O)}function D(l,O){let y=O;for(;y<L.length-3;){if(l.startsWith("diff"))return!1;if(L[y].startsWith(v)&&L[y+1].startsWith(j)&&L[y+2].startsWith(H))return!0;y++}return!1}return L.forEach((l,O)=>{if(!l||l.startsWith("*"))return;let y;const _=L[O-1],G=L[O+1],V=L[O+2];if(l.startsWith("diff --git")||l.startsWith("diff --combined")){if(d(),(y=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(l))&&(p=ie(y[1],void 0,n.dstPrefix),h=ie(y[2],void 0,n.srcPrefix)),e===null)throw new Error("Where is my file !!!");e.isGitDiff=!0;return}if(l.startsWith("Binary files")&&!e?.isGitDiff){if(d(),(y=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(l))&&(p=ie(y[1],void 0,n.dstPrefix),h=ie(y[2],void 0,n.srcPrefix)),e===null)throw new Error("Where is my file !!!");e.isBinary=!0;return}if((!e||!e.isGitDiff&&e&&l.startsWith(v)&&G.startsWith(j)&&V.startsWith(H))&&d(),e?.isTooBig)return;if(e&&(typeof n.diffMaxChanges=="number"&&e.addedLines+e.deletedLines>n.diffMaxChanges||typeof n.diffMaxLineLength=="number"&&l.length>n.diffMaxLineLength)){e.isTooBig=!0,e.addedLines=0,e.deletedLines=0,e.blocks=[],i=null;const $=typeof n.diffTooBigMessage=="function"?n.diffTooBigMessage(t.length):"Diff too big to be displayed";f($);return}if(l.startsWith(v)&&G.startsWith(j)||l.startsWith(j)&&_.startsWith(v)){if(e&&!e.oldName&&l.startsWith("--- ")&&(y=Wt(l,n.srcPrefix))){e.oldName=y,e.language=We(e.oldName,e.language);return}if(e&&!e.newName&&l.startsWith("+++ ")&&(y=_t(l,n.dstPrefix))){e.newName=y,e.language=We(e.newName,e.language);return}}if(e&&(l.startsWith(H)||e.isGitDiff&&e.oldName&&e.newName&&!i)){f(l);return}if(i&&(l.startsWith("+")||l.startsWith("-")||l.startsWith(" "))){x(l);return}const z=!D(l,O);if(e===null)throw new Error("Where is my file !!!");(y=u.exec(l))?e.oldMode=y[1]:(y=m.exec(l))?e.newMode=y[1]:(y=N.exec(l))?(e.deletedFileMode=y[1],e.isDeleted=!0):(y=g.exec(l))?(e.newFileMode=y[1],e.isNew=!0):(y=C.exec(l))?(z&&(e.oldName=y[1]),e.isCopy=!0):(y=E.exec(l))?(z&&(e.newName=y[1]),e.isCopy=!0):(y=S.exec(l))?(z&&(e.oldName=y[1]),e.isRename=!0):(y=M.exec(l))?(z&&(e.newName=y[1]),e.isRename=!0):(y=o.exec(l))?(e.isBinary=!0,e.oldName=ie(y[1],void 0,n.srcPrefix),e.newName=ie(y[2],void 0,n.dstPrefix),f("Binary file")):b.test(l)?(e.isBinary=!0,f(l)):(y=A.exec(l))?e.unchangedPercentage=parseInt(y[1],10):(y=I.exec(l))?e.changedPercentage=parseInt(y[1],10):(y=B.exec(l))?(e.checksumBefore=y[1],e.checksumAfter=y[2],y[3]&&(e.mode=y[3])):(y=w.exec(l))?(e.checksumBefore=[y[2],y[3]],e.checksumAfter=y[1]):(y=F.exec(l))?(e.oldMode=[y[2],y[3]],e.newMode=y[1]):(y=W.exec(l))?(e.newFileMode=y[1],e.isNew=!0):(y=T.exec(l))&&(e.deletedFileMode=y[1],e.isDeleted=!0)}),k(),R(),t}function Gt(r,n){if(r.length===0)return n.length;if(n.length===0)return r.length;const t=[];let e;for(e=0;e<=n.length;e++)t[e]=[e];let i;for(i=0;i<=r.length;i++)t[0][i]=i;for(e=1;e<=n.length;e++)for(i=1;i<=r.length;i++)n.charAt(e-1)===r.charAt(i-1)?t[e][i]=t[e-1][i-1]:t[e][i]=Math.min(t[e-1][i-1]+1,Math.min(t[e][i-1]+1,t[e-1][i]+1));return t[n.length][r.length]}function Se(r){return(n,t)=>{const e=r(n).trim(),i=r(t).trim();return Gt(e,i)/(e.length+i.length)}}function Le(r){function n(e,i,c=new Map){let a=1/0,s;for(let p=0;p<e.length;++p)for(let h=0;h<i.length;++h){const v=JSON.stringify([e[p],i[h]]);let j;c.has(v)&&(j=c.get(v))||(j=r(e[p],i[h]),c.set(v,j)),j<a&&(a=j,s={indexA:p,indexB:h,score:a})}return s}function t(e,i,c=0,a=new Map){const s=n(e,i,a);if(!s||e.length+i.length<3)return[[e,i]];const p=e.slice(0,s.indexA),h=i.slice(0,s.indexB),v=[e[s.indexA]],j=[i[s.indexB]],H=s.indexA+1,u=s.indexB+1,m=e.slice(H),N=i.slice(u),g=t(p,h,c+1,a),C=t(v,j,c+1,a),E=t(m,N,c+1,a);let S=C;return(s.indexA>0||s.indexB>0)&&(S=g.concat(S)),(e.length>H||i.length>u)&&(S=S.concat(E)),S}return t}const Q={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},he={matching:Dt.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:Ht.WORD,colorScheme:ae.LIGHT},ne="/",tt=Se(r=>r.value),$t=Le(tt);function be(r){return r.indexOf("dev/null")!==-1}function Ut(r){return r.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,"")}function Kt(r){return r.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function fe(r){switch(r){case K.CONTEXT:return Q.CONTEXT;case K.INSERT:return Q.INSERTS;case K.DELETE:return Q.DELETES}}function Ee(r){switch(r){case ae.DARK:return"d2h-dark-color-scheme";case ae.AUTO:return"d2h-auto-color-scheme";case ae.LIGHT:default:return"d2h-light-color-scheme"}}function qt(r){return r?2:1}function se(r){return r.slice(0).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function re(r,n,t=!0){const e=qt(n);return{prefix:r.substring(0,e),content:t?se(r.substring(e)):r.substring(e)}}function pe(r){const n=Re(r.oldName),t=Re(r.newName);if(n!==t&&!be(n)&&!be(t)){const e=[],i=[],c=n.split(ne),a=t.split(ne),s=c.length,p=a.length;let h=0,v=s-1,j=p-1;for(;h<v&&h<j&&c[h]===a[h];)e.push(a[h]),h+=1;for(;v>h&&j>h&&c[v]===a[j];)i.unshift(a[j]),v-=1,j-=1;const H=e.join(ne),u=i.join(ne),m=c.slice(h,v+1).join(ne),N=a.slice(h,j+1).join(ne);return H.length&&u.length?H+ne+"{"+m+" → "+N+"}"+ne+u:H.length?H+ne+"{"+m+" → "+N+"}":u.length?"{"+m+" → "+N+"}"+ne+u:n+" → "+t}else return be(t)?n:t}function ke(r){return`d2h-${Rt(pe(r)).toString().slice(-6)}`}function Oe(r){let n="file-changed";return r.isRename||r.isCopy?n="file-renamed":r.isNew?n="file-added":r.isDeleted?n="file-deleted":r.newName!==r.oldName&&(n="file-renamed"),n}function nt(r,n,t,e={}){const{matching:i,maxLineLengthHighlight:c,matchWordsThreshold:a,diffStyle:s}=Object.assign(Object.assign({},he),e),p=re(r,t,!1),h=re(n,t,!1);if(p.content.length>c||h.content.length>c)return{oldLine:{prefix:p.prefix,content:se(p.content)},newLine:{prefix:h.prefix,content:se(h.content)}};const v=s==="char"?Tt(p.content,h.content):Et(p.content,h.content),j=[];if(s==="word"&&i==="words"){const u=v.filter(g=>g.removed),m=v.filter(g=>g.added);$t(m,u).forEach(g=>{g[0].length===1&&g[1].length===1&&tt(g[0][0],g[1][0])<a&&(j.push(g[0][0]),j.push(g[1][0]))})}const H=v.reduce((u,m)=>{const N=m.added?"ins":m.removed?"del":null,g=j.indexOf(m)>-1?' class="d2h-change"':"",C=se(m.value);return N!==null?`${u}<${N}${g}>${C}</${N}>`:`${u}${C}`},"");return{oldLine:{prefix:p.prefix,content:Ut(H)},newLine:{prefix:h.prefix,content:Kt(H)}}}const Ge="file-summary",Xt="icon",Yt={colorScheme:he.colorScheme};class Qt{constructor(n,t={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},Yt),t)}render(n){const t=n.map(e=>this.hoganUtils.render(Ge,"line",{fileHtmlId:ke(e),oldName:e.oldName,newName:e.newName,fileName:pe(e),deletedLines:"-"+e.deletedLines,addedLines:"+"+e.addedLines},{fileIcon:this.hoganUtils.template(Xt,Oe(e))})).join(`
|
|
18
|
+
`);return this.hoganUtils.render(Ge,"wrapper",{colorScheme:Ee(this.config.colorScheme),filesNumber:n.length,files:t})}}const rt=Object.assign(Object.assign({},he),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),le="generic",$e="line-by-line",Jt="icon",Zt="tag";class en{constructor(n,t={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},rt),t)}render(n){const t=n.map(e=>{let i;return e.blocks.length?i=this.generateFileHtml(e):i=this.generateEmptyDiff(),this.makeFileDiffHtml(e,i)}).join(`
|
|
19
|
+
`);return this.hoganUtils.render(le,"wrapper",{colorScheme:Ee(this.config.colorScheme),content:t})}makeFileDiffHtml(n,t){if(this.config.renderNothingWhenEmpty&&Array.isArray(n.blocks)&&n.blocks.length===0)return"";const e=this.hoganUtils.template($e,"file-diff"),i=this.hoganUtils.template(le,"file-path"),c=this.hoganUtils.template(Jt,"file"),a=this.hoganUtils.template(Zt,Oe(n));return e.render({file:n,fileHtmlId:ke(n),diffs:t,filePath:i.render({fileDiffName:pe(n)},{fileIcon:c,fileTag:a})})}generateEmptyDiff(){return this.hoganUtils.render(le,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:Q})}generateFileHtml(n){const t=Le(Se(e=>re(e.content,n.isCombined).content));return n.blocks.map(e=>{let i=this.hoganUtils.render(le,"block-header",{CSSLineClass:Q,blockHeader:n.isTooBig?e.header:se(e.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(e).forEach(([c,a,s])=>{if(a.length&&s.length&&!c.length)this.applyRematchMatching(a,s,t).map(([p,h])=>{const{left:v,right:j}=this.processChangedLines(n,n.isCombined,p,h);i+=v,i+=j});else if(c.length)c.forEach(p=>{const{prefix:h,content:v}=re(p.content,n.isCombined);i+=this.generateSingleLineHtml(n,{type:Q.CONTEXT,prefix:h,content:v,oldNumber:p.oldNumber,newNumber:p.newNumber})});else if(a.length||s.length){const{left:p,right:h}=this.processChangedLines(n,n.isCombined,a,s);i+=p,i+=h}else console.error("Unknown state reached while processing groups of lines",c,a,s)}),i}).join(`
|
|
20
|
+
`)}applyLineGroupping(n){const t=[];let e=[],i=[];for(let c=0;c<n.lines.length;c++){const a=n.lines[c];(a.type!==K.INSERT&&i.length||a.type===K.CONTEXT&&e.length>0)&&(t.push([[],e,i]),e=[],i=[]),a.type===K.CONTEXT?t.push([[a],[],[]]):a.type===K.INSERT&&e.length===0?t.push([[],[],[a]]):a.type===K.INSERT&&e.length>0?i.push(a):a.type===K.DELETE&&e.push(a)}return(e.length||i.length)&&(t.push([[],e,i]),e=[],i=[]),t}applyRematchMatching(n,t,e){const i=n.length*t.length,c=et(n.concat(t).map(s=>s.content.length));return i<this.config.matchingMaxComparisons&&c<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?e(n,t):[[n,t]]}processChangedLines(n,t,e,i){const c={right:"",left:""},a=Math.max(e.length,i.length);for(let s=0;s<a;s++){const p=e[s],h=i[s],v=p!==void 0&&h!==void 0?nt(p.content,h.content,t,this.config):void 0,j=p!==void 0&&p.oldNumber!==void 0?Object.assign(Object.assign({},v!==void 0?{prefix:v.oldLine.prefix,content:v.oldLine.content,type:Q.DELETE_CHANGES}:Object.assign(Object.assign({},re(p.content,t)),{type:fe(p.type)})),{oldNumber:p.oldNumber,newNumber:p.newNumber}):void 0,H=h!==void 0&&h.newNumber!==void 0?Object.assign(Object.assign({},v!==void 0?{prefix:v.newLine.prefix,content:v.newLine.content,type:Q.INSERT_CHANGES}:Object.assign(Object.assign({},re(h.content,t)),{type:fe(h.type)})),{oldNumber:h.oldNumber,newNumber:h.newNumber}):void 0,{left:u,right:m}=this.generateLineHtml(n,j,H);c.left+=u,c.right+=m}return c}generateLineHtml(n,t,e){return{left:this.generateSingleLineHtml(n,t),right:this.generateSingleLineHtml(n,e)}}generateSingleLineHtml(n,t){if(t===void 0)return"";const e=this.hoganUtils.render($e,"numbers",{oldNumber:t.oldNumber||"",newNumber:t.newNumber||""});return this.hoganUtils.render(le,"line",{type:t.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:t.prefix===" "?" ":t.prefix,content:t.content,lineNumber:e,line:t,file:n})}}const it=Object.assign(Object.assign({},he),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),ce="generic",tn="side-by-side",nn="icon",rn="tag";class on{constructor(n,t={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},it),t)}render(n){const t=n.map(e=>{let i;return e.blocks.length?i=this.generateFileHtml(e):i=this.generateEmptyDiff(),this.makeFileDiffHtml(e,i)}).join(`
|
|
21
|
+
`);return this.hoganUtils.render(ce,"wrapper",{colorScheme:Ee(this.config.colorScheme),content:t})}makeFileDiffHtml(n,t){if(this.config.renderNothingWhenEmpty&&Array.isArray(n.blocks)&&n.blocks.length===0)return"";const e=this.hoganUtils.template(tn,"file-diff"),i=this.hoganUtils.template(ce,"file-path"),c=this.hoganUtils.template(nn,"file"),a=this.hoganUtils.template(rn,Oe(n));return e.render({file:n,fileHtmlId:ke(n),diffs:t,filePath:i.render({fileDiffName:pe(n)},{fileIcon:c,fileTag:a})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(ce,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:Q})}}generateFileHtml(n){const t=Le(Se(e=>re(e.content,n.isCombined).content));return n.blocks.map(e=>{const i={left:this.makeHeaderHtml(e.header,n),right:this.makeHeaderHtml("")};return this.applyLineGroupping(e).forEach(([c,a,s])=>{if(a.length&&s.length&&!c.length)this.applyRematchMatching(a,s,t).map(([p,h])=>{const{left:v,right:j}=this.processChangedLines(n.isCombined,p,h);i.left+=v,i.right+=j});else if(c.length)c.forEach(p=>{const{prefix:h,content:v}=re(p.content,n.isCombined),{left:j,right:H}=this.generateLineHtml({type:Q.CONTEXT,prefix:h,content:v,number:p.oldNumber},{type:Q.CONTEXT,prefix:h,content:v,number:p.newNumber});i.left+=j,i.right+=H});else if(a.length||s.length){const{left:p,right:h}=this.processChangedLines(n.isCombined,a,s);i.left+=p,i.right+=h}else console.error("Unknown state reached while processing groups of lines",c,a,s)}),i}).reduce((e,i)=>({left:e.left+i.left,right:e.right+i.right}),{left:"",right:""})}applyLineGroupping(n){const t=[];let e=[],i=[];for(let c=0;c<n.lines.length;c++){const a=n.lines[c];(a.type!==K.INSERT&&i.length||a.type===K.CONTEXT&&e.length>0)&&(t.push([[],e,i]),e=[],i=[]),a.type===K.CONTEXT?t.push([[a],[],[]]):a.type===K.INSERT&&e.length===0?t.push([[],[],[a]]):a.type===K.INSERT&&e.length>0?i.push(a):a.type===K.DELETE&&e.push(a)}return(e.length||i.length)&&(t.push([[],e,i]),e=[],i=[]),t}applyRematchMatching(n,t,e){const i=n.length*t.length,c=et(n.concat(t).map(s=>s.content.length));return i<this.config.matchingMaxComparisons&&c<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?e(n,t):[[n,t]]}makeHeaderHtml(n,t){return this.hoganUtils.render(ce,"block-header",{CSSLineClass:Q,blockHeader:t?.isTooBig?n:se(n),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(n,t,e){const i={right:"",left:""},c=Math.max(t.length,e.length);for(let a=0;a<c;a++){const s=t[a],p=e[a],h=s!==void 0&&p!==void 0?nt(s.content,p.content,n,this.config):void 0,v=s!==void 0&&s.oldNumber!==void 0?Object.assign(Object.assign({},h!==void 0?{prefix:h.oldLine.prefix,content:h.oldLine.content,type:Q.DELETE_CHANGES}:Object.assign(Object.assign({},re(s.content,n)),{type:fe(s.type)})),{number:s.oldNumber}):void 0,j=p!==void 0&&p.newNumber!==void 0?Object.assign(Object.assign({},h!==void 0?{prefix:h.newLine.prefix,content:h.newLine.content,type:Q.INSERT_CHANGES}:Object.assign(Object.assign({},re(p.content,n)),{type:fe(p.type)})),{number:p.newNumber}):void 0,{left:H,right:u}=this.generateLineHtml(v,j);i.left+=H,i.right+=u}return i}generateLineHtml(n,t){return{left:this.generateSingleHtml(n),right:this.generateSingleHtml(t)}}generateSingleHtml(n){const t="d2h-code-side-linenumber",e="d2h-code-side-line";return this.hoganUtils.render(ce,"line",{type:n?.type||`${Q.CONTEXT} d2h-emptyplaceholder`,lineClass:n!==void 0?t:`${t} d2h-code-side-emptyplaceholder`,contentClass:n!==void 0?e:`${e} d2h-code-side-emptyplaceholder`,prefix:n?.prefix===" "?" ":n?.prefix,content:n?.content,lineNumber:n?.number})}}var ve={},Ue;function an(){return Ue||(Ue=1,(function(r){(function(n){var t=/\S/,e=/\"/g,i=/\n/g,c=/\r/g,a=/\\/g,s=/\u2028/,p=/\u2029/;n.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},n.scan=function(b,w){var F=b.length,W=0,T=1,L=2,k=W,R=null,d=null,f="",x=[],D=!1,l=0,O=0,y="{{",_="}}";function G(){f.length>0&&(x.push({tag:"_t",text:new String(f)}),f="")}function V(){for(var X=!0,Y=O;Y<x.length;Y++)if(X=n.tags[x[Y].tag]<n.tags._v||x[Y].tag=="_t"&&x[Y].text.match(t)===null,!X)return!1;return X}function z(X,Y){if(G(),X&&V())for(var J=O,ee;J<x.length;J++)x[J].text&&((ee=x[J+1])&&ee.tag==">"&&(ee.indent=x[J].text.toString()),x.splice(J,1));else Y||x.push({tag:`
|
|
20
22
|
`});D=!1,O=x.length}function $(X,Y){var J="="+_,ee=X.indexOf(J,Y),me=v(X.substring(X.indexOf("=",Y)+1,ee)).split(" ");return y=me[0],_=me[me.length-1],ee+J.length-1}for(w&&(w=w.split(" "),y=w[0],_=w[1]),l=0;l<F;l++)k==W?j(y,b,l)?(--l,G(),k=T):b.charAt(l)==`
|
|
21
23
|
`?z(D):f+=b.charAt(l):k==T?(l+=y.length-1,d=n.tags[b.charAt(l+1)],R=d?b.charAt(l+1):"_v",R=="="?(l=$(b,l),k=W):(d&&l++,k=L),D=l):j(_,b,l)?(x.push({tag:R,n:v(f),otag:y,ctag:_,i:R=="/"?D-y.length:l+_.length}),f="",l+=_.length-1,k=W,R=="{"&&(_=="}}"?l++:h(x[x.length-1]))):f+=b.charAt(l);return z(D,!0),x};function h(o){o.n.substr(o.n.length-1)==="}"&&(o.n=o.n.substring(0,o.n.length-1))}function v(o){return o.trim?o.trim():o.replace(/^\s*|\s*$/g,"")}function j(o,b,w){if(b.charAt(w)!=o.charAt(0))return!1;for(var F=1,W=o.length;F<W;F++)if(b.charAt(w+F)!=o.charAt(F))return!1;return!0}var H={_t:!0,"\n":!0,$:!0,"/":!0};function u(o,b,w,F){var W=[],T=null,L=null,k=null;for(L=w[w.length-1];o.length>0;){if(k=o.shift(),L&&L.tag=="<"&&!(k.tag in H))throw new Error("Illegal content in < super tag.");if(n.tags[k.tag]<=n.tags.$||m(k,F))w.push(k),k.nodes=u(o,k.tag,w,F);else if(k.tag=="/"){if(w.length===0)throw new Error("Closing tag without opener: /"+k.n);if(T=w.pop(),k.n!=T.n&&!N(k.n,T.n,F))throw new Error("Nesting error: "+T.n+" vs. "+k.n);return T.end=k.i,W}else k.tag==`
|
|
22
24
|
`&&(k.last=o.length==0||o[0].tag==`
|
|
23
|
-
`);W.push(k)}if(w.length>0)throw new Error("missing closing tag: "+w.pop().n);return W}function m(o,b){for(var w=0,F=b.length;w<F;w++)if(b[w].o==o.n)return o.tag="#",!0}function N(o,b,w){for(var F=0,W=w.length;F<W;F++)if(w[F].c==o&&w[F].o==b)return!0}function g(o){var b=[];for(var w in o)b.push('"'+S(w)+'": function(c,p,t,i) {'+o[w]+"}");return"{ "+b.join(",")+" }"}function C(o){var b=[];for(var w in o.partials)b.push('"'+S(w)+'":{name:"'+S(o.partials[w].name)+'", '+C(o.partials[w])+"}");return"partials: {"+b.join(",")+"}, subs: "+g(o.subs)}n.stringify=function(o,b,w){return"{code: function (c,p,i) { "+n.wrapMain(o.code)+" },"+C(o)+"}"};var E=0;n.generate=function(o,b,w){E=0;var F={code:"",subs:{},partials:{}};return n.walk(o,F),w.asString?this.stringify(F,b,w):this.makeTemplate(F,b,w)},n.wrapMain=function(o){return'var t=this;t.b(i=i||"");'+o+"return t.fl();"},n.template=n.Template,n.makeTemplate=function(o,b,w){var F=this.makePartials(o);return F.code=new Function("c","p","i",this.wrapMain(o.code)),new this.template(F,b,this,w)},n.makePartials=function(o){var b,w={subs:{},partials:o.partials,name:o.name};for(b in w.partials)w.partials[b]=this.makePartials(w.partials[b]);for(b in o.subs)w.subs[b]=new Function("c","p","t","i",o.subs[b]);return w};function S(o){return o.replace(a,"\\\\").replace(e,'\\"').replace(i,"\\n").replace(c,"\\r").replace(s,"\\u2028").replace(p,"\\u2029")}function M(o){return~o.indexOf(".")?"d":"f"}function A(o,b){var w="<"+(b.prefix||""),F=w+o.n+E++;return b.partials[F]={name:o.n,partials:{}},b.code+='t.b(t.rp("'+S(F)+'",c,p,"'+(o.indent||"")+'"));',F}n.codegen={"#":function(o,b){b.code+="if(t.s(t."+M(o.n)+'("'+S(o.n)+'",c,p,1),c,p,0,'+o.i+","+o.end+',"'+o.otag+" "+o.ctag+'")){t.rs(c,p,function(c,p,t){',n.walk(o.nodes,b),b.code+="});c.pop();}"},"^":function(o,b){b.code+="if(!t.s(t."+M(o.n)+'("'+S(o.n)+'",c,p,1),c,p,1,0,0,"")){',n.walk(o.nodes,b),b.code+="};"},">":A,"<":function(o,b){var w={partials:{},code:"",subs:{},inPartial:!0};n.walk(o.nodes,w);var F=b.partials[A(o,b)];F.subs=w.subs,F.partials=w.partials},$:function(o,b){var w={subs:{},code:"",partials:b.partials,prefix:o.n};n.walk(o.nodes,w),b.subs[o.n]=w.code,b.inPartial||(b.code+='t.sub("'+S(o.n)+'",c,p,i);')},"\n":function(o,b){b.code+=B('"\\n"'+(o.last?"":" + i"))},_v:function(o,b){b.code+="t.b(t.v(t."+M(o.n)+'("'+S(o.n)+'",c,p,0)));'},_t:function(o,b){b.code+=B('"'+S(o.text)+'"')},"{":I,"&":I};function I(o,b){b.code+="t.b(t.t(t."+M(o.n)+'("'+S(o.n)+'",c,p,0)));'}function B(o){return"t.b("+o+");"}n.walk=function(o,b){for(var w,F=0,W=o.length;F<W;F++)w=n.codegen[o[F].tag],w&&w(o[F],b);return b},n.parse=function(o,b,w){return w=w||{},u(o,"",[],w.sectionTags||[])},n.cache={},n.cacheKey=function(o,b){return[o,!!b.asString,!!b.disableLambda,b.delimiters,!!b.modelGet].join("||")},n.compile=function(o,b){b=b||{};var w=n.cacheKey(o,b),F=this.cache[w];if(F){var W=F.partials;for(var T in W)delete W[T].instance;return F}return F=this.generate(this.parse(this.scan(o,b.delimiters),o,b),o,b),this.cache[w]=F}})(r)})(
|
|
25
|
+
`);W.push(k)}if(w.length>0)throw new Error("missing closing tag: "+w.pop().n);return W}function m(o,b){for(var w=0,F=b.length;w<F;w++)if(b[w].o==o.n)return o.tag="#",!0}function N(o,b,w){for(var F=0,W=w.length;F<W;F++)if(w[F].c==o&&w[F].o==b)return!0}function g(o){var b=[];for(var w in o)b.push('"'+S(w)+'": function(c,p,t,i) {'+o[w]+"}");return"{ "+b.join(",")+" }"}function C(o){var b=[];for(var w in o.partials)b.push('"'+S(w)+'":{name:"'+S(o.partials[w].name)+'", '+C(o.partials[w])+"}");return"partials: {"+b.join(",")+"}, subs: "+g(o.subs)}n.stringify=function(o,b,w){return"{code: function (c,p,i) { "+n.wrapMain(o.code)+" },"+C(o)+"}"};var E=0;n.generate=function(o,b,w){E=0;var F={code:"",subs:{},partials:{}};return n.walk(o,F),w.asString?this.stringify(F,b,w):this.makeTemplate(F,b,w)},n.wrapMain=function(o){return'var t=this;t.b(i=i||"");'+o+"return t.fl();"},n.template=n.Template,n.makeTemplate=function(o,b,w){var F=this.makePartials(o);return F.code=new Function("c","p","i",this.wrapMain(o.code)),new this.template(F,b,this,w)},n.makePartials=function(o){var b,w={subs:{},partials:o.partials,name:o.name};for(b in w.partials)w.partials[b]=this.makePartials(w.partials[b]);for(b in o.subs)w.subs[b]=new Function("c","p","t","i",o.subs[b]);return w};function S(o){return o.replace(a,"\\\\").replace(e,'\\"').replace(i,"\\n").replace(c,"\\r").replace(s,"\\u2028").replace(p,"\\u2029")}function M(o){return~o.indexOf(".")?"d":"f"}function A(o,b){var w="<"+(b.prefix||""),F=w+o.n+E++;return b.partials[F]={name:o.n,partials:{}},b.code+='t.b(t.rp("'+S(F)+'",c,p,"'+(o.indent||"")+'"));',F}n.codegen={"#":function(o,b){b.code+="if(t.s(t."+M(o.n)+'("'+S(o.n)+'",c,p,1),c,p,0,'+o.i+","+o.end+',"'+o.otag+" "+o.ctag+'")){t.rs(c,p,function(c,p,t){',n.walk(o.nodes,b),b.code+="});c.pop();}"},"^":function(o,b){b.code+="if(!t.s(t."+M(o.n)+'("'+S(o.n)+'",c,p,1),c,p,1,0,0,"")){',n.walk(o.nodes,b),b.code+="};"},">":A,"<":function(o,b){var w={partials:{},code:"",subs:{},inPartial:!0};n.walk(o.nodes,w);var F=b.partials[A(o,b)];F.subs=w.subs,F.partials=w.partials},$:function(o,b){var w={subs:{},code:"",partials:b.partials,prefix:o.n};n.walk(o.nodes,w),b.subs[o.n]=w.code,b.inPartial||(b.code+='t.sub("'+S(o.n)+'",c,p,i);')},"\n":function(o,b){b.code+=B('"\\n"'+(o.last?"":" + i"))},_v:function(o,b){b.code+="t.b(t.v(t."+M(o.n)+'("'+S(o.n)+'",c,p,0)));'},_t:function(o,b){b.code+=B('"'+S(o.text)+'"')},"{":I,"&":I};function I(o,b){b.code+="t.b(t.t(t."+M(o.n)+'("'+S(o.n)+'",c,p,0)));'}function B(o){return"t.b("+o+");"}n.walk=function(o,b){for(var w,F=0,W=o.length;F<W;F++)w=n.codegen[o[F].tag],w&&w(o[F],b);return b},n.parse=function(o,b,w){return w=w||{},u(o,"",[],w.sectionTags||[])},n.cache={},n.cacheKey=function(o,b){return[o,!!b.asString,!!b.disableLambda,b.delimiters,!!b.modelGet].join("||")},n.compile=function(o,b){b=b||{};var w=n.cacheKey(o,b),F=this.cache[w];if(F){var W=F.partials;for(var T in W)delete W[T].instance;return F}return F=this.generate(this.parse(this.scan(o,b.delimiters),o,b),o,b),this.cache[w]=F}})(r)})(ve)),ve}var ye={},Ke;function sn(){return Ke||(Ke=1,(function(r){(function(n){n.Template=function(u,m,N,g){u=u||{},this.r=u.code||this.r,this.c=N,this.options=g||{},this.text=m||"",this.partials=u.partials||{},this.subs=u.subs||{},this.buf=""},n.Template.prototype={r:function(u,m,N){return""},v:j,t:v,render:function(m,N,g){return this.ri([m],N||{},g)},ri:function(u,m,N){return this.r(u,m,N)},ep:function(u,m){var N=this.partials[u],g=m[N.name];if(N.instance&&N.base==g)return N.instance;if(typeof g=="string"){if(!this.c)throw new Error("No compiler available.");g=this.c.compile(g,this.options)}if(!g)return null;if(this.partials[u].base=g,N.subs){m.stackText||(m.stackText={});for(key in N.subs)m.stackText[key]||(m.stackText[key]=this.activeSub!==void 0&&m.stackText[this.activeSub]?m.stackText[this.activeSub]:this.text);g=e(g,N.subs,N.partials,this.stackSubs,this.stackPartials,m.stackText)}return this.partials[u].instance=g,g},rp:function(u,m,N,g){var C=this.ep(u,N);return C?C.ri(m,N,g):""},rs:function(u,m,N){var g=u[u.length-1];if(!H(g)){N(u,m,this);return}for(var C=0;C<g.length;C++)u.push(g[C]),N(u,m,this),u.pop()},s:function(u,m,N,g,C,E,S){var M;return H(u)&&u.length===0?!1:(typeof u=="function"&&(u=this.ms(u,m,N,g,C,E,S)),M=!!u,!g&&M&&m&&m.push(typeof u=="object"?u:m[m.length-1]),M)},d:function(u,m,N,g){var C,E=u.split("."),S=this.f(E[0],m,N,g),M=this.options.modelGet,A=null;if(u==="."&&H(m[m.length-2]))S=m[m.length-1];else for(var I=1;I<E.length;I++)C=t(E[I],S,M),C!==void 0?(A=S,S=C):S="";return g&&!S?!1:(!g&&typeof S=="function"&&(m.push(A),S=this.mv(S,m,N),m.pop()),S)},f:function(u,m,N,g){for(var C=!1,E=null,S=!1,M=this.options.modelGet,A=m.length-1;A>=0;A--)if(E=m[A],C=t(u,E,M),C!==void 0){S=!0;break}return S?(!g&&typeof C=="function"&&(C=this.mv(C,m,N)),C):g?!1:""},ls:function(u,m,N,g,C,E){var S=this.options.delimiters;return this.options.delimiters=E,this.b(this.ct(v(u.call(m,C,N)),m,g)),this.options.delimiters=S,!1},ct:function(u,m,N){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(u,this.options).render(m,N)},b:function(u){this.buf+=u},fl:function(){var u=this.buf;return this.buf="",u},ms:function(u,m,N,g,C,E,S){var M,A=m[m.length-1],I=u.call(A);return typeof I=="function"?g?!0:(M=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(I,A,m,N,M.substring(C,E),S)):I},mv:function(u,m,N){var g=m[m.length-1],C=u.call(g);return typeof C=="function"?this.ct(v(C.call(g)),g,N):C},sub:function(u,m,N,g){var C=this.subs[u];C&&(this.activeSub=u,C(m,N,this,g),this.activeSub=!1)}};function t(u,m,N){var g;return m&&typeof m=="object"&&(m[u]!==void 0?g=m[u]:N&&m.get&&typeof m.get=="function"&&(g=m.get(u))),g}function e(u,m,N,g,C,E){function S(){}S.prototype=u;function M(){}M.prototype=u.subs;var A,I=new S;I.subs=new M,I.subsText={},I.buf="",g=g||{},I.stackSubs=g,I.subsText=E;for(A in m)g[A]||(g[A]=m[A]);for(A in g)I.subs[A]=g[A];C=C||{},I.stackPartials=C;for(A in N)C[A]||(C[A]=N[A]);for(A in C)I.partials[A]=C[A];return I}var i=/&/g,c=/</g,a=/>/g,s=/\'/g,p=/\"/g,h=/[&<>\"\']/;function v(u){return String(u??"")}function j(u){return u=v(u),h.test(u)?u.replace(i,"&").replace(c,"<").replace(a,">").replace(s,"'").replace(p,"""):u}var H=Array.isArray||function(u){return Object.prototype.toString.call(u)==="[object Array]"}})(r)})(ye)),ye}var we,qe;function ln(){if(qe)return we;qe=1;var r=an();return r.Template=sn().Template,r.template=r.Template,we=r,we}var U=ln();const q={};q["file-summary-line"]=new U.Template({code:function(r,n,t){var e=this;return e.b(t=t||""),e.b('<li class="d2h-file-list-line">'),e.b(`
|
|
24
26
|
`+t),e.b(' <span class="d2h-file-name-wrapper">'),e.b(`
|
|
25
27
|
`+t),e.b(e.rp("<fileIcon0",r,n," ")),e.b(' <a href="#'),e.b(e.v(e.f("fileHtmlId",r,n,0))),e.b('" class="d2h-file-name">'),e.b(e.v(e.f("fileName",r,n,0))),e.b("</a>"),e.b(`
|
|
26
28
|
`+t),e.b(' <span class="d2h-file-stats">'),e.b(`
|
|
@@ -120,6 +122,4 @@ import{w as ot,a as at,r as st,b as lt,n as ct,d as ut,c as dt,e as ft,f as ht,F
|
|
|
120
122
|
`+t),e.b(" </div>"),e.b(`
|
|
121
123
|
`+t),e.b(" </div>"),e.b(`
|
|
122
124
|
`+t),e.b(" </div>"),e.b(`
|
|
123
|
-
`+t),e.b("</div>"),e.fl()},partials:{},subs:{}});q["tag-file-added"]=new U.Template({code:function(r,n,t){var e=this;return e.b(t=t||""),e.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),e.fl()},partials:{},subs:{}});q["tag-file-changed"]=new U.Template({code:function(r,n,t){var e=this;return e.b(t=t||""),e.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),e.fl()},partials:{},subs:{}});q["tag-file-deleted"]=new U.Template({code:function(r,n,t){var e=this;return e.b(t=t||""),e.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),e.fl()},partials:{},subs:{}});q["tag-file-renamed"]=new U.Template({code:function(r,n,t){var e=this;return e.b(t=t||""),e.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),e.fl()},partials:{},subs:{}});class
|
|
124
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function ue(r,n,t){return n in r?Object.defineProperty(r,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[n]=t,r}te.d(tt,{A:()=>un});const P=(_e={Fragment:()=>pt,computed:()=>ht,createTextVNode:()=>ft,createVNode:()=>dt,defineComponent:()=>ut,nextTick:()=>ct,reactive:()=>lt,ref:()=>st,watch:()=>at,watchEffect:()=>ot},we={},te.d(we,_e),we),on=(0,P.defineComponent)({props:{data:{required:!0,type:String},onClick:Function},render:function(){var r=this.data,n=this.onClick;return(0,P.createVNode)("span",{class:"vjs-tree-brackets",onClick:n},[r])}}),an=(0,P.defineComponent)({emits:["change","update:modelValue"],props:{checked:{type:Boolean,default:!1},isMultiple:Boolean,onChange:Function},setup:function(r,n){var t=n.emit;return{uiType:(0,P.computed)((function(){return r.isMultiple?"checkbox":"radio"})),model:(0,P.computed)({get:function(){return r.checked},set:function(e){return t("update:modelValue",e)}})}},render:function(){var r=this.uiType,n=this.model,t=this.$emit;return(0,P.createVNode)("label",{class:["vjs-check-controller",n?"is-checked":""],onClick:function(e){return e.stopPropagation()}},[(0,P.createVNode)("span",{class:"vjs-check-controller-inner is-".concat(r)},null),(0,P.createVNode)("input",{checked:n,class:"vjs-check-controller-original is-".concat(r),type:r,onChange:function(){return t("change",n)}},null)])}}),sn=(0,P.defineComponent)({props:{nodeType:{required:!0,type:String},onClick:Function},render:function(){var r=this.nodeType,n=this.onClick,t=r==="objectStart"||r==="arrayStart";return t||r==="objectCollapsed"||r==="arrayCollapsed"?(0,P.createVNode)("span",{class:"vjs-carets vjs-carets-".concat(t?"open":"close"),onClick:n},[(0,P.createVNode)("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},[(0,P.createVNode)("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"},null)])]):null}});var _e,we;function xe(r){return xe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},xe(r)}function rt(r){return Object.prototype.toString.call(r).slice(8,-1).toLowerCase()}function oe(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"root",t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,e=(arguments.length>3?arguments[3]:void 0)||{},i=e.key,c=e.index,a=e.type,s=a===void 0?"content":a,p=e.showComma,h=p!==void 0&&p,v=e.length,j=v===void 0?1:v,H=rt(r);if(H==="array"){var u=ze(r.map((function(g,C,E){return oe(g,"".concat(n,"[").concat(C,"]"),t+1,{index:C,showComma:C!==E.length-1,length:j,type:s})})));return[oe("[",n,t,{showComma:!1,key:i,length:r.length,type:"arrayStart"})[0]].concat(u,oe("]",n,t,{showComma:h,length:r.length,type:"arrayEnd"})[0])}if(H==="object"){var m=Object.keys(r),N=ze(m.map((function(g,C,E){return oe(r[g],/^[a-zA-Z_]\w*$/.test(g)?"".concat(n,".").concat(g):"".concat(n,'["').concat(g,'"]'),t+1,{key:g,showComma:C!==E.length-1,length:j,type:s})})));return[oe("{",n,t,{showComma:!1,key:i,index:c,length:m.length,type:"objectStart"})[0]].concat(N,oe("}",n,t,{showComma:h,length:m.length,type:"objectEnd"})[0])}return[{content:r,level:t,key:i,index:c,path:n,showComma:h,length:j,type:s}]}function ze(r){if(typeof Array.prototype.flat=="function")return r.flat();for(var n=fe(r),t=[];n.length;){var e=n.shift();Array.isArray(e)?n.unshift.apply(n,fe(e)):t.push(e)}return t}function Ce(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:new WeakMap;if(r==null)return r;if(r instanceof Date)return new Date(r);if(r instanceof RegExp)return new RegExp(r);if(xe(r)!=="object")return r;if(n.get(r))return n.get(r);if(Array.isArray(r)){var t=r.map((function(c){return Ce(c,n)}));return n.set(r,t),t}var e={};for(var i in r)e[i]=Ce(r[i],n);return n.set(r,e),e}function Ge(r,n,t,e,i,c,a){try{var s=r[c](a),p=s.value}catch(h){return void t(h)}s.done?n(p):Promise.resolve(p).then(e,i)}var ln=te(207),$e=te.n(ln);function Ue(r,n){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(r);n&&(e=e.filter((function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),t.push.apply(t,e)}return t}function Ke(r){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?Ue(Object(t),!0).forEach((function(e){ue(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ue(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}var it={data:{type:[String,Number,Boolean,Array,Object],default:null},rootPath:{type:String,default:"root"},indent:{type:Number,default:2},showLength:{type:Boolean,default:!1},showDoubleQuotes:{type:Boolean,default:!0},renderNodeKey:Function,renderNodeValue:Function,renderNodeActions:{type:[Boolean,Function],default:void 0},selectableType:String,showSelectController:{type:Boolean,default:!1},showLine:{type:Boolean,default:!0},showLineNumber:{type:Boolean,default:!1},selectOnClickNode:{type:Boolean,default:!0},nodeSelectable:{type:Function,default:function(){return!0}},highlightSelectedNode:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!1},theme:{type:String,default:"light"},showKeyValueSpace:{type:Boolean,default:!0},editable:{type:Boolean,default:!1},editableTrigger:{type:String,default:"click"},onNodeClick:{type:Function},onNodeMouseover:{type:Function},onBracketsClick:{type:Function},onIconClick:{type:Function},onValueChange:{type:Function}};const cn=(0,P.defineComponent)({name:"TreeNode",props:Ke(Ke({},it),{},{node:{type:Object,required:!0},collapsed:Boolean,checked:Boolean,style:Object,onSelectedChange:{type:Function}}),emits:["nodeClick","nodeMouseover","bracketsClick","iconClick","selectedChange","valueChange"],setup:function(r,n){var t=n.emit,e=(0,P.computed)((function(){return rt(r.node.content)})),i=(0,P.computed)((function(){return"vjs-value vjs-value-".concat(e.value)})),c=(0,P.computed)((function(){return r.showDoubleQuotes?'"'.concat(r.node.key,'"'):r.node.key})),a=(0,P.computed)((function(){return r.selectableType==="multiple"})),s=(0,P.computed)((function(){return r.selectableType==="single"})),p=(0,P.computed)((function(){return r.nodeSelectable(r.node)&&(a.value||s.value)})),h=(0,P.reactive)({editing:!1}),v=function(I){var B,o,b=(o=(B=I.target)===null||B===void 0?void 0:B.value)==="null"?null:o==="undefined"?void 0:o==="true"||o!=="false"&&(o[0]+o[o.length-1]==='""'||o[0]+o[o.length-1]==="''"?o.slice(1,-1):typeof Number(o)=="number"&&!isNaN(Number(o))||o==="NaN"?Number(o):o);t("valueChange",b,r.node.path)},j=(0,P.computed)((function(){var I,B=(I=r.node)===null||I===void 0?void 0:I.content;return B===null?B="null":B===void 0&&(B="undefined"),e.value==="string"?'"'.concat(B,'"'):B+""})),H=function(){var I=r.renderNodeValue;return I?I({node:r.node,defaultValue:j.value}):j.value},u=function(){t("bracketsClick",!r.collapsed,r.node)},m=function(){t("iconClick",!r.collapsed,r.node)},N=function(){t("selectedChange",r.node)},g=function(){t("nodeClick",r.node),p.value&&r.selectOnClickNode&&t("selectedChange",r.node)},C=function(){t("nodeMouseover",r.node)},E=function(I){if(r.editable&&!h.editing){h.editing=!0;var B=function o(b){var w;b.target!==I.target&&((w=b.target)===null||w===void 0?void 0:w.parentElement)!==I.target&&(h.editing=!1,document.removeEventListener("click",o))};document.removeEventListener("click",B),document.addEventListener("click",B)}},S=(function(){var I=(0,P.ref)(!1),B=(function(){var o,b=(o=$e().mark((function w(F){return $e().wrap((function(W){for(;;)switch(W.prev=W.next){case 0:return W.prev=0,W.next=3,navigator.clipboard.writeText(F);case 3:I.value=!0,setTimeout((function(){I.value=!1}),300),W.next=10;break;case 7:W.prev=7,W.t0=W.catch(0),console.error("[vue-json-pretty] Copy failed: ",W.t0);case 10:case"end":return W.stop()}}),w,null,[[0,7]])})),function(){var w=this,F=arguments;return new Promise((function(W,T){var L=o.apply(w,F);function k(d){Ge(L,W,T,k,R,"next",d)}function R(d){Ge(L,W,T,k,R,"throw",d)}k(void 0)}))});return function(w){return b.apply(this,arguments)}})();return{copy:B}})().copy,M=function(){var I=r.node,B=I.key,o=I.path,b=r.rootPath,w=new Function("data","return data".concat(o.slice(b.length)))(r.data),F=JSON.stringify(B?ue({},B,w):w,null,2);S(F)},A=function(){var I=r.renderNodeActions;if(!I)return null;var B={copy:M};return typeof I=="function"?I({node:r.node,defaultActions:B}):(0,P.createVNode)("span",{onClick:M,class:"vjs-tree-node-actions-item"},[(0,P.createTextVNode)("copy")])};return function(){var I,B=r.node;return(0,P.createVNode)("div",{class:{"vjs-tree-node":!0,"has-selector":r.showSelectController,"has-carets":r.showIcon,"is-highlight":r.highlightSelectedNode&&r.checked,dark:r.theme==="dark"},onClick:g,onMouseover:C,style:r.style},[r.showLineNumber&&(0,P.createVNode)("span",{class:"vjs-node-index"},[B.id+1]),r.showSelectController&&p.value&&B.type!=="objectEnd"&&B.type!=="arrayEnd"&&(0,P.createVNode)(an,{isMultiple:a.value,checked:r.checked,onChange:N},null),(0,P.createVNode)("div",{class:"vjs-indent"},[Array.from(Array(B.level)).map((function(o,b){return(0,P.createVNode)("div",{key:b,class:{"vjs-indent-unit":!0,"has-line":r.showLine}},[Array.from(Array(r.indent)).map((function(){return(0,P.createVNode)(P.Fragment,null,[(0,P.createTextVNode)(" ")])}))])})),r.showIcon&&(0,P.createVNode)(sn,{nodeType:B.type,onClick:m},null)]),B.key&&(0,P.createVNode)("span",{class:"vjs-key"},[(I=r.renderNodeKey,I?I({node:r.node,defaultKey:c.value||""}):c.value),(0,P.createVNode)("span",{class:"vjs-colon"},[":".concat(r.showKeyValueSpace?" ":"")])]),(0,P.createVNode)("span",null,[B.type!=="content"&&B.content?(0,P.createVNode)(on,{data:B.content.toString(),onClick:u},null):(0,P.createVNode)("span",{class:i.value,onClick:!r.editable||r.editableTrigger&&r.editableTrigger!=="click"?void 0:E,onDblclick:r.editable&&r.editableTrigger==="dblclick"?E:void 0},[r.editable&&h.editing?(0,P.createVNode)("input",{value:j.value,onChange:v,style:{padding:"3px 8px",border:"1px solid #eee",boxShadow:"none",boxSizing:"border-box",borderRadius:5,fontFamily:"inherit"}},null):H()]),B.showComma&&(0,P.createVNode)("span",null,[","]),r.showLength&&r.collapsed&&(0,P.createVNode)("span",{class:"vjs-comment"},[(0,P.createTextVNode)(" // "),B.length,(0,P.createTextVNode)(" items ")])]),r.renderNodeActions&&(0,P.createVNode)("span",{class:"vjs-tree-node-actions"},[A()])])}}});function qe(r,n){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(r);n&&(e=e.filter((function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),t.push.apply(t,e)}return t}function Z(r){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?qe(Object(t),!0).forEach((function(e){ue(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):qe(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}const un=(0,P.defineComponent)({name:"Tree",props:Z(Z({},it),{},{collapsedNodeLength:{type:Number,default:1/0},deep:{type:Number,default:1/0},pathCollapsible:{type:Function,default:function(){return!1}},virtual:{type:Boolean,default:!1},height:{type:Number,default:400},itemHeight:{type:Number,default:20},dynamicHeight:{type:Boolean,default:!0},selectedValue:{type:[String,Array],default:function(){return""}},collapsedOnClickBrackets:{type:Boolean,default:!0},style:Object,onSelectedChange:{type:Function},theme:{type:String,default:"light"}}),slots:["renderNodeKey","renderNodeValue","renderNodeActions"],emits:["nodeClick","nodeMouseover","bracketsClick","iconClick","selectedChange","update:selectedValue","update:data"],setup:function(r,n){var t=n.emit,e=n.slots,i=(0,P.ref)(),c=(0,P.computed)((function(){return oe(r.data,r.rootPath)})),a=function(T,L){return c.value.reduce((function(k,R){var d,f=R.level>=T||R.length>=L,x=(d=r.pathCollapsible)===null||d===void 0?void 0:d.call(r,R);return R.type!=="objectStart"&&R.type!=="arrayStart"||!f&&!x?k:Z(Z({},k),{},ue({},R.path,1))}),{})},s=(0,P.reactive)({translateY:0,visibleData:null,hiddenPaths:a(r.deep,r.collapsedNodeLength),startIndex:0,endIndex:0}),p=[],h=[],v=0,j={},H=function(T){p=Array(T).fill(0).map((function(){return r.itemHeight||20})),(h=new Array(T+1))[0]=0;for(var L=0;L<T;L++)h[L+1]=h[L]+p[L];v=h[T]||0},u=function(T){var L=p.length;T<0&&(T=0),T>L&&(T=L);for(var k=T;k<L;k++)h[k+1]=h[k]+p[k];v=h[L]||0},m=function(T,L){for(var k=0,R=T.length-1;k<R;){var d=k+R>>>1;T[d]<L?k=d+1:R=d}return k},N=(0,P.computed)((function(){for(var T=null,L=[],k=c.value.length,R=0;R<k;R++){var d=Z(Z({},c.value[R]),{},{id:R}),f=s.hiddenPaths[d.path];if(T&&T.path===d.path){var x=T.type==="objectStart",D=Z(Z(Z({},d),T),{},{showComma:d.showComma,content:x?"{...}":"[...]",type:x?"objectCollapsed":"arrayCollapsed"});T=null,L.push(D)}else{if(f&&!T){T=d;continue}if(T)continue;L.push(d)}}return L})),g=(0,P.computed)((function(){var T=r.selectedValue;return T&&r.selectableType==="multiple"&&Array.isArray(T)?T:[T]})),C=(0,P.computed)((function(){return!r.selectableType||r.selectOnClickNode||r.showSelectController?"":"When selectableType is not null, selectOnClickNode and showSelectController cannot be false at the same time, because this will cause the selection to fail."})),E=(0,P.computed)((function(){return r.dynamicHeight?v||0:N.value.length*r.itemHeight})),S=function T(){var L=N.value;if(L)if(r.virtual){var k,R=((k=i.value)===null||k===void 0?void 0:k.scrollTop)||0;if(r.dynamicHeight){p.length!==L.length&&H(L.length);var d=(function(G){var V=m(h,G+1e-4);return Math.max(0,Math.min(V-1,p.length-1))})(R),f=(function(G,V){var z=m(h,G+V);return Math.max(0,Math.min(z+1,p.length))})(R,r.height),x=Math.max(0,d-5),D=Math.min(L.length,f+5);s.startIndex=x,s.endIndex=D,s.translateY=h[x]||0,s.visibleData=L.slice(x,D),(0,P.nextTick)().then((function(){for(var G=!1,V=s.startIndex;V<s.endIndex;V++){var z=j[V];if(z){var $=z.offsetHeight;$&&p[V]!==$&&(p[V]=$,h[V+1]=h[V]+p[V],u(V+1),G=!0)}}G&&T()}))}else{var l=r.height/r.itemHeight,O=Math.floor(R/r.itemHeight),y=O<0?0:O+l>L.length?L.length-l:O;y<0&&(y=0);var _=y+l;s.translateY=y*r.itemHeight,s.startIndex=y,s.endIndex=_,s.visibleData=L.slice(y,_)}}else s.translateY=0,s.startIndex=0,s.endIndex=L.length,s.visibleData=L},M=null,A=function(){M&&cancelAnimationFrame(M),M=requestAnimationFrame((function(){S()}))},I=function(T){var L,k,R=T.path,d=r.selectableType;if(d==="multiple"){var f=g.value.findIndex((function(O){return O===R})),x=fe(g.value);f!==-1?x.splice(f,1):x.push(R),t("update:selectedValue",x),t("selectedChange",x,fe(g.value))}else if(d==="single"&&g.value[0]!==R){var D=(L=g.value,k=1,(function(O){if(Array.isArray(O))return O})(L)||(function(O,y){var _=O==null?null:typeof Symbol<"u"&&O[Symbol.iterator]||O["@@iterator"];if(_!=null){var G,V,z=[],$=!0,X=!1;try{for(_=_.call(O);!($=(G=_.next()).done)&&(z.push(G.value),!y||z.length!==y);$=!0);}catch(Y){X=!0,V=Y}finally{try{$||_.return==null||_.return()}finally{if(X)throw V}}return z}})(L,k)||nt(L,k)||(function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
125
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})())[0],l=R;t("update:selectedValue",l),t("selectedChange",l,D)}},B=function(T){t("nodeClick",T)},o=function(T){t("nodeMouseover",T)},b=function(T,L){if(T)s.hiddenPaths=Z(Z({},s.hiddenPaths),{},ue({},L,1));else{var k=Z({},s.hiddenPaths);delete k[L],s.hiddenPaths=k}},w=function(T,L){r.collapsedOnClickBrackets&&b(T,L.path),t("bracketsClick",T,L)},F=function(T,L){b(T,L.path),t("iconClick",T,L)},W=function(T,L){var k=Ce(r.data),R=r.rootPath;new Function("data","val","data".concat(L.slice(R.length),"=val"))(k,T),t("update:data",k)};return(0,P.watchEffect)((function(){C.value&&(function(T){throw new Error("[VueJSONPretty] ".concat(T))})(C.value)})),(0,P.watchEffect)((function(){N.value&&(r.virtual&&r.dynamicHeight&&p.length!==N.value.length&&H(N.value.length),S())})),(0,P.watch)((function(){return[r.dynamicHeight,r.itemHeight,c.value.length]}),(function(){r.virtual&&r.dynamicHeight&&(H(N.value.length),(0,P.nextTick)(S))})),(0,P.watch)((function(){return r.deep}),(function(T){T&&(s.hiddenPaths=a(T,r.collapsedNodeLength))})),(0,P.watch)((function(){return r.collapsedNodeLength}),(function(T){T&&(s.hiddenPaths=a(r.deep,T))})),function(){var T,L,k,R,d,f=(T=r.renderNodeKey)!==null&&T!==void 0?T:e.renderNodeKey,x=(L=r.renderNodeValue)!==null&&L!==void 0?L:e.renderNodeValue,D=(k=(R=r.renderNodeActions)!==null&&R!==void 0?R:e.renderNodeActions)!==null&&k!==void 0&&k,l=(d=s.visibleData)===null||d===void 0?void 0:d.map((function(O,y){var _=s.startIndex+y;return(0,P.createVNode)("div",{key:O.id,ref:function(G){return(function(V,z){z?j[V]=z:delete j[V]})(_,G||null)}},[(0,P.createVNode)(cn,{data:r.data,rootPath:r.rootPath,indent:r.indent,node:O,collapsed:!!s.hiddenPaths[O.path],theme:r.theme,showDoubleQuotes:r.showDoubleQuotes,showLength:r.showLength,checked:g.value.includes(O.path),selectableType:r.selectableType,showLine:r.showLine,showLineNumber:r.showLineNumber,showSelectController:r.showSelectController,selectOnClickNode:r.selectOnClickNode,nodeSelectable:r.nodeSelectable,highlightSelectedNode:r.highlightSelectedNode,editable:r.editable,editableTrigger:r.editableTrigger,showIcon:r.showIcon,showKeyValueSpace:r.showKeyValueSpace,renderNodeKey:f,renderNodeValue:x,renderNodeActions:D,onNodeClick:B,onNodeMouseover:o,onBracketsClick:w,onIconClick:F,onSelectedChange:I,onValueChange:W,class:r.dynamicHeight?"dynamic-height":void 0,style:r.dynamicHeight?{}:r.itemHeight&&r.itemHeight!==20?{lineHeight:"".concat(r.itemHeight,"px")}:{}},null)])}));return(0,P.createVNode)("div",{ref:i,class:{"vjs-tree":!0,"is-virtual":r.virtual,dark:r.theme==="dark"},onScroll:r.virtual?A:void 0,style:r.showLineNumber?Z({paddingLeft:"".concat(12*Number(c.value.length.toString().length),"px")},r.style):r.style},[r.virtual?(0,P.createVNode)("div",{class:"vjs-tree-list",style:{height:"".concat(r.height,"px")}},[(0,P.createVNode)("div",{class:"vjs-tree-list-holder",style:{height:"".concat(E.value,"px")}},[(0,P.createVNode)("div",{class:"vjs-tree-list-holder-inner",style:{transform:"translateY(".concat(s.translateY,"px)")}},[l])])]):l])}}});var pn=tt.A;export{pn as P,fn as c,hn as h};
|
|
125
|
+
`+t),e.b("</div>"),e.fl()},partials:{},subs:{}});q["tag-file-added"]=new U.Template({code:function(r,n,t){var e=this;return e.b(t=t||""),e.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),e.fl()},partials:{},subs:{}});q["tag-file-changed"]=new U.Template({code:function(r,n,t){var e=this;return e.b(t=t||""),e.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),e.fl()},partials:{},subs:{}});q["tag-file-deleted"]=new U.Template({code:function(r,n,t){var e=this;return e.b(t=t||""),e.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),e.fl()},partials:{},subs:{}});q["tag-file-renamed"]=new U.Template({code:function(r,n,t){var e=this;return e.b(t=t||""),e.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),e.fl()},partials:{},subs:{}});class cn{constructor({compiledTemplates:n={},rawTemplates:t={}}){const e=Object.entries(t).reduce((i,[c,a])=>{const s=U.compile(a,{asString:!1});return Object.assign(Object.assign({},i),{[c]:s})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},q),n),e)}static compile(n){return U.compile(n,{asString:!1})}render(n,t,e,i,c){const a=this.templateKey(n,t);try{return this.preCompiledTemplates[a].render(e,i,c)}catch{throw new Error(`Could not find template to render '${a}'`)}}template(n,t){return this.preCompiledTemplates[this.templateKey(n,t)]}templateKey(n,t){return`${n}-${t}`}}const un=Object.assign(Object.assign(Object.assign({},rt),it),{outputFormat:At.LINE_BY_LINE,drawFileList:!0});function pn(r,n={}){const t=Object.assign(Object.assign({},un),n),e=typeof r=="string"?zt(r,t):r,i=new cn(t),{colorScheme:c}=t,a={colorScheme:c},s=t.drawFileList?new Qt(i,a).render(e):"",p=t.outputFormat==="side-by-side"?new on(i,t).render(e):new en(i,t).render(e);return s+p}export{fn as P,hn as c,pn as h};
|