vendor: 5,200 bytes, lines 1-7
1/** 2 * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2. 3 * Original file: /npm/[email protected]/dist/Delta.js 4 * 5 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files 6 */ 7import e from"fast-diff";import t from"lodash.clonedeep";import n from"lodash.isequal";var r={exports:{}},s={};Object.defineProperty(s,"__esModule",{value:!0});const i=t,o=n;var a;!function(e){e.compose=function(e={},t={},n=!1){"object"!=typeof e&&(e={}),"object"!=typeof t&&(t={});let r=i(t);n||(r=Object.keys(r).reduce(((e,t)=>(null!=r[t]&&(e[t]=r[t]),e)),{}));for(const n in e)void 0!==e[n]&&void 0===t[n]&&(r[n]=e[n]);return Object.keys(r).length>0?r:void 0},e.diff=function(e={},t={}){"object"!=typeof e&&(e={}),"object"!=typeof t&&(t={});const n=Object.keys(e).concat(Object.keys(t)).reduce(((n,r)=>(o(e[r],t[r])||(n[r]=void 0===t[r]?null:t[r]),n)),{});return Object.keys(n).length>0?n:void 0},e.invert=function(e={},t={}){e=e||{};const n=Object.keys(t).reduce(((n,r)=>(t[r]!==e[r]&&void 0!==e[r]&&(n[r]=t[r]),n)),{});return Object.keys(e).reduce(((n,r)=>(e[r]!==t[r]&&void 0===t[r]&&(n[r]=null),n)),n)},e.transform=function(e,t,n=!1){if("object"!=typeof e)return t;if("object"!=typeof t)return;if(!n)return t;const r=Object.keys(t).reduce(((n,r)=>(void 0===e[r]&&(n[r]=t[r]),n)),{});return Object.keys(r).length>0?r:void 0}}(a||(a={})),s.default=a;var u,p={};Object.defineProperty(p,"__esModule",{value:!0}),function(e){e.length=function(e){return"number"==typeof e.delete?e.delete:"number"==typeof e.retain?e.retain:"object"==typeof e.retain&&null!==e.retain?1:"string"==typeof e.insert?e.insert.length:1}}(u||(u={})),p.default=u;var f={};Object.defineProperty(f,"__esModule",{value:!0});const l=p;f.default=class{constructor(e){this.ops=e,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(e){e||(e=1/0);const t=this.ops[this.index];if(t){const n=this.offset,r=l.default.length(t);if(e>=r-n?(e=r-n,this.index+=1,this.offset=0):this.offset+=e,"number"==typeof t.delete)return{delete:e};{const r={};return t.attributes&&(r.attributes=t.attributes),"number"==typeof t.retain?r.retain=e:"object"==typeof t.retain&&null!==t.retain?r.retain=t.retain:"string"==typeof t.insert?r.insert=t.insert.substr(n,e):r.insert=t.insert,r}}return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?l.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const e=this.ops[this.index];return e?"number"==typeof e.delete?"delete":"number"==typeof e.retain||"object"==typeof e.retain&&null!==e.retain?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);{const e=this.offset,t=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=e,this.index=t,[n].concat(r)}}return[]}},function(r,i){Object.defineProperty(i,"__esModule",{value:!0}),i.AttributeMap=i.OpIterator=i.Op=void 0;const o=e,a=t,u=n,l=s;i.AttributeMap=l.default;const h=p;i.Op=h.default;const c=f;i.OpIterator=c.default;const d=String.fromCharCode(0),b=(e,t)=>{if("object"!=typeof e||null===e)throw new Error("cannot retain a "+typeof e);if("object"!=typeof t||null===t)throw new Error("cannot retain a "+typeof t);const n=Object.keys(e)[0];if(!n||n!==Object.keys(t)[0])throw new Error(`embed types not matched: ${n} != ${Object.keys(t)[0]}`);return[n,e[n],t[n]]};class y{constructor(e){Array.isArray(e)?this.ops=e:null!=e&&Array.isArray(e.ops)?this.ops=e.ops:this.ops=[]}static registerEmbed(e,t){this.handlers[e]=t}static unregisterEmbed(e){delete this.handlers[e]}static getHandler(e){const t=this.handlers[e];if(!t)throw new Error(`no handlers for embed type "${e}"`);return t}insert(e,t){const n={};return"string"==typeof e&&0===e.length?this:(n.insert=e,null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n))}delete(e){return e<=0?this:this.push({delete:e})}retain(e,t){if("number"==typeof e&&e<=0)return this;const n={retain:e};return null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n)}push(e){let t=this.ops.length,n=this.ops[t-1];if(e=a(e),"object"==typeof n){if("number"==typeof e.delete&&"number"==typeof n.delete)return this.ops[t-1]={delete:n.delete+e.delete},this;if("number"==typeof n.delete&&null!=e.insert&&(t-=1,n=this.ops[t-1],"object"!=typeof n))return this.ops.unshift(e),this;if(u(e.attributes,n.attributes)){if("string"==typeof e.insert&&"string"==typeof n.insert)return this.ops[t-1]={insert:n.insert+e.insert},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this;if("number"==typeof e.retain&&"number"==typeof n.retain)return this.ops[t-1]={retain:n.retain+e.retain},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this}}return t===this.ops.length?this.ops.push(e):this.ops.splice(t,0,e),this}chop(){const e=this.ops[this.ops.length-1];return e&&"number"==typeof e.retain&&!e.attributes&&this.ops.pop(),this}filter(e){return this.ops.filter(e)}forEach(e){this.ops.forEach(e)}map(e){return this.ops.map(e)}partition(e){const t=[],n=[];return this.forEach((r=>{(e(r)?t:n).push(r)})),[t,n]}reduce(e,t){return this.ops.reduce(e,t)}
vendor: 4,577 bytes, line 7
7changeLength(){return this.reduce(((e,t)=>t.insert?e+h.default.length(t):t.delete?e-t.delete:e),0)}length(){return this.reduce(((e,t)=>e+h.default.length(t)),0)}slice(e=0,t=1/0){const n=[],r=new c.default(this.ops);let s=0;for(;s<t&&r.hasNext();){let i;s<e?i=r.next(e-s):(i=r.next(t-s),n.push(i)),s+=h.default.length(i)}return new y(n)}compose(e){const t=new c.default(this.ops),n=new c.default(e.ops),r=[],s=n.peek();if(null!=s&&"number"==typeof s.retain&&null==s.attributes){let e=s.retain;for(;"insert"===t.peekType()&&t.peekLength()<=e;)e-=t.peekLength(),r.push(t.next());s.retain-e>0&&n.next(s.retain-e)}const i=new y(r);for(;t.hasNext()||n.hasNext();)if("insert"===n.peekType())i.push(n.next());else if("delete"===t.peekType())i.push(t.next());else{const e=Math.min(t.peekLength(),n.peekLength()),r=t.next(e),s=n.next(e);if(s.retain){const o={};if("number"==typeof r.retain)o.retain="number"==typeof s.retain?e:s.retain;else if("number"==typeof s.retain)null==r.retain?o.insert=r.insert:o.retain=r.retain;else{const e=null==r.retain?"insert":"retain",[t,n,i]=b(r[e],s.retain),a=y.getHandler(t);o[e]={[t]:a.compose(n,i,"retain"===e)}}const a=l.default.compose(r.attributes,s.attributes,"number"==typeof r.retain);if(a&&(o.attributes=a),i.push(o),!n.hasNext()&&u(i.ops[i.ops.length-1],o)){const e=new y(t.rest());return i.concat(e).chop()}}else"number"==typeof s.delete&&("number"==typeof r.retain||"object"==typeof r.retain&&null!==r.retain)&&i.push(s)}return i.chop()}concat(e){const t=new y(this.ops.slice());return e.ops.length>0&&(t.push(e.ops[0]),t.ops=t.ops.concat(e.ops.slice(1))),t}diff(e,t){if(this.ops===e.ops)return new y;const n=[this,e].map((t=>t.map((n=>{if(null!=n.insert)return"string"==typeof n.insert?n.insert:d;throw new Error("diff() called "+(t===e?"on":"with")+" non-document")})).join(""))),r=new y,s=o(n[0],n[1],t,!0),i=new c.default(this.ops),a=new c.default(e.ops);return s.forEach((e=>{let t=e[1].length;for(;t>0;){let n=0;switch(e[0]){case o.INSERT:n=Math.min(a.peekLength(),t),r.push(a.next(n));break;case o.DELETE:n=Math.min(t,i.peekLength()),i.next(n),r.delete(n);break;case o.EQUAL:n=Math.min(i.peekLength(),a.peekLength(),t);const e=i.next(n),s=a.next(n);u(e.insert,s.insert)?r.retain(n,l.default.diff(e.attributes,s.attributes)):r.push(s).delete(n)}t-=n}})),r.chop()}eachLine(e,t="\n"){const n=new c.default(this.ops);let r=new y,s=0;for(;n.hasNext();){if("insert"!==n.peekType())return;const i=n.peek(),o=h.default.length(i)-n.peekLength(),a="string"==typeof i.insert?i.insert.indexOf(t,o)-o:-1;if(a<0)r.push(n.next());else if(a>0)r.push(n.next(a));else{if(!1===e(r,n.next(1).attributes||{},s))return;s+=1,r=new y}}r.length()>0&&e(r,{},s)}invert(e){const t=new y;return this.reduce(((n,r)=>{if(r.insert)t.delete(h.default.length(r));else{if("number"==typeof r.retain&&null==r.attributes)return t.retain(r.retain),n+r.retain;if(r.delete||"number"==typeof r.retain){const s=r.delete||r.retain;return e.slice(n,n+s).forEach((e=>{r.delete?t.push(e):r.retain&&r.attributes&&t.retain(h.default.length(e),l.default.invert(r.attributes,e.attributes))})),n+s}if("object"==typeof r.retain&&null!==r.retain){const s=e.slice(n,n+1),i=new c.default(s.ops).next(),[o,a,u]=b(r.retain,i.insert),p=y.getHandler(o);return t.retain({[o]:p.invert(a,u)},l.default.invert(r.attributes,i.attributes)),n+1}}return n}),0),t.chop()}transform(e,t=!1){if(t=!!t,"number"==typeof e)return this.transformPosition(e,t);const n=e,r=new c.default(this.ops),s=new c.default(n.ops),i=new y;for(;r.hasNext()||s.hasNext();)if("insert"!==r.peekType()||!t&&"insert"===s.peekType())if("insert"===s.peekType())i.push(s.next());else{const e=Math.min(r.peekLength(),s.peekLength()),n=r.next(e),o=s.next(e);if(n.delete)continue;if(o.delete)i.push(o);else{const r=n.retain,s=o.retain;let a="object"==typeof s&&null!==s?s:e;if("object"==typeof r&&null!==r&&"object"==typeof s&&null!==s){const e=Object.keys(r)[0];if(e===Object.keys(s)[0]){const n=y.getHandler(e);n&&(a={[e]:n.transform(r[e],s[e],t)})}}i.retain(a,l.default.transform(n.attributes,o.attributes,t))}}else i.retain(h.default.length(r.next()));return i.chop()}transformPosition(e,t=!1){t=!!t;const n=new c.default(this.ops);let r=0;for(;n.hasNext()&&r<=e;){const s=n.peekLength(),i=n.peekType();n.next(),"delete"!==i?("insert"===i&&(r<e||!t)&&(e+=s),r+=s):e-=Math.min(s,e-r)}return e}}y.Op=h.default,y.OpIterator=c.default,y.AttributeMap=l.default,y.handlers={},i.default=y,r.exports=y,r.exports.default=y}(r,r.exports);var h=r.exports,c=r.exports.AttributeMap,d=r.exports.Op,b=r.exports.OpIterator,y=r.exports.__esModule;
7export{c as AttributeMap,d as Op,b as OpIterator,y as __esModule,h as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.