offsite 0.0.68 → 0.0.69
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/apps/client/dist/assets/ChevronsDownUpIcon-BNVFd2te.js +1 -0
- package/apps/client/dist/assets/{XIcon-DVUan90_.js → XIcon-DQMNLluU.js} +6 -6
- package/apps/client/dist/assets/{context-menu-B0aGaw4r.js → context-menu-DKfHACvP.js} +6 -6
- package/apps/client/dist/assets/diff-panel-__AqAgY3.js +260 -0
- package/apps/client/dist/assets/dist-D5zkZMSx.js +1 -0
- package/apps/client/dist/assets/dist-DUf7iKTq.js +1 -0
- package/apps/client/dist/assets/dist-Jliw2AH0.js +168 -0
- package/apps/client/dist/assets/{editor-dialog-CSefFtgP.js → editor-dialog-3JXNSbBz.js} +2 -2
- package/apps/client/dist/assets/{highlights-ClFpvuAt.js → highlights-B40Xqqot.js} +2 -2
- package/apps/client/dist/assets/{image-viewer-DOTYtAy5.js → image-viewer-RU1A0RN3.js} +1 -1
- package/apps/client/dist/assets/index-B-seWYA6.css +2 -0
- package/apps/client/dist/assets/index-Cb7dxBnJ.js +73 -0
- package/apps/client/dist/assets/libesm-Bfkx4A5Z.js +13 -0
- package/apps/client/dist/assets/{preview-dialog-Bq-8p3uq.js → preview-dialog-DLv_D_cw.js} +1 -1
- package/apps/client/dist/assets/resolveLanguages-CUb-sBYj.js +2 -0
- package/apps/client/dist/assets/shiki-1q83RgHy.js +2 -0
- package/apps/client/dist/assets/stream-tokenizer-BcBuusIz.js +1 -0
- package/apps/client/dist/assets/tokensToHtml-BxQY-Ba2.js +14 -0
- package/apps/client/dist/assets/{video-viewer-DsgT3Iz6.js → video-viewer-BR9BoG81.js} +1 -1
- package/apps/client/dist/index.html +7 -6
- package/apps/client/dist/sw.js +1 -1
- package/package.json +1 -1
- package/apps/client/dist/assets/appendItems-BzU1_nhw.js +0 -9
- package/apps/client/dist/assets/constants-CmGPilXJ.js +0 -1
- package/apps/client/dist/assets/diff-panel-BwlgTA7f.js +0 -408
- package/apps/client/dist/assets/dist-D58YXc_P.js +0 -2
- package/apps/client/dist/assets/dist-NHATWfcN.js +0 -1
- package/apps/client/dist/assets/getFiletypeFromFileName-DGoZTiUS.js +0 -1
- package/apps/client/dist/assets/index-dFajjlBv.css +0 -2
- package/apps/client/dist/assets/index-osF-Hjys.js +0 -21
- package/apps/client/dist/assets/libesm-Dyf3eB1R.js +0 -13
- package/apps/client/dist/assets/renderTokenLines-CZITQnBN.js +0 -3
- package/apps/client/dist/assets/shiki-BoAJalUP.js +0 -2
- package/apps/client/dist/assets/stream-tokenizer-bYvWJIhm.js +0 -4
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{l as n}from"./utils-U6QfaJBO.js";var r=[[`path`,{d:`M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],i=[[`path`,{d:`M18 14C18 14 13.5811 19 12 19C10.4188 19 6 14 6 14`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 9.99996C18 9.99996 13.5811 5.00001 12 5C10.4188 4.99999 6 10 6 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],a=t(((e,t)=>{var n=NaN,r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt,c=typeof global==`object`&&global&&global.Object===Object&&global,l=typeof self==`object`&&self&&self.Object===Object&&self,u=c||l||Function(`return this`)(),d=Object.prototype.toString,f=Math.max,p=Math.min,m=function(){return u.Date.now()};function h(e,t,n){var r,i,a,o,s,c,l=0,u=!1,d=!1,h=!0;if(typeof e!=`function`)throw TypeError(`Expected a function`);t=y(t)||0,g(n)&&(u=!!n.leading,d=`maxWait`in n,a=d?f(y(n.maxWait)||0,t):a,h=`trailing`in n?!!n.trailing:h);function _(t){var n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function v(e){return l=e,s=setTimeout(S,t),u?_(e):o}function b(e){var n=e-c,r=e-l,i=t-n;return d?p(i,a-r):i}function x(e){var n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function S(){var e=m();if(x(e))return C(e);s=setTimeout(S,b(e))}function C(e){return s=void 0,h&&r?_(e):(r=i=void 0,o)}function w(){s!==void 0&&clearTimeout(s),l=0,r=c=i=s=void 0}function T(){return s===void 0?o:C(m())}function E(){var e=m(),n=x(e);if(r=arguments,i=this,c=e,n){if(s===void 0)return v(c);if(d)return s=setTimeout(S,t),_(c)}return s===void 0&&(s=setTimeout(S,t)),o}return E.cancel=w,E.flush=T,E}function g(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function _(e){return!!e&&typeof e==`object`}function v(e){return typeof e==`symbol`||_(e)&&d.call(e)==`[object Symbol]`}function y(e){if(typeof e==`number`)return e;if(v(e))return n;if(g(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=g(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(r,``);var c=a.test(e);return c||o.test(e)?s(e.slice(2),c?2:8):i.test(e)?n:+e}t.exports=h})),o=e(n(),1),s=e(a(),1),c=typeof window<`u`?o.useLayoutEffect:o.useEffect;function l(e,t,n,r){let i=(0,o.useRef)(t);c(()=>{i.current=t},[t]),(0,o.useEffect)(()=>{let t=n?.current??window;if(!(t&&t.addEventListener))return;let a=e=>{i.current(e)};return t.addEventListener(e,a,r),()=>{t.removeEventListener(e,a,r)}},[e,n,r])}function u(e){let t=(0,o.useRef)(()=>{throw Error(`Cannot call an event handler while rendering.`)});return c(()=>{t.current=e},[e]),(0,o.useCallback)((...e)=>t.current?.call(t,...e),[t])}var d=typeof window>`u`;function f(e,t,n={}){let{initializeWithValue:r=!0}=n,i=(0,o.useCallback)(e=>n.serializer?n.serializer(e):JSON.stringify(e),[n]),a=(0,o.useCallback)(e=>{if(n.deserializer)return n.deserializer(e);if(e===`undefined`)return;let r=t instanceof Function?t():t,i;try{i=JSON.parse(e)}catch(e){return console.error(`Error parsing JSON:`,e),r}return i},[n,t]),s=(0,o.useCallback)(()=>{let n=t instanceof Function?t():t;if(d)return n;try{let t=window.localStorage.getItem(e);return t?a(t):n}catch(t){return console.warn(`Error reading localStorage key \u201C${e}\u201D:`,t),n}},[t,e,a]),[c,f]=(0,o.useState)(()=>r?s():t instanceof Function?t():t),p=u(t=>{d&&console.warn(`Tried setting localStorage key \u201C${e}\u201D even though environment is not a client`);try{let n=t instanceof Function?t(s()):t;window.localStorage.setItem(e,i(n)),f(n),window.dispatchEvent(new StorageEvent(`local-storage`,{key:e}))}catch(t){console.warn(`Error setting localStorage key \u201C${e}\u201D:`,t)}}),m=u(()=>{d&&console.warn(`Tried removing localStorage key \u201C${e}\u201D even though environment is not a client`);let n=t instanceof Function?t():t;window.localStorage.removeItem(e),f(n),window.dispatchEvent(new StorageEvent(`local-storage`,{key:e}))});(0,o.useEffect)(()=>{f(s())},[e]);let h=(0,o.useCallback)(t=>{t.key&&t.key!==e||f(s())},[e,s]);return l(`storage`,h),l(`local-storage`,h),[c,p,m]}function p(e){let t=(0,o.useRef)(e);t.current=e,(0,o.useEffect)(()=>()=>{t.current()},[])}function m(e,t=500,n){let r=(0,o.useRef)();p(()=>{r.current&&r.current.cancel()});let i=(0,o.useMemo)(()=>{let i=(0,s.default)(e,t,n),a=(...e)=>i(...e);return a.cancel=()=>{i.cancel()},a.isPending=()=>!!r.current,a.flush=()=>i.flush(),a},[e,t,n]);return(0,o.useEffect)(()=>{r.current=(0,s.default)(e,t,n)},[e,t,n]),i}function h(e,t,n){let r=n?.equalityFn??((e,t)=>e===t),i=e instanceof Function?e():e,[a,s]=(0,o.useState)(i),c=(0,o.useRef)(i),l=m(s,t,n);return r(c.current,i)||(l(i),c.current=i),[a,l]}var g=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r)setTimeout(function(){r(e)},0);else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h)d[r]=void 0;else{if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},_=new class extends g{};function v(e,t,n){return _.diff(e,t,n)}function y(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function b(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function x(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function S(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function C(e,t){return x(e,t,``)}function w(e,t){return S(e,t,``)}function T(e,t){return t.slice(0,E(e,t))}function E(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function D(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function O(e,t){if(t)return A(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function k(e,t){if(t)return A(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function A(e,t){if(!t)return[k(e),O(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=D(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var j=`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}`,M=RegExp(`[${j}]+|\\s+|[^${j}]`,`ug`);new class extends g{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=D(e,r)}else n=e.match(M)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&N(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&N(n,i,r,null,t.intlSegmenter),e}};function N(e,t,n,r,i){if(t&&n){let[a,o]=A(t.value,i),[s,c]=A(n.value,i);if(e){let r=y(a,s);e.value=S(e.value,s,r),t.value=C(t.value,r),n.value=C(n.value,r)}if(r){let e=b(o,c);r.value=x(r.value,c,e),t.value=w(t.value,e),n.value=w(n.value,e)}}else if(n){if(e){let e=k(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=k(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=k(r.value,i),[a,o]=A(t.value,i),s=y(n,a);t.value=C(t.value,s);let c=b(C(n,s),o);t.value=w(t.value,c),r.value=x(r.value,n,c),e.value=S(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=k(r.value,i),n=T(O(t.value,i),e);t.value=w(t.value,n)}else if(e){let n=T(O(e.value,i),k(t.value,i));t.value=C(t.value,n)}}var P=new class extends g{tokenize(e){let t=RegExp(`(\\r?\\n)|[${j}]+|[^\\S\\n\\r]+|[^${j}]`,`ug`);return e.match(t)||[]}};function F(e,t,n){return P.diff(e,t,n)}var I=new class extends g{constructor(){super(...arguments),this.tokenize=R}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes(`
|
|
2
|
-
`)||(e=e.trim()),n.newlineIsToken&&t.includes(`
|
|
3
|
-
`)||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
4
|
-
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
5
|
-
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function L(e,t,n){return I.diff(e,t,n)}function R(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
6
|
-
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function z(e){return e==`.`||e==`!`||e==`?`}new class extends g{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(z(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends g{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends g{constructor(){super(...arguments),this.tokenize=R}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(B(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function B(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=B(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=B(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends g{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function V(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function H(e){if(!V(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var U={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function W(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;L(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(L(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||q(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
|
|
7
|
-
`)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function G(e,t){if(t||=U,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw 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 e.map(e=>G(e,t)).join(`
|
|
8
|
-
`)}let n=[];if(e.isGit){if(t=U,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+H(r)+` `+H(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+H((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+H((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+H((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+H((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+H(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+H(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
|
|
9
|
-
`)+`
|
|
10
|
-
`}function K(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;W(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?G(e,o.headerOptions):void 0)}}))}else{let s=W(e,t,n,r,i,a,o);return s?G(s,o?.headerOptions):void 0}}function q(e){let t=e.endsWith(`
|
|
11
|
-
`),n=e.split(`
|
|
12
|
-
`).map(e=>e+`
|
|
13
|
-
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}export{h as a,r as c,v as i,L as n,f as o,F as r,i as s,K as t};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/loader-Dbltcnnq.js","assets/preload-helper-BLdHbfdN.js","assets/themes-P0s7avrn.js","assets/unwrapDefault-ByDmBtHB.js","assets/core-yhRGiujn.js","assets/dist-TdUDcI9m.js","assets/ccount-D7kz22QW.js","assets/rolldown-runtime-COiEfhsA.js","assets/lib-m_q9jTTN.js","assets/core-BvRk9kiK.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-BLdHbfdN.js";import{t}from"./unwrapDefault-ByDmBtHB.js";var n,r=0,i=class extends Error{constructor(){super(`Highlighter is disposed`),this.name=`HighlighterDisposedError`}};function a(){return n}function o(e){return e??n??`shiki-js`}function s(e){if(n!=null&&n!==e)throw Error(`Cannot load the "${e}" highlighter while "${n}" is in use. Only one highlighter type can be active at a time; dispose every "${n}" instance (disposeHighlighter() disposes the shared one) before switching.`)}function c(e){s(e),n=e,r++}function l(){r--,r===0&&(n=void 0)}function u(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}function d(e){let t;return()=>t??=e().then(e=>(t=e,e),e=>{throw t=void 0,e})}var f=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},p=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},m=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function h(e={}){let n=new Map,r=new Map,i=new Map,a=0;function o(e,t){if(n.has(e))throw new f(e);n.set(e,t)}function s(e,t){return!n.has(e)&&(n.set(e,t),!0)}function c(e){return n.has(e)}function l(o){let s=r.get(o);if(s!==void 0)return Promise.resolve(s);let c=i.get(o);if(c!==void 0)return c;let l=n.get(o);if(l===void 0&&e.fallbackLoader===void 0)return Promise.reject(new p(o));let u=a,d=Promise.resolve().then(()=>l===void 0?e.fallbackLoader?.(o):l()).then(async n=>{if(n===void 0)throw new p(o);let s=t(n),c=e.normalizeTheme===void 0?s:await e.normalizeTheme(s,o);return u===a&&r.set(o,c),i.get(o)===d&&i.delete(o),c}).catch(e=>{throw i.get(o)===d&&i.delete(o),e});return i.set(o,d),d}function u(e){return Promise.all(e.map(e=>l(e)))}function d(e,t){r.set(e,t)}function h(e){for(let[t,n]of e)d(t,n)}function g(e){return r.get(e)}function _(e){let t=[];for(let n of e){let e=r.get(n);if(e===void 0)throw new m(n);t.push(e)}return t}function v(e){return r.has(e)}function y(e){for(let t of e)if(!r.has(t))return!1;return!0}function b(e){let t=r.get(e);return t===void 0?l(e):t}function x(){a++,r.clear(),i.clear()}return{clearResolvedThemes:x,getResolvedOrResolveTheme:b,getResolvedTheme:g,getResolvedThemes:_,hasRegisteredTheme:c,hasResolvedTheme:v,hasResolvedThemes:y,registerTheme:o,registerThemeIfAbsent:s,resolveTheme:l,resolveThemes:u,seedResolvedTheme:d,seedResolvedThemes:h}}var g=new Map,_=new Map,v=d(()=>e(()=>import(`./loader-Dbltcnnq.js`),__vite__mapDeps([0,1]))),y=d(()=>e(()=>import(`./themes-P0s7avrn.js`),__vite__mapDeps([2,3,1]))),b=d(()=>e(()=>import(`./core-yhRGiujn.js`),__vite__mapDeps([4,5,6,7,8,9]))),x=[[`editor.lineHighlightBackground`,`editor.active_line.background`],[`editor.selectionBackground`,`element.selected`],[`editor.findMatchBackground`,`search.match_background`],[`editor.findMatchHighlightBackground`,`search.match_background`],[`editorBracketMatch.background`,`editor.document_highlight.bracket_background`],[`editorError.foreground`,`error`],[`editorWarning.foreground`,`warning`],[`editorInfo.foreground`,`info`],[`editorHint.foreground`,`hint`],[`gitDecoration.addedResourceForeground`,`created`,`terminal.ansi.green`],[`gitDecoration.deletedResourceForeground`,`deleted`,`terminal.ansi.red`],[`gitDecoration.modifiedResourceForeground`,`modified`,`terminal.ansi.blue`]];function S(e,t){let n=`themes`in t?t.themes[0]:t;if(n==null)throw Error(`Theme "${e}" is an empty Zed theme family.`);let r={...n,name:e},i={};for(let[e,t]of Object.entries(r.style))typeof t==`string`&&(i[e]=t);let a=r.style.players?.[0];a?.cursor!=null&&(i[`editorCursor.foreground`]??=a.cursor),a?.selection!=null&&(i[`editor.selectionBackground`]??=a.selection);for(let[e,...t]of x){if(i[e]!=null)continue;let n=t.find(e=>i[e]!=null);n!=null&&(i[e]=i[n])}if(r.cssVariables===!0)i[`editor.foreground`]=`var(--hls-foreground)`,i[`editor.background`]=`var(--hls-background)`;else if(typeof r.cssVariables==`object`){i[`editor.foreground`]??=i.text??i.foreground??`foreground`,i[`editor.background`]??=i.background??`background`;let{prefix:e=`--hls-`,defaults:t}=r.cssVariables;for(let[n,r]of Object.entries(i)){let a=t?.[r];i[n]=`var(${e}${r}${a?`, ${a}`:``})`}}let o=r.appearance===`light`?`light`:`dark`;return{name:e,type:o,colors:i,zed:r,fg:i[`editor.foreground`]??i.text??i.foreground??(o===`light`?`#333333`:`#bbbbbb`),bg:i[`editor.background`]??i.background??(o===`light`?`#ffffff`:`#1e1e1e`)}}function C(e){let t=_.get(e);return t??(t=h({fallbackLoader:async t=>{if(typeof __DIFFS_WORKER__<`u`?__DIFFS_WORKER__:u())throw Error(`Theme "${t}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedThemes parameter.`);let n=g.get(t);if(e===`highlights`){let e=n?.zed??n?.diffs;if(e!=null){let n=await e(),r=`default`in n?n.default:n;if(`zed`in r&&r.zed!=null)return r;if(`style`in r||`themes`in r)return S(t,r);throw Error(`Theme "${t}" is a TextMate theme; register a Zed theme with registerCustomTheme(name, loader, 'zed') for Highlights.`)}let r=v(),{themes:i}=r instanceof Promise?await r:r,a=i[t];if(a!=null)return S(t,(await a()).default);if(n?.textmate!=null)throw Error(`Theme "${t}" is only registered for TextMate; use registerCustomTheme(name, loader, 'zed') for Highlights.`)}else{let e=n?.textmate??n?.diffs,r;if(e!=null){let t=await e();r=`default`in t?t.default:t}else{let e=y(),{themes:i}=e instanceof Promise?await e:e,a=i.getTheme(t);if(a==null&&n?.zed!=null)throw Error(`Theme "${t}" is only registered for Zed; use registerCustomTheme(name, loader, 'textmate') for Shiki.`);if(a==null)throw Error(`No valid theme loader registered for "${t}"`);let o=await a.load();r=`default`in o?o.default:o}if(`style`in r||`themes`in r)throw Error(`Theme "${t}" is a Zed theme; use preferredHighlighter: 'highlights' or register a TextMate theme for Shiki.`);let i=b(),{normalizeTheme:a,createCssVariablesTheme:o}=i instanceof Promise?await i:i;if(`cssVariables`in r&&r.cssVariables!=null)return{...r,textmate:a(o(r.cssVariables))};if(`textmate`in r&&r.textmate!=null)return{...r,textmate:a(r.textmate)};let s=a(r);return{name:s.name,type:s.type,fg:s.fg,bg:s.bg,colors:s.colors,textmate:s}}throw Error(`No valid theme loader registered for "${t}"`)},normalizeTheme:(e,t)=>{if(e.name!==t)throw Error(`resolvedTheme: themeName: ${t} does not match theme.name: ${e.name}`);return e}}),_.set(e,t)),t}function w(e){return{type:`text`,value:e}}function T({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function E({name:e,width:t=16,height:n=16,properties:r}){return T({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[T({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function D(e){return T({tagName:`div`,properties:{"data-gutter":``},children:e})}function O(e,t,n,r={}){return T({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[T({tagName:`span`,properties:{"data-line-number-content":``},children:[w(`${t}`)]})]})}function k(e,t,n){return T({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function A(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(w(`
|
|
3
|
-
`)),e}var j=new WeakMap;function M(e,t=!1){let{htmlStyle:n}=e;if(n!=null){let e=t?j.get(n):void 0;if(e==null){e=``;for(let t in n)e+=`${e===``?``:`;`}${t}:${n[t]}`;t&&j.set(n,e)}return e}let r=e.color==null?``:`color:${e.color}`;if(e.bgColor!=null&&(r+=`;background-color:${e.bgColor}`),e.fontStyle!=null){e.fontStyle&1&&(r+=`;font-style:italic`),e.fontStyle&2&&(r+=`;font-weight:bold`);let t=!!(e.fontStyle&4),n=!!(e.fontStyle&8);(t||n)&&(r+=`;text-decoration:${t?`underline`:``}${t&&n?` `:``}${n?`line-through`:``}`)}return r.replace(/^;/,``)}function N(e,t,n,{retain:r=!0}={}){let i=!1,a;Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){if(i)return a;let o=n();return r?(a=o,i=!0,Object.getOwnPropertyDescriptor(e,t)?.configurable===!0&&Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:a}),a):o},set(n){if(Object.getOwnPropertyDescriptor(e,t)?.configurable===!0)Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n});else if(Object.isFrozen(e))throw TypeError(`Cannot assign to read only array index '${t}'`);else a=n,i=!0}})}var P=Symbol(`no-token`),F=Symbol(`multiple-tokens`);function I(e){let t=L(e);if(t!=null)return t;let n=P,r=[],i=[],a,o=()=>{if(i.length===0||a==null)i=[],a=void 0;else if(i.length===1){let e=i[0];if(e?.type===`element`){z(e,a);for(let t of e.children)R(t)}else R(e);r.push(e),i=[],a=void 0}else{for(let e of i)R(e);r.push(T({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0}},s=e=>{e!==P&&(e===F?n=F:n===P?n=e:n!==e&&(n=F))};for(let t of e.children){let e=t.type===`element`?I(t):P;s(e),typeof e==`number`?(a!=null&&a!==e&&o(),a??=e,i.push(t)):(o(),r.push(t))}return o(),e.children=r,n}function L(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function R(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)R(t)}}function z(e,t){e.properties[`data-char`]=t}function B(e,{state:t,lazyLineAST:n=!1,cacheHtmlStyles:r=!1,useTokenTransformer:i=!1,mergeWhitespaces:a=`always`,decorations:o=[],lineOffsets:s=[]}){let c;for(let t of o){let n=c??=new Map,r={...t,start:W(t.start,s),end:W(t.end,s)},i=Math.min(r.end.line,e.length-1);for(let e=r.start.line;e<=i;e++){let t=n.get(e);t??n.set(e,t=[]),t.push(r)}}let l=(e,n)=>{let o;if(i||a!==`never`){let t=``,n=0;for(let r=0;r<e.length;r++){let a=e[r];if(i){let t=a.content.trim();if(t!==``&&t!==a.content){o??=e.slice(0,r);let n=a.content.indexOf(t);n>0&&o.push({content:a.content.slice(0,n),offset:a.offset}),o.push({...a,content:t,offset:a.offset+n});let i=n+t.length;i<a.content.length&&o.push({content:a.content.slice(i),offset:a.offset+i});continue}}else{let i=!!((a.fontStyle??0)&12);if(!i&&/^\s+$/.test(a.content)&&r<e.length-1){o??=e.slice(0,r),t===``&&(n=a.offset),t+=a.content;continue}t!==``&&o!=null&&(i?o.push({content:t,offset:n}):a={...a,content:t+a.content,offset:n},t=``)}o?.push(a)}}o??=e;let s={type:`element`,tagName:t==null?`span`:`div`,properties:t==null?{class:`line`}:{},children:[]},l=c?.get(n),u=l==null?V(s,o,i,r):H(s,o,l,n,i,r);return i&&u===0&&s.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),i&&l!=null&&I(s),t==null?s:A(s,n+1,t)};if(!n)return e.map(l);let u=Array(e.length);for(let t=0;t<e.length;t++){let n=e[t];N(u,t,()=>l(n,t))}return u}function V(e,t,n,r){let i=0;for(let a of t)a.content!==``&&(e.children.push(U(a,M(a,r),a.content,i,n)),i+=a.content.length);return i}function H(e,t,n,r,i,a){n.length>1&&n.sort((e,t)=>e.start.line===t.start.line?e.start.character===t.start.character?e.end.line===t.end.line?t.end.character-e.end.character:t.end.line-e.end.line:e.start.character-t.start.character:e.start.line-t.start.line);let o=t.reduce((e,t)=>e+t.content.length,0),s=[];for(let e=0;e<n.length;e++){let t=n[e],i={decoration:t,order:e,from:t.start.line===r?t.start.character:0,to:t.end.line===r?t.end.character:o};s.push({position:Math.max(0,Math.min(i.from,o)),range:i,start:!0},{position:Math.max(0,Math.min(i.to,o)),range:i,start:!1})}s.sort((e,t)=>e.position-t.position);let c=[],l=[],u=0,d=(e,t)=>{let n=0,r=c.length;for(;n<r;){let t=n+r>>>1;c[t].order<e.order?n=t+1:r=t}t?c.splice(n,0,e):c[n]===e&&c.splice(n,1)},f=()=>{let t=e,n=0;for(let e of c){if(l[n]?.range!==e){l.length=n;let r={type:`element`,tagName:`span`,properties:{...e.decoration.properties},children:[]};t.children.push(r),l.push({range:e,node:r})}t=l[n++].node}return l.length=n,t},p=e,m=e=>{let t=u;for(;s[u]?.position===e;)u++;let n=!1;for(let n=t;n<u;n++){let{range:t,start:r}=s[n];!r&&t.from!==t.to&&e<o&&d(t,!1)}for(let r=t;r<u;r++){let{range:t,start:i}=s[r];i&&t.from<=e&&t.to>=e&&(t.to>e||t.from===e||e===o)&&(d(t,!0),t.from===t.to&&(n=!0))}if(n){f();for(let e=t;e<u;e++){let{range:t,start:n}=s[e];n&&t.from===t.to&&d(t,!1)}}e<o&&(p=f())},h=0;for(let e of t){if(e.content===``)continue;let t=h,n=t+e.content.length,r=M(e,a);for(;h<n;){s[u]?.position===h&&m(h);let a=Math.min(n,s[u]?.position??n);p.children.push(U(e,r,h===t&&a===n?e.content:e.content.slice(h-t,a-t),t,i)),h=a}}return s[u]?.position===h&&m(h),h}function U(e,t,n,r,i){let a=e.htmlAttrs==null?{}:{...e.htmlAttrs};return t!==``&&(a.style=t),i&&(a[`data-char`]=r),{type:`element`,tagName:`span`,properties:a,children:[{type:`text`,value:n}]}}function W(e,t){if(typeof e!=`number`)return e;let n=0,r=t.length;for(;n+1<r;){let i=n+r>>>1;t[i]<=e?n=i:r=i}return{line:n,character:e-(t[n]??0)}}export{o as _,k as a,T as c,C as d,u as f,l as g,a as h,A as i,E as l,c as m,N as n,O as o,i as p,M as r,D as s,B as t,w as u};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/langs-DdlLhtBb.js","assets/langs-DssLtjmH.js","assets/preload-helper-BLdHbfdN.js","assets/engine-oniguruma-Dl5gvpE_.js","assets/engine-oniguruma-BMl9YtsA.js","assets/rolldown-runtime-COiEfhsA.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e,n as t,r as n,t as r}from"./constants-CmGPilXJ.js";import{d as i,f as a}from"./renderTokenLines-CZITQnBN.js";import{t as o}from"./preload-helper-BLdHbfdN.js";import{n as s,t as c}from"./stream-tokenizer-bYvWJIhm.js";import{G as l,U as u,c as d,s as f}from"./dist-TdUDcI9m.js";import{t as p}from"./appendItems-BzU1_nhw.js";function m(e,t){for(let i of Array.isArray(e)?e:[e]){let e=n.get(i.name);e??(e=i,n.set(i.name,e)),t.attachLanguages([e]),r.add(e.name)}}async function h(r){if(typeof __DIFFS_WORKER__<`u`?__DIFFS_WORKER__:a())throw Error(`resolveLanguage("${r}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let i=e.get(r);if(i!=null)return i;let s=(async()=>{let e=t.get(r);if(e==null){let{bundledLanguages:t}=await o(async()=>{let{bundledLanguages:e}=await import(`./langs-DdlLhtBb.js`);return{bundledLanguages:e}},__vite__mapDeps([0,1,2]));Object.prototype.hasOwnProperty.call(t,r)&&(e=t[r])}if(e==null)throw Error(`resolveLanguage: "${r}" not found in bundled or custom languages`);let{default:i}=await e(),a={name:r,data:i};return n.has(r)||n.set(r,a),a})();e.set(r,s);try{return await s}finally{e.get(r)===s&&e.delete(r)}}function g(e){return n.get(e)??h(e)}async function _(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=g(r)??h(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function v(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}var y=0,b=0,x=class{backend;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=!1;#u=[l];#d=[];#f=0;#p=[];#m=-1;#h=!0;#g=!1;#_=0;#v=++b;#y=-1;#b=-1;#x;#S=0;#C=[];#w=!1;#T=v(async e=>{if(this.#l)return;let{startingLine:t=0,totalLines:n=1/0}=e??{},r=Math.min(n===1/0?1/0:t+n,this.#i.lineCount);if(this.#t==null&&!C(this.#i.languageId)){if(await this.backend?.loadLanguages([this.#i.languageId]),this.#l)return;this.#t=this.#e.getLanguage(this.#i.languageId)}this.#D(),this.#N(r)},500);#E=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,tokenizerId:n,jobId:r}=e;t===`tokenize`&&n===this.#v&&typeof r==`number`&&r===this.#_&&(this.#y>=0?this.#z(r):this.#B(r))};getStringCommentRegexpRangesInLine(e){if(!this.#s||e<0||e>=this.#i.lineCount||(this.#O(),this.#t==null))return null;if(this.#C[e]===void 0){this.#R(e);let t=this.#u[e]??l,n=this.#P(e,t);this.#u[e+1]=n.state}return this.#C[e]??null}constructor(e,t,n){this.backend=n,this.#e=e,this.#i=t.textDocument,this.#n=t.theme,this.#r=[],this.#a=t.tokenizeMaxLineLength??1e3,this.#o=t.onDeferTokenize,this.#s=t.matchBrackets!==!1,this.#c=t.__debug??!1,this.#O(),this.#D()}setTheme(e){this.#n!==e&&(this.#n=e,this.#D(),this.stopBackgroundTokenize(),this.#u=[l],this.#d=[],this.#f=0,this.#p=[],this.#t!=null&&this.#i.lineCount>0&&this.#M(0))}#D(){if(this.#n===``)return;this.backend?.getTheme(this.#n);let{colorMap:e}=this.#e.setTheme(this.#n);this.#r=e}dispose(){this.#l=!0,this.stopBackgroundTokenize(),this.#A()}tokenize(e,t,n=!1){if(this.#O(),this.#D(),this.#t==null&&!C(this.#i.languageId))throw Error(`Grammar for language "${this.#i.languageId}" not loaded`);let{lineCount:r}=this.#i,{startingLine:i=0,totalLines:a=1/0}=t??{},o=a===1/0?r:Math.min(i+a,r),s=e.startLine,c=Math.max(i,s),u=t!=null&&a!==1/0&&e.lineDelta>0&&s<o&&e.endLine>=o,d=e.lineDelta===0&&(e.changedLineChanges?.every(([,,e])=>e===0)??!0);this.#s&&!d&&(this.#C.length=Math.min(this.#C.length,e.startLine));let f=n&&e.lineDelta!==0&&s>=i,p=d||t==null||s>=c,m=e.changedLineRanges??[[s,e.endLine]];this.#d=[],this.#f=0,this.#p=[];let h=-1;if(s<c)for(let[e,t]of m)e<c&&(h=Math.max(h,Math.min(t,c-1)));let g=h>=s&&(d||e.lineDelta<0);d?this.#R(s):(this.#I(e),(t==null||s>=c)&&this.#R(c));let _=0,v=m[_][1],y,b=0,x=d?m[_][0]:c,S=!1,w=new Map,T=g?new Map:void 0;if(T!=null&&!d){let e=Math.min(h+1,c,o);if(e>s){this.#R(e);let t=s,n=this.#u[t]??l;for(;t<e;t++){let e=this.#P(t,n);n=e.state,T.set(t,e.resolvedTokens)}this.#u[e]=n}}let E=this.#u[x]??l;for(;x<o;){let e=d?this.#u[x+1]:f?this.#L(x+1):void 0;p&&(this.#u[x]=E);let{resolvedTokens:t,state:n}=this.#P(x,E);if(E=n,x>=c?w.set(x,t):T?.set(x,t),p&&(this.#u[x+1]=E),S=x>=v&&(d||f)&&e!=null&&E.equals(e),S){_++;let e=m[_];if(e==null)break;if(e[0]>=o){y=e[0],b=_;break}let t=this.#u[e[0]];if(f)for(let n=x+2;n<=e[0]&&(t=this.#L(n),t!=null);n++)this.#u[n]=t;t==null?(v=e[1],x++):(x=e[0],E=t,v=e[1]),S=!1}else x++}if(p&&(x<o?this.#u[x+1]=E:this.#u[x]=E),S&&f&&y==null){for(let e=x+2;e<=r;e++){let t=this.#L(e);if(t==null)break;this.#u[e]=t}this.#d=[],this.#f=0,this.#p=[]}if(T!=null&&T.size>0&&this.#o(T),y!=null)this.#s&&d&&(this.#C.length=Math.min(this.#C.length,y)),this.#M(y,m,b);else if(!S&&x<r){let e=u&&s>=c?o:s<c&&!d?s:x;this.#s&&d&&(this.#C.length=Math.min(this.#C.length,e)),this.#M(e,m,_)}return w}prebuildStateStack(e){this.#O(),this.#T(e)}stopBackgroundTokenize(){this.#b=-1,this.#h||(this.#h=!0,this.#g=!1,this.#m=-1,this.#y=-1,this.#x=void 0,this.#S=0,this.#d=[],this.#f=0,this.#p=[],this.#A())}pauseBackgroundTokenize(){this.#h||this.#g||(this.#c&&console.log(`[diffs/editor] background tokenization paused`,{jobId:this.#_}),this.#g=!0)}resumeBackgroundTokenize(){this.#h||!this.#g||this.#t==null||this.#m<0||(this.#c&&console.log(`[diffs/editor] background tokenization resumed`,{jobId:this.#_}),this.#g=!1,this.#j(this.#_))}#O(){this.#t==null&&!C(this.#i.languageId)&&this.#e.getLoadedLanguages().includes(this.#i.languageId)&&(this.#t=this.#e.getLanguage(this.#i.languageId))}#k(){this.#w||=(globalThis.addEventListener(`message`,this.#E),!0)}#A(){this.#w&&=(globalThis.removeEventListener(`message`,this.#E),!1)}#j(e){globalThis.postMessage({type:`tokenize`,tokenizerId:this.#v,jobId:e})}#M(e,t,n=0){if(C(this.#i.languageId))return;let r=++this.#_;this.#c&&console.log(`[diffs/editor] background tokenization scheduled`,{jobId:r,startLine:e,changedLineRanges:t,changedRangeIndex:n}),this.#h=!1,this.#g=!1,this.#m=e,this.#y>=0&&(this.#b=Math.max(this.#b,this.#y)),this.#y=-1,this.#x=t,this.#S=n,this.#k(),this.#j(r)}#N(e){if(this.#t==null||this.#u.length>e)return;if(!this.#h){this.#y>=0?this.#y=Math.max(this.#y,e):this.#b=Math.max(this.#b,e);return}let t=++this.#_;this.#h=!1,this.#g=!1,this.#m=this.#u.length-1,this.#y=e,this.#b=-1,this.#x=void 0,this.#S=0,this.#k(),this.#j(t)}#P(e,t){let n=this.#i.getLineText(e);if(n.length>=this.#a)return console.warn(`[diffs] Line(${e}) too long to tokenize: ${n.length}`),this.#F(e,null),{resolvedTokens:[[0,``,n]],state:t};if(this.#t==null||n===``||n.trim()===``)return this.#F(e,null),{resolvedTokens:[[0,``,n]],state:t};let r=S(this.#t,this.#r,n,t,y,this.#s);return this.#F(e,r.bracketIgnoredRanges),{resolvedTokens:r.resolvedTokens,state:r.ruleStack}}#F(e,t){this.#s&&(this.#C[e]=t)}#I(e){let t=e.changedLineChanges??[[e.startLine,e.endLine,e.lineDelta]],n=e.startLine+1;n<=this.#u.length-n?(this.#d=this.#u,this.#f=0,this.#u=this.#u.slice(0,n)):(this.#f=n,this.#d=this.#u.slice(n),this.#u.length=Math.min(this.#u.length,n)),this.#p=t}#L(e){let t=e;for(let n=this.#p.length-1;n>=0;n--){let[r,i,a]=this.#p[n];if(a!==0){if(t>i)t-=a;else if(t>r)return this.#u[e]}}return this.#d[t-this.#f]??this.#u[e]}#R(e,t){let n=Math.min(Math.max(0,e),this.#i.lineCount);if(this.#u.length>n||this.#t==null)return!0;let r=t==null?0:performance.now(),i=this.#u.length-1,a=this.#u[i]??l;for(;i<n;){this.#u[i]=a;let e=this.#i.getLineText(i);if(e.length<this.#a&&e!==``&&e.trim()!==``){let t=S(this.#t,this.#r,e,a,y,this.#s,!1);this.#F(i,t.bracketIgnoredRanges),a=t.ruleStack}else this.#F(i,null);if(i++,this.#u[i]=a,t!=null&&performance.now()-r>t)break}return i>=n}#z(e){if(this.#h||this.#g||this.#t==null||e!==this.#_)return;this.#D();let t=this.#R(this.#y,1);this.#h||this.#g||e!==this.#_||(t?this.stopBackgroundTokenize():(this.#m=this.#u.length-1,this.#j(e)))}#B(e){if(this.#h||this.#g||this.#t==null||e!==this.#_)return;this.#D();let t=performance.now(),n=new Map,r=this.#i.lineCount,i=this.#x,a=this.#m,o=this.#u[a]??l,s=!1,c=this.#S,u=i?.[c]?.[1];for(;a<r;){this.#u[a]=o;let e=u==null?void 0:this.#L(a+1),r=this.#P(a,o);if(n.set(a,r.resolvedTokens),o=r.state,this.#u[a+1]=o,s=u!=null&&a>=u&&e!=null&&o.equals(e),a++,s){c++;let e=i?.[c];if(e==null)break;if(u=e[1],this.#u[e[0]]==null)s=!1;else{a=e[0],o=this.#u[a]??o,s=!1;continue}}if(performance.now()-t>1)break}if(this.#o(n),!(this.#h||this.#g||e!==this.#_)){if(s||a>=r){let e=this.#b;this.stopBackgroundTokenize(),e>=0&&this.#N(e)}else this.#m=a,this.#S=c,this.#j(e)}}};function S(e,t,n,r,i,a=!0,o=!0){let s=e.tokenizeLine2(n,r,i);s.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${n.substring(0,100)}`);let c=s.tokens,l=c.length/2,d=[],f=[];if(!o&&!a)return{ruleStack:s.ruleStack,resolvedTokens:d,bracketIgnoredRanges:f};for(let e=0;e<l;e++){let r=c[2*e],i=e+1<l?c[2*e+2]:n.length;if(r===i)continue;let s=c[2*e+1];if(o){let e=u.getForeground(s);d.push([r,t[e],n.slice(r,i)])}a&&u.getTokenType(s)>0&&f.push([r,i])}return{ruleStack:s.ruleStack,resolvedTokens:d,bracketIgnoredRanges:f}}function C(e){return e===`text`||e===`ansi`}var w=class e extends c{highlighter;options;#e=``;#t;constructor(e,t){super(),this.highlighter=e,this.options=t}tokenizeChunk(e,t){let n=(this.#e+e).split(/(\r\n|\r|\n)/),r=[];for(let e=0;e<n.length;e+=2){let i=n[e],a=this.highlighter.codeToTokens(i,{...this.options,grammarState:this.#t}),o=a.tokens[0].map(e=>({...e,offset:e.offset+this.stableOffset}));e+1<n.length?(p(t,o),this.pushLineBreak(t,i.length,n[e+1]),this.#t=a.grammarState):(r=o,this.#e=i)}return{unstable:r,tailLength:this.#e.length}}clone(){this.assertActive();let t=new e(this.highlighter,this.options);return this.copyStateTo(t),t.#e=this.#e,t.#t=this.#t,t}resetSource(){this.#e=``,this.#t=void 0}releaseSource(){this.resetSource()}},T=class e extends s{raw;loadedThemes=new Map;attachedLanguages=new Set([`text`,`ansi`]);static async create(t){let n=t===`shiki-wasm`?(await o(async()=>{let{createOnigurumaEngine:e}=await import(`./engine-oniguruma-Dl5gvpE_.js`);return{createOnigurumaEngine:e}},__vite__mapDeps([3,4,5]))).createOnigurumaEngine(o(()=>import(`./wasm-BnjxR4X6.js`),[])):(await o(async()=>{let{createJavaScriptRegexEngine:e}=await import(`./engine-javascript-DKxkqixV.js`);return{createJavaScriptRegexEngine:e}},[])).createJavaScriptRegexEngine(),r=await d({themes:[],langs:[],engine:n});return new e(t,r)}constructor(e,t){super(e,i(e)),this.raw=t}getTheme(e){this.assertNotDisposed();let t=this.loadedThemes.get(e),n=this.themeResolver.getResolvedTheme(e)??t;if(n==null)throw Error(`Theme "${e}" has not been resolved`);if(t!==n){let t=n.textmate??(n.cssVariables==null?void 0:f(n.cssVariables));if(t==null)throw Error(`Theme "${e}" does not support Shiki`);this.raw.setTheme({...t,name:e}),this.loadedThemes.set(e,n)}return n}codeToTokens(e,t){return this.raw.codeToTokens(e,this.resolveOptions(t))}createEditorTokenizer(e){return new x(this.raw,e,this)}createStreamTokenizer(e){return new w(this.raw,this.resolveOptions(e))}async loadLanguages(e){this.assertNotDisposed(),m(await _(e.filter(e=>!this.attachedLanguages.has(e))),this)}hasLoadedLanguages(e){if(this.disposed)return!1;let n;return e.every(e=>this.attachedLanguages.has(e)?!0:!t.has(e)&&(n??=this.raw.getLoadedLanguages(),n.includes(e)))}attachLanguages(e){this.assertNotDisposed();for(let t of e){if(this.attachedLanguages.has(t.name))continue;let e=t.data.find(e=>e.name===t.name||e.aliases?.includes(t.name)===!0);if(e==null)throw Error(`attachResolvedLanguages: No returned grammar declares "${t.name}" as its name or an alias.`);this.raw.loadLanguageSync(t.data);try{this.raw.getLanguage(t.name)}catch{throw Error(`attachResolvedLanguages: "${e.name}" is already loaded without alias "${t.name}". Load the alias first or give the grammar a unique name.`)}this.attachedLanguages.add(t.name)}}releaseResources(){this.loadedThemes.clear(),this.attachedLanguages.clear(),this.raw.dispose()}resolveOptions({theme:e,themes:t,...n}){if(this.assertNotDisposed(),e!=null)return this.getTheme(e),{...n,theme:e};if(t==null)throw Error(`A theme or themes option is required`);for(let e of Object.values(t))this.getTheme(e);return{...n,themes:t}}};export{T as ShikiHighlighter,m as i,g as n,h as r,_ as t};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{g as e,m as t,p as n,t as r}from"./renderTokenLines-CZITQnBN.js";import{n as i}from"./appendItems-BzU1_nhw.js";function a(e,t,n,a=!1){let o=[0];if(n.decorations?.some(e=>typeof e.start==`number`||typeof e.end==`number`)===!0)for(let t=e.indexOf(`
|
|
2
|
-
`);t!==-1;t=e.indexOf(`
|
|
3
|
-
`,t+1))o.push(t+1);let s={type:`element`,tagName:`code`,properties:{},children:[]},c=r(t.tokens,{decorations:n.decorations,mergeWhitespaces:n.mergeWhitespaces,lineOffsets:o,cacheHtmlStyles:a});for(let e=0;e<c.length;e++)e>0&&s.children.push({type:`text`,value:`
|
|
4
|
-
`}),s.children.push(c[e]);let l={type:`root`,children:[{type:`element`,tagName:`pre`,properties:{class:`diffs`,style:t.rootStyle===!1?void 0:t.rootStyle??[t.fg==null?``:`color:${t.fg}`,t.bg==null?``:`background-color:${t.bg}`].filter(Boolean).join(`;`),tabIndex:0},children:[s]}]};return i(l)}var o=class{name;themeResolver;disposed=!1;constructor(e,n){this.name=e,this.themeResolver=n,t(e)}codeToHtml(e,t){return a(e,this.codeToTokens(e,t),t,this.name===`highlights`)}get isDisposed(){return this.disposed}dispose(){this.disposed||(this.disposed=!0,this.releaseResources(),e())}assertNotDisposed(){if(this.disposed)throw new n}},s=class{disposed=!1;stableOffset=0;unstable=[];pendingCarriageReturn=``;enqueue(e){this.assertActive(),e=this.pendingCarriageReturn+e,this.pendingCarriageReturn=e.endsWith(`\r`)?`\r`:``,this.pendingCarriageReturn!==``&&(e=e.slice(0,-1));let t=this.unstable.length,n=[],{unstable:r,tailLength:i}=this.tokenizeChunk(e,n);return this.pendingCarriageReturn!==``&&r.push({content:`\r`,offset:this.stableOffset+i}),this.unstable=r,{recall:t,stable:n,unstable:r}}pushLineBreak(e,t,n){for(let r=0;r<n.length;r++)e.push({content:n[r],offset:this.stableOffset+t+r});this.stableOffset+=t+n.length}close(){let e=this.unstable;return this.dispose(),{stable:e}}clear(){this.assertActive(),this.stableOffset=0,this.unstable=[],this.pendingCarriageReturn=``,this.resetSource()}dispose(){this.disposed||(this.disposed=!0,this.unstable=[],this.releaseSource())}copyStateTo(e){e.stableOffset=this.stableOffset,e.unstable=this.unstable.slice(),e.pendingCarriageReturn=this.pendingCarriageReturn}assertActive(){if(this.disposed)throw Error(`stream tokenizer is disposed`)}};export{o as n,a as r,s as t};
|