Files
2026-04-28 21:15:09 +03:00

9 lines
3.6 KiB
JavaScript

/** 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([[23],{452:function(ia,ba,e){e.r(ba);var ea=e(1),x=e(10),ha=e(2);ia=e(51);var ca=e(34),da=e(11);e=function(){function e(){this.init()}e.prototype.init=function(){this.i6=!1;this.Ve=this.rl=this.connection=null;this.Wr={};this.la=this.dF=null};e.prototype.Nla=function(e){for(var w=this,n=0;n<e.length;++n){var h=e[n];switch(h.at){case "create":this.Wr[h.author]||(this.Wr[h.author]=h.aName);this.Tca(h);break;case "modify":this.la.Ul(h.xfdf).then(function(e){w.la.qb(e[0])});
break;case "delete":this.la.Ul("<delete><id>"+h.aId+"</id></delete>")}}};e.prototype.Tca=function(e){var w=this;this.la.Ul(e.xfdf).then(function(n){n=n[0];n.authorId=e.author;w.la.qb(n);w.la.trigger(x.b.UPDATE_ANNOTATION_PERMISSION,[n])})};e.prototype.sca=function(e,x,n){this.rl&&this.rl(e,x,n)};e.prototype.preloadAnnotations=function(e){this.addEventListener("webViewerServerAnnotationsEnabled",this.sca.bind(this,e,"add",{imported:!1}),{once:!0})};e.prototype.initiateCollaboration=function(w,y,n){var h=
this;if(w){h.Ve=y;h.la=n.ta();n.addEventListener(x.e.DOCUMENT_UNLOADED,function(){h.disableCollaboration()});h.lma(w);var f=new XMLHttpRequest;f.addEventListener("load",function(){if(200===f.status&&0<f.responseText.length)try{var n=JSON.parse(f.responseText);h.connection=exports.Ya.Qma(Object(ca.j)(h.Ve,"blackbox/"),"annot");h.dF=n.id;h.Wr[n.id]=n.user_name;h.la.eM(n.id);h.connection.mqa(function(e){e.t&&e.t.startsWith("a_")&&e.data&&h.Nla(e.data)},function(){h.connection.send({t:"a_retrieve",dId:w});
h.trigger(e.Events.WEBVIEWER_SERVER_ANNOTATIONS_ENABLED,[h.Wr[n.id],h.dF])},function(){h.disableCollaboration()})}catch(z){Object(ha.g)(z.message)}});f.open("GET",Object(ca.j)(this.Ve,"demo/SessionInfo.jsp"));f.withCredentials=!0;f.send();h.i6=!0;h.la.yY(function(e){return h.Wr[e.Author]||e.Author})}else Object(ha.g)("Document ID required for collaboration")};e.prototype.disableCollaboration=function(){this.rl&&(this.la.removeEventListener(da.a.Events.ANNOTATION_CHANGED,this.rl),this.rl=null);this.connection&&
this.connection.Np();this.la&&this.la.eM("Guest");this.init();this.trigger(e.Events.WEBVIEWER_SERVER_ANNOTATIONS_DISABLED)};e.prototype.lma=function(e){var w=this;this.rl&&this.la.removeEventListener(da.a.Events.ANNOTATION_CHANGED,this.rl);this.rl=function(n,h,f){return Object(ea.b)(this,void 0,void 0,function(){var r,x,y,aa,ba,ca,da,ha,ia;return Object(ea.d)(this,function(z){switch(z.label){case 0:if(f.imported)return[2];r={t:"a_"+h,dId:e,annots:[]};return[4,w.la.mI()];case 1:x=z.ea();"delete"!==
h&&(y=(new DOMParser).parseFromString(x,"text/xml"),aa=new XMLSerializer);for(ba=0;ba<n.length;ba++)ca=n[ba],ha=da=void 0,"add"===h?(da=y.querySelector('[name="'+ca.Id+'"]'),ha=aa.serializeToString(da),ia=null,ca.InReplyTo&&(ia=w.la.hg(ca.InReplyTo).authorId||"default"),r.annots.push({at:"create",aId:ca.Id,author:w.dF,aName:w.Wr[w.dF],parent:ia,xfdf:"<add>"+ha+"</add>"})):"modify"===h?(da=y.querySelector('[name="'+ca.Id+'"]'),ha=aa.serializeToString(da),r.annots.push({at:"modify",aId:ca.Id,xfdf:"<modify>"+
ha+"</modify>"})):"delete"===h&&r.annots.push({at:"delete",aId:ca.Id});0<r.annots.length&&w.connection.send(r);return[2]}})})}.bind(w);this.la.addEventListener(da.a.Events.ANNOTATION_CHANGED,this.rl)};e.Events={WEBVIEWER_SERVER_ANNOTATIONS_ENABLED:"webViewerServerAnnotationsEnabled",WEBVIEWER_SERVER_ANNOTATIONS_DISABLED:"webViewerServerAnnotationsDisabled"};return e}();Object(ia.a)(e);ba["default"]=e}}]);}).call(this || window)