MCPcopy Create free account
hub / github.com/simstudioai/sim / UK

Function UK

apps/sim/lib/execution/sandbox/bundles/pdf-lib.cjs:32–32  ·  view source on GitHub ↗
(q,X)

Source from the content-addressed store, hash-verified

30%%EOF`},q.prototype.sizeInBytes=function(){return 16+this.lastXRefOffset.length},q.prototype.copyBytesInto=function(X,V){var K=V;return X[V++]=E.s,X[V++]=E.t,X[V++]=E.a,X[V++]=E.r,X[V++]=E.t,X[V++]=E.x,X[V++]=E.r,X[V++]=E.e,X[V++]=E.f,X[V++]=E.Newline,V+=k0(this.lastXRefOffset,X,V),X[V++]=E.Newline,X[V++]=E.Percent,X[V++]=E.Percent,X[V++]=E.E,X[V++]=E.O,X[V++]=E.F,V-K},q.forLastCrossRefSectionOffset=function(X){return new q(X)},q}(),S6=RG;var OG=function(){function q(X){this.dict=X}return q.prototype.toString=function(){return`trailer
31`+this.dict.toString()},q.prototype.sizeInBytes=function(){return 8+this.dict.sizeInBytes()},q.prototype.copyBytesInto=function(X,V){var K=V;return X[V++]=E.t,X[V++]=E.r,X[V++]=E.a,X[V++]=E.i,X[V++]=E.l,X[V++]=E.e,X[V++]=E.r,X[V++]=E.Newline,V+=this.dict.copyBytesInto(X,V),V-K},q.of=function(X){return new q(X)},q}(),Qq=OG;var wG=function(q){A(X,q);function X(V,K,Q){if(Q===void 0)Q=!0;var Y=q.call(this,V.obj({}),Q)||this;return Y.objects=K,Y.offsets=Y.computeObjectOffsets(),Y.offsetsString=Y.computeOffsetsString(),Y.dict.set(I.of("Type"),I.of("ObjStm")),Y.dict.set(I.of("N"),x.of(Y.objects.length)),Y.dict.set(I.of("First"),x.of(Y.offsetsString.length)),Y}return X.prototype.getObjectsCount=function(){return this.objects.length},X.prototype.clone=function(V){return X.withContextAndObjects(V||this.dict.context,this.objects.slice(),this.encode)},X.prototype.getContentsString=function(){var V=this.offsetsString;for(var K=0,Q=this.objects.length;K<Q;K++){var Y=this.objects[K],J=Y[1];V+=J+`
32`}return V},X.prototype.getUnencodedContents=function(){var V=new Uint8Array(this.getUnencodedContentsSize()),K=k0(this.offsetsString,V,0);for(var Q=0,Y=this.objects.length;Q<Y;Q++){var J=this.objects[Q],G=J[1];K+=G.copyBytesInto(V,K),V[K++]=E.Newline}return V},X.prototype.getUnencodedContentsSize=function(){return this.offsetsString.length+n6(this.offsets)[1]+n6(this.objects)[1].sizeInBytes()+1},X.prototype.computeOffsetsString=function(){var V="";for(var K=0,Q=this.offsets.length;K<Q;K++){var Y=this.offsets[K],J=Y[0],G=Y[1];V+=J+" "+G+" "}return V},X.prototype.computeObjectOffsets=function(){var V=0,K=Array(this.objects.length);for(var Q=0,Y=this.objects.length;Q<Y;Q++){var J=this.objects[Q],G=J[0],W=J[1];K[Q]=[G.objectNumber,V],V+=W.sizeInBytes()+1}return K},X.withContextAndObjects=function(V,K,Q){if(Q===void 0)Q=!0;return new X(V,K,Q)},X}(N6),a5=wG;var AG=function(){function q(X,V){var K=this;this.parsedObjects=0,this.shouldWaitForTick=function(Q){return K.parsedObjects+=Q,K.parsedObjects%K.objectsPerTick===0},this.context=X,this.objectsPerTick=V}return q.prototype.serializeToBuffer=function(){return _(this,void 0,void 0,function(){var X,V,K,Q,Y,J,G,W,Z,H,U,z,k,M,j,B,L;return c(this,function(O){switch(O.label){case 0:return[4,this.computeBufferSize()];case 1:X=O.sent(),V=X.size,K=X.header,Q=X.indirectObjects,Y=X.xref,J=X.trailerDict,G=X.trailer,W=0,Z=new Uint8Array(V),W+=K.copyBytesInto(Z,W),Z[W++]=E.Newline,Z[W++]=E.Newline,H=0,U=Q.length,O.label=2;case 2:if(!(H<U))return[3,5];if(z=Q[H],k=z[0],M=z[1],j=String(k.objectNumber),W+=k0(j,Z,W),Z[W++]=E.Space,B=String(k.generationNumber),W+=k0(B,Z,W),Z[W++]=E.Space,Z[W++]=E.o,Z[W++]=E.b,Z[W++]=E.j,Z[W++]=E.Newline,W+=M.copyBytesInto(Z,W),Z[W++]=E.Newline,Z[W++]=E.e,Z[W++]=E.n,Z[W++]=E.d,Z[W++]=E.o,Z[W++]=E.b,Z[W++]=E.j,Z[W++]=E.Newline,Z[W++]=E.Newline,L=M instanceof a5?M.getObjectsCount():1,!this.shouldWaitForTick(L))return[3,4];return[4,R2()];case 3:O.sent(),O.label=4;case 4:return H++,[3,2];case 5:if(Y)W+=Y.copyBytesInto(Z,W),Z[W++]=E.Newline;if(J)W+=J.copyBytesInto(Z,W),Z[W++]=E.Newline,Z[W++]=E.Newline;return W+=G.copyBytesInto(Z,W),[2,Z]}})})},q.prototype.computeIndirectObjectSize=function(X){var V=X[0],K=X[1],Q=V.sizeInBytes()+3,Y=K.sizeInBytes()+9;return Q+Y},q.prototype.createTrailerDict=function(){return this.context.obj({Size:this.context.largestObjectNumber+1,Root:this.context.trailerInfo.Root,Encrypt:this.context.trailerInfo.Encrypt,Info:this.context.trailerInfo.Info,ID:this.context.trailerInfo.ID})},q.prototype.computeBufferSize=function(){return _(this,void 0,void 0,function(){var X,V,K,Q,Y,J,G,W,Z,H,U;return c(this,function(z){switch(z.label){case 0:X=_2.forVersion(1,7),V=X.sizeInBytes()+2,K=i5.create(),Q=this.context.enumerateIndirectObjects(),Y=0,J=Q.length,z.label=1;case 1:if(!(Y<J))return[3,4];if(G=Q[Y],W=G[0],K.addEntry(W,V),V+=this.computeIndirectObjectSize(G),!this.shouldWaitForTick(1))return[3,3];return[4,R2()];case 2:z.sent(),z.label=3;case 3:return Y++,[3,1];case 4:return Z=V,V+=K.sizeInBytes()+1,H=Qq.of(this.createTrailerDict()),V+=H.sizeInBytes()+2,U=S6.forLastCrossRefSectionOffset(Z),V+=U.sizeInBytes(),[2,{size:V,header:X,indirectObjects:Q,xref:K,trailerDict:H,trailer:U}]}})})},q.forContext=function(X,V){return new q(X,V)},q}(),o5=AG;var NG=function(q){A(X,q);function X(V){var K=q.call(this)||this;return K.data=V,K}return X.prototype.clone=function(){return X.of(this.data.slice())},X.prototype.toString=function(){return"PDFInvalidObject("+this.data.length+" bytes)"},X.prototype.sizeInBytes=function(){return this.data.length},X.prototype.copyBytesInto=function(V,K){var Q=this.data.length;for(var Y=0;Y<Q;Y++)V[K++]=this.data[Y];return Q},X.of=function(V){return new X(V)},X}(z0),s5=NG;var y6;(function(q){q[q.Deleted=0]="Deleted",q[q.Uncompressed=1]="Uncompressed",q[q.Compressed=2]="Compressed"})(y6||(y6={}));var SG=function(q){A(X,q);function X(V,K,Q){if(Q===void 0)Q=!0;var Y=q.call(this,V,Q)||this;return Y.computeIndex=function(){var J=[],G=0;for(var W=0,Z=Y.entries.length;W<Z;W++){var H=Y.entries[W],U=Y.entries[W-1];if(W===0)J.push(H.ref.objectNumber);else if(H.ref.objectNumber-U.ref.objectNumber>1)J.push(G),J.push(H.ref.objectNumber),G=0;G+=1}return J.push(G),J},Y.computeEntryTuples=function(){var J=Array(Y.entries.length);for(var G=0,W=Y.entries.length;G<W;G++){var Z=Y.entries[G];if(Z.type===y6.Deleted){var{type:H,nextFreeObjectNumber:U,ref:z}=Z;J[G]=[H,U,z.generationNumber]}if(Z.type===y6.Uncompressed){var{type:H,offset:k,ref:z}=Z;J[G]=[H,k,z.generationNumber]}if(Z.type===y6.Compressed){var{type:H,objectStreamRef:M,index:j}=Z;J[G]=[H,M.objectNumber,j]}}return J},Y.computeMaxEntryByteWidths=function(){var J=Y.entryTuplesCache.access(),G=[0,0,0];for(var W=0,Z=J.length;W<Z;W++){var H=J[W],U=H[0],z=H[1],k=H[2],M=P5(U),j=P5(z),B=P5(k);if(M>G[0])G[0]=M;if(j>G[1])G[1]=j;if(B>G[2])G[2]=B}return G},Y.entries=K||[],Y.entryTuplesCache=m0.populatedBy(Y.computeEntryTuples),Y.maxByteWidthsCache=m0.populatedBy(Y.computeMaxEntryByteWidths),Y.indexCache=m0.populatedBy(Y.computeIndex),V.set(I.of("Type"),I.of("XRef")),Y}return X.prototype.addDeletedEntry=function(V,K){var Q=y6.Deleted;this.entries.push({type:Q,ref:V,nextFreeObjectNumber:K}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},X.prototype.addUncompressedEntry=function(V,K){var Q=y6.Uncompressed;this.entries.push({type:Q,ref:V,offset:K}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},X.prototype.addCompressedEntry=function(V,K,Q){var Y=y6.Compressed;this.entries.push({type:Y,ref:V,objectStreamRef:K,index:Q}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},X.prototype.clone=function(V){var K=this,Q=K.dict,Y=K.entries,J=K.encode;return X.of(Q.clone(V),Y.slice(),J)},X.prototype.getContentsString=function(){var V=this.entryTuplesCache.access(),K=this.maxByteWidthsCache.access(),Q="";for(var Y=0,J=V.length;Y<J;Y++){var G=V[Y],W=G[0],Z=G[1],H=G[2],U=I6(j6(W)),z=I6(j6(Z)),k=I6(j6(H));for(var M=K[0]-1;M>=0;M--)Q+=(U[M]||0).toString(2);for(var M=K[1]-1;M>=0;M--)Q+=(z[M]||0).toString(2);for(var M=K[2]-1;M>=0;M--)Q+=(k[M]||0).toString(2)}return Q},X.prototype.getUnencodedContents=function(){var V=this.entryTuplesCache.access(),K=this.maxByteWidthsCache.access(),Q=new Uint8Array(this.getUnencodedContentsSize()),Y=0;for(var J=0,G=V.length;J<G;J++){var W=V[J],Z=W[0],H=W[1],U=W[2],z=I6(j6(Z)),k=I6(j6(H)),M=I6(j6(U));for(var j=K[0]-1;j>=0;j--)Q[Y++]=z[j]||0;for(var j=K[1]-1;j>=0;j--)Q[Y++]=k[j]||0;for(var j=K[2]-1;j>=0;j--)Q[Y++]=M[j]||0}return Q},X.prototype.getUnencodedContentsSize=function(){var V=this.maxByteWidthsCache.access(),K=z4(V);return K*this.entries.length},X.prototype.updateDict=function(){q.prototype.updateDict.call(this);var V=this.maxByteWidthsCache.access(),K=this.indexCache.access(),Q=this.dict.context;this.dict.set(I.of("W"),Q.obj(V)),this.dict.set(I.of("Index"),Q.obj(K))},X.create=function(V,K){if(K===void 0)K=!0;var Q=new X(V,[],K);return Q.addDeletedEntry(a.of(0,65535),0),Q},X.of=function(V,K,Q){if(Q===void 0)Q=!0;return new X(V,K,Q)},X}(N6),Yq=SG;var yG=function(q){A(X,q);function X(V,K,Q,Y){var J=q.call(this,V,K)||this;return J.encodeStreams=Q,J.objectsPerStream=Y,J}return X.prototype.computeBufferSize=function(){return _(this,void 0,void 0,function(){var V,K,Q,Y,J,G,W,Z,M,j,H,L,U,z,B,k,M,j,B,L,O,N,R,v;return c(this,function(w){switch(w.label){case 0:V=this.context.largestObjectNumber+1,K=_2.forVersion(1,7),Q=K.sizeInBytes()+2,Y=Yq.create(this.createTrailerDict(),this.encodeStreams),J=[],G=[],W=[],Z=this.context.enumerateIndirectObjects(),M=0,j=Z.length,w.label=1;case 1:if(!(M<j))return[3,6];if(H=Z[M],L=H[0],U=H[1],z=L===this.context.trailerInfo.Encrypt||U instanceof E0||U instanceof s5||L.generationNumber!==0,!z)return[3,4];if(J.push(H),Y.addUncompressedEntry(L,Q),Q+=this.computeIndirectObjectSize(H),!this.shouldWaitForTick(1))return[3,3];return[4,R2()];case 2:w.sent(),w.label=3;case 3:return[3,5];case 4:if(B=n6(G),k=n6(W),!B||B.length%this.objectsPerStream===0)B=[],G.push(B),k=a.of(V++),W.push(k);Y.addCompressedEntry(L,k,B.length),B.push(H),w.label=5;case 5:return M++,[3,1];case 6:M=0,j=G.length,w.label=7;case 7:if(!(M<j))return[3,10];if(B=G[M],L=W[M],O=a5.withContextAndObjects(this.context,B,this.encodeStreams),Y.addUncompressedEntry(L,Q),Q+=this.computeIndirectObjectSize([L,O]),J.push([L,O]),!this.shouldWaitForTick(B.length))return[3,9];return[4,R2()];case 8:w.sent(),w.label=9;case 9:return M++,[3,7];case 10:return N=a.of(V++),Y.dict.set(I.of("Size"),x.of(V)),Y.addUncompressedEntry(N,Q),R=Q,Q+=this.computeIndirectObjectSize([N,Y]),J.push([N,Y]),v=S6.forLastCrossRefSectionOffset(R),Q+=v.sizeInBytes(),[2,{size:Q,header:K,indirectObjects:J,trailer:v}]}})})},X.forContext=function(V,K,Q,Y){if(Q===void 0)Q=!0;if(Y===void 0)Y=50;return new X(V,K,Q,Y)},X}(o5),Jq=yG;var $G=function(q){A(X,q);function X(V){var K=q.call(this)||this;return K.value=V,K}return X.prototype.asBytes=function(){var V=this.value+(this.value.length%2===1?"0":""),K=V.length,Q=new Uint8Array(V.length/2),Y=0,J=0;while(Y<K){var G=parseInt(V.substring(Y,Y+2),16);Q[J]=G,Y+=2,J+=1}return Q},X.prototype.decodeText=function(){var V=this.asBytes();if(b8(V))return x8(V);return J1(V)},X.prototype.decodeDate=function(){var V=this.decodeText(),K=P8(V);if(!K)throw new G1(V);return K},X.prototype.asString=function(){return this.value},X.prototype.clone=function(){return X.of(this.value)},X.prototype.toString=function(){return"<"+this.value+">"},X.prototype.sizeInBytes=function(){return this.value.length+2},X.prototype.copyBytesInto=function(V,K){return V[K++]=E.LessThan,K+=k0(this.value,V,K),V[K++]=E.GreaterThan,this.value.length+2},X.of=function(V){return new X(V)},X.fromText=function(V){var K=E4(V),Q="";for(var Y=0,J=K.length;Y<J;Y++)Q+=D2(K[Y],4);return new X(Q)},X}(z0),g=$G;var CG=function(){function q(X,V){this.encoding=X===V5.ZapfDingbats?K1.ZapfDingbats:X===V5.Symbol?K1.Symbol:K1.WinAnsi,this.font=i9.load(X),this.fontName=this.font.FontName,this.customName=V}return q.prototype.encodeText=function(X){var V=this.encodeTextAsGlyphs(X),K=Array(V.length);for(var Q=0,Y=V.length;Q<Y;Q++)K[Q]=u2(V[Q].code);return g.of(K.join(""))},q.prototype.widthOfTextAtSize=function(X,V){var K=this.encodeTextAsGlyphs(X),Q=0;for(var Y=0,J=K.length;Y<J;Y++){var G=K[Y].name,W=(K[Y+1]||{}).name,Z=this.font.getXAxisKerningForPair(G,W)||0;Q+=this.widthOfGlyph(G)+Z}var H=V/1000;return Q*H},q.prototype.heightOfFontAtSize=function(X,V){if(V===void 0)V={};var K=V.descender,Q=K===void 0?!0:K,Y=this.font,J=Y.Ascender,G=Y.Descender,W=Y.FontBBox,Z=J||W[3],H=G||W[1],U=Z-H;if(!Q)U+=G||0;return U/1000*X},q.prototype.sizeOfFontAtHeight=function(X){var V=this.font,K=V.Ascender,Q=V.Descender,Y=V.FontBBox,J=K||Y[3],G=Q||Y[1];return 1000*X/(J-G)},q.prototype.embedIntoContext=function(X,V){var K=X.obj({Type:"Font",Subtype:"Type1",BaseFont:this.customName||this.fontName,Encoding:this.encoding===K1.WinAnsi?"WinAnsiEncoding":void 0});if(V)return X.assign(V,K),V;else return X.register(K)},q.prototype.widthOfGlyph=function(X){return this.font.getWidthOfGlyph(X)||250},q.prototype.encodeTextAsGlyphs=function(X){var V=Array.from(X),K=Array(V.length);for(var Q=0,Y=V.length;Q<Y;Q++){var J=K4(V[Q]);K[Q]=this.encoding.encodeUnicodeCodePoint(J)}return K},q.for=function(X,V){return new q(X,V)},q}(),$6=CG;var UK=function(q,X){var V=Array(q.length);for(var K=0,Q=q.length;K<Q;K++){var Y=q[K],J=HK(Gq(X(Y))),G=HK.apply(void 0,Y.codePoints.map(FG));V[K]=[J,G]}return hG(V)},hG=function(q){return`/CIDInit /ProcSet findresource begin
3312 dict begin
34begincmap
35/CIDSystemInfo <<

Callers 1

pdf-lib.cjsFile · 0.70

Calls 4

HKFunction · 0.70
GqFunction · 0.70
XFunction · 0.70
hGFunction · 0.70

Tested by

no test coverage detected