UNPKG

@suns/react-monorepo-nx

Version:

To evaluate and compare the bundled and unbundled builds on large codebase.

9 lines (8 loc) 3.69 kB
/** Notice * This file contains works from many authors under various (but compatible) licenses. Please see core.txt for more information. **/ (function(){(window.wpCoreControlsBundle=window.wpCoreControlsBundle||[]).push([[21],{536:function(wa,ta,n){n.r(ta);var pa=n(0),oa=n(7),na=n(3);wa=n(51);var ja=n(29),ka=n(13);n=function(){function fa(){this.init()}fa.prototype.init=function(){this.Rga=!1;this.Pf=this.pn=this.connection=null;this.Gu={};this.ga=this.NJ=null};fa.prototype.$Aa=function(y){for(var x=this,f=0;f<y.length;++f){var e=y[f];switch(e.at){case "create":this.Gu[e.author]||(this.Gu[e.author]=e.aName);this.cqa(e);break;case "modify":this.ga.jq(e.xfdf).then(function(a){x.ga.pb(a[0])}); break;case "delete":this.ga.jq("<delete><id>"+e.aId+"</id></delete>")}}};fa.prototype.cqa=function(y){var x=this;this.ga.jq(y.xfdf).then(function(f){f=f[0];f.authorId=y.author;x.ga.pb(f);x.ga.trigger(oa.c.UPDATE_ANNOTATION_PERMISSION,[f])})};fa.prototype.zpa=function(y,x,f){this.pn&&this.pn(y,x,f)};fa.prototype.preloadAnnotations=function(y){this.addEventListener("webViewerServerAnnotationsEnabled",this.zpa.bind(this,y,"add",{imported:!1}),{once:!0})};fa.prototype.initiateCollaboration=function(y, x,f){var e=this;if(y){e.Pf=x;e.ga=f.la();f.addEventListener(oa.h.DOCUMENT_UNLOADED,function(){e.disableCollaboration()});e.DBa(y);var a=new XMLHttpRequest;a.addEventListener("load",function(){if(200===a.status&&0<a.responseText.length)try{var b=JSON.parse(a.responseText);e.connection=exports.da.oCa(Object(ja.k)(e.Pf,"blackbox/"),"annot");e.NJ=b.id;e.Gu[b.id]=b.user_name;e.ga.lS(b.id);e.connection.QFa(function(h){h.t&&h.t.startsWith("a_")&&h.data&&e.$Aa(h.data)},function(){e.connection.send({t:"a_retrieve", dId:y});e.trigger(fa.Events.WEBVIEWER_SERVER_ANNOTATIONS_ENABLED,[e.Gu[b.id],e.NJ])},function(){e.disableCollaboration()})}catch(h){Object(na.g)(h.message)}});a.open("GET",Object(ja.k)(this.Pf,"demo/SessionInfo.jsp"));a.withCredentials=!0;a.send();e.Rga=!0;e.ga.k7(function(b){return e.Gu[b.Author]||b.Author})}else Object(na.g)("Document ID required for collaboration")};fa.prototype.disableCollaboration=function(){this.pn&&(this.ga.removeEventListener(ka.a.Events.ANNOTATION_CHANGED,this.pn),this.pn= null);this.connection&&this.connection.Xr();this.ga&&this.ga.lS("Guest");this.init();this.trigger(fa.Events.WEBVIEWER_SERVER_ANNOTATIONS_DISABLED)};fa.prototype.DBa=function(y){var x=this;this.pn&&this.ga.removeEventListener(ka.a.Events.ANNOTATION_CHANGED,this.pn);this.pn=function(f,e,a){return Object(pa.b)(this,void 0,void 0,function(){var b,h,r,w,z,aa,ha,ba,ca;return Object(pa.d)(this,function(ea){switch(ea.label){case 0:if(a.imported)return[2];b={t:"a_"+e,dId:y,annots:[]};return[4,x.ga.m_()];case 1:h= ea.ba();"delete"!==e&&(r=(new DOMParser).parseFromString(h,"text/xml"),w=new XMLSerializer);for(z=0;z<f.length;z++)aa=f[z],ba=ha=void 0,"add"===e?(ha=r.querySelector('[name="'+aa.Id+'"]'),ba=w.serializeToString(ha),ca=null,aa.InReplyTo&&(ca=x.ga.Cg(aa.InReplyTo).authorId||"default"),b.annots.push({at:"create",aId:aa.Id,author:x.NJ,aName:x.Gu[x.NJ],parent:ca,xfdf:"<add>"+ba+"</add>"})):"modify"===e?(ha=r.querySelector('[name="'+aa.Id+'"]'),ba=w.serializeToString(ha),b.annots.push({at:"modify",aId:aa.Id, xfdf:"<modify>"+ba+"</modify>"})):"delete"===e&&b.annots.push({at:"delete",aId:aa.Id});0<b.annots.length&&x.connection.send(b);return[2]}})})}.bind(x);this.ga.addEventListener(ka.a.Events.ANNOTATION_CHANGED,this.pn)};fa.Events={WEBVIEWER_SERVER_ANNOTATIONS_ENABLED:"webViewerServerAnnotationsEnabled",WEBVIEWER_SERVER_ANNOTATIONS_DISABLED:"webViewerServerAnnotationsDisabled"};return fa}();Object(wa.a)(n);ta["default"]=n}}]);}).call(this || window)