mirror of
https://github.com/yjs/yjs.git
synced 2025-12-16 19:57:45 +01:00
1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
|
|
!function n(t,r,e){function u(o,a){if(!r[o]){if(!t[o]){var c="function"==typeof require&&require;if(!a&&c)return c(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var l=r[o]={exports:{}};t[o][0].call(l.exports,function(n){var r=t[o][1][n];return u(r?r:n)},l,l.exports,n,t,r,e)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o<e.length;o++)u(e[o]);return u}({1:[function(n,t){var r;r=n("underscore"),t.exports=function(n){var t;return t=function(){function t(t,r,e){var u,i;this.engine=t,this.HB=r,this.execution_listener=e,i=function(n){return function(t){return n.send(t)}}(this),this.execution_listener.push(i),this.applied_operations=[],u=function(n){return function(t){return n.applied_operations.push(t)}}(this),this.execution_listener.push(u),0!==(null!=n?n.length:void 0)&&this.engine.applyOps(n[0].getHistoryBuffer()._encode()),this.unexecuted={}}return t.prototype.getOpsInExecutionOrder=function(){return this.applied_operations},t.prototype.send=function(t){var r,e,u,i;if(t.uid.creator===this.HB.getUserId()&&"string"!=typeof t.uid.op_number){for(i=[],e=0,u=n.length;u>e;e++)r=n[e],i.push(r.getUserId()!==this.HB.getUserId()?r.getConnector().receive(t):void 0);return i}},t.prototype.receive=function(n){var t,r;return null==(t=this.unexecuted)[r=n.uid.creator]&&(t[r]=[]),this.unexecuted[n.uid.creator].push(n)},t.prototype.flushOne=function(n){var t;return(null!=(t=this.unexecuted[n])?t.length:void 0)>0?this.engine.applyOp(this.unexecuted[n].shift()):void 0},t.prototype.flushOneRandom=function(){return this.flushOne(r.random(0,n.length-1))},t.prototype.flushAll=function(){var n,t,r;r=this.unexecuted;for(n in r)t=r[n],this.engine.applyOps(t);return this.unexecuted={}},t}()}},{underscore:2}],2:[function(n,t,r){(function(){var n=this,e=n._,u={},i=Array.prototype,o=Object.prototype,a=Function.prototype,c=i.push,l=i.slice,f=i.concat,s=o.toString,p=o.hasOwnProperty,h=i.forEach,v=i.map,d=i.reduce,g=i.reduceRight,y=i.filter,m=i.every,x=i.some,_=i.indexOf,b=i.lastIndexOf,w=Array.isArray,j=Object.keys,O=a.bind,A=function(n){return n instanceof A?n:this instanceof A?void(this._wrapped=n):new A(n)};"undefined"!=typeof r?("undefined"!=typeof t&&t.exports&&(r=t.exports=A),r._=A):n._=A,A.VERSION="1.6.0";var k=A.each=A.forEach=function(n,t,r){if(null==n)return n;if(h&&n.forEach===h)n.forEach(t,r);else if(n.length===+n.length){for(var e=0,i=n.length;i>e;e++)if(t.call(r,n[e],e,n)===u)return}else for(var o=A.keys(n),e=0,i=o.length;i>e;e++)if(t.call(r,n[o[e]],o[e],n)===u)return;return n};A.map=A.collect=function(n,t,r){var e=[];return null==n?e:v&&n.map===v?n.map(t,r):(k(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var E="Reduce of empty array with no initial value";A.reduce=A.foldl=A.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),d&&n.reduce===d)return e&&(t=A.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(k(n,function(n,i,o){u?r=t.call(e,r,n,i,o):(r=n,u=!0)}),!u)throw new TypeError(E);return r},A.reduceRight=A.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),g&&n.reduceRight===g)return e&&(t=A.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var o=A.keys(n);i=o.length}if(k(n,function(a,c,l){c=o?o[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(E);return r},A.find=A.detect=function(n,t,r){var e;return F(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},A.filter=A.select=function(n,t,r){var e=[];return null==n?e:y&&n.filter===y?n.filter(t,r):(k(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},A.reject=function(n,t,r){return A.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},A.every=A.all=function(n,t,r){t||(t=A.identity);var e=!0;return null==n?e:m&&n.every===m?n.every(t,r):(k(n,function(n,i,o){return(e=e&&t.call(r,n,i,o))?void 0:u}),!!e)};var F=A.some=A.any=function(n,t,r){t||(t=A.identity);var e=!1;return null==n?e:x&&n.some===x?n.some(t,r):(k(n,function(n,i,o){return e||(e=t.call(r,n,i,o))?u:void 0}),!!e)};A.contains=A.include=function(n,t){return null==n?!1:_&&n.indexOf===_?-1!=n.indexOf(t):
|