@plaso-infi/whiteboard-sdk 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker/gif.worker.js +15 -0
- package/package.json +2 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */function e(e,r,n,t){return new(n||(n=Promise))((function(a,i){function o(e){try{s(t.next(e))}catch(e){i(e)}}function u(e){try{s(t.throw(e))}catch(e){i(e)}}function s(e){var r;e.done?a(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(o,u)}s((t=t.apply(e,r||[])).next())}))}function r(e,r){var n,t,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,t&&(a=2&i[0]?t.return:i[0]?t.throw||((a=t.return)&&a.call(t),0):t.next)&&!(a=a.call(t,i[1])).done)return a;switch(t=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,t=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=r.call(e,o)}catch(e){i=[6,e],t=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var n={},t={},a={};Object.defineProperty(a,"__esModule",{value:!0}),a.loop=a.conditional=a.parse=void 0;a.parse=function e(r,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t;if(Array.isArray(n))n.forEach((function(n){return e(r,n,t,a)}));else if("function"==typeof n)n(r,t,a,e);else{var i=Object.keys(n)[0];Array.isArray(n[i])?(a[i]={},e(r,n[i],t,a[i])):a[i]=n[i](r,t,a,e)}return t};a.conditional=function(e,r){return function(n,t,a,i){r(n,t,a)&&i(n,e,t,a)}};a.loop=function(e,r){return function(n,t,a,i){for(var o=[],u=n.pos;r(n,t,a);){var s={};if(i(n,e,t,s),n.pos===u)break;u=n.pos,o.push(s)}return o}};var i={};Object.defineProperty(i,"__esModule",{value:!0}),i.readBits=i.readArray=i.readUnsigned=i.readString=i.peekBytes=i.readBytes=i.peekByte=i.readByte=i.buildStream=void 0;i.buildStream=function(e){return{data:e,pos:0}};var o=function(){return function(e){return e.data[e.pos++]}};i.readByte=o;i.peekByte=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(r){return r.data[r.pos+e]}};var u=function(e){return function(r){return r.data.subarray(r.pos,r.pos+=e)}};i.readBytes=u;i.peekBytes=function(e){return function(r){return r.data.subarray(r.pos,r.pos+e)}};i.readString=function(e){return function(r){return Array.from(u(e)(r)).map((function(e){return String.fromCharCode(e)})).join("")}};i.readUnsigned=function(e){return function(r){var n=u(2)(r);return e?(n[1]<<8)+n[0]:(n[0]<<8)+n[1]}};i.readArray=function(e,r){return function(n,t,a){for(var i="function"==typeof r?r(n,t,a):r,o=u(e),s=new Array(i),d=0;d<i;d++)s[d]=o(n);return s}};i.readBits=function(e){return function(r){for(var n=function(e){return e.data[e.pos++]}(r),t=new Array(8),a=0;a<8;a++)t[7-a]=!!(n&1<<a);return Object.keys(e).reduce((function(r,n){var a=e[n];return a.length?r[n]=function(e,r,n){for(var t=0,a=0;a<n;a++)t+=e[r+a]&&Math.pow(2,n-a-1);return t}(t,a.index,a.length):r[n]=t[a.index],r}),{})}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=a,n=i,t={blocks:function(e){for(var r=[],t=e.data.length,a=0,i=(0,n.readByte)()(e);0!==i&&i;i=(0,n.readByte)()(e)){if(e.pos+i>=t){var o=t-e.pos;r.push((0,n.readBytes)(o)(e)),a+=o;break}r.push((0,n.readBytes)(i)(e)),a+=i}for(var u=new Uint8Array(a),s=0,d=0;d<r.length;d++)u.set(r[d],s),s+=r[d].length;return u}},o=(0,r.conditional)({gce:[{codes:(0,n.readBytes)(2)},{byteSize:(0,n.readByte)()},{extras:(0,n.readBits)({future:{index:0,length:3},disposal:{index:3,length:3},userInput:{index:6},transparentColorGiven:{index:7}})},{delay:(0,n.readUnsigned)(!0)},{transparentColorIndex:(0,n.readByte)()},{terminator:(0,n.readByte)()}]},(function(e){var r=(0,n.peekBytes)(2)(e);return 33===r[0]&&249===r[1]})),u=(0,r.conditional)({image:[{code:(0,n.readByte)()},{descriptor:[{left:(0,n.readUnsigned)(!0)},{top:(0,n.readUnsigned)(!0)},{width:(0,n.readUnsigned)(!0)},{height:(0,n.readUnsigned)(!0)},{lct:(0,n.readBits)({exists:{index:0},interlaced:{index:1},sort:{index:2},future:{index:3,length:2},size:{index:5,length:3}})}]},(0,r.conditional)({lct:(0,n.readArray)(3,(function(e,r,n){return Math.pow(2,n.descriptor.lct.size+1)}))},(function(e,r,n){return n.descriptor.lct.exists})),{data:[{minCodeSize:(0,n.readByte)()},t]}]},(function(e){return 44===(0,n.peekByte)()(e)})),s=(0,r.conditional)({text:[{codes:(0,n.readBytes)(2)},{blockSize:(0,n.readByte)()},{preData:function(e,r,t){return(0,n.readBytes)(t.text.blockSize)(e)}},t]},(function(e){var r=(0,n.peekBytes)(2)(e);return 33===r[0]&&1===r[1]})),d=(0,r.conditional)({application:[{codes:(0,n.readBytes)(2)},{blockSize:(0,n.readByte)()},{id:function(e,r,t){return(0,n.readString)(t.blockSize)(e)}},t]},(function(e){var r=(0,n.peekBytes)(2)(e);return 33===r[0]&&255===r[1]})),c=(0,r.conditional)({comment:[{codes:(0,n.readBytes)(2)},t]},(function(e){var r=(0,n.peekBytes)(2)(e);return 33===r[0]&&254===r[1]})),l=[{header:[{signature:(0,n.readString)(3)},{version:(0,n.readString)(3)}]},{lsd:[{width:(0,n.readUnsigned)(!0)},{height:(0,n.readUnsigned)(!0)},{gct:(0,n.readBits)({exists:{index:0},resolution:{index:1,length:3},sort:{index:4},size:{index:5,length:3}})},{backgroundColorIndex:(0,n.readByte)()},{pixelAspectRatio:(0,n.readByte)()}]},(0,r.conditional)({gct:(0,n.readArray)(3,(function(e,r){return Math.pow(2,r.lsd.gct.size+1)}))},(function(e,r){return r.lsd.gct.exists})),{frames:(0,r.loop)([o,d,c,u,s],(function(e){var r=(0,n.peekByte)()(e);return 33===r||44===r}))}];e.default=l}(t);var s={};Object.defineProperty(s,"__esModule",{value:!0}),s.deinterlace=void 0;s.deinterlace=function(e,r){for(var n=new Array(e.length),t=e.length/r,a=function(t,a){var i=e.slice(a*r,(a+1)*r);n.splice.apply(n,[t*r,r].concat(i))},i=[0,4,2,1],o=[8,8,4,2],u=0,s=0;s<4;s++)for(var d=i[s];d<t;d+=o[s])a(d,u),u++;return n};var d={};Object.defineProperty(d,"__esModule",{value:!0}),d.lzw=void 0;d.lzw=function(e,r,n){var t,a,i,o,u,s,d,c,l,f,p,v,y,g,h,b,m=4096,x=n,w=new Array(n),B=new Array(m),k=new Array(m),A=new Array(4097);for(u=(a=1<<(f=e))+1,t=a+2,d=-1,i=(1<<(o=f+1))-1,c=0;c<a;c++)B[c]=0,k[c]=c;for(p=v=y=g=h=b=0,l=0;l<x;){if(0===g){if(v<o){p+=r[b]<<v,v+=8,b++;continue}if(c=p&i,p>>=o,v-=o,c>t||c==u)break;if(c==a){i=(1<<(o=f+1))-1,t=a+2,d=-1;continue}if(-1==d){A[g++]=k[c],d=c,y=c;continue}for(s=c,c==t&&(A[g++]=y,c=d);c>a;)A[g++]=k[c],c=B[c];y=255&k[c],A[g++]=y,t<m&&(B[t]=d,k[t]=y,0==(++t&i)&&t<m&&(o++,i+=t)),d=s}g--,w[h++]=A[g],l++}for(l=h;l<x;l++)w[l]=0;return w},Object.defineProperty(n,"__esModule",{value:!0}),n.decompressFrames=b=n.decompressFrame=g=n.parseGIF=void 0;var c,l=(c=t)&&c.__esModule?c:{default:c},f=a,p=i,v=s,y=d;var g=n.parseGIF=function(e){var r=new Uint8Array(e);return(0,f.parse)((0,p.buildStream)(r),l.default)},h=function(e,r,n){if(e.image){var t=e.image,a=t.descriptor.width*t.descriptor.height,i=(0,y.lzw)(t.data.minCodeSize,t.data.blocks,a);t.descriptor.lct.interlaced&&(i=(0,v.deinterlace)(i,t.descriptor.width));var o={pixels:i,dims:{top:e.image.descriptor.top,left:e.image.descriptor.left,width:e.image.descriptor.width,height:e.image.descriptor.height}};return t.descriptor.lct&&t.descriptor.lct.exists?o.colorTable=t.lct:o.colorTable=r,e.gce&&(o.delay=10*(e.gce.delay||10),o.disposalType=e.gce.extras.disposal,e.gce.extras.transparentColorGiven&&(o.transparentIndex=e.gce.transparentColorIndex)),n&&(o.patch=function(e){for(var r=e.pixels.length,n=new Uint8ClampedArray(4*r),t=0;t<r;t++){var a=4*t,i=e.pixels[t],o=e.colorTable[i]||[0,0,0];n[a]=o[0],n[a+1]=o[1],n[a+2]=o[2],n[a+3]=i!==e.transparentIndex?255:0}return n}(o)),o}console.warn("gif frame does not have associated image.")},b=n.decompressFrame=h;n.decompressFrames=function(e,r){return e.frames.filter((function(e){return e.image})).map((function(n){return h(n,e.gct,r)}))};var m=[];function x(e){return new Promise((function(r){var n=new FileReader;n.onloadend=function(e){var n;r(null===(n=e.target)||void 0===n?void 0:n.result)},n.readAsArrayBuffer(e)}))}var w,B,k=self;function A(e,r){k.postMessage(e,r)}function S(n){return e(this,void 0,void 0,(function(){var e,t,a,i,o,u,s,d,c,l;return r(this,(function(f){switch(f.label){case 0:return e=n.reqId,t=n.file,w!==t?[3,1]:(a=B.next(),c=a.value,(l=a.done)?A({name:"response",reqId:e,value:null}):A({name:"response",reqId:e,value:c},[c.patch.buffer]),l&&(w=""),[3,6]);case 1:return w=t,i=void 0,"string"!=typeof t?[3,3]:[4,(p=t,new Promise((function(e,r){var n=new XMLHttpRequest;n.responseType="arraybuffer",n.open("GET",p),n.onload=function(){e(n.response)},n.onerror=r,n.send()})))];case 2:return i=f.sent(),[3,5];case 3:return[4,x(t)];case 4:i=f.sent(),f.label=5;case 5:o=g(i),u=o.frames.filter((function(e){return"image"in e})),s=o.gct,B=function(e,n){var t,a;return r(this,(function(r){switch(r.label){case 0:t=0,r.label=1;case 1:return t<e.length?(a=e[t],[4,b(a,n,!0)]):[3,4];case 2:r.sent(),r.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}(u,s),d=B.next(),c=d.value,(l=d.done)?(A({name:"response",reqId:e,value:null}),w=""):A({name:"response",reqId:e,value:c},[c.patch.buffer]),f.label=6;case 6:return!w&&m.length>0&&S(m.shift()),[2]}var p}))}))}k.onmessage=function(n){var t=n.data;return e(void 0,void 0,void 0,(function(){var e,n,a;return r(this,(function(r){return"decodeFrames"===t.name&&(e=t.reqId,n=t.value,a={reqId:e,file:n},w&&w!==n?m.push(a):S(a)),[2]}))}))}}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaso-infi/whiteboard-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"rimraf": "^5.0.1",
|
|
40
40
|
"rollup": "^3.29.2",
|
|
41
41
|
"rollup-plugin-clean": "^1.0.0",
|
|
42
|
+
"rollup-plugin-copy": "3.5.0",
|
|
42
43
|
"rollup-plugin-dts": "^6.0.2",
|
|
43
44
|
"rollup-plugin-json": "^4.0.0",
|
|
44
45
|
"rollup-plugin-postcss": "^4.0.2",
|